z88dk-1.8.ds1/0000755000175000017500000000000010765235724012517 5ustar tygrystygrysz88dk-1.8.ds1/amigabuild.sh0000755000175000017500000000224007575171127015153 0ustar tygrystygrys#!/bin/sh # # # Bootstrap an amiga build from scratch, first build the unix system in # situ # # Start from scratch make clean Z80_OZFILES=`pwd`/lib/ ZCCCFG=`pwd`/lib/config/ export Z80_OZFILES export ZCCCFG CC=gcc CFLAGS="-g -O2" CCOPT=-DUNIX export CC export CFLAGS export CCOPT PATH=`pwd`/bin:$PATH export PATH make -e make -C `pwd`/libsrc make -C `pwd`/libsrc install # That's the unix part bootstrapped, now onto the Amiga #CC="dcc -unixrc" CC="m68k-amigaos-gcc -noixemul" CFLAGS="-g -O2" CCOPT=-DAMIGA DESTDIR=`pwd`/amiga/bin export CC export CFLAGS export CCOPT make -C `pwd` -e amiga cat > z88dk/bin/startzcc << EOD ; Set up of Z88DK for the Amiga ; 28/2/99 djm ; 26/4/99 djm Made Hopefully independent of where the thing is ; 8/12/02 djm Remove the annoying zlib: assign ;Root directory for everything - remember to change this if you move it! assign zcc: / ;Path to executables! path zcc:bin add ;Set some variables for z80asm (so it can find various files) setenv Z80_OZFILES zcc:lib/ ; Set the variable so ZCC knows where to find its config file setenv ZCCCFG zcc:lib/config/ EOD rm -fr `find z88dk -type d -name 'CVS'` lha a z88dk-amiga-1.5.lha z88dk/ z88dk-1.8.ds1/build.sh0000755000175000017500000000052410762270713014150 0ustar tygrystygrys#!/bin/sh # # # Build z88dk on unix systems # # Start from scratch #make clean mkdir bin PATH=`pwd`/bin:$PATH export PATH Z80_OZFILES=`pwd`/lib/ ZCCCFG=`pwd`/lib/config/ export Z80_OZFILES export ZCCCFG CC=gcc CFLAGS="-g -O2" CCOPT=-DUNIX export CC export CFLAGS export CCOPT make -e make -C `pwd`/libsrc make -C `pwd`/libsrc install z88dk-1.8.ds1/config.sh0000755000175000017500000000050610637517564014327 0ustar tygrystygrys#!/bin/sh # Some script hackery to allow global installs destdir=$1 default=$2 rm -f lib/config/*.cfg for file in `ls lib/config/*.lnx`; do dest=`echo $file | sed 's/\.lnx/\.cfg/g'` sed "s?DESTDIR\/?$destdir?g" < $file > $dest done if [ x$default != x ]; then cp lib/config/${default}.cfg lib/config/zcc.cfg fi z88dk-1.8.ds1/doc/0000755000175000017500000000000010765202715013256 5ustar tygrystygrysz88dk-1.8.ds1/doc/apps.html0000644000175000017500000003102007130401727015077 0ustar tygrystygrys Writing Z88 Applications

Writing Z88 Applications

Introduction

This document is under construction and hence might not make any sense - if you want to create a Z88 application it's probably a good idea to look in the examples/app/ directory to see how to do it

Lets be frank, unless you're Gunther (or some other deity) <grin> writing DORs is not fun, in fact almost impossible first time, then once you find a setup that works you constantly recycle the DOR for each application. I've been there, done that, given up, asked for help, got it and then recycled it, and here it is again in the kit!

One of the original aims of the Z88dk was to be able to create applications simply and easily without having to go into the messy bits of how to construct the DOR - simply give it your parameters and away it goes and creates it without you having to know whats going on.

Well, I've finally implemented it, hopefully in a non messy way within the limits the system, so read on, and find out how easy it is to create applications with the z88dk.

How to do it

For the creation of applications two header files are important: dor.h and application.h - both of these need to be included in order to construct the application DOR.

dor.h contains some constants for the application type and application.h uses these constants to construct the DOR, hence they should be included in this order. However! It's not as simple as that - application.h needs some information from you such as application name etc - there are defaults, but I don't think you'd want to use those!

The information is given courtesy of #define in between the including of dor.h and application.h, you should define the following:

#define HELP1   "..."
#define HELP2   "..."
#define HELP3   "..."
#define HELP4   "..."
#define HELP5   "..."
#define HELP6   "..."

The information for the application help page, if HELP1 is not defined then the standard HELP page is used <grin>, if any of the others (HELP2 to HELP6) is not defined then "" is substituted

#define APP_NAME "..."

The name of the application (as appears in the Index)

#define APP_KEY  '[KEY]'

The hotkey for the application

#define APP_INFO "..."

The equivalent of *name from BASIC

#define APP_TYPE [constants or'd together as from dor.def]

The application type, if you don't define this then the default type is bad with OZ preserving the screen (i.e. very, very bad!)

#define APP_TYPE2 [constants]

The application type byte 2 - specifies whether caps lock should be on or not.

All of the constants above are in z80asm format - not C style, so insert Z88 control sequences in the form ".." &blah &".." and not \[blah] or you might get a bit of suprise!

Extra Features

As I said above, the default application type is bad and to let OZ redraw the screen, this isn't particularly friendly as you can imagine so you can turn off the redraw screen flag by #define APP_TYPE yourself, this does however leave you with a bit of a problem - you won't be able to redraw your screen, so, to this end, I've provided an facility for you to be able to do it - simply have a function called redrawscreen which is defined thus:

void __APPFUNC__ redrawscreen() 
{
        /* Put some code here */
}

The __APPFUNC__ flag causes the flag DEFINED_[function] to be written to the zcc_opt.def file. This is then picked up by the startup code and appropriate code is generated to call this function - NB it won't automatically turn off OZ preservation of the screen. This __APPFUNC__ call could be applied to other functions to enable your code to take over error handling for example, however that isn't supported at the moment.

For an example of this see the examples/app/dstar.c demo.

Menus and Topics

[Or whatever the name is!] In a fit of conscience and against my better principles(!) I've implemented topics. They're fully implemented except for help pages (maybe coming soon!). This is where things get a little complicated, so listen up!

You are allowed up to 7 topics per application and 24 items within each topic (if you ever fit this many into an app please let me know!) you define a topic with #define TOPIC[num] "[name]". Each item under a topic is named via #define TOPIC[num]_[item], it's hotkey by #define TOP[num]_[item]KEY, code by #define TOPIC(...)CODE and its attribute (see dev notes and dor,h) by #define TOPIC(...)ATTR. But thats getting confusing, so have a look at the dstar.c example in examples/app to see what I mean.

Each topic and each command on a topic may have a help page attached to it, have a look at useless.c to see how it's done - remember don't specify so much help that it goes over the 8k limit or all hell will break loose (I'm sure you can live with that limitation!)

As an aside, topics also have an attribute byte, which can be defined by #define TOPIC[num]ATTR. All attributes can be left out in which case they default to 0.

In order to handle menu selections you should define a function thus:

void __APPFUNC__ handlecmds(int code)

Where code is the command code that has been selected. If you don't do this then you can't react to your menus!.

Bad, but not so bad Applications

If the amount of static variables used by your application is less than 8k (the minimum amount of bad memory that can be allocated) then give the flag -reqpag=num to the frontend where num is the number of 256 byte pages of bad memory required - the unused memory up to the 8k limit is given back to OZ on pre-emption. To find out what num is for your application look at the .opt/.asm file and search for DEFVARS and count the number of bytes there. Sorry, there is no foolproof way to do this automatically. For example the dstar.c program needs -reqpag=5 and rpn.c needs -reqpag=1. Remember that the startup code (maybe unnecessarily) reserves a byte at $2000 so add 1 to your variable count before dividing by 256!

Good Applications

It should in theory be possible to write good applicatons with the kit - simply don't use any static variables, supply the flag -reqpag=0 to the frontend and of course set the the appropriate APP_TYPE

I have placed all variables used by the startup code into safe workspace area to allow this facility - I reserve 50 bytes which is more than sufficient for our needs (we need 47 ATM) to allow for future expansion.

[Untested feature!!] If you're feeling particularly cocky, you can write good apps that have static variables...as long as you don't have too many of them that is. You can specify the flag -safedata=[n bytes] where n is the amount of static data that you want, this space is taken from the safe workspace, which remember is also shared by the stack, mail and other such things. A suppose a safe limit would be in the region of 500 bytes or so, but experiment, if you don't have arrays of local variables and no recursion you might be able to get away with more, as the saying goes, your mileage may vary!!

Changing the origin of the application

The default origin for an application is 49152 - this should give you plenty of space to do whatever you like, however, perhaps you want to slot it in elsewhere in an eprom - in this case use the -zorg= flag. NB. The application DOR created assumes that it is located in top top bank (63) of an EPROM cartridge, so unless you have a large application don't relocate it to < 49152 [This is to ensure that the application entry point is in segment 3 - the DOR contains a dummy startup which then jumps to the real start address.]

Using a Near Heap

Until the far routines and code are working properly it is possible to write applications which use the same malloc functions as for BASIC, however please define your heapsize thus (or strange things will happen!):

#include <malloc.h>

#define HPSIZE [size]
HEAPSIZE(HPSIZE)
#pragma set HEAPSIZE HPSIZE

#pragma set is a synonym for #define that gets passed through to the compiler (as opposed to being expanded out by the preprocessoe). When the time comes to write the zcc_opt.def file the compiler looks for the #define HEAPSIZE divides by 256 (for the number of pages) adds it to 32 (mininum size of bad memory) and writes this value to the zcc_opt.def file, this allows the DOR to be created requesting the correct amount of bad memory.

However, this can be a bit wasteful to say the least, say you only had 50 bytes of static variables and an 8k heap, the application would request 16k of bad memory when in fact it only needs 8448 bytes (to the nearest 256 byte page), so in this case supply the parameter -reqpag=33 and only 8448 bytes will be requested - smart eh?

Eventually the -reqpag= will enable unused memory in the 8k default bad memory to be returned to the system upon suspension, however in order to this elegantly and without too much unwieldy code this requires a couple of modifications to z80asm so that IF statements can evaluate expressions, since this mod hasn't be made yet, this feature isn't enabled - the compiler will reject any parameter which is less than 32 (and isn't 0

Sending/receiving mail

I've now implemented functions to allow passing and sending of mail between functions, the two functions are called: readmail and sendmail and both have the prototype (char *type, far char *info, int length). Don't worry about the far char * type - a near pointer (eg for local variables) is automatically extended to far when needed. For an example of the usage of readmail look at examples/app/viewer.c which is a simple text viewer which accepts the NAME type so to use it, select a file from the filer and switch to to the Textview popdown.

NB. To save heartache from typos (I'm a fine one to talk!) in the z88.h header file I've defined the two OZ supported mail types, these are FILEMAIL and DATEMAIL, use these instead of typing the character string yourself!

The program appmake

This is a quick knock up of a program which will generate bank images from an application binary - it creates the ROM header and the front DOR as appropriate, call it from the frontend using the -create-app flag at the same time as compile time. Internally it callocs 64k and then loads the appropriate addresses with the necessary information. It obtains information about the application from the z88_crt0.map and z88_crt0.sym files and as such should not be run alone.

The algorithm used to generate a Card ID is based on the time() function, I don't know whether this will be sufficient to guarantee exclusive-ness, but hopefully it will be sufficient - does anyone have a better algorithm for thus - rand() is useless since it isn't random - i.e. given the same seed it will of course generate the same random number - (It seem that picking up ROM values via the r register on the Z80 is more random!)

A few precautionary notes

Due to a small feechure in z80asm which causes DEFVARS -1 to be incorrectly resolved when linking object files, all assembling takes place at one time, this means that the -a flag is ineffective, and is equivalent to -c when the -create-app flag is supplied. So, as a result don't compile to object files then link - you'll trash the lower memory of the Z88! [Been there, done that!]

In summary

To create an application supply the following command line to zcc:

zcc -create-app -make-app [-reqpag=] [-zorg=] [libraries] [files]

After of course including dor.h and application.h in your application. The two flags -create-app and -make-app are needed so that the compiler doesn't become to specifically Z88 orientated - other Z80 machines might require different flags to the compiler in order to create a different type of executable, this way thinks are quite transparent and the zcc.cfg file doesn't become even more overloaded!!

If you wish to use graphic functions then you have to supply the application graphics library which is -lgfxapp - this pages the graphics page into the 16384 segment instead of the 49152 segment - I've taken the needed routines from standard.lib and placed them in gfx[app].lib due to a label clash with some of the standard.lib routines.

Enjoy making applications with Z88dk.


dom 10.4.99 z88dk-1.8.ds1/doc/compile.txt0000644000175000017500000001330107346211434015444 0ustar tygrystygrys$Id: compile.txt,v 1.2 2001/09/07 18:34:04 dom Exp $ ------------------------------------------------------------------------------- Compiling with the z88dk ; By Henk Poley ; 05-jun-2001 ------------------------------------------------------------------------------- general compilation command: zcc [flags] file(s) [+..] - Config file to load (must be the first argument) zcc.cfg is used by default. See below for the arguments. [-startup=..] - Startup header to use (see other docs for more information) [-l..] - Link this library (see below and in zcc.html) [-o..] - Binary output file (standard a.bin) file(s) - File(s) to compile Controlling steps of the compilation process: [-E] - Preprocess files only, leave output in .i file [-a] - Produce .asm (or .opt) file only (aka don't assemble) [-c] - Do not link object files [-make-lib] - Shortcut to generate .o files from library .c files [-m] - Generate .map files when assembling/linking (When compiling libs) Options to control the type code produced: [-O[0,1,2,3]] - Optimize compiler output (to .opt file) Can be either 0 (none) 1,2,3, level 2 is recommended. Level 3 is suitable for large programs (includes certain lib functions to reduce size of code(!)) [-cc] - Intersperse C code as comments in the assembler output, WARNING: this *will* clobber some optimizations. Options to control compiler functions: [-unsigned] - Implicitly define everything as unsigned unless explicitly told otherwise. (will optimize much better) [-smartpf] - Intelligent printf routine handling (see zcc.html for more info) [-no-smartpf] - Turn off the intelligent printf handling Z88 specific: [-create-app] - Create an application image (i.e. bank 63,62 etc) [-make-app] - (App) Notify the compiler that you're trying to make an application [-reqpag=..] - (App) Number of 256 byte pages required for bad application [-zorg=..] - (App) Origin for a Z88 application [-safedata=..] - (App) Amount of safedata required by your code [-defvars=..] - (App) Where static variables should be dropped (only valid for single file compilations, but see later) [-expandz88] - (App) Expanded z88 required [-no-expandz88] - (App) Expanded z88 not required (these two flags toggle some startup code to check for an expanded machine) [-startup=3] - Produce standalone code that can be run from a set address from BASIC. Use -zorg= to change the address [-R] - (Use with above) produces relocatable code that can be loaded into a DIM'd BASIC array. [-stackoffset] - Sets the stack offset for shared libs (see package.txt for details) Miscellaneous options: [-v] - Verbose - echo commands as they are executed [-vn] - Don't be verbose [-Wall] - Turn on all the compiler warnings [-Wnone] - Turn off all compiler warnings [-Wn[num]] - Turn off the compiler warning [num] [-W[num]] - Turn on the compiler warning [num] [-z80-verb] - Allow z80asm to be verbose, this tends to generate a lot of output to the screen so may not be desired. [-asxx] - Cause the compiler to emit asxx compatible code [-Cp..] - Pass an option through to the pre-processor [-Ca..] - Pass an option through to the assembler [-D, -I, -U] - are passed through to the preprocessor. Any unrecognised options are passed through to the compiler (to allow for improvements in the future.) ------------------------------------------------------------------------------- [+..] abc80 (ABC80) aceansi (Jupiter ACE, using VT-ANSI engine) cpm (CP/M) msx (MSX 1) mz (Sharp MZ) mzansi (Sharp MZ, using VT-ANSI) nc (Amstrad NC100) rex (REX 6000) sam (Sam Coupe) svi (Spectravideo SVI) m5 (SORD M5) ti82 (Ti82, using ROM text routines) ti82ansi (Ti82, using VT-ANSI) ti83 (Ti83 ...) ti83ansi (Ti83 ...) ti85 (Ti85 ...) ti85ansi (Ti85 ...) ti86 (Ti86 ...) ti86ansi (Ti86 ...) ti8x (Ti83+ ...) [ti8xansi] (Ti83+ ...) vz (VZ / Laser 200) vzansi (VZ / Laser 200, using VT-ANSI) z88 (Cambridge Z88) z88ansi (Cambridge Z88, using VT-ANSI) z88net (Cambridge Z88 with TCP/IP) zx (ZX Spectrum) zx81 (ZX 81) zx81ansi (ZX 81, using VT-ANSI) zxansi (ZX Spectrum, using VT-ANSI) ------------------------------------------------------------------------------- [-startup=..] See other documentation to learn what -startup is used for. Like: Ti.txt Compiling for the Ti82, Ti83(+), Ti85 and Ti86 ------------------------------------------------------------------------------- [-l..] farz88 (Z88 far support) gfx (Z88 BASIC graphics lib) gfxapp (Z88 application graphics lib) m (Generic math routines) malloc (Generic near malloc routine) mz (OZ's math routines) ndos (Fake file-routines, return errors only) net (Z88 socket routines for ZSock) netdev (Z88 socket routines for devices) p3 (+3 file support library) tigray82 (Ti82 graylib routines) tigray83 (Ti83 ...) tigray83p (Ti83+ ...) tigray85 (Ti85 ...) tigray86 (Ti86 ...) z88 (Some Z88 application routines, like mailboxing) z88dk-1.8.ds1/doc/copt.man0000644000175000017500000000446707130401727014727 0ustar tygrystygrys copt(1) copt(1) NNAAMMEE copt - peephole optimizer SSYYNNOOPPSSIISS ccoopptt _f_i_l_e ... DDEESSCCRRIIPPTTIIOONN _c_o_p_t is a general-purpose peephole optimizer. It reads code from its standard input and writes an improved ver- sion to its standard output. _c_o_p_t reads the named files for its optimizations, which are encoded as follows: ... = ... Pattern matching uses literal string comparison, with one exception: ``%%'' matches the ``%'' character, and ``%'' followed by a digit matches everything up to the next occurrence of the next pattern character, though all occurrences of %_n must denote the same string. For exam- ple, the pattern ``%1=%1.'' matches exactly those strings that begin with a string X, followed by a ``='' (the first), followed by a second occurrence of X, followed by a period. In this way, the input/output pattern mov $%1,r%2 mov *r%2,r%2 = mov %1,r%2 commands _c_o_p_t to replace runs like mov $_a,r3 mov *r3,r3 with mov _a,r3 Note that a tab or newline can terminate a %_n variable. _c_o_p_t compares each run of input patterns with the current input instruction and its predecessors. If no match is found, it advances to the next input instruction and tries again. Otherwise, it replaces the input instructions with the corresponding output patterns, pattern variables instantiated, and resumes its search with the _f_i_r_s_t instruction of the replacement. _c_o_p_t matches input pat- terns in reverse order to cascade optimizations without backing up. BBUUGGSS Errors in optimization files are always possible. 1 z88dk-1.8.ds1/doc/cpc.txt0000644000175000017500000000406507731051412014564 0ustar tygrystygrysNotes on the CPC target ======================= Loading Addresses ----------------- The code is compiled to address $6000 (24576), to run the code on a CPC you should do the following: MEMORY &5fff load "[filename]",&6000 call &6000 Floating Point Support ---------------------- The CPC target supports a native maths library, this is selected using the -lmz switch when compiling. The library that is linked in by default supports 3 models of CPC - CPC464, CPC664 and CPC6128. Should memory be in short supply and you wish to compile for a specific CPC then you can do the following: zcc +cpc [...] -lmz -l6128_math or -l664_math or -l664_math which will save about 600 bytes of memory. The native CPC library supports some additional functions, these are: void deg(); Switch the FP engine into degrees mode void rad(); Switch the FP engine into radians mode double pi(); Return the value of pi. double pow10(int x); Returns 10^x File IO Library --------------- Support for file IO on the CPC has been added. This uses the CAS_ interface and as such as the limitation that only 2 files may be open at a time - one for reading and one for writing. In addition due to the firmware implementation of these routines, a 2k buffer is required for both input and output. This buffer is statically built into the program. The following routines are not supported by the CPC fcntl library: ftell() fgetpos() fsetpos() rewind() fseek() creat() lseek() mkdir() getcwd() rmdir() getwd() Additionally, open() only supports the O_RDONLY and O_WRONLY flags. To link in the library supply the -lcpcfs flag to the compiler. If you do not require file IO in your program then supply the -lndos flag which links in a dummy stub library that simply returns errors. Application Creation -------------------- The appmake has been updated to support the CPC as a target. When compiling if you supply the -create-app flag then a file with the suffix .cpc is generated. This file contains a CPC disc file header which can then be easily transferred onto a CPC disc using cpcfs or a similar tool. z88dk-1.8.ds1/doc/dstar.gif0000644000175000017500000000331707130401726015061 0ustar tygrystygrysGIF87a,I8ͻ`(di%"R/:·,`0Fl18tɤңp%EdR͘j7ݸ3n=[f]7/ibwnlswXop}=S'{MnsXZU8Vb4`)Sg[FK#(ǀ̵}~ҡiQ5e׌TޒfЗͲ?u걜jkf`==% dlv_@UB\wxhW8>_2:%5 ͚/s2T!@*h*\%W!Kx4#rdV_`ÊK2!f)PRF,fDJ݋l^j(H^# <;7 } nx%֘sM&~[lXX(ڄ0lQhEűV5j?Ea rwveWaTwP8!@`q`G>]| VR:$DXȣtGwؗydihlp)tix|矀*蠄j衈&袌6裐F*餔Vj饘f馜v駠*ꨤjꩨꪬ䠟3}jg뮺*+%xV"ǞXl=+7N쐚&˶Uv/~+neeq9ˮFWk/֋KNR l0 py[1o1j2mk,,. ̠kÞg4 o6VR?gYq.z)/ˣȩQͯ5GY-r#2f H[$%7FuG|w'\rprY-Ob಍tϑZwyN6]W*固gÍx-sͤbzCnyuMsg{x /O4O;!N1_:+.z졓7ʳ\==6HnG۞Ktsox?֒rg;ؼU.kFYASw "J{p[4ԅAp}r\ǿ_ [aH Ã4`8(u. 9 @ zA4 N%3aC]SPXG@fFpj|@Cq+:Q{'|! %-un d/+I"$Y1Ʀ-# C0y䤉I)- 7"oC$)q^ϗuxb:pD191fkl վL)&Mi[I9}ӓD Nqs# 0y'6g}2X@'VfaB P:pERF z HGJҒ(MJWҖ0LgJӚ8ͩNwӞ@ PJԢHMRԦ:PTJժZXͪVծz` XJֲhMZֶp\皖RD;z88dk-1.8.ds1/doc/embedded.txt0000644000175000017500000000105507553527756015571 0ustar tygrystygrysThe embedded target (+embedded) has been supplied by Daniel Wallner and targets his Z80 core http://www.opencores.org/projects/t80/. "Console" Input and output is provided by a 16450 UART. It is important to initialise the UART at the start of your program, eg: #include #include "ns16450.h" int main() { init_uart(0,1); printf("Hello world!"); } Floating point is supported by this port, and some example are given in examples/embedded (NB. Many of these examples could be made to work on other z88dk targets with the minimum of hassle) z88dk-1.8.ds1/doc/enigma.gif0000644000175000017500000000136107130401726015201 0ustar tygrystygrysGIF87a,I8ͻ`(diRHrȉ&#_6Jy5 ?8юA&-'eU[#p:\^c;7O)᳥F{}e0klK^uUɊmaм݆.7ޱQխXr\ 5_Z8Crf B3㻈0JTⵌqh7= Sj!c8tɳϟ@ J' ?OSJWѫhjxfJIkQ`|i'4sԬ]Gp6}*aߓݽvdY*l޲E;]ќ9q\_CMӨS^ͺװc˞M۸sͻ Nȓ+_μУKNسkνËOӫ_Ͼ˟OϿ(h& 6F(Vhfv ($h(,0(4h8<@)DiH&L6PF)TViXf\v`)dihlp)tix|矀*蠄f;z88dk-1.8.ds1/doc/error.txt0000644000175000017500000001543707130401726015155 0ustar tygrystygrys Errors and Warnings Produced by the Small C+ Compiler ----------------------------------------------------- [Document under construction] The compiler has two ways of letting you know if something is either potentially, or is actually wrong with your code. To let you know of potential problems, or problems that it can usually overcome the compiler will emit a warning, if the problem is more serious and the compiler cannot overcome it an error will be emitted. The line between these two is fairly fuzzy, but given time (and this document!) I hope you'll discover what is important and what isn't. WARNINGS -------- #1 Too few arguments in function #2 Too many arguments in function call #3 Too many arguments in declaration Potentially a very big problem - have you remembered to prototype correctly? #4 Function returns different type to prototype #5 Prototype is %s #6 Function is %s These three warnings come together, another prototyping problem perhaps? Or have you called a function which doesn't return an int before declaring it? #7 Return type defaults to int This annoying can be very warning, to get round it explicitly say what your return type is during function declaration - old Small C programs will kick up loads of these. #8 Converting integer to pointer without cast #9 Converting pointer to integer without cast "Does exactly what is says on the can" #10 Equating of different signedness #11 Operation on different signedness! Both of these are a sign that there may be trouble ahead - be careful with your signedness! #12 Converting far ptr to near ptr Uh-oh, you *really* don't want to do this, information is lost and the pointer could end up being wild, you can get rid of it using a cast but are you really sure you want to do that? #13 Pointer/pointer type mismatch This occurs during functions calls if your pointer types aren't matched up - eg your function needs a pointer to int and you're supplying pointer to char - do take care! #14 Expected ',' #15 Expected '"' #16 Expected ''' (single ') #17 Expected ';' The last one isn't fatal, but the others possible are. #18 Unterminated assembler code Bung a #endasm in where it should've been in the first place! #19 Unknown #pragma directive You've either made a typo, or just ported some code across. #20 Far only applicable to pointers There's no such thing as a far [blah] it doesn't make sense, you have to point to any far data. #21 Initialisation too long, truncating! This is caused by supplying a string which is too long during definition of a character array with a finite size. #22 Bad variable declaration (void) Duh. #23 Static incompatible with register/auto What exactly did you mean here? #24 Cannot assign value to pointer This arrives during global initialisation - 0 is the only value to which you can assign a pointer to [During code anything goes, so maybe you want to try it then] #25 Illegal size of operation (on function) #26 Expected argument #27 Int constant in double expression #28 Getting value from void function I like explanatory error messages! #29 Compiler bug - code may not work properly #30 Fix soon hopefully! Next warning may be dubious! These should probably be disabled now - the code generated is perfectly fine - this is caused prompted by the address operator on an array in a struct accessed via a pointer (well, that's the only instance that I've found of it..) #31 Bitfields not supported by compiler Nice try They're parsed correctly but just default to ints instead of bits within an int - it's not worth implementing them IMHO - the space saved in storage is more than cancelled out than the code that would be required to handle them. #32 Division by zero, result set to be zero The code produced here isn't optimal, but the optimizer does its best to remove any wastage - check your code! #33 Call to function without prototype Do yerself a favour and prototype! #34 Func expects: %s" #35 Func gets: %s" #36 In function: %s() line %d" #37 Typedef doesn't support pointer types (sorry!) I am a lazy programmer! In theory typedef could support pointer types with no additional strain, however it's easier just to barf the warning at this point. Code is correctly parsed, but any use of the typedef results in use of the fundamental only. Various messages which provide further information.. ERRORS ------ #1 Unexpected end of file FATAL #2 Can't open zcc_opt.def file FATAL zcc_opt.def is a key file to the entire system - it's written to by the compiler to give instructions for assemble and linktime. #3 Can't nest include files FATAL #4 Can't open include file FATAL The built in pre-processor is in a word crap, you should never see these messages if you use the frontend #4 Input line too long Wow, that is an impressive macro - the line buffer is 1k! #5 Output file error FATAL Is your disc write protected? #6 Double literal space exhausted FATAL #7 Literal Queue Overflow FATAL #8 Staging buffer overflow FATAL #9 Macro table full FATAL #10 Global symbol table overflow FATAL #11 Local symbol table overflow FATAL #12 Structure member table overflow FATAL #13 Structure symbol table overflow FATAL You trying to compile emacs or sommat? Your program is too big - split it up into little chunks! #14 Indirection too deep FATAL Pointers to pointers to arrays are not permitted! #15 Negative Size Illegal An array definition with a negative index? #16 Not in switch #17 Too many cases #18 Multiple defaults #19 Too many active whiles FATAL #20 Out of context #21 Must assign to char pointer or array #22 Dodgy declaration (not pointer) Initialising a global pointer to function with a non pointer #23 Can't declare within switch FATAL #24 Must declare at start of block FATAL #25 Illegal Function or Declaration #26 Missing Open Parenthesis #27 Illegal Argument Name: %s #28 Incorrect number of arguments #29 Expected arguments #30 Out of data for struct initial.. FATAL #31 Already defined #32 Must be lvalue FATAL #33 Illegal address, #34 Can't subscript #35 Can't take member FATAL #36 Unknown member FATAL #37 Unknown struct FATAL #38 Illegal symbol name #39 Missing closing bracket #40 Missing token: %s #41 Unknown symbol: %s #42 Argument mismatch %s() Arg #%d: %s #43 Doesn't match original decl type: %s #44 Missing token, expecting %c got %c #45 Invalid Exponent #46 Floating Overflow #47 Invalid expression #48 Can't dereference #49 Operands must be int #50 Expecting constant expression #51 Enum name already used by another symbol #52 No matching #if z88dk-1.8.ds1/doc/faq.html0000644000175000017500000000727107130401726014715 0ustar tygrystygrys Answers to some (not so) Frequently Asked Questions

Some Answers...

..to some occasionally asked questions
  1. What's it all about
  2. Why bother with C
  3. I've discovered this bug...
  4. The examples don't compile properly
  5. How do I access memory directly

What's it all about

z88dk is a complete programming package originally designed to produce programs for the Cambridge Computers Ltd z88 computer. The z88 is a z80a based machine and was Sir Clive Sinclairs first (and last..) computer after selling Sinclair Research to Amstrad, for more details on the z88 see Z88 Forever

The package consists of a Small C+ compiler (much extended), a peephole optimizer an integrated assembler/linker and a front end to drive it all. There's also an additional support program to facilitate the easy building of z88 applications

The kit an be easily retargetted for other z80 based machines - in 5 minutes I had created some simple code to allow Spectrum programs to be produced.


Why bother with C

Well, for almost as long as I can remember people on c.s.s. have been going on about a C compiler, but no one has ever done anything about it (with the exception of John Elliot who created a wrapper for Hitech C), but that's not what this section is about....why bother with C..well:

  • Complex expressions can be easily and quickly written
  • Code can be easily ported from other machines
  • Your code is now portable across platforms
  • It's just quicker to write than the equivalent assembler

And lots of other reasons, I'm not going to lie, the code will be larger than hand coded assembler, but it will be so much easier to maintain, and will take far less time to write that it is worth it! [Not that I'm biased!]


I've discovered this bug...

Good! There's bound to be some, but are you sure it's not in your code? If not then test without optimization (use -O0) and it's still there try to isolate where it goes wrong - is it in the generated code, or is it in a library function? Let me know by sending me the C source, the assembler output and the optimizer output, and point out where it's going wrong as well. If it's in a library routine, can you come up with a fix for it?

Basically, if you've found a bug make sure you can reproduce it - how does it occur - does it pop up in any other place? Send me examples of it and it at all possible send me a fix! Basically send me as much information as you can.

On the other hand, if it's a bug in the assembler then read the z80asm.txt file in the doc directory for more details as to what to do with it!


I can't compile the examples

Only one thing to say here - are you supply the correct libraries? Anything that uses floating point needs to be linked with -lm (generic) for maths support. For the z88, anything that uses graphics needs to be linked with -lgfx. The README in each examples program tells you how to compile them.


How do I access memory directly

The compiler, sccz80, offers you several ways of accessing memory directly - you can cast a constant to a pointer to type and then dereference it (eg *(char *) 40000) or you can use the "external pointer" data type which is detailed in the main doc file.

z88dk-1.8.ds1/doc/far.html0000644000175000017500000001141407130401726014710 0ustar tygrystygrys Extended Memory Access for the Small C+ Compiler

More than 64k?

The Z80 processor is an old processor, and it's based on an even older one - the Intel 8080. These two processors are 8 bit accumulator based and can access an address space of 65536 bytes (or 64k).

Quite early on it was realised that this simply isn't enough address space to implement a comprehensive operating system and leave sufficient user RAM for their own programs.

The solution to this is quite straightforward, have more ROM/RAM in the system and page it in when required. This trick isn't just used on the Z80 but also for the 6500 series of processors from Motorola.

However, this isn't going to be a lecture on memory models and computer architecture (I'd end up in hot water for what I'd say, and probably will even for that small bit just there!) - it's a description of how the Small C+ compiler can access more than 64k and whats still left to do!

The far pointers used by Small C+ are 24 bits long i.e. 3 bytes, this enables the theoretical access of 16Mb of memory (if your program requires more than this then please tell me what you're trying to do on a Z80!). The far pointer allows for a flat memory model - i.e. they are treated as "normal" 24 bit number by the compiler.

Before I begin I should like to point out the for Small C+ far pointers are stored in the registers ehl where e contains bits 16-23 and hl bits 0-15 of the pointer. If e holds 0 then hl is taken to be an absolute address in the current memory configuration.

For this concept to work, it will be necessary to create an extremely well designed memory allocation system which will have to present in all programs that use far pointers.

Thus initially we need a malloc routine would far the prototype:

far *malloc(long)

Which would take a four byte integer, reserve this much space in the system, and return a pointer which would consist effectively of a memory pool number in e and 0 in hl. If enough space couldn't be reserved it should return with ehl=0.

Internally however it would have to create a memory pool within the Z88 and extend this until the size is that wished by the user. In returning a pointer in ehl it should internally bind whatever e is to the system memory pool (this maybe via a look up table or some other method) so that whenever access to the pool e is requested it can be calculated where exactly offset hl actually is.

I should obviously mention free which will free the memory pool e and deallocate all memory reserved by malloc. In addition to this there should be a cleanup function which will deallocate all the memory in all the memory pools. (This is an internal function and will be used by the startup code to clean up on exit of the program - and hence avoid leakage).

All access to the memory pools at C-level will be via a set of functions to read and write various types, which will now be described with entry parameters and projected exit conditions:

Reading routines, all these have entry ehl = memory pool address

lp_gchar   - read char

Exit:   a=l = byte at that location
h=0

This routine should not bother with signedness - the compiler will sort this out

lp_gint    - read 2 byte integer

Exit:   hl = word at that location (stored little endian)

lp_gptr

Exit:  ehl = far pointer at that location

lp_glong        - read 4 byte integer

Exit: dehl = long at that location (l=LSB)

lp_gdoub        - read 6 byte double

Exit: Load FA -> FA+5 with the double stored at that location

FA -> FA+5 are 6 bytes presently located in the startup code, but will be relocated to the bad memory for applications. This routine may require some thought - there is a routine in the float package to place bcixde into the FA area.

Writing routines, all these have entry e'h'l' = memory pool address and the following additional entry parameters:

lp_pchar        - write char

Entry:     l = byte to write

lp_pint         - write 2 byte integer

Entry:    hl = word to write

lp_pptr         - write far pointer

Entry:   ehl = far pointer to write

lp_plong        - write 4 byte integer

Entry:  dehl = long to write

lp_pdoub        - write double

Entry:  none

This routine will write the bytes stored in FA -> FA+5 to the memory pool address, once again this may require some thought.


These routines have now been written by Garry Lancaster for the z88 and so this document is just hanging around should someone feel like writing routines for other machines.


Dom 16/4/2000 z88dk-1.8.ds1/doc/farmods.txt0000644000175000017500000000215007130401727015444 0ustar tygrystygrysThe addition of working far pointers has neccessitated a few changes in the z88 library - a few routines have lost their far ability (though since they weren't used with this in the first place this is no loss), these routines are: readmail sendmail remove In contrast, fopen/open/wcopen now fully understand far pointers for a filename specification and will not blink if you supply one. This is achieved by copying the string down into near memory and rewriting the address supplied to the gn_opf routine so that it points to this near copy. This approach is taken (as opposed to rewriting a C far ptr to and OZ far ptr due to the fact that a string may in actual fact be spread across any number of pages or banks. This happens tranparently and you have no need to worry about it. Should you wish to write library routines which utilise far pointers take a look at open_z88 in fcntl/z88 which is a commented implementation. It should be noted that since far data cannot be used with BASIC programs for a basic program fopen etc do not comprehend far pointers and the chances are that the opening the file would fail. z88dk-1.8.ds1/doc/farz88.html0000644000175000017500000002222307130401727015263 0ustar tygrystygrys Z88 Far Memory access with z88dk

Z88 Far Memory

Far memory routines have now been implemented in z88dk for the Z88. This document describes how you can write C programs using these routines, and also gives details of how the scheme is implemented for anyone interested.

The document is divided into the following sections:


Overview & Limitations

The Z88 far memory model used by the Z88 Development Kit uses a 3-byte far pointer size. Near pointers can easily be cast as far pointers, so it is easy to write programs using a mixture of near and far memory. It is obviously not possible to cast far pointers as near pointers, however.

There is no limit to the size of the far memory heap (other than the 4Mb limit imposed by the Z88 architecture!), and allocations of any size can be made, provided your heap is large enough and the host Z88 has sufficient RAM available. Very large heaps will require more of your bad application RAM to be reserved for memory management, however, and full details of this are given in the next section.

The far memory model is only supported by the application target type in Small C; so it is not possible to write programs running under BASIC using far data. Due to the memory overheads required by the allocation routines (see implementation details if you're interested), any application which uses this model will be bad.

Packages may use far pointers as parameters passed to them by applications, but since each application has its own far heap managed through its static workspace, the following limitations apply:

  • the far pointer may only be used while the process to which it belongs is active
  • far pointers may not be passed from one process to another

Using far memory in Z88 applications

Compiler Directives

Using the far memory allocation words in your Z88 applications is quite straightforward. Firstly, you must signal that you will be using the far memory functions with the following line:

  #define FARDATA 1

This line should be before any includes, as the standard library header files use it to determine whether to make far memory versions of the library functions available.

Secondly, specify the size of the far heap your application requires with a line as follows:

  #pragma -farheap=65536

The above line gives a heapsize of 64K. You can specify any size up to a maximum of 4194304 (4Mb). Bear in mind the following points:

  • memory is not actually reserved in the Z88 until it is allocated with the malloc function, so you can specify a large heapsize without worrying that your application is "wasting" large amounts of the Z88s memory
  • the amount of bad application memory (or static workspace) required by the allocation system is equal to (HEAPSIZE/128)+487 bytes, where HEAPSIZE is the maximum heap size in bytes

For example, if you have a maximum heapsize of 65536 bytes, the amount of static workspace used will be 999 bytes. A 4Mb heap would require about 32.5K of static workspace!

Allocating and using far memory

Within your C application, you can now use the following functions:

far *malloc(long size)
Returns a far pointer to a region of memory "size" bytes in size
void free(far *ptr)
Free the previously allocated region of memory at "ptr"
void freeall(void)
Frees all allocated memory (this is done automatically when applications are terminated)

You can use various string functions on far memory pointers; where functions take two parameters, you can also provide near pointers as parameters (remembering to cast them as far!) The following functions are currently available for far pointers: strchr, strrchr, strcpy, strncpy, strcat, strncat, strlen, strlwr, strupr.

For more information, take a look at the example in examples/app/farmall/.


Implementation details

Knowledge of the way far memory is implemented on the Z88 may be helpful to anyone wishing to write a similar library for another machine, or for those hoping to port the method to their own (non-C) environment.

Also, if you are planning to rewrite the Z88 operating system (!) or replace any of the memory-allocation calls using the pkg_ozcr call, you should take careful note of the assumptions I have made here, and try not to break them ;-)

Note that all the assumptions made below are true for all versions of OZ up to and including v4.0

Memory overheads

Whenever far memory support is required in an application, a certain amount of bad application workspace is automatically reserved. This consists of:

pool_table (224 bytes)
Used to hold memory pool handles allocated by OZ
copybuff (258 bytes)
Used by some library routines as a temporary buffer for OZ calls that use strings (this is not used internally by memory allocation routines, and will not be considered further)
malloc_table (2 bytes for every 256 bytes required in the far heap)
The most important structure, holding details of the bank and address of each 256-byte allocation in the heap

The pool table

This structure, as noted above, is used to hold the pool handles that have been opened by the application. Initially, it is filled with nulls, indicating that no pools are open.

This is a table of 1-byte entries, each corresponding to a bank in the Z88's memory map. As banks 0-31 are always ROM (internal), the first entry corresponds to bank 32, with the final entry corresponding to bank 255. Each entry holds either 0 (indicating no pool open for that bank), or a value which relates directly to the pool handle returned by OZ for that bank.

Three important assumptions are made when constructing and using this table:

  • each OZ pool handle always gives allocations from the same bank; when the bank is exhausted, no further allocations are possible with the handle
  • as a consequence, for each process, only one pool handle is ever associated with a particular bank
  • the values of OZ pool handles are always of the form $0XY0, where $XY!=$00

The first two assumptions mean that we only need 224 table entries (one for each bank) no matter how much memory we allocate. The last assumption means that each entry only needs to be one byte in size (we shift the handle value 4 bits to the right), and a zero value can indicate no pool.

The malloc table

Each entry in the malloc table consists of two bytes, and corresponds to an allocation of 256 bytes of far memory.

The first byte contains the bank number containing the allocation (0 indicates no allocation has been made for this entry), and the second byte contains the high byte of the address of the memory allocation (always in segment 1).

The low byte of the address is not required, since for allocations of 256 bytes, OZ always returns an address with a low byte of zero; thus this is always assumed.

Allocation method

The first stage in memory allocation is to locate a section of the malloc table which has not yet been allocated (ie contains nulls) and which is large enough for the required allocation. An extra 2 bytes are always added to the amount of memory required, to hold the number of pages (256-byte allocations) in the allocated block.

When a suitable region has been located (malloc always uses the smallest suitable region), we start making allocations and filling the malloc table. This is done as follows:

  • first, existing pools in the pool table are checked, and allocations made from these
  • if all existing pools are exhausted, new pools are opened and allocations made from these

If all pools are exhausted and no further ones can be opened before all memory is allocated, the memory allocated so far is freed, and malloc returns an error.

Once the allocations are completed, the number of 256-byte pages used is stored in the first two bytes, and a far pointer following this value is returned.

Deallocation method

Deallocating is much more straightforward. The pointer is decremented twice, and the value fetched is thus the number of 256-byte pages that were allocated.

A loop is entered which frees each 256-byte allocation, and zeros the corresponding entry in the malloc table.

Note that no pool handles are freed during this process, but they become usable again when further mallocs are performed. All handles in the pool table are freed by the freeall function, which is automatically called on exit from the application.


Garry Lancaster, 18/4/00
z88dk-1.8.ds1/doc/fileio.txt0000644000175000017500000000241707273751461015301 0ustar tygrystygrysFile I/O and z88dk ------------------ Many machines supported by z88dk support multiple types of disc system, for this reason it is desirable to make it as easy as possible to switch between them. To this end, the file libraries for certain targets have now been separated out from the main machine library and located in separate libraries. The routines which gave been isolated are: close creat fdgetpos ftell lseek open open_z88 read readbyte remove rename write writebyte Which are all the routines required to enable file i/o. A dummy library called ndos.lib has been created which contains minimal stubs for these routines which simply return an error value. Unfortunately, this means that if you don't require file i/o you have to supply an extra parameter for the compile, but I believe the flexibility of being able to switch between different DOS systems is worthwhile. So far, a file library has only been prepared for one system besides the z88 (whose file i/o routines remain integrated) and that is for the Spectrum. Spectrum: A file i/o library has been prepared for the +3, this hasn't been tested but it should just work! To use it compile thusly: zcc +zx -DPLUS3 [files] -lp3 To compile with no/dummy file io routines use: zcc +zx [files] -lndos In future z88dk-1.8.ds1/doc/history.html0000644000175000017500000005031007130401726015637 0ustar tygrystygrys Z88 Development Kit History File

Z88 Development Kit

There seems to be little point carrying on with this file since the history is really contained in the "Whats New?" section, this file will continue to grow when I move old "What's New?" over to here.

Some past history

This is getting quite long, hence the re-location into a separate file where I can rabbit on about the changes I made to my hearts content!

As a recap on the versions between v0.66 of the compiler and whatever the last release beneath was (v0.55?) here are the important new features:

  • Initialising xx *[]= { ,,, } types now works properly
  • Auto variables can be initialised
  • sizeof() now works on structure members
  • Casts now slightly more cast like
  • goto now works a lot better than before
  • Octal constants are now understood
  • Bug fixes (lots!)
  • Optimisatioin rules (lots!)
  • More lib functions

New for v1.2 on v1.1 are the following features:

  • Menus and topics (v1.1p2)
  • Help for menus and topics (v1.1p3)
  • Reduction of startup codesize for good apps (v1.1p4)
  • Application Mailboxing (v1.1p4)
  • Exit function rewritten to return exit code (eg for displaying of error box for z88 apps)
  • Corrected bug in prototyping which could produce spurious errors (v1.1p4)
  • More example apps (v1.1p3,v1.1p4)
  • Even more optimization rules <grin>
  • Support for new z80asm v1.0.10 features (this version is the minimum supported!)
  • New mini(f)printf functions which are automagically utilised (you can of course use them explicitly!)
  • fcntl.h library routines
  • static [type] outside of function or in function definition correctly limits the scope
  • ...details on the changes for a particular patch can always be found in the readme.1st file in the root directory

New for v1.1 of Z88dk (sccz80 v0.55) are the following features:

  • Z88 applications can now be created!
  • \n is now correctly interpreted by the library routines - no need for \l anymore
  • enums are implemented
  • typedef is now accepted (kept as a storage class)
  • Casts are now implemented
  • Improved error/warning messages and handling
  • Fixed ? operator - sometimes it would test for longs instead of for ints (operator to the left of ? is always evaluated as an int)
  • Code generated for far access should be a lot better (ie work!) [store entry methods may still change]
  • Improved frontend and the ability to link libraries in easily
  • Improved ability to retarget compiler for other Z80 systems
  • Yeah, you guessed, more optimization rules!

New for v0.52 of the compiler are the following features:

  • Assembler Macros using the asm() construct
  • String concatenation (for string constants)
  • Ability to initialise global (*func)() types
  • Sizeof now works on all variables
  • Even more correct prototypes!
  • Correct initialisation of intialised local statics
  • Fixed long constant loading (I broke it last time!)
  • Added new library functions for unsigned >> ops
  • Lots of little things changed, code tidied up etc
  • Yup, more optimization rules, and fixed a bug in them which could crash copt if it was feeling awkward
  • -lmz flag for zcc to automagically use Z88math
  • WarpUp binaries for sccz80, copt, zcpp

New for v0.49 of the compiler are the following features:

  • Proper function prototyping
  • ANSI style function definitios
  • Type checking on function calls (if prototyped) and promotion as necessary
  • More rigorous type conversion in general
  • Initialisation of local statics (except for doubles)
  • Correct initialisation of char arrays in structs
  • Use of the literal queue for char *ptr="[text]"; (previously initialisation was achieved via a ASMPC+2 style construct)
  • Ability to do sizeof() of const char string eg sizeof("fish")
  • Type specifiers LUS for numeric constants
  • Redirectable stdin, stdout, stderr
  • Fixed feof(),getc(), added ftell(),getpos(),gets(),putc()
  • More optimization rules (including a speed(!) one!)
  • Rejigged front end allowing easy retargetting of the compiler for other Z80 machines
  • Hopefully memory leak free WinSucks version
  • Z80asm v1.0.5

Release v0.52 22/3/99

Does anyone actually read this file? Anyway, I've had enough of this compiler for the moment so this is the first Aminet version (no doubt to be followed by another later this week!) Lots of fixes in this release and a couple of extensions as well, but if you've read the docs you'll know that of course!


Pre-release v0.51 18/3/99

This is just getting silly! Everytime I say I want to release it I go through a spurt of adding new features, new this time are:

  • Correct initialisation of local statics (oops, forgot to give the size to the initials function!)
  • Ability to set pointers to functions equal to a function name in static declarations
  • Sizeof now works on all variables (except for those passed to a function and obviously kicks up a fuss about functions!)
  • What, you want more, do you really want my blood?
  • Okay then...fixed the string.h file - missing comma!
  • Just for you...another optimization rule

Pre-release v0.50 17/3/99

Corrected a few silly problems with function return values (prototyping), killed a silly error, added the -Wnone flag.


Pre-release v0.49 16/3/99

Hopefully the same as v0.48d?


Pre-release v0.48[a-e] 5-14/3/99

Internal release. This version saw a substantial rejigging of the compiler code to allow almost error free compilation - gcc -Wall is now without errors (I'm not going to bother with -pedantic!) Several annoying bugs which only showed up on Linux were fixed. Memory leaks on Winblows were sorted out (sassen frassen). Full prototypes make their appearance for the first time in Small C (is it right to call it Small C anymore?)


Pre-release v0.47 3/3/99

Internal bug fix release only


Pre-release v0.46 2/3/99

zcc Added provison for a second layer of optimization and a few other tweaks. Sorted out a few problems which would have arisen in multi-module programs which used floating point operations. Also allowed the order of input files to be irrelevant (previously the file with main() had to be the first in the list.

copt Second rule file for optimization of logical operations on unsigned chars as well as a few other simple optimizations.

sccz80 Fixed lots of bugs in cc6.c regarding calling of long functions (mainly missed out else statements!), squashed bugs in +/- calling for long functions (stack was not being equalised correctly), sorted out the widenlong() function in cc5.c so that chars/ints are correctly extended to longs (regardless of sign). Sorted out representation of negative long constants, countless other bug fixes to long routines.

Improved the handling of -no-header (this is used to compile library sources which are in C) so now it does something useful. It's also now possible to overwrite library functions for a particular program (in principle at least) - though are you sure you want to do this?

library Almost completely rewritten the library routines for long - there were so many silly mistakes here it amazes me that no one actually spotted them, I've extensively tested them, and am fairly confident that they all work now. Some sample problems that I came across l_long_sub calculated b-a instead of a-b l_long_inc/dec were completely fubarred. Comparison routines were complete nonsense (some more so than others) - mostly due to the l_long_sub bug/feature <grin>. In summary it transpires that what with bugs in the compiler and in the libraries that any code utilising longs would never have worked.

There's also lots of new string functions as well as some new ctype functions. Also all new is a malloc() system.


Pre-release v0.45 ??/2/99

This release only got as far as Dennis, it's the release that first saw the introduction of the config file for zcc.


Pre-release v0.44 19/1/99

I hope you all had a good holiday season and are ready to start attempting to trip the compiler up once more!

A new frontend with this edition, and at last meaningful flags for the compiler. Also new is support for Z88 maths routines - there is something fishy somewhere in the code though - the cube.c example refuses to work correctly and I'm baffled!

Fixed a problem with #pragma asm/endasm statements - they weren't being parsed correctly.


Pre-release v0.43 2/12/98

A bit of a little bug fix release really, I noticed a few problems with the generated code and though I'd better fix them sharpish (The classic one is of course getting the size of integer incorrect!). There's also a new demo program - Dstarz88


Pre-release v0.42 29/11/98

Far pointers have been implemented, hopefully correctly, declare as you would a normal pointer but prefix by "far". No support routines have been written for them, so nothing will compile if you use them , but have a look at the assembler file and see whether it is as you would expect it to be. [See far.html for descriptions of the proposed routines!]

I've also done a bit of fixing up of longs, so now you can set them equal to a constant correctly! And finally, yes I know I've been saying it for the past x releases, but longs should work properly know - I've fixed up long comparisions in if statements, and it's also possible to switch via a long (untested!). Also added is a lot of type-checking so that you get warnings if you try to equate/do arithmetic on different signed values (obviously not applicable for +/-). This behaviour isn't ANSI atm, in the future I'll fix it so promotion to unsigned takes place. Also, warnings pop up if you do int<->ptr conversions - it's not really a good idea to do these sort of things if you want your code to be portable! [Code will still be generated, but side effects might occur!]

Fixed the "bug" in the 16 bit divide routines - I got the input parameters the wrong way round, an ex de,hl solves all! Did a small mod in crt0/l_mult to change rl a to rla (DLE).


Pre-release v0.41 17/11/98

This and v0.40 were released concurrently, this version adds literal queue compression to save memory in the resulting executable - it works remarkable well and saves almost 180 bytes in the cube demo, in programs with lots of text even more should be saved.


Pre-release v0.40 16/11/98

Another long pause However, to make it worth your while I've come back with a cracker - hopefully longs will now be functioning correctly. I've changed the manner in which they were stored when calling library functions - now like doubles they are stored on the stack instead of in the alternate registers, this makes for much nicer code that will work as opposed to code that might work! To celebrate this I've written 32 bit multiplication and division routines!

Also rewritten are the 16 bit multiply and divide routines (they're now a little small and hopefully faster), and I've finally got the (l)abs routines right..or at least I hope so!

Labels in the compiler are now prefixed by a smc_ to avoid potential label clashes with routines in the library. A little bit more work has be done on long pointers though they still won't work! [I'm gonna hate sorting that out!]

Barring any major hiccups I think the compiler is almost ready for its first public release, any comments?


Pre-release v0.39 20/10/98

Apologies for the long delay in releasing this - I've been kinda tied up with other things of late! Anyway, it's now here and the compiler now fixes a few things like signed chars (dumb mistake by me) and the initialisation of aggregates.

In the library functions it's been big change time - the graphic functions have been rewritten so that they page in the map bank each time (previously it was (rather sloppily!)) just left paged in permanently. As predicted this caused a "few" problems! There's an integer printf function - use only if absolutely necessary - even after serious hand optimization (It took a whole evening!!) it still weighs in at around 2k. The exit() function has been rewritten to cope with the atexit() function which someone might possibly care to use. More serious problems are avoided by insertion of the correct case/switch function! Ooops, that one was hanging around waiting to clobber people!


Pre-release v0.38 8/10/98

Implemented the local static variable storage class and fixed a few minor problems in sccz80 with filenames, removed some obsolete code, removed the prototypes for malloc and exit from ccfunc.h and included stdlib.h where appropriate.

Corrected the strings.h include file and altered the strncmp() library function to be more efficient and smaller (DLE), found the minusfa fp routine and put it in mathsupp/ along with odd. Altered the double <= function so it has the label dleq so to avoid clash with a defc in cntlchar.def - hopefully fp programs will now compile?


Pre-release v0.37 6/10/98

The last two releases never got very far due to problems with prototyping. This new release fixes those, and adds another batch of library functions - investigate the headers for more details!

This release is only supplied as a complete archive because I've completely reorganised the libsrc/ directory and added several new files - it's much easier to start again that to create a set of patch distributions!

Hopefully I've finally(!) fully implemented unsigned datatypes - they are now scanned for in function definitions, also a bare unsigned results in an unsigned int being produced. Removed the int and word datatypes - silly! In the source code spent a lot of time prototyping certain functions to knock some warnings off a -Wall compilation.



Allowed for longer include filenames than 16! This also prevents possible segmentation faults - which solves the Amiga "gcc" problem and quite a few others I imagine as well!

The keywords register and auto are parsed for in statement() though they are silently ignored.

There's a very big bugfix for this release, dereferencing of pointers are now resolved correctly and generate good code - this was broken since v0.33 and was due to the incorrect assignment of one variable in the primary() function. This took me about 4 hours to track down and correct! Many thanks to David Earlam for putting me onto the trail for this one.

There's also another optimization rule which optimizes some more of the structure referencing code.


Pre-release v0.36 29/9/98

sccz80 Pesky prototypes again, now they're done with #pragma proto and #pragma unproto, these will now work with the Borland pp.

Hopefully sorted out the gcc crash problem, this was due to not checking whether a pointer to struct was set or not, if unset the compiler tried to reference an address in low memory and this seems to have upset the memory protection agent, though why it should also do this on the Amiga which has no memory protection is a tad strange.

Implemented Dennis' startup code so a BASIC program is generated which contains the compiled code as well making life that little bit easier!

Added a couple more optimizing rules.


Pre-release v0.35 28/9/98

sccz80 (Almost) ANSI function definitions have been implemented. Fixed the distinguishing of prototypes by implementing #proto/#unproto. The previous fix used #defines which were swallowed by the preprocessor.

Fixed a problem that arose after v0.32 due to over-zealous use of the delete line key!


Pre-release v0.34 22/9/98

sccz80 Made the error messages much more legible (i.e. ala Dice), corrected a nasty hang which could result if a symbol wasn't found by end of file, made the differentiation between library functions and external functions in other modules.

Includes Implemented the slightly kludgey (but it works!) way of ensuring that prototypes here do reference the library functions.


Pre-release v0.33 14/9/98

sccz80 Implemented the long data type and the associated libraries.


Pre-release v0.32 12-13/9/98

sccz80 Changed the maximum line length to 192 (so as to get enigma_sc to compile!), and altered the assembler label length from 8 to 32.

The big modification is the use of the signed and unsigned keywords - this actually affects the code being produced and hence should work! A small warning (which I shouldn't really need to state :) is that don't try doing functions on combinations of the two, really weird things will result otherwise!

Libraries Corrected a few label problems in the l_mul and l_lt library functions.

Optimizer Put some of the rules in the correct order so that they don't prevent other optimizations being made.

zcc New pass through to the compiler for -e (stop on errors) and -f (implicitly define all ints and chars as unsigned.)

Startup code Installs a simple error handler which will trap escapes to stop those annoying hangs. Pressing escape will abort the program (much like Ctrl+C does on other computers).


Pre-release v0.31 8/9/98

sccz80 Corrected a few problems in the definition of extern and static variables (assembler output) - programs should now compile and execute correctly!

Restored the data type of external pointer (lost in the conversion over to Small C+). Allowed the explicit use of static for global variables. Created a fake data size of void (which is effectively int) for functions, thus allowing more code to compile with fewer changes.

zcc Allowed passing of -A flag to the compiler


Pre-release v0.3 6/9/98

The most important change is that to the Small-C+ compiler which has more features than the original Small-C and will allow the compilation of many more programs.

Have moved all of the runtime functions previously held in z88_crt0.asm into library functions so will only be linked in if needed, this has a dramatic effect at reducing the size of the produced binaries. Hopefully all the cross references have been resolved correctly.


Pre-release v0.2 August 1998

Added a lot of untested library functions, and a driver.


Pre-release v0.1 August 1998

First release of the Z80 compatible Small-C compiler based on the zcc v0.96 sources by Ken Yap. Very minimal, just enough to compile Hello World.


Back to main doc file z88dk-1.8.ds1/doc/interrupts.txt0000644000175000017500000001203010416272011016217 0ustar tygrystygrys INTERRUPTS IN Z88DK The z80 supports three interrupt modes: IM0, IM1 and IM2. 1. IM 0 - The Forgotten Mode IM0 is the least used mode and is mainly there for 8080 compatibility. In this mode an interrupting peripheral supplies an instruction to execute when the interrupt is acknowledged. That instruction is typically a single-byte "RST n" which effectively causes a subroutine call to one of eight fixed entry points in the first 256 bytes of memory. A pro for this mode of operation is the quick interrupt response since the interrupt service routine for up to eight different peripherals is directly jumped to right away. There is no direct support for this mode under z88dk but it is a simple matter to assemble a 3-byte JP instruction at these entry points to cause a jump to an ISR of your creation. One or more copies of the generic ISR described below can be used to handle the interrupts. 2. IM 1 - Keep It Simple IM1 is more commonly used. In this mode, an interrupt causes a jump to address 0x38. Typically the interrupt service routine there might poll attached peripherals to determine which need servicing. If only a single device or two can cause interrupts this might be acceptable. Again, There is no direct support for this mode under z88dk but it is a simple matter to assemble a 3-byte JP instruction at 0x38 to cause a jump to an ISR of your creation. The generic ISR described below can be used to handle the interrupt. 3. IM 2 - The Sexy Mode IM2 is the most powerful interrupt mode. In this mode an interrupting peripheral supplies a single-byte vector when the interrupt is acknowledged. The contents of the I register is concatenated with this vector byte (with I most significant) forming a 16-bit address where the address of the interrupt service routine to jump to is stored. Effectively register I*256 points at a 256 byte table of interrupt service routine addresses. By convention (and convention only since this seems to be frequently violated) vectors supplied by interrupting peripherals are even. This ensures that interrupt service routine addresses do not overlap in the table pointed at by register I. In particular, it is worthwhile noting that Zilog's peripheral chips can only store even vectors and therefore reset bit 0 of vectors written to them automatically. This means that normally only even vectors 0-254 can be generated by peripherals making the table pointed to by register I exactly 256 bytes long and fitting nicely into a single 256-byte page. However in the real world, some peripherals can generate odd vectors, including 255 meaning the vector table could be 257 bytes long and may (without care) have overlapping entries due to the mix of odd and even vectors generated by attached peripherals. z88dk supplies an im2 library; consult the header file im2.h for function prototypes in the library. To use the library you must first declare the location of the 256(257) byte interrupt vector table as described in the header file. im2_Init() is called to initialize im2 mode. This call will create the im2 vector table, set im2 mode, and allow you to choose between a conventional 256 byte table or the less conventional 257 byte variant. Each vector entry will point at a default interrupt service routine that you pass in as parameter; this can be a C function or an absolute memory address. Typical interrupt service routines can be installed on any vector with im2_InstallISR(). This can be the address of a C function, assembly function or absolute memory address. Any such interrupt routine must save and restore registers as well as reenable interrupts prior to a "reti" to return from interrupt. If the function registered is a C function this must be done with embedded assembler. The library also supplies a Generic Interrupt Service Routine. This is an ISR that can be installed on any vector with im2_InstallISR() as any typical ISR is. The difference is that this ISR can have any number of hooks registered with it. Each hook will be executed one after the other on interrupt. Should any hook return with the carry flag set, succeeding hooks will not be run. The ISR itself will take care of saving and restoring registers as well as reenabling interrupts so any hooks registered with it do not need to worry about those details. This model is the usual model used when several peripherals could supply the same vector, but can also be used to register plain C ISRs without their having to worry about the low-level housekeeping associated with ISRs. To create a generic ISR, it must be copied into RAM. This is done with im2_CreateGenericISR(). Any number of independent generic ISRs can be created in this manner and can be registered on one or more interrupt vectors with im2_InstallISR(). When making changes to the z80's interrupt state whether using im2.lib or not, make sure to have interrupts disabled using some inline assembler. Im2.lib will not enable or reenable maskable interrupts so as not to interfere with the program. Further questions can be answered on the z88dk users mailing list. - aralbrec 04.2006 z88dk-1.8.ds1/doc/lib3d.txt0000755000175000017500000000565710021135454015022 0ustar tygrystygrys------------------------- 3D Libraries (2/15/2002) Doc taken from the OZ Developement kit. See section III for Credits on this file and on the whole library $Id: lib3d.txt,v 1.3 2004/03/02 16:49:48 stefano Exp $ ------------------------- TOC I. Introduction II. Reference III. Credits/Acknowledgements IV. Links I. Introduction ---------------- The 3D Libraries include a standard set of functions for making your own 3D functions. This document is a reference for these functions. II. Reference -------------- The following is a reference for the available functions in lib3d.lib. Please note that you will have to include "lib3d.h" in order to use these functions in your code. void ozrotatepointx(Vector_t *v, int rot) void ozrotatepointy(Vector_t *v, int rot) void ozrotatepointz(Vector_t *v, int rot) Use these functions to rotate a vector around the origin. The variable 'rot' is the rotation factor in degrees (?), not radians (? p 180). Note: Do not rotate the original coordinates! This will distort an object after a few times of use. Use ozcopyvector() to first copy the coordinates into a temporary variable and rotate them there. Example: ... Vector_t v; ... v.x = 10; v.y = 10; v.z = 10; ozrotatepointx(&v, 90); ozrotatepointy(&v, 90); ozrotatepointz(&v, 90); ... void ozcopyvector(Vector_t *dest, Vector_t *src) This function copies a vector's X, Y, and Z coordinates from *src to *dest. Example: ... Vector_t v1; Vector_t v2; ... ozcopyvector(&v2, &v1); ... void oztranslatevector(Vector_t *v, Vector_t *offset) Offset a vector by using this function. It will add the X, Y and Z coordinates from *offset to *v. Example: ... Vector_t v1; Vector_t v2; ... oztranslatevector(&v2, &v1); ... void ozplotpointcam(Vector_t *v, Cam_t *c, Point_t *p) This function will convert 3D vectors (X, Y, Z) into 2D Points (X, Y). This will even compensate for camera's position and angle. If you do not wish to use a camera in your program, use ozplotpoint() instead (see next function.) Example: ... Vector_t v; Point_t p; Cam_t mycam; ... ozplotpointcam(&v, &mycam, &p); ... void ozplotpoint(Vector_t *v, Point_t *p) This function converts 3D vectors to 2D points without compensating for camera's position, thus it is much faster. Example: ... Vector_t v; Point_t p; ... ozplotpointcam(&v, &p); ... III. Credits/Acknowledgements 3D Libraries Copyright 2002, Mark Hamilton Jr. Vector rotation optimizations performed by Lawrence Chitty. Wonderful Sine and Cosine enhancements done by Alexander Pruss. Many thanks to on-line tutorials, Alexander Pruss and Benjamin Green for helping me with 3D concepts. I certainly learned a lot from this experience. IV. Links http://evesw.techmods.com - My development site. http://www.ozdev.com - You should know this place--it's where you got the Hi-Tech C compiler from! z88dk-1.8.ds1/doc/memoryallocation.txt0000644000175000017500000003424110416272011017366 0ustar tygrystygrys MEMORY ALLOCATION UNDER Z88DK This file describes several dynamic and static memory allocation schemes that work well under z88dk. All assume a 64K memory space model, but a thing or two will be said about >64K model memory allocation. Besides what is described here, z88dk does have a far memory model concept which uses 24-bit memory pointers to access up to 16MB of memory. This has been implemented for the z88 target and you should consult other documentation in this directory to learn more about it. Before getting into it, let's briefly investigate how C's variables are treated by the compiler. 1. AUTOMATIC VARIABLES Local variables declared in a C program are allocated on the stack as a function is entered and are popped off the stack as functions are exited. They are dynamic (in that memory is allocated and deallocated from the stack as required) and transient (in that referring to their addresses has no meaning after the function terminates). Example: accessing local variables from assembler embedded in a C function. int myfunc(char b, unsigned char *p) { #asm ld hl,2 add hl,sp ; skip over return address on stack ld e,(hl) inc hl ld d,(hl) ; de = p inc hl ld a,(hl) ; a = b, "char b" occupies 16 bits on stack ; but only the LSB is relevant ... ld hl,1 ; hl is the return parameter #endasm } Example: z88dk's special __FASTCALL__ qualifier can be used if the C function has just one parameter. In that case, the parameter is passed in the HL register pair instead of being allocated on the stack. int __FASTCALL__ myfunc(unsigned char *p) { #asm ; hl = p ... ; return value in hl #endasm } 2. STATIC VARIABLES In C, static variables are those variables declared outside the scope of any function. They are global by default (as in they can be referred to from anywhere) and can be made lexically local to a particular C file by using the "static" modifier in their declaration. Because they are declared outside the scope of any function, they exist for the duration of the entire program. For this reason they cannot be allocated on the stack but instead are assigned their own absolute locations in memory. The assembler used by z88dk does not, at this time, have any concept of separate code or data segments. Therefore the compiler simply generates a single monolithic binary that contains compiled code and space for statically declared variables. This can be a problem if ROMable code must be generated because these globally defined static variables will be mixed in with code in the final binary, and will become constants when they are burned into a ROM. An example of a static variable being accessed from assembler: int a; ... #asm ld hl,(_a) #endasm The C variable has sufficient space reserved by the compiler and is given an assembler label which is constructed by prefixing the C name with a "_". There are several workarounds for accommodating ROMable code. One is to declare variables as pointers to fixed memory locations in RAM. If your program statically declares an int, make it statically declare a pointer to int instead with the pointer initialized to a constant memory address in RAM. This constant value is safely ROMable. There are two ways to place a pointer at an arbitrary memory address. The first method uses a bit of embedded assembler for assistance: extern int *p; #asm ._p defw 60000 #endasm The extern qualifier tells the compiler that the variable is declared someplace else so that no memory is reserved for it when the declaration is met. Recall that the C compiler will cause references to this variable to be made from assembler using the C name with a prefixed "_". We arrange in the embedded assembler to supply that name and space with a constant memory address safely in RAM. The two bytes referred to by assembler label "_p" with value 60000 will be compiled as part of the final binary and will be burned into ROM. References to "p" from the C program will access the word 60000 and dereferencing the "p" ptr will cause an int to be written or read from address 60000. The second method accomplishes the same thing but perhaps uses a cleaner declaration style: extern int *p @ 60000; // FIXME Another frequently used method in some of z88dk's libraries is to have the user declare locations in memory of various necessary data structures. Eg, the im2 library requires a single label to be defined in the program that holds the location of the interrupt vector table. Consult the im2.h header file for further information. 3. STATIC MEMORY ALLOCATION There are two reasons why you may want to remove static variables from the final binary. One is that you want to make the final binary smaller for loading into the final target by pruning out RAM variables. Another is that the binary must be ROMable so that static variables must be removed and placed in RAM locations. The methods mentioned in the last section may not be entirely satisfactory if you have a lot of static variables to worry about. Each time your program changes the static variables it uses, you will have to modify by hand the locations of each pointer variable. Another alternative is to write a static memory allocator: unsigned int static_free = 50000; void *static_alloc(unsigned int size) { unsigned int temp; temp = static_free; static_free += size; return temp; } The variable "static_free" holds the address of freely available memory in RAM, and is adjusted upward as static memory is allocated during the initialization of the program. All static variables are made into pointers and are allocated memory for their data from the static allocator. Example: int a; char *table[100]; Is turned into this: int *a; char **table; main() { a = static_alloc(sizeof(int)); table = static_alloc(100*sizeof(char *)); } This will reduce the size of the final binary that needs to be loaded into the target (the original static table array reserved 200 bytes in the final binary but after the change only 2 bytes in the final binary would be reserved for the pointer) but it is *still* not ROMable code. Space for each pointer variable (2 bytes) will be allocated within the output binary destined for the ROM. One must place the location of each pointer variable at a specific memory address in RAM using the special pointer declaration syntax mentioned in the last section so that they can be assigned to from a call to static_alloc. 4. DYNAMIC MEMORY ALLOCATION There are currently two dynamic memory allocators in z88dk that are independent from each other and can be used together if desired. A. Standard C Malloc and Free The standard C malloc functions manage a single monolithic chunk of memory (called the "heap") accessed by malloc() for allocation and free() for returning memory chunks for reuse. Any size memory chunks can be requested and a block of sufficient size will be returned if sufficient memory space in the heap is present. In your program you must include the header malloc.h and link to the malloc library in your compile command with "-lmalloc". In main() you must initialize the heap with a call to heapinit(). In the tiny memory space of the z80, where this free memory chunk for the malloc functions is located is a problem. z88dk's malloc implementation requires the user program to declare the location of the heap in one of two ways. The first way is to declare the macro supplied in the header file globally with the rest of the static variable declarations in your main.c file: HEAPSIZE(bytes) where "bytes" is the size of the heap in bytes. This macro actually declares a static array of the given size, which is something that will be compiled as part of the final binary. This is not good if your binary will need to be ROMable or if you want to shrink the size of the final binary. Instead you can declare the location of the heap using some embedded assembler: #asm XDEF _heap DEFC _heap = 50000 #endasm This will place the heap at address 50000. The initialization call to heapinit() takes as parameter the size of the heap and this will format a block of memory at that address to use that size only. B. The Dynamic Block Allocator The standard malloc() and free() implementation is very flexible in that it allows memory blocks of any size to be allocated and returned to the heap. It also has some drawbacks, namely it suffers from speed issues (relatively speaking) and external fragmentation. Because any size memory blocks can be requested from the heap, a substantial amount of overhead is incurred keeping track of which pieces of the heap are still available. This makes it comparatively slow. Again because any size memory blocks can be allocated, the heap can suffer from a condition known as external fragmentation. Over the course of running a program, many blocks of variable sizes can be allocated and freed. This can lead to a situation where there are a lot of scattered smallish segments available in the heap for allocation. Memory requests may no longer be satisfiable since any single free segment is too small, even though the total amount of space in the heap (found by adding up all the little segments) would be sufficient. This situation is known as external fragmentation. If the heap is too small (quite likely given the small 64k space available) programs that make use of the heap may grind to a halt after running long periods because memory requests are no longer satisfiable due to the scattered condition of the heap. A solution to both these problems is the dynamic block memory allocator. A block memory allocator maintains several memory queues, each of which maintains a list of free blocks of fixed size. Queue #0 might contain 6-byte blocks, queue #1 14-byte blocks, etc. Memory requests are made from a specific queue, retrieving a memory block of known size. Because the free memory blocks are maintained in a list, allocation and freeing is very fast. Another important advantage this allocator has to the heap oriented one is that scattered free memory from all over the memory map can be made available through the block allocator. To use the block memory allocator, you must include the header balloc.h and link to the balloc library with "-lballoc" in your compile command. In your C program you must declare the location of the queue table which is 2*numQ bytes in size where numQ is the number of memory queues you want. You can do this in one of two ways. One way is to declare the macro from the header file with the rest of your static variables in the main.c file: BAQTBL(numQ) where numQ is the number of memory queues desired. Again, this will declare a static array that will be compiled as part of your final binary, something not suitable for ROMable code. The other method is to declare the location of the queue table using some embedded assembler: #asm XDEF _ba_qtbl DEFC _ba_qtbl = 50000 #endasm which will place the queue table at address 50000. You must initialize the queues to empty prior to use with a call to ba_Init(). The queues will be empty and you must add memory to the queues with calls to ba_AddMem(). The header files are a source of further documentation on both dynamic memory allocators. 5. IMPLICIT DYNAMIC MEMORY ALLOCATION BY SOME Z88DK LIBRARIES Several of z88dk's libraries need to allocate dynamic memory for their own purposes. The abstract data types library (see adt.h), for example, has a linked list data type that needs to allocate containers for each node in a linked list. These libraries do not make assumptions about how your program does memory allocation (ie whether it uses the standard heap or the block allocator or another scheme of your own creation). Instead they call two functions that you must provide in your C program to perform the memory allocation on their behalf. These two functions are declared thus: ( u_malloc must return carry flag set if allocation successful ) void __FASTCALL__ *u_malloc(uint size) { return(malloc(size)); // lib function malloc sets carry } ( u_free must ignore addr == 0 ) void __FASTCALL__ u_free(void *addr) { free(addr); // lib function free ignores 0 } In this example, the standard malloc() and free() are used to satisfy all requests, but the block memory allocator is probably the best choice for the library functions since they frequently allocate and free small fixed size blocks. Here are the same two functions written in assembler: XDEF _u_malloc ._u_malloc ; HL = size in bytes LIB malloc jp malloc ; return in HL address of memory block XDEF _u_free ._u_free ; HL = address of memory block LIB free jp free Whether or not a library makes use of implicit memory allocation will be mentioned in its header file and the sizes of those requests should be clear from the data structures declared there. If you have a certain amount of programming experience, it shouldn't be a mystery as to which libraries might need to dynamically allocate memory. 6. WHAT IF YOU HAVE MORE THAN 64K? Aside from the far pointers mentioned at the beginning of this article, there are two things that can be done to take advantage of this extra memory space. By far the easiest thing you can do is access the extra memory through a RAMdisk model, ie copy data to and from the extra banks to the main 64K bank where your program is designed to run, as needed. Another is to make use of the block memory allocator. Separate queues can be maintained for available memory in different memory banks. Subroutines within your program can be confined to certain banks so that whenever they run they only access data in those banks and have those banks paged in when they run. Those subroutines can use the block allocator for their memory allocation needs, making sure they allocate from the appropriate queues. That's the end of the overview... Any specific questions can be addressed to the z88dk users mailing list. - aralbrec 04.2006 z88dk-1.8.ds1/doc/netman/0000755000175000017500000000000010765202715014540 5ustar tygrystygrysz88dk-1.8.ds1/doc/netman/.sock_open.man.swp0000644000175000017500000003000007130401727020070 0ustar tygrystygrysb0VIM 5.3>8R;domdylan.cheshire.hunt~dom/z88dk/doc/netman/sock_open.man3210#"! Utpadsr< February 13, 2000 djmRETURN VALUEDESCRIPTION void (*datahandler)(), char protocol); SOCKET *sock_open(ipaddr_t ipaddr, tcpport_t dport, #include SYNOPSIS sock_open - Open an active connectionNAMEsock_open(3Z) z88dk Programmers Manual sock_open(3Z)z88dk-1.8.ds1/doc/netman/cat3z/0000755000175000017500000000000010765202715015564 5ustar tygrystygrysz88dk-1.8.ds1/doc/netman/cat3z/byteorder.30000644000175000017500000000440407130401727017645 0ustar tygrystygrys byteorder(3) z88dk Programmer's Manual byteorder(3) NNAAMMEE htonl, htons, ntohl, ntohs - convert values between host and network byte order SSYYNNOOPPSSIISS ##iinncclluuddee <> uunnssiiggnneedd lloonngg iinntt hhttoonnll((uunnssiiggnneedd lloonngg iinntt _h_o_s_t_l_o_n_g));; uunnssiiggnneedd sshhoorrtt iinntt hhttoonnss((uunnssiiggnneedd sshhoorrtt iinntt _h_o_s_t_s_h_o_r_t));; uunnssiiggnneedd lloonngg iinntt nnttoohhll((uunnssiiggnneedd lloonngg iinntt _n_e_t_l_o_n_g));; uunnssiiggnneedd sshhoorrtt iinntt nnttoohhss((uunnssiiggnneedd sshhoorrtt iinntt _n_e_t_s_h_o_r_t));; DDEESSCCRRIIPPTTIIOONN The hhttoonnll(()) function converts the long integer _h_o_s_t_l_o_n_g from host byte order to network byte order. The hhttoonnss(()) function converts the short integer _h_o_s_t_s_h_o_r_t from host byte order to network byte order. The nnttoohhll(()) function converts the long integer _n_e_t_l_o_n_g from network byte order to host byte order. The nnttoohhss(()) function converts the short integer _n_e_t_s_h_o_r_t from network byte order to host byte order. On the z80 the host byte order is Least Significant Byte first, whereas the network byte order, as used on the Internet, is Most Significant Byte first. CCOONNFFOORRMMIINNGG TTOO BSD 4.3 NNOOTTEESS Unlike on other machines these functions are not provided through macros - they are instead functions kept in z80_crt0.lib. The optimization rules supplied with z88dk are aware of these routines and when appropriate optimize the function call away. AAUUTTHHOORR Dominic Morris Original manual page by David Metcalfe BSD February 18 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/DeviceOffline.30000644000175000017500000000273207130401730020344 0ustar tygrystygrys DeviceOffline(3z) z88dk Programmer's Manual DeviceOffline(3z) NNAAMMEE DeviceOffline - turn the network device online SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd DDeevviicceeOOfffflliinnee((iinntt _f_l_a_g));; DDEESSCCRRIIPPTTIIOONN The DDeevviicceeOOfffflliinnee(()) function turns the packet driver offline so that other application may utilise the resources that it is using. For example for the built in SLIP driver, turning the device online prevents polling of the serial port for incoming bytes and the sending of queued packets, thus allowing another program (e.g. Terminal) to use the serial port. The parameter _f_l_a_g specifies how the device is to be turned offline, with current device drivers this has no significence. However it is envisaged that the value NOHANGUP the device will simply suspend sending and receiving packets. Whilst with HANGUP the device will hangup the line and terminate the telephone connection. RREETTUURRNN VVAALLUUEE None. SSEEEE AALLSSOO DDeevviicceeOOnnlliinnee(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/DeviceOnline.30000644000175000017500000000160307130401727020210 0ustar tygrystygrys DeviceOnline(3z) z88dk Programmer's Manual DeviceOnline(3z) NNAAMMEE DeviceOnline - turn the network device online SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd DDeevviicceeOOnnlliinnee((vvooiidd));; DDEESSCCRRIIPPTTIIOONN The DDeevviicceeOOnnlliinnee(()) function turns the packet driver back on again after it has been previously turned offline by DDeevviicceeOOfffflliinnee((33zz)). How this is achieved depends on the device driver in use. RREETTUURRNN VVAALLUUEE None. SSEEEE AALLSSOO DDeevviicceeOOfffflliinnee(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/getnetbyname.30000644000175000017500000000245707130401727020336 0ustar tygrystygrys getnetbyname(3z) z88dk Programmer's Manual getnetbyname(3z) NNAAMMEE getnetbyname, getnetbynumber - get network entry SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ggeettnneettbbyynnaammee((cchhaarr **_n_a_m_e));; cchhaarr **ggeettnneettbbyynnuummbbeerr((iinntt _n_e_t_w_o_r_k,, cchhaarr ** _b_u_f));; DDEESSCCRRIIPPTTIIOONN The ggeettnneettbbyynnaammee(()) function returns the standard number for the network with the name _n_a_m_e. If no network is known then NULL is returned. The ggeettnneettbbyynnuummbbeerr(()) function copies into _b_u_f (and returns _b_u_f) the network matching the _n_e_t_w_o_r_k. If no network is known then _n_e_t_w_o_r_k is returned in ASCII form. RREETTUURRNN VVAALLUUEE Detailed above. NNOOTTEESS These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/getnetbynumber.30000644000175000017500000000245707130401727020706 0ustar tygrystygrys getnetbyname(3z) z88dk Programmer's Manual getnetbyname(3z) NNAAMMEE getnetbyname, getnetbynumber - get network entry SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ggeettnneettbbyynnaammee((cchhaarr **_n_a_m_e));; cchhaarr **ggeettnneettbbyynnuummbbeerr((iinntt _n_e_t_w_o_r_k,, cchhaarr ** _b_u_f));; DDEESSCCRRIIPPTTIIOONN The ggeettnneettbbyynnaammee(()) function returns the standard number for the network with the name _n_a_m_e. If no network is known then NULL is returned. The ggeettnneettbbyynnuummbbeerr(()) function copies into _b_u_f (and returns _b_u_f) the network matching the _n_e_t_w_o_r_k. If no network is known then _n_e_t_w_o_r_k is returned in ASCII form. RREETTUURRNN VVAALLUUEE Detailed above. NNOOTTEESS These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/getprotobyname.30000644000175000017500000000254207130401727020706 0ustar tygrystygrys getprotobyname(3z) z88dk Programmer's Manual getprotobyname(3z) NNAAMMEE getprotobyname, getprotobynumber - get protocol entry SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ggeettpprroottoobbyynnaammee((cchhaarr **_n_a_m_e));; cchhaarr **ggeettpprroottoobbyynnuummbbeerr((iinntt _p_r_o_t_o_c_o_l,, cchhaarr ** _b_u_f));; DDEESSCCRRIIPPTTIIOONN The ggeettpprroottoobbyynnaammee(()) function returns the standard number for the protocol with the name _n_a_m_e. If no protocol is known then NULL is returned. The ggeettpprroottoobbyynnuummbbeerr(()) function copies into _b_u_f (and returns _b_u_f) the protocol matching the _p_r_o_t_o_c_o_l. If no protocol is known then _p_r_o_t_o_c_o_l is returned in ASCII form. RREETTUURRNN VVAALLUUEE Detailed above. NNOOTTEESS These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/getprotobynumber.30000644000175000017500000000254207130401727021256 0ustar tygrystygrys getprotobyname(3z) z88dk Programmer's Manual getprotobyname(3z) NNAAMMEE getprotobyname, getprotobynumber - get protocol entry SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ggeettpprroottoobbyynnaammee((cchhaarr **_n_a_m_e));; cchhaarr **ggeettpprroottoobbyynnuummbbeerr((iinntt _p_r_o_t_o_c_o_l,, cchhaarr ** _b_u_f));; DDEESSCCRRIIPPTTIIOONN The ggeettpprroottoobbyynnaammee(()) function returns the standard number for the protocol with the name _n_a_m_e. If no protocol is known then NULL is returned. The ggeettpprroottoobbyynnuummbbeerr(()) function copies into _b_u_f (and returns _b_u_f) the protocol matching the _p_r_o_t_o_c_o_l. If no protocol is known then _p_r_o_t_o_c_o_l is returned in ASCII form. RREETTUURRNN VVAALLUUEE Detailed above. NNOOTTEESS These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/getservbyname.30000644000175000017500000000250607130401727020522 0ustar tygrystygrys getservbyname(3z) z88dk Programmer's Manual getservbyname(3z) NNAAMMEE getservbyname, getservbyport - get service entry SSYYNNOOPPSSIISS ##iinncclluuddee <> ttccppppoorrtt__tt ggeettsseerrvvbbyynnaammee((cchhaarr **_n_a_m_e));; cchhaarr **ggeettsseerrvvbbyyppoorrtt((ttccppppoorrtt__tt _p_o_r_t,, cchhaarr ** _b_u_f));; DDEESSCCRRIIPPTTIIOONN The ggeettsseerrvvbbyynnaammee(()) function returns the standard port for the service with the name _n_a_m_e. If no service is known then NULL is returned. The ggeettsseerrvvbbyyppoorrtt(()) function copies into _b_u_f (and returns _b_u_f) the service matching the standard port _p_o_r_t. If no service is known then _p_o_r_t is returned in ASCII form. RREETTUURRNN VVAALLUUEE Detailed above. NNOOTTEESS These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/getservbyport.30000644000175000017500000000250607130401727020566 0ustar tygrystygrys getservbyname(3z) z88dk Programmer's Manual getservbyname(3z) NNAAMMEE getservbyname, getservbyport - get service entry SSYYNNOOPPSSIISS ##iinncclluuddee <> ttccppppoorrtt__tt ggeettsseerrvvbbyynnaammee((cchhaarr **_n_a_m_e));; cchhaarr **ggeettsseerrvvbbyyppoorrtt((ttccppppoorrtt__tt _p_o_r_t,, cchhaarr ** _b_u_f));; DDEESSCCRRIIPPTTIIOONN The ggeettsseerrvvbbyynnaammee(()) function returns the standard port for the service with the name _n_a_m_e. If no service is known then NULL is returned. The ggeettsseerrvvbbyyppoorrtt(()) function copies into _b_u_f (and returns _b_u_f) the service matching the standard port _p_o_r_t. If no service is known then _p_o_r_t is returned in ASCII form. RREETTUURRNN VVAALLUUEE Detailed above. NNOOTTEESS These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/getservprotobyname.30000644000175000017500000000267007130401727021610 0ustar tygrystygrys getservprotobyname(3zz)88dk Programmer's Manuagletservprotobyname(3z) NNAAMMEE getservprotobyname, getservprotobyport - get servprotoice entry SSYYNNOOPPSSIISS ##iinncclluuddee <> uu88__tt ggeettsseerrvvpprroottoobbyynnaammee((cchhaarr **_n_a_m_e));; uu88__tt ggeettsseerrvvpprroottoobbyyppoorrtt((ttccppppoorrtt__tt _p_o_r_t));; DDEESSCCRRIIPPTTIIOONN The ggeettsseerrvvpprroottoobbyynnaammee(()) function returns the appropriate protocol for the service with the name _n_a_m_e. If the ser- vice isn't known then NULL is returned. The ggeettsseerrvvpprroottoobbyyppoorrtt(()) function returns the appropriate protocol for the service with the standard port number _p_o_r_t. If the service is unknown then NULL is returned. RREETTUURRNN VVAALLUUEE If a service is known to more than one protocol then the most frequently used is returned. NNOOTTEESS These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/getservprotobynumber.30000644000175000017500000000267007130401727022160 0ustar tygrystygrys getservprotobyname(3zz)88dk Programmer's Manuagletservprotobyname(3z) NNAAMMEE getservprotobyname, getservprotobyport - get servprotoice entry SSYYNNOOPPSSIISS ##iinncclluuddee <> uu88__tt ggeettsseerrvvpprroottoobbyynnaammee((cchhaarr **_n_a_m_e));; uu88__tt ggeettsseerrvvpprroottoobbyyppoorrtt((ttccppppoorrtt__tt _p_o_r_t));; DDEESSCCRRIIPPTTIIOONN The ggeettsseerrvvpprroottoobbyynnaammee(()) function returns the appropriate protocol for the service with the name _n_a_m_e. If the ser- vice isn't known then NULL is returned. The ggeettsseerrvvpprroottoobbyyppoorrtt(()) function returns the appropriate protocol for the service with the standard port number _p_o_r_t. If the service is unknown then NULL is returned. RREETTUURRNN VVAALLUUEE If a service is known to more than one protocol then the most frequently used is returned. NNOOTTEESS These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/pktdrive.30000644000175000017500000001050107130401730017463 0ustar tygrystygrys pktdrive(3z) z88dk Programmer's Manual pktdrive(3z) NNAAMMEE pktdrive - packet driver descriptor structure SSYYNNOOPPSSIISS ##iinncclluuddee <> DDEESSCCRRIIPPTTIIOONN The _p_k_t_d_r_i_v_e structure defines access to a device, it is only used by the ZSock kernel. Should you wish to write a packet driver then this structure should be filled with the relevent routines. All external packet drivers run at address 8192 ($2000) and it as this address that the structure should be placed. Had z88dk the capability _p_k_t_d_r_i_v_e would be defined as follows: struct pktdrive { char magic[10]; char *type; char *copymsg; void (*initfunc)(void); void (*queuefn)(void *pkt, size_t len); void *(*packetfn)(void); void *(*sendfn)(void); int (*readfn)(void); void (*onlinefn)(); void (*offlinefn)(int); int (*statusfn)(void); }; The members of the _p_k_t_d_r_i_v_e structure are: _m_a_g_i_c Magic to identifier the file as a packet driver, this is defined as ZS0PKTDRV _t_y_p_e A pointer to the type of the device _c_o_p_y_m_s_g A pointer to the copyright message _i_n_i_t_f_u_n_c A function that initialises the device during the initial configurationin this function. _q_u_e_u_e_f_n A function that stores outgoing backets in a queue pending sending. Depending on the speed of the device it may also inject packets into the inter- face. _p_a_c_k_e_t_f_n A function that returns the address of the incoming packet. This function is called immediately after initialisation and after the _r_e_a_d_f_n function (below) has returned a packet. _s_e_n_d_f_n A function that is called on the interrupt to inject bytes out of the interface. If this function returns non-zero then packet at the address returned is freed. _r_e_a_d_f_n A function that is called on the interrupt to read incoming bytes. If the function returns non-zero then a packet is assumed to have been read, with length as returned by readfn and lying at the address specified by packetfn. _o_n_l_i_n_e_f_n A function that is called when the device is to be turned online _o_f_f_l_i_n_e_f_n A function that is called when the device is to be turned offline, if the parameter is non-zero then the function should hang up line (if appropriate) otherwise it should just suspend sending and receiving packets. _s_t_a_t_u_s_f_n A function that returns the status of the device. It is envisaged that it will return 0 for offline and 1 for online though it may return other values. The value returned is left for the user to under- stand. NNOOTTEESS When the packet is passed to the driver for output a 4 bytes of header space is available at dp-4. The SLIP driver by Dominic Morris utilises these bytes to implement a linked list and to hold the length of the outgoing packet. Other packet drivers might wish to copy the packet to their own address space for converting into other forms - eg CSLIP form. Alternatively they might simply create a link from their own space to the packet in the queue so to reduce time wasted copying bytes. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/QueryPackage.30000644000175000017500000000235707130401727020234 0ustar tygrystygrys QueryPackage(3z) z88dk Programmer's Manual QueryPackage(3z) NNAAMMEE QueryPackage - open a shared library/package SSYYNNOOPPSSIISS ##iinncclluuddee <> bbooooll__tt QQuueerryyPPaacckkaaggee((cchhaarr _p_a_c_k_a_g_e,, cchhaarr _m_a_j_o_r ,, cchhaarr _m_i_n_o_r));; DDEESSCCRRIIPPTTIIOONN The QQuueerryyPPaacckkaaggee(()) function checks and makes available for use the shared package _p_a_c_k_a_g_e with a version of at least _m_i_n_o_r._m_i_n_o_r The function initially checks for the presence of the package subsystem and then proceeds to check for the spec- ified package. Version checking can be disabled by specifying _m_i_n_o_r and _m_a_j_o_r to be 0. RREETTUURRNN VVAALLUUEE The QQuueerryyPPaacckkaaggee(()) function returns 0 on failure or 1 on success. The carry flag is set accordingly and thus the non-standard iferror { ... } construct can be used to check for success. 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/resolve.30000644000175000017500000000231107130401727017320 0ustar tygrystygrys resolve(3z) z88dk Programmer's Manual resolve(3z) NNAAMMEE resolve - convert hostname to IP address SSYYNNOOPPSSIISS ##iinncclluuddee <> iippaaddddrr__tt rreessoollvvee((cchhaarr **_n_a_m_e));; DDEESSCCRRIIPPTTIIOONN The rreessoollvvee(()) function queries any configured nameservers for the IP address of the host with the name _n_a_m_e. If _n_a_m_e is in the form a.b.c.d then this is converted to an IP address and returned. RREETTUURRNN VVAALLUUEE rreessoollvv(()) returns the network order IP address of the requested host. If the name cannot be resolved then NULL is returned. rreessoollvv(()) may also be called by the macro ggeetthhoossttbbyynnaammee BBUUGGSS If you use the macro ggeetthhoossttbbyynnaammee then beware that the ZSock implementation is not at all standard. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/reverse_addr_lookup.30000644000175000017500000000315707130401727021710 0ustar tygrystygrys reverse_addr(3z) z88dk Programmer's Manual reverse_addr(3z) NNAAMMEE reverse_addr_lookup - convert IP address to hstname SSYYNNOOPPSSIISS ##iinncclluuddee <> bbooooll__tt rreevveerrssee__aaddddrr__llooookkuupp((iippaaddddrr__tt _i_p_a_d_d_r,, cchhaarr **_n_a_m_e));; DDEESSCCRRIIPPTTIIOONN The rreevveerrssee__aaddddrr__llooookkuupp(()) function queries any configured nameservers for the name of the host with IP address _i_p_a_d_d_r. If _i_p_a_d_d_r is not known to the queried nameservers then the _i_p_a_d_d_r is converted to the form a.b.c.d and returned. RREETTUURRNN VVAALLUUEE rreevveerrssee__aaddddrr__llooookkuupp(()) places the hostname in the buffer specified by _n_a_m_e, no checks are made that this buffer is large enough to hold the full hostname. The function returns TRUE or FALSE depending on whether the queried nameservers knew _i_p_a_d_d_r. rreevveerrssee__aaddddrr__llooookkuupp(()) may also be called by the macro ggeetthhoossttbbyyaaddddrr BBUUGGSS If you use the macro ggeetthhoossttbbyyaaddddrr then beware that the ZSock implementation is not at all standard. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_abort.30000644000175000017500000000174407130401727020000 0ustar tygrystygrys sock_abort(3z) z88dk Programmer's Manual sock_abort(3z) NNAAMMEE sock_abort - abort a network connection SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd ssoocckk__aabboorrtt((SSOOCCKKEETT **_s_)_; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to an open socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)). The ssoocckk__aabboorrtt(()) function will immediately move a socket into a closed state disallowing any further reads or writes. RREETTUURRNN VVAALLUUEE None SSEEEE AALLSSOO ssoocckk__cclloossee(3z), ssoocckk__sshhuuttddoowwnn(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_close.30000644000175000017500000000212707130401730017764 0ustar tygrystygrys sock_close(3z) z88dk Programmer's Manual sock_close(3z) NNAAMMEE sock_close - close a network connection SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd ssoocckk__cclloossee((SSOOCCKKEETT **_s_)_; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to an open socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)). The ssoocckk__cclloossee(()) function will initiate a close on the socket specified by _s. Once this function has been called no more data can be written to the socket. If the socket is of type prot_TCP then data can continue to be read. RREETTUURRNN VVAALLUUEE None SSEEEE AALLSSOO ssoocckk__aabboorrtt(3z), ssoocckk__sshhuuttddoowwnn(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_closed.30000644000175000017500000000214707130401730020132 0ustar tygrystygrys sock_closed(3z) z88dk Programmer's Manual sock_closed(3z) NNAAMMEE sock_closed - test whether a network connection is closed SSYYNNOOPPSSIISS ##iinncclluuddee <> bbooooll__tt ssoocckk__cclloosseedd((SSOOCCKKEETT **_s_)_; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to a socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)). The ssoocckk__cclloosseedd(()) function tests whether a socket is closed i.e. connection to a remote host has not been established or has already been closed by the kernel. A socket of prot_UDP is never closed. RREETTUURRNN VVAALLUUEE ssoocckk__cclloosseedd(()) returns TRUE or FALSE SSEEEE AALLSSOO ssoocckk__ooppeenneedd(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_dataready.30000644000175000017500000000210407130401730020610 0ustar tygrystygrys sock_dataready(3z) z88dk Programmer's Manual sock_dataready(3z) NNAAMMEE sock_dataready - test whether a network connection has incoming data SSYYNNOOPPSSIISS ##iinncclluuddee <> ssiizzee__tt ssoocckk__ddaattaarreeaaddyy((SSOOCCKKEETT **_s_)_; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to an open socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)). The ssoocckk__ddaattaarreeaaddyy(()) function tests whether a socket has data waiting to be read by the user program. RREETTUURRNN VVAALLUUEE ssoocckk__ddaattaarreeaaddyy(()) returns the amount of data waiting in the input queue. SSEEEE AALLSSOO ssoocckk__rreeaadd(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_flush.30000644000175000017500000000174607130401730020006 0ustar tygrystygrys sock_flush(3z) z88dk Programmer's Manual sock_flush(3z) NNAAMMEE sock_flush - flush a network connection SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd ssoocckk__fflluusshh((SSOOCCKKEETT **_s_)_; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to an open socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)). The socket should be of type prot_TCP. The ssoocckk__fflluusshh(()) function will depending on the state of the connection either immediately send any pending data in the socket buffer or flag the data for sending in the next timer call. RREETTUURRNN VVAALLUUEE None AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_listen.30000644000175000017500000000332607130401730020157 0ustar tygrystygrys sock_listen(3z) z88dk Programmer's Manual sock_listen(3z) NNAAMMEE sock_listen - open a passive network connection SSYYNNOOPPSSIISS ##iinncclluuddee <> SSOOCCKKEETT **ssoocckk__lliisstteenn((iippaaddddrr__tt _i_p_d_e_s_t,, ttccppppoorrtt__tt _l_p_o_r_t,, vvooiidd _(_*_h_a_n_d_l_e_r_)_(_),, cchhaarr _p_r_o_t_o_)_; DDEESSCCRRIIPPTTIIOONN The ssoocckk__lliisstteenn(()) function creates a socket descriptor for a passive (i.e. listening) connection on local port _l_p_o_r_t awaiting a connection from host _i_p_d_e_s_t. At the moment only protocols prot_UDP and prot_TCP are supported. To accept connections from any host specify the parameter _i_p_d_e_s_t to be 0L. The parameter _h_a_n_d_l_e_r specifies a handler to be called whenever the connection changes state or new data arrives. It should be the code for a package routine. The input parameters of the function _h_a_n_d_l_e_r vary depend- ing on whether the socket is of type prot_UDP or prot_TCP. RREETTUURRNN VVAALLUUEE ssoocckk__lliisstteenn(()) returns a socket descriptor. Specifying a non support protocol will result in the carry flag being set and the return value being EPROTONOSUPPORT. SSEEEE AALLSSOO ssoocckk__ooppeenn(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_open.30000644000175000017500000000272007130401730017617 0ustar tygrystygrys sock_open(3z) z88dk Programmer's Manual sock_open(3z) NNAAMMEE sock_open - open an active network connection SSYYNNOOPPSSIISS ##iinncclluuddee <> SSOOCCKKEETT **ssoocckk__ooppeenn((iippaaddddrr__tt _i_p_d_e_s_t,, ttccppppoorrtt__tt _d_p_o_r_t,, vvooiidd _(_*_h_a_n_d_l_e_r_)_(_),, cchhaarr _p_r_o_t_o_)_; DDEESSCCRRIIPPTTIIOONN The ssoocckk__ooppeenn(()) function creates a socket descriptor and attempts to establish a connection to the port _d_p_o_r_t on the host _i_p_d_e_s_t using the protocol _p_r_o_t_o. At the moment only protocols prot_UDP and prot_TCP are supported. The parameter _h_a_n_d_l_e_r specifies a handler to be called whenever the connection changes state or new data arrives. It is of archaic interest only. RREETTUURRNN VVAALLUUEE ssoocckk__ooppeenn(()) returns a socket descriptor. Specifying a non- supported protocol will result in the carry flag being set and the return value being EPROTONOSUPPORT. SSEEEE AALLSSOO ssoocckk__lliisstteenn(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_opened.30000644000175000017500000000207307130401730020131 0ustar tygrystygrys sock_opened(3z) z88dk Programmer's Manual sock_opened(3z) NNAAMMEE sock_opened - test whether a network connection is estab- lished SSYYNNOOPPSSIISS ##iinncclluuddee <> bbooooll__tt ssoocckk__ooppeenneedd((SSOOCCKKEETT **_s_)_; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to a socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)). The ssoocckk__ooppeenneedd(()) function tests whether a socket is open i.e. connection to a remote host has been established. A socket of prot_UDP is always established. RREETTUURRNN VVAALLUUEE ssoocckk__ooppeenneedd(()) returns TRUE or FALSE SSEEEE AALLSSOO ssoocckk__cclloosseedd(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_putc.30000644000175000017500000000226607130401730017636 0ustar tygrystygrys sock_putc(3z) z88dk Programmer's Manual sock_putc(3z) NNAAMMEE sock_putc - write byte to a network socket SSYYNNOOPPSSIISS ##iinncclluuddee <> ssiizzee__tt ssoocckk__ppuuttcc((cchhaarr _c,, SSOOCCKKEETT **_s));; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to an open socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)) The ssoocckk__ppuuttcc(()) function writes a single byte _c to the socket specified by _s. RREETTUURRNN VVAALLUUEE The ssoocckk__wwrriittee(()) function returns the number of bytes written to the socket (i.e. 0 or 1). If an illegal socket is supplied the carry flag will be set and the return value will be EPROTONOSUPPORT. SSEEEE AALLSSOO ssoocckk__wwrriittee(3z), ssoocckk__ppuuttss(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_puts.30000644000175000017500000000227607130401730017657 0ustar tygrystygrys sock_puts(3z) z88dk Programmer's Manual sock_puts(3z) NNAAMMEE sock_write - write string to a network socket SSYYNNOOPPSSIISS ##iinncclluuddee <> ssiizzee__tt ssoocckk__ppuuttss((SSOOCCKKEETT **_s,, cchhaarr **_d_p));; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to an open socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)) The ssoocckk__ppuuttss(()) function writes the NULL terminated string _d_p to the socket specified by _s. RREETTUURRNN VVAALLUUEE The ssoocckk__wwrriittee(()) function returns the number of bytes written to the socket. If an illegal socket is supplied the carry flag will be set and the return value will be EPROTONOSUPPORT. SSEEEE AALLSSOO ssoocckk__wwrriittee(3z), ssoocckk__ppuuttcc(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_read.30000644000175000017500000000230007130401730017563 0ustar tygrystygrys sock_read(3z) z88dk Programmer's Manual sock_read(3z) NNAAMMEE sock_read - read bytes from a network socket SSYYNNOOPPSSIISS ##iinncclluuddee <> ssiizzee__tt ssoocckk__rreeaadd((SSOOCCKKEETT ** _s,, vvooiidd ** _d_p ,, ssiizzee__tt _l_e_n));; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to an open socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)) The ssoocckk__rreeaadd(()) function reads at most _l_e_n bytes from the socket _s and places them at _d_p. _d_p which should be in the lower 16k of the memory map. RREETTUURRNN VVAALLUUEE The ssoocckk__rreeaadd(()) function returns the number of bytes read from the socket. If an illegal socket is supplied the carry flag will be set and the return value will be EPROTONOSUPPORT. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_shutdown.30000644000175000017500000000214007130401730020525 0ustar tygrystygrys sock_shutdown(3z) z88dk Programmer's Manual sock_shutdown(3z) NNAAMMEE sock_shutdown - abort a network connection SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd ssoocckk__cclloossee((SSOOCCKKEETT **_s_)_; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to an open socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)). The ssoocckk__sshhuuttddoowwnn(()) function wipes all trace of the socket _s from the system. It should be preceded by either a ssoocckk__cclloossee((33zz)) or ssoocckk__aabboorrtt((33zz)) depending on the circum- stances. RREETTUURRNN VVAALLUUEE None SSEEEE AALLSSOO ssoocckk__cclloossee(3z), ssoocckk__aabboorrtt(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/sock_write.30000644000175000017500000000253007130401730020007 0ustar tygrystygrys sock_write(3z) z88dk Programmer's Manual sock_write(3z) NNAAMMEE sock_write - write bytes to a network socket SSYYNNOOPPSSIISS ##iinncclluuddee <> ssiizzee__tt ssoocckk__wwrriittee((SSOOCCKKEETT **_s,, vvooiidd **_d_p ,, ssiizzee__tt _l_e_n));; DDEESSCCRRIIPPTTIIOONN The parameter _s is a descriptor to an open socket created using ssoocckk__ooppeenn((33zz)) or ssoocckk__lliisstteenn((33zz)) The ssoocckk__wwrriittee(()) function writes a stream of bytes to the open socket specified by _s. The data of length _l_e_n is taken from address _d_p which should be in the lower 16k of the memory map. RREETTUURRNN VVAALLUUEE The ssoocckk__wwrriittee(()) function returns the number of bytes written to the socket. If an illegal socket is supplied the carry flag will be set and the return value will be EPROTONOSUPPORT. SSEEEE AALLSSOO ssoocckk__ppuuttcc(3z), ssoocckk__ppuuttss(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/tcp_calloc.30000644000175000017500000000477307130401730017754 0ustar tygrystygrys tcp_malloc(3) z88dk Programmer's Manual tcp_malloc(3) NNAAMMEE tcp_calloc, tcp_malloc, tcp_free - Allocate and free mem- ory SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd **ttccpp__ccaalllloocc((ssiizzee__tt _n_m_e_m_b,, ssiizzee__tt _s_i_z_e));; vvooiidd **ttccpp__mmaalllloocc((ssiizzee__tt _s_i_z_e));; vvooiidd ttccpp__ffrreeee((vvooiidd _*_p_t_r));; DDEESSCCRRIIPPTTIIOONN ccaalllloocc(()) allocates memory for an array of _n_m_e_m_b elements of _s_i_z_e bytes each and returns a pointer to the allocated memory. The memory is set to zero. mmaalllloocc(()) allocates _s_i_z_e bytes and returns a pointer to the allocated memory. The memory is not cleared. ffrreeee(()) frees the memory space pointed to by _p_t_r, which must have been returned by a previous call to mmaalllloocc(()) or ccaalllloocc(()) Otherwise, or if ffrreeee((_p_t_r)) has already been called before, undefined behaviour occurs. If _p_t_r is NNUULLLL, no operation is performed. RREETTUURRNN VVAALLUUEESS For ccaalllloocc(()) and mmaalllloocc(()), the value returned is a pointer to the allocated memory, which is suitably aligned for any kind of variable, or NNUULLLL if the request fails. ffrreeee(()) returns no value. SSEEEE AALLSSOO ttccpp__ppaaggeeiinn(3z) ,ttccpp__ppaaggeeoouutt(3z) NNOOTTEESS These functions manipulate memory in a private memory page belonging to ZSock. This 16k page holds all the buffers that ZSock uses and hence requests for large amounts of memory are likely to fail (and in any case are not recom- mended). This facility has been offered to allow daemons to be written simply (they have no address space of their own). User applications should not use these facilities. If a large (>256 bytes) amount of memory is required for a user application then the application should either be of the BAD type or be redesigned. AAUUTTHHOORR Dominic Morris February 18 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/tcp_free.30000644000175000017500000000477307130401730017440 0ustar tygrystygrys tcp_malloc(3) z88dk Programmer's Manual tcp_malloc(3) NNAAMMEE tcp_calloc, tcp_malloc, tcp_free - Allocate and free mem- ory SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd **ttccpp__ccaalllloocc((ssiizzee__tt _n_m_e_m_b,, ssiizzee__tt _s_i_z_e));; vvooiidd **ttccpp__mmaalllloocc((ssiizzee__tt _s_i_z_e));; vvooiidd ttccpp__ffrreeee((vvooiidd _*_p_t_r));; DDEESSCCRRIIPPTTIIOONN ccaalllloocc(()) allocates memory for an array of _n_m_e_m_b elements of _s_i_z_e bytes each and returns a pointer to the allocated memory. The memory is set to zero. mmaalllloocc(()) allocates _s_i_z_e bytes and returns a pointer to the allocated memory. The memory is not cleared. ffrreeee(()) frees the memory space pointed to by _p_t_r, which must have been returned by a previous call to mmaalllloocc(()) or ccaalllloocc(()) Otherwise, or if ffrreeee((_p_t_r)) has already been called before, undefined behaviour occurs. If _p_t_r is NNUULLLL, no operation is performed. RREETTUURRNN VVAALLUUEESS For ccaalllloocc(()) and mmaalllloocc(()), the value returned is a pointer to the allocated memory, which is suitably aligned for any kind of variable, or NNUULLLL if the request fails. ffrreeee(()) returns no value. SSEEEE AALLSSOO ttccpp__ppaaggeeiinn(3z) ,ttccpp__ppaaggeeoouutt(3z) NNOOTTEESS These functions manipulate memory in a private memory page belonging to ZSock. This 16k page holds all the buffers that ZSock uses and hence requests for large amounts of memory are likely to fail (and in any case are not recom- mended). This facility has been offered to allow daemons to be written simply (they have no address space of their own). User applications should not use these facilities. If a large (>256 bytes) amount of memory is required for a user application then the application should either be of the BAD type or be redesigned. AAUUTTHHOORR Dominic Morris February 18 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/tcp_malloc.30000644000175000017500000000477307130401730017766 0ustar tygrystygrys tcp_malloc(3) z88dk Programmer's Manual tcp_malloc(3) NNAAMMEE tcp_calloc, tcp_malloc, tcp_free - Allocate and free mem- ory SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd **ttccpp__ccaalllloocc((ssiizzee__tt _n_m_e_m_b,, ssiizzee__tt _s_i_z_e));; vvooiidd **ttccpp__mmaalllloocc((ssiizzee__tt _s_i_z_e));; vvooiidd ttccpp__ffrreeee((vvooiidd _*_p_t_r));; DDEESSCCRRIIPPTTIIOONN ccaalllloocc(()) allocates memory for an array of _n_m_e_m_b elements of _s_i_z_e bytes each and returns a pointer to the allocated memory. The memory is set to zero. mmaalllloocc(()) allocates _s_i_z_e bytes and returns a pointer to the allocated memory. The memory is not cleared. ffrreeee(()) frees the memory space pointed to by _p_t_r, which must have been returned by a previous call to mmaalllloocc(()) or ccaalllloocc(()) Otherwise, or if ffrreeee((_p_t_r)) has already been called before, undefined behaviour occurs. If _p_t_r is NNUULLLL, no operation is performed. RREETTUURRNN VVAALLUUEESS For ccaalllloocc(()) and mmaalllloocc(()), the value returned is a pointer to the allocated memory, which is suitably aligned for any kind of variable, or NNUULLLL if the request fails. ffrreeee(()) returns no value. SSEEEE AALLSSOO ttccpp__ppaaggeeiinn(3z) ,ttccpp__ppaaggeeoouutt(3z) NNOOTTEESS These functions manipulate memory in a private memory page belonging to ZSock. This 16k page holds all the buffers that ZSock uses and hence requests for large amounts of memory are likely to fail (and in any case are not recom- mended). This facility has been offered to allow daemons to be written easily (they have no address space of their own). User applications should not use these facilities. If a large (>256 bytes) amount of memory is required for a user application then the application should either be of the BAD type or be redesigned. AAUUTTHHOORR Dominic Morris February 18 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/tcp_pagein.30000644000175000017500000000223107130401730017745 0ustar tygrystygrys tcp_pagein(3z) z88dk Programmer's Manual tcp_pagein(3z) NNAAMMEE tcp_pagein - page the ZSock data area into the memory map SSYYNNOOPPSSIISS ##iinncclluuddee <> uu88__tt ttccpp__ppaaggeeiinn((vvooiidd));; DDEESSCCRRIIPPTTIIOONN The ttccpp__ppaaggeeiinn(()) function pages in the ZSock data area into segment 1 (addresses 16384-32767) of the z88s memory map. This function is primarily of use to daemons which use the ZSock dataarea for small amounts of storage. RREETTUURRNN VVAALLUUEE ttccpp__ppaaggeeiinn(()) returns the previous binding of segment 1 which should be used as a parameter to ttccpp__ppaaggeeoouutt(3z) SSEEEE AALLSSOO ttccpp__ppaaggeeoouutt(3z), ttccpp__mmaalllloocc(3z), ttccpp__ccaalllloocc(3z) ttccpp__ffrreeee(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/tcp_pageout.30000644000175000017500000000271707130401730020157 0ustar tygrystygrys tcp_pageout(3z) z88dk Programmer's Manual tcp_pageout(3z) NNAAMMEE tcp_pageout - page the ZSock data area out of the memory map SSYYNNOOPPSSIISS ##iinncclluuddee <> vvooiidd ttccpp__ppaaggeeoouutt((uu88__tt _o_l_d_b_i_n_d_i_n_g_)_; DDEESSCCRRIIPPTTIIOONN The ttccpp__ppaaggeeoouutt(()) function pages out the ZSock data area into segment 1 (addresses 16384-32767) of the z88s memory map. The parameter _o_l_d_b_i_n_d_i_n_g is the return value from a prior ttccpp__ppaaggeeiinn((33zz)) function. This function is primarily of use to daemons which use the ZSock dataarea for small amounts of storage. RREETTUURRNN VVAALLUUEE ttccpp__ppaaggeeiinn(()) returns the previous binding of segment 1 which should be used as a parameter to ttccpp__ppaaggeeoouutt(3z) SSEEEE AALLSSOO ttccpp__ppaaggeeiinn(3z), ttccpp__mmaalllloocc(3z), ttccpp__ccaalllloocc(3z) ttccpp__ffrreeee(3z) BBUUGGSS Supplying an incorrect _o_l_d_b_i_n_d_i_n_g will most likely crash the z88. AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/cat3z/tcp_RegCatchall.30000644000175000017500000000422307130401730020656 0ustar tygrystygrys tcp_RegCatchall(3z) z88dk Programmer's Manual tcp_RegCatchall(3z) NNAAMMEE tcp_RegCatchall - (De)register packet catcher SSYYNNOOPPSSIISS ##iinncclluuddee <> iinntt ttccpp__RReeggCCaattcchhaallll((iinntt _l_i_b_c_a_l_l));; DDEESSCCRRIIPPTTIIOONN The ttccpp__RReeggCCaattcchhaallll(()) function registers or deregisters a function that is used to catch all incoming packets after it has passed the basic tests of checksumming, length and ttl-checking. l-checking. The parameter lliibbccaallll is the ID for a shared library/packet call which has the prototype thus: bbooooll__tt FFuunnccttiioonn((vvooiidd **_d_p,, ssiizzee__tt _l_e_n));; Where _d_p is the address of the packet and _l_e_n is the length of the packet. This function should return TRUE/FALSE to indicate to the ZSock kernel whether the function has dealt with the packet and ZSock should not process it. RREETTUURRNN VVAALLUUEE ttccpp__RReeggCCaattcchhaallll(()) returns the previous ID of the catchall function. NNOOTTEESS Should you wish to stop calling your catchall function simply call the function with an argument of NULL. This function is of use should somebody write a driver for an as yet unsupported protocol. The package call should page in the ZSock data area using the function ttccpp__ppaaggeeiinn((33zz)). This call could for example be used to implement a tracer- oute style routine to catch ICMP replies. Returning TRUE when it has received an ICMP reply packet of the correct tyoe, and FALSE otherwise. SSEEEE AALLSSOO ttccpp__ppaaggeeiinn(3z), ttccpp__ppaaggeeoouutt(3z) AAUUTTHHOORR Dominic Morris 18 February 2000 1 z88dk-1.8.ds1/doc/netman/man3z/0000755000175000017500000000000010765202715015570 5ustar tygrystygrysz88dk-1.8.ds1/doc/netman/man3z/byteorder.30000644000175000017500000000547007130401730017647 0ustar tygrystygrys.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified Sat Jul 24 21:29:05 1993 by Rik Faith (faith@cs.unc.edu) .\" z88dk version 18/2/2000 .TH byteorder 3 "February 18 2000" "BSD" "z88dk Programmer's Manual" .SH NAME htonl, htons, ntohl, ntohs \- convert values between host and network byte order .SH SYNOPSIS .nf .B #include .sp .BI "unsigned long int htonl(unsigned long int " hostlong ); .sp .BI "unsigned short int htons(unsigned short int " hostshort ); .sp .BI "unsigned long int ntohl(unsigned long int " netlong ); .sp .BI "unsigned short int ntohs(unsigned short int " netshort ); .fi .SH DESCRIPTION The \fBhtonl()\fP function converts the long integer \fIhostlong\fP from host byte order to network byte order. .PP The \fBhtons()\fP function converts the short integer \fIhostshort\fP from host byte order to network byte order. .PP The \fBntohl()\fP function converts the long integer \fInetlong\fP from network byte order to host byte order. .PP The \fBntohs()\fP function converts the short integer \fInetshort\fP from network byte order to host byte order. .PP On the z80 the host byte order is Least Significant Byte first, whereas the network byte order, as used on the Internet, is Most Significant Byte first. .SH "CONFORMING TO" BSD 4.3 .SH NOTES Unlike on other machines these functions are not provided through macros - they are instead functions kept in z80_crt0.lib. The optimization rules supplied with z88dk are aware of these routines and when appropriate optimize the function call away. .SH AUTHOR Dominic Morris .PP Original manual page by David Metcalfe z88dk-1.8.ds1/doc/netman/man3z/DeviceOffline.30000755000175000017500000000203007130401730020342 0ustar tygrystygrys.TH DeviceOffline 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME DeviceOffline \- turn the network device online .SH SYNOPSIS .nf .B #include .sp .BI "void DeviceOffline(int "flag ); .fi .SH DESCRIPTION The \fBDeviceOffline()\fP function turns the packet driver offline so that other application may utilise the resources that it is using. .PP For example for the built in SLIP driver, turning the device online prevents polling of the serial port for incoming bytes and the sending of queued packets, thus allowing another program (e.g. Terminal) to use the serial port. .PP The parameter \fIflag\fP specifies how the device is to be turned offline, with current device drivers this has no significence. However it is envisaged that the value NOHANGUP the device will simply suspend sending and receiving packets. Whilst with HANGUP the device will hangup the line and terminate the telephone connection. .SH "RETURN VALUE" None. .SH "SEE ALSO" .BR DeviceOnline "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/DeviceOnline.30000755000175000017500000000103307130401730020206 0ustar tygrystygrys.TH DeviceOnline 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME DeviceOnline \- turn the network device online .SH SYNOPSIS .nf .B #include .sp .BI "void DeviceOnline(void); .fi .SH DESCRIPTION The \fBDeviceOnline()\fP function turns the packet driver back on again after it has been previously turned offline by \fBDeviceOffline(3z)\fP. How this is achieved depends on the device driver in use. .SH "RETURN VALUE" None. .SH "SEE ALSO" .BR DeviceOffline "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/getnetbyname.30000755000175000017500000000153407130401730020332 0ustar tygrystygrys.TH getnetbyname 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME getnetbyname, getnetbynumber \- get network entry .SH SYNOPSIS .nf .B #include .sp .BI "int getnetbyname(char *"name ); .BI "char *getnetbynumber(int "network ", char * "buf ); .fi .SH DESCRIPTION The \fBgetnetbyname()\fP function returns the standard number for the network with the name \fIname\fP. If no network is known then NULL is returned. .PP The \fBgetnetbynumber()\fP function copies into \fIbuf\fP (and returns \fIbuf\fP) the network matching the \fInetwork\fP. If no network is known then \fInetwork\fP is returned in ASCII form. .SH "RETURN VALUE" Detailed above. .SH NOTES These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/getnetbynumber.30000755000175000017500000000153407130401730020702 0ustar tygrystygrys.TH getnetbyname 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME getnetbyname, getnetbynumber \- get network entry .SH SYNOPSIS .nf .B #include .sp .BI "int getnetbyname(char *"name ); .BI "char *getnetbynumber(int "network ", char * "buf ); .fi .SH DESCRIPTION The \fBgetnetbyname()\fP function returns the standard number for the network with the name \fIname\fP. If no network is known then NULL is returned. .PP The \fBgetnetbynumber()\fP function copies into \fIbuf\fP (and returns \fIbuf\fP) the network matching the \fInetwork\fP. If no network is known then \fInetwork\fP is returned in ASCII form. .SH "RETURN VALUE" Detailed above. .SH NOTES These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/getprotobyname.30000755000175000017500000000156207130401730020710 0ustar tygrystygrys.TH getprotobyname 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME getprotobyname, getprotobynumber \- get protocol entry .SH SYNOPSIS .nf .B #include .sp .BI "int getprotobyname(char *"name ); .BI "char *getprotobynumber(int "protocol ", char * "buf ); .fi .SH DESCRIPTION The \fBgetprotobyname()\fP function returns the standard number for the protocol with the name \fIname\fP. If no protocol is known then NULL is returned. .PP The \fBgetprotobynumber()\fP function copies into \fIbuf\fP (and returns \fIbuf\fP) the protocol matching the \fIprotocol\fP. If no protocol is known then \fIprotocol\fP is returned in ASCII form. .SH "RETURN VALUE" Detailed above. .SH NOTES These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/getprotobynumber.30000755000175000017500000000156207130401730021260 0ustar tygrystygrys.TH getprotobyname 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME getprotobyname, getprotobynumber \- get protocol entry .SH SYNOPSIS .nf .B #include .sp .BI "int getprotobyname(char *"name ); .BI "char *getprotobynumber(int "protocol ", char * "buf ); .fi .SH DESCRIPTION The \fBgetprotobyname()\fP function returns the standard number for the protocol with the name \fIname\fP. If no protocol is known then NULL is returned. .PP The \fBgetprotobynumber()\fP function copies into \fIbuf\fP (and returns \fIbuf\fP) the protocol matching the \fIprotocol\fP. If no protocol is known then \fIprotocol\fP is returned in ASCII form. .SH "RETURN VALUE" Detailed above. .SH NOTES These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/getservbyname.30000755000175000017500000000155407130401730020525 0ustar tygrystygrys.TH getservbyname 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME getservbyname, getservbyport \- get service entry .SH SYNOPSIS .nf .B #include .sp .BI "tcpport_t getservbyname(char *"name ); .BI "char *getservbyport(tcpport_t "port ", char * "buf ); .fi .SH DESCRIPTION The \fBgetservbyname()\fP function returns the standard port for the service with the name \fIname\fP. If no service is known then NULL is returned. .PP The \fBgetservbyport()\fP function copies into \fIbuf\fP (and returns \fIbuf\fP) the service matching the standard port \fIport\fP. If no service is known then \fIport\fP is returned in ASCII form. .SH "RETURN VALUE" Detailed above. .SH NOTES These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/getservbyport.30000755000175000017500000000155407130401730020571 0ustar tygrystygrys.TH getservbyname 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME getservbyname, getservbyport \- get service entry .SH SYNOPSIS .nf .B #include .sp .BI "tcpport_t getservbyname(char *"name ); .BI "char *getservbyport(tcpport_t "port ", char * "buf ); .fi .SH DESCRIPTION The \fBgetservbyname()\fP function returns the standard port for the service with the name \fIname\fP. If no service is known then NULL is returned. .PP The \fBgetservbyport()\fP function copies into \fIbuf\fP (and returns \fIbuf\fP) the service matching the standard port \fIport\fP. If no service is known then \fIport\fP is returned in ASCII form. .SH "RETURN VALUE" Detailed above. .SH NOTES These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/getservprotobyname.30000755000175000017500000000167507130401730021615 0ustar tygrystygrys.TH getservprotobyname 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME getservprotobyname, getservprotobyport \- get servprotoice entry .SH SYNOPSIS .nf .B #include .sp .BI "u8_t getservprotobyname(char *"name ); .BI "u8_t getservprotobyport(tcpport_t "port ); .fi .SH DESCRIPTION The \fBgetservprotobyname()\fP function returns the appropriate protocol for the service with the name \fIname\fP. If the service isn't known then NULL is returned. .PP The \fBgetservprotobyport()\fP function returns the appropriate protocol for the service with the standard port number \fIport\fP. If the service is unknown then NULL is returned. .SH "RETURN VALUE" If a service is known to more than one protocol then the most frequently used is returned. .SH NOTES These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/getservprotobynumber.30000755000175000017500000000167507130401730022165 0ustar tygrystygrys.TH getservprotobyname 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME getservprotobyname, getservprotobyport \- get servprotoice entry .SH SYNOPSIS .nf .B #include .sp .BI "u8_t getservprotobyname(char *"name ); .BI "u8_t getservprotobyport(tcpport_t "port ); .fi .SH DESCRIPTION The \fBgetservprotobyname()\fP function returns the appropriate protocol for the service with the name \fIname\fP. If the service isn't known then NULL is returned. .PP The \fBgetservprotobyport()\fP function returns the appropriate protocol for the service with the standard port number \fIport\fP. If the service is unknown then NULL is returned. .SH "RETURN VALUE" If a service is known to more than one protocol then the most frequently used is returned. .SH NOTES These functions use a lookup table compiled into the ZSock kernel, it is not likely that method will change in the near future. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/htonl.30000644000175000017500000000002607130401730016764 0ustar tygrystygrys.so man3z/byteorder.3 z88dk-1.8.ds1/doc/netman/man3z/htons.30000644000175000017500000000002607130401730016773 0ustar tygrystygrys.so man3z/byteorder.3 z88dk-1.8.ds1/doc/netman/man3z/ntohl.30000644000175000017500000000002607130401730016764 0ustar tygrystygrys.so man3z/byteorder.3 z88dk-1.8.ds1/doc/netman/man3z/ntohs.30000644000175000017500000000002607130401730016773 0ustar tygrystygrys.so man3z/byteorder.3 z88dk-1.8.ds1/doc/netman/man3z/pktdrive.30000755000175000017500000000614707130401730017505 0ustar tygrystygrys.TH pktdrive 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME pktdrive \- packet driver descriptor structure .SH SYNOPSIS .nf .B #include .fi .SH DESCRIPTION The \fIpktdrive\fP structure defines access to a device, it is only used by the ZSock kernel. Should you wish to write a packet driver then this structure should be filled with the relevent routines. .PP All external packet drivers run at address 8192 ($2000) and it as this address that the structure should be placed. Had z88dk the capability \fIpktdrive\fP would be defined as follows: .sp .RS .nf .ne 7 .ta 8n 16n struct pktdrive { char magic[10]; char *type; char *copymsg; void (*initfunc)(void); void (*queuefn)(void *pkt, size_t len); void *(*packetfn)(void); void *(*sendfn)(void); int (*readfn)(void); void (*onlinefn)(); void (*offlinefn)(int); int (*statusfn)(void); }; .ta .fi .RE .PP The members of the \fIpktdrive\fP structure are: .TP .I magic Magic to identifier the file as a packet driver, this is defined as ZS0PKTDRV\0 .TP .I type A pointer to the type of the device .TP .I copymsg A pointer to the copyright message .TP .I initfunc A function that initialises the device during the initial configurationin this function. .TP .I queuefn A function that stores outgoing backets in a queue pending sending. Depending on the speed of the device it may also inject packets into the interface. .TP .I packetfn A function that returns the address of the incoming packet. This function is called immediately after initialisation and after the \fIreadfn\fP function (below) has returned a packet. .TP .I sendfn A function that is called on the interrupt to inject bytes out of the interface. If this function returns non-zero then packet at the address returned is freed. .TP .I readfn A function that is called on the interrupt to read incoming bytes. If the function returns non-zero then a packet is assumed to have been read, with length as returned by readfn and lying at the address specified by packetfn. .TP .I onlinefn A function that is called when the device is to be turned online .TP .I offlinefn A function that is called when the device is to be turned offline, if the parameter is non-zero then the function should hang up line (if appropriate) otherwise it should just suspend sending and receiving packets. .TP .I statusfn A function that returns the status of the device. It is envisaged that it will return 0 for offline and 1 for online though it may return other values. The value returned is left for the user to understand. .SH NOTES When the packet is passed to the driver for output a 4 bytes of header space is available at dp-4. The SLIP driver by Dominic Morris utilises these bytes to implement a linked list and to hold the length of the outgoing packet. .PP Other packet drivers might wish to copy the packet to their own address space for converting into other forms - eg CSLIP form. Alternatively they might simply create a link from their own space to the packet in the queue so to reduce time wasted copying bytes. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/QueryPackage.30000755000175000017500000000151707130401730020232 0ustar tygrystygrys.TH QueryPackage 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME QueryPackage \- open a shared library/package .SH SYNOPSIS .nf .B #include .sp .BI "bool_t QueryPackage(char " package ", char " major " , char " minor ); .fi .SH DESCRIPTION The \fBQueryPackage()\fP function checks and makes available for use the shared package \fIpackage\fP with a version of at least \fIminor\fP.\fIminor\fP .PP The function initially checks for the presence of the package subsystem and then proceeds to check for the specified package. .PP Version checking can be disabled by specifying \fIminor\fP and \fImajor\fP to be 0. .SH "RETURN VALUE" The \fBQueryPackage()\fP function returns 0 on failure or 1 on success. The carry flag is set accordingly and thus the non-standard iferror { ... } construct can be used to check for success. z88dk-1.8.ds1/doc/netman/man3z/resolve.30000755000175000017500000000146707130401730017334 0ustar tygrystygrys.TH resolve 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME resolve \- convert hostname to IP address .SH SYNOPSIS .nf .B #include .sp .BI "ipaddr_t resolve(char *"name ); .fi .SH DESCRIPTION The \fBresolve()\fP function queries any configured nameservers for the IP address of the host with the name \fIname\fP. .PP If \fIname\fP is in the form a.b.c.d then this is converted to an IP address and returned. .SH "RETURN VALUE" \fBresolv()\fP returns the network order IP address of the requested host. If the name cannot be resolved then NULL is returned. .PP \fBresolv()\fP may also be called by the macro \fBgethostbyname\fP .SH BUGS If you use the macro \fBgethostbyname\fP then beware that the ZSock implementation is not at all standard. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/reverse_addr_lookup.30000755000175000017500000000204507130401730021704 0ustar tygrystygrys.TH reverse_addr 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME reverse_addr_lookup \- convert IP address to hstname .SH SYNOPSIS .nf .B #include .sp .BI "bool_t reverse_addr_lookup(ipaddr_t "ipaddr ", char *"name ); .fi .SH DESCRIPTION The \fBreverse_addr_lookup()\fP function queries any configured nameservers for the name of the host with IP address \fIipaddr\fP. .PP If \fIipaddr\fP is not known to the queried nameservers then the \fIipaddr\fP is converted to the form a.b.c.d and returned. .SH "RETURN VALUE" \fBreverse_addr_lookup()\fP places the hostname in the buffer specified by \fIname\fP, no checks are made that this buffer is large enough to hold the full hostname. The function returns TRUE or FALSE depending on whether the queried nameservers knew \fIipaddr\fP. .PP \fBreverse_addr_lookup()\fP may also be called by the macro \fBgethostbyaddr\fP .SH BUGS If you use the macro \fBgethostbyaddr\fP then beware that the ZSock implementation is not at all standard. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_abort.30000755000175000017500000000113007130401730017766 0ustar tygrystygrys.TH sock_abort 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_abort \- abort a network connection .SH SYNOPSIS .nf .B #include .sp .BI "void sock_abort(SOCKET *"s); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to an open socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP. .PP The \fBsock_abort()\fP function will immediately move a socket into a closed state disallowing any further reads or writes. .SH "RETURN VALUE" None .SH "SEE ALSO" .BR sock_close "(3z), " sock_shutdown "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_close.30000755000175000017500000000131107130401730017765 0ustar tygrystygrys.TH sock_close 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_close \- close a network connection .SH SYNOPSIS .nf .B #include .sp .BI "void sock_close(SOCKET *"s); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to an open socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP. .PP The \fBsock_close()\fP function will initiate a close on the socket specified by \fIs\fP. Once this function has been called no more data can be written to the socket. If the socket is of type prot_TCP then data can continue to be read. .SH "RETURN VALUE" None .SH "SEE ALSO" .BR sock_abort "(3z), " sock_shutdown "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_closed.30000755000175000017500000000131307130401730020133 0ustar tygrystygrys.TH sock_closed 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_closed \- test whether a network connection is closed .SH SYNOPSIS .nf .B #include .sp .BI "bool_t sock_closed(SOCKET *"s); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to a socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP. .PP The \fBsock_closed()\fP function tests whether a socket is closed i.e. connection to a remote host has not been established or has already been closed by the kernel. .PP A socket of prot_UDP is never closed. .SH "RETURN VALUE" \fBsock_closed()\fP returns TRUE or FALSE .SH "SEE ALSO" .BR sock_opened "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_dataready.30000755000175000017500000000124107130401730020620 0ustar tygrystygrys.TH sock_dataready 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_dataready \- test whether a network connection has incoming data .SH SYNOPSIS .nf .B #include .sp .BI "size_t sock_dataready(SOCKET *"s); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to an open socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP. .PP The \fBsock_dataready()\fP function tests whether a socket has data waiting to be read by the user program. .SH "RETURN VALUE" \fBsock_dataready()\fP returns the amount of data waiting in the input queue. .SH "SEE ALSO" .BR sock_read "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_flush.30000755000175000017500000000120407130401730020002 0ustar tygrystygrys.TH sock_flush 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_flush \- flush a network connection .SH SYNOPSIS .nf .B #include .sp .BI "void sock_flush(SOCKET *"s); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to an open socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP. The socket should be of type prot_TCP. .PP The \fBsock_flush()\fP function will depending on the state of the connection either immediately send any pending data in the socket buffer or flag the data for sending in the next timer call. .SH "RETURN VALUE" None .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_listen.30000755000175000017500000000227507130401730020170 0ustar tygrystygrys.TH sock_listen 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_listen \- open a passive network connection .SH SYNOPSIS .nf .B #include .sp .BI "SOCKET *sock_listen(ipaddr_t "ipdest ", tcpport_t "lport ", .BI " void "(*handler)() ", char "proto); .fi .SH DESCRIPTION The \fBsock_listen()\fP function creates a socket descriptor for a passive (i.e. listening) connection on local port \fIlport\fP awaiting a connection from host \fIipdest\fP. At the moment only protocols prot_UDP and prot_TCP are supported. .PP To accept connections from any host specify the parameter \fIipdest\fP to be 0L. .PP The parameter \fIhandler\fP specifies a handler to be called whenever the connection changes state or new data arrives. It should be the code for a package routine. .PP The input parameters of the function \fIhandler\fP vary depending on whether the socket is of type prot_UDP or prot_TCP. .SH "RETURN VALUE" \fBsock_listen()\fP returns a socket descriptor. Specifying a non support protocol will result in the carry flag being set and the return value being EPROTONOSUPPORT. .SH "SEE ALSO" .BR sock_open "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_open.30000755000175000017500000000173507130401730017633 0ustar tygrystygrys.TH sock_open 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_open \- open an active network connection .SH SYNOPSIS .nf .B #include .sp .BI "SOCKET *sock_open(ipaddr_t "ipdest ", tcpport_t "dport ", .BI " void "(*handler)() ", char "proto); .fi .SH DESCRIPTION The \fBsock_open()\fP function creates a socket descriptor and attempts to establish a connection to the port \fIdport\fP on the host \fIipdest\fP using the protocol \fIproto\fP. At the moment only protocols prot_UDP and prot_TCP are supported. .PP The parameter \fIhandler\fP specifies a handler to be called whenever the connection changes state or new data arrives. It is of archaic interest only. .SH "RETURN VALUE" \fBsock_open()\fP returns a socket descriptor. Specifying a non-supported protocol will result in the carry flag being set and the return value being EPROTONOSUPPORT. .SH "SEE ALSO" .BR sock_listen "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_opened.30000755000175000017500000000124607130401730020141 0ustar tygrystygrys.TH sock_opened 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_opened \- test whether a network connection is established .SH SYNOPSIS .nf .B #include .sp .BI "bool_t sock_opened(SOCKET *"s); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to a socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP. .PP The \fBsock_opened()\fP function tests whether a socket is open i.e. connection to a remote host has been established. .PP A socket of prot_UDP is always established. .SH "RETURN VALUE" \fBsock_opened()\fP returns TRUE or FALSE .SH "SEE ALSO" .BR sock_closed "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_putc.30000755000175000017500000000141007130401730017633 0ustar tygrystygrys.TH sock_putc 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_putc \- write byte to a network socket .SH SYNOPSIS .nf .B #include .sp .BI "size_t sock_putc(char "c ", SOCKET *"s ); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to an open socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP .PP The \fBsock_putc()\fP function writes a single byte \fIc\fP to the socket specified by \fIs\fP. .SH "RETURN VALUE" The \fBsock_write()\fP function returns the number of bytes written to the socket (i.e. 0 or 1). If an illegal socket is supplied the carry flag will be set and the return value will be EPROTONOSUPPORT. .SH "SEE ALSO" .BR sock_write "(3z), " sock_puts (3z) .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_puts.30000755000175000017500000000141607130401730017661 0ustar tygrystygrys.TH sock_puts 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_write \- write string to a network socket .SH SYNOPSIS .nf .B #include .sp .BI "size_t sock_puts(SOCKET *"s ", char *"dp ); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to an open socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP .PP The \fBsock_puts()\fP function writes the NULL terminated string \fIdp\fP to the socket specified by \fIs\fP. .SH "RETURN VALUE" The \fBsock_write()\fP function returns the number of bytes written to the socket. If an illegal socket is supplied the carry flag will be set and the return value will be EPROTONOSUPPORT. .SH "SEE ALSO" .BR sock_write "(3z), " sock_putc (3z) .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_read.30000755000175000017500000000144607130401730017604 0ustar tygrystygrys.TH sock_read 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_read \- read bytes from a network socket .SH SYNOPSIS .nf .B #include .sp .BI "size_t sock_read(SOCKET * "s ", void * "dp " , size_t " len ); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to an open socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP .PP The \fBsock_read()\fP function reads at most \fIlen\fP bytes from the socket \fIs\fP and places them at \fIdp\fP. \fIdp\fP which should be in the lower 16k of the memory map. .SH "RETURN VALUE" The \fBsock_read()\fP function returns the number of bytes read from the socket. If an illegal socket is supplied the carry flag will be set and the return value will be EPROTONOSUPPORT. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_shutdown.30000755000175000017500000000124707130401730020543 0ustar tygrystygrys.TH sock_shutdown 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_shutdown \- abort a network connection .SH SYNOPSIS .nf .B #include .sp .BI "void sock_close(SOCKET *"s); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to an open socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP. .PP The \fBsock_shutdown()\fP function wipes all trace of the socket \fIs\fP from the system. It should be preceded by either a \fBsock_close(3z)\fP or \fBsock_abort(3z)\fP depending on the circumstances. .SH "RETURN VALUE" None .SH "SEE ALSO" .BR sock_close "(3z), " sock_abort "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/sock_write.30000755000175000017500000000160207130401730020015 0ustar tygrystygrys.TH sock_write 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME sock_write \- write bytes to a network socket .SH SYNOPSIS .nf .B #include .sp .BI "size_t sock_write(SOCKET *"s ", void *"dp " , size_t "len ); .fi .SH DESCRIPTION The parameter \fIs\fP is a descriptor to an open socket created using \fBsock_open(3z)\fP or \fBsock_listen(3z)\fP .PP The \fBsock_write()\fP function writes a stream of bytes to the open socket specified by \fIs\fP. The data of length \fIlen\fP is taken from address \fIdp\fP which should be in the lower 16k of the memory map. .SH "RETURN VALUE" The \fBsock_write()\fP function returns the number of bytes written to the socket. If an illegal socket is supplied the carry flag will be set and the return value will be EPROTONOSUPPORT. .SH "SEE ALSO" .BR sock_putc "(3z), " sock_puts "(3z) .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/tcp_calloc.30000644000175000017500000000344607130401730017754 0ustar tygrystygrys.TH tcp_malloc 3 "February 18 2000" "" "z88dk Programmer's Manual" .SH NAME tcp_calloc, tcp_malloc, tcp_free \- Allocate and free memory .SH SYNOPSIS .nf .B #include .sp .BI "void *tcp_calloc(size_t " "nmemb" ", size_t " "size" ");" .nl .BI "void *tcp_malloc(size_t " "size" ");" .nl .BI "void tcp_free(void " "*ptr" ");" .nl .fi .SH DESCRIPTION .B calloc() allocates memory for an array of .I nmemb elements of .I size bytes each and returns a pointer to the allocated memory. The memory is set to zero. .PP .B malloc() allocates .I size bytes and returns a pointer to the allocated memory. The memory is not cleared. .PP .B free() frees the memory space pointed to by .IR ptr , which must have been returned by a previous call to .BR malloc() or .B calloc() Otherwise, or if .BI "free(" "ptr" ) has already been called before, undefined behaviour occurs. If .I ptr is .BR NULL , no operation is performed. .PP .SH "RETURN VALUES" For .BR calloc() " and " malloc() , the value returned is a pointer to the allocated memory, which is suitably aligned for any kind of variable, or .B NULL if the request fails. .PP .B free() returns no value. .PP .SH "SEE ALSO" .BR tcp_pagein "(3z) ," tcp_pageout (3z) .SH NOTES These functions manipulate memory in a private memory page belonging to ZSock. This 16k page holds all the buffers that ZSock uses and hence requests for large amounts of memory are likely to fail (and in any case are not recommended). .PP This facility has been offered to allow daemons to be written simply (they have no address space of their own). User applications should not use these facilities. If a large (>256 bytes) amount of memory is required for a user application then the application should either be of the BAD type or be redesigned. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/tcp_free.30000644000175000017500000000344607130401730017440 0ustar tygrystygrys.TH tcp_malloc 3 "February 18 2000" "" "z88dk Programmer's Manual" .SH NAME tcp_calloc, tcp_malloc, tcp_free \- Allocate and free memory .SH SYNOPSIS .nf .B #include .sp .BI "void *tcp_calloc(size_t " "nmemb" ", size_t " "size" ");" .nl .BI "void *tcp_malloc(size_t " "size" ");" .nl .BI "void tcp_free(void " "*ptr" ");" .nl .fi .SH DESCRIPTION .B calloc() allocates memory for an array of .I nmemb elements of .I size bytes each and returns a pointer to the allocated memory. The memory is set to zero. .PP .B malloc() allocates .I size bytes and returns a pointer to the allocated memory. The memory is not cleared. .PP .B free() frees the memory space pointed to by .IR ptr , which must have been returned by a previous call to .BR malloc() or .B calloc() Otherwise, or if .BI "free(" "ptr" ) has already been called before, undefined behaviour occurs. If .I ptr is .BR NULL , no operation is performed. .PP .SH "RETURN VALUES" For .BR calloc() " and " malloc() , the value returned is a pointer to the allocated memory, which is suitably aligned for any kind of variable, or .B NULL if the request fails. .PP .B free() returns no value. .PP .SH "SEE ALSO" .BR tcp_pagein "(3z) ," tcp_pageout (3z) .SH NOTES These functions manipulate memory in a private memory page belonging to ZSock. This 16k page holds all the buffers that ZSock uses and hence requests for large amounts of memory are likely to fail (and in any case are not recommended). .PP This facility has been offered to allow daemons to be written simply (they have no address space of their own). User applications should not use these facilities. If a large (>256 bytes) amount of memory is required for a user application then the application should either be of the BAD type or be redesigned. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/tcp_malloc.30000644000175000017500000000344707130401730017767 0ustar tygrystygrys.TH tcp_malloc 3 "February 18 2000" "" "z88dk Programmer's Manual" .SH NAME tcp_calloc, tcp_malloc, tcp_free \- Allocate and free memory .SH SYNOPSIS .nf .B #include .sp .BI "void *tcp_calloc(size_t " "nmemb" ", size_t " "size" ");" .nl .BI "void *tcp_malloc(size_t " "size" ");" .nl .BI "void tcp_free(void " "*ptr" ");" .nl .fi .SH DESCRIPTION .B calloc() allocates memory for an array of .I nmemb elements of .I size bytes each and returns a pointer to the allocated memory. The memory is set to zero. .PP .B malloc() allocates .I size bytes and returns a pointer to the allocated memory. The memory is not cleared. .PP .B free() frees the memory space pointed to by .IR ptr , which must have been returned by a previous call to .BR malloc() or .B calloc() Otherwise, or if .BI "free(" "ptr" ) has already been called before, undefined behaviour occurs. If .I ptr is .BR NULL , no operation is performed. .PP .SH "RETURN VALUES" For .BR calloc() " and " malloc() , the value returned is a pointer to the allocated memory, which is suitably aligned for any kind of variable, or .B NULL if the request fails. .PP .B free() returns no value. .PP .SH "SEE ALSO" .BR tcp_pagein "(3z) ," tcp_pageout (3z) .SH NOTES These functions manipulate memory in a private memory page belonging to ZSock. This 16k page holds all the buffers that ZSock uses and hence requests for large amounts of memory are likely to fail (and in any case are not recommended). .PP This facility has been offered to allow daemons to be written easily (they have no address space of their own). User applications should not use these facilities. If a large (>256 bytes) amount of memory is required for a user application then the application should either be of the BAD type or be redesigned. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/tcp_pagein.30000755000175000017500000000135407130401730017761 0ustar tygrystygrys.TH tcp_pagein 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME tcp_pagein \- page the ZSock data area into the memory map .SH SYNOPSIS .nf .B #include .sp .BI "u8_t tcp_pagein(void); .fi .SH DESCRIPTION The \fBtcp_pagein()\fP function pages in the ZSock data area into segment 1 (addresses 16384-32767) of the z88s memory map. .PP This function is primarily of use to daemons which use the ZSock dataarea for small amounts of storage. .SH "RETURN VALUE" \fBtcp_pagein()\fP returns the previous binding of segment 1 which should be used as a parameter to \fBtcp_pageout\fP(3z) .SH "SEE ALSO" .BR tcp_pageout "(3z), " tcp_malloc (3z), " tcp_calloc"(3z) .BR tcp_free "(3z)" .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/tcp_pageout.30000755000175000017500000000166307130401730020165 0ustar tygrystygrys.TH tcp_pageout 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME tcp_pageout \- page the ZSock data area out of the memory map .SH SYNOPSIS .nf .B #include .sp .BI "void tcp_pageout(u8_t "oldbinding); .fi .SH DESCRIPTION The \fBtcp_pageout()\fP function pages out the ZSock data area into segment 1 (addresses 16384-32767) of the z88s memory map. .PP The parameter \fIoldbinding\fP is the return value from a prior \fBtcp_pagein(3z)\fP function. .PP This function is primarily of use to daemons which use the ZSock dataarea for small amounts of storage. .SH "RETURN VALUE" \fBtcp_pagein()\fP returns the previous binding of segment 1 which should be used as a parameter to \fBtcp_pageout\fP(3z) .SH "SEE ALSO" .BR tcp_pagein "(3z), " tcp_malloc (3z), " tcp_calloc"(3z) .BR tcp_free "(3z)" .SH BUGS Supplying an incorrect \fIoldbinding\fP will most likely crash the z88. .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/netman/man3z/tcp_RegCatchall.30000755000175000017500000000302207130401730020661 0ustar tygrystygrys.TH tcp_RegCatchall 3z "18 February 2000" "" "z88dk Programmer's Manual" .SH NAME tcp_RegCatchall \- (De)register packet catcher .SH SYNOPSIS .nf .B #include .sp .BI "int tcp_RegCatchall(int "libcall ); .fi .SH DESCRIPTION The \fBtcp_RegCatchall()\fP function registers or deregisters a function that is used to catch all incoming packets after it has passed the basic tests of checksumming, length and ttl-checking. l-checking. .PP The parameter \fBlibcall\fP is the ID for a shared library/packet call which has the prototype thus: .sp .BI "bool_t Function(void *" dp ", size_t "len ); .PP Where \fIdp\fP is the address of the packet and \fIlen\fP is the length of the packet. This function should return TRUE/FALSE to indicate to the ZSock kernel whether the function has dealt with the packet and ZSock should not process it. .SH "RETURN VALUE" \fBtcp_RegCatchall()\fP returns the previous ID of the catchall function. .SH NOTES Should you wish to stop calling your catchall function simply call the function with an argument of NULL. .PP This function is of use should somebody write a driver for an as yet unsupported protocol. .PP The package call should page in the ZSock data area using the function \fBtcp_pagein(3z)\fP. .PP This call could for example be used to implement a traceroute style routine to catch ICMP replies. Returning TRUE when it has received an ICMP reply packet of the correct tyoe, and FALSE otherwise. .SH "SEE ALSO" .BR tcp_pagein "(3z), " tcp_pageout (3z) .SH AUTHOR Dominic Morris z88dk-1.8.ds1/doc/options.txt0000644000175000017500000001222407130401726015506 0ustar tygrystygrysThis is intended to be a quick reference to the types of code that z88dk can produce - there is now a plethora of flags controlling almost every aspect of it, and needless to say it has got quite confusing (even for me!) so now follows a quick reminder of what can be achieved! BASIC Programs -------------- The default type of output code produced by z88dk, it requires no flags other than those for any libraries that you wish to link in, eg: % zcc -lm -lgfx cube.c Will compile file cube.c into a BASIC program whilst pulling in routines from the generic maths library and the graphics library. Applications ------------ This is where the fun begins, to create an application in the .63 form we need two flags, one to trigger the compiler into producing appropriate code (essentially using DEFVARS instead of defs to create storage), and another to call the "appmaker" program. eg: % zcc -create-app -make-app -lgfxapp dstar.c Will compile the dstar.c file into an application whilst pulling in routines from the application graphics library (We need different libraries for applications and BASIC programs due to paging requirements - essential so we don't page the executing code out!) We can further tweak the compilation; suppose you want to combine several apps onto one card (using some other program to achieve this), the default address that the application is compiled to is 49152, if you wish to compile to a different address use the following command line: % zcc -zorg=[address in decimal] -create-app -make-app -lgfxapp dstar.c Which if the address is > 49152 will create a truncated .63 image from the address supplied. The application is of course org'd to this address. To change the amount of bad memory given to a bad application (or ugly popdown) we use the flag -reqpag= where reqpag is the number of 256 byte pages that we require. This flag is also very useful for giving back memory to the system on preemption - have a look at the dstar.c and rpn.c examples for examples of the usage of reqpag. Using the defaults for application creation it isn't possible to create a good application which uses static variables (by default these are placed in "bad memory") however, should you wish to do this then a couple of flags can come to your rescue! As you know each application is allowed certain amounts of "safe memory" to store some static variables (usually used to hold the "far pointer" to some allocated memory), the startup code for applications uses some of this space to hold some extremely useful information (have a look at the app_crt0.asm file in the lib directory for the gory details). The flags of concern are -safedata=[number] and -defvars=[address]. -safedata tells the compiler how much safe memory *your* code requires and -defvars is used to place static variables at this address. These options should really only be used by those who should know better (I myself have not even used them!) but some brief information: - Your safedata area starts at $1FFD-[num of bytes reqd], so if you need $10 bytes then your defvars flag should be -defvars=$1FED It is probably a good idea not to specify -defvars on the command line - but to place it in the C file using the #pragma directive - this allows multifile projects to be compiled without variable space clash. Intuition Debugging Of Application ---------------------------------- By supplying the flag -intuition to the compiler the necessary call is inserted in the startup code to enable the program to be debugged via Intuition (the Z88 debugger from Interlogic). You will need to blow the application to an EPROM with Intuition and adjust the application DOR appropriately. For more details read the very fine documentation that came with your copy of Assembler Workbench. [I'm getting a strange sense of deja-vu regarding the names of these programs ] Absolute Address Code --------------------- The compiler can also produce code that can run from an absolute address, this is perhaps most suitable for use from within a BASIC program with a well known memory map. To invoke it use: % zcc -startup=3 -ofile.bin [files] And file.bin will be a self contained C program or module, which can be utilised via the BASIC command CALL 16384. To compile it to a different address use the -zorg= flag. Relocatable Code ---------------- Thanks to the relocation feature of z80asm it is possible to produce code which can be run from any address in RAM. To switch into this mode supply the -R flag to the frontend. At present it is not possible to pass parameters from BASIC to the compiled C program - a way of translating BBC BASICs parameter passing method into the argc/argv method used by C is something of headache the moment. Spectrum Startup Code --------------------- To compile code for the ZX Spectrum use the flag +zx Support is steadily improving and can only get better. Likewise for other machines: +zxansi - Use ZX VT100 terminal +vz - Create a file for a VZ200/300 +nc - Create an application image for the Amstrad nc100 ---- I hope that I've covered most of the important flags of the compiler which affect the type of code that is produced. If you have any questions just ask me! djm 18/4/2000 z88dk-1.8.ds1/doc/packages.txt0000644000175000017500000000475607130401727015605 0ustar tygrystygrysWriting Packages With z88dk At the time of writing, the package subsystem by Garry Lancaster has not fully been finalised so where differences exist between this document and the documentation supplied by Garry, his should take precedence. A package is always attached to a application eg. The Packege Package is attached to Installer and the TCP Package is attached to the application ZSock, thus building a package with z88dk is tied to building an application. As result this documentation is written with the assumption that you know how to write and build applications with z88dk. Constructing the Package DOR ---------------------------- The package DOR is the structure which informs the Package system about your package. Creating the DOR with z88dk is incredibly simple. Normally to create an application DOR you would do the following: #include /* Define application paramaters */ #include In a similar vein, to build the package DOR you do the following: #include /* Define package parameters */ #include /* Define table of pointers to functions (jump table)*/ /* Define application parameters */ #include The package parameters are as follows: #define MAKE_PACKAGE 1 Say that you do want to create a package(! #define PACK_VERSION $MMmm The version of the package you are creating - MM=major, mm=minor #define PACK_NAME "[name]" The name of the package (without the [] of course!) #define PACK_BOOT This should be set to either 0 or 1 depending on whether the package should autoboot or not (This is of course bypassed by holding down 'P' on reset) #define PACKAGE_ID $xx The package number as allocated by Garry Lancaster #define MAX_CALL_NUM $nn The maximum LSB of a call to your package. Setting Up The Jump Table ------------------------- The jump table can be easily defined using the following construct: package_str blahfishcakeblah[] = { {Func1}, {Func2}, .... {FuncN} }; Remember to prototype as external to the file Func1....FuncN Finally ------- You have to supply 3 functions yourself to fully define the package, these are the pack_ayt, pack_bye and pack_dat functions. Due to the complex entry and exit parameters of these functions they are best written in assembler. For more details about these calls please see Garry's documentation. These functions must either be prototyped (to allow correct linking) At a later date these 3 functions may be writable in C if there's enough demand for the ability. dom 3/3/2000 z88dk-1.8.ds1/doc/platforms.txt0000644000175000017500000001147710631472636016043 0ustar tygrystygrysZ88DK Port Status $Id: platforms.txt,v 1.15 2007/06/06 08:51:42 stefano Exp $ PLATFORM | Native I/O | ANSI VT I/O | GRAPH LIB | GRAY LIB | FILELIB | ZSOCK | SOUND | Others | ------------------------------------------------------------------------------------------------------------------------------- | | | | | | | | | ABC80 | No | 40x24-buggy | No | No | No | No | --- | --- | Amstrad NC100 | Yes | No | No | No | No | No | --- | Untested | Amstrad CPC | Yes | 20-80x25 COL| 256x192 | No | No | No | --- | Alt. FP lib | Aquarius | 38x25 | 40x24 COL| No | No | No | No | 1 bit | --- | Cambridge Z88 | Yes | Yes | 256x64 | No | Yes | Yes | 1 bit | Paging+many | Commodore 128 | No | 40x25 COL| No | No | No | No | --- | --- | CP/M | Yes | If Hardware | No | No | Yes | No | --- | --- | Jupiter ACE | No | 32x24 B/W| 96x64 emul. | No | No | No | 1 bit | --- | MSX 1 | 40x24 | No | No | No | No | No | --- | --- | NASCOM 1/2 | 48x15 | 48x16 B/W| Unfinished | No | No | No | --- | --- | REX 6000 | No | No | No | No | No | No | --- | (1) | NewBrain | Yes | No | No | No | Yes | No | --- | --- | Rabbit C.M. | | No | No | No | No | No | --- | --- | Sam Coupe | 32x24-buggy | No | No | No | No | No | --- | --- | Sega Master S | | | | No | | No | | --- | Sharp MZ | 40x25 | 40x25 COL| 80x50 | No | No | No | --- | (2) | Sharp OZ | Yes | 59x10 B/W| 239x80 | No | No | No | --- | (3) | SORD M5 | 32x24 | No | No | No | No | No | --- | --- | Spectravideo | 40x24 | No | No | No | No | No | --- | --- | Sprinter | 80x35 | 80x35 COL| No | No | Yes | No | --- | (4) | TI82 | 16x8 | 32x4 B/W| 96x64 | Yes | No | No | 1 bit | --- | TI83 | 16x8 | 32x4 B/W| 96x64 | Yes | In Progress | No | 1 bit | --- | TI83 Plus | 16x8 | 32x4 B/W| 96x64 | Yes | No | No | 1 bit | --- | TI85 | 21x8 | 32x4 B/W| 128x64 | Yes | No | No | 1 bit | --- | TI86 | 21x8 | 32x4 B/W| 128x64 | Yes | No | No | 1 bit | --- | VZ/Laser 200 | 32x16 | 32x12 B/W| 128x64 | No | No | No | --- | --- | ZX 81 | 32x21-buggy | 32x21 B/W| 96x64 emul. | No | No | No | --- | FP Unstable | ZX Spectrum | 32x24+64x24 |24..85x24 COL| 256x192 | No | +3 | No | 1 bit | (5) | ZXVGS | | | | | Yes | | | | | | | | | | | | | (1) The Xircom REX 6000 port provides hooks into the native OS. No z88dk i/o functions are supported (2) Flagged for a lot of time as "instable" because of an emulator instability !! (3) Much of the "OZDK" functions are ported; at the moment doesn't work if code size > 8Kbytes. (4) Sprinter has many "standard" functions implemented (5) Work on a +3 (and others) file library is in progress FP Unstable = On these platforms there are problems using some of the "special" registers, making some functions crash. The float variables, for example, can't be used (for now). z88dk-1.8.ds1/doc/retarget.txt0000644000175000017500000001337507454524662015656 0ustar tygrystygrysRetargetting the Compiler For Other Z80 Based Machines ------------------------------------------------------ [Document under construction] The compiler part of the Z88DK produces perfectly standard Z80 assembler, to this end it could easily be retargetted to other Z80 based machines with the minimum of effort. In order to port for other Z80 machines a new startup file has to be supplied along with slightly rewritten library functions. The startup file for the Z88 is located in the {zcc}/lib directory and is called z88_crt0.asm, it just provides a simple way to interface machine code programs to BASIC - in it is contained a short BASIC program which calls the startup code. In the case of the Z88 the startup code allocates memory for the atexit() stack and installs a simple error handler which exits to BASIC when escape is pressed. The file also includes the floating point routines if required by any module in a project. Also defined in this file are LIBrary references to the various runtime routines used by generated code - such as routines to divide and multiply etc. Unlike the earlier versions of Small C runtime routines are only linked in if they are used, for example if your programs doesn't do any multiplication or division then these routines will not be included in the generated executable, hence resulting in much smaller executables. This is a very fine idea, however potential problems may arise if you have retargetted the compiler to another Z80 system eg the ZX Spectrum and wish to generate executables which access far code. The Z88 has a very flexible method of memory paging - (virtually) any bank can be placed in any 16k segment of the Z80 physical address space, and hence it is irrelevant where the code to access far data is located. However in the case of the Spectrum 128 memory can only be paged in the top 16k of address space and, well, I think you see the problem - the code to access far data is in danger of being paged out. To circumvent this, place the routines which access far data (the lp_* routines in the libsrc/crt0 directory) in with the startup code - this will slightly increase the executable size but will almost guarantee no embarrassing paging out mistakes (assuming of course that your startup code is located in low memory). A short startup for the ZX Spectrum is now in lib/spec_crt0.asm file, a few Spectrum specific functions have been written so that many of the examples for the z88 now compile and work on the Spectrum as well. Floating Point Routines ----------------------- A set of floating point routines is supplied which will work on any Z80 (it does use undocumented opcodes, but...), however should you wish to write your own to utilise the fp calculator in your machines ROM, take a look at the mathz88.asm file in the lib directory for a template, the chances are you'll need to change the constant for 0.1 in the const.c file, but let me know and I'll add another flag to the compiler! Stdio Library Routines ---------------------- The "new" stdio library is now almost completely machine independent however obviously some low level routines are needed in order for the generic routines to work, here I shall list the required routines: int fgetc_cons(void) Should read a key from the keyboard returning the ASCII key value in hl. This routine should return 0 if no key is pressed, however unless an error occurs it should wait for a keypress. void fputc_cons(char code) Should print code to the screen int fgets_cons(char *buf, int maxlen) Should read a string from the keyboard. Done this way because some computers (i.e. z88) have an OS call to do this which offers editing facilities void puts_cons(char *str) [optional] Writes a NULL terminated string to the console, this call is provided to conserve memory usage should no other stdio routines be required int getk(void) [optional] Should read the current state of the keyboard, returning NULL if no key is pressed Should you require file handling you will need the following standard routines from fcntl.h (or unistd.h as it is sometimes known), should you not want file-handling for your machine then these functions should be NULL functions (chances are they won't be called!): int open(far char *name, int flags, mode_t mode); int creat(far char *name, mode_t mode); int close(int fd); size_t read(int fd, void *ptr, size_t len); size_t write(int fd, void *ptr, size_t len); long lseek(int fd,long posn, int whence); int open_z88(far char *name, int flags, mode_t mode, char *explicit, size_t len) This is a non-standard routine and on most machines will probably just call open() however this provides the facility to return the explicit file name (which is placed in explicit, up to a maximum length len) extern int __FASTCALL__ readbyte(int fd); This function reads a byte from filehandle fd (which is supplied in the register pair hl), if an error occurred it should return EOF (-1) and return with carry set. Otherwise it should return with carry reset and hl holding the byte just read extern int writebyte(int fd, int c); This function writes byte c to filehandle fd, once more if an error occurs it should return EOF and carry set, otherwise hl holds the byte just written and carry is reset void fabandon(FILE *fp) Abandon file with the handle fd - this is called by the system on program exit should it not be able to close a file. This function is a dummy function on the z88 but for example on the Spectrum +3 this function would be of use. Once you have supplied the above functions the entire z88dk stdio library is available to you (including printf etc) in addition to all the ctype, string, assert, setjmp, near malloc, some stdlib and the generic math routines - just a little work yields over 100 usable functions! dom, 9/4/2000 z88dk-1.8.ds1/doc/stdio.txt0000644000175000017500000000351707130401727015143 0ustar tygrystygrysz88dk New Stdio Library - 4/4/2000 djm Yup, after ages of promising I've finally gotten around to updating the crusty stdio of z88dk. This new library finally dumps the equivalence of file handles and streams and hence brings the model more into line with libraries for "big C" The library is now highly portable across machines - to gain basic functionality on another machine just 3 functions have to be written - write character to console, read character from console and read string from console. At the moment for simplicities sake, file streams are not buffered, though adding buffering should be fairly trivial - if there is enough demand/clamouring then I can add it. It is highly recommended that your programs use the new library (it is the default and simply recompiling will enable support) even though it is slightly larger it offers many advantages: - Standard ANSI return values (I hope) - Standard ANSI functions (gets() is now defined correctly, and other functions behave in a standard manner (eg putchar() will now output to whatever stdout is instead of always to the console) - An ungetc() function - hurrah! - All streams are closed on program exit - minisprintf now uses the minivfprintf core routine and thus now supports long datatypes - freopen(_z88) is now available There are some as yet unresolved disadvantages: - Your program becomes slightly larger - A maximum of 7 open streams (10 in total including std*) This last point is not a particular disadvantage - you can of course open files using open() and creat() however files opened this way are /not/ automatically closed on program exit. Should you wish to use the old stdio routines then do a #define FDSTDIO 1 before including and link with -lz88 and you can use them, however you should note that the printf() family of functions is not available. djm 4/4/2000 z88dk-1.8.ds1/doc/ti.txt0000644000175000017500000001166607307445237014453 0ustar tygrystygrys------------------------------------------------------------------------------- Compiling for the Ti82, Ti83(+), Ti85 and Ti86 ; By Henk Poley ; 05-jun-2001 ------------------------------------------------------------------------------- general compilation command: zcc [+..] [-startup=..] [-o..] [-l..] [flags] file(s) [+..] - Config file to load: Ti82 Ti82ansi Ti83 Ti83ansi Ti8x Ti8xansi Ti85 Ti85ansi Ti86 Ti86ansi [-startup=..] - Startup header to use (see below for values) [-o..] - Binary output file (standard a.bin) [-l..] - Link this library (see zcc.html for others): tigray82 tigray83 tigray83p tigray85 tigray86 [flags] - For other flags see compile.txt file(s) - File(s) to compile ------------------------------------------------------------------------------- Ti82: compiles for CrASH (always) #pragma string name xxx - program description, max 22 characters (approx) #pragma output nostreams - If you just don't use the streams at all (no text and file-stuff) #pragma output atexit - If you use the atexit() command (uses 64 bytes extra stack). ------------------------------------------------------------------------------- Ti83: zcc [+..] [-startup=..] [-o..] [-l..] file(s) -startup = n - Primary shell(s); compatible shell(s) (Primary shell merely means it's the smallest implementation for that shell, that uses full capabilities of the shell) 1 - Ion; Ti-Explorer (default) 2 - Venus; 3 - ZES; 4 - Anova; SOS 5 - Ti-Explorer, AShell; SOS, Anova (same as 6) 6 - AShell, Ti-Explorer; SOS, Anova (same as 5) 7 - SOS; Anova 8 - Venus Explorer (VE); Venus 9 - Ion, Ti-Explorer; ZASMLOAD, plain TIOS 10 - Plain TIOS, ZASMLOAD #pragma string name xxx - program description, max 22 characters (approx) #pragma data icon xx,xx,xx; - shell icon 5 (Anova), 7 (VE), or 8 (rest) bytes long. Bigger icons won't brake anything, they are just displayed truncated (with most of the shells). Standard icon is "C+". #pragma output nostreams - If you just don't use the streams at all (no text and file-stuff) #pragma output atexit - If you use the atexit() command (uses 64 bytes extra stack). ------------------------------------------------------------------------------- Ti83+ (Second Edition): zcc -startup = n - Primary shell, compatible shells (Primary shell merely means it's the smallest implementation for that shell, that uses full capabilities of the shell) 1 - Ion (default) 2 - MirageOS without quit key 3 - MirageOS with quit key - *dangerous* (possibly) 4 - TSE Kernel #pragma string name xxx - program description, max 22 characters (approx) #pragma data icon xx,xx,xx; - shell icon 8 bytes long. Standard icon is "C+". #pragma data mirage_icon xx,xx,xx; - Icon for MirageOS, 16 bytes long. Standard icon is a 'map' with "C+" written on it. #pragma output GimmeSpeed - Will switch the Ti83+ Second Edition to 15MHz during runtime. Setting this when compiling for the normal Ti83+ won't brake anything. It will return to the shell at the normal 6MHz. This won't work when using grayscale, until there is made a "high speed" IM2 grayscale interrupt... NOTE: Only works with ROM v1.13 and higher. #pragma output StackNeeded = nnn; - External Data Required for virtual stack. TSE uses this value, it is standard set to 400 bytes, which equals to the normal stackspace of the Ti83+. When you think your program uses more or less than that, try a bit to find the best value. #pragma output nostreams - If you just don't use the streams at all (no text and file-stuff) #pragma output atexit - If you use the atexit() command (uses 64 bytes extra stack). ------------------------------------------------------------------------------- Ti85: compiles for Rigel (always) #pragma string name xxx - program description #pragma output nostreams - If you just don't use the streams at all (no text and file-stuff) #pragma output atexit - If you use the atexit() command (uses 64 bytes extra stack). ------------------------------------------------------------------------------- Ti86: zcc -startup = n - Primary shell(s); compatible shell(s) (Primary shell merely means it's the smallest implementation for that shell, that uses full capabilities of the shell) 1 - LASM (default) 2 - ASE, Rascal, emanon, etc. 3 - zap2000 4 - emanon 5 - Embedded LargeLd - !!!EXPERIMENTAL!!! 10 - asm() executable #pragma string name xxx - program description #pragma data icon xx,xx,xx; - shell icon 8 bytes long. Standard icon is "C+". #pragma output nostreams - If you just don't use the streams at all (no text and file-stuff) #pragma output atexit - If you use the atexit() command (uses 64 bytes extra stack). z88dk-1.8.ds1/doc/windows.txt0000644000175000017500000000615607307445237015527 0ustar tygrystygrys------------------------------------------------------------------------------- Setting up the z88dk for Windows9x ; By Henk Poley ; 05-jun-2001 ------------------------------------------------------------------------------- To begin with, these steps have only been tested on Windows95 & 98 (Lite), but they should work on other (Windows) platforms as long as they have 32bit DOS capabilities and long filenames. Maybe you will need to add entries to the PATH and environment variables in a different way than described here, because AUTOEXEC.BAT is no longer in use (Windows ME/NT/2000/XP), please revert to the manuals if it doesn't seem to work this way. You could also ask us, the makers of the z88dk, off coarse... This is going to be a step-by-step guide, please don't feel embarrassed. First unzip all files in the archive to a directory. We will call this directory from now on {z88dk}. Now you will need the Windows executables from which a link can found on the z88dk's website (http://z88dk.sourceforge.net/). Unzip the files into {z88dk}\bin. Now for the following steps open your AUTOEXEC.BAT file, you will find it in your C:\ directory. If it isn't there, create it. Then search for the line beginning with "PATH" or "SET PATH=". Add {z88dk}\bin\ to it, you will get a line like the following. Note that you need to separate different entries with a colon ';' (in this case {z88dk} is "c:\dos\z88dk"). PATH c:\dos\tools\;c:\dos\z88dk\bin\ Now we have to setup where the z88dk needs to look for it's data files (libraries, assembly and config files needed during compile time). Add the following lines to your AUTOEXEC.BAT (remark that all "DOS" backslashes need to be turned into "unix" slashes): SET Z80_OZFILES = {z88dk}/LIB/ SET ZCCCFG = {z88dk}/LIB/CONFIG/ You will get for example: SET Z80_OZFILES = C:/DOS/Z88DK/LIB/ SET ZCCCFG = C:/DOS/Z88DK/LIB/CONFIG/ Save your new AUTOEXEC.BAT in the root (C:\). Now you need a text-editor that can search-and-replace in more documents at one time (like TextPad or UltraEdit, search for them at http://www.downloads.com/). We need this when editing the config files. You could also only change the config (*.cfg) files of the platforms you will work with, you will then only need Notepad or similar programs. Open a DOS-window and type: cd {z88dk} cd lib cd config copy *.lnx *.cfg Now go to {z88dk}\lib\config within Windows. Select all .cfg files and open them with the text-editor. If it doesn't open them in the right program, hold shift down and right click on the files. Chose "open with...", then deselect the "use always" selection, and select your program, then press "OK". Now find the search-and-replace utility in your text-editor. Replace the following (can also be done manualy on one file): cp -> copy DESTDIR -> {z88dk} (remove the "DOS" backslash at the end!) / -> \ ("unix" slashes into "DOS" backslashes) Restart your PC and there you go. For info about using the z88dk please revert to other documentation found in the {z88dk}\doc\ directory, like compile.txt and zcc.html. Have a nice day, Henk Poley z88dk-1.8.ds1/doc/z80asm.txt0000644000175000017500000027142007130401727015143 0ustar tygrystygrysTHE Z80 CROSS ASSEMBLER, V1.0.16 (30th January 2000) Thank you for purchasing a copy of this cross assembler. We have made an effort to program an easy user interface and efficient assembler source file compiling. The object file and library format is an invention of our own and has also been included in this documentation. We hope that you will enjoy your Z80 machine code programming with our assembler. We have made an effort to produce a fairly easy-to-understand documentation. If you have any comments or corrections, please don't hesitate to contact us: Gunther Strube Gl. Kongevej 37, 4.tv. DK-1610 Kobenhavn V Denmark e-mail gbs@image.dk 1.0 Running the asssembler Since assemblers are developed for programmers the user interface have been implemented according to the standard command line environment (CLI) used in most operating systems; however, if only a GUI interface is available (as in MacOS) then a command shell must be executed to allow standard command line input. The Z80 Module Asssembler command line interface may change if other programmers wish to implement a different interface to the assembler. You have the opportunity! o The help page When executing the assembler from the command line without parameters, i.e. pressing after the assembler program name, a help page is automatically displayed whereafter control is returned to the operating system command line. The page shortly explains the syntax of parameter specification and which parameters are available. o The command line The syntax of the assembler parameters is a streightforward design. Filenames or a project file are always specified. The options may be left out: z80asm [options] | <@modulesfile> As seen above must be specified first. Then you enter the names of all files to be assembled. You either choose to specify all file names or a @ containing all file names. File name may be specified with or without the 'asm extension. The correct filename parsing is handled automatically by the assembler. As seen on the syntax at least on source file must be specified and may be repeated with several file names. Only one project file may be specified if no source file names are given. Many of the parameters are preset with default values which gives an easy user interface when specifying the assembly parameters. Only advanced parameters need to be specified explicitly. The help page displays the default parameter values at the bottom of the page. o The assembler options Options are used to control the assembly process and output. They are recognized by the assembler when you specify a leading minus before the option identifier ('-'). Options are always specified before file names or project files. When the assembler is executed options are all preset with default values and are either switched ON or OFF (active or not). All options have a single letter identification. Upper and lower case letters are distinguished, which means that 'a' might be different command than 'A'. If an option is to be turned off, you simply specify a 'n' before the identification, e.g. -nl which selects listing files not to be created by the assembler. - Information during assembly, -v The assembler writes a certain amount of information to its program window (or on the command line screen) to let the user know what is happening. For each source file both the current assembler pass and include file names are displayed. During linking all object file names and specified names of library modules are displayed. When all files have been processed and the necessary output generated, a status message is displayed which informs you of how many errors occurred (or none). You will also be reported with a message of how many source lines that have been parsed during a compilation. This information can be very convenient during a large compilation project, especially on relatively smaller computers (with less powerful processors) and no harddisk. If you own a powerful 32bit computer equipped with a fast harddisk, assembly information is displayed at high speed (and almost impossible to read); it may then be useful to turn this information off specifying a -nv option at the command line. - Use alternative source file extension, -e The default assembler source file extension is ".asm". Using this option, you force the assembler to use another default extension, like ".opt" or "as the source file. The extension is specified without the ".". Only three letters are accepted - the rest is discarded. - Use alternative object file extension, -M The default assembler object file extension is ".obj". Using this option, you force the assembler to use another default extension, like ".o" as the object file name extension. The extension is specified without the ".". Only three letters are accepted - the rest is discarded. - Create listing file output, -l The information in listing files is a combination of the original source file and additional information of the generated machine code. Further, the listing file is page formatted with a header specifying the date and time of the compilation, the file name of the listing and a page number. For each line of the source file the following information is written: The machine code and assembler address output are written in hexadecimal notation. If the machine code uses more the 4 bytes, the source file line is written on the following line. This usually happens when you have defined a string constant or a relatively large amount of constant definitions. The assembler address is always beginning at zero, i.e. the beginning of the current modules' machine code. In a relocated context of the machine code, where all code is positioned at fixed addresses, you will have the opportunity to view the addresses of your code relative to the start of individual modules using the assembler output addresses. Further, the last assembler address can be interpreted as the size of the modules' generated machine code. Listing files also serves the purpose of a hard copy on paper of your programs, and are useful in a debugging phase (identifying opcodes versus the mnemonic representation of instructions). The creation of listing files imposes much more processing work of the assembler. If you want to compile your code as quickly as possible then don't create listing files. Listing files obtain their file name from the base of the source file name, and is added with the 'lst' extension. - Create symbol table, -s Symbol tables contains the integer form of symbolical names and constants that has been parsed and generated during a compilation of a source file. The structure of the symbol table is divided into two columns. The first contains the parsed symbol names, converted to upper case. The second column contains the generated value of the symbol name. All symbol values are displayed in signed 32 bit hexadecimal notation. The two columns are separated by tabulators which represents a default value of 8 spaces per tabulator. The width of the symbol name column is defined as the tabulator distance multiplied by 4. The default with of the name column is 4 * 8 = 32 spaces. The symbol table will be written to the end of the appropriate listing file, if listing file and symbol table output is enabled. If no listing file output is enabled, the symbol table will be written to a separate file, identified with the base name of the source file module and given the 'sym' extension. - Assemble only updated files, -d Assemblers usually force compiles all specified files. This is also possible (as default) for the Z80 Module Assembler. In large application project with 15 modules or more it can be quite frustrating to compile all every time. The solution is to only assemble updated files and leave the rest (since they have been compiled to the programmers knowledge). But in a long term view it is better to just compile a project without thinking of which files need to be compiled or not. That can be done with the Z80 Module Assembler. By simply specifying the -d parameter at the command line, only updated source files are assembled into object files - the rest are ignored. Using the -d option in combination with a project file gives the best project setup for a large compilation; compile your projects without worrying about which module is updated or not. - Link/relocate object files, -b The -b option must be used if you want to create an executable Z80 machine code output file of your previosly created object files. You may also use the -a option which is identical in functionality but also includes the -d option. In other words assemble only updated source modules and perform linking/relocation of the code afterwards. Pass 1: When the linking process begins with the first object module, it is examined for an ORG address to perform the absolute address relocation of all the object module machine code. The ORG (loading address for memory) will have to be defined in the first source file module. If not, the assembler will prompt you for it on the command line. The ORG address must be typed in hexadecimal notation. If you never use the ORG directive in your source files, you can always explicitly define one at the command line with the -r option. The next step in the linking process is loading of the machine code from each object module, in the order of the specified modules. Pass 1 is completed with loading all local and global symbol definitions of the object modules. All relocatable address symbols are assigned the correct absolute memory location (based on ORG). Pass 2: The address patching process. All expressions are now read and evaluated, then patched into the appropriate positions of the linked machine code. When all expressions have been evaluated the machine code is completed and saved to a file named as the first source file module, and assigned the 'bin' extension. -o Define another filename for the compiled binary output than the default source filename of the project, appended with the .bin extension. - Splitting completed machine code into 16K segments, -c This feature has only meaning to the Z88. Since the Z88 memory organisation is based on 16K memory banks to be paged into the 4 segments of the Z80 address space, it may be necessary to split your code into 16K blocks if it exceeds 16K in size. Due to the size of the Z88 Assembler application, it is necessary to position it as to separate blocks on the EPROM; in segment 2 and 3. - Create address map information file, -m When the linking process has been completed and the machine code saved to a file, the address map file is produced. This file contains the information of all relocated address symbols with their assigned absolute addresses. Further, an id is written that displays the scope of the symbols; local ('L') or global ('G'). The last item of each address map line, identified after the colon, is the name of the module which the symbol name belongs to. The address map file is divided into two sections; the first produces the symbol list in alphabetical order (fast lookup of symbol names), the second in order of their address counterparts. The section is more used during a debugging session when an address in a dissassembly needs to be identified with a name. The second list also gives a chronological view (composition) of the linked modules. The following is an example of an address map file: - Re-define the ORG relocation address, -r During the linking phase of the assembler the ORG address that defines the position in memory where the code is to be loaded and executed, is fetched from the first object module file. You can override this by specifying an explicit address origin by entering the -r option followed by an address in hexadecimal notation at the command line, e.g.: -r4000 which specifies that your code is to be relocated for address 4000h (16384d) onwards. Using the -r option superseeds a defined ORG in an object file. You could for example have defined the ORG to 8000h (32768d) in your first source file, then compiled the project. This would have generated machine code for memory location 8000h (segment 2 in the Cambridge Z88). Since the object files are generated it is easy to link them again with another ORG address by just using the -r option. The linking process does not alter the information in object files - they are only read. The same project could then easily be re-linked to another address, e.g. -r2000. - Generate address independent code, -R The Z80 processor instruction set allows only relative jumps in maximum +/- 128 bytes using the JR and DJNZ instructions. Further, there is no program counter relative call-to-subroutine or jump-to-subroutine instruction. If you want a program to be address-independent no absolute address references may be used in jump or call instructions. If you want to program Z80 address independent code you can only write small routines using the JR and DJNZ instructions. With a restricted interval of 128 bytes you can imagine the size of those routines! Programming of large applications using address independency is simply impossible on the Z80 processor with the basic instruction set available. You can only define a fixed address origin (ORG) for your machine code to be loaded and executed from. However, there is one solution: before the code is executed an automatical address-relocation is performed to the current position in memory. This is done only once. The penalty is that the program fills more space in memory. This is unavoidable since information must be available to define where the address relocation has to be performed in the program. Further, a small routine must be included with the program to read the relocation information and patch it into the specified locations of the program. It is impossible to determine the extra size generated with a relocation table. We assume an extra size of 3 - 3.5K for a typical 16K application program. You can generate address independent code using the -R option accompanied with the -a or -b option. There is no other requirements. The relocatable code may be useful for programmers using the Cambridge Z88 who want to use machine code in the BBC BASIC application environment. This can easily be interfaced with the DIM statement to allocate memory for the machine code program, and issue a CALL or USR() to execute the machine code. Please note that the linking process with the -R option addresses your code from 0 onwards. This is necessary when the runtime relocation is performed by the relocater (just before your program is executed). This can be examined by loading the address map file into a text editor. The principle of relocation is in fact a self-modifying program. You cannot relocate a program that has been blown into an EPROM (cannot be modified). You may only execute relocatable programs in dynamic memory (RAM). The relocater is built into the Z80 Module Assembler. The relocation table is created during the linking phase. When all object modules have been linked and the appropriate machine code generated, the process is ended with first copying the relocater routine into the executable file, then a relocation table and finally the compiled machine code program. Any defined ORG in your code is superseeded - this is not necessary in a relocatable program! Two rules must be obeyed when using relocatable programs: 1. The IY register must have been set up to point at the address where your program resides. The first code is in fact the relocater which manipulates your code on the basis of the IY register. IF IY is not setup properly your machine code program will be relocated for an address it is not resided at. On execution your might then call a random address (on the basis of the random IY register). 2. Don't use the alternate register set for parameter passing between the caller (of your code) in the main code and the relocated program. The following registers are affected by the initial relocation process: AFBCDEHL/IXIY/........ same ......../..../afbcdehl different You still have all the main registers for parameter passing which is more than sufficient for average programming. When your address-independent code is stored to the file, a message is displayed which informs the user of how many bytes the relocation header consists of. This constant is useful since it informs you of the distance between the relocation header and the start of your code. The map file automatically reflects the relocation header. All addresses of your code has been modified to include the relocation header. Please note that all addresses in the map file are defined from address 0. When your code is placed in an absolute memory address, and you need to perform a debugging session, you can find your specific label address by adding the constant from the map file to the memory origin of your code. The inbuilt relocator routine may be examined by extracting the "relocate.asm" file from the "Z80src.zip" comressed file resource. - Create global address definition file, -g With this option it is possible to generate a DEFC directive definition file of all globally declared identifiers in a file project (declared with the XDEF directive). These global definitions are calculated from the specified ORG address (from first module or the -r option). This feature is very useful, if you want to get access to routines from a separate compilation. If the two code compilation were placed in different banks of the Z88, it would be possible to know the correct address of a routine just by using the DEFC address definition previously compiled. We used this facility to access routines in the two 8K halves of the segment 0 debugge version. This debugger actually swaps one of the two 8K blocks in and out of segment 0 when needed to call an 'external' routine. Applications on the Z88 may only acces the upper 8K of segment 0. A 16K application therefore needs to be split in 8K halves and paged in when needed to be run in this area. Tuff! - Define a static symbol (logically true), -D This option is useful if you want to produce conditional compilations. The symbol defined here will be active throughout the compilation. We used this feature to compile machine code on different computer platforms (QL, IBM, LINUX or Z88). Specify the symbol immediatly after the option identifier, i.e. -Dsymbol . - Using a project file, @ Project files defines all file names of a project. The file name standard stored in a project file obeyes the operating system notation. In stead of specifying every module file name at the command line, a simple reference of a project file can be made in stead. According to the rules of the specification of parameters you specify either your source file modules or use a project file. The project file specification is of cource much faster. An example: z80asm -a main pass1 pass2 link asmdrctv z80instr This command line will compile all specified module file names into a single executable file called 'main.bin'. However if a project file 'assembler' were created already containing the same file names, the command line would have been: z80asm -a @assembler - much easier! A project file only contains file names. Each file name is separated by a new line character \n. The new line character may be different on various computer platforms - but the assembler interprets it correctly. The contents of a project file may look like this: z80asm\n z80pass1\nz80pass1\n modlink\n The \n identifies a new line in the file ( in MSDOS or in LINUX). Project files are easily created using a simple text editor. Always define project files on the platform you are going to use for the assembly process - this assures that you use the correct new line character; e.g. MSDOS uses for new line, and QDOS uses only for new line. - Include library modules during linking/relocation, -i This option allowes compilation time linking of external machine code, better known as library routines. Much, much programming time can be saved by producing a set of standard routines compiled into library files. These may then be included later in application project compilations. The command line option allowes specification of several library files. For each library reference in an application module, all library files will be scanned for that particular module. The filename (inclusive directory path) of the library may be specified explicitly on the command line immedialty after the -i identifier. If you ommit the filename, a default library filename will be used by the assembler. This default filename is defined by creating the environment variable "Z80_STDLIB=..." ("..." refers to your filename). Please refer to your operating system documentation on how to create environment variables. Library files are recognised by the ".LIB" extension. - Create a library, -x A library file is composed of object files surrounded by a few file structures. The library file format (and object file format) may be found at the end of this documentation. A library is simply a set of independent routines (that may refer to each other) put together in a sequential form. You may only specify a single -x option on the command line. A filename may be explicitly defined (including device and path information) to determine the storage location of the library. As in -i you may ommit the filename to use the default filename identified by the "Z80_STDLIB" environment variable. A library routine must be defined using a simple XLIB directive with an identical address name label definition. Please refer to further information later in this documentation. The "Z80lib.zip" contains the standard library with all corrseponding source files. Have a look at them - they clearly displays how to compose a library routine. One very important aspect of libraries is the time that the assembler spends searching through them. To optimize the search you should place your routines in a "topological" order, i.e. routines that acces other library routines should be placed first. In most situations you avoid redundant sequential searching through the library. - Define tabulator distance (for text output files), -t To save storage space the Z80 cross assembler output files (listing, map, symbol and XDEF definition files) uses a tabulator control character in stead of spaces. The benefit is about 30% compressed files. The tabulator distance defines the distance of space between each tabulator it represents. The default value is 8 spaces per tabulator. The tabulators are used to separate two columns of information. The first column contains a name of some sort. Since names have variable length, a size of the column is defined. The Assembler defines the size of the column by multiplying the current tabulator distance with 4, i.e. giving a default size of 4*8 = 32 'spaces'. This is usually more than enough for most name definitions parsed from source files. You may redefine the tabulator distance by usign the -t option immediatly followed by a decimal number, e.g. -t4 for defining a tabulator distance of 4. The with of the first column will then be 4*4 = 16 'spaces'. 2.0 An overview of assembler features and related files o The Z88 operating system definition files You will find header files containing all operating system definitions as defined in the Z88 Developers' Notes V3 in the "OZdefc.zip" file. This makes the operating system interface programming a lot easier. o The supplied standard library Z80 source files We have supplied a standard library with useful routines for both beginners and professional machine code programmers. All source files are supplied for having the opportunity to study and improve the routines. However some routines are programmed especially for the Z88 operating system and may not be of use for other Z80 based computers unless thorougly rewritten. The standard library source files may be found in the "Z80lib.zip" file. o Z88 module assembler application source We have supplied the complete source of the Z88 module assembler application. This allowes you to evaluate many aspects of programming applications on the Z88. Further, most features of the assembler are mirrored in these source files; using directives, the free format of Z80 mnemonics, library routine access, modular file design, labels, using expressions, comments, data structure manipulation and good programming design. o File based compilation This assembler is completely file based, i.e. all parsing and code generation is manipulated via files on storage medias such as harddisks or floppy discs (or file based RAM-discs). o Modular source file design A compilation may be split into individual source files that either can be linked together during assembly as a single module or assembled as separate source file modules. Separate source file modules saves compilation time and memory. Further, this design is much more straightforward and much more logically clear in a design phase of a large compilation project than one huge kludge of a source file. o Scope of symbols in source modules All source modules may refer to each others symbols by using XREF directives. This means that you refer to external information outside the current source module. The opposite of an external module reference is to declare symbols globally available using a XDEF directive, i.e. making symbols available to other source modules. Finally it is possible to have local symbols that is not known to other source modules than the current. A label or constant that has not been declared with XREF, XDEF or XLIB is local to the module. o Using arithmetic and relational expressions All directives that require a numerical parameter or Z80 mnemonics that use an integer argument may use expressions. Expressions may be formed by all standard arithmetic operators and relational operators. Even binary operators are implemented. All expressions may contain external identifiers and is automatically resolved during the linking phase. Only certain directives require compilation time evaluable expressions. o Source file manipulation To allow the Assembler to execute in multitasking environments such as LINUX and QDOS, all source input files are opened as shared I/O. This allows other programs to access the source files while the assembler is working. All output files (both text and binary files) are opened/created for exclusive use; other programs will have no access to those files until they have been closed. o Free format of assembler source files The source files may be written in a free format. No fixed position columns as needed as in the COBOL programming language. All text may be typed in mixed case (the assembler converts all text input to upper case). Tabulators may be used freely (in stead of spaces which also saves source file space) to suit the programmers own habits of structured text layouts. However, one rule must be obeyed: syntax of Z80 assembler mnemonics and most directives must be completed on individual lines. Text files using different OS dependant line feed standard are parsed properly; line feed types CR, LF or CRLF are automatically recognized. So you can easily compile your sources from Linux/UNIX on an MSDOS platform. o Specification of filenames Specification of filenames in source files are always enclosed in double quotes. The assembler just collects the filename string and uses this to open a file. This way all filename standards may be used as defined on different operating system platforms. o Including other source files into the current source file The need for header file information such as operating system constants or data structures is often indispensable for source file modules. In stead of copying the contents of those files into each module, it is possible to include them at run time (during parsing). Infinite include file levels are permitted, i.e. included files calling other files. o Conditional assembly in source file modules Large compilation projects often need to compile the application in several variations. This can be achieved with enclosing parts of the source with conditional directives for the different variations of the application. This may also be useful if the assembler source is ported to several platforms, where inclusion of other source files (such as header files) are using different filename standards. The conditional directives IF, ELSE, and ENDIF may be nested into infinite levels. o Undocumented Z80 instruction code generation We have included the syntax parsing and code generation of the undocumented Z80 instructions for the sake of completeness. However, IM 2 interrupts must be disabled before they are executed (an interrupt may otherwise occur in the middle of the instruction execution). Many games on the ZX Spectrum have used them to protect the code from prying eyes. The Z88 native debugger code uses some of the un-documented instructions for fast access to register variables. o Object file generation The Z80 Module Assembler generates object files that contains the compressed version of an assembled source module. The information herein contains declared symbols (local, global and external), expressions, address origin, module name and machine code. The object file modules are much smaller than their source file counterparts (often smaller than 2K). o Transfer of object files across platforms The Z80 Module Assembler is already implemented on several different computer platforms. You may freely transfer the object files and use them as a part of another cross-compilation. There is no system-dependent information in the object files. o Date stamp controlled assembly To avoid unnecessary compilation of source file modules, it is possible to let the assembler compile only recently updated source file modules by comparing the date stamp of the source and the object file modules. Source file modules that are older than object file modules are ignored. This facility is indispensable in large compilation projects. o Listing files The assembler may generate listing files that contain a copy of the source file with additional code generation information of Z80 mnemonics dumped in hexadecimal format. The listing files are formatted with page headers containg time of assembly and the filename. Line numbers are included which corresponds to the source file lines. o Symbol information All symbol generated values used in source modules may be dumped to the end of the listing file or as a separate symbol file. If the symbol table is dumped into the listing file, each symbol will be written with page references of all occurences in the listing file. Address symbols (labels) are addressed relative to the start of the module. Symbol constants are written as defined in the source. The symbol table are written in alphabetical order with corresponding values in hexadecimal format. o Linking & relocation of object modules into executable Z80 machine code To obtain an executable Z80 machine code file it is necessary to link all assembled object modules and relocate them at a defined address, where the code is to be executed at in the computers' memory. The linking & relocation is performed automatically after completed assembly of all specified source file modules. The ORG relocation address is specified in the first object module. o Address map files The address map is an invaluable information during a debugging session of your compiled program. This file contains all symbolical address labels with their generated address constants after a completed linking/relocation of all modules into executable machine code. The map file is ordered in two groups; the first list contains all symbol names ordered alphabetically with corresponding address constants, the second list contains all symbols ordered by their address value (in chronological order). o Symbol address definition files As with address map files this contains information of globally declared symbolical address labels, relocated to their absolute position as for the compiled machine code file. However, the format is completely different; all symbols are created as constant definitions to be included as a header file into another source file and assembled. This is useful if you want to call subroutines compiled separately in another project (originated in a different memory setup). o Error files Error files are created by the assembler during processing. If any errors should occur, they will be written to this file containing information of where the error occurred in the source module. If no errors were found, the error file is automatically closed and deleted. o Creating and using object file libraries for standard routines Machine programmers often re-use their standard routines. We have implemented a file format for generating libraries using the existing object file modules. Using a simple set of rules makes it very easy to create your own libraries from your source file modules. Documentation of the library file format is included in this documentation. At command line infinite number of libraries may be specified. All will be searched during linking of your object modules for referenced library routines. 3.0 Executing the cross assembler and environment variables The following text describes how to execute the assembler and defining the environment variables used by the assembler. o The environment variables The assembler uses two environment variables: "Z80_STDLIB" define the default filename of the standard library filename. "Z80_OZFILES" define the default path of the standard Z88 OZ system headers. o Running in the QDOS/SMSQ operating system environment z80asm may be compiled using the C68 compiler developed by the Walker brothers. You also need the 'env_bin' file. This is necessary to install into the operating system before using the assembler. It contains the environment variable facility integrated on UNIX, MS-DOS and many other operating systems. Include the following line into your BOOT upstart program: LRESPR win1_ext_env_bin The device and path 'win1_ext_' is just an example of where to store your system extension file. You may have it on your BOOT disk as well. If you don't have ToolKit 2 on your system use the following line in your BOOT program: envext = RESPR(1024): LBYTES win1_ext_env_bin, envext: CALL envext Use the following in your BOOT file to set the environment variables: SETENV "Z80_OZFILES=win1_z80_src_oz_" SETENV "Z80_STDLIB=win1_z80_standard_lib" The example filenames are only a demonstration. Change them as necessary. o Running in the LINUX/UNIX operating system environment This program can be executed on the LINUX operating system and any other UNIX. The sources are strictly ANSI C and uses only library calls that are described in Brian W. Kernigham and Dennis M. Ritchie's C books. The important thing to remember before compiling it under UNIX, is in which direction the integers are stored by the processor architecture; the famous Big Endian and Little endian concept. The config.h file uses a "ENDIAN" definition when z80asm must interpretate integers in big endian order. Please set this definition according to your system's processor architecture. Most people uses the Intel processor when running Linux - this is a little endian architecture (so you don't need the ENDIAN define...). You can compile z80asm using GNU C compiler simply by entering the following on your command line: gcc -o z80asm -O2 *.c The environment variables needed by z80asm are easily added in your accounts login script, ".profile" or ".bash_profile" in your home directory. o Running in the MS-DOS operating system environment This program can be executed on all MSDOS operating systems using the INTEL 8086 processor up to high speed 80386/80486/Pentium processors on IBM & compatible computers. Add the source files to your favorite C compiler system in MSDOS or Windows (here you need to specify compilation options o a console appliction). The environment variables are easily put into your AUTOEXEC.BAT file. Simply specify: SET Z80_OZFILES=C:\Z80\OZ\ SET Z80_STDLIB=C:\Z80\STANDARD.LIB Choose your own settings if you like. If you want the assembler to be accessible in any path, add the path location of the assembler in the PATH search line: ;C:\Z80 4.0 Z80 module assembler file types o The assembler file types and their extension names The Z80 Module Assembler uses several different file name extensions to distinguish the type of files processed. The base name of the source file is used to create the various assembler output file types. The following list explaines the available files: o The file name extension identifier The file name extension identifier may be different from platform to platform. UNIX has no defined standard. MSDOS and TOS uses '.'. QDOS uses the '_' identifier. SMSQ also allowes the '.' extension identifer. The Assembler implemented on the supplied platforms are defined with the correct extension identifier. You can see this on the Assembler help page (executing the program with no parameters). - The source file extension The extension for assembler mnemonic source files are 'asm'. Source files are specified by the user with or without the extension - whatever chosen, the assembler will investigate automatically what is needed to read the source files. - The object file extension The extension for object files are 'obj'. The base file name is taken from the corresponding source file name. This file is generated by the assembler from parsing the source file and contains intermediate generated machine code, an address origin of the machine code, symbol information and expressions. - The error file extension The extension for error files are 'err'. Before beginning processing the source files, an error file is created. If any errors should occur, they will be written to this file containing information of where the error occurred. If no error were found, the error file is automatically closed and deleted. Error files are simple text files that can be loaded by any text editor for evaluation. - The listing file extension The extension for listing files are 'lst'. The base file name is taken from the corresponding source file name. This file is generated by the assembler and contains a hexadecimal output of the generated machine code that corresponds to the Z80 mnemonic instruction or directive, followed by a copy of the original source line. If selected, the symbol table is dumped at the end of the listing file. - The symbol file extension The extension for symbol table files are 'sym'. The base file name is taken from the corresponding source file name. The symbol table file contains information about the defined and used symbols of the source file and their generated values (labels and constants). The symbol file is only created if listing file output is disabled. - The executable file extension The extension for executable Z80 machine code files are 'bin'. The base file name is taken from the first specified source file name at the command line (or project file). This is the linked and relocated output of object files and may be executed by the Z80 processor. You may override this default behaviour by using the -o option and specify your own output filename (and extension). - The address map file extension The extension for address map files are 'map'. The basefile name is taken from the first specified source file name at the command line (or project file). This file is generated by the assembler and contains a list of all defined address labels from all linked/relocated modules with their calculated (absolute) address in memory. Used for debugging reference. - The definition file extension The extension for global address label definition files are 'def'. The base file name is taken from the first specified source file name at the command line (or project file). This file is generated by the assembler and contains a list of all globally declared address labels with their calculated (absolute) origin address, fetched only during assembly of source file modules. The format of the list contains constant definitions (addresses) and may be parsed e.g. as include files for other projects. - The library file extension Library files are identified with the 'lib' extension. Library files may be created using the -x option. Library may be included into application code during linking of object modules. 5.0 Compiling files o The assembler compiling process The Z80 Module Assembler uses a two stage compilation process; stage 1 parses source files and generates object files. Stage 2 reads the object files and links the object file code, completes with address patching and finishes with storing the executable code. Stage 1, parsing & code generation of all source files, object file generation: A source file is being parsed for Z80 mnemonics and directives. An object file is created to hold information of module name, local, global and external symbol identifiers, expressions and the intermediate code generation (but address and other constant information). During pass 1 all Z80 mnemonics are parsed and code is generated appropriately. All expression are evaluated; expressions that contain relocatable address symbols or external symbol are automatically stored into the object file. Expressions that didn't evaluate are preserved for pass 2. When a source file has been read successfully to the end, pass 2 is started. During pass 2 all non-evaluated expressions from pass 1 are re-evaluated and stored to the object file if necessary. Errors are reported if symbols are stil missing in expressions. When all expressions are evaluated and no errors occurred, all "touched" symbols (used in expressions) are stored into the object file, with scope, type and value. Then, the module name and generated code is stored to the object file. Various file pointers to sub-sections of the object file is resolved. The completion of stage 1 is to produce the symbol table output (either appended to listing file if selected or as a separate file). This process is performed for all specified source modules in a project. Stage 2, linking object files and library modules, producing executable code: Pass 1 of the linking loads information from each object file in the project; the ORG address is fetched, identifiers (resolving scope, and absolute values) loaded, and machine code linked. During this pass all external library modules are fetched and linked with the object modules (if a library is specified from the command line). When all modules have been loaded, pass 2 begins. Pass 2 then reads each expression section from all object modules (including library modules), evaluates them and patches the value into the appropriate position of the linked machine code. When all expressions have been evaluated successfully the executable code is stored. If selected, the address map file is produces from the current symbol table resided in the data structures of the assembler's memory is stored to a text file. o File names Specification of file names follow the convention used on the various platforms that the assembler is ported to. Please read your operating systems manual for more information. o Portability of assembler file names If you are going to port your Z80 Module Assembler files across several platforms a few hints may be worth considering: Avoid special symbols in file names like '_', '#' and '.' . They may have special meaning on some operating system platforms. Use only 7 bit standard ASCII letters in file names ('A' to 'z'). Non english language letters are not always allowed, and further they may not be interpreted correctly when ported to another platform. Avoid too long file names. Some operating systems have boundaries for length of file names in a directory path. For example MS-DOS only allows 8 characters in a file name (followed by an extension). Others may have no boundaries. o The standard platform identifier When the Z80 Module Assembler is running a standard platform identifier is made available. The identifier reflects the name of the platform: "Z88" - the assembler is running on the Z88 portable computer. "QDOS" - the assembler is running on the QDOS/SMSQ platform (QL & compatibles) "MSDOS" - the assembler is running on the IBM MS-DOS platform of computers "UNIX" - the assembler is running on the LINUX/UNIX platform. The identifier might be very handy when you need to port your source files to different computer platforms. We use them in for loading header files. Have a look on the INCLUDE directive example in the Directive Reference section. o Source file structure The composition of a source file module is completely free to the programmer. How he chooses to place the source code on a text line has no effect of the parsing process of the assembler. The linefeed interpretation is also handled by z80asm - it understands the following formats: (used by QDOS/SMSQ/UNIX/AMIGA), (used by MSDOS), (used by Z88/MacIntosh). o Using local, global and external symbols In larger application projects it is unavoidable to use a modular programming design, i.e. splitting the source into several individual files. This approaches the popular top - down design where you can isolate the problem solving into single modules. The outside world just needs to know where the routine is to be called by linking the modules with a few directives. In the Z80 Module Assembler you only need two directives to accomplish just that: the XREF and XDEF directives. XREF declares a symbol to be external to the current source file module. This tells the assembler that all expressions using that symbol is not to be evaluated until the compiled object modules are to linked and relocated together. Expressions that contains this symbol is simply stored into the object file. XDEF declares a symbol to be created in this module and made globally available to other modules during the linking/relocation phase. All expressions that contain a globally declared symbol is automatically stored into the object file. When a symbol is created and is neither declared external or global, it is implicitly defined as local to the current source module. The symbol is then only available to the current module during linking/relocation. If you want to access (external) library modules from a library, use the LIB directive followed by the name of the routine. Several routine names may be specified separated by a comma. During the linking process all external and corresponding global symbols are resolved. If two identical global identifier are loaded by the linking process, the most recently loaded identifier is used by the linker. o Defining symbol names Good programming involves a structured approach to mnemonic identification of names in subroutines, variables, data structures and other constants. The Z80 Module Assembler gives you several possibilities. The easiest and frequently used one is DEFC (Define Constant). We have supplied a complete set of header files (the "OZdefc.zip" file) containing the Z88 operating system manifests as defined in the Developers' Notes V3 (the "devnotes.zip" file) which just contains DEFC directives. Each DEFC directive is followed by a an identifier name, followed by a = symbol and then an evaluable constant expression (usually just a constant). Constant definitions are usually operating system manifest or other frequently used items. They are put into separate source files and later inserted into main source files using the INCLUDE directive. Though DEFC resolves most needs, it may be necessary to define variable areas or templates containing names with an appropriate size tag (byte, word or long word). This is possible using the DEFVARS directive. Here you may specify as many names as needed in the group. Then, it is easy to add, re-arrange or delete any of the variable names - only a few modifications and then just re-compiling the necessary source files that use the templates. This would be a nightmare with DEFC, since you have to keep track of the previous and next name in the group in addition to count the size of all names. All this is managed by DEFVARS automatically. Have a look at the syntax in the Directive Reference section. With advanced Z80 programming you cannot avoid dynamic data structures like linked lists or binary trees. The fundamentals for this are known as records in PASCAL or strucures in C. DEFVARS is well suited for this purpose. Defining each DEFVARS group with 0 automatically generates offset variables. The last name then automatically defines the size of the data structure. Again, refer to the directive reference for a good example. A third possibility for an easy definition of symbols is to use the DEFGROUP directive. Here you're able to define a set of symbols equal to an enumeration. It follows the same principles as for C's ENUM facility. The default starts at 0 and increases by 1. If you choose, a specific identifier may be set to a value, which then can set the next enumeration sequense. Again, this directive have been made to implement an easy way of defining symbols and providing a simple method to alter the identifier group. Please refer to the directive reference for an example. o Comments in source files As always, good programming requires good documentation. Without comments your programs loose overview and logic. Machine code is especially hard to follow - have you trid to look at a piece of code 2 years after implementation AND without any comments? HORRIBLE! There is never too many comments in machine code - we especially like to use high level language as comments - it avoids un-necessary text and logic is much more clear. Comments in Z80 source files are possible using a semicolon. When the assembler meets a semicolon the rest of the current source line is ignored until the linefeed. Parsing will then commence from the beginning of the line. The semicolon may be placed anywhere in a source line. As stated you cannot place mnemonics after the semicolon - they will be ignored. The Z80 parser will in many places accept comments without a semicolon has been set - but don't rely on it. Better use a semicolon. The context is much more clear. The following is an example on how to use comments in Z80 source files: ; ********************** ; main menu ; .mainmenu call window ; display menu call getkey ; readkeyboard ret ; action in register A o Defining symbolic address labels The main reason for using an assembler is to be able to determine symbolical addresses and use them as reference in the code. These are defined by a name preceeded with a full stop. It is allowed to place a mnemonic or directive after an address label. An address label may be left as a single statement on a line - you may of course use comment after the label. The following is a label definition: ; ***************** ; routine definition .mainmenu call xxx ; mainmenu is the label preceeded with '.' It is not allowed to position two labels on the same line. However, you may place as many label after each other - even though no code is between them. They just receive the same assembler address. It is not allowed to specify two identical address labels in the same source file. If you want to declare an address globally accessible to other modules, then use XDEF for the address label definition, otherwise the label definition will be interpreted as a local address label. XDEF mainmenu ... .mainmenu ; this label is accessible from other modules with XREF You may use before or after the label - z80asm automatically handles the scope resolution as long as you use XDEF to define it as globally accessible. o Writing Z80 mnemonic instructions All Z80 instructions may be written in mixed case, lower or upper case - you decide! How you separate opcode words, register names and operands is your choice. Only a few rules must be obeyed: 1) each instruction mnemonic must be completed on a single line. 2) the instruction identifier must be a word, i.e. don't use space between CALL 3) register identifiers must be a word, ie. HL not H L A few examples which all are legal syntax: Ld HL , 0 ld hl, $fFFF caLL ttttt o Optional Z80 mnemonic instruction syntax We have added some syntactical option on a few Z80 mnemonics. They are: DJNZ label (the comma is not needed) IN F,(C) (special case instruction which only affects the flags) The instructions below allow additional specification of the accumulator register. Zilog standard convention is to only specify the source operand. Sometimes it is better to specify the accumulator to make the instruction look more clear, and to avoid confusion. After all, they specified it for "add", "adc" and "sbc". sub a,r sub a,n sub a,(hl) sub a,(ix+0) sub a,(iy+0) this syntax applies also to "and", "or", "xor" & "cp" o The undocumented Z80 instructions We have included the parsing and code generation of the undocumented Z80 instructions. They are as follows: LD r,IXL r = A,B,C,D,E,IXL,IXH LD r,IXH LD IXL,n n = 8bit operand LD IXH,n ADC A,IXL ADC A,IXH ADD, AND, CP, DEC, INC, OR, SBC, SUB, XOR ... SLL A, B, C, D, E, H, L SLL (HL), (IX+d), (IY+d) (SLL = [S]hift [L]ogical [L]eft). SLL does shift leftwards but insert a '1' in bit 0 instead of a '0'. Except for the SLL instruction all have bugs related to an interrupt being able to occur while the instructions are decoded by the processor. They are implemented on the chip, but are reported to be unreliable. We have used some of them in our debugger software for the Z88. Until now the code has been running successfully on all our Z88 computers. o Referencing library routines When you need to use a library routine in your application code, you need to do two things; include a library file at the assembler command line with the -i option and refer to the library routine in your source file using the LIB directive followed by the name of the library routine, e.g. LIB malloc, mfree which will declare the two names "malloc" and "mfree" as external identifiers to the current source file module. Please note that you can declare the names before or after they actually are referred in your program source,. Failing to use the LIB directive will interprete labels as local symbols to that source file module. When the parser meets the instruction that uses one of the above names in a parameter, the parameter "expression" is automatically saved to the object file for later processing. During the linking phase of all the object files the specified library file is automatically scanned for "malloc" and "free" and included into the application code when found. Much application programming can be saved in "re-inventing the wheel" if you store frequently used standard routines in libraries. We have supplied a comprehensive set of library routines that were created along the development of the Assembler Workbench application EPROM. Use them as appropriate and add new ones. We are interested in your work - if you feel that you have made some good routines that others may benefit from, e-mail them to us and we will include them into the standard library. o Creating/updating libraries Creating libraries is an inbuilt feature of the assembler. The following steps are necessary to create a library: 1) define a project file containing all filenames (without extensions) in your directory that contains all library routines (the easiest method since you later can move all files to another directory). Remember to arrange the filename in a topological order, i.e. library routines that access other routines must pe placed first. This optimizes the searching through a library during the linking process. 2) Each library source module uses the XLIB directive to define the name of the routine. The same name must be used for the address label definition. If your library uses other library routines then declare them with the LIB directive. Please note that a library routine creates the module name itself (performed by XLIB automatically). The module name is used to search for routines in a library. 3) The command line contains the -x option immediately followed by your filename. If you don't specify a filename, the default standard filename is used (defined by the Z80_STDLIB environment variable). Then you need to specify your project filename preceeded by @, for example: Z80asm -xiofunctions @iofunctions will create a library "iofunctions.lib" in the current directory (also containing all library source files). The project file is "iofunctions" also in the current directory. Please note that no binary file is created (a library is NOT an executable file), but a collection of object files sequentially organized in a file. o Referencing routines in other compiled projects It may be necessary in some situations to get access to routines previously compiled in another project. This implies however a knowledge of their absolute addresses during linking. This information is stored in the map file, but not accessible in a form suitable to be parsed by the assembler. However, this is possible in using the -g option at the assembler command line. The action performed creates a DEFC list file of address labels that have been declared as globally available (using the XDEF directive). Only compiled source files are included in the list. If you were using the -a option (compile only updated source files) and no files were updated then the -g file would be empty. If you would like a complete list of all global routines then it is needed to compile the whole project (using the -b command line option). When the file is generated, it can easily be INCLUDE'd in another project where your routines may access the external routines. You might do this in two ways: 1) including the file in every source module that needs to access external routines. This may be the easiest solutuion if you're only going to need external acces in one or two source modules. With many external calls in different module of the current project it requires much altering of files. 2) creating a new source file that is part of your project. This file could easily be the first file in your project but could just as well be placed anywhere in your project. Declare each external name that is needed somewhere in your project as XDEF, meaning that all names to be included are globally accessible from this module. Then specify the INCLUDE of the DEFC list of the other project file. As the names get loaded, they become global defintions. All other definitions will be ignored and not stored to the object file (they are not referref in the source module). All your other modules just needs to specify the external names as XREF. During linking they all get resolved and your code has access to external routines from a previosly compiled project. Whenever the previous project has been re-compiled (and issued with -g option) there is a possibility that routine addresses has changed. You therefore need to recompile the extra source module in your project to get the new identifier values - the rest of your compilation is unaffected (due to the XREF directives). Only the linking process gets the new proper addresses. In example 1) you had to recompile all source files that would have used an INCLUDE of the DEFC list file. In example 2) only one file had to be recompiled. The principle of external addresses was used to compile the debugger version to be resided in segment 0 (into the upper 8K). The actual size of the debugger code uses 16K, but was split into two separate halfes to fit into the upper 8K of segment 0. Each of the 8K code-segments had to get access to the other 8K block. The solution was the -g option and cross referencing using XREF and an additional source module (containing the XDEF declarations) that included the -g list file of the other project compilation. 6.0 Using expressions Expressions is almost unavoidable in source files. They define and explain things much clearer than just using a constant. The Z80 Module Assembler allows expressions whereever a parameter is needed. This applies to Z80 mnemonic instructions, directives and even in character strings. The resulting value from an evaluated expression is always an integer. All expressions are calculated internall as 32 bit signed integers. However, the parameter type defines the true range of the expression. E.g. you cannot store a 32 bit signed integer at an 8 bit LD instruction like LD A, . If a parameter is outside an allowed integer range an assemble error is reported. Finally, no floating point operations are needed by the assembler. There is no real standard on Z80 based computers. Whenever an integer is stored in a Z80 file, the standard Zilog notation is used, i.e. storing the integer in low byte, high byte order (this also applies to 32bit integers). This standard is also known as little endian notation (also used by INTEL processors). Expressions may be formed as arithmetic and relational expressions. Several components are supported: symbol names (identifiers), constants, ASCII characters and various arithmetic operators. o Constant identifiers Apart from specifying decimal integer numbers, you are allowed to use hexadecimal constants, binary constants and ASCII characters. The following symbols are put in front of the constant to identify the type: $ hexadecimal constant, e.g. $4000 (16384). @ binary constant, e.g. @11000000 (192). ' ' ASCII character, e.g. 'a'. o Arithmetic operators All basic arithmetic operators are supported: addition, subtraction, multiplication, division and modulus. In addition binary logical operators are implemented: binary AND, OR and XOR. + addition, e.g. 12+13 - unary minus, subtraction. E.g. -10, 12-45. * multiplication, e.g. 45*2 (90). / division, e.g. 256/8 (32). % modulus, e.g. 256%8 (0). ^ power, e.g. 2^7 (128). ~ Binary AND, e.g. 255 ~ 7 (7). | Binary OR, e.g. 128 | 64 (192). : Binary XOR, e.g. 128 ~ 128 (0). # Truncate expression as constant (remove relocatable address flag) Arithmetic operators use the standard operator precedence, shown from highest to lowest: $@' (constant identifiers) () ^ */% +-~|: If you want to overide the default operator precedence rules, use brackets (). o The # operator This is not a real operator, though. It is only used as the first symbol in an expression to identify that this expression evaluates to a constant, i.e. containing no relocatable information. This feature may be necessary when you have to calculate a distance between two address labels without letting the assembler think it is a relocatable address. The assembler thinks that expressions containing address labels are relocatable items. In 99% of any expression used this is perfectly adequate. During the linking phase such an expression may have undiserable side effect when you want to produce relocatable machine code using the -R option. The relocator identifies the expression as an relocatable item and will add a constant to the evaluated value of the expression. This is a perfectly correct handling in normal address references for relocatable code. However, since the assembler cannot see this as a constant expression, you have to force it as one. LD BC, end_relocator-relocator ; the relocator will add an ORG constant LD BC, #end_relocator-relocator ; the relocator sees a constant expression Normal executable code, compiled for a an absolute address, won't conflict with the above problem, since no constants are added to expressions. All address information is calculated during loading of the address labels in pass 1 of the linking process. Pass 2 of the linking process just evaluates expressions (thereby using the proper values of labels and other constants) and patches them into the corresponding locations of the code. o Relational operators With relational operators you may form logical expressions resulting in true or false conditions. The resulting value of a true expression is 1. The resulting value of a false expression is 0. These operators are quite handy when you need to perform complex logic for conditional assembly in IF-ELSE-ENDIF statements. The following relational operators are available: = equal to <> not equal to < less than > larger than <= less than or equal to >= larger than or equal to ! not You may link several relational expressions with the binary operators AND, OR and XOR. You have all the possibilities available! It is perfectly legal to use relational expressions in parameters requiring an arithmetic value. For example: LD A, (USING_IBM = 1) | RTMFLAGS o The ASMPC standard function In occasional circumstances it may be necessary to use the current location of the assembler program counter in an expression e.g. calculating a relative distance. This may be done with the help of the ASMPC identifier. An example: .errmsg0 DEFM errmsg1 - ASMPC - 1 & "File open error" .errmsg1 DEFM errmsg2 - ASMPC - 1 & "Syntax error" .errmsg2 Here, a length byte of the following string (excluding the length byte) is calculated by using the current ASMPC address value. o The & operator You may use expressions in string definitions when using the DEFM directive. String constants are enclosed in double quotes, e.g. "abcdefgh". Several strings and byte expressions may be concatanated using the & operator. The resulting type of an expression in strings are an unsigned byte of the range of 0 to 255, e.g.: "string_a" & "string_b" & 'X' & CR & LF & 0 o Symbol identifiers in expressions Apart from using integer constants in your expressions, names are allowed as well. This is frequently used for symbolical address label references (both external and local). Forward referencing of symbols is not really something that is important in evaluating expressions. The logic is built into the assembler parser. If an expression cannot be resolved in pass 1 of source file parsing, it will try to re-evaluate the failed expression in pass 2 of the parsing. If it still fails a symbol has not been found (XREF and LIB external symbols are handled during the linking phase). 7.0 Directive reference The Z80 Module Assembler directives are used to manipulate the Z80 assembler mnemonics and to generate data structures, variables and constants. You are even permitted to include binary files while code generation is performed. As the name imply they direct the assembler to perform other tasks than just parsing and compiling Z80 instruction mnemonics. All directives are treated as mnemonics by the assembler, i.e. it is necessary that they appear as the first command identifier on the source line (NOT necessarily the first character). Only one directive is allowed at a single source line. Even though they are written as CAPITALS in this documentation they may be written in mixed case letters in your source files. Since the directives cover very different topics of assembler processing, each directive will be explained in detail, identified with a header description for each text section. The following syntax is used: <> defines an entity, i.e. a number, character or string. {} defines a an optional repetition of an entity. [] defines an option that may be left out. BINARY "filename" Loads a binary file at the assembler PC. This could for example be a static data structure or an executable machine code routine. The loaded binary file information is included into the object file code section. The assembler PC is updated to the end of the loaded binary code. CALL_OZ['('] [')'] The may be a 16bit expression and must evaluate to a constant. This is an easy interface call to the Z88 operating system. This is an advanced RST 20H instruction which automatically allocates space for the size of the specified parameter (either 8 bit or 16 bit). Code is internally generated as follows: RST $20 DEFB x ; 8bit parameter or RST $20 DEFW x ; 16bit parameter DEFB <8bit expr>,{<8bit expr>} (-128; 255) DEFW <16bit expr>,{<16bit expr>} (-32768; 65535) DEFL <32bit expr>,{<32bit expr>} (-2147483647; 4294967295) Stores a yte (8 bit), ord (16 bit) or a ong word (32 bit) at the current assembler PC. Expressions may be used to calculate the constant. All constant are stored in low byte - high byte order (little endian). DEFC name=<32bit expression>{, name=<32bit expression>} Define a symbol constant. The allowed range is a signed 32bit integer value. The expression must be evaluable, i.e. no forward referencing identifiers. All standard Z88 operating system header files use DEFC DEFM Stores a string constant at the current assembler PC. Strings are enclosed in double quotes. Strings may be concatanated with byte constants using the & operator. This is useful if control characters need to be a part of the string and cannot be typed from the keyboard. DEFGROUP '{' name {',' name ['=' <8bit expression>]} '}' Defines a group of identifier symbols with implicit values. This is similiar to the enumeration principles used in C and PASCAL. The initial symbol value is 0, increased by 1 for each new symbol in the list. You may include a which breaks the linear enumeration from that constant. The DEFGROUP directive may be spanned across several lines and MUST be enclosed with { and }. DEFGROUP is just a more easy way than: DEFC name0 = 0, name1 = name0, ... The following example illustrates a useful example of defining symbol values: DEFGROUP { sym_null, sym_dquote, sym_squote, sym_semicolon, sym_comma, sym_fullstop, sym_lparen, sym_lcurly, sym_rcurly, sym_rparen, sym_plus, sym_minus, sym_multiply, sym_divi, sym_mod, sym_power, sym_assign, sym_strconq, sym_and, sym_or, sym_xor, sym_not sym_less, sym_greater, sym_constexpr, sym_newline, sym_lf, sym_name, sym_number, sym_decmconst, sym_hexconst, sym_binconst, sym_charconst, sym_lessequal, sym_greatequal, sym_notequal sym_negated, sym_nil, sym_ifstatm, sym_elsestatm, sym_endifstatm } DEFINE name,{name} Defines a symbol identifier as logically true (integer <> 0). The symbol will be created as a local variable and disappears when assembly is finished on the current source file module. Nice feature for conditional assembly. DEFS <16bit expression> Allocates storage. The size of the area will be filled with zero bytes. The expression must be [1; 65535]. DEFVARS <16bit expression> '{' [] [ ] { [] [ ] } '}' ::= 'a' .. 'z' ::= 'ds.b' | 'ds.w' | 'ds.p' | 'ds.l' Defines variable address area or offsets. First you define the origin of a variabe area. This may be defined using an evaluable 16bit expression (positive). Each variable name is followed by a size specifier which can be a byte, word, pointer (3 bytes) or long word size. This is particularly useful for defining dynamic data strucures in linked lists and binary search trees. Defining variable areas are only template definitions not allocations. An example: DEFVARS Z80asm_vars { RuntimeFlags1 ds.b 1 ; space for next variable is 1 byte RuntimeFlags2 ds.b 1 RuntimeFlags3 ds.b 1 ds.w 1 ; space not defined explicitORIG ds.w 1 ; 2 bytes space asmtime ds.b 3 ; 3 bytes space datestamp_src ds.b 6 ; 6 bytes space datestamp_obj ds.b 6 TOTALERRORS ds.l 1 ; 4 bytes space } the following is useful for defining dynamic data structures: DEFVARS 0 ; 'PfixStack' structure (used for postfix expressions): { pfixstack_const ds.l 1 ; The stack item value pfixstack_previtem ds.p 1 ; Pointer to previous element on stack SIZEOF_pfixstack ; total size of data structure } This type of variable declaration makes it very easy for modifications, e.g. deleting or inserting variable definitions. A special logic is available too which can be used throughout individual source files during compilation. If you specify -1 as the starting address, the last offset from the previous DEFVARS which was not specified as 0 will be used. This enables you to gradually build up a list of identifier name offsets across DEFVARS areas in different source files. The following example explains everything: defvars $4000 { aaa ds.b 1 bbb ds.b 100 } defvars -1 { ccc ds.b 100 ddd ds.b 1 eee ds.b 10 } defvars 0 { fff ds.p 1 ggg ds.b 1 hhh ds.w 1 iii ds.p 1 } defvars -1 { jjj ds.b 100 } Some of the symbols will look like this: BBB = 00004001 CCC = 00004065 GGG = 00000003 JJJ = 000040D4 FPP['('] <8bit expression> [')'] Interface call to the Z88 operating systems' floating point library. This is easier than writing: RST $18 DEFB mnemonic This is an advanced RST 18H instruction which automatically allocates space for the specified parameter. All Z88 floating point call mnemonics are defined in the "fpp.def" file. IF [ELSE] ENDIF Multi-line-directive. This allows to assemble particular source lines between the IF, ELSE and ENDIF directives. The logical truth of the IF condition depends on which source lines will be assembled inside the directive construction. ELSE is optional. Infinite nesting of IF directives are allowed. Each directive must be specified on separate lines. An example: if QDOS INCLUDE "defs_h" INCLUDE "symbol_def" INCLUDE "#stdio_def" INCLUDE "#fileio_def" INCLUDE "#memory_def" else INCLUDE "defs.h" INCLUDE "symbol.def" if MSDOS | UNIX INCLUDE "#stdio.def" INCLUDE "#fileio.def" INCLUDE "#memory.def" endif if Z88 INCLUDE ":*//stdio.def" INCLUDE ":*//fileio.def" INCLUDE ":*//memory.def" endif endif INCLUDE "filename" Another component that is frequently used is to 'link' an additional source file together with the current source file. Usually this contains variable definitions that is commonly used by several modules in a project. This makes sense since there is no idea in copying the same information into several files - it simply uses redundant space of your storage media. This is certainly important on the Z88 which not always has huge amounts of installed user/system RAM (usually 128K). The external source file will be included at the position of the INCLUDE directive. You specify an include file as with the following example: INCLUDE "#stdio.def" The format of the filename depends on the operating system platform. As with the current source file, you may also insert files in include files. There is no limit of how many levels (of files) you specify of include files. Recursive or mutual recursive INCLUDE files (an INCLUDE file calling it self) is not possible - the assembler program will immediately return an error message back to you! Include files are usually put at the start of the source file module but may be placed anywhere in the source text. The current source file will be continued after the INCLUDE directive when the included file has been parsed to the end of file. If you specifiy a leading '#' in the filename (as shown above) the assembler automatically preceeds a default directory path, defined from the Z80_OZFILES environment variable. Most of the time INCLUDE is used for including Z88 operating system manifests - which enables you to place them in a particular place on your system. Using the '#' also enables you to have these OZ header files placed anywhere on any computer platform. The '#' resolves this for you. LIB name {,name} Declares symbol as external to the current module. The symbol name will be defined as the name of a library routine which will be automatically linked into the application code from a library during the linking/relocation phase of the compilation process (if a library has been specified at the command line with the -i option). LSTOFF Switches listing output to file off temporarily. The listing file is not closed. LSTON Enables listing output (usually from a previous LSTOFF). Both directives may be useful when information from INCLUDE files is redundant in the listing file, e.g. operating system definitions. MODULE name Defines the name of the current module. This may be defined only once for a module. All source file modules contain a module name. This name is used by the assembler when creating address map files and for searching routines in libraries. Further, it allowes the programmer to choose a well defined name for the source file module. The position of the module name is of no importance; it may be placed at the end or the start of the source file. However, it has more sense to put it at the top. The syntax is simple - specify a legal identifier name after the MODULE directive, e.g. MODULE main_module ORG <16bit expression> Define address origin of compiled machine code - the position in memory where the machine is to be loaded and executed. The expression must be evaluable (containing no forward or external references). All address references will be calculated from the defined ORG value. The ORG address will be placed in the current module that is being compiled. However, during linking only the first object module is being read for an ORG address. The ORG is ignored during linking if you have specified an -r option on the command line. XDEF name {, name} Declares symbol globally available to other specified source file modules during the linking phase of the compilation process. XLIB name When you need to create a library routine, it is necessary to declare the routine with XLIB. In fuctionality it declares the name globally available to all other modules in project, but also serves as a searchable item in libraries. A library routine does not contain a MODULE directive, since the XLIB name is also identified as the module name (you only specify one library routine per module). XREF name {, name} Declares symbol as external to the current module. The name must have been defined as XDEF in another module to let this module reach the value of the symbol during the linking phase. 8.0 Run time error messages The following error messages will be written in corresponding error files (related to a source file). Each error message will contain the name of the source file and a line number where the error occurred in the file. 0, "File open/read error" You have tried to access a file that either was not found, already opened by other resources, or the assembler wasn't able to create output files (object file, listing-, symbol-, map- or executable binary file). 1, "Syntax error" This is a message used by many routines - hence the general but descriptive message. You have tried to use illegal registers in Z80 mnemonic instructions, specified an illegal parameter type (string instead of integer), omitted a parameter (DEFB without constant). 2, "Symbol not defined" This error is given if you are referring to an identifier (usually in an address reference) that was not declared. Either a label definition is missing in the current module or you have forgotten to declare an identifier as external using the XREF directive. 3, "Not enough memory" / "No room in Z88" Well, well. It seems that there wasn't enough room to hold the internal data structures during parsing or linking your code. Delete any unnecessary running applications/jobs then try again. If you got the message on the Z88, try also to delete un-necessary files from the filing system of your current RAM card. 4, "Integer out of range" You have an expression which evaluates into a constant that are beyond the legal integer range (e.g. trying to store a 16bit value into an 8bit parameter). 5, "Syntax error in expression" Quite clearly you ahve made an illegal expression, e.g. specifying two following operands without an operator to separate them, used an illegal constant specifier or using illegal characters that aren't a legal identifier. 6, "Right bracket missing" Your expression is usgin brackets and is not properly balanced, i.e. too many beginning brackets or to few ending brackets... 7, "Out of range" Same as 4. 8, "Source filename missing" There has not been specified any source file modules or project file to start a compilation. 9, "Illegal option" The command line parser couldn't recognise the -option. Remember to specify your option in EXACT case size. You have probably used a space between an option and a filename parameter. 10, "Unknown identifier" The parser expected a legal identifier, i.e. a directiver or Z80 mnemonic. You have probably omitted the '.' in front of a label definition, misspelled a name or used a comment without a leading ';'. 11, "Illegal identifier" You have been trying to use a name that is either not known to the parser or an illegal identifier. This might happen if you try to use a register that is not allowed in a LD instruction, e.g. LD A,F . 12, "Max. code size reached" Is that really possible? Very interesting code of yours! Z80 machine code program tend to be in the 32K range (at least on the Z88)... Well, the Z80 processor cannot address more than 64K. Start changing your code to a smaller size! 13, "errors occurred during assembly" Status error message displayed on the screen when the assembler has completed its parsing on all modules. You have one or more errors to correct in your source files before the assembler continues with linking the next time. 14, "Symbol already defined" In the current source file, you have tried to create two identical address label definitions, or other name identifier creators (using DEFC, DEFVARS, DEFGROUP). 15, "Module name already defined" You have used the MODULE directive more than once in your source file, or used both a MODULE and XLIB directive (library modules only need an XLIB). 16, "Module name not defined" A MODULE directive is missing in your source file (or XLIB directive in a library source file routine). 17, "Symbol already declared local" You have tried to declare a symbol as XREF, but it was already defined local, eg. using a ".lbaddr" in your source. 18, "Symbol already declared global" You have two identical XDEF symbol declarations in your source file module. 19, "Symbol already declared external" You have two identical XREF symbol declarations in your source file module. 20, "No command line arguments" Ups - display Z80 Module Assembler help text. 21, "Illegal source filename" You have tried to specify an option after having begun to specify filenames. Options must always be specified before filenames or project files. 22, "Symbol declared global in another module" You have two identical XDEF definitions in separate modules. One of them should probably be an XREF instead. 23, "Re-declaration not allowed" You are trying to specify an XDEF for a name that has already been XREF'ed in the same module (or the other way around). 24, "ORG already defined" Not used. 25, "Relative jump address must be local" You have tried to JR to a label address that is declared as external (with XREF or LIB). JR must be performed in the current source file module. 26, "Not a relocatable file" / "Not an object file" The assembler opened a supposed object file (with the proper ".obj" extension) but realised it wasn't conforming to the Z80 assembler standard object file format. 27, "Reserved name" You have tried to create a label or other name as "ASMPC". 28, "Couldn't open library file" The library file was found but couldn't be opened (probably already opened by another application resource) 29, "Not a library file" Your library file is not a library file (at least is not of the correct file format used by this assembler). Have you maybe used another "library" file? The Z80 library file could also be corrupted (at least in the header)... 30, "Environment variable not defined" The assembler reports that either the "Z80_OZFILES" or "Z80_STDLIB" environment variables wasn't found in the operating system. 31, "Cannot include file recurseively" An file was tried to be included which was already included at a previous include level. INCLUDE "a.h" cannot contain an INCLUDE "a.h"... 9.0 Compiling the Z80 Module Assembler ANSI C source files If it is needed to re-compile the assembler for the current platform or compiling it for a new platform, two files must be stored together with the source files present in the same source directory: 1) The 'config.h' file This file contains three components: a) A constant string (name) to identfiy the name of the platform the assembler is running in. The name may be used in assembly source texts as an identifier e.g. for conditional assembly of your compilation project. b) A C compiler identifier to control #ifdef conditional compilation of the assembler source files. If new platforms are added to the source files the compiler identifier is added to the 'config.h' file. Please choose a well defined name of the operating system. c) If your processor architecture uses Big Endian integer storage (high byte - low byte order), then it is necessary to use the "ENDIAN" directive (e.g. for MC68000). The 'config.h' file must be in the same directory as the C source files. 2) The 'symbol.h' file This file contains all data structures (linked lists for expressions, AVL binary trees for symbol tables, source module specifications, etc.) used by the assembler C source files. Almost all C source files include this file. The 'symbol.h' file must be in the same directory as the C source files. o The assember program supplied as ANSI C source files The Z80 Module Assembler is already established on several computer platforms. However, other programmers wishing to use the assembler on a another platform must port the source files and compile them on a local ANSI C compiler. We chose the ANSI C language because it is a widely known language, standardized and well suited for text processing and compiler oriented applications. Further, a ANSI C compiler is almost always available on various computer platforms. o The format of the source files The source files contain no binary information, such as internal data structures for specific wordprocessors or editors. All source files are stored as 7 bit ASCII characters using only new line (\n) and tabulators (\t) as control characters. The syntax layout of the sources use the GNU programming style. o Defining the current platform As seen on the supplied 'config.h' file only one platform identification can be active at one time. All other platform identifications are commented out (not active). Setting more than one platform active may result in the C compiler failing with unknown identifier errors or generating fatal code. o The C source files The Z80 Module Assembler is composed of the following ANSI C source files: z80asm.c This file contains the main entry of the assembler. Command line parsing, assembler file control, calling of pass1, pass2, linking, relocating, code generation. Various assembler output files are created from this source module. z80pass.c Control of pass1: source file parsing, inclusion of files, conditional assembly and code generation to object files. Listing file generation. Control of pass2: expression evaluation, patching and completion of object files. Patching in listing files and symbol table generation (to separate file or at end of listing file). modlink.c Control of linking and relocating of object module machine code. Also automatic library inclusion and relocating of code modules. Creation of object module libraries and executable Z80 machine code files. Creation of mapfiles (sorting of symbols and writing to file). symbols.c Symbol table management og local, global and external assembler source module symbols. exprprsr.c Expression parsing and evaluation. Storing of expressions in infix notation to object files. prsline.c Source line parsing functions. These recognize identifiers, constants and Z80 standard mnemonics. prsident.c Here, all standard mnemonics and directives are found and executed to begin parsing, generate machine code and store information into the object file. asmdrctv.c All function logic routines (DEFB, INCLUDE, ORG, DEFVARS, etc.) that parse and code generate Z80 assembler directives. ldinstr.c All functions that parse and code generate the Z80 LD instruction group to the object file. z80instr.c All functions that parse and code generate the rest of the Z80 instructions to the object file. hist.c This contains the development history of z80asm, right from the start, with more or less interesting details. if you make any changes, please specify them here, supplied with your name (and maybe an email address). This file uses c format multi-line comments. It is not needed to include this file in the compilation project. o Using a Make utility or a compiler front end Most C compilers accept the following command line: cc -oz80asm *.c which will identify the execute filename as "z80asm". All c files will auto- matically be compiled, and the main() function is automatically resolved in the appropriate "main" source during compilation. You may however be forced to use a make utility. o Future platform implementations If you have ported this assembler to a new platform, please send us a disc with the appropriate files. PLEASE SPECIFY WHERE YOU HAVE MADE THE CHANGES. We prefer MSDOS discs (since almost everybody can read/write them). If otherwise, please specify the format. Send the discs to: Gunther Strube Gl. Kongevej 37, 4.tv. DK-1610 Kobenhavn V Denmark I can also be reached by email: gbs@image.dk The Z80 Module Assembler may have been further developed in parallel with your port. It is of extreme importance that we know of all your changes to be able to put them into a new release. Write a file with your programming changes, the executable program, and which platform the assembler is running on. Make sure that the compiled program may be distributed freely - some companies expect royalties for selling/ distributing software that was compiled with their C compilers. We take NO responsibility for illegally distributed programs! The Z80 Module Assembler is a GPL'ed program and should be kept that way to the benefit of all developers... 10.0 File formats o Object file format documentation The structure of the object file format is designed exclusively for the Z80 Module Assembler. However, it may be useful for other programmers if they wish to use the file format for other purposes. We have included the documentation of the object file structure in this document. Improvement suggestions are welcome. We hope to have designed a simple and straightforward file format. The documentation may be necessary if you want to use the object file format in other systems. I have created the design structure of the object file format to be suitable for future expansion. The primary aim of the design has been to maintain structure simplicity and load efficiency during link processing. The format of the object file is as follows: 0 [ 'Z80RMF01' ] [ ] [ ] [ ] [ ] [ ] [ ] [ ... ] [ ] [ ... ] [ ] [ ... ] [ ] [ ] n The 0 (null) - defines start to total of bytes file length. The above figure has deliberately been split into sections to clarify the file structure, allthough there is no actual physical separation between the sections in the file; each section is immediatly followed by the next. The file pointers are 32bit integers stored in low byte - high byte order (Little endian format - Z80/Intel notation). Contains the ORG address for the linked machine code or FFFFh for no ORG address defined. Contains the following: defines the resulting evaluation type range: 'U': 8bit integer (0 to 255) 'S': 8bit signed integer (-128 to 127) 'C': 16bit integer (-32768 to 65535) 'L': 32bit signed integer defines the 16bit relative module code patch pointer to store result. defines byte length of expression string. contains the infix expression parsed from the source file. Contains the following: defines the scope of the name: 'L' is local, 'G' is global, 'X' global library defines whether it is a: 'A' relocatable address, 'C' a constant' defines length byte of the following string. Contains the following which defines library reference names: defines length byte of the following string. Contains a preceeding byte identifying the length of the following string Contains a preceeding 16bit integer identifying the total length of the following machine code block. o Library file format documentation The library file format is a sequense of object files with additional structures. 0 [ 'Z80LMF01' ] [ ] [ ... ] n Contains the following: <'Z80RMF01' Object File> is a 32bit integer file pointer to the next If this file pointer is -1 (FFFFFFFFh) then the current is the last in the library file. is 32bit length integer of <'Z80RMF01' Object File> If this integer is 0 then it is indicated that the current has been marked "deleted" and will not be used. z88dk-1.8.ds1/doc/zcc.html0000644000175000017500000007174607273540526014747 0ustar tygrystygrys Z88 Development Kit v1.33 sccz80v1.10b0.70 - XX/X/2001

Z88 Development Kit

A Small C+ Compiler for Z80 based Machines



What's New?

Please See the file readme.1st in the root directory of the archive for more information


Introduction

The z88 Development Kit (hereafter known as z88dk) is an advanced set of tools allowing the production of complex programs for z80 based computers in either C or assembly language.

Although titled z88dk this a little bit misleading; as supplied the kit produces code for over a dozen z80 based machines and can be easily retargetted to any z80 based machine with the minimum of effort (see the file retarget.txt for details on how to do this.)

z88dk consists of the Z80 Module Assembler (z80asm) from Interlogic, a highly extended Small C+ compiler as well as various libraries implementing a large subset of the ANSI standard.

Code Output

For the z88 the kit produces the following executables:

    • Programs runnable from BBC BASIC
        Absolute address runable programs
          Relocatable programs
            Good, bad, ugly applications and popdowns
              Packages (aka shared libraries)

              For the spectrum only absolute address executables are produced


              Status

              Well, the package has finally been released, and we're now up to the umpteenth release, the status of it quite tricky, the source for all of it is released and anyone can port it to anything they feel like, however if any changes are made to the compiler, frontend, appmaker, optimizer, libraries, includes could you please let me know so that I we keep this kit unified. Any changes to z80asm should be reported to Gunther (see z80asm.txt file).

              The Kit is free to use for free applications (though let me know if you do use it!), if you create a commercial product then I (and I'm sure Gunther) would be most appreciative of a copy.


              Acknowledgements

              Thanks to everyone who submitted bug reports, extends and uses z88dk

              The Z88 Development Kit was, and always will be, "Made with Amiga." Though a Linux box or two did help along the way!


              Installation

              *nix Installation

              Move the tgz file to your home area and extract it using the command:

              % tar xvzf [filename]

              Once this has been done you'll find a new directory called z88dk and under that you'll find the following directory tree:

                      
                      bin/        Executable directory
                      doc/        Place for doc files
                      examples/   A few example programs (for z88 and Spectrum)
                      include/    Header files for the C compiler
                      lib/        Where the runtime libraries and startup code live
                      libsrc/     Source for the runtime libraries
                      src/      
                      src/appmake Source for the application maker
                      src/z80asm  Source for the z80asm Module Assembler
                      src/copt    Source for the z80 code optimiser
                      src/cpp     Source for the DECUS cpp
                      src/sccz80  Source for the C compiler
                      src/zcc     Source for the front end
              	support/    Miscellaneous code snippets

              In order to use z88dk you'll need to first of all build the binaries, to this go into the z88dk directory and enter:

              % make

              And with a bit of luck things will be built for you! Next you'll need to add the z88dk/bin directory into your path, this is done easily under tcsh by editing your .cshrc (or .tcshrc) and inserting the line:

              setenv $PATH $HOME/z88dk/bin\:$PATH

              Whilst you're there add the lines:

              setenv ZCCCFG $HOME/z88dk/lib/config/
              setenv Z80_OZFILES $HOME/z88dk/lib
              setenv Z80_STDLIB $HOME/z88dk/lib/clibs/s.lib

              If you use a different shell, eg bash or some other hideous contrivance you'll have to use a different method (consult a convenient manual/guru)

              Log in a new shell, type zcc, and with a bit of luck you'll see a short message - congratulations you've now installed z88dk and can start programming!

              Amiga Installation

              Extract the archive to any directory you feel like, and add the following lines to your s:user-startup file:

              ;BEGIN Z88DK
              cd [directory where you installed it]/bin
              execute startzcc
              ;ENDF Z88DK

              MSDOS/Win32 Installation

              Grab the executables from Dennis' homepage?


              The Frontend

              The frontend of z88dk is called zcc, it is this that you should call if you want to do any compilations. To invoke the frontend use the command:

                      zcc [flags]  [files to be compiled/linked]

              The files can be either C files (.c) , preprocessed C files(.i), compiled C files (.asm), optimised compiled file (.opt) or assembled files (.obj), any combination of them can be mixed together and the relevant processed done on them.

              Processing of a file list is done on each file in turn (i.e. preprocess, compile, optimise, assemble) at the end all files may be linked into a single executable if desired.

              Options to control the action of the frontend:

                   +[file]       Name of alternate config file 
                   		   (must be the first argument)
                   -a            Produce .asm (or .opt) file only
                   -c            Do not link object files
                   -E            Preprocess files only, leave output in .i file
                   -o [file]     Specify output file for binary (default is a.bas for BASIC
                                 programs and a.bin for application binaries)
                   -On           Optimize compiler output (to .opt file)
                                 n can be either 0 (none) 1,2,3, level 2 is recommended.
              		   Level 3 is suitable for large programs (includes certain
              		   lib functions to reduce size of code(!))
                   -v            Verbose - echo commands as they are executed
                   -vn           Don't be verbose
              

              Options to control library usage:

                   -l[name]      Link in a library - supply just the name (after placing them
                                 in the correct directory)
                   -lm           Link in the generic Z80 maths library
                   -lmz          Link in and generate code for OZ's maths routines
                   -lmalloc      Link in the near malloc routines
                   -lgfx         Link in the graphics routines (for BASIC progams)
                   -lgfxapp      Link in the graphics routines (for applications)
                   -lz88         Link in some Z88 application routines (eg mailboxing)
                   -lnet	   Link the the socket routines for ZSock
                   -m            Generate .map files when assembling/linking
              

              Options to control the type code produced:

                   -unsigned     Implicitly define everything as unsigned unless explicitly
                                 told otherwise.
                   -create-app   Create an application image (i.e. bank 63,62 etc)
                   -make-app     (App) Notify the compiler that you're trying to make an
                                 application
                   -reqpag=      (App) Number of 256 byte pages required for bad
                                 application
                   -zorg=        (App) Origin for a Z88 application
                   -safedata=    (App) Amount of safedata required by your code
                   -defvars=     (App) Where static variables should be dropped (only
                                 valid for single file compilations, but see later)
                   -expandz88    (App) Expanded z88 required
                   -no-expandz88 (App) Expanded z88 not required (these two flags toggle
                                 some startup code to check for an expanded machine)
              
                   -startup=3    Produce standalone code that can be run from a set
                                 address from BASIC. Use -zorg= to change the address
                   -R            (Use with above) produces relocatable code that can be
                                 loaded into a DIM'd BASIC array.
              
                   -smartpf      Intelligent printf routine handling
                   -no-smartpf   Turn off the intelligent printf handling
                   -make-lib     Shortcut to generate .o files from library .c files
                   -stackoffset  Sets the stack offset for shared libs (see package.txt
              		   for details)
                                 
              

              Miscellaneous options:

                   -z80-verb     Allow z80asm to be verbose, this tends to generate a lot
                                 of output to the screen so may not be desired.
                   -cc           Intersperse C code as comments in the assembler output, warning:
                                 this *will* clobber some optimizations.
                   -Wall         Turn on all the compiler warnings
                   -Wnone        Turn off all compiler warnings
                   -Wn[num]      Turn off the compiler warning [num]
                   -W[num]       Turn on the compiler warning [num]
                   -asxx	   Cause the compiler to emit asxx compatible code
                   -Cp[option]   Pass an option through to the pre-processor
                   -Ca[option]   Pass an option through to the assembler
              

              In addition, the flags, -D, -I, -U are passed through to the preprocessor.

              Any unrecognised options are passed through to the compiler (to allow for improvements in the future.)

              Configuration files

              In order for z88dk to work on as many platforms as possible and so that it can be easily tweaked, retargetted and generally mutilated, the frontend (zcc) consults a plain text configuration file which is in the directory pointed to be the ZCCCFG variable.

              The default is to use the file ZCCCFG/zcc.cfg which by default is a softlink to the configuration file for the z88. Should you mainly be targetting a different machine then simply change the softlink to the appropriate file.

              Should you want to occasionally compile for other machines then as the construct your zcc line thusly:

              zcc +[name] [....]

              Where name is either z88, zx (Spectrum), or vz (for the VZ200/300 port). If you wish to use a config file located in the current directory or anywhere else on the system then specify the full path and filename - make sure the filename as the suffix .cfg.

              Finally, for the sake of backwards compatibility zcc will take the value of the environmental variable ZCCFILE and use that config file.

              The order of checking is as follows:

              1. "Local" file (if exists) eg +temp.cfg
              2. ZCCCFG/[name].cfg eg +z88
              3. ZCCFILE
              4. ZCCCFG/zcc.cfg

              The Compiler

              Introduction to the Compiler

              The Compiler is based upon the Small C/Plus compiler which has long history but can be basically be attributed to in chronological order: Cain, Van Zandt, Hendrix and Ronald Yorston. This last person in particular developed the compiler very considerably beyond the original specification for Small C set down by Ron Cain. James R. Van Zandt modified it to include floating point using floating routines originally written by Neil Colvin.

              I too have further extended the compiler and hopefully made it into a true cross compiler which can produce z80 code from any machine.

              The compiler accepts a subset of Standard C, for more details about C see the ubiquitous K&R - "The C Programming Language", if you want details about the compiler try and find the now out of print "The Small-C Handbook" by James E Hendrix. Information on the original incarnation of the compiler is available from Dr Dobbs CDROM, though at $50 it could be considered overpriced.

              Datatypes Supported by the Compiler

              Small C+ supports a wide variety of datatypes which are similar to those in ANSI C, however it should be noted that the float type is a synonym for double - unlike big C there are not two different types.

              Characters, ints and longs may be either signed or unsigned. Their maximum and minimum values are detailed in the table below. Pointers contain the addresses of data elements and are treated as unsigned ints when compared. NB. The size of pointers is likely to be userdefinable in the future:

              Type Size Min Max
              char1 byte-128127
              unsigned char1 byte0255
              int2 bytes-3276732767
              unsigned int1 bytes065535
              long4 bytes-21474836472147483647
              unsigned long4 bytes04294967296

              The compiler supports a wide range of data types up to pointers to pointers to type.

              Hopefully longs will now be correctly handled - including all arithmetic routines. One area which I haven't addressed is the conversion to and from doubles - they might work if they are smaller than 32767/65535 (signed/unsigned) for the generic routines. If the z88 maths routines are used any conversion should work perfectly fine.

              Structures are declared in the usual way but may not contain instances of themselves, but may contain pointers to instances of themselves. Passing structures to a function is not permitted i.e. the only legal way a structure can occur in a function argument is as a pointer.

              Far pointers are now supported, although library code only exists for the z88.

              Writing Code

              In this section I'll just raise a few of the more obscure aspects of the compiler

              Rather a lot of optimization rules have been written for the unsigned char type. So use them as much as possible, particularly if you wish to use logical operations (&|^). Doubles are particularly unwieldy and the code which accesses them cannot be optimized particularly well, so avoid them if at all possible (not suprisingly they aren't the speediest of types either).

              Other tips include define arrays and chars first of all in a function and ints later. Loop counting ints which are defined last of all will (when the code is optimized) generate much faster and smaller code.

              If you do define a global (static) variable (as opposed to just declaring its presence) please note that the variable is embedded within the code and could not be changed if the program were to be blown onto an EPROM. Also important to note is that global doubles can not be initialised.

              It is possible to mix C and assembly in a single source file, simply enclose the assembler language with #asm/#endasm or with #pragma asm/#pragma endasm. It isn't advisted that you mix assembler and C unless you know very well what you're doing!

              Having said that, possibly the most useful use of the #asm/#endasm would be to initialize global variables (though this can be done automatically), this could be used to easily define udg graphics for example:

              extern char udg[8];
              
              main()
              {
              /* Put some code here! */
              }
              
              #asm
              ; A very boring graphic! 
              ._udg    defb 185,170,185,170,185,170,185,170
              #endasm

              Note the use of the _ prefix - this has been added to avoid label clashes with the library.

              Macros

              There is another method to call machine code from within C - the "asm function" this is an incredibly useful way of getting macros into z80asm, an example of how to do it is in the example/ directory, it's easier to read the example than to read me try to describe it(!)

              As well as providing macros, asm() can be used to call machine code routines embedded with C expressions (caution!!). An example of using it this way follows:

              main()
              {
                      int j;
                      j=asm("call\tfish");
              }
              
              #asm
              .fish
                      ld      hl,1
                      ret
              #endasm

              Not perhaps the best example ever, but it illustrates its use - you can also return longs (kept in dehl) and chars (in h=0,l)

              There is another feature of this version of Small C which could potentially be of much use if you were combining an existing assembler and a C program. This is the so called external pointer data type, and I shall illustrate it's use with a few C examples and the hypothetical assembler code produced, let us assume that hl is the integer j.

              extern int data(address);       address=16 bit Z80 address
              
              function()
              {
                      int j;
                      j=data          ld  hl,(address)
                      j=&data         ld  hl,address
              }

              You can similarly do the same trick with chars and doubles. I believe this to be slightly "non-standard" but could prove invaluable for finding out system variables etc.

              Compiler Limitations

              It's important to remember that the compiler isn't gcc! It's still the Small C+ compiler, albeit with a lot of extensions, to this end remember the following:

              • ****Pointers to functions cannot be prototyped!! ****
              • enums are treated as constants - there's no checking that you are assigning an appropriate value to an enum type (which is just an int)
              • typedef doesn't consider pointers - I hope to change this in future
              • casts may be a bit dodgy on pointers to pointers (my brain tends to turn to putty around about this point)
              • Although there's no warning about it, the compiler knows that you're being naughty when converting between pointer types without a cast (a result of my brain being putty around pointer to pointers!)
              • Multidimensional arrays are not supported (see above)
              • Bitfields are not supported, the compiler parses them, but warns you that they're not supported - you never know code may actually work!!
              • The compiler evaluates expressions left to right eg (1 + j + 3) will create bulkier code than ( j + 1 + 3 )
              • Remember to specify types with constants - in certain cases the compiler may not do the necessary conversion from short to long

              Printf Functions

              I'll be honest, printf() is a beast, the integer version with formatting control ways in at over 2k which is a little large to say the least, so with a little bit of scraping around I present you with miniprintf! This function is a substitute for printf() with the following limitations:

              • Only %s, %d, %c %% %u %ld %lu types are accepted
              • No width formatting control
              • It doesn't return the number of characters printed

              If possible the compiler will scan your format string and if it sees just these types then it will use miniprintf() instead, however should you require the number of characters printed then we're in trouble! To disable this "intelligent" substitution specify the command flag -no-smartpf, it is enabled by default.

              However miniprintf() is faster so perhaps on occasion (and with flagrant regard to memory requirements) you want to switch between them, you're a bit stuck if you can only specify flags on the command line, which is where the universal #pragma directive comes into play once more.

              If in your source file you insert the line:

              #pragma -no-smartpf

              You'll turn off intelligent printf handling, but if you want it back again, just insert a:

              #pragma -smartpf

              And it'll be turned back on again, of course this #pragma has other uses, for example in compiling applications, the command line to compile them is, to be frank, a bit of a gobful at times, so simply stick these lines at the top of your source file(s):

              #pragma -make-app
              #pragma -reqpag=0
              #pragma -no-expandz88

              Or whatever is appropriate for your application, all sccz80 specific flags can be specified within the source file, with the exception of -make-lib which has to be on the command line. So if you are using safedata space for static variables you can specify the DEFVARS address for each module. NB. I will not be responsible for tears and other distress that this may cause, if you use -safedata= or -defvars= then it is assumed you know what you're doing!!!


              z80 Code Optimizer

              The optimizer supplied with the package is of the peephole variety - i.e. if it spots a a group of lines which it knows can be better represented in another way it will - it isn't (and never will) be a true optimizer and keep track of register usage and avoid repeated loading of a register with the same value.

              Hopefully the rules supplied will not cause any software to fail (I haven't come across anything yet - and I have used them a lot), however if they do, then just mail me with the C source and the assembler output (raw and optimized) and I'll see what I can do to remedy the situation.


              Assembler and Linker

              As previously noted the assembler and linker are combined in the z80asm Module Assembler from Interlogic. Using this program has numerous advantages over the traditional method of using a separate linker and assembler, briefly these are:

              • Compact object file format (no more bulky Intel Hex object files)
              • Fast, small and cross-compilable
              • Extensive built in support for the Z88..
              • ..whilst not sacrificing generic z80 compatibility
              • A good general purpose assembler for assembly projects
              • Most of the Z88 community is familar with the syntax
              • Still being actively developed.

              I will always support (where applicable) any new features in z80asm, for example in v1.2 of the kit the following new z80asm features are used:

              • Ability to specify an output file
              • Ability to define scope of variables labels anywhere within a .asm file (goodbye .hdr!!)
              • Errors now give the module name in which they occurred
              • Text is now defined in .asm files via defm (OK, it's not a new feature in z80asm, but it's new for sccz80!) - this can result in a decrease in assembly time.

              In future z80asm is due to gain sections, these will of course be used by z88dk allowing more library routines to be used in z88 applications.


              Libraries and Includes

              I have endeavoured to put together a fairly comprehensive library of functions which cover most of the things that smallish C programs would want to do. There are of course many omissions and undoubtedly many mistakes, so if you find one, could you either endeavour to fix it and send me the corrected version or alternatively let me know and I'll find the time to repair it.

              malloc.h

              extern void *calloc(int number, int size_of_datatype);
              extern void *malloc(int bytes);
              extern free(char *);
              extern getfree(void);
              extern getlarge(void);
              extern initmem(int size);
              
              
              I've kludged around and come up with an extremely rudimentary malloc/free scheme for Small C. All memory is allocated out of character array! The routines actually come from a file I spotted on an MSX website a year or so ago, here's an example of how to use these routines.

              
              #include <malloc.h>
              
              /*
               * Define the size of the pool, HEAPSIZE is a macro for unsigned char [ ]
               */
              #define HPSIZE 8192
              HEAPSIZE(HPSIZE)
              
              
              main()
              {
                      char *s;
                      int size;
                      initmem(HPSIZE);        /* Initialise the heap - has to be done! */
                      s=malloc(100);
                      if (s == 0 ) exit(0);
                      free(s);
                      size=getfree();         /* Get total free memory */
                      size=getlarge();        /* Get size of largest block */
              }
              

              Don't forget to link with -lmalloc


              Example Programs

              Included within the package are a few C example programs, they're quite simple, but prove that the package does actually work!

              There is also a number of demo applications hidden within the examples/apps directory, these are supplied in a format suitable for installing using the RAM Installer. I'll briefly describe them:

              dstar A short puzzle game written almost entirely in C, it's quite a tricky one I warn you now!

              rpn The application version of the Reverse Polish Notation calculator.

              useless Completely useless, just a short demo of how to interact with OZ using C - demonstrates menus, help and commands

              viewer A simple popup (about 20 lines of code), displays the contents of a file on to the screen (select a file from the Filer)

              wc Another simple pop up which displays the number of bytes words and lines in a file (select a file fomr the filer)


              Spectrum Support

              I've started some (minimal) ZX Spectrum support, it's not perfect, but it's just enough to run a couple of example programs. I've implemented simple functions such as getk(),getkey() (non-standard) and putchar(), puts(),gets(),putc(). The miniprintf routines should also work. These few routines make it possible to run enigma.c successfully. I've also played around with dstar.c (just minor changes to the graphics routines) and it too now works on the Spectrum; some screenshots:

              Enigma ZX Screenshot A screenshot of the enigma.c program in action on the Spectrum. It's not exactly exciting, but it was the first program to be compiled and as you can see works pretty well perfectly!
              DstarZX Screensgit Another easy port from the Z88. This game has quite a complex history, and finally it's made it onto the Spectrum. It's a fairly tricky puzzler, so prepare for frustration!

              In addition to the routines mentioned above, all ctype.h and strings.h functions are available. In addition generic Z80 Maths support as well as the near-malloc routines should work. All routines in stdlib.h with the exception of sleep() and csleep() should also function as per the z88 - have a look at the {zcc}/libsrc/speclist for details of what is in the Spectrum library.


              Known Feechures aka bugs!

              Hopefully this list will first grow(!) and then shrink as I sort them out.

              28.1.2000

              ---Casts can sometimes through a wobbly generating incorrect code. I've tried to fix them but they may still occasionally go wrong.

              8.3.99

              --->The supplied preprocessor is ANSI C and doesn't strip // style comments - solution don't use them or use the -// flag. The compiler should strip // style comments however.

              So, I guess you're here cos your code doesn't work? Have you checked it - I mean have you really checked it? Does it make sense, there are no wild pointers are there? Ah, where does it go wrong then? In a library function? Good, delve into the libsrc directory pull out the relevant file and look at it. Spotted a bug? Tell me about it and I'll put it right.


              Some Past History

              The development history of the Z88DK is now found in the separate file history.html.


              The Future

              Pretty well all the goals have been achieved! Now the fun with library routines begins! I'm starting to rewrite all of the library functions in C where far access is a possibility - i.e. string functions, stdio etc. Garry has written some nice z88 far memory management routines so all that's left are the bugs!

              Future developments can of course be found on the z88dk website where I will upload the latest distributions on a fairly regular basis.


              Dominic "Devnotes? What are those?" Morris <dom@jb.man.ac.uk> 17/4/2000

              Back to top

              I don't wanna change the world.... z88dk-1.8.ds1/doc/zxscrdrv.txt0000644000175000017500000000323207744601665015716 0ustar tygrystygrysZX Spectrum Screen Driver ------------------------- The new screen driver is still fairly minimal but it does feature 64 column text and 32 column text (switchable) and can be easily extended. Here are the byte sequences for it: 1,64 - Switch to 64 column mode 1,32 - Switch to 32 column mode 2,ll,hh - Set the address of the 32 column font. ll is low byte, hh = high byte. By default this points to the ROM font at 15616 3,ll,hh - Set the address for the UDGs by default this points to 65368 8,9,10,11 - Move in x and y as you would expect 12 - Form feed - clears the screen and moves print posn to 0,0 13 - Carriage return - advances y and sets x to 0 16,x - Set the ink colour (x = 48-55 ('0'-'7')) 17,x - Set the paper colour (x = 48-55 ('0'-'7')) 18,x - Turn flash on/off (x=49/48 ('1'/'0') 19,x - Turn on/off bright 20,x - Turn on/off inverse (x=49/48 ('1'/'0') 22,y,x - Move to position y,x on the screen (0<=y<=23, 0<=x<=63) NB. y and x are displaced by 32 eg to move the print position to (0,0) use 22,32,32. 32 column mode also uses 64 column coordinates. All the commands, except for the udg address/font address can be embedded in strings using either octal or hexadecimal representation. Address changes can be sent either using fputc() or using printf with the address as parameters. Characters greater than 127 are interpreted as udgs. These are always printed using the 32 column mode. This gives a potential of 128 udgs though obviously, it's possible to swap between banks in the middle of printing a string. The screen now scrolls when line 24 is "hit", the routine used is in the 48k ROM. dom 24/1/2002 z88dk-1.8.ds1/examples/0000755000175000017500000000000010765235700014327 5ustar tygrystygrysz88dk-1.8.ds1/examples/ace/0000755000175000017500000000000010765202715015057 5ustar tygrystygrysz88dk-1.8.ds1/examples/ace/adv.byt0000644000175000017500000003242207240553422016352 0ustar tygrystygrys a.bas 4@ 4!9"(@!9sW@!/@6!3@6!7@6͌Yhl1$Small C+ J.ACE Z}\\\\\ ] ]@][]]]]]]]^^8^U^l^^^^^^^0_\___#````a.aUa|aaab?bbc_ccccccc d\ddeee.ffffgvggggggggggghh(h7hGhphhhhhhhhii5i  DOWND NORTN SOUTS EASTE WESTW GET PICK DROPPUT FIRESHOOBOOTSTARMOTOKEY LASEGUN USEDBAR BARSGOLDCOINMIRRBROKGLOVROPEFLOOBOARPLANSTALBLOCICE POOLWATELAKESLEEGREEMAN DOOR OPEN!UNLO!WIND"SMAL#SPAC#SHIP#SECU$FLIN%STON&DRAW'HELP(INVE)I )QUIT*STOP*ABOR*YES +Y +NO ,COMP-KEYB-TYPE.TURN/HAND0KILL1DANC2WALT2REMO3KICK4BREA4HIT 4BANG4BRIB5USE 6WITH6PUSH7THRE83 8TWO 92 9ONE :1 :MEND;FIX ;REPA;FOUR<4 <LOOK=STAN>TREE?CUT @SAW @WEARACROSBJUMPCRAVIDUP EU ECLIMEFUSEFREDEGR GMAINHAUX IFIELJSHIEJ     _DfDiDnDsDxD{D|DDDDDDDDDDDDDDQQQR RR3RTR[R                                                                                 &                                 ! EF EF  EF EF EF EF EF EF EF EF "EF %EF (EF (EF +EF .EF %1EF &4EF)FF*FFEFEF EFEFEFEF7EFEFEFEF"EF%EF(EF(EF+EF.EF%1EF&4EF=':EF4:EF6=EF@BEF6%EEFAFG3FGBDJEGBDMEG6PE G6UE GCDPEGCDMEGZEG6]EG bE G iE,G nE GqE1G tE4G E7G7E:GE=G1yE@G1qE@G6|ECG6ELG6EOG.(ETGELGJEWGJE\GJEaG2EdG2EjG! E@G6EoG1$ErG=EEuG4ExGEE}G5$EG6EG EG=EG EGEGEGEG! EG78EG78EG79EG79EG7:FG7:EG;F FG6FG=FG(FG(FG(FG("FG(%FG((FG(+FG(.FG=E3FG8FGFGAFG3FGGFG;FG6>FGC;FGECFG#HFG7HKFG7IKFG78PFG79PFG7<UFG7:]FH7:UFH(F H=FH# $ % gFLmFLsFLyFLF LFL!9gs!1@Vm!9gs PsgL! "q@! ?L! !1@Vm;!9! 9ts#ͣs+~!9n&|¨L3!9n&íMhLûMûM!9ts+ͣs!9ts!!9! 9ts~!9~ LL!9~ M#!9ts#ͣsL*q@ys#MhL!9!9tsͣs!9! 9ts~!9~ YMYM!9~ xM!9n&?L!9ts#ͣs2M*q@ͩs|ʞM! ?L*q@ͩs+"q@êM*q@ͩs"q@ûM} ʲL ʸLûLÂL3!@*k)tsL!"k!͕s4NM#M)(l^#V*kPs1N*k͉sN!_iL!"k)@tsLhLM!"dl*kUNUN!kts+ͣs*kmNmN!kts+ͣs!qiL͚X!"l!k" lW"flPs(O!* lgs PsڸN* lgsPsN! O* lgs PsN* l#" lBP* lgs PsN* lgsPsO! O* l#" lN|$O!iL!"dl+O.OÄN!"bl* lgs;}o!9gs PsTO3|O!9gs|FP!9gs PsFP* l#" l34O* l#" lW"bl͛sO* lgs;}o!9gs PsҳO3O!9gs|FP!9gs PsFP* l#" l3ÓO|O!D*k)tsn&PsP.P*flPs P#n&"k!"dl##O!H"k!"&l!"dl+O3O*k^#Vkb|œP*&l͉sҔP*fl ͕syP!iLÔP*l|ʌP!iLÔP!iL!"dlPsڳP*flPsҮQ*k##^#VkbPsP*blPsҭQ*k ts"`l*`l#"`l+n&͛s5Q)D^#V*`ln&"k,@͉s*Q!"l!"dl!9*`l#"`lP*k ts"k!"&l!"dl*k^!PsaQ!V*k#"k+n&)^#V*kn&"k,@*dl͛sҙQ!9*k#"kNQ!iL!"dl[k*kPs!(l*k)^#Vkb*kPsQmsQ!!rtr*k͕sQ͉s!(l*k)^#V!Ps!k*k)ts͉s͉s*`l#"`ln&!k*k)^#VPsR͉s!(l*k)^#V!PsڌR!(l*k)^#V!PsڌR!!!!iL!!͕sSýR#åR!(l!9ts)tsmsS!96#6!@!9ts)tsLPs S!iLhLõR!9ts|'S!jL!"dl!(l*k)^#V!Ps҂S*kPsdS! jL!"dlS!(l*k)6#6!kts#ͣsÐS!;jL!"dl*kPsҮS!PjL!"dl-T!(l*k)^#V*kPsS!(l*k)6#6!kts#ͣs-T!(l*k)^#V!PsT!(l*k)^#V!PsT!gjL!"dl-T!zjL!"dl!(l*k)^#V*kPsUT!jL!"dlT!(l*k)^#V!PsT!(l*k)*kͣsT!(l*k)^#V!PsҵT!kts+ͣs!(l*k)*kͣsT!jL!"dl!(l*k)^#V!PsT!(l*k)6#6!kts+ͣs-U!(l*k)^#V!PsU!jL!"dl-U!jL!"dl!u@*k)tsL!!"dl!"dl*k"k!k*k)ͣs!k*k)ͣs!(l*k)^#V!(l*k)!(l*k#)tsͣs!(l*k#)ͣs!jL;!jL!9 X}!9gsYPsU!"dl3!9gsNPsV!$m3U!jL!"dl!jL XYPsTV! kL!kL XYPsTV!"dlûU*k#"kn&!k*k)ͣs!(l*k)*kͣs!(l*k)ͣs!"dl[k*k"k!9!8kL*k!!1@shL! 9ɐR1SS.TT.UDUKURUYUkU}UU VVWVtVVVVVwmo !(n>w!(n~r#orC $!(n:m:NrGp2mr:Nr=2mrD !(n:m!p2mrA !(n:m6p2mrB !(n:mw#w !(n#>w!(n~!Orp:Or 2m#~=!Nrp~=2mrb(LJeq !(n>w!(n~ 2:m:m> Pr<2m!Nrp2m2m< Pr=2m%q2m2mr=́rAqrrkr2m2mro(4Kq !(n>w!(n~ :m> Pr<2m!Nrq2m :m> Pr=2mq2mrr:ḿrrl :ḿrrnqr!(n~r͛rrL !(nF:mrM !(n~Rn 2r >2r( 2r >2r 2r >2r 2r !$:m(G :m_w!$6 T]:mG2m:Nr=2m> Pr=rx2mɯ2m:m<2m!Or:Or=2mör! $$K!&6 T]Pr:NrW:m<2mÜrN#F#x( ~#~# `i||G(ogz怨Oz(_W|>DM!R0?= PYyFsxȗ_WXs7?+{_z!8ɳ7~ogXs?+~#foXs+Xs7?+|(!#7Xs+Xs7?+}|{ozg}o|g0123456789ABCDEF! 9~s!9^#V! Ps8t!-!9tsVm!9! 9tsftͣs!9^#V!9tsr|9t!9^#V!9tss!s! 9^#V! 9tsrn&!9tsVmkt#|/g}/o*U@|t "U@!9NF^Vnfx(  # !!++!9N#Fy#^#V#~#fowt# xt!9^#V6# xttz88dk-1.8.ds1/examples/ace/ansitest.byt0000644000175000017500000000655107240553422017436 0ustar tygrystygrys a.bas K @ L !9"(@!9sZ@!/@6!3@6!7@6t@dB1 C$Small C+ J.ACE!yA>M!A!>M!A>M!A!>M!A!>M!A!>M!B!>M!)B!>M!M!SB!>M! MwAA#+A!XB!!9͉K !9͉K>M!9!XB!!9͉K M!9͉K>M!9AIf you can read this, CSI is not working. %c2JIf this the firt thing you can read, CSI is OK. %c[1mBold Text %c[2mDim text %c[4mUnderlined Text %c[24mUn-underlined text %c[7mReverse Text %c[27mUn-reverse text %c[m%c[%u;%uH* !-@!U@CҠBÁB hB##~ʝBͶB|ʝB͢BxBկwwww!~Oy B0nfB|!uut!~7+~##C+z {!!9! 9͉K#L+~ E!9~%^C!9n&! 9͉KEE!9! 9͉K#L+~!9n&D!9! 9͉K#L+~!9n&C!9͉K++L!9͉K͎K!9^#V! 9^!drKE!9!9͉K++LC}dʞCuʞCE!9͉K͉K͙K!9^#V!E!9!9͉K++LE!9͉K͉K!9^#V!E!9!9͉K++LE!9͉K͉K!9++͉K#L+~ʙD!9n&! 9͉KEiD!9͉K++LE!9͉K^#V! 9͉KE!9͉K++LE!9n&! 9͉KEE}l~CdCu)Ds]DcʪDD"C!!9~/E! 9͎K!T]ͽL8VE!-! 9͉KE! 9! 9͎KALL!9! 9͎K! ZLL|ʛE!9͎K! 9^#V! 9n&E!9! 9͎K! ͹K!0͡K! 9͉KE!~~(nfq#uti&B8FnfqK!9 FzKFxF~#FF J2F2FC ( *K2 :F<!JxF2F J^Kz#FCFÐFKFKFCFÉFz FCFÕF~#[ F 2Fz CFGCFÕF~#=(? 2Fz CF4GCFÕF~#0eG:eG`iFB00zGCFGCFÕF"(\ƒG2Fz 5CFGCFÕF;&H`iFB0z CF4GCFÕF~#!F(!`iFB0z CFGCFÕFz CFGCFÕF~#;7G~#0!H:!H0 O Oz CFGCFÕF;ʘG`iF 7?BE !F>wm^H !F>w!F~|J#RHvJC $!F:F:JG|H2FvJ:J=2FvJD !F:FҕH2FvJA !F:FH2FvJB !F:Fw#w !F#>w!F~!J,I:J 2F#~=!J;I~=2FvJb(LJI !F>w!F~ 2:F:F> J<2F!JcI2F2F< J=2FI2F2FvJ=KIvJvJJ2F2FvJo(4K:J !F>w!F~ :F> J<2F!JI2F :F> J=2FJ2FvJvJ:FKvJl :FKvJn`JvJ!F~vJ)KvJL !FF:FvJM !F~F 2{J >2{J( 2{J >2{J 2{J >2{J 2{J A8[0@a8{0@@!{J!$:F(G :F_w!$6 T]:FG2F:J=2F> J=Kx2Fɯ2F:F<2F!J:J=2FDK! $$K!&6 T]J:JW:F<2F*KzK7?+{_z!8ɳ7~#fo^#V#N#FPY|}Ņo|ٌg{ً_zيWz BzALxG!9OzAL !!RR0Z?xALyALML |/g}/oz/W{/_z !9 !!RR0Z?L+}ŕo|ٜg{ٛ_zٚWz( |!7|7?!}|}|{zzK+{ozgCM)!9 !1@^#V!9͉K++U@FMogz88dk-1.8.ds1/examples/ace/readme0000644000175000017500000000076007240553422016240 0ustar tygrystygrysThese samples have been tested with the VACE emulator. After compiling they can be converted with bin2byt utility, then loaded on the emulator. The FORTH commands are 16384 30000 bload smallgfx --> (or other file name) 16384 call I suppose the RAMTOP (or whatever name is used on the ACE for the Stack Pointer) should be set in a safe location, but I have on idea on how to do this (or on where is it by default). The ADV_A.C source code is already present under the ZX Spectrum samples. z88dk-1.8.ds1/examples/ace/smallgfx.byt0000644000175000017500000000102507240553422017410 0ustar tygrystygrys a.bas @ !9"@!9s#@=@1$Small C+ J.ACE!2寴@ʈ@X@ A@!2!,!9^#V!͍@!9A҅@+O@È@!9^VNF!AAͬ@A!9pqrs@!96:r~~@w~w~=w~o~g}Ao~g}A~o~g}Ao~g}A~o~g}Ao~g}A~o~g}Ao~g}A~w@|`}@",@Ņ??O4|089!$yH(G Y~8 8>G>D E(8G>ƀwA+{_z!8ɳ7z88dk-1.8.ds1/examples/ace/smallgfx.c0000644000175000017500000000037007240553422017036 0ustar tygrystygrys #include main() { int i; /* Draw a series of concentric circles */ for (i=50 ; i>0; i=i-7) { circle(50,44,i,1); if (i < 15 ) i=i-1; } while (1!=2) {} } z88dk-1.8.ds1/examples/console/0000755000175000017500000000000010765202715015771 5ustar tygrystygrysz88dk-1.8.ds1/examples/console/adv_a.c0000644000175000017500000016522007425004723017213 0ustar tygrystygrys/* * Adventure A - Some really old 'n' crusty speccy game * [Originally for ZX80/81/82 by Artic Computing] * * Compiled under z88dk by djm especially for gwl * * djm 19/3/2000 * * Very few changes were needed to get this to work under * z88dk (many changes were made to sccz80 though(!)) * * Changes to standard source: * - \ continuation in the strings * - casts removed in structures * - Few defines to make life easier * * Only tested on a ZX...it should work on Z88 (BASIC) though * * Found at: http://www.penelope.demon.co.uk/pod/ * * From the asm source on the same site: * * Disassembled, annotated and converted for use with CP/M by * Paul Taylor 18-Aug-1998 With Special thanks to Tim Olmstead */ #include #include #include #include #ifdef SPECTRUM #define KEY_DEL 12 #endif #ifdef Z88 #define KEY_DEL 127 #endif #ifndef KEY_DEL #define KEY_DEL '\b' #endif void GetLine(); char i_GetCh(); typedef int BOOL; typedef unsigned char BYTE; enum blah { FALSE, TRUE }; /***** ; Disassembly of the file "F:\GAMES\SPECCY\A\ARTICADV\Advent_a.sna" ; ; Created with dZ80 v1.30a ; ; on Wednesday, 05 of August 1998 at 11:33 PM ; .org $5d6c ROM_SAV .equ $04c2 ROM_LD .equ $0556 ROM_CLS .equ $0daf SCRCT .equ $5c8c ; remaining scroll count (system variable) */ /* item location codes */ #define NOTX 0xfc #define ITEM_WORN 0xfd #define ITEM_HELD 0xfe /* ; offsets of ZX Spectrum system variables #define SVAR_KEYBUF -$32 */ int F_NTYET; int PARAM1; int CMDFLG; /* PREDIX .equ $-$29 ; PREDIX points here */ int VERB_TK; int NOUN_TK; BOOL FLAG; int CUR_RM; /* */ int GVARS[0x1e]; /* workspace of $1e bytes of game variables*/ /* offsets of game variables */ #define GVAR_NO_ITEMS 0x01 #define GVAR_02 0x02 #define GVAR_03 0x03 #define GVAR_04 0x04 #define GVAR_05 0x05 #define GVAR_06 0x06 #define GVAR_07 0x07 #define GVAR_08 0x08 #define GVAR_09 0x09 #define GVAR_0a 0x0a #define GVAR_0b 0x0b #define GVAR_0c 0x0c #define GVAR_0d 0x0d #define GVAR_0e 0x0e #define GVAR_0f 0x0f #define GVAR_10 0x10 #define GVAR_11 0x11 #define GVAR_12 0x12 #define GVAR_13 0x13 #define GVAR_14 0x14 #define GVAR_15 0x15 #define GVAR_16 0x16 #define GVAR_17 0x17 #define GVAR_18 0x18 #define GVAR_19 0x19 #define GVAR_1a 0x1a #define GVAR_1b 0x1b #define GVAR_1c 0x1c #define GVAR_1d 0x1d #define GVAR_1e 0x1e char strTokenBuf[4]; /* workspace of $04 bytes to hold a token*/ int nScore; #ifdef SPECTRUM #define MAX_COL 64 #endif #ifdef Z88 #define MAX_COL 80 #endif #ifndef MAX_COL #define MAX_COL 32 #endif char chaEditLine[MAX_COL + 1]; char* pchEditLine; int nRemColumns = MAX_COL; typedef struct { int nVerbTok; int nNounTok; void* pPredicates; void* pActions; } VNDef; enum blah2 { NA_DO_AUTO, NA_CONTINUE, NA_MAIN, NA_BEGIN, NA_RESTART }; int nNextParseAction; VNDef* pvndCurrent; BYTE* pPredicateCurrent; BYTE* pActionCurrent; /* ====================================================================== // game instructions // ====================================================================== */ char *strInstructions = "WELCOME TO ADVENTURE 'A'\n"\ "THE PLANET OF DEATH\n\n"\ "IN THIS ADVENTURE YOU FIND "\ "YOURSELF STRANDED ON AN "\ "ALIEN PLANET. YOUR AIM IS "\ "TO ESCAPE FROM THIS PLANET "\ "BY FINDING YOUR, NOW "\ "CAPTURED AND DISABLED, "\ "SPACE SHIP\n"\ "YOU WILL MEET VARIOUS "\ "HAZARDS AND DANGERS ON YOUR "\ "ADVENTURE, SOME NATURAL, "\ "SOME NOT, ALL OF WHICH YOU "\ "MUST OVERCOME TO SUCCEED\n\n"\ "GOOD LUCK, YOU WILL NEED IT!\n\n"\ "PRESS ANY KEY TO START\n"; /* // ====================================================================== // response messages // ====================================================================== */ char* straMsg[] = { "IT SHOWS A MAN CLIMBING DOWN A PIT USING A ROPE\n", "HOW? I CANT REACH\n", "IT HAS FALLEN TO THE FLOOR\n", "HOW?\n", "ITS TOO WIDE.I FELL AND BROKE MY NECK\n", "UGH! HE IS ALL SLIMY\n", "HE VANISHED IN A PUFF OF SMOKE\n", "YOU ALSO BROKE THE MIRROR\n", "COMPUTER SAYS: 2 WEST,2 SOUTH FOR SPACE FLIGHT\n", "IT HAS WEAKENED IT\n", "IT HAD NO EFFECT\n", "I FELL AND KNOCKED MYSELF OUT.\n", "THE BARS LOOK LOOSE\n", "WHAT WITH?\n", "I SEE A GOLD COIN\n", "BRRR.THE WATERS TOO COLD\n", "THE FUSE HAS JUST BLOWN\n", "THE LIFT HAS BEEN ACTIVATED\n", "I SEE NOTHING SPECIAL\n", "KEEP OFF THE MIDDLE MEN,ONE MAY BE SHOCKING!\n", "VANITY WALTZ!\n", "TRY HELP\n", "POINTS OF COMPASS\n", "TRY LOOKING AROUND\n", "I CAN SEE A STEEP SLOPE\n", "AN ALARM SOUNDS.THE SECURITY GUARD SHOT ME FOR TRESPASSING.\n", "I CAN SEE A ROPE HANGING DOWN THE CHIMNEY.\n", "I AM NOT THAT DAFT.IT IS TOO DEEP.\n", "THE SPACE SHIP BLEW UP AND KILLED ME.\n", "THE SHIP HAS FLOWN INTO THE LARGE LIFT AND IS HOVERING THERE.\nTHERE ARE FOUR BUTTONS OUTSIDE THE WINDOW MARKED 1,2,3 AND 4\n", "THE LIFT HAS TAKEN ME UP TO A PLATEAU.\nCONGRATULATIONS, YOU HAVE MANAGED TO COMPLETE THIS ADVENTURE\nWITHOUT GETTING KILLED.\n", "THE LIFT HAS BECOME ELECTRIFIED\n", "I HAVE BEEN ELECTROCUTED\n", "IT IS A GOOD JOB I WAS WEARING RUBBER SOLED BOOTS.\n", "I WOULD KILL MYSELF IF I DID.\n", "I HAVE TURNED GREEN AND DROPPED DEAD.\n", "THE GREEN MAN AWOKE AND THROTTLED ME.\n", "THE GUARD WOKE AND SHOT ME.\n", "WHAT AT?\n"}; /* // ====================================================================== // room descriptions // ====================================================================== */ char* straRoom[] = { "I AM ON A MOUNTAIN PLATEAU\n"\ "TO THE NORTH THERE IS A STEEP CLIFF\n"\ "OBVIOUS EXITS ARE DOWN,EAST AND WEST\n", "I AM AT THE EDGE OF A DEEP PIT\n"\ "OBVIOUS EXITS ARE EAST\n", "I AM IN A DAMP LIMESTONE CAVE WITH STALACTITES HANGING DOWN.\n"\ "THE EXIT IS TO THE WEST\n"\ "THERE IS A PASSAGE TO THE NORTH\n", "I AM IN A DENSE FOREST\n"\ "THERE IS A ROPE HANGING FROM ONE TREE\n"\ "OBVIOUS EXITS ARE SOUTH AND WEST\n", "I AM BESIDE A LAKE\n"\ "EXITS ARE EAST AND NORTH.THERE IS A RAVINE TO THE WEST\n", "I AM IN A STRANGE HOUSE\n"\ "THE DOOR IS TO THE NORTH\n", "I AM IN AN OLD SHED\n"\ "THE EXIT IS TO THE EAST\n", "I AM IN A MAZE.THERE ARE PASSAGES EVERYWHERE\n", "I AM IN A MAZE.THERE ARE PASSAGES EVERYWHERE\n", "I AM IN A MAZE.THERE ARE PASSAGES EVERYWHERE\n", "I AM IN A MAZE.THERE ARE PASSAGES EVERYWHERE\n", "I AM IN AN ICE CAVERN\n"\ "THERE IS AN EXIT TO THE EAST\n", "I AM IN A QUIET CAVERN\n"\ "THERE ARE EXITS WEST,EAST AND SOUTH\n", "I AM IN A WIND TUNNEL\n"\ "THERE IS A CLOSED DOOR AT THE END\n"\ "THERE IS ALSO AN EXIT TO THE WEST\n", "I AM IN A ROOM WITH A COMPUTER IN\n"\ "THE COMPUTER IS WORKING AND HAS A KEYBOARD\n"\ "THE EXIT IS WEST\n", "I AM IN A PASSAGE\n"\ "THERE IS A FORCE FIELD TO THE SOUTH : BEWARE OF SECURITY\n"\ "THERE ARE EXITS TO NORTH,EAST AND WEST\n", "I AM IN A LARGE HANGER\n"\ "THERE IS A LOCKED DOOR TO THE WEST\n"\ "THERE ARE ALSO EXITS EAST,NORTH AND SOUTH\n", "I AM IN A TALL LIFT.THE BUTTONS ARE VERY HIGH\n"\ "THE EXIT IS WEST\n", "I AM IN THE LIFT CONTROL ROOM\n"\ "THERE ARE THREE SWITCHES ON THE WALL.THEY ARE ALL OFF\n"\ "A SIGN SAYS : 5,4 NO DUSTY BIN RULES\n"\ "THE EXIT IS EAST\n", "I AM IN A PRISON CELL\n", "I AM IN A SPACE SHIP.THERE IS NO VISIBLE EXIT\n"\ "THERE IS A SMALL OPEN WINDOW IN THE SIDE\n"\ "THERE ARE ALSO TWO BUTTONS,ONE MARKED MAIN AND THE OTHER AUX.\n"}; /* // ====================================================================== // item descriptions // ====================================================================== */ #define MAX_ITEM 28 char* straItem[MAX_ITEM] = { "A PAIR OF BOOTS", "A STARTER MOTOR", "A KEY", "A LASER GUN", "AN OUT OF ORDER SIGN", "A METAL BAR", "A GOLD COIN", "A MIRROR", "BROKEN GLASS", "A PAIR OF SLIMY GLOVES", "A ROPE", "A FLOOR BOARD", "A BROKEN FLOOR BOARD", "STALACTITES", "A BLOCK OF ICE", "A POOL OF WATER", "A SMALL GREEN MAN SLEEPING ON THE MIRROR", "A SLEEPING GREEN MAN", "A LOCKED DOOR", "AN OPEN DOOR", "A BARRED WINDOW", "A HOLE IN THE WALL", "A SMALL BUT POWERFULL SPACE SHIP", "A SLEEPING SECURITY MAN", "A PIECE OF SHARP FLINT", "SOME STONES", "A DRAWING ON THE WALL", "A LOUDSPEAKER WITH DANCE MUSIC COMING OUT"}; /* // ====================================================================== // initial positions of items - 1 int per item, holds room number // NOTX indicates item doesn't exist yet // ====================================================================== */ int naItemStart[MAX_ITEM] = { 0x05, 0x11, 0x0e, 0x06, 0x11, NOTX, NOTX, 0x0c, NOTX, 0x0d, NOTX, 0x05, NOTX, NOTX, 0x0b, NOTX, 0x0c, NOTX, 0x13, NOTX, 0x13, NOTX, 0x10, 0x10, 0x00, 0x01, 0x02, 0x0f }; /* // ====================================================================== // current positions of items - 1 int per item, holds room number // initialized from naItemStart at start, updated during the game // NOTX indicates item doesn't exist yet // ====================================================================== */ int naItemLoc[MAX_ITEM]; /* // the commands and their synonyms // each token is 4 characters, followed by a 1 byte token code // first define the token codes */ #define TOK_DOWN 0x01 #define TOK_NORT 0x02 #define TOK_SOUT 0x03 #define TOK_EAST 0x04 #define TOK_WEST 0x05 #define TOK_GET 0x0d #define TOK_DROP 0x0e #define TOK_FIRE 0x0f #define TOK_BOOT 0x10 #define TOK_STAR 0x11 #define TOK_KEY 0x12 #define TOK_GUN 0x13 #define TOK_USED 0x14 #define TOK_BAR 0x15 #define TOK_COIN 0x16 #define TOK_MIRR 0x17 #define TOK_BROK 0x18 #define TOK_GLOV 0x19 #define TOK_ROPE 0x1a #define TOK_BOAR 0x1b #define TOK_STAL 0x1c #define TOK_ICE 0x1d #define TOK_WATE 0x1e #define TOK_MAN 0x1f #define TOK_DOOR 0x20 #define TOK_OPEN 0x21 #define TOK_WIND 0x22 #define TOK_SHIP 0x23 #define TOK_SECU 0x24 #define TOK_FLIN 0x25 #define TOK_STON 0x26 #define TOK_DRAW 0x27 #define TOK_HELP 0x28 #define TOK_INVE 0x29 #define TOK_QUIT 0x2a #define TOK_YES 0x2b #define TOK_NO 0x2c #define TOK_COMP 0x2d #define TOK_TYPE 0x2e #define TOK_TURN 0x2f #define TOK_HAND 0x30 #define TOK_KILL 0x31 #define TOK_DANC 0x32 #define TOK_REMO 0x33 #define TOK_BREA 0x34 #define TOK_BRIB 0x35 #define TOK_USE 0x36 #define TOK_PUSH 0x37 #define TOK_THRE 0x38 #define TOK_TWO 0x39 #define TOK_ONE 0x3a #define TOK_MEND 0x3b #define TOK_FOUR 0x3c #define TOK_LOOK 0x3d #define TOK_STAN 0x3e #define TOK_TREE 0x3f #define TOK_CUT 0x40 #define TOK_WEAR 0x41 #define TOK_CROS 0x42 #define TOK_JUMP 0x43 #define TOK_RAVI 0x44 #define TOK_UP 0x45 #define TOK_FUSE 0x46 #define TOK_REDE 0x47 #define TOK_MAIN 0x48 #define TOK_AUX 0x49 #define TOK_FIEL 0x4a /* now map the codes to their character representations */ typedef struct { char strWord[5]; int nCode; } TOKEN; #define MAX_TOK 110 TOKEN taToken[MAX_TOK] = { { "DOWN", TOK_DOWN }, { "D ", TOK_DOWN }, { "NORT", TOK_NORT }, { "N ", TOK_NORT }, { "SOUT", TOK_SOUT }, { "S ", TOK_SOUT }, { "EAST", TOK_EAST }, { "E ", TOK_EAST }, { "WEST", TOK_WEST }, { "W ", TOK_WEST }, { "GET ", TOK_GET }, { "PICK", TOK_GET }, { "DROP", TOK_DROP }, { "PUT ", TOK_DROP }, { "FIRE", TOK_FIRE }, { "SHOO", TOK_FIRE }, { "BOOT", TOK_BOOT }, { "STAR", TOK_STAR }, { "MOTO", TOK_STAR }, { "KEY ", TOK_KEY }, { "LASE", TOK_GUN }, { "GUN ", TOK_GUN }, { "USED", TOK_USED }, { "BAR ", TOK_BAR }, { "BARS", TOK_BAR }, { "GOLD", TOK_COIN }, { "COIN", TOK_COIN }, { "MIRR", TOK_MIRR }, { "BROK", TOK_BROK }, { "GLOV", TOK_GLOV }, { "ROPE", TOK_ROPE }, { "FLOO", TOK_BOAR }, { "BOAR", TOK_BOAR }, { "PLAN", TOK_BOAR }, { "STAL", TOK_STAL }, { "BLOC", TOK_ICE }, { "ICE ", TOK_ICE }, { "POOL", TOK_WATE }, { "WATE", TOK_WATE }, { "LAKE", TOK_WATE }, { "SLEE", TOK_MAN }, { "GREE", TOK_MAN }, { "MAN ", TOK_MAN }, { "DOOR", TOK_DOOR }, { "OPEN", TOK_OPEN }, { "UNLO", TOK_OPEN }, { "WIND", TOK_WIND }, { "SMAL", TOK_SHIP }, { "SPAC", TOK_SHIP }, { "SHIP", TOK_SHIP }, { "SECU", TOK_SECU }, { "FLIN", TOK_FLIN }, { "STON", TOK_STON }, { "DRAW", TOK_DRAW }, { "HELP", TOK_HELP }, { "INVE", TOK_INVE }, { "I ", TOK_INVE }, { "QUIT", TOK_QUIT }, { "STOP", TOK_QUIT }, { "ABOR", TOK_QUIT }, { "YES ", TOK_YES }, { "Y ", TOK_YES }, { "NO ", TOK_NO }, { "COMP", TOK_COMP }, { "KEYB", TOK_COMP }, { "TYPE", TOK_TYPE }, { "TURN", TOK_TURN }, { "HAND", TOK_HAND }, { "KILL", TOK_KILL }, { "DANC", TOK_DANC }, { "WALT", TOK_DANC }, { "REMO", TOK_REMO }, { "KICK", TOK_BREA }, { "BREA", TOK_BREA }, { "HIT ", TOK_BREA }, { "BANG", TOK_BREA }, { "BRIB", TOK_BRIB }, { "USE ", TOK_USE }, { "WITH", TOK_USE }, { "PUSH", TOK_PUSH }, { "THRE", TOK_THRE }, { "3 ", TOK_THRE }, { "TWO ", TOK_TWO }, { "2 ", TOK_TWO }, { "ONE ", TOK_ONE }, { "1 ", TOK_ONE }, { "MEND", TOK_MEND }, { "FIX ", TOK_MEND }, { "REPA", TOK_MEND }, { "FOUR", TOK_FOUR }, { "4 ", TOK_FOUR }, { "LOOK", TOK_LOOK }, { "STAN", TOK_STAN }, { "TREE", TOK_TREE }, { "CUT ", TOK_CUT }, { "SAW ", TOK_CUT }, { "WEAR", TOK_WEAR }, { "CROS", TOK_CROS }, { "JUMP", TOK_JUMP }, { "RAVI", TOK_RAVI }, { "UP ", TOK_UP }, { "U ", TOK_UP }, { "CLIM", TOK_UP }, { "FUSE", TOK_FUSE }, { "REDE", TOK_REDE }, { "R ", TOK_REDE }, { "MAIN", TOK_MAIN }, { "AUX ", TOK_AUX }, { "FIEL", TOK_FIEL }, { "SHIE", TOK_FIEL } }; /* // the directional information, one list for each room // each list entry is of the form , // each list is terminated with $ff */ BYTE DIR_00[] = { TOK_DOWN,0x03, TOK_EAST,0x02, TOK_WEST,0x01, 0xff }; BYTE DIR_01[] = { TOK_EAST,0x00, 0xff }; BYTE DIR_02[] = { TOK_NORT,0x07, TOK_WEST,0x00, 0xff }; BYTE DIR_03[] = { TOK_SOUT,0x04, TOK_WEST,0x00, 0xff }; BYTE DIR_04[] = { TOK_NORT,0x03, TOK_EAST,0x05, 0xff }; BYTE DIR_05[] = { TOK_NORT,0x04, 0xff }; BYTE DIR_06[] = { 0xff }; BYTE DIR_07[] = { TOK_DOWN,0x07, TOK_NORT,0x08, TOK_SOUT,0x07, TOK_EAST,0x07, TOK_WEST,0x07, 0xff }; BYTE DIR_08[] = { TOK_DOWN,0x07, TOK_NORT,0x07, TOK_SOUT,0x09, TOK_EAST,0x07, TOK_WEST,0x07, 0xff }; BYTE DIR_09[] = { TOK_DOWN,0x07, TOK_NORT,0x07, TOK_SOUT,0x07, TOK_EAST,0x0a, TOK_WEST,0x07, 0xff }; BYTE DIR_0A[] = { TOK_DOWN,0x07, TOK_NORT,0x02, TOK_SOUT,0x07, TOK_EAST,0x07, TOK_WEST,0x0b, 0xff }; BYTE DIR_0B[] = { TOK_EAST,0x07, 0xff }; BYTE DIR_0C[] = { TOK_SOUT,0x0f, TOK_EAST,0x0d, TOK_WEST,0x13, 0xff }; BYTE DIR_0D[] = { 0xff }; BYTE DIR_0E[] = { TOK_WEST,0x0d, 0xff }; BYTE DIR_0F[] = { TOK_EAST,0x13, TOK_WEST,0x13, 0xff }; BYTE DIR_10[] = { TOK_NORT,0x0f, TOK_SOUT,0x13, TOK_EAST,0x11, 0xff }; BYTE DIR_11[] = { TOK_WEST,0x10, 0xff }; BYTE DIR_12[] = { TOK_EAST,0x10, 0xff }; BYTE DIR_13[] = { 0xff }; /* this vector array contains an address for every room */ BYTE* DIR_V[] = { DIR_00, DIR_01, DIR_02, DIR_03, DIR_04, DIR_05, DIR_06, DIR_07, DIR_08, DIR_09, DIR_0A, DIR_0B, DIR_0C, DIR_0D, DIR_0E, DIR_0F, DIR_10, DIR_11, DIR_12, DIR_13, DIR_13 /* room 0x14 shares room 0x13's data - it's just an 0xff anyway */ }; /* index codes of predicates */ #define COM_CHKROOM 0x00 #define COM_CHKHERE 0x01 #define COM_CHKRAND 0x02 #define COM_CHKAWAY 0x03 #define COM_CHKWORN 0x04 #define COM_CHKSETF 0x05 #define COM_TSTGVAR 0x06 #define COM_CHKCLRF 0x07 #define COM_CHKHELD 0x08 /* a table of predicates */ BOOL CHKROOM(); BOOL CHKHERE(); BOOL CHKRAND(); BOOL CHKAWAY(); BOOL CHKWORN(); BOOL CHKSETF(); BOOL TSTGVAR(); BOOL CHKCLRF(); BOOL CHKHELD(); int *PRED_V[] = { CHKROOM, /* $00 */ CHKHERE, /* $01 */ CHKRAND, /* $02 */ CHKAWAY, /* $03 */ CHKWORN, /* $04 */ CHKSETF, /* $05 */ TSTGVAR, /* $06 */ CHKCLRF, /* $07 */ CHKHELD /* $08 */ }; /* // list of predicate entries // first byte is the index of the predicate, see PRED_V // second byte is stored in PARAM1 // subsequent bytes of entry are terminated with a 0xff */ BYTE A_GD_BOOT[] = { COM_CHKHERE,0x00, 0xff }; BYTE A_GD_STAR[] = { COM_CHKHERE,0x01, 0xff }; BYTE A_GD_KEY[] = { COM_CHKHERE,0x02, 0xff }; BYTE A_GD_GUN[] = { COM_CHKHERE,0x03, 0xff }; BYTE A_GD_BAR[] = { COM_CHKHERE,0x05, 0xff }; BYTE A_GD_COIN[] = { COM_CHKHERE,0x06, 0xff }; BYTE A_G_MIRR_1[] = { COM_CHKHERE,0x07, COM_CHKAWAY,0x10, 0xff }; BYTE A_GD_MIRR_2[] = { COM_CHKHERE,0x08, 0xff }; BYTE A_GD_GLOV[] = { COM_CHKHERE,0x09, 0xff }; BYTE A_GD_ROPE[] = { COM_CHKHERE,0x0a, 0xff }; BYTE A_GD_BOAR_1[] = { COM_CHKHERE,0x0b, 0xff }; BYTE A_GD_BOAR_2[] = { COM_CHKHERE,0x0c, 0xff }; BYTE A_GD_STAL[] = { COM_CHKHERE,0x0d, 0xff }; BYTE A_GD_ICE[] = { COM_CHKHERE,0x0e, 0xff }; BYTE A_GD_FLIN[] = { COM_CHKHERE,0x18, 0xff }; BYTE A_GD_STON[] = { COM_CHKHERE,0x19, 0xff }; BYTE A_D_MIRR[] = { COM_CHKHERE,0x07, 0xff }; BYTE A_DRAW_STAL[] = { COM_CHKROOM,0x02, 0xff }; BYTE A_U_ICE_1[] = { COM_CHKROOM,0x02, COM_CHKHERE,0x0e, 0xff }; BYTE A_CUT_ROPE[] = { COM_CHKROOM,0x03, 0xff }; BYTE A_USE_FLIN[] = { COM_CHKROOM,0x03, COM_CHKHERE,0x18, 0xff }; BYTE A_C_RAVI_1[] = { COM_CHKROOM,0x04, 0xff }; BYTE A_C_RAVI_2[] = { COM_CHKROOM,0x06, 0xff }; BYTE A_C_RAVI_3[] = { COM_CHKROOM,0x04, COM_CHKHERE,0x0b, 0xff }; BYTE A_USE_BOAR[] = { COM_CHKROOM,0x06, COM_CHKHERE,0x0b, 0xff }; BYTE A_DOWN[] = { COM_CHKROOM,0x0b, 0xff }; BYTE A_U_ICE_2[] = { COM_CHKROOM,0x0b, COM_CHKHELD,0x0e, 0xff }; BYTE A_G_MAN_1[] = { COM_CHKHERE,0x10, COM_CHKHERE,0x09, COM_CHKWORN,0x09, 0xff }; BYTE A_G_MAN_2[] = { COM_CHKHERE,0x10, COM_CHKHERE,0x09, 0xff }; BYTE A_G_MAN_3[] = { COM_CHKHERE,0x10, 0xff }; BYTE A_KD_MAN_1[] = { COM_CHKHERE,0x11, 0xff }; BYTE A_G_MIRR_3[] = { COM_CHKHERE,0x07, COM_CHKAWAY,0x10, 0xff }; BYTE A_K_MAN_2[] = { COM_CHKHERE,0x10, 0xff }; BYTE A_U_GUN_1[] = { COM_CHKHERE,0x10, COM_CHKHERE,0x03, 0xff }; BYTE A_U_GUN_2[] = { COM_CHKHERE,0x11, COM_CHKHERE,0x03, COM_CHKHELD,0x11, 0xff }; BYTE A_U_GUN_3[] = { COM_CHKHERE,0x11, COM_CHKHERE,0x03, 0xff }; BYTE A_TYPE_HELP[] = { COM_CHKROOM,0x0e, 0xff }; BYTE A_FIRE_GUN[] = { COM_CHKROOM,0x0f, 0xff }; BYTE A_FIEL_1[] = { COM_CHKROOM,0x0f, COM_CHKCLRF,GVAR_07, COM_CHKHERE,0x03, 0xff }; BYTE A_FIEL_2[] = { COM_CHKSETF,GVAR_07, COM_CHKCLRF,GVAR_08, COM_CHKROOM,0x0f, COM_CHKHERE,0x03, 0xff }; BYTE A_FIEL_3[] = { COM_CHKSETF,GVAR_08, COM_CHKROOM,0x0f, COM_CHKHERE,0x03, 0xff }; BYTE A_DANC_1[] = { COM_CHKROOM,0x0f, COM_CHKHELD,0x07, COM_CHKSETF,GVAR_08, 0xff }; BYTE A_DANC_2[] = { COM_CHKROOM,0x0f, 0xff }; BYTE A_O_DOOR_1[] = { COM_CHKROOM,0x10, 0xff }; BYTE A_USE_KEY[] = { COM_CHKROOM,0x10, COM_CHKHERE,0x02, 0xff }; BYTE A_K_SECU[] = { COM_CHKROOM,0x10, COM_CHKHERE,0x03, 0xff }; BYTE A_LUP_BREA[] = { COM_CHKROOM,0x13, 0xff }; BYTE A_UP[] = { COM_CHKROOM,0x13, COM_CHKHERE,0x15, 0xff }; BYTE A_BRSEC[] = { COM_CHKROOM,0x13, 0xff }; BYTE A_U_COIN[] = { COM_CHKROOM,0x13, COM_CHKHERE,0x06, 0xff }; BYTE A_B_DOOR[] = { COM_CHKROOM,0x13, COM_CHKHERE,0x13, 0xff }; BYTE A_G_COIN[] = { COM_CHKROOM,0x04, COM_CHKAWAY,0x06, 0xff }; #define A_L_WATE A_G_COIN BYTE A_WATE_1[] = { COM_CHKROOM,0x04, COM_CHKAWAY,0x06, COM_CHKWORN,0x00, COM_CHKHERE,0x00, 0xff }; BYTE A_WATE_2[] = { COM_CHKROOM,0x04, COM_CHKAWAY,0x06, COM_CHKHERE,0x00, 0xff }; BYTE A_O_DOOR_2[] = { COM_CHKROOM,0x0d, 0xff }; BYTE A_PUSH_THRE[] = { COM_CHKROOM,0x12, COM_CHKCLRF,GVAR_09, COM_CHKCLRF,GVAR_0a, 0xff }; BYTE A_PUSH_DIG[] = { COM_CHKROOM,0x12, COM_CHKCLRF,GVAR_0a, 0xff }; BYTE A_PUSH_TWO[] = { COM_CHKROOM,0x12, COM_TSTGVAR,GVAR_09,0x01, COM_CHKCLRF,GVAR_0a, 0xff }; BYTE A_PUSH_ONE[] = { COM_CHKROOM,0x12, COM_TSTGVAR,GVAR_09,0x02, COM_CHKCLRF,GVAR_0a, 0xff }; BYTE A_MEND_FUSE[] = { COM_CHKROOM,0x12, COM_CHKSETF,GVAR_0a, 0xff }; BYTE A_USE_BAR[] = { COM_CHKROOM,0x12, COM_CHKHERE,0x05, COM_CHKSETF,GVAR_0a, 0xff }; BYTE A_LOOK[] = { COM_CHKROOM,0x0b, 0xff }; BYTE A_HELP_1[] = { COM_CHKROOM,0x11, 0xff }; BYTE A_HELP_2[] = { COM_CHKROOM,0x0f, 0xff }; BYTE A_HELP_3[] = { COM_CHKROOM,0x0e, 0xff }; BYTE A_HELP_4[] = { COM_CHKROOM,0x07, 0xff }; BYTE A_HELP_5[] = { COM_CHKROOM,0x08, 0xff }; BYTE A_HELP_6[] = { COM_CHKROOM,0x09, 0xff }; BYTE A_HELP_7[] = { COM_CHKROOM,0x0a, 0xff }; BYTE A_HELP_8[] = { COM_CHKROOM,0x14, COM_CHKSETF,GVAR_0c, 0xff }; BYTE A_LUP[] = { COM_CHKSETF,GVAR_0b, COM_CHKROOM,0x0c, 0xff }; BYTE A_WEST[] = { COM_CHKROOM,0x0d, 0xff }; BYTE A_JUMP[] = { COM_CHKROOM,0x01, 0xff }; BYTE A_USEROP[] = { COM_CHKROOM,0x01, COM_CHKHELD,0x0a, 0xff }; BYTE A_UPROPE[] = { COM_CHKROOM,0x0c, COM_CHKSETF,GVAR_0b, 0xff }; BYTE A_SHIP[] = { COM_CHKHERE,0x16, 0xff }; BYTE A_P_MAUX[] = { COM_CHKROOM,0x14, COM_CHKHERE,0x01, 0xff }; BYTE A_P_32[] = { COM_CHKROOM,0x14, COM_CHKSETF,GVAR_0c, 0xff }; BYTE A_P_41[] = { COM_CHKROOM,0x14, COM_CHKSETF,GVAR_0c, COM_TSTGVAR,GVAR_09,0x03, 0xff }; BYTE A_PSH_ONE_2[] = { COM_CHKROOM,0x14, COM_CHKSETF,GVAR_0c, COM_CHKWORN,0x00, COM_TSTGVAR,GVAR_09,0x03, 0xff }; /* // list of predicate entries for Auto Commands // first byte is the index of the predicate, see PRED_V // second byte is stored in PARAM1 // subsequent bytes of entry are terminated with a $ff // check if we have turned green and died */ BYTE A_CHGRN[] = { COM_TSTGVAR,GVAR_05,0x01, // if game variable 0x05 = 1 COM_CHKSETF,GVAR_06, // and game variable 0x06 is set 0xff }; /* check if the small green man is to throttle us (version 1) */ BYTE A_CHTHR[] = { COM_TSTGVAR,GVAR_02,0x01, // if game variable 0x02 = 1 COM_CHKHERE,0x10, // and is-present the small green man sleeping on the mirror 0xff }; /* check if the small green man is to throttle us (version 2) */ BYTE A_C2THR[] = { COM_TSTGVAR,GVAR_02,0x01, // if game variable 0x02 = 1 COM_CHKHERE,0x11, // and is-present the sleeping green man (moved off mirror) 0xff }; /* check if we're to be shot by the security guard */ BYTE A_SHOT[] = { COM_TSTGVAR,GVAR_02,0x01, /* if game variable 0x02 = 1 */ COM_CHKHERE,0x17, /* and is-present the sleeping security man */ 0xff }; /* check if ice has melted */ BYTE A_MELTD[] = { COM_TSTGVAR,GVAR_02,0x01, /* if game variable 0x02 = 1 */ COM_CHKHERE,0x0e, /* and is-present the block of ice */ 0xff }; /* an empty action entry */ BYTE A_NULL[] = { 0Xff }; BYTE A_MISC[] = { 0xff }; /* used for auto commands - no predicates required */ #define I_SH_INVE 0x00 /* terminates bytecode processing */ #define I_SH_REMO 0x01 #define I_SH_GET 0x02 #define I_SH_DROP 0x03 #define I_SH_WEAR 0x04 #define I_SH_MSG 0x05 #define I_SH_REDE 0x06 /* terminates bytecode processing */ #define I_SH_AUTO 0x07 /* terminates bytecode processing */ #define I_SH_GOTO 0x08 #define I_SH_SETF 0x09 #define I_SH_CLRF 0x0a #define I_SH_SWAP 0x0b #define I_SH_DEAD 0x0c /* terminates bytecode processing */ #define I_SH_OK 0x0d /* terminates bytecode processing */ #define I_SH_QUIT 0x0e /* terminates bytecode processing */ #define I_SH_SETV 0x0f #define I_SH_CREA 0x10 #define I_SH_DEST 0x11 #define I_SH_ADSC 0x12 #define I_SH_SCOR 0x13 #define I_SH_FAIL1 0x14 #define I_SH_TELL 0x15 #define I_SH_FAIL2 0x16 #define I_SH_FAIL3 0x17 #define I_SH_FAIL4 0x18 /* bytecodes for the various commands a user can enter */ BYTE SGET_00[] = { I_SH_GET,0x00,I_SH_OK }; BYTE SGET_01[] = { I_SH_GET,0x01,I_SH_OK }; BYTE SGET_02[] = { I_SH_GET,0x02,I_SH_OK }; BYTE SGET_03[] = { I_SH_GET,0x03,I_SH_OK }; BYTE SGET_05[] = { I_SH_GET,0x05,I_SH_OK }; BYTE SGET_06[] = { I_SH_GET,0x06,I_SH_OK }; BYTE SGET_07[] = { I_SH_GET,0x07,I_SH_OK }; BYTE SGET_08[] = { I_SH_GET,0x08,I_SH_OK }; BYTE SGET_09[] = { I_SH_GET,0x09,I_SH_OK }; BYTE SGET_0A[] = { I_SH_GET,0x0a,I_SH_OK }; BYTE SGET_0B[] = { I_SH_GET,0x0b,I_SH_OK }; BYTE SGET_0C[] = { I_SH_GET,0x0c,I_SH_OK }; BYTE SGET_0D[] = { I_SH_GET,0x0d,I_SH_OK }; BYTE SGET_0E[] = { I_SH_GET,0x0e,I_SH_SETV,GVAR_02,0x09,I_SH_OK }; BYTE SGET_18[] = { I_SH_GET,0x18,I_SH_OK }; BYTE SGET_19[] = { I_SH_GET,0x19,I_SH_OK }; BYTE SINVENT[] = { I_SH_INVE,0x07 }; /* the 0x07 is ignored */ BYTE SQUIT[] = { I_SH_QUIT }; BYTE SPUT_00[] = { I_SH_DROP,0x00,I_SH_OK }; BYTE SPUT_01[] = { I_SH_DROP,0x01,I_SH_OK }; BYTE SPUT_02[] = { I_SH_DROP,0x02,I_SH_OK }; BYTE SPUT_03[] = { I_SH_DROP,0x03,I_SH_OK }; BYTE SPUT_05[] = { I_SH_DROP,0x05,I_SH_OK }; BYTE SPUT_06[] = { I_SH_DROP,0x06,I_SH_OK }; BYTE SPUT_07[] = { I_SH_DROP,0x07,I_SH_OK }; BYTE SPUT_08[] = { I_SH_DROP,0x08,I_SH_OK }; BYTE SPUT_09[] = { I_SH_DROP,0x09,I_SH_OK }; BYTE SPUT_0A[] = { I_SH_DROP,0x0a,I_SH_OK }; BYTE SPUT_0B[] = { I_SH_DROP,0x0b,I_SH_OK }; BYTE SPUT_0C[] = { I_SH_DROP,0x0c,I_SH_OK }; BYTE SPUT_0D[] = { I_SH_DROP,0x0d,I_SH_OK }; BYTE SPUT_0E[] = { I_SH_DROP,0x0e,I_SH_OK }; BYTE SPUT_18[] = { I_SH_DROP,0x18,I_SH_OK }; BYTE SPUT_19[] = { I_SH_DROP,0x19,I_SH_OK }; BYTE SLK_DRW[] = { I_SH_MSG,0x00,I_SH_AUTO }; BYTE SBRK_ST[] = { I_SH_MSG,0x01,I_SH_AUTO }; BYTE SUSE_IC[] = { I_SH_CREA,0x0d,I_SH_MSG,0x02,I_SH_AUTO }; BYTE SCUT_RP[] = { I_SH_MSG,0x03,I_SH_AUTO }; BYTE SUSE_FL[] = { I_SH_CREA,0x0a,I_SH_MSG,0x02,I_SH_AUTO }; BYTE SWR_00[] = { I_SH_WEAR,0x00,I_SH_OK }; BYTE SRM_00[] = { I_SH_REMO,0x00,I_SH_OK }; BYTE SCR_RV[] = { I_SH_MSG,0x03,I_SH_AUTO }; BYTE SUSE_BO[] = { I_SH_GOTO,0x06,I_SH_REDE }; BYTE SUS2_BO[] = { I_SH_GOTO,0x04,I_SH_DEST,0x0b,I_SH_CREA,0x0c,I_SH_REDE }; BYTE SJMP_RV[] = { I_SH_MSG,0x04,I_SH_DEAD }; BYTE SUSE_I2[] = { I_SH_GOTO,0x0c,I_SH_DROP,0x0e,I_SH_SWAP,0x0e,I_SH_SETV,GVAR_02,0x07,I_SH_REDE }; BYTE SGET_MN[] = { I_SH_GET,0x10,I_SH_SWAP,0x10,I_SH_MSG,0x05,I_SH_SETV,GVAR_05,0x0a,I_SH_CLRF,GVAR_06,I_SH_AUTO }; BYTE SGET_M2[] = { I_SH_GET,0x10,I_SH_SWAP,0x10,I_SH_OK }; BYTE SPUT_11[] = { I_SH_DROP,0x11,I_SH_OK }; BYTE SGE2_07[] = { I_SH_GET,0x07,I_SH_OK }; BYTE SGE2_08[] = { I_SH_GET,0x08,I_SH_OK }; BYTE SPU2_07[] = { I_SH_DROP,0x07,I_SH_OK }; BYTE SPU2_08[] = { I_SH_DROP,0x08,I_SH_OK }; BYTE SDO_HOW[] = { I_SH_MSG,0x03,I_SH_AUTO }; BYTE SUSE_GN[] = { I_SH_DEST,0x10,I_SH_SWAP,0x07,I_SH_MSG,0x06,I_SH_MSG,0x07,I_SH_AUTO }; BYTE SFIR_GN[] = { I_SH_MSG,0x26,I_SH_AUTO }; BYTE SUS2_GN[] = { I_SH_DEST,0x11,I_SH_MSG,0x06,I_SH_AUTO }; BYTE SHLP_CM[] = { I_SH_MSG,0x08,I_SH_AUTO }; BYTE SFLD_1[] = { I_SH_SETF,GVAR_07,I_SH_MSG,0x09,I_SH_AUTO }; BYTE SFLD_2[] = { I_SH_SETF,GVAR_08,I_SH_MSG,0x09,I_SH_AUTO }; BYTE SFLD_3[] = { I_SH_MSG,0x0a,I_SH_AUTO }; BYTE SDANCE[] = { I_SH_GOTO,0x10,I_SH_SETV,GVAR_02,0x09,I_SH_REDE }; BYTE SDANCE2[] = { I_SH_MSG,0x0b,I_SH_GOTO,0x13,I_SH_REDE }; BYTE SUSE_KY[] = { I_SH_GOTO,0x12,I_SH_REDE }; BYTE SKIL_SG[] = { I_SH_DEST,0x17,I_SH_OK }; BYTE SLK_UP[] = { I_SH_MSG,0x0c,I_SH_AUTO }; BYTE SBRK_BA[] = { I_SH_SWAP,0x14,I_SH_CREA,0x05,I_SH_REDE }; BYTE SGO_UP[] = { I_SH_GOTO,0x0c,I_SH_SWAP,0x14,I_SH_REDE }; BYTE SBRBSEC[] = { I_SH_MSG,0x0d,I_SH_AUTO }; BYTE SUSE_CN[] = { I_SH_SWAP,0x12,I_SH_DEST,0x06,I_SH_REDE }; BYTE SBDOOR[] = { I_SH_GOTO,0x0c,I_SH_SWAP,0x12,I_SH_REDE }; BYTE SLK_WAT[] = { I_SH_MSG,0x0e,I_SH_AUTO }; BYTE SGET_CN[] = { I_SH_MSG,0x01,I_SH_AUTO }; BYTE SWATER2[] = { I_SH_MSG,0x0f,I_SH_AUTO }; BYTE SWATER1[] = { I_SH_CREA,0x06,I_SH_GET,0x06,I_SH_OK }; BYTE SL2_WAT[] = { I_SH_MSG,0x0f,I_SH_AUTO }; BYTE SODOOR2[] = { I_SH_GOTO,0x0e,I_SH_REDE }; BYTE SPSH3A[] = { I_SH_SETV,GVAR_09,0x01,I_SH_OK }; BYTE SPSHDG[] = { I_SH_MSG,0x10,I_SH_CLRF,GVAR_09,I_SH_SETF,GVAR_0a,I_SH_AUTO }; BYTE SPSH2A[] = { I_SH_SETV,GVAR_09,0x02,I_SH_OK }; BYTE SPSH1A[] = { I_SH_MSG,0x11,I_SH_SETV,GVAR_09,0x03,I_SH_AUTO }; BYTE SMNDFUS[] = { I_SH_MSG,0x0d,I_SH_AUTO }; BYTE SUSE_BA[] = { I_SH_CLRF,GVAR_0a,I_SH_DEST,0x05,I_SH_OK }; BYTE SLOOK1[] = { I_SH_MSG,0x18,I_SH_AUTO }; BYTE SHELP1[] = { I_SH_MSG,0x13,I_SH_AUTO }; BYTE SHELP2[] = { I_SH_MSG,0x14,I_SH_AUTO }; BYTE SHELP3[] = { I_SH_MSG,0x15,I_SH_AUTO }; BYTE SHELP4[] = { I_SH_MSG,0x16,I_SH_AUTO }; BYTE SLK_UP2[] = { I_SH_MSG,0x1a,I_SH_AUTO }; BYTE SQUIET[] = { I_SH_GOTO,0x0c,I_SH_SETV,GVAR_02,0x07,I_SH_REDE }; BYTE SWR_09[] = { I_SH_WEAR,0x09,I_SH_OK }; BYTE SRM_09[] = { I_SH_REMO,0x09,I_SH_OK }; BYTE SREDE[] = { I_SH_REDE }; BYTE SJUMP_D[] = { I_SH_MSG,0x03,I_SH_AUTO }; BYTE SUSE_RP[] = { I_SH_SETF,GVAR_0b,I_SH_DROP,0x0a,I_SH_GOTO,0x0c,I_SH_REDE }; BYTE SJUMP[] = { I_SH_MSG,0x1b,I_SH_AUTO }; BYTE SUP_ROP[] = { I_SH_GOTO,0x01,I_SH_REDE }; BYTE SSHIP[] = { I_SH_GOTO,0x14,I_SH_REDE }; BYTE SPSH_MN[] = { I_SH_MSG,0x1c,I_SH_DEAD }; BYTE SPSH_AU[] = { I_SH_SETF,GVAR_0c,I_SH_MSG,0x1d,I_SH_AUTO }; BYTE SPSH_32[] = { I_SH_MSG,0x19,I_SH_DEAD }; BYTE SPSH_4[] = { I_SH_MSG,0x1e,I_SH_QUIT }; BYTE SPSH_1B[] = { I_SH_MSG,0x1f,I_SH_MSG,0x20,I_SH_DEAD }; BYTE SPSH_1C[] = { I_SH_MSG,0x1f,I_SH_MSG,0x21,I_SH_MSG,0x1e,I_SH_QUIT }; BYTE SHELP5[] = { I_SH_MSG,0x17,I_SH_AUTO }; BYTE SLOOK2[] = { I_SH_MSG,0x12,I_SH_AUTO }; /* // list of available verb/noun combinations // along with their defining predicates and // command lists // terminated with a zero byte // for each entry: // 1st = verb token code // 2nd = noun token code // 3rd = address of predicate list entry // 4th = address of system command list entry */ VNDef vndDefinitions[] = { { TOK_GET, TOK_BOOT, A_GD_BOOT, SGET_00 }, { TOK_GET, TOK_STAR, A_GD_STAR, SGET_01 }, { TOK_GET, TOK_KEY, A_GD_KEY, SGET_02 }, { TOK_GET, TOK_GUN, A_GD_GUN, SGET_03 }, { TOK_GET, TOK_BAR, A_GD_BAR, SGET_05 }, { TOK_GET, TOK_COIN, A_GD_COIN, SGET_06 }, { TOK_GET, TOK_MIRR, A_G_MIRR_1, SGET_07 }, { TOK_GET, TOK_MIRR, A_GD_MIRR_2, SGET_08 }, { TOK_GET, TOK_BROK, A_GD_MIRR_2, SGET_08 }, { TOK_GET, TOK_GLOV, A_GD_GLOV, SGET_09 }, { TOK_GET, TOK_ROPE, A_GD_ROPE, SGET_0A }, { TOK_GET, TOK_BOAR, A_GD_BOAR_1, SGET_0B }, { TOK_GET, TOK_BOAR, A_GD_BOAR_2, SGET_0C }, { TOK_GET, TOK_BROK, A_GD_BOAR_2, SGET_0C }, { TOK_GET, TOK_STAL, A_GD_STAL, SGET_0D }, { TOK_GET, TOK_ICE, A_GD_ICE, SGET_0E }, { TOK_GET, TOK_FLIN, A_GD_FLIN, SGET_18 }, { TOK_GET, TOK_STON, A_GD_STON, SGET_19 }, { TOK_INVE, 0xff, A_MISC, SINVENT }, { TOK_QUIT, 0xff, A_MISC, SQUIT }, { TOK_DROP, TOK_BOOT, A_GD_BOOT, SPUT_00 }, { TOK_DROP, TOK_STAR, A_GD_STAR, SPUT_01 }, { TOK_DROP, TOK_KEY, A_GD_KEY, SPUT_02 }, { TOK_DROP, TOK_GUN, A_GD_GUN, SPUT_03 }, { TOK_DROP, TOK_BAR, A_GD_BAR, SPUT_05 }, { TOK_DROP, TOK_COIN, A_GD_COIN, SPUT_06 }, { TOK_DROP, TOK_MIRR, A_D_MIRR, SPUT_07 }, { TOK_DROP, TOK_MIRR, A_GD_MIRR_2, SPUT_08 }, { TOK_DROP, TOK_BROK, A_GD_MIRR_2, SPUT_08 }, { TOK_DROP, TOK_GLOV, A_GD_GLOV, SPUT_09 }, { TOK_DROP, TOK_ROPE, A_GD_ROPE, SPUT_0A }, { TOK_DROP, TOK_BOAR, A_GD_BOAR_1, SPUT_0B }, { TOK_DROP, TOK_BOAR, A_GD_BOAR_2, SPUT_0C }, { TOK_FIRE, TOK_BROK, A_GD_BOAR_2, SPUT_0C }, { TOK_DROP, TOK_STAL, A_GD_STAL, SPUT_0D }, { TOK_DROP, TOK_ICE, A_GD_ICE, SPUT_0E }, { TOK_DROP, TOK_FLIN, A_GD_FLIN, SPUT_18 }, { TOK_DROP, TOK_STON, A_GD_STON, SPUT_19 }, { TOK_LOOK, TOK_DRAW, A_DRAW_STAL, SLK_DRW }, { TOK_BREA, TOK_STAL, A_DRAW_STAL, SBRK_ST }, { TOK_USE, TOK_ICE, A_U_ICE_1, SUSE_IC }, { TOK_CUT, TOK_ROPE, A_CUT_ROPE, SCUT_RP }, { TOK_USE, TOK_FLIN, A_USE_FLIN, SUSE_FL }, { TOK_WEAR, TOK_BOOT, A_MISC, SWR_00 }, { TOK_REMO, TOK_BOOT, A_MISC, SRM_00 }, { TOK_CROS, TOK_RAVI, A_C_RAVI_1, SCR_RV }, { TOK_CROS, TOK_RAVI, A_C_RAVI_2, SCR_RV }, { TOK_USE, TOK_BOAR, A_C_RAVI_3, SUSE_BO }, { TOK_USE, TOK_BOAR, A_USE_BOAR, SUS2_BO }, { TOK_JUMP, TOK_RAVI, A_C_RAVI_3, SJMP_RV }, { TOK_JUMP, TOK_RAVI, A_C_RAVI_2, SJMP_RV }, { TOK_DOWN, 0xff, A_DOWN, SCR_RV }, { TOK_USE, TOK_ICE, A_U_ICE_2, SUSE_I2 }, { TOK_GET, TOK_MAN, A_G_MAN_1, SGET_MN }, { TOK_GET, TOK_MAN, A_G_MAN_2, SGET_M2 }, { TOK_GET, TOK_MAN, A_G_MAN_3, SGET_MN }, { TOK_DROP, TOK_MAN, A_KD_MAN_1, SPUT_11 }, { TOK_GET, TOK_MIRR, A_G_MIRR_3, SGE2_07 }, { TOK_GET, TOK_BROK, A_GD_MIRR_2, SGE2_08 }, { TOK_DROP, TOK_MIRR, A_D_MIRR, SPU2_07 }, { TOK_DROP, TOK_BROK, A_GD_MIRR_2, SPU2_08 }, { TOK_KILL, TOK_MAN, A_K_MAN_2, SDO_HOW }, { TOK_KILL, TOK_MAN, A_KD_MAN_1, SDO_HOW }, { TOK_USE, TOK_GUN, A_U_GUN_1, SUSE_GN }, { TOK_USE, TOK_GUN, A_U_GUN_2, SFIR_GN }, { TOK_USE, TOK_GUN, A_U_GUN_3, SUS2_GN }, { TOK_TYPE, TOK_HELP, A_TYPE_HELP, SHLP_CM }, { TOK_FIRE, TOK_GUN, A_FIRE_GUN, SFIR_GN }, { TOK_FIEL, 0xff, A_FIEL_1, SFLD_1 }, { TOK_FIEL, 0xff, A_FIEL_2, SFLD_2 }, { TOK_FIEL, 0xff, A_FIEL_3, SFLD_3 }, { TOK_DANC, 0xff, A_DANC_1, SDANCE }, { TOK_DANC, 0xff, A_DANC_2, SDANCE2 }, { TOK_OPEN, TOK_DOOR, A_O_DOOR_1, SDO_HOW }, { TOK_USE, TOK_KEY, A_USE_KEY, SUSE_KY }, { TOK_KILL, TOK_SECU, A_K_SECU, SKIL_SG }, { TOK_LOOK, TOK_UP, A_LUP_BREA, SLK_UP }, { TOK_BREA, TOK_BAR, A_LUP_BREA, SBRK_BA }, { TOK_UP, 0xff, A_UP, SGO_UP }, { TOK_BRIB, TOK_SECU, A_BRSEC, SBRBSEC }, { TOK_USE, TOK_COIN, A_U_COIN, SUSE_CN }, { TOK_DOOR, 0xff, A_B_DOOR, SBDOOR }, { TOK_LOOK, TOK_WATE, A_L_WATE, SLK_WAT }, { TOK_GET, TOK_COIN, A_G_COIN, SGET_CN }, { TOK_WATE, 0xff, A_WATE_1, SWATER1 }, { TOK_WATE, 0xff, A_WATE_2, SWATER2 }, { TOK_WATE, 0xff, A_L_WATE, SL2_WAT }, { TOK_OPEN, TOK_DOOR, A_O_DOOR_2, SODOOR2 }, { TOK_PUSH, TOK_THRE, A_PUSH_THRE, SPSH3A }, { TOK_PUSH, TOK_THRE, A_PUSH_DIG, SPSHDG }, { TOK_PUSH, TOK_TWO, A_PUSH_TWO, SPSH2A }, { TOK_PUSH, TOK_TWO, A_PUSH_DIG, SPSHDG }, { TOK_PUSH, TOK_ONE, A_PUSH_ONE, SPSH1A }, { TOK_PUSH, TOK_ONE, A_PUSH_DIG, SPSHDG }, { TOK_MEND, TOK_FUSE, A_MEND_FUSE, SMNDFUS }, { TOK_USE, TOK_BAR, A_USE_BAR, SUSE_BA }, { TOK_LOOK, 0xff, A_LOOK, SLOOK1 }, { TOK_HELP, 0xff, A_HELP_1, SHELP1 }, { TOK_HELP, 0xff, A_HELP_2, SHELP2 }, { TOK_HELP, 0xff, A_HELP_3, SHELP3 }, { TOK_HELP, 0xff, A_HELP_4, SHELP4 }, { TOK_HELP, 0xff, A_HELP_5, SHELP4 }, { TOK_HELP, 0xff, A_HELP_6, SHELP4 }, { TOK_HELP, 0xff, A_HELP_7, SHELP4 }, { TOK_HELP, 0xff, A_HELP_8, SHELP1 }, { TOK_LOOK, TOK_UP, A_LUP, SLK_UP2 }, { TOK_WEST, 0xff, A_WEST, SQUIET }, { TOK_NORT, 0xff, A_HELP_2, SQUIET }, { TOK_WEAR, TOK_GLOV, A_MISC, SWR_09 }, { TOK_REMO, TOK_GLOV, A_MISC, SRM_09 }, { TOK_REDE, 0xff, A_MISC, SREDE }, { TOK_DOWN, 0xff, A_JUMP, SJUMP_D }, { TOK_USE, TOK_ROPE, A_USEROP, SUSE_RP }, { TOK_JUMP, 0xff, A_JUMP, SJUMP }, { TOK_UP, TOK_ROPE, A_UPROPE, SUP_ROP }, { TOK_SHIP, 0xff, A_SHIP, SSHIP }, { TOK_PUSH, TOK_MAIN, A_P_MAUX, SPSH_MN }, { TOK_PUSH, TOK_AUX, A_P_MAUX, SPSH_AU }, { TOK_PUSH, TOK_THRE, A_P_32, SPSH_32 }, { TOK_PUSH, TOK_TWO, A_P_32, SPSH_32 }, { TOK_PUSH, TOK_FOUR, A_P_41, SPSH_4 }, { TOK_PUSH, TOK_ONE, A_PSH_ONE_2, SPSH_1C }, { TOK_PUSH, TOK_ONE, A_P_41, SPSH_1B }, { TOK_HELP, 0xff, A_MISC, SHELP5 }, { TOK_LOOK, 0xff, A_MISC, SLOOK2 }, { 0x00, 0x00, 0, 0 } }; /* bytecodes for the auto commands */ BYTE STURNGR[] = { I_SH_MSG,0x23,I_SH_DEAD }; BYTE STHROTL[] = { I_SH_MSG,0x24,I_SH_DEAD }; BYTE SSHOT[] = { I_SH_MSG,0x25,I_SH_DEAD }; BYTE SMELT_I[] = { I_SH_SWAP,0x0e,I_SH_TELL }; BYTE STELLME[] = { I_SH_TELL }; /* // list of auto command combinations // terminated with a zero byte // these processed at the end of each parse cycle // for each entry: // 1st = verb token code (wildcard, matches any verb) // 2nd = noun token code (wildcard, matches any noun) // 3rd = address of predicate list entry // 4th = unknown address */ VNDef AUT_LST[] = { { 0xff, 0xff, A_CHGRN, STURNGR }, { 0xff, 0xff, A_CHTHR, STHROTL }, { 0xff, 0xff, A_C2THR, STHROTL }, { 0xff, 0xff, A_SHOT, SSHOT }, { 0xff, 0xff, A_MELTD, SMELT_I }, { 0xff, 0xff, A_NULL, STELLME } }; /* // ====================================================================== // output a character to the display // ====================================================================== */ void i_PutCh(char ch) { putchar(ch); if (ch == '\n') nRemColumns = MAX_COL; } /* // ====================================================================== // throw a new line on the display // ====================================================================== */ void PrintCR() { i_PutCh('\n'); } /* // ====================================================================== // clear the screen // ====================================================================== */ void ClearScr() { putchar(12); /* int n; for (n = 0; n < 50; ++n) printf("\n"); nRemColumns = MAX_COL; */ } /* // ====================================================================== // print the zero-terminated string pointed to by HL // performing word-wrap and scrolling if necessary // ====================================================================== */ void PrintStr(unsigned char* hl) { unsigned char ch; unsigned char *temphl; int b; for (;;) { ch = *hl++; if (ch == 0) return; switch (ch) { case '\n': PrintCR(); break; case ' ': break; default: --hl; temphl = hl; b = 0; for (;;) { ch = *hl; if ((ch == ' ') || (ch == '\0') || (ch == '\n')) break; ++b; ++hl; } if (b > nRemColumns) PrintCR(); hl = temphl; for (;;) { ch = *hl; if ((ch == ' ') || (ch == '\0') || (ch == '\n')) break; i_PutCh(ch); ++hl; } if ((nRemColumns - b) != 0) { i_PutCh(' '); nRemColumns = nRemColumns - b - 1; } else nRemColumns = nRemColumns - b; break; } } } /**** ; main program starts here START ld hl,GVARS ; zero all game variables ld b,$1e INITLP ld (hl),$00 inc hl djnz INITLP ld hl,$0000 ld (SCORE),hl call PrintInstr ; display instructions // copied to main - initialize naItemLoc ld ix,GVARS ; initialize ix to point at the game variables ld (CUR_RM),$00 ; set current room to 0 (starting room) push hl ; save hl (points at naItemLoc) jr RESTG ; skip message data... RESTG_M .text "WANT TO RESTORE A GAME?" .byte $0d,$00 RESTG ld hl,RESTG_M ; prompt - restore game? call PrintStr ; print it pop hl ; restore hl (points at naItemLoc) call i_GetCh cp 'Y' call z,LCASS ; user typed 'Y', go and restore game ; main execution loop MAIN call ClearScr xor a cp (ix+$00) ; if (ix+$00) is zero, jr z,ROOM ; go and display the room description cp (ix+$03) ; if (ix+$03) is zero, jr z,DARK_CH ; go straight to the dark check dec (ix+$03) ; otherwise, decrement (ix+$03) DARK_CH ld a,(naItemLoc) ; get location of item $00 cp (CUR_RM) ; check whether it's in the current room jr z,ROOM ; if it is, it's not dark push hl jr DARK ; skip message data... DARK_M .text "EVERYTHING IS DARK.I CANT SEE." .byte $0d,$00 DARK ld hl,DARK_M ; say it's dark and we can't see call PrintStr pop hl xor a cp (ix+$04) ; if (ix+$04) is zero, jr z,DARK_ND ; go straight to ???????? dec (ix+$04) ; otherwise, decrement (ix+$04) DARK_ND jr DO_AUTO ; (96) ****/ /* display description for current room */ void ShowRoom() { int nItem; PrintStr(straRoom[CUR_RM]); FLAG = FALSE; for (nItem = 0; nItem < MAX_ITEM; ++nItem) { if (naItemLoc[nItem] == CUR_RM) { if (!FLAG) { PrintStr("I CAN ALSO SEE :\n"); FLAG = TRUE; } PrintStr(straItem[nItem]); PrintCR(); } } nNextParseAction = NA_DO_AUTO; } /***** // ====================================================================== // perform regular automatic functions, e.g. the little green man // ====================================================================== void DO_AUTO() { ld hl,AUT_LST ; select the auto command list (wildcards, every command matches) jp PARS_LP ; and restart parser ***/ /* // ====================================================================== // system command - TELL command // generates the "tell me what to do" prompt // ====================================================================== */ void SH_TELL() { BYTE* pDirections; if (GVARS[GVAR_02] > 0) --GVARS[GVAR_02]; if (GVARS[GVAR_05] > 0) --GVARS[GVAR_05]; /*** { char sz[256]; sprintf(sz, "02 = %u\n", GVARS[0x02]); PrintStr(sz); } ***/ PrintStr("TELL ME WHAT TO DO \n"); GetLine(); F_NTYET = FALSE; /* // ====================================================================== // fetch verb token from the input buffer // ====================================================================== */ pchEditLine = chaEditLine; for (;;) { VERB_TK = GET_TOK(); if (VERB_TK == 0xff) { BOOL bDont = FALSE; if ((*pchEditLine == '\n') || (*pchEditLine == '\0')) bDont = TRUE; else { for (;;) { if (*pchEditLine == ' ') { ++pchEditLine; goto verb_outer_continue; } else if ((*pchEditLine == '\n') || (*pchEditLine == '\0')) { bDont = TRUE; break; } ++pchEditLine; } } if (bDont) { PrintStr("I DONT UNDERSTAND\n"); nNextParseAction = NA_DO_AUTO; return; } } else break; /* verb ok */ verb_outer_continue: continue; } /* verb recognized */ NOUN_TK = 0xff; /* assume noun unrecognized before reading on */ /* trim off excess characters from the verb */ for (;;) { char ch = *pchEditLine; if (ch == ' ') break; if (ch == '\0') goto P_DIR; if (ch == '\n') goto P_DIR; ++pchEditLine; } /* // ====================================================================== // fetch noun token from the input buffer // ====================================================================== */ for (;;) { ++pchEditLine; NOUN_TK = GET_TOK(); if (NOUN_TK != 0xff) break; for (;;) { char ch = *pchEditLine; if (ch == ' ') break; if (ch == '\0') goto P_DIR; if (ch == '\n') goto P_DIR; ++pchEditLine; } } /* // ====================================================================== // attempt to parse a direction verb // ====================================================================== */ P_DIR: pDirections = DIR_V[CUR_RM]; for (;;) { int nDir = *pDirections; if (nDir == 0xff) break; if (nDir == VERB_TK) { CUR_RM = pDirections[1]; nNextParseAction = NA_MAIN; return; } pDirections += 2; } pvndCurrent = vndDefinitions; CMDFLG = FALSE; nNextParseAction = NA_BEGIN; } extern void *SYS_V[]; void PARSE_LP() { int nVerbTok = pvndCurrent->nVerbTok; if (nVerbTok == 0) { if (!CMDFLG) { if (VERB_TK < TOK_GET) /* direction? */ PrintStr("I CANT GO IN THAT DIRECTION\n"); else if (F_NTYET) PrintStr("I CANT DO THAT YET\n"); else PrintStr("I CANT\n"); } nNextParseAction = NA_DO_AUTO; return; } if ((nVerbTok == 0xff) || (nVerbTok == VERB_TK)) { int nNounTok = pvndCurrent->nNounTok; if ((nNounTok == 0xff) || (nNounTok == NOUN_TK)) { int nPred; pPredicateCurrent = (BYTE*) pvndCurrent->pPredicates; while ((nPred = *pPredicateCurrent++) != 0xff) { BOOL (*pfn)() = PRED_V[nPred]; PARAM1 = *pPredicateCurrent; if (!pfn()) { F_NTYET = TRUE; nNextParseAction = NA_CONTINUE; return; } ++pPredicateCurrent; } /* execute command */ pActionCurrent = (BYTE*) pvndCurrent->pActions; CMDFLG = TRUE; nNextParseAction = NA_CONTINUE; for (;;) { if (*pActionCurrent == 0xff) return; else { void (*pfn)() = (void*) (SYS_V[*pActionCurrent++]); PARAM1 = *pActionCurrent; pfn(); if (nNextParseAction != NA_CONTINUE) return; ++pActionCurrent; } } PrintStr("Executed!\n"); } } nNextParseAction = NA_CONTINUE; return; } /* predicates */ /* // predicate CHKROOM - this tests the current room number to make sure it's the specified room number. // if it is, we move on to the next command, otherwise we trigger a "i can't do that yet" response. // this handler interprets PARAM1 as the room number */ BOOL CHKROOM() { return PARAM1 == CUR_RM; } /* // predicate for GET and DROP commands // this handler interprets PARAM1 as the item number */ BOOL CHKHERE() { int nLoc = naItemLoc[PARAM1]; return (nLoc == CUR_RM) || (nLoc >= ITEM_WORN); } /* // predicate CHKRAND - randomly allows or disallows the user's command. // if allowed, we move on to the next command, otherwise we trigger a "i can't do that yet" response. */ BOOL CHKRAND() { return (rand() % 256) < PARAM1; } /* // predicate CHKAWAY - checks that the specified item is not carried, held or in the current room. // if it is NOT, we move on to the next command, otherwise we trigger a "i can't do that yet" response. // this handler interprets PARAM1 as the item number */ BOOL CHKAWAY() { return !CHKHERE(); } /* // predicate CHKWORN - checks that the specified item is being worn. // if it is, we move on to the next command, otherwise we trigger a "i can't do that yet" response. // this handler interprets PARAM1 as the item number */ BOOL CHKWORN() { return naItemLoc[PARAM1] == ITEM_WORN; } /* // predicate CHKSETF - checks the game variable specified by PARAM1. // if it is non-zero, we move on to the next command, otherwise we trigger a "i can't do that yet" response. // this handler interprets PARAM1 as the game variable number // used by "field" and "look up" */ BOOL CHKSETF() { return !!GVARS[PARAM1]; } /* // predicate TSTGVAR - compares the game variable specified by PARAM1 with the value specified as // the next byte after the command. // if it is equal, we move on to the next command, otherwise we trigger a "i can't do that yet" response. // this handler interprets PARAM1 as the game variable number */ BOOL TSTGVAR() { int nParam2 = *++pPredicateCurrent; return GVARS[PARAM1] == nParam2; } /* // predicate CHKCLRF - checks the game variable specified by PARAM1. // if it is zero, we move on to the next command, otherwise we trigger a "i can't do that yet" response. // this handler interprets PARAM1 as the game variable number */ BOOL CHKCLRF() { return !CHKSETF(); } /* // predicate CHKHELD - checks that the specified item is being carried (or worn!). // if it is, we move on to the next command, otherwise we trigger a "i can't do that yet" response. // this handler interprets PARAM1 as the item number */ BOOL CHKHELD() { return (naItemLoc[PARAM1] == ITEM_HELD) || (naItemLoc[PARAM1] == ITEM_WORN); } /*** ; fetch location for an item ; item number is in PARAM1 ; location is returned in A ; address of location entry is returned in HL GET_LOC ld hl,naItemLoc ld b,$00 ld c,(PARAM1) add hl,bc ld a,(hl) ret ***/ void SH_INVE() { int bNothing=TRUE; int nItem; int nLoc; PrintStr("I HAVE WITH ME THE FOLLOWING:\n"); for (nItem = 0; nItem < MAX_ITEM; ++nItem) { nLoc = naItemLoc[nItem]; if (nLoc >= ITEM_WORN) { bNothing = FALSE; PrintStr(straItem[nItem]); if (nLoc == ITEM_WORN) PrintStr(" WHICH I AM WEARING"); PrintCR(); } } if (bNothing) PrintStr("NOTHING AT ALL\n"); nNextParseAction = NA_DO_AUTO; } /* // ====================================================================== // system command - REMOVE command // item to be removed is specified in PARAM1 // ====================================================================== */ void SH_REMO() { if (naItemLoc[PARAM1] == ITEM_WORN) { if (GVARS[GVAR_NO_ITEMS] == 6) { PrintStr("I CANT. MY HANDS ARE FULL\n"); nNextParseAction = NA_DO_AUTO; } else { naItemLoc[PARAM1] = ITEM_HELD; ++GVARS[GVAR_NO_ITEMS]; } } else { PrintStr("I AM NOT WEARING IT\n"); nNextParseAction = NA_DO_AUTO; } } /* // ====================================================================== // system command - GET command // item to be got is specified in PARAM1 // ====================================================================== */ void SH_GET() { if (GVARS[GVAR_NO_ITEMS] == 6) { PrintStr("I CANT CARRY ANY MORE\n"); nNextParseAction = NA_DO_AUTO; } else if (naItemLoc[PARAM1] == CUR_RM) { naItemLoc[PARAM1] = ITEM_HELD; ++GVARS[GVAR_NO_ITEMS]; } else if ((naItemLoc[PARAM1] == ITEM_WORN) || (naItemLoc[PARAM1] == ITEM_HELD)) { PrintStr("I ALREADY HAVE IT\n"); nNextParseAction = NA_DO_AUTO; } else { PrintStr("I DON'T SEE IT HERE\n"); nNextParseAction = NA_DO_AUTO; } } /* // ====================================================================== // system command - DROP command // item to be dropped is specified in PARAM1 // ====================================================================== */ void SH_DROP() { if (naItemLoc[PARAM1] == CUR_RM) { PrintStr("I DONT HAVE IT\n"); nNextParseAction = NA_DO_AUTO; } else if (naItemLoc[PARAM1] == ITEM_WORN) { naItemLoc[PARAM1] = CUR_RM; } else if (naItemLoc[PARAM1] == ITEM_HELD) { --GVARS[GVAR_NO_ITEMS]; naItemLoc[PARAM1] = CUR_RM; } else { PrintStr("I DONT HAVE IT\n"); nNextParseAction = NA_DO_AUTO; } } /* // ====================================================================== // system command - WEAR command // item to be worn is specified in PARAM1 // ====================================================================== */ void SH_WEAR() { if (naItemLoc[PARAM1] == ITEM_HELD) { naItemLoc[PARAM1] = ITEM_WORN; --GVARS[GVAR_NO_ITEMS]; } else if (naItemLoc[PARAM1] == ITEM_WORN) { PrintStr("I AM ALREADY WEARING IT\n"); nNextParseAction = NA_DO_AUTO; } else { PrintStr("I DONT HAVE IT\n"); nNextParseAction = NA_DO_AUTO; } } /* // ====================================================================== // system command - display a response // index of response to be displayed is specified in PARAM1 // ====================================================================== */ BOOL SH_MSG() { PrintStr(straMsg[PARAM1]); return TRUE; } /* // ====================================================================== // system command - REDE // redescribe current room, terminating execution of system commands // ====================================================================== */ void SH_REDE() { nNextParseAction = NA_MAIN; } /* // ====================================================================== // exactly the same effect as SH_FAIL - it halts further system command // processing, // and proceeds to execute the auto commands. // ====================================================================== */ void SH_AUTO() { nNextParseAction = NA_DO_AUTO; } /* // ====================================================================== // system command - go directly to specific room (do not pass go) // index of room is specified in PARAM1 // NB: room description not automatically displayed // ====================================================================== */ void SH_GOTO() { CUR_RM = PARAM1; } /* // ====================================================================== // system command SETF - set game variable to $ff // index of variable to set is specified in PARAM1 // ====================================================================== */ void SH_SETF() { GVARS[PARAM1] = 0xff; } /* // ====================================================================== // system command CLRF - clear game variable to $00 // index of variable to clear is specified in PARAM1 // ====================================================================== */ void SH_CLRF() { GVARS[PARAM1] = 0x00; } /* // ====================================================================== // system command - SWAP // swap an item's location with the location of the following item // item to be swapped is specified in PARAM1 // ====================================================================== */ void SH_SWAP() { int nTemp = naItemLoc[PARAM1]; naItemLoc[PARAM1] = naItemLoc[PARAM1 + 1]; naItemLoc[PARAM1 + 1] = nTemp; } /* // ====================================================================== // system command - DEAD // immediately terminate game, stop executing system commands // ====================================================================== */ void SH_DEAD() { PrintStr("DO YOU WISH TO TRY AGAIN?\n"); for (;;) { char ch; PrintStr("ANSWER YES OR NO\n"); ch = i_GetCh(); if (ch == 'Y') { nNextParseAction = NA_RESTART; return; } if (ch == 'N') { exit(0); } } } /* display "OK.." prompt and cease processing system commands */ void SH_OK() { PrintStr("OK..\n"); nNextParseAction = NA_DO_AUTO; } void SH_QUIT() { PrintStr("DO YOU WANT TO SAVE THE GAME?\n"); if (i_GetCh() == 'Y') { /* save */ PrintStr("SAVE NOT SUPPORTED\n"); PrintStr("DO YOU WISH TO CONTINUE?\n"); if (i_GetCh() == 'Y') { nNextParseAction = NA_DO_AUTO; return; } } SH_DEAD(); } /* // ====================================================================== // system command SETV - set game variable to a specific value // index of variable to set is specified in PARAM1 // the new value is specified as the byte after this command // ====================================================================== */ void SH_SETV() { int nParam2 = *++pActionCurrent; GVARS[PARAM1] = nParam2; } /* // ====================================================================== // system command CREA - create item in current room // index of item to be created is specified in PARAM1 // ====================================================================== */ void SH_CREA() { naItemLoc[PARAM1] = CUR_RM; } /* // ====================================================================== // system command DEST - destroy item in current room // index of item to be destoyed is specified in PARAM1 // ====================================================================== */ void SH_DEST() { naItemLoc[PARAM1] = NOTX; } /* clean-up and abort execution of system commands, continuing with auto commands */ void SH_FAIL() { nNextParseAction = NA_DO_AUTO; } /* // ====================================================================== // system command ADSC - add value to the current score. // value to be added is specified in PARAM1 // ====================================================================== */ void SH_ADSC() { nScore += PARAM1; } void SH_SCOR() { char szScore[32]; PrintStr("YOU HAVE A SCORE OF "); #ifdef SMALL_C printn(nScore,16,stdout); #else sprintf(szScore, "%04x", nScore); /* hex! (really) */ PrintStr(szScore); #endif PrintCR(); } /* addresses of various system function handlers */ void* SYS_V[] = { SH_INVE, SH_REMO, SH_GET, SH_DROP, SH_WEAR, SH_MSG, SH_REDE, SH_AUTO, SH_GOTO, SH_SETF, SH_CLRF, SH_SWAP, SH_DEAD, SH_OK, SH_QUIT, SH_SETV, SH_CREA, SH_DEST, SH_ADSC, SH_SCOR, SH_FAIL, SH_TELL, SH_FAIL, SH_FAIL, SH_FAIL }; /* // ====================================================================== // fetch command token from the input buffer, starting at position HL // on return, A contains the token code (or $ff if not recognized) // and HL points to the character after the token // ====================================================================== */ int GET_TOK() { char *pchTokenBuffer = strTokenBuf; int nResult = 0xff; int n; strncpy(strTokenBuf, " ", 4); /* clear the token buffer to spaces */ for (n = 0; n < 4; ++n) { char ch = *pchEditLine; if (ch == ' ') break; if (ch == '\0') break; if (ch == '\n') break; *pchTokenBuffer++ = ch; ++pchEditLine; } for (n = 0; n < MAX_TOK; ++n) { if (strncmp(strTokenBuf, taToken[n].strWord, 4) == 0) { nResult = taToken[n].nCode; break; } } return nResult; } /*** ; ====================================================================== LCASS push hl jr LCASS_1 ; (16) LCASS_M .text "READY CASSETTE" .byte $0d,$00 LCASS_1 ld hl,LCASS_M call PrintStr pop hl call i_GetCh push ix ld ix,FLAG ld de,$0029 ld a,$ff scf call ROM_LD ld ix,naItemLoc ld de,$001d ld a,$ff scf call ROM_LD pop ix ret ****/ /* // ====================================================================== // fetch key from buffer // waits for keypress, returns ascii code in A // ====================================================================== */ char i_GetCh() { int ch; do { ch = getkey(); } while ((ch != '\n') && (ch != '\r') && (ch != KEY_DEL ) && !(ch >= ' ' && ch <= '~')); if (ch == '\r') ch = '\n'; if (ch >= 'a' && ch <= 'z') ch ^= 0x20; return (char) ch; } /*** ; unused keyboard-reading code (left over from ZX81 version?) push de ld d,a ld a,$7f in a,($fe) rra jr c,ZX_END2 ld a,$fe in a,($fe) rra jr c,ZX_END2 ld a,$01 or a ZX_END ld a,d pop de ret ZX_END2 xor a jr ZX_END ; (-6) ***/ /* // ====================================================================== // get a line of input from the user // store the data in the buffer pointed to by HL // ====================================================================== */ void GetLine() { int nPos = 0; char ch = 0; while (ch != '\n') { chaEditLine[nPos] = 0; ch = i_GetCh(); if (ch == KEY_DEL ) /* delete */ { if (nPos != 0) { --nPos; i_PutCh(8); i_PutCh(' '); i_PutCh(8); } } else if (ch != '\n') { if (nPos == MAX_COL) { i_PutCh(' '); i_PutCh(8); } else { i_PutCh(ch); chaEditLine[nPos++] = ch; } } } i_PutCh('\n'); } /* // ====================================================================== // clear screen, display instructions and wait for keypress // ====================================================================== */ void PrintInstr() { ClearScr(); PrintStr(strInstructions); i_GetCh(); } /**** ****/ /**** ; spurious data found in the original game GARBAGE .word $5200,$4c4f,$5220,$004f .end ****/ int main() { int n; for (;;) /* restart game loop */ { /* initialize the game variables */ for (n = 0; n <= 0x1e; ++n) GVARS[n] = 0; nScore = 0; PrintInstr(); /* copy data from naItemStart to naItemLoc at start of game */ for (n = 0; n < MAX_ITEM; ++n) naItemLoc[n] = naItemStart[n]; CUR_RM = 0; PrintStr("WANT TO RESTORE A GAME?\n"); if (i_GetCh() == 'Y') { /* restore */ PrintStr("RESTORE NOT SUPPORTED\n"); PrintStr("PRESS A KEY"); i_GetCh(); } for (;;) /* main loop */ { ClearScr(); if (GVARS[0] == 0) { ShowRoom(); } else { if (GVARS[3] > 0) --GVARS[3]; if (naItemLoc[0] == CUR_RM) { ShowRoom(); } else { PrintStr("EVERYTHING IS DARK.I CANT SEE.\n"); if (GVARS[4] > 0) --GVARS[4]; nNextParseAction = NA_DO_AUTO; } } for (;;) /* parse loop */ { switch (nNextParseAction) { case NA_DO_AUTO: pvndCurrent = AUT_LST; break; case NA_CONTINUE: ++pvndCurrent; break; case NA_MAIN: case NA_RESTART: goto outer_cont; break; case NA_BEGIN: break; default: PrintStr("ERROR\n"); ++pvndCurrent; break; } PARSE_LP(); } outer_cont: if (nNextParseAction == NA_RESTART) break; } } return 0; } z88dk-1.8.ds1/examples/console/enigma.c0000644000175000017500000000576307505335211017404 0ustar tygrystygrys/* * A Simple 3 Rotor Enigma Simulation * * 11/9/98 djm - Converted to z88dk * 27/1/02 djm - Added support for argc/argv for CPM */ #include #include #include #include /* Rotor Wirings */ unsigned char rotor[] = "EKMFLGDQVZNTOWYHXUSPAIBRCJAJDKSIRUXBLHWTMCQGZNPYFVOEBDFHJLCPRTXVZNYEIWGAKMUSQOESOVPZJAYQUIRHXLNFTGKDCMWBVZBRGITYUPSDNHLXAWMJQOFECK"; unsigned char ref[] = "YRUHQSLDPXNGOKMIEBFZCWVJAT"; unsigned char notch[] = "QEVJZ"; unsigned int flag = 0; /*Encryption parameters */ unsigned char order[3] = { 3, 1, 2 }; unsigned char rings[3] = { 'W', 'X', 'T' }; unsigned char pos[3] = { 'A', 'W', 'E' }; unsigned char plug[] = "AMTE"; #ifdef CPM #define ARGC #endif #ifdef Z88_SHELL #define ARGC #endif #ifdef ARGC int main(int argc, char *argv[]) #else int main() #endif { unsigned int i, j, n = 0; unsigned int ch; #ifdef ARGC int len, posn; if (argc != 2) { puts("Usage: enigma [text to be encoded]"); exit(1); } len = strlen(argv[1]); posn = -1; #else puts("Enter text to be (de)coded, finish with a ."); #endif #ifdef ARGC while (posn++ < len) { ch = toupper(*(argv[1] + posn)); #else for (;;) { ch = getchar(); ch = toupper(ch); #endif if (ch == '.') exit(0); if (!isalpha(ch)) continue; /* Step up first rotor */ pos[0]++; if (pos[0] > 'Z') pos[0] -= 26; /* Check if second rotor reached notch last time */ if (flag) { /* Step up second and third rotors */ pos[1]++; if (pos[1] > 'Z') pos[1] -= 26; pos[2]++; if (pos[2] > 'Z') pos[2] -= 26; flag = 0; } /* Step up seconond rotor if first rotor reached notch */ if (pos[0] == notch[order[0] - 1]) { pos[1]++; if (pos[1] > 'Z') pos[1] -= 26; if (pos[1] == notch[order[1] - 1]) flag = 1; } /*Swap pairs of letters on plugboard */ for (i = 0; plug[i]; i += 2) { if (ch == plug[i]) ch = plug[i + 1]; else if (ch == plug[i + 1]) ch = plug[i]; } /* Rotors (forward) */ for (i = 0; i < 3; i++) { ch += pos[i] - 'A'; if (ch > 'Z') ch -= 26; ch -= rings[i] - 'A'; if (ch < 'A') ch += 26; ch = rotor[((order[i] - 1) * 26) + ch - 'A']; ch += rings[i] - 'A'; if (ch > 'Z') ch -= 26; ch -= pos[i] - 'A'; if (ch < 'A') ch += 26; } /* Reflecting rotor */ ch = ref[ch - 'A']; /*Rotors (Reverse) */ for (i = 3; i; i--) { ch += pos[i - 1] - 'A'; if (ch > 'Z') ch -= 26; ch -= rings[i - 1] - 'A'; if (ch < 'A') ch += 26; for (j = 0; j < 26; j++) if (rotor[(26 * (order[i - 1] - 1)) + j] == ch) break; ch = j + 'A'; ch += rings[i - 1] - 'A'; if (ch > 'Z') ch -= 26; ch -= pos[i - 1] - 'A'; if (ch < 'A') ch += 26; } /* Plugboard */ for (i = 0; plug[i]; i += 2) { if (ch == plug[i]) ch = plug[i + 1]; else if (ch == plug[i + 1]) ch = plug[i]; } n++; putchar(ch); if (n % 5 == 0) if (n % 55 == 0) putchar('\n'); else putchar(' '); } } z88dk-1.8.ds1/examples/console/fib.c0000644000175000017500000000075410264206263016677 0ustar tygrystygrys/* Small recursive program that calculates Fibonacci numbers. * * This program was originally featured in the "Embedded Systems Magazine" * April 1989 */ #include #pragma string name Fibonacci numbers int fib(int n); unsigned results[11]; main() { int loop; for (loop=1; loop < 10; loop++) { results[loop] = fib(loop); printf("fib(%d) = %d\n",loop,results[loop]); } } int fib(int n) { if (n <= 2) return 1; return fib(n-1) + fib(n-2); } z88dk-1.8.ds1/examples/console/mm.c0000755000175000017500000001230410555657665016570 0ustar tygrystygrys /* Mastermind game, written by: Stephen A. Ward, January, 1980 Modified for BDS C by: Leor Zolman, February, 1980 Modified for Z88DK (and Visual C and GCC) by: Stefano Bodrato, March, 2004 -- NOTE: Z88DK ports need to be extended to support shells, to be able to pass the following parameters -- Usage: mm [ -B ] [ -K ] [ -C# ] [ -P# ] where: -B tells # of possible solutions before each guess -C# sets number of different characters (e.g., "-c4" means A-D) (defaults to 6) -P# sets number of positions in solution string (defaults to 4) -K disables kibitzing (enabled by default.). Thus, for example, the invokation mm -C10 -P3 would simulate the game of "Bagels", where the layout is ten different characters in three positions. I don't think "Bagels" allows repetitions, though, so it isn't QUITE the same... */ #include #include #include #include //#include #define NPEGS 10 /* Max NPeg */ #define MCOLORS 26 /* Max NColors */ #define NHIST 100 char Secret[NPEGS+2]; /* was CHAR */ char History[NHIST*NPEGS]; /* was CHAR */ int Jots[NHIST]; int guesses; int NColors, /* Number of colors */ NPeg; /* Number of pegs */ char KFlag, /* Kibitz flag */ BFlag; /* Debug flag */ main(int argc,char **argv) //char **argv; { register int i,j; int ngames, ntries; char *trial, *arg; ngames = ntries = 0; NColors = 6; /* Number of colors */ NPeg = 4; /* Number of pegs */ KFlag = 1; /* Kibitz flag */ BFlag = 0; /* Debug flag */ for (i=1; i MCOLORS) NColors = MCOLORS; continue; case 'P': NPeg = atoi(++arg); if (NPeg > NPEGS) NPeg = NPEGS; continue; default: printf("Illegal option %s\n", argv[i]); exit(-1); } else { printf("Usage: mm [ -b ] [ -k ] [ -c# ] [ -p# ]\n"); exit(-1); }} printf("%c",12); printf("Mastermind game:\n"); printf(" I have a secret string of %d letters ",NPeg); printf("between A and %c.\n", 'A' + NColors - 1); printf(" Object: find it in as few guesses as possible.\n"); printf(" For each guess, I will tell you how many\n"); printf(" Hits (right letter in the right place) and\n"); printf(" Misses (right letter in the wrong place)\n"); printf(" you had for that guess.\n"); printf(" Note: letters may appear more than once in my strings.\n"); //srand1("\nType any character to begin: "); //srand(time(NULL)); printf("\nType any character to begin: "); getchar(); Game: for (i=0; i>4 ? "\t\t\t %d hit" : "\t\t\t no hit"), j>>4); if ((j>>4) - 1) putchar('s'); printf ( (j & 0xf ? ", %d miss" : ", no miss"), j & 0xf); if ((j & 0xf) - 1) printf("es"); putchar('\n'); if (j == (NPeg << 4)) { printf("You got it in %d guesses!\n", ++guesses); ntries += guesses; ngames++; i = ntries/ngames; //printf("Average for %d game%c is %1d.%1d\n", printf("Average for %d game%c is %d.%d\n", ngames, (ngames != 1) ? 's' : 32, i , ntries*100 /ngames %100); goto Game; }} Secret[NPeg] = 0; printf("My secret symbol was "); for (i=0; i 0) score++; } return score; } int incr(tt) char *tt; { register int i; i = 0; while (i < NPeg) { if (++tt[i] < NColors) return 1; tt[i] = 0; i++; } return 0; } int Check() { char tt[NPEGS]; char *hh; register int i, j; int count; count = 0; for (i=0; i NPeg && !isspace(where[i])) { printf("Too many letters\n"); goto again; } if (i < NPeg) { printf("Too few letters\n"); goto again; } for (i=0; i= NColors) { printf("Bad letter -- use A thru %c\n", 'A'+NColors-1); goto again; } } return 1; } z88dk-1.8.ds1/examples/console/README0000644000175000017500000000017207425004723016647 0ustar tygrystygrysThe demos in this program are all console driven and should work on all platforms Compile thus: zcc +[machine] [file.c] z88dk-1.8.ds1/examples/console/rpn.c0000644000175000017500000000416407425004723016737 0ustar tygrystygrys/* * Reverse Polish Notation calculator - integer only! * * Nabbed from GBDK distribution, converted over to Small C+ * * Small C+ changes: * * - include * - #define for UBYTE WORD BYTE * - Correcting gets() statement so that we give a max size * * Added to Small C+ archive 14/3/99 djm * * I'm guessing that Pascal Felber originally wrote this, if * not, then I apologise. * * Enjoy it: enter expressions like 1000 2342 + then 2 * * or something like that, it's all a bit too much like Forth * for my liking! * */ #define ANSI_STDIO #include #include #include #define MAXOP 40 #define NUMBER '0' #define STACKSIZE 40 #define UBYTE unsigned char #define WORD int #define BYTE char UBYTE sp; WORD stack[STACKSIZE]; UBYTE s[MAXOP]; UBYTE pos; WORD n; void push(WORD l) { if(sp < STACKSIZE) stack[sp++] = l; else printf("Stack full\n"); } WORD pop() { if(sp > 0) return stack[--sp]; else printf("Stack empty\n"); return 0; } WORD top() { if(sp > 0) return stack[sp-1]; else printf("Stack empty\n"); return 0; } BYTE read_op() { if(pos == 0) { gets(s); } while(s[pos] == ' ' || s[pos] == '\t') pos++; if(s[pos] == '\0') { pos = 0; return('\n'); } if(isdigit(s[pos])==0) return(s[pos++]); n = s[pos] - '0'; while(isdigit(s[++pos])) n = 10 * n + s[pos] - '0'; return NUMBER; } void main() { BYTE type; WORD op2; printf("RPN Calculator\n"); printf("Nabbed from GBDK archive\n"); sp = 0; pos = 0; while((type = read_op(s)) != 0) { switch(type) { case NUMBER: push(n); break; case '+': push(pop() + pop()); break; case '*': push(pop() * pop()); break; case '-': op2 = pop(); push(pop() - op2); break; case '/': op2 = pop(); if(op2 != 0) push(pop() / op2); else printf("Divide by 0\n"); break; case '.': return; case '\n': printf("==> %d\n", top()); break; } } } z88dk-1.8.ds1/examples/console/sorter.c0000644000175000017500000000151707425004723017455 0ustar tygrystygrys/* Small C+ Insertion sort! * * Joe Mackay 3/2/1999 */ #include #define SIZE 100 main() { int A[SIZE], i, j, tmp; /* Fill array with descending numbers (worst case) */ i=0; while (itmp) A[j]=A[--j]; A[j] = tmp; } /* Print sorted version */ puts("After:"); printarray(A); } printarray(int A[]) { int i; i=0; while (i char x; char board[] = { '1','2','3', '4','5','6', '7','8','9' }; char threes[] = { 0,1,2, 3,4,5, 6,7,8, 0,4,8, 6,4,2, 0,3,6, 1,4,7, 2,5,8 }; void printboard() { printf("\n * *"); printf("\n %c * %c * %c", board[0], board[1], board[2]); printf("\n*****************"); printf("\n %c * %c * %c", board[3], board[4], board[5]); printf("\n*****************"); printf("\n %c * %c * %c ", board[6], board[7], board[8]); printf("\n * *"); printf("\n\n"); /* printf("\n * * "); printf("\n %c * %c * %c ", board[0], board[1], board[2]); printf("\n * * "); printf("\n********************************"); printf("\n * * "); printf("\n %c * %c * %c ", board[3], board[4], board[5]); printf("\n * * "); printf("\n********************************"); printf("\n * * "); printf("\n %c * %c * %c ", board[6], board[7], board[8]); printf("\n * * "); printf("\n\n"); */ } int domove(char player,char opponent) { // Is the center of board free ? if ( board[4] != player && board[4] != opponent ) { board[4] = player; return (0); } // Can I win ? for (x=0 ; x!=8; x++) { if ((board[threes[x*3]]==player && board[threes[x*3+1]]==player) && (board[threes[x*3+2]] != player && board[threes[x*3+2]] != opponent)) { board[threes[x*3+2]] = player; return (1); } else if ((board[threes[x*3+1]]==player && board[threes[x*3+2]]==player) && (board[threes[x*3]] != player && board[threes[x*3]] != opponent)) { board[threes[x*3]] = player; return (1); } } // Is the opponent going to win ? for (x=0 ; x!=8; x++) { if ((board[threes[x*3]]==opponent && board[threes[x*3+1]]==opponent) && (board[threes[x*3+2]] != player && board[threes[x*3+2]] != opponent)) { board[threes[x*3+2]] = player; return (0); } else if ((board[threes[x*3+1]]==opponent && board[threes[x*3+2]]==opponent) && (board[threes[x*3]] != player && board[threes[x*3]] != opponent)) { board[threes[x*3]] = player; return (0); } } // Put in the first free place for (x=0 ; x!=9; x++) { if ( board[x] != player && board[x] != opponent ) { board[x] = player; return (0); } } return(2); } int human(char player,char opponent) { char c; while (1) { c=10; while (c<0 || c>9) //c=(getch()-49); c=(getk()-49); if ( board[c] != player && board[c] != opponent ) { board[c]=player; return (1); } } } int ckwin(char player) { for (x=0 ; x!=8; x++) { if ( board[threes[x*3]]==player && board[threes[x*3+1]]==player && board[threes[x*3+2]]==player) return (1); } return(0); } int ckfree (char player1 , char player2) { for (x=0 ; x!=9; x++) { if ( board[x] != player1 && board[x] != player2 ) { return (1); } } return(0); } int ckgame (char player1 , char player2) { if (ckwin (player1)) { printf ("%c is the winner\n\n",player1); return (1); } if (ckwin (player2)) { printf ("%c is the winner\n\n",player2); return (2); } if (!ckfree (player1,player2)) { printf ("No winners\n\n"); return (3); } return (0); } int main() { //for (x=0 ; x!=9; x++) board[x] = x; printboard(); while (ckgame ('X','O') == 0) { human ('X','O'); printboard(); if (ckgame ('X','O') != 0) return (0); domove ('O','X'); printboard(); } } z88dk-1.8.ds1/examples/console/world.c0000644000175000017500000000012307425004723017256 0ustar tygrystygrys/* * Hello World */ #include main() { printf("Hello world!\n"); } z88dk-1.8.ds1/examples/dstar.c0000644000175000017500000001605110711311663015605 0ustar tygrystygrys/* Ported to the Ti82/83/83+ (rest will follow) by Henk Poley * Extended with different sprite sizes and sound by Stefano Bodrato * * * up,down,left,right - move ball/box * [Enter] - toggle ball/box * 7 - Quit * 9 - Restart level * +,- - CHEAT.... * * * * For the key usage on other platforms read the original docs: * * * dstar.c * * DStar Z88 - C Demo * Original TI game By A Von Dollen * Converted to Z88 By D Morris * Keys: Q,A,O,P,SPACE,H,G * * dstarz88 is a conversion of a TI86 game I found with * source on www.ticalc.org. * * The original program was written by Andrew Von Dollen who * in turn based it on a HP game by Joe W. * * The aim of the game is to collect all the clear bubbles by * running over them. You control either the dark bubble or * the solid box. The dark bubble is used to collect the clear * bubbles, and the solid box is used as a sort of movable wall. * * Both objects carry on moving until they hit something else * (except for the dark bubble in the case of clear bubbles). * * The keys are defined in #define statements, and default thus: * * Up: Q * Down: A * Left: O * Right: P * Quit: G * Retry: H * Switch: [SPACE] * * Switch changes between the dark bubble and the solid box. * * This is the first game ever produced with the Small C compiler - * it was written as a statement saying that it is possible to * write something easily, quickly and efficiently using the * compiler. Hopefully it will be an encouragement for others to * do likewise! * * Enough twaddle, enjoy the game and study the source! * * d. 1/12/98 * * * * * * * * Compile examples: To get a TI82 version of the game (optionally you could add sound): zcc +ti82 -create-app dstar.c To get a TI85 version of the game (optionally you could add sound): zcc +ti85 -Dspritesize=7 -create-app dstar.c To get a Spectrum 16K version of the game: zcc +zx -Dspritesize=16 -DSOUND -create-app -zorg=24300 dstar.c To get an 80 pixel graphics version of the game (Mattel Aquarius, etc): zcc +aquarius -Dspritesize=5 -create-app dstar.c */ #include #include #include #include #ifdef SOUND #include #endif /* #define spritesize 5 --> very low resolutions, 80x45 pixels */ /* #define spritesize 6 --> TI mode, 96x54 */ /* #define spritesize 8 --> 128x72 pixels */ /* #define spritesize 16 --> Big screen mode 256x144 */ #ifndef spritesize #define spritesize 6 #endif /* Single sprite memory usage, including bytes for its size */ #if (spritesize == 16) #define spritemem 34 #else #define spritemem (spritesize+2) #endif #include "dstar.h" void main() { Level = (STARTLEV-1); SetupLevel(); /* Display the first level */ /* Loop keyhandler till you finished the game */ while (CheckNotFinished()) Gamekeys(); } void Gamekeys(void) { char *charptr; /* Set up a pointer to the variable we want to change * (either the box or the ball) */ charptr = PieceIsBall ? &BoxOffset : &BallOffset; switch(getk()) { case K_DOWN: MovePiece(charptr,0,+1); break; case K_UP: MovePiece(charptr,0,-1); break; case K_RIGHT: MovePiece(charptr,+1,0); break; case K_LEFT: MovePiece(charptr,-1,0); break; case K_SWITCH: PieceIsBall^=1; /* Toggle ball/box */ #ifdef SOUND bit_fx4 (5); #endif while (getk() != 0) {} break; case K_EXIT: exit(0); case K_NEXTLEV: /* Okay this IS cheating... */ if(++Level==MAXLEVEL) { --Level; break; } SetupLevel(); break; case K_PREVLEV: if(--Level==-1) { ++Level; break; } /* fall thrue */ case K_CLEAR: #ifdef SOUND bit_fx4 (3); #endif SetupLevel(); } } /* The level is stored 'compressed', taking up 38 bytes a time. * byte 0 - position of ball * byte 1 - position of box * 2-37 - Level data * * Level data is stored as two bits per block, so we have to shift our * picked up byte round to get it. */ void SetupLevel(void) { int x; char *ptr,*ptr2; /* Fresh level, so start with the ball */ PieceIsBall = FALSE; ptr2 = Board; /* We copy to the Board */ ptr = levels + (Level * 38); /* from the Level data */ /* First two bytes are the ball and the box position */ BallOffset = *ptr++; BoxOffset = *ptr++; /* Decompress Level into the Board */ for (x=0; x!=36; x++) { *ptr2++=((*ptr)>>6)&3; *ptr2++=((*ptr)>>4)&3; *ptr2++=((*ptr)>>2)&3; *ptr2++=( *ptr) &3; ptr++; } /* Put the ball and box into their Board position */ *(Board+BallOffset) = BALL; *(Board+BoxOffset) = BOX; DrawBoard(); /* Display the clean Board */ #ifdef SOUND bit_fx4 (1); #endif } void DrawBoard(void) { int x,y; char *ptr; ptr = Board; clg(); /* clear the screen */ for (y=0 ; y!=9 ; y++) { for (x=0 ; x!=16 ; x++) { putsprite(spr_or,(x*spritesize),(y*spritesize),sprites + (spritemem * (*ptr++))); } } } /* Check if a Level is (not) finished: * There are 144 squares in each Level * * Note the use of != instead of < or <= * - this is faster to execute on the Z80! */ char CheckNotFinished(void) { char *ptr; int i; ptr = Board; for(i=1 ; i!=144 ; i++) { if(*ptr++ == BUBB) return(TRUE); /* Are there any bubbles? */ } if(++Level == MAXLEVEL) return(FALSE); /* All levels done? */ SetupLevel(); /* If not => Next Level! */ return(TRUE); /* And keep scanning keys */ } /* Check to see if we're running into anything: * - The box stops for everything (exept empty space [= 0]) * - The ball stops for everything exept a bubble */ char TestNextPosIsStop(char nextpos) { if(!PieceIsBall) if (nextpos==BUBB) return(FALSE); return(nextpos); } void MovePiece(char *ptr, char plusx, char plusy) { char *locn; char temp,temp2; int x,y; temp = PieceIsBall + 3; temp2 = (plusx + (plusy * 16)); while(1) /* loop */ { locn = *(ptr) + Board; if(TestNextPosIsStop(*(locn+temp2))) return; /* till edge */ y = (*(ptr) / 16); x = (*(ptr) - (y * 16)) * spritesize; y *= spritesize; if(*(locn+temp2)==BUBB) { putsprite(spr_xor,x+(plusx*spritesize),y+(plusy*spritesize),sprites + (spritemem * BUBB)); #ifdef SOUND bit_fx2 (5); #endif } *(locn+temp2) = *locn; *locn = 0; /* remove old */ putsprite(spr_xor,x,y,sprites + (spritemem * temp)); /* put new */ putsprite(spr_xor,x+(plusx*spritesize),y+(plusy*spritesize),sprites + (spritemem * temp)); #ifdef SOUND bit_fx2 (2); #endif (*ptr) += temp2; } } z88dk-1.8.ds1/examples/dstar.h0000644000175000017500000004621510551671725015631 0ustar tygrystygrys#pragma string name DStar #pragma output nostreams void MovePiece(char *ptr, char plusx, char plusy); char TestNextPosIsStop(char nextpos); char CheckNotFinished(void); void SetupLevel(void); void DrawBoard(void); void Gamekeys(void); char BallOffset; /* Ball position */ char BoxOffset; /* Box position */ char PieceIsBall; /* 1 = box, 0 = ball */ char Level; /* Guess! */ char Board[144]; /* Space for decompressed Level */ #define MAXLEVEL 25 /* Highest Level */ #define STARTLEV 1 /* Start Level */ #define TRUE 1 #define FALSE 0 /* Block numbers.. */ #define WALL 1 #define BUBB 2 #define BALL 3 #define BOX 4 #define K_NEXTLEV '+' #define K_PREVLEV '-' #if defined __TI82__ || defined __TI83__ || defined __TI8X__ || defined __TI85__ || defined __TI86__ #define K_UP 11 /* arrow up */ #define K_DOWN 10 /* arrow down */ #define K_LEFT 8 /* arrow left */ #define K_RIGHT 9 /* arrow right */ #define K_SWITCH 13 /* [Enter] */ #define K_EXIT '7' /* [Esc]/[Quit] */ #define K_CLEAR '9' #endif #if defined __ZX81__ || defined __VZ200__ || defined __NASCOM__ #define K_UP 'Q' /* arrow up */ #define K_DOWN 'A' /* arrow down */ #define K_LEFT 'O' /* arrow left */ #define K_RIGHT 'P' /* arrow right */ #define K_SWITCH ' ' /* [SPACE] */ #define K_EXIT 'G' /* [Esc]/[Quit] */ #define K_CLEAR 'H' #endif //#if defined __SPECTRUM__ || defined __Z88__ || defined __ACE__ || defined __CPC__ #ifndef K_UP #define K_UP 'q' /* arrow up */ #define K_DOWN 'a' /* arrow down */ #define K_LEFT 'o' /* arrow left */ #define K_RIGHT 'p' /* arrow right */ #define K_SWITCH ' ' /* [SPACE] */ #define K_EXIT 'g' /* [Esc]/[Quit] */ #define K_CLEAR 'h' #endif extern char levels[]; extern char sprites[]; #if (spritesize == 5) #asm ._sprites defb 5,5 defb @00000000 ; empty sprite defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 5,5 defb @11110000 ;1=edge, defb @10110000 defb @11010000 defb @11110000 defb @00000000 defb 5,5 defb @01100000 ;2=bubble defb @10010000 defb @10010000 defb @01100000 defb @00000000 defb 5,5 defb @01100000 ;3=moveable ball defb @11010000 defb @11110000 defb @01100000 defb @00000000 defb 5,5 defb @11110000 ;4=moveable block defb @10010000 defb @10010000 defb @11110000 defb @00000000 #endasm #endif #if (spritesize == 6) #asm ._sprites defb 6,6 defb @00000000 ; empty sprite defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 6,6 defb @01111000 ;1=edge, defb @10000100 defb @10000100 defb @10000100 defb @10000100 defb @01111000 defb 6,6 defb @00000000 ;2=bubble defb @00110000 defb @01001000 defb @01001000 defb @00110000 defb @00000000 defb 6,6 defb @00000000 ;3=moveable ball defb @00110000 defb @01101000 defb @01111000 defb @00110000 defb @00000000 defb 6,6 defb @00000000 ;4=moveable block defb @01111000 defb @01001000 defb @01001000 defb @01111000 defb @00000000 #endasm #endif #if (spritesize == 7) #asm ._sprites defb 7,7 ;0=blank defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 8,7 ;1=edge, defb @01111110 defb @10101001 defb @11000111 defb @10110001 defb @11001011 defb @10100101 defb @01111110 defb 7,7 ;2=clear ball defb @00000000 defb @00011000 defb @00100100 defb @00100100 defb @00011000 defb @00000000 defb @00000000 defb 7,7 ;3=moveable ball defb @00000000 defb @00011000 defb @00110100 defb @00111100 defb @00011000 defb @00000000 defb @00000000 defb 7,7 ;4=moveable block defb @00000000 defb @00111100 defb @00111100 defb @00111100 defb @00111100 defb @00000000 defb @00000000 #endasm #endif #if (spritesize == 8) #asm ._sprites defb 8,8 defb @00000000 ; empty sprite defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 8,8 defb @01111110 ;1=edge, defb @10101001 defb @11000111 defb @10110001 defb @11001011 defb @10100101 defb @10101001 defb @01111110 defb 8,8 defb @00000000 ;2=bubble defb @00000000 defb @00011000 defb @00100100 defb @00100100 defb @00011000 defb @00000000 defb @00000000 defb 8,8 defb @00000000 ;3=moveable ball defb @00111100 defb @01110110 defb @01111010 defb @01111010 defb @01111110 defb @00111100 defb @00000000 defb 8,8 defb @00000000 ;4=moveable block defb @01111110 defb @01000010 defb @01000010 defb @01000010 defb @01000010 defb @01111110 defb @00000000 #endasm #endif #if (spritesize == 16) #asm ._sprites defb 16,16 defw 0,0,0,0,0,0,0,0 ; empty sprite defw 0,0,0,0,0,0,0,0 defb 16,16 defb @01111111, @11111110 ;1=edge, defb @10101010, @10101001 defb @11010101, @01000001 defb @10101000, @00000001 defb @11010000, @00000001 defb @10100000, @00000001 defb @11000000, @00000001 defb @10000000, @00000001 defb @10000000, @00000001 defb @10000000, @00000001 defb @10000000, @00000001 defb @10000000, @00000001 defb @10000000, @00000001 defb @10000000, @00000001 defb @10000000, @00000001 defb @01111111, @11111110 defb 16,16 defb @00000000, @00000000 ;2=bubble, defb @00000000, @00000000 defb @00000000, @00000000 defb @00000000, @00000000 defb @00000011, @11000000 defb @00000100, @00100000 defb @00001000, @10010000 defb @00001000, @01010000 defb @00001000, @00010000 defb @00001000, @00010000 defb @00000100, @00100000 defb @00000011, @11000000 defb @00000000, @00000000 defb @00000000, @00000000 defb @00000000, @00000000 defb @00000000, @00000000 defb 16,16 defb @00000000, @00000000 ;3=moveable ball defb @00000000, @00000000 defb @00000011, @11000000 defb @00001111, @00110000 defb @00011111, @11011000 defb @00011111, @11101000 defb @00111111, @11101100 defb @00111111, @11111100 defb @00111111, @11111100 defb @00111111, @11111100 defb @00011111, @11111000 defb @00011111, @11111000 defb @00001111, @11110000 defb @00000011, @11000000 defb @00000000, @00000000 defb @00000000, @00000000 defb 16,16 defb @00000000, @00000000 ;4=moveable block defb @01111111, @11111110 defb @01001101, @10110010 defb @01011111, @11111010 defb @01110000, @00001110 defb @01110000, @00001110 defb @01010000, @00001010 defb @01110000, @00001110 defb @01110000, @00001110 defb @01010000, @00001010 defb @01110000, @00001110 defb @01110000, @00001110 defb @01011111, @11111010 defb @01001101, @10110010 defb @01111111, @11111110 defb @00000000, @00000000 #endasm #endif #asm ._levels defb 17,30 ;ball offset, box offset defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@00000000,@00000000,@10010001 defb @01000000,@00000000,@00000010,@00010101 defb @01000000,@00000000,@01011000,@00000001 defb @01000000,@01010010,@00000000,@00000101 defb @01010010,@00001000,@00000000,@10000001 defb @01001000,@00000000,@00100101,@00100001 defb @01000000,@00000101,@10000000,@00001001 defb @01010101,@01010101,@01010101,@01010101 .level2 defb 30,86 defb @00010000,@01000100,@01000000,@01000101 defb @01000000,@10000000,@00000000,@00000001 defb @00000001,@10000001,@10000000,@10000000 defb @01000100,@10000000,@00001000,@00010001 defb @00000000,@00000100,@00001000,@00000100 defb @01000000,@00010001,@00001000,@00000001 defb @00000001,@00000100,@01000000,@01101001 defb @01000000,@00000000,@00000000,@00000100 defb @00010000,@01000000,@00000000,@00010000 .level3 defb 30,46 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@10010001 defb @01000000,@01010000,@00000000,@01010001 defb @01000000,@01100000,@00000010,@00000001 defb @01001000,@00000000,@10010100,@00001001 defb @01000110,@00001000,@00100100,@00100101 defb @01000101,@10000110,@00001000,@10010101 defb @01100000,@00000101,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level4 defb 125,30 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01000000,@00000100,@00000000,@00000001 defb @01011001,@10001001,@10011001,@10011001 defb @01000100,@01100010,@01000100,@01000101 defb @01011001,@10011000,@10011001,@10011001 defb @01000000,@00000100,@00000000,@00000001 defb @01000000,@01000000,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level5 defb 17,110 defb @00010101,@01010101,@01010101,@01010100 defb @01000000,@01000000,@01000001,@00000001 defb @01000001,@10000100,@10000010,@00010001 defb @01010000,@00000000,@01000001,@00000001 defb @01100001,@10010000,@00000000,@00000101 defb @01010000,@00000001,@00100001,@00000001 defb @01100100,@00010001,@00010000,@00010001 defb @01000000,@01000000,@00100100,@00011001 defb @00010101,@01010101,@01010101,@01010100 .level6 defb 65,113 defb @00000000,@01010101,@01010101,@01010101 defb @00000001,@00000010,@00000001,@10001001 defb @00000100,@00000010,@00000000,@01000101 defb @00010000,@00000010,@00000000,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01010000,@00000010,@00000100,@00000101 defb @01000000,@00000010,@00000000,@01000001 defb @01000001,@00000010,@00000101,@10000001 defb @01010101,@01010101,@01010101,@01010101 .level7 defb 115,122 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00000001 defb @00010100,@01010100,@00011000,@01011001 defb @00011000,@00011000,@01000100,@01000100 defb @00000100,@00010000,@01010100,@01010000 defb @00010100,@00010000,@01100100,@01100100 defb @01000000,@00000000,@00000000,@00000001 defb @01000000,@01100000,@00000000,@00011001 defb @01010101,@01010101,@01010101,@01010101 .level8 defb 108,98 defb @01010101,@01010101,@01010101,@01010100 defb @01000010,@01010000,@00000000,@00000101 defb @01000001,@10000001,@01001000,@00000001 defb @01000010,@01010001,@00011000,@00000001 defb @01010000,@00000001,@01000001,@10010001 defb @01010001,@00000000,@00000010,@01100001 defb @01100010,@01000000,@10000001,@00010001 defb @01010000,@00000000,@00000000,@00000001 defb @00010101,@01010101,@01010101,@01010101 .level9 defb 30,72 defb @00000100,@01010101,@01010101,@01010100 defb @00011001,@10000000,@00000001,@00000001 defb @01100010,@01000000,@00100000,@00000100 defb @00010001,@00001001,@01000010,@01000001 defb @01000001,@10000110,@00100000,@00001001 defb @01000000,@00001001,@01000000,@00000100 defb @01100110,@00000000,@00000000,@00010000 defb @01000000,@00000000,@00000000,@01000000 defb @01010101,@01010101,@01010101,@00000000 .level10 defb 93,36 defb @00000000,@01010101,@01010101,@01010100 defb @01010101,@00100000,@00000000,@00000001 defb @01000000,@00000101,@01100010,@01001001 defb @01001000,@00000110,@00011000,@00000100 defb @01000000,@00000100,@00100000,@01001001 defb @01100110,@00000100,@10010000,@01000100 defb @00011000,@00000101,@01000001,@01010000 defb @01000000,@00000000,@00000100,@01000100 defb @00010101,@01010101,@01010000,@01000001 .level11 defb 30,108 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000001,@00000000,@00000001 defb @01000001,@10100000,@00000010,@10000101 defb @01010000,@00100000,@00010100,@00001001 defb @01100000,@00000110,@01101000,@00010101 defb @01010001,@01000000,@00010100,@00000001 defb @01100000,@10010010,@00000000,@00001001 defb @01011001,@01010000,@00000100,@00000101 defb @00010100,@01010101,@01010101,@01010100 .level12 defb 17,92 defb @01010000,@00000001,@01000001,@01010100 defb @01000101,@01010110,@00010101,@00100101 defb @01000000,@00101000,@00000000,@10000001 defb @01000101,@00000101,@10000001,@10010001 defb @01000100,@10000101,@01100001,@01000001 defb @01000101,@00000101,@00000001,@00010001 defb @01000000,@00001000,@00000000,@00000001 defb @01000000,@00000000,@00100000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level13 defb 18,113 defb @00010101,@01010101,@01010101,@01010100 defb @01000001,@00000000,@00000000,@10000101 defb @01000100,@00000110,@00000010,@01010001 defb @01000000,@00000000,@10000000,@00010001 defb @01001000,@00000000,@00000000,@00011001 defb @01000100,@00000000,@00100000,@00000001 defb @01010000,@00000000,@10001000,@00011001 defb @01000000,@01000000,@00100001,@00010001 defb @00010101,@01010101,@01010101,@01010100 .level14 defb 36,50 defb @01010101,@01010101,@01010101,@01010101 defb @01100110,@00000000,@00000000,@10011001 defb @01001001,@00000000,@00000001,@01000001 defb @01000000,@00000000,@00000010,@00000001 defb @01000000,@00000000,@00100100,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01001001,@00000000,@00000000,@01000001 defb @01100110,@00000000,@00000000,@10011001 defb @01010101,@01010101,@01010101,@01010101 .level15 defb 51,76 defb @00010101,@01010100,@01010101,@01010100 defb @01000000,@00001001,@00000000,@00100001 defb @01000100,@10000100,@00010000,@00100001 defb @01000000,@01000000,@01101000,@01100001 defb @00010001,@00000001,@00100000,@00010001 defb @01100000,@00000000,@00010000,@01100001 defb @00010000,@00000000,@10000000,@00000100 defb @01100000,@00000000,@00000000,@00001001 defb @00010101,@01010101,@01010101,@01010100 .level16 defb 35,19 defb @01010101,@01010101,@01010101,@01010101 defb @01010000,@01100010,@00000000,@00001001 defb @01100000,@10011000,@00000000,@00000101 defb @01010001,@01010000,@00001000,@00000101 defb @01010000,@00000010,@01100100,@00000001 defb @01101000,@00000000,@00001001,@10000001 defb @01010010,@00000000,@01010101,@10000001 defb @01011001,@00000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level17 defb 29,124 defb @01010101,@01010101,@01010101,@01010101 defb @01001001,@00000000,@00000000,@01000001 defb @01000100,@00100110,@10011000,@00010001 defb @01000000,@00011001,@01100100,@10000001 defb @01001001,@00000000,@00000010,@01000001 defb @01000010,@01100000,@00001001,@00000001 defb @01000100,@00010001,@01100100,@00010001 defb @01000000,@00100001,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level18 defb 115,26 defb @01010101,@01010101,@01010101,@01010101 defb @01001000,@00000010,@00000001,@00000001 defb @01000001,@10011000,@00000110,@00000001 defb @01000000,@01100100,@00000001,@10000001 defb @01000000,@10000001,@00000010,@01100001 defb @01000110,@01000000,@01001001,@00000001 defb @01001001,@10000100,@10000100,@00000001 defb @01100100,@00000100,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level19 defb 126,110 defb @01010101,@01010101,@01010101,@01010101 defb @01100000,@00010100,@00000000,@01011001 defb @01000100,@00010000,@00000000,@01100001 defb @01001001,@00000010,@01010000,@10000001 defb @01000100,@00000001,@10000000,@00000001 defb @01000000,@00010000,@00100100,@00000001 defb @01000101,@00100100,@01011000,@00010001 defb @01001001,@00011000,@00000000,@01010001 defb @01010101,@01010101,@01010101,@01010101 .level20 defb 77,66 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@10011000,@00000000,@00000001 defb @01011000,@00100100,@01011000,@00000101 defb @01000100,@01001000,@00000100,@00010001 defb @01000000,@01000001,@01000001,@00001001 defb @01000100,@00010000,@00100001,@00010001 defb @01010000,@00100101,@00011000,@00100101 defb @01000000,@00000000,@00100110,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level21 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@01000000,@00001000,@00000101 defb @01000000,@01000000,@00000000,@01000101 defb @01000000,@01011000,@00000000,@00100001 defb @01000010,@00000000,@10000000,@10000101 defb @01000000,@00010000,@00000101,@01100001 defb @01000010,@00100000,@00000010,@00101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level22 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01100100,@00011001,@00011000,@00010001 defb @01000000,@00010000,@00000000,@00000001 defb @01100000,@00010000,@01100000,@10000001 defb @01010001,@10000000,@00000010,@00010101 defb @01001000,@01000000,@01010110,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level23 defb 103,105 defb @00010101,@01010101,@01010101,@01010100 defb @01000100,@00011001,@00011000,@00010001 defb @01000000,@00100000,@01000000,@00000001 defb @01010000,@00010000,@00100001,@10000001 defb @01000001,@10000001,@00001010,@00100001 defb @01011000,@01000000,@01010010,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @00010101,@01010101,@01010101,@01010100 defb @00000000,@00000000,@00000000,@00000000 .level24 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000100,@00000000,@00000101 defb @01000101,@10001000,@00000001,@01100101 defb @01000110,@00000000,@00100100,@00010101 defb @01001010,@00001001,@00010100,@00000001 defb @01000110,@00100001,@00000000,@01010001 defb @01000101,@00000000,@01000101,@01101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level25 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01001000,@01011000,@00001000,@00000001 defb @01000000,@01100000,@10000001,@01000001 defb @01001000,@00000001,@01000001,@10000001 defb @01000110,@00000010,@01000000,@00100001 defb @01000101,@10000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 #endasm z88dk-1.8.ds1/examples/embedded/0000755000175000017500000000000010765202715016060 5ustar tygrystygrysz88dk-1.8.ds1/examples/embedded/clib2.lst0000644000175000017500000000002607553527564017612 0ustar tygrystygrysfgetc_cons fputc_cons z88dk-1.8.ds1/examples/embedded/fgetc_cons.asm0000644000175000017500000000040407553527564020707 0ustar tygrystygrys; ; Embedded C Library ; ; fgetc_cons ; ; Daniel Wallner - Mar. 2002 ; INCLUDE "ns16450.def" XLIB fgetc_cons .fgetc_cons ld bc,UART_BASE + LSR loop: in a,(c) and a,$1 jr z,loop ld bc,UART_BASE in a,(c) ld l,a ret z88dk-1.8.ds1/examples/embedded/fputc_cons.asm0000644000175000017500000000044607553527564020746 0ustar tygrystygrys; ; Embedded C Library ; ; fputc_cons ; ; Daniel Wallner - Mar. 2002 ; INCLUDE "ns16450.def" XLIB fputc_cons .fputc_cons ld bc,UART_BASE + LSR loop: in a,(c) and a,$20 jr z,loop ld hl,2 add hl,sp ld a,(hl) ld bc,UART_BASE out (c),a ret z88dk-1.8.ds1/examples/embedded/hello.c0000644000175000017500000000013607553524052017331 0ustar tygrystygrys#include #include "ns16450.h" main() { init_uart(0,1); printf("Hello world!"); } z88dk-1.8.ds1/examples/embedded/loop.c0000644000175000017500000000030507553524052017175 0ustar tygrystygrys/* * Z80 test * * UART loop back * */ #include #include #include "ns16450.h" int main(void) { char c; init_uart(0,1); for (;;) { c = getchar(); putchar(c); } } z88dk-1.8.ds1/examples/embedded/Makefile0000644000175000017500000000130007555321613017514 0ustar tygrystygrys all: embedded_clib2.lib hello.bin sine.bin loop.bin savage.bin embedded_clib2.lib: fputc_cons.asm fgetc_cons.asm z80asm -d -ns -nm -Mo -DFORembedded -xembedded_clib2 @clib2.lst ns16450.o: embedded_clib2.lib ns16450.h ns16450.c zcc +embedded -c ns16450.c hello.bin: embedded_clib2.lib ns16450.o hello.c zcc +embedded ns16450.o hello.c -o hello.bin sine.bin: embedded_clib2.lib ns16450.o sine.c zcc +embedded -lm ns16450.o sine.c -o sine.bin loop.bin: embedded_clib2.lib ns16450.o loop.c zcc +embedded -lm ns16450.o loop.c -o loop.bin savage.bin: embedded_clib2.lib ns16450.o savage.c zcc +embedded -lm ns16450.o savage.c -o savage.bin clean: $(RM) *.bin *.i *.lib *.op* *.o *~ zcc_opt.def z88dk-1.8.ds1/examples/embedded/ns16450.c0000644000175000017500000000035507553527564017264 0ustar tygrystygrys#include "ns16450.h" extern void init_uart(unsigned char DM, unsigned char DL) { output8(UART_BASE + LCR, 0x80); /* DLAB = 1 */ output8(UART_BASE + DLL, DL); output8(UART_BASE + DLM, DM); output8(UART_BASE + LCR, 0x03); /* N81 */ } z88dk-1.8.ds1/examples/embedded/ns16450.def0000644000175000017500000000041707553527564017577 0ustar tygrystygrys; ; Embedded C Library ; ; UART definitions ; ; Daniel Wallner - Feb. 2002 ; ; DEFC UART_BASE = $0000 DEFC RBR = 0 DEFC THR = 0 DEFC IER = 1 DEFC IIR = 2 DEFC LCR = 3 DEFC MCR = 4 DEFC LSR = 5 DEFC MSR = 6 DEFC SCR = 7 DEFC DLL = 0 DEFC DLM = 1 z88dk-1.8.ds1/examples/embedded/ns16450.h0000644000175000017500000000056407553527564017273 0ustar tygrystygrys/* UART definitions Daniel Wallner - Feb. 2002 */ #define UART_BASE 0x0000 #define RBR 0 #define THR 0 #define IER 1 #define IIR 2 #define LCR 3 #define MCR 4 #define LSR 5 #define MSR 6 #define SCR 7 #define DLL 0 #define DLM 1 extern void __LIB__ output8(unsigned short addr, unsigned char data); extern void init_uart(unsigned char DM, unsigned char DL); z88dk-1.8.ds1/examples/embedded/savage.c0000644000175000017500000000046407553524052017500 0ustar tygrystygrys/* Program Savage; see Byte, Oct '87, p. 277 */ #include #include #include "ns16450.h" #define ILOOP 500 int main(void) { int i; float a; init_uart(0,1); a = 1.0; for(i = 0; i < ILOOP; ++i) { a = tan(atan(exp(log(sqrt(a * a))))); printf("A = %f\n", a); a += 1.0; } } z88dk-1.8.ds1/examples/embedded/sine.c0000644000175000017500000000063607553524052017171 0ustar tygrystygrys/* * Z80 test * * Print stars in sine pattern * */ #include #include #include "ns16450.h" int main(void) { float spunk; char res; char p; init_uart(0,1); while (1) { for (spunk = 0.0; spunk < 6.283; spunk = spunk + 0.1) { res = 30.0 * sin(spunk) + 40.0; for (p = 0; p < res; ++p) { putchar(' '); } putchar('*'); putchar(0x0d); putchar(0x0a); } } } z88dk-1.8.ds1/examples/graphics/0000755000175000017500000000000010765202715016127 5ustar tygrystygrysz88dk-1.8.ds1/examples/graphics/chessb16.h0000755000175000017500000001222710565630351017724 0ustar tygrystygrys/* Mid size chessboard (16x16) Converted from ZX to BMP and then from BMP to sprites with the Daniel McKinnon's z88dk Sprite Editor This one is another fancy replacement for "chessboard.h" */ #include #include #define P_BLACK 1 #define P_WHITE 0 #define P_PAWN 0 #define P_ROOK 3 #define P_KNIGHT 2 #define P_BISHOP 1 #define P_QUEEN 4 #define P_KING 5 char pieces[] = { 16, 16, 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x80 , 0x03 , 0xC0 , 0x02 , 0x40 , 0x02 , 0x40 , 0x01 , 0x80 , 0x03 , 0xC0 , 0x06 , 0x60 , 0x04 , 0x20 , 0x06 , 0x60 , 0x02 , 0x40 , 0x0E , 0x70 , 0x08 , 0x10 , 0x1F , 0xF8 , 0x00 , 0x00 , 16, 16, 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x80 , 0x03 , 0xC0 , 0x03 , 0xC0 , 0x03 , 0xC0 , 0x01 , 0x80 , 0x03 , 0xC0 , 0x07 , 0xE0 , 0x07 , 0xE0 , 0x07 , 0xE0 , 0x03 , 0xC0 , 0x0F , 0xF0 , 0x0F , 0xF0 , 0x1F , 0xF8 , 0x00 , 0x00 , 16, 16, 0x00 , 0x00 , 0x03 , 0xC0 , 0x07 , 0xE0 , 0x07 , 0xE0 , 0x07 , 0xE0 , 0x07 , 0xE0 , 0x07 , 0xE0 , 0x0F , 0xF0 , 0x0F , 0xF0 , 0x0F , 0xF0 , 0x0F , 0xF0 , 0x1F , 0xF8 , 0x1F , 0xF8 , 0x3F , 0xFC , 0x3F , 0xFC , 0x00 , 0x00 , 16, 16, 0x00 , 0x00 , 0x06 , 0x60 , 0x06 , 0x60 , 0x0F , 0x70 , 0x09 , 0x90 , 0x18 , 0xD8 , 0x12 , 0x48 , 0x17 , 0x68 , 0x12 , 0x28 , 0x12 , 0x38 , 0x18 , 0x18 , 0x08 , 0x10 , 0x0C , 0x30 , 0x04 , 0x20 , 0x3F , 0xFC , 0x7F , 0xFE , 16, 16, 0x00 , 0x00 , 0x06 , 0x60 , 0x06 , 0x60 , 0x0F , 0x70 , 0x0F , 0xF0 , 0x1F , 0xB8 , 0x1D , 0xD8 , 0x18 , 0xD8 , 0x1D , 0xE8 , 0x1D , 0xE8 , 0x1F , 0xE8 , 0x0F , 0xF0 , 0x0F , 0xF0 , 0x07 , 0xE0 , 0x3F , 0xFC , 0x7F , 0xFE , 16, 16, 0x07 , 0xE0 , 0x0F , 0xF0 , 0x1F , 0xF8 , 0x1F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x1F , 0xF8 , 0x7F , 0xFE , 0xFF , 0xFF , 0xFF , 0xFF , 16, 16, 0x00 , 0x00 , 0x03 , 0x60 , 0x07 , 0xE0 , 0x04 , 0x30 , 0x0C , 0x18 , 0x19 , 0x88 , 0x33 , 0x0C , 0x60 , 0x04 , 0x40 , 0x26 , 0x40 , 0x66 , 0x47 , 0xC2 , 0x7D , 0x82 , 0x03 , 0x02 , 0x06 , 0x02 , 0x04 , 0x02 , 0x07 , 0xFE , 16, 16, 0x00 , 0x00 , 0x03 , 0x60 , 0x07 , 0xF0 , 0x07 , 0xF0 , 0x0F , 0xF8 , 0x1D , 0xF8 , 0x39 , 0xFC , 0x7F , 0xFC , 0x7F , 0xDE , 0x7F , 0xBE , 0x7F , 0x7E , 0x7C , 0xFE , 0x03 , 0xFE , 0x07 , 0xFE , 0x07 , 0xFE , 0x07 , 0xFE , 16, 16, 0x07 , 0xF0 , 0x0F , 0xF0 , 0x0F , 0xF8 , 0x1F , 0xFC , 0x3F , 0xFC , 0x7F , 0xFE , 0xFF , 0xFE , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0x0F , 0xFF , 0x0F , 0xFF , 0x0F , 0xFF , 16, 16, 0x00 , 0x00 , 0x3B , 0xDC , 0x2A , 0x54 , 0x2E , 0x74 , 0x20 , 0x04 , 0x30 , 0x0C , 0x1F , 0xF8 , 0x08 , 0x10 , 0x08 , 0x10 , 0x08 , 0x10 , 0x08 , 0x10 , 0x08 , 0x10 , 0x1F , 0xF8 , 0x30 , 0x0C , 0x20 , 0x04 , 0x7F , 0xFE , 16, 16, 0x00 , 0x00 , 0x3B , 0xDC , 0x3B , 0xDC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x18 , 0x18 , 0x0F , 0xF0 , 0x0F , 0xF0 , 0x0F , 0xF0 , 0x0F , 0xF0 , 0x0F , 0xF0 , 0x18 , 0x18 , 0x3F , 0xFC , 0x3F , 0xFC , 0x7F , 0xFE , 16, 16, 0x7F , 0xFE , 0x7F , 0xFE , 0x7F , 0xFE , 0x7F , 0xFE , 0x7F , 0xFE , 0x7F , 0xFE , 0x7F , 0xFE , 0x3F , 0xFC , 0x1F , 0xF8 , 0x1F , 0xF8 , 0x1F , 0xF8 , 0x3F , 0xFC , 0x7F , 0xFE , 0x7F , 0xFE , 0xFF , 0xFF , 0xFF , 0xFF , 16, 16, 0x00 , 0x00 , 0x1C , 0x38 , 0x14 , 0x28 , 0x1C , 0x38 , 0x0C , 0x30 , 0x7E , 0x7E , 0x5A , 0x5A , 0x73 , 0xCE , 0x3D , 0xBC , 0x29 , 0x94 , 0x39 , 0x9C , 0x1F , 0xF8 , 0x10 , 0x08 , 0x15 , 0xA8 , 0x10 , 0x08 , 0x1F , 0xF8 , 16, 16, 0x00 , 0x00 , 0x1C , 0x38 , 0x14 , 0x28 , 0x1C , 0x38 , 0x0C , 0x30 , 0x7E , 0x7E , 0x5A , 0x5A , 0x7E , 0x7E , 0x37 , 0xEC , 0x3F , 0xFC , 0x3F , 0xFC , 0x1F , 0xF8 , 0x10 , 0x08 , 0x1F , 0xF8 , 0x15 , 0xA8 , 0x1F , 0xF8 , 16, 16, 0x3E , 0x7C , 0x3E , 0x7C , 0x3E , 0x7C , 0x3F , 0xFC , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0x7F , 0xFE , 0x7F , 0xFE , 0x7F , 0xFE , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 16, 16, 0x00 , 0x00 , 0x01 , 0x80 , 0x19 , 0x98 , 0x37 , 0xEC , 0x67 , 0xE6 , 0x41 , 0x82 , 0x45 , 0xA2 , 0x48 , 0x12 , 0x68 , 0x16 , 0x38 , 0x1C , 0x14 , 0x28 , 0x10 , 0x08 , 0x1F , 0xF8 , 0x15 , 0xA8 , 0x15 , 0xA8 , 0x1F , 0xF8 , 16, 16, 0x00 , 0x00 , 0x01 , 0x80 , 0x19 , 0x98 , 0x37 , 0xEC , 0x77 , 0xEE , 0x79 , 0x9E , 0x7D , 0xBE , 0x7A , 0x5E , 0x77 , 0xEE , 0x37 , 0xEC , 0x1B , 0xD8 , 0x1F , 0xF8 , 0x10 , 0x08 , 0x1F , 0xF8 , 0x15 , 0xA8 , 0x1F , 0xF8 , 16, 16, 0x03 , 0xC0 , 0x1F , 0xF8 , 0x3F , 0xFC , 0x7F , 0xFE , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0x7F , 0xFE , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC , 0x3F , 0xFC }; PutPiece (int x, int y, int piece,int b_w) { putsprite(spr_and,6+16*x+7*y,7*y,pieces+68+piece*102); putsprite(spr_or,6+16*x+7*y,7*y,pieces+34*b_w+piece*102); } DrawBoard() { int x,y,z,a,b; clg(); for (x=1 ; x!=59; x++) { draw(x,x+10,x+129,x+10); } for (x=0 ; x!=8; x++) { for (y=0 ; y!=8; y++) { if (!((x+y) & 1)) { for (z=0 ; z!=7; z++) { a=3+16*x+7*y+z; b=12+7*y+z; undraw(a,b,a+14,b); } } } } } z88dk-1.8.ds1/examples/graphics/chessboard.c0000644000175000017500000000240707340500337020407 0ustar tygrystygrys/* Chessboard lib demo/test program By Stefano Bodrato - 13/08/2001 $Id: chessboard.c,v 1.2 2001/08/21 15:40:15 stefano Exp $ */ #if defined __TI85__ || defined __TI86__ || defined __Z88__ || defined __VZ200__ #include #else #include #endif Main() { int x; DrawBoard(); //Black Rook PutPiece (0,0,P_ROOK,P_BLACK); PutPiece (7,0,P_ROOK,P_BLACK); //Black Knight PutPiece (1,0,P_KNIGHT,P_BLACK); PutPiece (6,0,P_KNIGHT,P_BLACK); //Black Bishop PutPiece (2,0,P_BISHOP,P_BLACK); PutPiece (5,0,P_BISHOP,P_BLACK); //Black Queen PutPiece (3,0,P_QUEEN,P_BLACK); //Black King PutPiece (4,0,P_KING,P_BLACK); //Black Pawn for (x=0 ; x!=8; x++) { PutPiece (x,1,P_PAWN,P_BLACK); } //White Pawn for (x=0 ; x!=8; x++) { PutPiece (x,6,P_PAWN,P_WHITE); } //White Rook PutPiece (0,7,P_ROOK,P_WHITE); PutPiece (7,7,P_ROOK,P_WHITE); //White Knight PutPiece (1,7,P_KNIGHT,P_WHITE); PutPiece (6,7,P_KNIGHT,P_WHITE); //White Bishop PutPiece (2,7,P_BISHOP,P_WHITE); PutPiece (5,7,P_BISHOP,P_WHITE); //White Queen PutPiece (3,7,P_QUEEN,P_WHITE); //White King PutPiece (4,7,P_KING,P_WHITE); } z88dk-1.8.ds1/examples/graphics/chessboard.h0000644000175000017500000003146407437200462020424 0ustar tygrystygrys/* Normal size chessboard by Stefano Bodrato - 27/02/2002 Converted from ZX to BMP and then from BMP to sprites with the Daniel McKinnon's z88dk Sprite Editor */ #include #include #define P_BLACK 1 #define P_WHITE 0 #define P_PAWN 5 #define P_ROOK 0 #define P_KNIGHT 1 #define P_BISHOP 2 #define P_QUEEN 4 #define P_KING 3 char pieces[] = { 21, 23, 0x00 , 0x00 , 0x00 , 0x3D , 0xF7 , 0x80 , 0x25 , 0x14 , 0x80 , 0x25 , 0x14 , 0x80 , 0x27 , 0x1C , 0x80 , 0x20 , 0x00 , 0x80 , 0x18 , 0x03 , 0x00 , 0x04 , 0x04 , 0x00 , 0x04 , 0x04 , 0x00 , 0x04 , 0x84 , 0x00 , 0x04 , 0x84 , 0x00 , 0x04 , 0x04 , 0x00 , 0x04 , 0x84 , 0x00 , 0x04 , 0x84 , 0x00 , 0x04 , 0x84 , 0x00 , 0x04 , 0x84 , 0x00 , 0x08 , 0x82 , 0x00 , 0x11 , 0x01 , 0x00 , 0x20 , 0x00 , 0x80 , 0x40 , 0x00 , 0x40 , 0x40 , 0x00 , 0x40 , 0x7F , 0xFF , 0xC0 , 0x00 , 0x00 , 0x00 , 21, 23, 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x3F , 0xFF , 0x80 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x1F , 0xFF , 0x00 , 0x3F , 0xFF , 0x80 , 0x7F , 0xFF , 0xC0 , 0xFF , 0xFF , 0xE0 , 0xFF , 0xFF , 0xE0 , 0xFF , 0xFF , 0xE0 , 0xFF , 0xFF , 0xE0 , 21, 23, 0x00 , 0x00 , 0x00 , 0x03 , 0xE0 , 0x00 , 0x0C , 0x18 , 0x00 , 0x11 , 0x84 , 0x00 , 0x22 , 0x02 , 0x00 , 0x24 , 0x19 , 0x00 , 0x40 , 0x00 , 0x80 , 0x40 , 0x00 , 0x40 , 0x40 , 0x00 , 0x20 , 0x40 , 0x00 , 0x20 , 0x40 , 0x3E , 0x20 , 0x20 , 0x21 , 0xC0 , 0x20 , 0x10 , 0x00 , 0x10 , 0x10 , 0x00 , 0x11 , 0x08 , 0x00 , 0x09 , 0x08 , 0x00 , 0x09 , 0x04 , 0x00 , 0x12 , 0x02 , 0x00 , 0x24 , 0x01 , 0x00 , 0x40 , 0x00 , 0x80 , 0x40 , 0x00 , 0x80 , 0x7F , 0xFF , 0x80 , 0x00 , 0x00 , 0x00 , 21, 23, 0x03 , 0xE0 , 0x00 , 0x0F , 0xF0 , 0x00 , 0x1F , 0xFC , 0x00 , 0x3F , 0xFE , 0x00 , 0x7F , 0xFF , 0x00 , 0x7F , 0xFF , 0x80 , 0xFF , 0xFF , 0xC0 , 0xFF , 0xFF , 0xE0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 0x7F , 0xFF , 0xE0 , 0x3F , 0xF9 , 0xC0 , 0x3F , 0xF8 , 0x00 , 0x3F , 0xFC , 0x00 , 0x1F , 0xFC , 0x00 , 0x1F , 0xFE , 0x00 , 0x3F , 0xFF , 0x00 , 0x7F , 0xFF , 0x80 , 0xFF , 0xFF , 0xC0 , 0xFF , 0xFF , 0xC0 , 0xFF , 0xFF , 0xC0 , 0xFF , 0xFF , 0xC0 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0x40 , 0x00 , 0x00 , 0xA0 , 0x00 , 0x01 , 0x10 , 0x00 , 0x02 , 0x08 , 0x00 , 0x02 , 0xE8 , 0x00 , 0x05 , 0xF4 , 0x00 , 0x05 , 0x14 , 0x00 , 0x04 , 0x04 , 0x00 , 0x04 , 0x04 , 0x00 , 0x07 , 0x1C , 0x00 , 0x01 , 0x10 , 0x00 , 0x02 , 0x88 , 0x00 , 0x05 , 0x04 , 0x00 , 0x09 , 0x02 , 0x00 , 0x08 , 0x02 , 0x00 , 0x0A , 0x02 , 0x00 , 0x0A , 0x02 , 0x00 , 0x0A , 0x02 , 0x00 , 0x08 , 0x02 , 0x00 , 0x04 , 0x04 , 0x00 , 0x0F , 0xFE , 0x00 , 0x00 , 0x00 , 0x00 , 21, 23, 0x00 , 0x40 , 0x00 , 0x00 , 0xE0 , 0x00 , 0x01 , 0xF0 , 0x00 , 0x03 , 0xF8 , 0x00 , 0x07 , 0xF8 , 0x00 , 0x07 , 0xFC , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x07 , 0xFC , 0x00 , 0x0F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x0F , 0xFE , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x00 , 0x60 , 0x50 , 0x30 , 0x50 , 0x50 , 0x50 , 0x28 , 0x88 , 0xA0 , 0x24 , 0x89 , 0x20 , 0x25 , 0x05 , 0x20 , 0x13 , 0x06 , 0x40 , 0x11 , 0x04 , 0x40 , 0x11 , 0x8C , 0x40 , 0x10 , 0x88 , 0x40 , 0x10 , 0x20 , 0x40 , 0x10 , 0x20 , 0x40 , 0x14 , 0xD8 , 0x40 , 0x14 , 0x20 , 0x40 , 0x10 , 0x20 , 0x40 , 0x12 , 0x00 , 0x40 , 0x12 , 0x00 , 0x40 , 0x12 , 0x00 , 0x40 , 0x10 , 0x00 , 0x40 , 0x0F , 0xFF , 0x80 , 0x00 , 0x00 , 0x00 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x00 , 0x60 , 0x70 , 0x30 , 0xF0 , 0xF8 , 0x78 , 0xF8 , 0xF8 , 0xF8 , 0x7D , 0xFD , 0xF0 , 0x7F , 0xFF , 0xF0 , 0x7F , 0xFF , 0xF0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x1F , 0xFF , 0xC0 , 0x0F , 0xFF , 0x80 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x00 , 0x60 , 0x50 , 0x30 , 0x50 , 0x50 , 0x50 , 0x28 , 0x88 , 0xA0 , 0x24 , 0x89 , 0x20 , 0x25 , 0x05 , 0x20 , 0x13 , 0x06 , 0x40 , 0x11 , 0x04 , 0x40 , 0x11 , 0x8C , 0x40 , 0x10 , 0x88 , 0x40 , 0x10 , 0x88 , 0x40 , 0x10 , 0x88 , 0x40 , 0x12 , 0x00 , 0x40 , 0x12 , 0x00 , 0x40 , 0x12 , 0x00 , 0x40 , 0x08 , 0x00 , 0x80 , 0x09 , 0x00 , 0x80 , 0x09 , 0x00 , 0x80 , 0x08 , 0x00 , 0x80 , 0x0F , 0xFF , 0x80 , 0x00 , 0x00 , 0x00 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x00 , 0xE0 , 0x70 , 0x38 , 0xF0 , 0x70 , 0x78 , 0xF8 , 0xF8 , 0xF8 , 0x7C , 0xF9 , 0xF0 , 0x7F , 0xFF , 0xF0 , 0x7F , 0xFF , 0xF0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x1F , 0xFF , 0xC0 , 0x1F , 0xFF , 0xC0 , 0x1F , 0xFF , 0xC0 , 0x1F , 0xFF , 0xC0 , 0x1F , 0xFF , 0xC0 , 0x1F , 0xFF , 0xC0 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0xF0 , 0x00 , 0x01 , 0x08 , 0x00 , 0x02 , 0x44 , 0x00 , 0x02 , 0x84 , 0x00 , 0x02 , 0x84 , 0x00 , 0x02 , 0x04 , 0x00 , 0x01 , 0x08 , 0x00 , 0x00 , 0x90 , 0x00 , 0x00 , 0x90 , 0x00 , 0x01 , 0x08 , 0x00 , 0x01 , 0x48 , 0x00 , 0x02 , 0x44 , 0x00 , 0x04 , 0x82 , 0x00 , 0x09 , 0x01 , 0x00 , 0x12 , 0x00 , 0x80 , 0x24 , 0x00 , 0x40 , 0x48 , 0x00 , 0x20 , 0x48 , 0x00 , 0x20 , 0x40 , 0x00 , 0x20 , 0x20 , 0x00 , 0x40 , 0x7F , 0xFF , 0xE0 , 0x00 , 0x00 , 0x00 , 21, 23, 0x00 , 0xF0 , 0x00 , 0x01 , 0xF8 , 0x00 , 0x03 , 0xFC , 0x00 , 0x07 , 0xFE , 0x00 , 0x07 , 0xFE , 0x00 , 0x07 , 0xFE , 0x00 , 0x07 , 0xFE , 0x00 , 0x03 , 0xFC , 0x00 , 0x01 , 0xF8 , 0x00 , 0x01 , 0xF8 , 0x00 , 0x03 , 0xFC , 0x00 , 0x03 , 0xFC , 0x00 , 0x07 , 0xFE , 0x00 , 0x0F , 0xFF , 0x00 , 0x1F , 0xFF , 0x80 , 0x3F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xE0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 0x7F , 0xFF , 0xE0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 21, 23, 0x00 , 0x00 , 0x00 , 0x38 , 0xE3 , 0x80 , 0x38 , 0xE3 , 0x80 , 0x38 , 0xE3 , 0x80 , 0x3F , 0xFF , 0x80 , 0x3F , 0xFF , 0x80 , 0x0F , 0xFE , 0x00 , 0x07 , 0xFC , 0x00 , 0x07 , 0xFC , 0x00 , 0x06 , 0xFC , 0x00 , 0x06 , 0xFC , 0x00 , 0x07 , 0xFC , 0x00 , 0x06 , 0xFC , 0x00 , 0x06 , 0xFC , 0x00 , 0x06 , 0xFC , 0x00 , 0x06 , 0xFC , 0x00 , 0x0E , 0xFE , 0x00 , 0x1D , 0xFF , 0x00 , 0x3F , 0xFF , 0x80 , 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x00 , 0x00 , 0x00 , 21, 23, 0x7D , 0xF7 , 0xC0 , 0x7D , 0xF7 , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xC0 , 0x3F , 0xFF , 0x80 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x1F , 0xFF , 0x00 , 0x3F , 0xFF , 0x80 , 0x7F , 0xFF , 0xC0 , 0xFF , 0xFF , 0xE0 , 0xFF , 0xFF , 0xE0 , 0xFF , 0xFF , 0xE0 , 0xFF , 0xFF , 0xE0 , 21, 23, 0x00 , 0x00 , 0x00 , 0x03 , 0xF0 , 0x00 , 0x0F , 0xFC , 0x00 , 0x1C , 0xFE , 0x00 , 0x3B , 0xFF , 0x00 , 0x37 , 0xE7 , 0x80 , 0x7F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xE0 , 0x7F , 0xFF , 0xE0 , 0x7F , 0xFF , 0xE0 , 0x7F , 0xE1 , 0xC0 , 0x3F , 0xE0 , 0x00 , 0x3F , 0xF0 , 0x00 , 0x1F , 0xF0 , 0x00 , 0x1D , 0xF8 , 0x00 , 0x0D , 0xF8 , 0x00 , 0x0D , 0xFC , 0x00 , 0x1B , 0xFE , 0x00 , 0x37 , 0xFF , 0x00 , 0x7F , 0xFF , 0x80 , 0x7F , 0xFF , 0x80 , 0x7F , 0xFF , 0x80 , 0x00 , 0x00 , 0x00 , 21, 23, 0x03 , 0xF0 , 0x00 , 0x0F , 0xFC , 0x00 , 0x1F , 0xFE , 0x00 , 0x3F , 0xFF , 0x00 , 0x7F , 0xFF , 0x80 , 0x7F , 0xFF , 0xC0 , 0xFF , 0xFF , 0xE0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 0x7F , 0xFF , 0xE0 , 0x3F , 0xF9 , 0xC0 , 0x3F , 0xF8 , 0x00 , 0x3F , 0xFC , 0x00 , 0x1F , 0xFC , 0x00 , 0x1F , 0xFE , 0x00 , 0x3F , 0xFF , 0x00 , 0x7F , 0xFF , 0x80 , 0xFF , 0xFF , 0xC0 , 0xFF , 0xFF , 0xC0 , 0xFF , 0xFF , 0xC0 , 0xFF , 0xFF , 0xC0 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0x40 , 0x00 , 0x00 , 0xE0 , 0x00 , 0x01 , 0xF0 , 0x00 , 0x03 , 0xF8 , 0x00 , 0x03 , 0x18 , 0x00 , 0x06 , 0x0C , 0x00 , 0x06 , 0xEC , 0x00 , 0x07 , 0xFC , 0x00 , 0x07 , 0xFC , 0x00 , 0x07 , 0xFC , 0x00 , 0x01 , 0xF0 , 0x00 , 0x03 , 0x78 , 0x00 , 0x06 , 0xFC , 0x00 , 0x0E , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0D , 0xFE , 0x00 , 0x0D , 0xFE , 0x00 , 0x0D , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x07 , 0xFC , 0x00 , 0x0F , 0xFE , 0x00 , 0x00 , 0x00 , 0x00 , 21, 23, 0x00 , 0x40 , 0x00 , 0x00 , 0xE0 , 0x00 , 0x01 , 0xF0 , 0x00 , 0x03 , 0xF8 , 0x00 , 0x07 , 0xF8 , 0x00 , 0x07 , 0xFC , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x0F , 0xFE , 0x00 , 0x07 , 0xFC , 0x00 , 0x0F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 0x0F , 0xFE , 0x00 , 0x1F , 0xFF , 0x00 , 0x1F , 0xFF , 0x00 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x00 , 0x40 , 0x20 , 0x10 , 0x60 , 0x70 , 0x30 , 0x30 , 0x70 , 0x60 , 0x38 , 0xF8 , 0xE0 , 0x38 , 0xF8 , 0xC0 , 0x1D , 0xFD , 0xC0 , 0x1D , 0xFD , 0xC0 , 0x1E , 0xFB , 0xC0 , 0x1E , 0xFB , 0xC0 , 0x1F , 0xDF , 0xC0 , 0x1F , 0xDF , 0xC0 , 0x1F , 0x27 , 0xC0 , 0x1B , 0xDF , 0xC0 , 0x1B , 0xDF , 0xC0 , 0x1F , 0xFF , 0xC0 , 0x1D , 0xFF , 0xC0 , 0x1D , 0xFF , 0xC0 , 0x1D , 0xFF , 0xC0 , 0x0F , 0xFF , 0x80 , 0x00 , 0x00 , 0x00 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x00 , 0xC0 , 0x70 , 0x18 , 0xE0 , 0xF8 , 0x38 , 0xF0 , 0xF8 , 0x78 , 0x79 , 0xFC , 0xF0 , 0x7D , 0xFD , 0xF0 , 0x7F , 0xFF , 0xF0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x1F , 0xFF , 0xC0 , 0x0F , 0xFF , 0x80 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x00 , 0x40 , 0x20 , 0x10 , 0x60 , 0x70 , 0x30 , 0x30 , 0x70 , 0x60 , 0x38 , 0xF8 , 0xE0 , 0x38 , 0xF8 , 0xC0 , 0x1D , 0xFD , 0xC0 , 0x1D , 0xFD , 0xC0 , 0x1E , 0xFB , 0xC0 , 0x1E , 0xFB , 0xC0 , 0x1E , 0xFB , 0xC0 , 0x1E , 0xFB , 0xC0 , 0x1F , 0xFF , 0xC0 , 0x1B , 0xFF , 0xC0 , 0x1B , 0xFF , 0xC0 , 0x0F , 0xFF , 0x80 , 0x0D , 0xFF , 0x80 , 0x0D , 0xFF , 0x80 , 0x0D , 0xFF , 0x80 , 0x0F , 0xFF , 0x80 , 0x00 , 0x00 , 0x00 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0x20 , 0x00 , 0xC0 , 0x70 , 0x18 , 0xE0 , 0x70 , 0x38 , 0xF0 , 0xF8 , 0x78 , 0x78 , 0xF8 , 0xF0 , 0x7D , 0xFD , 0xF0 , 0x7F , 0xFF , 0xF0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x1F , 0xFF , 0xC0 , 0x1F , 0xFF , 0xC0 , 0x1F , 0xFF , 0xC0 , 0x1F , 0xFF , 0xC0 , 0x1F , 0xFF , 0xC0 , 0x1F , 0xFF , 0xC0 , 21, 23, 0x00 , 0x00 , 0x00 , 0x00 , 0xF0 , 0x00 , 0x01 , 0xB8 , 0x00 , 0x03 , 0x7C , 0x00 , 0x03 , 0x7C , 0x00 , 0x03 , 0xFC , 0x00 , 0x03 , 0xFC , 0x00 , 0x01 , 0xF8 , 0x00 , 0x00 , 0xF0 , 0x00 , 0x00 , 0xF0 , 0x00 , 0x01 , 0xF8 , 0x00 , 0x01 , 0x78 , 0x00 , 0x03 , 0x7C , 0x00 , 0x06 , 0xFE , 0x00 , 0x0D , 0xFF , 0x00 , 0x1B , 0xFF , 0x80 , 0x37 , 0xFF , 0xC0 , 0x6F , 0xFF , 0xE0 , 0x6F , 0xFF , 0xE0 , 0x7F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xE0 , 0x00 , 0x00 , 0x00 , 21, 23, 0x00 , 0xF0 , 0x00 , 0x01 , 0xF8 , 0x00 , 0x03 , 0xFC , 0x00 , 0x07 , 0xFE , 0x00 , 0x07 , 0xFE , 0x00 , 0x07 , 0xFE , 0x00 , 0x07 , 0xFE , 0x00 , 0x03 , 0xFC , 0x00 , 0x01 , 0xF8 , 0x00 , 0x01 , 0xF8 , 0x00 , 0x03 , 0xFC , 0x00 , 0x03 , 0xFC , 0x00 , 0x07 , 0xFE , 0x00 , 0x0F , 0xFF , 0x00 , 0x1F , 0xFF , 0x80 , 0x3F , 0xFF , 0xC0 , 0x7F , 0xFF , 0xE0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 0x7F , 0xFF , 0xE0 , 0xFF , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 }; PutPiece (int x, int y, int piece,int b_w) { putsprite(spr_and,9+21*x+10*y,15+10*y,pieces+852*b_w+piece*142 + 71); putsprite(spr_or,9+21*x+10*y,15+10*y,pieces+852*b_w+piece*142); } DrawBoard() { int x,y,z,a,b; clg(); for (x=1 ; x!=82; x++) { draw(x,x+30,x+170,x+30); } for (x=0 ; x!=8; x++) { for (y=0 ; y!=8; y++) { if (!((x+y) & 1)) { for (z=0 ; z!=9; z++) { a=3+21*x+10*y+z; b=32+10*y+z; undraw(a,b,a+20,b); } } } } } z88dk-1.8.ds1/examples/graphics/coswave.c0000644000175000017500000000062407432466201017743 0ustar tygrystygrys #include #include #include main() { float x,y; char z,buf; //clg(); for (x=-3.0; x<3.0; x=x+0.06) { buf=100; for (y=-3.0; y<3.0; y=y+0.2) { z = (char) 70.0 - (10.0 * (y + 3.0) + ( 10.0 * cos (x*x + y*y) )); if (buf>z) { buf = z; plot ( (char) (16.0 * (x+3.0)), (char) z); } } } while (getk() != 13) {}; } z88dk-1.8.ds1/examples/graphics/fancychess.h0000755000175000017500000002444210565630351020436 0ustar tygrystygrys/* Normal size chessboard by Stefano Bodrato - 14/02/2007 Converted from ZX to BMP and then from BMP to sprites with the Daniel McKinnon's z88dk Sprite Editor This one is a fancy replacement for "chessboard.h" */ #include #include #define P_BLACK 0 #define P_WHITE 1 #define P_PAWN 0 #define P_ROOK 1 #define P_KNIGHT 2 #define P_BISHOP 5 #define P_QUEEN 3 #define P_KING 4 // 6 x BLACK + 6 x WHITE + 6 x MASK char pieces[] = { 24, 24, 0x00 , 0x00 , 0x00 , 0x00 , 0x18 , 0x00 , 0x00 , 0x2C , 0x20 , 0x00 , 0x5E , 0x20 , 0x00 , 0x5E , 0x70 , 0x00 , 0x7E , 0x20 , 0x00 , 0xFF , 0x20 , 0x00 , 0xFF , 0x20 , 0x00 , 0x3C , 0x20 , 0x00 , 0x3C , 0x20 , 0x00 , 0x18 , 0x20 , 0x00 , 0x7F , 0xE0 , 0x00 , 0xFF , 0xE0 , 0x00 , 0xBF , 0x20 , 0x01 , 0xBF , 0xA0 , 0x01 , 0x7F , 0xA0 , 0x01 , 0x7F , 0xA0 , 0x01 , 0xFF , 0xA0 , 0x00 , 0x66 , 0x20 , 0x00 , 0x66 , 0x00 , 0x00 , 0xE7 , 0x00 , 0x01 , 0xE7 , 0x80 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x0E , 0x38 , 0xE0 , 0x0A , 0x28 , 0xA0 , 0x0E , 0x38 , 0xE0 , 0x0B , 0xEF , 0xA0 , 0x0E , 0x6C , 0xE0 , 0x03 , 0xFF , 0x80 , 0x01 , 0x25 , 0x00 , 0x01 , 0xFF , 0x00 , 0x01 , 0x49 , 0x00 , 0x01 , 0xFF , 0x00 , 0x01 , 0x25 , 0x00 , 0x01 , 0xFF , 0x00 , 0x01 , 0x49 , 0x00 , 0x01 , 0xFF , 0x00 , 0x01 , 0x25 , 0x00 , 0x03 , 0xFF , 0x80 , 0x04 , 0x92 , 0xC0 , 0x0F , 0xFF , 0xE0 , 0x15 , 0x24 , 0xB0 , 0x1F , 0xFF , 0xF0 , 0x12 , 0x52 , 0x90 , 0x1F , 0xFF , 0xF0 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x03 , 0x68 , 0x00 , 0x0D , 0x5E , 0x00 , 0x15 , 0xFF , 0x00 , 0x2B , 0xFF , 0x80 , 0x17 , 0xF9 , 0xC0 , 0x3B , 0xFF , 0xE0 , 0x17 , 0xFF , 0xF0 , 0x2B , 0xFF , 0xF8 , 0x27 , 0xFF , 0xF8 , 0x39 , 0xF9 , 0xF8 , 0x4E , 0xF8 , 0x70 , 0x33 , 0xFC , 0x00 , 0x2D , 0xFC , 0x00 , 0x15 , 0xFE , 0x00 , 0x3B , 0xFE , 0x00 , 0x6B , 0xFF , 0x00 , 0x17 , 0xFF , 0x80 , 0x6F , 0xFF , 0xC0 , 0x5F , 0xFF , 0xE0 , 0x3F , 0xFF , 0xE0 , 0x5F , 0xFF , 0xE0 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x00 , 0x58 , 0x00 , 0x00 , 0x2C , 0x00 , 0x00 , 0xD2 , 0x00 , 0x01 , 0x52 , 0x00 , 0x01 , 0x54 , 0x00 , 0x00 , 0xA8 , 0x00 , 0x01 , 0x5C , 0x00 , 0x02 , 0xBE , 0x00 , 0x02 , 0xDE , 0x00 , 0x01 , 0x3C , 0x00 , 0x01 , 0x5C , 0x00 , 0x00 , 0x3C , 0x00 , 0x00 , 0x3C , 0x00 , 0x00 , 0x7C , 0x00 , 0x00 , 0x7C , 0x00 , 0x00 , 0x7E , 0x00 , 0x00 , 0x7E , 0x00 , 0x00 , 0x7F , 0x00 , 0x00 , 0x5F , 0x00 , 0x00 , 0x1C , 0x00 , 0x00 , 0x1E , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x01 , 0x54 , 0x00 , 0x01 , 0x54 , 0x00 , 0x01 , 0x54 , 0x00 , 0x01 , 0xFC , 0xC0 , 0x00 , 0xA9 , 0xE0 , 0x01 , 0x45 , 0xE0 , 0x00 , 0xC4 , 0xC0 , 0x01 , 0x78 , 0xC0 , 0x00 , 0xF0 , 0xC0 , 0x01 , 0x7F , 0xC0 , 0x00 , 0x7F , 0xC0 , 0x00 , 0x7F , 0xC0 , 0x00 , 0x7C , 0xC0 , 0x00 , 0x7C , 0xC0 , 0x00 , 0x7C , 0xC0 , 0x00 , 0x7C , 0xC0 , 0x00 , 0x7C , 0xC0 , 0x00 , 0x7C , 0x00 , 0x00 , 0x7C , 0x00 , 0x00 , 0x7C , 0x00 , 0x00 , 0xFE , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x00 , 0x60 , 0x00 , 0x00 , 0xF0 , 0x00 , 0x01 , 0xF8 , 0x0C , 0x03 , 0x88 , 0x14 , 0x05 , 0x88 , 0x28 , 0x03 , 0xF8 , 0x50 , 0x05 , 0xFA , 0xA0 , 0x00 , 0xF1 , 0x40 , 0x01 , 0x0E , 0x80 , 0x02 , 0xF1 , 0x40 , 0x02 , 0xC6 , 0x00 , 0x01 , 0x38 , 0x00 , 0x01 , 0xF8 , 0x00 , 0x01 , 0xF8 , 0x00 , 0x01 , 0xF8 , 0x00 , 0x01 , 0xF8 , 0x00 , 0x01 , 0xF8 , 0x00 , 0x01 , 0x98 , 0x00 , 0x01 , 0x98 , 0x00 , 0x01 , 0x98 , 0x00 , 0x01 , 0xDC , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x00 , 0x18 , 0x00 , 0x00 , 0x24 , 0x20 , 0x00 , 0x42 , 0x20 , 0x00 , 0x52 , 0x70 , 0x00 , 0x52 , 0x20 , 0x00 , 0x81 , 0x20 , 0x00 , 0xFF , 0x20 , 0x00 , 0x3C , 0x20 , 0x00 , 0x3C , 0x20 , 0x00 , 0x18 , 0x20 , 0x00 , 0x7F , 0xE0 , 0x00 , 0x81 , 0xE0 , 0x00 , 0x91 , 0x20 , 0x01 , 0x20 , 0xA0 , 0x01 , 0x20 , 0xA0 , 0x01 , 0x00 , 0xA0 , 0x01 , 0xFF , 0xA0 , 0x00 , 0x66 , 0x20 , 0x00 , 0x66 , 0x00 , 0x00 , 0xE7 , 0x00 , 0x01 , 0xE7 , 0x80 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x0F , 0x7D , 0xE0 , 0x09 , 0x45 , 0x20 , 0x09 , 0x45 , 0x20 , 0x09 , 0xC7 , 0x20 , 0x08 , 0x82 , 0x20 , 0x07 , 0xFF , 0xC0 , 0x01 , 0x21 , 0x00 , 0x01 , 0x21 , 0x00 , 0x01 , 0xFF , 0x00 , 0x01 , 0x09 , 0x00 , 0x01 , 0x09 , 0x00 , 0x01 , 0xFF , 0x00 , 0x01 , 0x11 , 0x00 , 0x01 , 0x11 , 0x00 , 0x01 , 0xFF , 0x00 , 0x02 , 0x44 , 0x80 , 0x04 , 0x44 , 0x40 , 0x0F , 0xFF , 0xE0 , 0x11 , 0x11 , 0x10 , 0x11 , 0x11 , 0x10 , 0x1F , 0xFF , 0xF0 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x00 , 0x50 , 0x00 , 0x02 , 0xAA , 0x00 , 0x0D , 0x55 , 0x00 , 0x02 , 0xA0 , 0x80 , 0x0D , 0x06 , 0x40 , 0x25 , 0x00 , 0x20 , 0x1A , 0x00 , 0x10 , 0x24 , 0x00 , 0x08 , 0x0A , 0x0E , 0x08 , 0x34 , 0x09 , 0x88 , 0x0A , 0x08 , 0x70 , 0x34 , 0x04 , 0x00 , 0x13 , 0x04 , 0x00 , 0x2C , 0x02 , 0x00 , 0x12 , 0x02 , 0x00 , 0x29 , 0x01 , 0x00 , 0x16 , 0x00 , 0x80 , 0x68 , 0x00 , 0x40 , 0x14 , 0x00 , 0x20 , 0x30 , 0x00 , 0x20 , 0x5F , 0xFF , 0xE0 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x00 , 0x18 , 0x00 , 0x00 , 0x2C , 0x00 , 0x00 , 0xD2 , 0x00 , 0x00 , 0xA2 , 0x00 , 0x00 , 0x54 , 0x00 , 0x01 , 0xA8 , 0x00 , 0x00 , 0x56 , 0x00 , 0x01 , 0xB1 , 0x00 , 0x02 , 0x51 , 0x00 , 0x00 , 0x92 , 0x00 , 0x00 , 0x14 , 0x00 , 0x00 , 0x24 , 0x00 , 0x00 , 0x44 , 0x00 , 0x00 , 0x44 , 0x00 , 0x00 , 0x44 , 0x00 , 0x00 , 0x42 , 0x00 , 0x00 , 0x81 , 0x00 , 0x00 , 0xF7 , 0x00 , 0x00 , 0x14 , 0x00 , 0x00 , 0x14 , 0x00 , 0x00 , 0x1E , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x01 , 0x54 , 0x00 , 0x01 , 0x54 , 0x00 , 0x01 , 0x54 , 0x00 , 0x01 , 0xFC , 0xE0 , 0x02 , 0xA9 , 0x10 , 0x01 , 0x45 , 0x10 , 0x02 , 0xC4 , 0xA0 , 0x01 , 0x78 , 0xA0 , 0x02 , 0xD0 , 0xA0 , 0x00 , 0x8F , 0xA0 , 0x00 , 0x80 , 0xA0 , 0x00 , 0x87 , 0xA0 , 0x00 , 0x84 , 0xA0 , 0x00 , 0x84 , 0xA0 , 0x00 , 0x84 , 0xA0 , 0x00 , 0x84 , 0xA0 , 0x00 , 0x84 , 0xE0 , 0x00 , 0x84 , 0x00 , 0x00 , 0x84 , 0x00 , 0x01 , 0x02 , 0x00 , 0x01 , 0xFE , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x00 , 0x00 , 0x00 , 0x60 , 0x00 , 0x00 , 0x90 , 0x00 , 0x01 , 0x08 , 0x0C , 0x03 , 0x78 , 0x14 , 0x05 , 0x78 , 0x28 , 0x03 , 0x08 , 0x50 , 0x05 , 0x0A , 0xA0 , 0x00 , 0xF1 , 0x40 , 0x01 , 0xFE , 0x80 , 0x02 , 0x01 , 0x40 , 0x02 , 0x1E , 0x00 , 0x01 , 0xE8 , 0x00 , 0x01 , 0x08 , 0x00 , 0x01 , 0x08 , 0x00 , 0x01 , 0x08 , 0x00 , 0x01 , 0x08 , 0x00 , 0x01 , 0x64 , 0x00 , 0x01 , 0x54 , 0x00 , 0x01 , 0x54 , 0x00 , 0x01 , 0x54 , 0x00 , 0x01 , 0xDE , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x18 , 0x00 , 0x00 , 0x3C , 0x20 , 0x00 , 0x7E , 0x30 , 0x00 , 0xFE , 0x70 , 0x00 , 0xFE , 0x78 , 0x00 , 0xFF , 0x70 , 0x01 , 0xFF , 0x70 , 0x01 , 0xFF , 0x70 , 0x00 , 0x7F , 0x70 , 0x00 , 0x7F , 0x70 , 0x00 , 0x3F , 0xF0 , 0x00 , 0xFF , 0xF0 , 0x01 , 0xFF , 0xF0 , 0x01 , 0xFF , 0xF0 , 0x03 , 0xFF , 0xB0 , 0x03 , 0xFF , 0xB0 , 0x03 , 0xFF , 0xB0 , 0x03 , 0xFF , 0xB0 , 0x00 , 0xFF , 0xB0 , 0x00 , 0xE7 , 0x20 , 0x01 , 0xE7 , 0x80 , 0x03 , 0xE7 , 0xC0 , 0x01 , 0xE7 , 0x80 , 0x00 , 0x00 , 0x00 , 24, 24, 0x0E , 0x38 , 0xE0 , 0x1E , 0x38 , 0xF0 , 0x1E , 0x38 , 0xF0 , 0x1F , 0xFF , 0xF0 , 0x1F , 0xFF , 0xF0 , 0x1F , 0xFF , 0xF0 , 0x07 , 0xFF , 0xC0 , 0x03 , 0xFF , 0x80 , 0x03 , 0xFF , 0x80 , 0x03 , 0xFF , 0x80 , 0x03 , 0xFF , 0x80 , 0x03 , 0xFF , 0x80 , 0x03 , 0xFF , 0x80 , 0x03 , 0xFF , 0x80 , 0x03 , 0xFF , 0x80 , 0x03 , 0xFF , 0x80 , 0x07 , 0xFF , 0xC0 , 0x0F , 0xFF , 0xE0 , 0x1F , 0xFF , 0xF0 , 0x3F , 0xFF , 0xF8 , 0x3F , 0xFF , 0xF8 , 0x3F , 0xFF , 0xF8 , 0x3F , 0xFF , 0xF8 , 0x1F , 0xFF , 0xF0 , 24, 24, 0x03 , 0x68 , 0x00 , 0x0F , 0x7E , 0x00 , 0x1F , 0xFF , 0x00 , 0x3F , 0xFF , 0x80 , 0x7F , 0xFF , 0xC0 , 0x3F , 0xFF , 0xE0 , 0x7F , 0xFF , 0xF0 , 0x3F , 0xFF , 0xF8 , 0x7F , 0xFF , 0xFC , 0x7F , 0xFF , 0xFC , 0x7F , 0xFF , 0xFC , 0xFF , 0xFF , 0xF8 , 0x7F , 0xFE , 0x10 , 0x7F , 0xFE , 0x00 , 0x3F , 0xFF , 0x00 , 0x7F , 0xFF , 0x00 , 0xFF , 0xFF , 0x80 , 0x3F , 0xFF , 0xC0 , 0xFF , 0xFF , 0xE0 , 0xFF , 0xFF , 0xF0 , 0x7F , 0xFF , 0xF0 , 0xFF , 0xFF , 0xF0 , 0x5F , 0xFF , 0xE0 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x58 , 0x00 , 0x00 , 0xFC , 0x00 , 0x00 , 0xFE , 0x00 , 0x01 , 0xFF , 0x00 , 0x03 , 0xFF , 0x00 , 0x03 , 0xFE , 0x00 , 0x01 , 0xFC , 0x00 , 0x03 , 0xFE , 0x00 , 0x07 , 0xFF , 0x00 , 0x07 , 0xFF , 0x00 , 0x03 , 0xFE , 0x00 , 0x03 , 0x7E , 0x00 , 0x01 , 0x7E , 0x00 , 0x00 , 0x7E , 0x00 , 0x00 , 0xFE , 0x00 , 0x00 , 0xFE , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0xFF , 0x80 , 0x00 , 0xFF , 0x80 , 0x00 , 0x7F , 0x00 , 0x00 , 0x3F , 0x00 , 0x00 , 0x1E , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x01 , 0x54 , 0x00 , 0x03 , 0x56 , 0x00 , 0x03 , 0x56 , 0x00 , 0x03 , 0xFE , 0xC0 , 0x03 , 0xFD , 0xE0 , 0x01 , 0xFD , 0xF0 , 0x03 , 0xFD , 0xF0 , 0x01 , 0xFD , 0xE0 , 0x03 , 0xFD , 0xE0 , 0x01 , 0xFF , 0xE0 , 0x03 , 0xFF , 0xE0 , 0x01 , 0xFF , 0xE0 , 0x00 , 0xFF , 0xE0 , 0x00 , 0xFF , 0xE0 , 0x00 , 0xFE , 0xE0 , 0x00 , 0xFE , 0xE0 , 0x00 , 0xFE , 0xE0 , 0x00 , 0xFE , 0xE0 , 0x00 , 0xFE , 0xC0 , 0x00 , 0xFE , 0x00 , 0x00 , 0xFE , 0x00 , 0x01 , 0xFF , 0x00 , 0x00 , 0xFE , 0x00 , 0x00 , 0x00 , 0x00 , 24, 24, 0x00 , 0x60 , 0x00 , 0x00 , 0xF0 , 0x00 , 0x01 , 0xF8 , 0x0C , 0x03 , 0xF8 , 0x1E , 0x07 , 0xF8 , 0x3E , 0x0F , 0xF8 , 0x7C , 0x07 , 0xFA , 0xF8 , 0x0F , 0xFB , 0xF0 , 0x05 , 0xFF , 0xE0 , 0x03 , 0xFF , 0xC0 , 0x07 , 0xFF , 0xE0 , 0x07 , 0xFF , 0x40 , 0x03 , 0xFE , 0x00 , 0x03 , 0xFC , 0x00 , 0x03 , 0xFC , 0x00 , 0x03 , 0xFC , 0x00 , 0x03 , 0xFC , 0x00 , 0x03 , 0xFC , 0x00 , 0x03 , 0xFC , 0x00 , 0x03 , 0xDC , 0x00 , 0x03 , 0xDC , 0x00 , 0x03 , 0xDE , 0x00 , 0x01 , 0xDC , 0x00 , 0x00 , 0x00 , 0x00 }; PutPiece (int x, int y, int piece,int b_w) { putsprite(spr_and,7+21*x+10*y,15+10*y,pieces+888+piece*74); putsprite(spr_or,7+21*x+10*y,15+10*y,pieces+444*b_w+piece*74); } DrawBoard() { int x,y,z,a,b; clg(); for (x=1 ; x!=82; x++) { draw(x,x+30,x+170,x+30); } for (x=0 ; x!=8; x++) { for (y=0 ; y!=8; y++) { if (!((x+y) & 1)) { for (z=0 ; z!=9; z++) { a=3+21*x+10*y+z; b=32+10*y+z; undraw(a,b,a+20,b); } } } } } z88dk-1.8.ds1/examples/graphics/icon0000755000175000017500000000042410762530766017014 0ustar tygrystygrys#define icon_width 16 #define icon_height 16 static char icon_bits[] = { 0xff, 0xff, 0xab, 0xaa, 0x55, 0xd5, 0xab, 0xaa, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x55, 0xd5, 0xab, 0xaa, 0x55, 0xd5, 0xff, 0xff}; z88dk-1.8.ds1/examples/graphics/showlib3d.c0000755000175000017500000000533607747741357020223 0ustar tygrystygrys/* 3d.c Demo using standard Wizard 3d and 4d math functions Copyright 2002, Mark Hamilton Flickering (non paged graphics) port to Z88DK by Stefano Bodrato - Oct 2003 use keys 1 and 2 to enlarge/reduce the cube 3 - exits */ //#include #include "lib3d.h" #include "graphics.h" #include "stdio.h" #include "stdlib.h" //#define TIMING int main(void); /* #define MX 238/2 #define MY 80/2 */ #define MX 96/2 #define MY 64/2 Vector_t cube[8] = { { -20 , 20, 20 }, { 20 , 20, 20 }, { 20 , -20, 20 }, { -20 , -20, 20 }, { -20 , 20, -20 }, { 20 , 20, -20 }, { 20 , -20, -20 }, { -20 , -20, -20 } }; int main(void) { static Vector_t rot; static Vector_t t; static Point_t p[8]; static unsigned c = 0; static int i; static int zf = 0; #ifdef TIMING extern unsigned _oz64hz_word; static unsigned frames; #endif //ozinitprofiler(); //ozsetactivepage(1); //ozsetdisplaypage(0); #ifdef TIMING frames=0; _oz64hz_word=0; #endif while(c != 13) { //if(ozkeyhit()) c = ozngetch(); //if(getk()) c = fgetc_cons(); c=getk(); switch(c) { case '1': zf -= 10; if(zf < -100) zf = -100; break; case '2': zf += 10; if(zf > 300) zf = 300; break; case '3': exit (0); } c = 0; for(i = 0; i < 8; i++) { ozcopyvector(&t,&cube[i]); ozrotatepointx(&t, rot.x); ozrotatepointy(&t, rot.y); t.z += zf; /* zoom factor */ ozplotpoint(&t, &p[i]); } rot.y = (rot.y+1)%360; rot.x = (rot.x+2)%360; clg(); /* top face */ draw(p[0].x + MX, p[0].y + MY, p[1].x + MX, p[1].y + MY); draw(p[1].x + MX, p[1].y + MY, p[2].x + MX, p[2].y + MY); draw(p[2].x + MX, p[2].y + MY, p[3].x + MX, p[3].y + MY); draw(p[3].x + MX, p[3].y + MY, p[0].x + MX, p[0].y + MY); /* bottom face */ draw(p[4].x + MX, p[4].y + MY, p[5].x + MX, p[5].y + MY); draw(p[5].x + MX, p[5].y + MY, p[6].x + MX, p[6].y + MY); draw(p[6].x + MX, p[6].y + MY, p[7].x + MX, p[7].y + MY); draw(p[7].x + MX, p[7].y + MY, p[4].x + MX, p[4].y + MY); /* side faces */ draw(p[0].x + MX, p[0].y + MY, p[4].x + MX, p[4].y + MY); draw(p[1].x + MX, p[1].y + MY, p[5].x + MX, p[5].y + MY); draw(p[2].x + MX, p[2].y + MY, p[6].x + MX, p[6].y + MY); draw(p[3].x + MX, p[3].y + MY, p[7].x + MX, p[7].y + MY); //ozsetdisplaypage(!ozgetdisplaypage()); #ifdef TIMING frames++; if(_oz64hz_word>64*10) { static char buf[80]; sprintf(buf,"%d frames in 10 seconds",frames); ozputs(0,0,buf); ozgetch(); _oz64hz_word=0; frames=0; } #endif //ozsetactivepage(!ozgetactivepage()); } } z88dk-1.8.ds1/examples/graphics/sinwave.c0000644000175000017500000000062407432466201017750 0ustar tygrystygrys #include #include #include main() { float x,y; char z,buf; //clg(); for (x=-3.0; x<3.0; x=x+0.06) { buf=100; for (y=-3.0; y<3.0; y=y+0.2) { z = (char) 60.0 - (10.0 * (y + 3.0) + ( 10.0 * sin (x*x + y*y) )); if (buf>z) { buf = z; plot ( (char) (15.0 * (x+3.0)), (char) z); } } } while (getk() != 13) {}; } z88dk-1.8.ds1/examples/graphics/smallgfx.c0000644000175000017500000000050507242745766020126 0ustar tygrystygrys #include main() { draw(0,0,95,63); /* Draw a diamond - weak, but it demonstrates relative drawing! */ plot(64,25); drawr(15,15); drawr(15,-15); drawr(-15,-15); drawr(-15,15); circle(30,30,20,1); circle(30,30,28,1); fill(8,30); } z88dk-1.8.ds1/examples/graphics/smallgfx2.c0000644000175000017500000000073707247713301020200 0ustar tygrystygrys #include #include #include main() { int x,a; for (x=1;x<95;x++) { a=50-x; plot (x,32-(a*a/80)); } /* Draw a diamond - weak, but it demonstrates relative drawing! */ plot(61,25); drawr(15,15); drawr(15,-15); drawr(-15,-15); drawr(-15,15); circle(30,30,20,1); circle(30,30,28,1); fill(8,35); fill(70,30); while (getk() != 13) {}; } z88dk-1.8.ds1/examples/graphics/spritest.c0000644000175000017500000000523407247713301020153 0ustar tygrystygrys/* Sample for the putsprite command. We draw some garbage on the screen, then we put a masked arrow. It can be moved using arrows; ENTER exits. Improved version; the mask is drawn AFTER the sprite, so we reduce the flicker, and being the mask just "a border", it is put faster. */ #include "stdio.h" #include "games.h" #include char bullet[] = { 11,3, '\xE0', '\xE0', '\xBF', '\xA0', '\xE0', '\xE0' }; char arrow[] = { 8,8, '\x00', '\x60', '\x70', '\x78', '\x7C', '\x18', '\x0C', '\x00' }; char arrow_mask[] = { 8,8, '\xE0', '\x90', '\x88', '\x84', '\x82', '\xE6', '\x12', '\x1E' }; char arrow_bk[] = { 8,8, 0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0 }; /* extern char bullet[]; extern char arrow[]; extern char arrow_mask[]; extern char arrow_bk[]; #asm .smc_bullet defb 11,3 defb @11100000, @11100000 defb @10111111, @10100000 defb @11100000, @11100000 .smc_arrow defb 8,8 defb @00000000 defb @01100000 defb @01110000 defb @01111000 defb @01111100 defb @00011000 defb @00001100 defb @00000000 .smc_arrow_mask defb 8,8 defb @11100000 defb @10010000 defb @10001000 defb @10000100 defb @10000010 defb @11100110 defb @00010010 defb @00011110 .smc_arrow_bk defb 8,8 defw 0 defb 0,0,0,0,0,0,0,0 defb 0,0,0,0,0,0,0,0 #endasm */ main() { int x,y,z; int flag=1; int speed=1; char *ptr; //printf("%c",12); //clear screen for (x=10; x<39; x=x+3) //put some trash on screen { putsprite(spr_or,2*x,x,bullet); putsprite(spr_or,2*x-10,x,bullet); putsprite(spr_or,2*x+10,x,bullet); } //printf("Sprite demo"); x=40; y=20; bksave(x,y,arrow_bk); while (flag!=2) { switch( getk() ) { case 11: y=y-speed; flag=1; break; case 10: y=y+speed; flag=1; break; case 9: x++; flag=1; break; case 8: x--; flag=1; break; case 13: flag=2; break; default: speed=1; } if (flag==1) { if (speed<4) speed=speed+1; bkrestore(arrow_bk); bksave(x,y,arrow_bk); putsprite(spr_or,x,y,arrow); putsprite(spr_mask,x,y,arrow_mask); flag=0; } } } z88dk-1.8.ds1/examples/graphics/ti_chessboard.h0000644000175000017500000002151607335762426021127 0ustar tygrystygrys/* Chessboard lib for TI85, TI86 and VZ200 (128x64 pixel screen) By Stefano Bodrato - 13/08/2001 */ #include #include #define P_BLACK 1 #define P_WHITE 0 #define P_PAWN 5 #define P_ROOK 0 #define P_KNIGHT 1 #define P_BISHOP 2 #define P_QUEEN 4 #define P_KING 3 extern char pieces[]; #asm ._pieces ; White Pieces defb 9,10 defb @00000000, @00000000 ; Rook defb @01111111, @00000000 defb @01010101, @00000000 defb @01010101, @00000000 defb @01000001, @00000000 defb @00100010, @00000000 defb @00100010, @00000000 defb @00100010, @00000000 defb @00111110, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Rook mask defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Knight defb @00011100, @00000000 defb @00100010, @00000000 defb @01000001, @00000000 defb @01001111, @00000000 defb @01001000, @00000000 defb @00100110, @00000000 defb @01000010, @00000000 defb @01111110, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Knight mask defb @00011100, @00000000 defb @00111110, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111000, @00000000 defb @00111110, @00000000 defb @01111110, @00000000 defb @01111110, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Bishop defb @00001000, @00000000 defb @00010100, @00000000 defb @00100010, @00000000 defb @01000100, @00000000 defb @01001011, @00000000 defb @01001101, @00000000 defb @01000001, @00000000 defb @01111111, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Bishop mask defb @00001000, @00000000 defb @00011100, @00000000 defb @00111110, @00000000 defb @01111110, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; King defb @00011100, @00000000 defb @00010100, @00000000 defb @01110111, @00000000 defb @01000001, @00000000 defb @01110111, @00000000 defb @00010100, @00000000 defb @00100010, @00000000 defb @01111111, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; King mask defb @00011100, @00000000 defb @00011100, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @00011100, @00000000 defb @00111110, @00000000 defb @01111111, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Queen defb @01001001, @00000000 defb @10110110, @10000000 defb @10010100, @10000000 defb @10001000, @10000000 defb @01000001, @00000000 defb @01000001, @00000000 defb @01000001, @00000000 defb @00111110, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Queen mask defb @01001001, @00000000 defb @11111111, @10000000 defb @11111111, @10000000 defb @11111111, @10000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @00111110, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Pawn defb @00011100, @00000000 defb @00100010, @00000000 defb @00100010, @00000000 defb @00010100, @00000000 defb @00100010, @00000000 defb @01000001, @00000000 defb @01000001, @00000000 defb @01111111, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Pawn mask defb @00011100, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00011100, @00000000 defb @00111110, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @00000000, @00000000 ; Black Pieces defb 9,10 defb @00000000, @00000000 ; Rook defb @00000000, @00000000 defb @00101010, @00000000 defb @00101010, @00000000 defb @00111110, @00000000 defb @00011100, @00000000 defb @00011100, @00000000 defb @00011100, @00000000 defb @00000000, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Rook mask defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Knight defb @00000000, @00000000 defb @00011100, @00000000 defb @00111110, @00000000 defb @00110000, @00000000 defb @00110000, @00000000 defb @00011000, @00000000 defb @00111100, @00000000 defb @00000000, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Knight mask defb @00011100, @00000000 defb @00111110, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111000, @00000000 defb @00111110, @00000000 defb @01111110, @00000000 defb @01111110, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Bishop defb @00000000, @00000000 defb @00001000, @00000000 defb @00011100, @00000000 defb @00111000, @00000000 defb @00110010, @00000000 defb @00110110, @00000000 defb @00111110, @00000000 defb @00000000, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Bishop mask defb @00001000, @00000000 defb @00011100, @00000000 defb @00111110, @00000000 defb @01111110, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; King defb @00000000, @00000000 defb @00001000, @00000000 defb @00001000, @00000000 defb @00111110, @00000000 defb @00001000, @00000000 defb @00001000, @00000000 defb @00011100, @00000000 defb @00000000, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; King mask defb @00011100, @00000000 defb @00011100, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @00011100, @00000000 defb @00111110, @00000000 defb @01111111, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Queen defb @00000000, @00000000 defb @01001001, @00000000 defb @01101011, @00000000 defb @01110111, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00000000, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Queen mask defb @01001001, @00000000 defb @11111111, @10000000 defb @11111111, @10000000 defb @11111111, @10000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @00111110, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Pawn defb @00000000, @00000000 defb @00011100, @00000000 defb @00011100, @00000000 defb @00001000, @00000000 defb @00011100, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00000000, @00000000 defb @00000000, @00000000 defb 9,10 defb @00000000, @00000000 ; Pawn mask defb @00011100, @00000000 defb @00111110, @00000000 defb @00111110, @00000000 defb @00011100, @00000000 defb @00111110, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @01111111, @00000000 defb @00000000, @00000000 #endasm PutPiece (int x, int y, int piece,int b_w) { putsprite(spr_and,6+10*x+5*y,5+5*y,pieces+264*b_w+piece*44 + 22); putsprite(spr_or,6+10*x+5*y,5+5*y,pieces+264*b_w+piece*44); } DrawBoard() { int x,y,z,a,b; clg (); for (x=1 ; x!=43; x++) { draw(x,x+9,81+x,x+9); } for (x=0 ; x!=8; x++) { for (y=0 ; y!=8; y++) { if (!((x+y) & 1)) { for (z=0 ; z!=5; z++) { a=3+10*x+5*y+z; b=11+5*y+z; undraw(a,b,a+9,b); } } } } } z88dk-1.8.ds1/examples/graphics/wintest.c0000644000175000017500000000637407567116020020001 0ustar tygrystygrys/* Sample for the putsprite command and gui.h We draw some garbage on the screen, open a window, then we put a masked arrow. It can be moved using arrows; ENTER closes window; ENTER again exits. build with: zcc + -lmalloc -lndos wintest.c */ #include "stdio.h" #include "malloc.h" #include "graphics.h" #include "games.h" #include "gui.h" #include #define HPSIZE 2048 HEAPSIZE(HPSIZE) char bullet[] = { 11,3, '\xE0', '\xE0', '\xBF', '\xA0', '\xE0', '\xE0' }; char arrow[] = { 8,8, '\x00', '\x60', '\x70', '\x78', '\x7C', '\x18', '\x0C', '\x00' }; char arrow_mask[] = { 8,8, '\xE0', '\xF0', '\xF8', '\xFC', '\xFE', '\xFE', '\x3E', '\x1E' }; char arrow_bk[] = { 8,8, 0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0 }; // Not the exactly the required space, but a little more.. char wbk[] = { 38,18, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0 }; main() { int x,y,z; int flag=1; struct gui_win win; heapinit(HPSIZE); printf("%c",12); //clear screen for (x=10; x<39; x=x+3) //put some trash on screen { putsprite(spr_or,2*x,x,bullet); putsprite(spr_or,2*x-10,x,bullet); putsprite(spr_or,2*x+10,x,bullet); } //printf("%c",12); //clear screen printf("GUI demo. Press ENTER to close."); win->x=30; win->y=15; win->flags= WIN_BORDER|WIN_SHADOW; win->height=20; win->width=40; win_open (win); x=40; y=20; bksave(x,y,arrow_bk); while (flag!=2) { /* switch( getk() ) { case 11: y--; flag=1; break; case 10: y++; flag=1; break; case 9: x++; flag=1; break; case 8: x--; flag=1; break; case 13: flag=2; } */ // Alternate controls: Kempston Joystick on Spectrum (flickers a lot), cursors on a TI calculator, etc.. switch( joystick(1) ) { case MOVE_UP: y--; flag=1; break; case MOVE_DOWN: y++; flag=1; break; case MOVE_RIGHT: x++; flag=1; break; case MOVE_LEFT: x--; flag=1; break; case MOVE_FIRE: flag=2; } if (flag==1) { bkrestore(arrow_bk); bksave(x,y,arrow_bk); clga(31,16,38,18); getsprite(x,y,wbk); putsprite(spr_or,31,16,wbk); putsprite(spr_mask,x,y,arrow_mask); putsprite(spr_or,x,y,arrow); flag=0; } } win_close (win); while (getk()!=13); } z88dk-1.8.ds1/examples/graphics/xample.c0000755000175000017500000001342510765022535017571 0ustar tygrystygrys#include #include #include #pragma output hrgpage=36096 #include #include "icon" #define BITMAPDEPTH 1 Display *display; int screen; /* values for window_size in main */ #define SMALL 1 #define OK 0 void main(argc, argv) int argc; char **argv; { Window win; unsigned int width, height, display_width, display_height; int x = 0, y = 0; unsigned int border_width = 4; char *window_name = "Basic Window Program"; char *icon_name = "basicwin"; Pixmap icon_pixmap; XSizeHints size_hints; XEvent report; GC gc; XFontStruct *font_info; char *display_name = NULL; int window_size = 0; if ((display=XOpenDisplay(display_name)) == NULL) { fprintf(stderr,"basicwin: cannot connect to X server %s\n", XDisplayName(display_name)); exit(-1); } screen = DefaultScreen(display); display_width = DisplayWidth(display,screen); display_height = DisplayHeight(display,screen); //width = display_width/3; //height = display_height/4; width = 230; height = 160; win = XCreateSimpleWindow(display, RootWindow(display,screen), x, y, width, height, border_width, BlackPixel(display,screen), WhitePixel(display,screen)); icon_pixmap = XCreateBitmapFromData(display, win, icon_bits, icon_width, icon_height); size_hints.flags = PPosition | PSize | PMinSize; size_hints.x = x; size_hints.y = y; size_hints.width = width; size_hints.height = height; size_hints.min_width = 350; size_hints.min_height = 250; XSetStandardProperties(display, win, window_name, icon_name, icon_pixmap, argv, argc, &size_hints); XSelectInput(display, win, ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask); load_font(&font_info); get_GC(win, &gc, font_info); XMapWindow(display, win); while (1) { XNextEvent(display, &report); switch (report.type) { case Expose: while (XCheckTypedEvent(display, Expose, &report)) ; if (window_size == SMALL) TooSmall(win, gc, font_info); else { draw_text(win, gc, font_info, width, height); draw_graphics(win, gc, width, height); } break; case ConfigureNotify: width = report.xconfigure.width; height = report.xconfigure.height; if (width < size_hints.min_width || height < size_hints.min_height) window_size = SMALL; else window_size = OK; break; case ButtonPress: case KeyPress: XUnloadFont(display, font_info->fid); XFreeGC(display, gc); XCloseDisplay(display); exit(1); break; default: break; } } } get_GC(win, gc, font_info) Window win; GC *gc; XFontStruct *font_info; { unsigned long valuemask = 0; XGCValues values; unsigned int line_width = 1; int line_style = LineSolid; /*LineOnOffDash;*/ int cap_style = CapButt; int join_style = JoinMiter; int dash_offset = 0; static char dash_list[] = {20, 40}; int list_length = sizeof(dash_list); *gc = XCreateGC(display, win, valuemask, &values); XSetFont(display, *gc, font_info->fid); XSetForeground(display, *gc, BlackPixel(display,screen)); XSetLineAttributes(display, *gc, line_width, line_style, cap_style, join_style); XSetDashes(display, *gc, dash_offset, dash_list, list_length); } load_font(font_info) XFontStruct **font_info; { char *fontname = "9x15"; if ((*font_info=XLoadQueryFont(display,fontname)) == NULL) { printf("stderr, basicwin: cannot open 9x15 font\n"); exit(-1); } } draw_text(win, gc, font_info, win_width, win_height) Window win; GC gc; XFontStruct *font_info; unsigned int win_width, win_height; { int y = 20; char *string1 = "Hi! I'm a window, who are you?"; char *string2 = "To terminate program; Press any key"; char *string3 = "or button while in this window."; char *string4 = "Screen Dimensions:"; int len1, len2, len3, len4; int width1, width2, width3; char cd_height[50], cd_width[50], cd_depth[50]; int font_height; int y_offset, x_offset; len1 = strlen(string1); len2 = strlen(string2); len3 = strlen(string3); width1 = XTextWidth(font_info, string1, len1); width2 = XTextWidth(font_info, string2, len2); width3 = XTextWidth(font_info, string3, len3); XDrawString(display, win, gc, (win_width-width1)/2, y, string1, len1); XDrawString(display, win, gc, (win_width-width2)/2, (int)(win_height-35), string2, len2); XDrawString(display, win, gc, (win_width-width3)/2, (int)(win_height-15), string3, len3); sprintf(cd_height,"Height - %d pixels", DisplayHeight(display,screen)); sprintf(cd_width,"Width - %d pixels", DisplayWidth(display,screen)); sprintf(cd_depth,"Depth - %d plane(s)", DefaultDepth(display,screen)); len4 = strlen(string4); len1 = strlen(cd_height); len2 = strlen(cd_width); len3 = strlen(cd_depth); font_height = font_info->max_bounds.ascent + font_info->max_bounds.descent; //printf("Font height: %u - Win height: %u\n",font_height, win_height); y_offset = win_height/2 - font_height - font_info->max_bounds.descent; x_offset = (int) win_width/4; XDrawString(display, win, gc, x_offset, y_offset, string4, len4); y_offset += font_height; XDrawString(display, win, gc, x_offset, y_offset, cd_height, len1); y_offset += font_height; XDrawString(display, win, gc, x_offset, y_offset, cd_width, len2); y_offset += font_height; XDrawString(display, win, gc, x_offset, y_offset, cd_depth, len3); } draw_graphics(win, gc, window_width, window_height) Window win; GC gc; unsigned int window_width, window_height; { int x,y; unsigned int width, height; height = window_height/2; width = 3 * window_width/4; x = window_width/2 - width/2; y = window_height/2 - height/2; XDrawRectangle(display, win, gc, x, y, width, height); } TooSmall(win, gc, font_info) Window win; GC gc; XFontStruct *font_info; { char *string1 = "Too Small"; int x,y; y = font_info->max_bounds.ascent + 2; x = 2; XDrawString(display, win, gc, x, y, string1, strlen(string1)); } z88dk-1.8.ds1/examples/rcmx000/0000755000175000017500000000000010765202715015520 5ustar tygrystygrysz88dk-1.8.ds1/examples/rcmx000/baudmeas.asm0000755000175000017500000000150610571263042020003 0ustar tygrystygrys; ; Z88DK - Rabbit Control Module examples ; This file is part of baudmeas.c ; ; $Id: baudmeas.asm,v 1.1 2007/02/28 11:23:14 stefano Exp $ ; baudmeas: ld bc,0 ld de,07ffh l1: defb 0d3h ; ioi ld (2),a ; Any write triggers transfer defb 0d3h ; ioi ld hl,(2) ; RTC byte 0-1 defb 0dch ; and hl,de jr nz,l1 l3: inc bc push bc ld b,98h ld hl,8 l2: defb 0d3h ; ioi ld (hl),5ah ; WDTCR <= 5ah djnz l2 pop bc defb 0d3h ; ioi ld (2),a ; Any write triggers transfer defb 0d3h ; ioi ld hl,(2) ; RTC byte 0-1 bit 2,h jr Z,l3 ld h,b ld l,c ld de,8 add hl,de defb 0fch ; rr hl defb 0fch ; rr hl defb 0fch ; rr hl defb 0fch ; rr hl ld a,l ; Calculate same baudrate as bootstrap (2400) ; a := a*3*2*2*2 ld b,a add a,b add a,b ; a*3 add a,a ; a*3*2 add a,a ; a*3*2*2 add a,a ; a*3*2*2*2 (*24) ret z88dk-1.8.ds1/examples/rcmx000/baudmeas.c0000755000175000017500000000144210571263043017445 0ustar tygrystygrys/* Z88DK - Rabbit Control Module examples Measuring the RMC baud rate $Id: baudmeas.c,v 1.1 2007/02/28 11:23:15 stefano Exp $ */ #include static int baudmeas() { #asm push af ; push bc ; push de ; call baudmeas ; ld l,a ; ld h,0 ; pop de ; pop bc ; pop af ; ret #include "baudmeas.asm" #endasm } /** Simple hack just to set outgoing serial to the baudrate obtained earlier */ static int init_serial(int divisor) { #asm ; Set the baudrate to 2400 ; ld a,l ; serial divisor, low byte ; defb 0d3h ; ioi ; ld (0a9h),a ; #endasm } int main() { int divisor; divisor=baudmeas(); init_serial(divisor-1); printf("This little program should now have measured the baudrate.\n"); printf("The divisor was: %d\n", divisor); while (1); } z88dk-1.8.ds1/examples/rcmx000/example.c0000755000175000017500000000065210571263043017321 0ustar tygrystygrys/* Z88DK - Rabbit Control Module examples Simple demonstration of rudimentary stdin stdout capabilities $Id: example.c,v 1.1 2007/02/28 11:23:15 stefano Exp $ */ #include int main() { char ch; printf("Please enter a few characters and and see how target\n"); printf("echoes them back one by one...\n"); while (1) { ch=getchar(); printf("Target Got: %c\r", ch); } } z88dk-1.8.ds1/examples/rcmx000/hello.c0000755000175000017500000000010110571263043016756 0ustar tygrystygrys#include int main() { printf("Hello World!!!\n"); } z88dk-1.8.ds1/examples/rcmx000/Makefile0000755000175000017500000000150610761004002017146 0ustar tygrystygrys# Z88DK - Rabbit Control Module examples # # $Id: Makefile,v 1.3 2008/02/26 12:37:22 aralbrec Exp $ # You NEED to set this to your baudrate divisor and your serial port SERDEVICE=/dev/ttyXXX BAUD_DIV=XXX all: example.bin twinkle2000.bin twinkle3000.bin SUPPORT=/usr/local/lib/z88dk/support/rcmx000 example.bin: example.c zcc +rcmx000 -oexample.bin example.c twinkle2000.bin: zcc +rcmx000 -otwinkle2000.bin twinkle2000.c twinkle3000.bin: zcc +rcmx000 -otwinkle3000.bin twinkle3000.c run_example: $(SUPPORT)/boot -b $(SERDEVICE) $(BAUD_DIV) example.bin run_twinkle2000: $(SUPPORT)/boot -b $(SERDEVICE) $(BAUD_DIV) twinkle2000.bin run_twinkle3000: $(SUPPORT)/boot -b $(SERDEVICE) $(BAUD_DIV) twinkle3000.bin clean: rm -f *.bin ; rm -f *.LOD ; rm -f tmp_* ; rm -f zcc_opt.def ; \ rm -f *~ ; rm -f #* ; rm -f *# z88dk-1.8.ds1/examples/rcmx000/twinkle2000.c0000755000175000017500000000213010571263043017636 0ustar tygrystygrys/* Z88DK - Rabbit Control Module examples Led blinking for the Rabbit 2000 $Id: twinkle2000.c,v 1.1 2007/02/28 11:23:15 stefano Exp $ */ static void setup_io() { #asm ld a,84h ; defb 0d3h; ioi ; ld (24h),a ; #endasm } static void leds_on() { #asm ld a,00h ; leds on ; defb 0d3h; ioi ; ld (030h),a ; #endasm } static void leds_off() { #asm ld a,0ffh ; leds off ; defb 0d3h; ioi ; ld (030h),a ; #endasm } static int read_rtc() { #asm defb 0d3h ; ioi ; ld (2),a ; Any write triggers transfer ; defb 0d3h ; ioi ; ld hl,(2) ; RTC byte 0-1 ; #endasm } static int wait_rtc() { #asm push de ; push hl ; wait: defb 0d3h ; ioi ; ld (2),a ; Any write triggers transfer ; defb 0d3h ; ioi ; ld hl,(2) ; RTC byte 0-1 ; ld de,07fffh ; defb 0dch ; and hl,de ; jr nz, wait ; pop hl ; pop de ; #endasm } #include int main() { int i; setup_io(); while(1) { leds_on(); printf("LED ON....\n"); wait_rtc(); leds_off(); printf("LED OFF...\n"); wait_rtc(); } } z88dk-1.8.ds1/examples/rcmx000/twinkle3000.c0000755000175000017500000000207610571263043017650 0ustar tygrystygrys/* Z88DK - Rabbit Control Module examples Led blinking for the Rabbit 3000 $Id: twinkle3000.c,v 1.1 2007/02/28 11:23:15 stefano Exp $ */ void setup_io() { #asm ; This could have been better documented but its possible to look it up in the ; ; Rabbit3000 manuals ; ld a,0 ; defb 0d3h; ioi ; ld (4eh),a ; ld a,0ffh ; defb 0d3h; ioi ; ld (4fh),a ; #endasm } void leds_on() { #asm ld a,0 ; leds on ; defb 0d3h; ioi ; ld (48h),a ; #endasm } void leds_off() { #asm ld a,ffh ; leds off ; defb 0d3h; ioi ; ld (48h),a ; #endasm } static int wait_rtc() { #asm push de ; push hl ; wait: defb 0d3h ; ioi ; ld (2),a ; Any write triggers transfer ; defb 0d3h ; ioi ; ld hl,(2) ; RTC byte 0-1 ; ld de,7fffh ; defb 0dch ; and hl,de ; jr nz, wait ; pop hl ; pop de ; #endasm } #include int main() { int i; setup_io(); while(1) { leds_on(); printf("LED ON....\n"); wait_rtc(); leds_off(); printf("LED OFF...\n"); wait_rtc(); } } z88dk-1.8.ds1/examples/README0000644000175000017500000000012007425004723015176 0ustar tygrystygrysExamples. Console contains a few demos that should work on all machine targets z88dk-1.8.ds1/examples/rex/0000755000175000017500000000000010765202715015125 5ustar tygrystygrysz88dk-1.8.ds1/examples/rex/hello.c0000644000175000017500000000076307425004723016400 0ustar tygrystygrys/* * * Hello World for DS 6000 * * Written by Damjan Marion * */ #include int main() { MSG msg; int flag=1; DsEventClear(); DsClearScreen(); DsPrintf(90,20,16,"Hello World"); DsDialogTextButton(90, 80, 60, 20, 61, "Exit"); /*Wait for event*/ test(); while (flag) { DsEventMessageGet(&msg); switch(msg.message) { case MSG_DS_CLOSE: case MSG_DS_COMMAND: case MSG_DS_KEY_DOWN: flag=0; DsBeepOn(2); break; } } } z88dk-1.8.ds1/examples/rex/hello.res0000644000175000017500000000252207314344552016746 0ustar tygrystygrysAPPNAME Hello World COMMENT Made with z88dk ICON XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.... X...................................X... X....................................X.. X.....................................X. X......................................X X......X..X.XXXX.X....X.....XX.........X X......X..X.X....X....X....X..X........X X......X..X.X....X....X....X..X........X X......XXXX.XXX..X....X....X..X........X X......X..X.X....X....X....X..X........X X......X..X.X....X....X....X..X........X X......X..X.XXXX.XXXX.XXXX..XX.........X X......................................X X......................................X X......................................X X......................................X X......X..X..XX..XXX..X...XXX..........X X......X..X.X..X.X..X.X...X..X.........X X......X..X.X..X.X..X.X...X..X.........X X......X..X.X..X.XXX..X...X..X.........X X......XXXX.X..X.X..X.X...X..X.........X X......XXXX.X..X.X..X.X...X..X.........X X.......XX...XX..X..X.XXX.XXX..........X X......................................X X......................................X X......................................X X......................................X X......................................X X......................................X X......................................X X......................................X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX z88dk-1.8.ds1/examples/rex/README0000644000175000017500000000074307314342554016013 0ustar tygrystygrysA bit of mystery.. I don't know whether this will work at all, but here's a simple Rex 6000 example.. compile: zcc +rex -o hello.bin hello.c If you have compiled mkaddin (from support/) then you can create an addin in one go using: zcc +rex -create-app -o hello.bin hello.c (hello.bin is an intermediate binary file) This uses the file hello.res which contains the application name, coment and an icon in an obvious format If hello.res doesn't exist then the defaults are used z88dk-1.8.ds1/examples/sam/0000755000175000017500000000000010765202715015107 5ustar tygrystygrysz88dk-1.8.ds1/examples/sam/ansitest.c0000755000175000017500000000242407617701563017121 0ustar tygrystygrys/* * Test the ANSI terminal * * 15/4/2000 Stefano Bodrato * * Compile with zcc +zxansi ansitest.c */ #include "stdio.h" main() { int x; /* A stupid CSI escape code test (normally no use uses CSI) */ printf ("If you can read this, CSI is not working.\n"); /* printf ("%c2J",155); */ printf ("If this the first thing you can read, CSI is OK.\n"); /* Set Graphic Rendition test */ printf ("%c[1mBold Text\n",27); printf ("%c[2mDim text\n",27); printf ("%c[4mUnderlined Text\n",27); printf ("%c[24mUn-underlined text\n",27); printf ("%c[5mBlink Text\n",27); printf ("A new line\n",27); printf ("%c[25mUn-blink text\n",27); printf ("%c[7mReverse Text\n",27); printf ("%c[27mUn-reverse text\n",27); printf ("%c[8mConcealed Text\n",27); printf ("%c[m",27); for (x=37; x>29; x--) { printf ("%c[%umFore text color %u.\n",27,x,x); } for (x=40; x<48; x++) { printf ("%c[%umBack text color %u.\n",27,x,x); } /* Restore default text attributes */ printf ("%c[m",27); /* Cursor Position test "Draw" an X */ for (x=0; x<11; x++) { printf ("%c[%u;%uH*\n",27,8+x,22+x); printf ("%c[%u;%uH*\n",27,18-x,22+x); } } z88dk-1.8.ds1/examples/sam/cube.c0000644000175000017500000000577707617701563016220 0ustar tygrystygrys/***************************************************************************/ /* */ /* 3D Rotating Cube. Created for Amiga and PC by Stefan Henrikson 1993. */ /* */ /* Modified for Z88 BASIC 1993, SmallC+ Z88 1998 by Dennis Groning. */ /* */ /***************************************************************************/ #include #include #include #define MAX_X 256.0 #define MAX_Y 192.0 #define NODES 8 #define SIZE 24.0 /* djm speed ups */ #define MAX_X2 128.0 #define MAX_Y2 32.0 main() { double x[NODES], y[NODES], z[NODES]; double vx, vy, vz; double xg[NODES], yg[NODES], zg[NODES]; double mx, my, halfangle; double cx,cy,cz,sx,sy,sz; double t1,t2,t3; int node; vx=0; vy=0; vz=0; x[0]=-SIZE; y[0]=-SIZE; z[0]=-SIZE; x[1]=-SIZE; y[1]= SIZE; z[1]=-SIZE; x[2]= SIZE; y[2]= SIZE; z[2]=-SIZE; x[3]= SIZE; y[3]=-SIZE; z[3]=-SIZE; x[4]=-SIZE; y[4]=-SIZE; z[4]= SIZE; x[5]=-SIZE; y[5]= SIZE; z[5]= SIZE; x[6]= SIZE; y[6]= SIZE; z[6]= SIZE; x[7]= SIZE; y[7]=-SIZE; z[7]= SIZE; for(node=0;node!=NODES;node++) { xg[node]=x[node]; yg[node]=y[node]; zg[node]=z[node]; } while(getk()==0) { cx=cos(vx); cy=cos(vy); sx=sin(vx); sy=sin(vy); cz=cos(vz); sz=sin(vz); mx=(MAX_X2-SIZE*1.8)*cos(vx)+MAX_X2; my=(MAX_Y2-SIZE*1.8)*sin(vy)+MAX_Y2; for(node=0;node!=NODES;node++) { t1=yg[node]*cx-zg[node]*sx; t2=yg[node]*sx+zg[node]*cx; t3=xg[node]*cy; x[node] = (t3 + t2*sy)*cz; x[node] = x[node] - t1*sz; y[node] = (t3 + t2*sy)*sz; y[node] = y[node] + t1*cz; z[node]=-xg[node]*sy+t2*cy; } vx+=0.003; vy+=0.005; vz+=0.002; clg(); draw(x[0]+mx,y[0]+my,x[1]+mx,y[1]+my); draw(x[1]+mx,y[1]+my,x[2]+mx,y[2]+my); draw(x[2]+mx,y[2]+my,x[3]+mx,y[3]+my); draw(x[3]+mx,y[3]+my,x[0]+mx,y[0]+my); draw(x[4]+mx,y[4]+my,x[5]+mx,y[5]+my); draw(x[5]+mx,y[5]+my,x[6]+mx,y[6]+my); draw(x[6]+mx,y[6]+my,x[7]+mx,y[7]+my); draw(x[7]+mx,y[7]+my,x[4]+mx,y[4]+my); draw(x[0]+mx,y[0]+my,x[4]+mx,y[4]+my); draw(x[3]+mx,y[3]+my,x[7]+mx,y[7]+my); draw(x[2]+mx,y[2]+my,x[6]+mx,y[6]+my); draw(x[1]+mx,y[1]+my,x[5]+mx,y[5]+my); } } z88dk-1.8.ds1/examples/sam/dstar.c0000644000175000017500000002454007444333071016375 0ustar tygrystygrys/* * dstar.c * * dstarz88 is a conversion of a TI86 game I found with * source on www.ticalc.org. * * The original program was written by Andrew Von Dollen who * in turn based it on a HP game by Joe W. * * The aim of the game is to collect all the clear bubbles by * running over them. You control either the dark bubble or * the solid box. The dark bubble is used to collect the clear * bubbles, and the solid box is used as a sort of movable wall. * * Both objects carry on moving until they hit something else * (except for the dark bubble in the case of clear bubbles). * * The keys are defined in #define statements, and default thus: * * Up: Q * Down: A * Left: O * Right: P * Quit: G * Retry: H * Switch: [SPACE] * * Switch changes between the dark bubble and the solid box. * * This is the first game ever produced with the Small C compiler - * it was written as a statement saying that it is possible to * write something easily, quickly and efficiently using the * compiler. Hopefully it will be an encouragement for others to * do likewise! * * For your interest I've also included the original Z88 converted * assembler from which I worked - it's quite crude but it just * about functions, the C is much more refined! * * Enough twaddle, enjoy the game and study the source! * * d. 1/12/98 * * * Rejigged for the Spectrum 17/5/99 djm * */ /* Skip closeall() gunk */ #pragma output nostreams /* Call up the required header files */ #include #include #include /* dstar.h contains the levels and "sprite" data */ #include "dstar.h" #define NO 0 #define MAXLEVEL 25 #define STARTLEV 0 /* Start level -1 */ /* Block numbers.. */ #define WALL 1 #define BUBB 2 #define BALL 3 #define BOX 4 /* Key definitions, change these to define your keys! */ #define K_UP 'Q' #define K_DOWN 'A' #define K_LEFT 'O' #define K_RIGHT 'P' #define K_SWITCH 32 #define K_EXIT 'G' #define K_CLEAR 'H' /* Declare some variables to start off with! */ char balloffset; /* Ball position */ char boxoffset; /* Box position */ char ballorbox; /* 1 if box, 0 if ball */ char level; /* Take a guess! */ char board[144]; /* Level internal map thing */ char tiscr[1024]; /* Our very own TI86 screen! */ /* prototype to stop barfing */ void redrawscreen(void); main() { redrawscreen(); /* Define the windows */ playgame(); /* Play the game */ myexit(); /* Clean up after ourselves */ } myexit() { exit(0); /* Get outta here! */ } playgame() { setupgame(); /* Set level to 1, get level etc */ /* Loop while checkfinish() says we haven't finished! */ while ( checkfinish() ) { gamekeys(); /* Scan keys */ } } /* Set some variables up at the start.. */ setupgame() { ballorbox=NO; level=STARTLEV; setuplevel(); } gamekeys() { char *charptr; /* Set up a pointer to the variable we want to change (either for * box or for ball */ if (ballorbox) charptr=&boxoffset; else charptr=&balloffset; switch( toupper(getk()) ) { /* Use OZ to get the key */ case K_DOWN: down(charptr); break; case K_UP: up(charptr); break; case K_RIGHT: right(charptr); break; case K_LEFT: left(charptr); break; case K_SWITCH: ballorbox^=1; /* Toggle ball/box */ break; case K_EXIT: myexit(); case K_CLEAR: setuplevel(); } } /* Movement functions - all of these are pretty well similar so I * will only comment the first one - it's fairly obvious what is * happening though */ left(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn-1)) ) return; *(locn-1)=*locn; *locn=0; (*ptr)--; /* ptr is the location of blob */ drawboard(); /* Draw screen */ } } right(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn+1)) ) return; *(locn+1)=*locn; *locn=0; (*ptr)++; drawboard(); } } down(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn+16)) ) return; *(locn+16)=*locn; *locn=0; (*ptr)+=16; drawboard(); } } up(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if ( standardmiddle(*(locn-16)) ) return; *(locn-16)=*locn; *locn=0; (*ptr)-=16; drawboard(); } } /* Check to see if we're running into anything, if box is set then * if we hit anything we want to stop, if we're ball then if we * hit anything except for bubble we wanna stop */ standardmiddle(char nextpos) { if (ballorbox) return (nextpos); /* For box */ else if (nextpos==BUBB || nextpos==NO) return(0); return(1); } /* Check to see if a level is finished * There are 144 squares in each level, note the use of != instead of * >6)&3; *ptr2++=((*ptr)>>4)&3; *ptr2++=((*ptr)>>2)&3; *ptr2++=(*ptr)&3; ptr++; } } /* Now, plot the ball and box into the internal map */ ptr2=board; *(ptr2+balloffset)=BALL; *(ptr2+boxoffset)=BOX; drawboard(); } /* Define the text window and the graphics window * If can't open graphics window then exit gracefully */ void redrawscreen(void) { /* #asm ld hl,16384 ld de,16385 ld bc,6143 ld (hl),0 ldir ld (hl),56 ld bc,767 ldir ld a,7 out (254),a ld a,56 ld (23624),a ld a,8 ld (23568),a #endasm */ puts_cons(" DStar Z88 - C Demo"); puts_cons("Original game By A Von Dollen"); puts_cons(" Converted to ZX By D Morris"); puts_cons(" Keys: Q,A,O,P,SPACE,H,G"); } /* Draw the board, mostly written in C, even though we did take a bit * of a performance hit when it was converted over from asm */ drawboard() { int x,y; char *ptr; ptr=board; for (y=0;y!=9;y++) { for (x=0;x!=16;x++) { puttiblock((*ptr++),x,y); } } /* dozxcopyasm(); */ } /* Dump a sprite onto the TI screen we've built * The TI screen is 16 characters wide by 8 deep i.e. half the size * of the Z88's map screen. It's stored line by line (sensible!) * * We enter with y being y/7 and x being x/8 (if we think in pixels) * So for each y we have to step down by 112. * The increment between rows is 16. */ puttiblock(char spr,int x, int y) { char *ptr2,*ptr; int i; /* We use this method instead of y*=112 because the compiler has special * cases for multiplying by ints less than 16 (except for 11 and 13 * (Hmmm, I wonder why?!?!) */ y=(y*14)*8; /* So, get where we want to dump our sprite into ptr */ ptr=tiscr+y+x; /* Calculate where the sprite is */ spr*=8; ptr2=sprites+spr; /* And dump it in there */ for (i=0; i!=7;i++) { *ptr=*(ptr2++); ptr+=16; } } /* Ooops, forgive me this one bit of assembler in the entire program! * This just copies the TI screen onto the OZ map. * * It really is easier to keep this routine in here, change it into * C if you like.. */ dozxcopyasm() { #asm ld de,18432+8 ld hl,_tiscr ld c,8*8-1 .zxscrcpy1 push de ld b,16 .zxscrcpy2 ld a,(hl) ld (de),a inc de inc hl djnz zxscrcpy2 pop de call drow dec c jr nz,zxscrcpy1 ret .drow inc d ld a,7 and d ret nz ld a,e add a,32 ld e,a ret c ld a,d sub 8 ld d,a ret #endasm } /* THE END! */ z88dk-1.8.ds1/examples/sam/dstar.h0000644000175000017500000003151407444333071016401 0ustar tygrystygrys/* * Sprite and level data for DStar * Stored in #asm statements * * Even though the sprites are only 7 bytes long, we align them at 8 * bytes, so calculations go that little bit quicker! */ extern char levels[]; extern char sprites[]; #asm .smc_sprites ;1=edge, 2=clear ball 3=moveable ball 4=moveable block defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 0 defb @01111110 defb @10101001 defb @11000111 defb @10110001 defb @11001011 defb @10100101 defb @01111110 defb 0 defb @00000000 defb @00011000 defb @00100100 defb @00100100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 defb @00011000 defb @00110100 defb @00111100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 defb @00111100 defb @00111100 defb @00111100 defb @00111100 defb @00000000 defb @00000000 defb 0 #endasm #asm .smc_levels defb 17,30 ;ball offset, box offset defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@00000000,@00000000,@10010001 defb @01000000,@00000000,@00000010,@00010101 defb @01000000,@00000000,@01011000,@00000001 defb @01000000,@01010010,@00000000,@00000101 defb @01010010,@00001000,@00000000,@10000001 defb @01001000,@00000000,@00100101,@00100001 defb @01000000,@00000101,@10000000,@00001001 defb @01010101,@01010101,@01010101,@01010101 .level2 defb 30,86 defb @00010000,@01000100,@01000000,@01000101 defb @01000000,@10000000,@00000000,@00000001 defb @00000001,@10000001,@10000000,@10000000 defb @01000100,@10000000,@00001000,@00010001 defb @00000000,@00000100,@00001000,@00000100 defb @01000000,@00010001,@00001000,@00000001 defb @00000001,@00000100,@01000000,@01101001 defb @01000000,@00000000,@00000000,@00000100 defb @00010000,@01000000,@00000000,@00010000 .level3 defb 30,46 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@10010001 defb @01000000,@01010000,@00000000,@01010001 defb @01000000,@01100000,@00000010,@00000001 defb @01001000,@00000000,@10010100,@00001001 defb @01000110,@00001000,@00100100,@00100101 defb @01000101,@10000110,@00001000,@10010101 defb @01100000,@00000101,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level4 defb 125,30 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01000000,@00000100,@00000000,@00000001 defb @01011001,@10001001,@10011001,@10011001 defb @01000100,@01100010,@01000100,@01000101 defb @01011001,@10011000,@10011001,@10011001 defb @01000000,@00000100,@00000000,@00000001 defb @01000000,@01000000,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level5 defb 17,110 defb @00010101,@01010101,@01010101,@01010100 defb @01000000,@01000000,@01000001,@00000001 defb @01000001,@10000100,@10000010,@00010001 defb @01010000,@00000000,@01000001,@00000001 defb @01100001,@10010000,@00000000,@00000101 defb @01010000,@00000001,@00100001,@00000001 defb @01100100,@00010001,@00010000,@00010001 defb @01000000,@01000000,@00100100,@00011001 defb @00010101,@01010101,@01010101,@01010100 .level6 defb 65,113 defb @00000000,@01010101,@01010101,@01010101 defb @00000001,@00000010,@00000001,@10001001 defb @00000100,@00000010,@00000000,@01000101 defb @00010000,@00000010,@00000000,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01010000,@00000010,@00000100,@00000101 defb @01000000,@00000010,@00000000,@01000001 defb @01000001,@00000010,@00000101,@10000001 defb @01010101,@01010101,@01010101,@01010101 .level7 defb 115,122 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00000001 defb @00010100,@01010100,@00011000,@01011001 defb @00011000,@00011000,@01000100,@01000100 defb @00000100,@00010000,@01010100,@01010000 defb @00010100,@00010000,@01100100,@01100100 defb @01000000,@00000000,@00000000,@00000001 defb @01000000,@01100000,@00000000,@00011001 defb @01010101,@01010101,@01010101,@01010101 .level8 defb 108,98 defb @01010101,@01010101,@01010101,@01010100 defb @01000010,@01010000,@00000000,@00000101 defb @01000001,@10000001,@01001000,@00000001 defb @01000010,@01010001,@00011000,@00000001 defb @01010000,@00000001,@01000001,@10010001 defb @01010001,@00000000,@00000010,@01100001 defb @01100010,@01000000,@10000001,@00010001 defb @01010000,@00000000,@00000000,@00000001 defb @00010101,@01010101,@01010101,@01010101 .level9 defb 30,72 defb @00000100,@01010101,@01010101,@01010100 defb @00011001,@10000000,@00000001,@00000001 defb @01100010,@01000000,@00100000,@00000100 defb @00010001,@00001001,@01000010,@01000001 defb @01000001,@10000110,@00100000,@00001001 defb @01000000,@00001001,@01000000,@00000100 defb @01100110,@00000000,@00000000,@00010000 defb @01000000,@00000000,@00000000,@01000000 defb @01010101,@01010101,@01010101,@00000000 .level10 defb 93,36 defb @00000000,@01010101,@01010101,@01010100 defb @01010101,@00100000,@00000000,@00000001 defb @01000000,@00000101,@01100010,@01001001 defb @01001000,@00000110,@00011000,@00000100 defb @01000000,@00000100,@00100000,@01001001 defb @01100110,@00000100,@10010000,@01000100 defb @00011000,@00000101,@01000001,@01010000 defb @01000000,@00000000,@00000100,@01000100 defb @00010101,@01010101,@01010000,@01000001 .level11 defb 30,108 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000001,@00000000,@00000001 defb @01000001,@10100000,@00000010,@10000101 defb @01010000,@00100000,@00010100,@00001001 defb @01100000,@00000110,@01101000,@00010101 defb @01010001,@01000000,@00010100,@00000001 defb @01100000,@10010010,@00000000,@00001001 defb @01011001,@01010000,@00000100,@00000101 defb @00010100,@01010101,@01010101,@01010100 .level12 defb 17,92 defb @01010000,@00000001,@01000001,@01010100 defb @01000101,@01010110,@00010101,@00100101 defb @01000000,@00101000,@00000000,@10000001 defb @01000101,@00000101,@10000001,@10010001 defb @01000100,@10000101,@01100001,@01000001 defb @01000101,@00000101,@00000001,@00010001 defb @01000000,@00001000,@00000000,@00000001 defb @01000000,@00000000,@00100000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level13 defb 18,113 defb @00010101,@01010101,@01010101,@01010100 defb @01000001,@00000000,@00000000,@10000101 defb @01000100,@00000110,@00000010,@01010001 defb @01000000,@00000000,@10000000,@00010001 defb @01001000,@00000000,@00000000,@00011001 defb @01000100,@00000000,@00100000,@00000001 defb @01010000,@00000000,@10001000,@00011001 defb @01000000,@01000000,@00100001,@00010001 defb @00010101,@01010101,@01010101,@01010100 .level14 defb 36,50 defb @01010101,@01010101,@01010101,@01010101 defb @01100110,@00000000,@00000000,@10011001 defb @01001001,@00000000,@00000001,@01000001 defb @01000000,@00000000,@00000010,@00000001 defb @01000000,@00000000,@00100100,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01001001,@00000000,@00000000,@01000001 defb @01100110,@00000000,@00000000,@10011001 defb @01010101,@01010101,@01010101,@01010101 .level15 defb 51,76 defb @00010101,@01010100,@01010101,@01010100 defb @01000000,@00001001,@00000000,@00100001 defb @01000100,@10000100,@00010000,@00100001 defb @01000000,@01000000,@01101000,@01100001 defb @00010001,@00000001,@00100000,@00010001 defb @01100000,@00000000,@00010000,@01100001 defb @00010000,@00000000,@10000000,@00000100 defb @01100000,@00000000,@00000000,@00001001 defb @00010101,@01010101,@01010101,@01010100 .level16 defb 35,19 defb @01010101,@01010101,@01010101,@01010101 defb @01010000,@01100010,@00000000,@00001001 defb @01100000,@10011000,@00000000,@00000101 defb @01010001,@01010000,@00001000,@00000101 defb @01010000,@00000010,@01100100,@00000001 defb @01101000,@00000000,@00001001,@10000001 defb @01010010,@00000000,@01010101,@10000001 defb @01011001,@00000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level17 defb 29,124 defb @01010101,@01010101,@01010101,@01010101 defb @01001001,@00000000,@00000000,@01000001 defb @01000100,@00100110,@10011000,@00010001 defb @01000000,@00011001,@01100100,@10000001 defb @01001001,@00000000,@00000010,@01000001 defb @01000010,@01100000,@00001001,@00000001 defb @01000100,@00010001,@01100100,@00010001 defb @01000000,@00100001,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level18 defb 115,26 defb @01010101,@01010101,@01010101,@01010101 defb @01001000,@00000010,@00000001,@00000001 defb @01000001,@10011000,@00000110,@00000001 defb @01000000,@01100100,@00000001,@10000001 defb @01000000,@10000001,@00000010,@01100001 defb @01000110,@01000000,@01001001,@00000001 defb @01001001,@10000100,@10000100,@00000001 defb @01100100,@00000100,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level19 defb 126,110 defb @01010101,@01010101,@01010101,@01010101 defb @01100000,@00010100,@00000000,@01011001 defb @01000100,@00010000,@00000000,@01100001 defb @01001001,@00000010,@01010000,@10000001 defb @01000100,@00000001,@10000000,@00000001 defb @01000000,@00010000,@00100100,@00000001 defb @01000101,@00100100,@01011000,@00010001 defb @01001001,@00011000,@00000000,@01010001 defb @01010101,@01010101,@01010101,@01010101 .level20 defb 77,66 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@10011000,@00000000,@00000001 defb @01011000,@00100100,@01011000,@00000101 defb @01000100,@01001000,@00000100,@00010001 defb @01000000,@01000001,@01000001,@00001001 defb @01000100,@00010000,@00100001,@00010001 defb @01010000,@00100101,@00011000,@00100101 defb @01000000,@00000000,@00100110,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level21 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@01000000,@00001000,@00000101 defb @01000000,@01000000,@00000000,@01000101 defb @01000000,@01011000,@00000000,@00100001 defb @01000010,@00000000,@10000000,@10000101 defb @01000000,@00010000,@00000101,@01100001 defb @01000010,@00100000,@00000010,@00101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level22 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01100100,@00011001,@00011000,@00010001 defb @01000000,@00010000,@00000000,@00000001 defb @01100000,@00010000,@01100000,@10000001 defb @01010001,@10000000,@00000010,@00010101 defb @01001000,@01000000,@01010110,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level23 defb 103,105 defb @00010101,@01010101,@01010101,@01010100 defb @01000100,@00011001,@00011000,@00010001 defb @01000000,@00100000,@01000000,@00000001 defb @01010000,@00010000,@00100001,@10000001 defb @01000001,@10000001,@00001010,@00100001 defb @01011000,@01000000,@01010010,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @00010101,@01010101,@01010101,@01010100 defb @00000000,@00000000,@00000000,@00000000 .level24 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000100,@00000000,@00000101 defb @01000101,@10001000,@00000001,@01100101 defb @01000110,@00000000,@00100100,@00010101 defb @01001010,@00001001,@00010100,@00000001 defb @01000110,@00100001,@00000000,@01010001 defb @01000101,@00000000,@01000101,@01101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level25 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01001000,@01011000,@00001000,@00000001 defb @01000000,@01100000,@10000001,@01000001 defb @01001000,@00000001,@01000001,@10000001 defb @01000110,@00000010,@01000000,@00100001 defb @01000101,@10000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 #endasm z88dk-1.8.ds1/examples/sam/enigma.c0000644000175000017500000000745607444333071016527 0ustar tygrystygrys/* 3 rotor Enigma simulation * Converted over to Small C by D Morris 11/9/98 * * As you can see Small C doesn't do multidimensional arrays! * If you want to see how this program works have a look at * the BBC Basic program enigma.bas in this directory * */ #include #include #include /* Rotor Wirings */ unsigned char rotor[]="EKMFLGDQVZNTOWYHXUSPAIBRCJAJDKSIRUXBLHWTMCQGZNPYFVOEBDFHJLCPRTXVZNYEIWGAKMUSQOESOVPZJAYQUIRHXLNFTGKDCMWBVZBRGITYUPSDNHLXAWMJQOFECK"; unsigned char ref[]= "YRUHQSLDPXNGOKMIEBFZCWVJAT"; unsigned char notch[]="QEVJZ"; unsigned int flag=0; /*Encryption parameters */ unsigned char order[3]={ 3, 1, 2 }; unsigned char rings[3]={ 'W','X','T' }; unsigned char pos[3]={ 'A','W','E' }; unsigned char plug[]="AMTE"; main() { unsigned int i,j,n; unsigned int ch; n=0; puts("Enter text to be (de)coded, finish with a ."); while(1>0) { ch=getchar(); ch=toupper(ch); if (ch == '.') exit(0); if (!isalpha(ch)) continue; /* Step up first rotor */ pos[0]++; if (pos[0]>'Z') pos[0] -= 26; /* Check if second rotor reached notch last time */ if (flag) { /* Step up second and third rotors */ pos[1]++; if (pos[1]>'Z') pos[1] -= 26; pos[2]++; if (pos[2]>'Z') pos[2] -= 26; flag=0; } /* Step up seconond rotor if first rotor reached notch */ if (pos[0]==notch[order[0]-1]) { pos[1]++; if (pos[1]>'Z') pos[1] -= 26; if (pos[1]==notch[order[1]-1]) flag=1; } /*Swap pairs of letters on plugboard */ for (i=0; plug[i]; i+=2) { if (ch==plug[i]) ch=plug[i+1]; else if (ch==plug[i+1]) ch=plug[i]; } /* Rotors (forward) */ for (i=0; i<3; i++) { ch += pos[i]-'A'; if (ch>'Z') ch -=26; ch -= rings[i]-'A'; if (ch<'A') ch +=26; ch=rotor[((order[i]-1)*26)+ch-'A']; ch += rings[i]-'A'; if (ch>'Z') ch -=26; ch -= pos[i]-'A'; if (ch<'A') ch +=26; } /* Reflecting rotor */ ch=ref[ch-'A']; /*Rotors (Reverse) */ for (i=3; i; i--) { ch += pos[i-1]-'A'; if (ch>'Z') ch -=26; ch -= rings[i-1]-'A'; if (ch<'A') ch +=26; for (j=0; j<26; j++) if (rotor[(26*(order[i-1]-1))+j]==ch) break; ch=j+'A'; ch += rings[i-1]-'A'; if (ch>'Z') ch -=26; ch -= pos[i-1]-'A'; if (ch<'A') ch +=26; } /* Plugboard */ for (i=0; plug[i]; i+=2) { if (ch==plug[i]) ch=plug[i+1]; else if (ch==plug[i+1]) ch=plug[i]; } n++; putchar(ch); if (n%5==0) if (n%55==0) putchar('\n'); else putchar(' '); } } z88dk-1.8.ds1/examples/sam/gfx.c0000644000175000017500000000121507444333071016036 0ustar tygrystygrys #include #include #include struct window mine; /* Window structure */ main() { int j,i; clg(); /* Draw a series of concentric circles in the centre of the screen * these go off the screen but don't generate an error - very cool! */ for (i=90 ; i!=0; i--) { circle(128,96,i,1); if (i < 25 ) i--; } draw(0,0,255,63); /* Draw a diamond - weak, but it demonstrates relative drawing! */ plot(200,32); drawr(10,10); drawr(10,-10); drawr(-10,-10); drawr(-10,10); } z88dk-1.8.ds1/examples/sam/graygfx.c0000644000175000017500000000201507444333071016720 0ustar tygrystygrys #include #include #include #pragma string name GrayTest main() { int x,a; g_clg(G_WHITE); for (x=1;x<95;x++) { a=50-x; g_plot (x,32-(a*a/80),G_BLACK); } g_draw(3,3,93,3,G_DARK); g_draw(3,3,3,61,G_DARK); g_draw(93,3,93,61,G_DARK); g_draw(3,61,93,61,G_DARK); g_draw(2,2,92,2,G_LIGHT); g_draw(2,2,2,60,G_LIGHT); g_draw(92,2,92,60,G_LIGHT); g_draw(2,60,92,60,G_LIGHT); /* Draw a diamond - weak, but it demonstrates relative drawing! */ g_plot(61,25,G_DARK); g_drawr(15,15,G_DARK); g_drawr(15,-15,G_DARK); g_drawr(-15,-15,G_DARK); g_drawr(-15,15,G_DARK); g_circle(30,30,20,1,G_BLACK); g_circle(30,30,28,1,G_BLACK); g_page(1); fill(8,30); fill(70,30); g_page(0); fill(30,5); g_circle(30,30,25,1,G_WHITE); g_circle(30,30,40,1,G_BLACK); g_circle(30,30,41,1,G_DARK); g_circle(30,30,42,1,G_LIGHT); g_circle(30,30,43,1,G_WHITE); //while (1 != 2) {}; } z88dk-1.8.ds1/examples/sam/hello.c0000644000175000017500000000015107617701564016363 0ustar tygrystygrys#include main() { printf("Hello, world(1)\n"); fputs("Hello, world(2)\n",stdout); } z88dk-1.8.ds1/examples/sam/keyget.c0000644000175000017500000000022407444333071016541 0ustar tygrystygrys#include main() { unsigned char a; while (1) { a = getk(); /* fputs("a",stdout); */ printf("%u\n", a); } } z88dk-1.8.ds1/examples/sam/Makefile0000644000175000017500000000131410765022535016546 0ustar tygrystygrysPROGS = hello keyget dstar enigma gfx smile cube mandel ansi all: $(PROGS) hello: hello.c zcc +sam -vn hello.c -o hello keyget: keyget.c zcc +sam -vn keyget.c -o keyget gfx: gfx.c zcc +sam -vn gfx.c -o gfx graygfx: zcc +sam -vn graygfx.c -o graygfx smile: smile.c zcc +sam -vn smile.c -o smile cube: cube.c zcc +sam -vn cube.c -o cube -lm dstar: dstar.c dstar.h zcc +sam -vn dstar.c -o dstar enigma: enigma.c zcc +sam -vn enigma.c -o enigma mandel: mandel.c zcc +sam -vn mandel.c -o mandel -lm rpn: zcc +sam -vn rpn.c -o rpn -lndos adv: zcc +sam -vn adv_a.c -o adv_a -lndos ansi: zcc +samansi -vn ansitest.c -o ansitest -lndos clean: $(RM) *.i *.asm *.op* *.o *~ zcc_opt.def $(PROGS) z88dk-1.8.ds1/examples/sam/mandel.c0000644000175000017500000000127507444333071016520 0ustar tygrystygrys #include #include #include #pragma string name GrayMandelbrot float a,b,c,d,e,g,h,i,j; int x,y; int xmax,ymax; int k; float l,m,n,o,p; void main() { clg(); xmax=256; ymax=192; a=-2.0; b=2.0; c=a; d=b; e=4.0; g=(b-a)/(float)xmax; h=(d-c)/(float)ymax; for(y=ymax; y>0; y--) { j=(float)y*h+c; for(x=xmax; x>0; x--) { i=(float)x*g+a; k=0; l=0.0; m=0.0; n=0.0; o=0.0; l110: k++; if (k<100) //Iterates { p=n-o+i; m=2.0*l*m+j; l=p; n=l*l; o=m*m; //printf ("%f ",e); if ((n+o) #include char smile[] = { 8,8, 0x3C, /* defb @00111100 ; oooo */ 0x42, /* defb @01000010 ; o o */ 0xA5, /* defb @10100101 ;o o o o */ 0xA5, /* defb @10100101 ;o o o o */ 0x81, /* defb @10000001 ;o o */ 0xA5, /* defb @10100101 ;o o o o */ 0x5A, /* defb @01011010 ; o oo o */ 0x3C /* defb @00111100 ; oooo */ }; main() { char x, y, temp; for(y=0 ; y<8 ; y++) { temp = smile[y+2]; for(x=0 ; x<8 ; x++) { if(temp & 1) { putsprite(spr_or, 8 * x, 8 * y, smile); } temp >>= 1; } } getk(); /*pause*/ } z88dk-1.8.ds1/examples/sms/0000755000175000017500000000000010765202715015131 5ustar tygrystygrysz88dk-1.8.ds1/examples/sms/apktest.c0000755000175000017500000000111310630364747016754 0ustar tygrystygrys#include #include unsigned char pal1[] = {0x00, 0x20, 0x08, 0x28, 0x02, 0x22, 0x0A, 0x2A, 0x15, 0x35, 0x1D, 0x3D, 0x17, 0x37, 0x1F, 0x3F}; unsigned char pal2[] = {0x00, 0x03, 0x08, 0x28, 0x02, 0x22, 0x0A, 0x2A, 0x15, 0x35, 0x1D, 0x3D, 0x17, 0x37, 0x1F, 0x3F}; extern char testtxt_apk[]; void main() { char buf[100]; aplib_depack(testtxt_apk, buf); set_vdp_reg(VDP_REG_FLAGS1, VDP_REG_FLAGS1_SCREEN); load_tiles(standard_font, 0, 255, 1); load_palette(pal1, 0, 16); load_palette(pal2, 16, 16); printf(buf); for (;;) { wait_vblank_noint(); } } z88dk-1.8.ds1/examples/sms/batnball.til0000755000175000017500000000020010630364747017422 0ustar tygrystygrysr|ppfx~~fx~~fx~~fx~~fx~~fx~~fx~~fx~~~pp@<<~~ |8~<z88dk-1.8.ds1/examples/sms/bkg.til0000755000175000017500000000040010630364747016410 0ustar tygrystygrysUUUUUUUUUUUUUÁz88dk-1.8.ds1/examples/sms/car1.til0000755000175000017500000000010010630364747016470 0ustar tygrystygrys88 ? /00/ ? 88ddz88dk-1.8.ds1/examples/sms/chicken.c0000755000175000017500000000445410630370127016705 0ustar tygrystygrys#define __HAVESEED #include #include #define VDP_REG_HBL_COUNTER 0x8A unsigned char pal1[] = {0x2A, 0x3F, 0x0F, 0x00, 0x01, 0x02, 0x03, 0x17, 0x15, 0x35, 0x1D, 0x3D, 0x17, 0x37, 0x1F, 0x03}; unsigned char pal2[] = {0x2A, 0x3F, 0x0F, 0x00, 0x10, 0x20, 0x30, 0x35, 0x15, 0x35, 0x1D, 0x3D, 0x17, 0x10, 0x20, 0x03}; unsigned int road_pattern[] = {0x0001, 0x0002, 0x0000, 0x0000}; unsigned int top_sidewalk_pattern[] = {0x0004, 0x0004, 0x0005}; unsigned int bottom_sidewalk_pattern[] = {0x0006, 0x0004}; unsigned int central_strip_pattern[] = {0x0003}; unsigned int car1_map_r[] = {0x0008, 0x0009}; unsigned int car1_map_l[] = {0x0209, 0x0208}; extern unsigned char chicken_graphics(); int rand_speed() { return (rand() & 0x3F) + 0x0A; } void main() { int x = 0; int y = 0; int i, j; int ply_x = 120; int ply_y = 92; int ply_tile = 'H'; int ply2_x = 120; int ply2_y = 100; int ply2_tile = 'H'; int raster[10], speeds[10], *p, *p2; char *c; for (y = 2; y < 22; y += 2) { for (x = 0; x != 32; x += 2) { set_bkg_map(road_pattern, x, y, 2, 2); } for (x = 0; x != 32; x += 4) { if (y < 12) { set_bkg_map(car1_map_r, x, y+1, 2, 1); } else { set_bkg_map(car1_map_l, x, y+1, 2, 1); } } } for (x = 0; x != 32; x ++) { set_bkg_map(top_sidewalk_pattern, x, 0, 1, 3); set_bkg_map(bottom_sidewalk_pattern, x, 22, 1, 3); set_bkg_map(central_strip_pattern, x, 12, 1, 1); } for (i = 0, p2 = speeds; i != 5; i++, p2++) { (*p2) = rand_speed(); } for (i = 0; i != 5; i++, p2++) { (*p2) = -rand_speed(); } set_vdp_reg(VDP_REG_FLAGS1, VDP_REG_FLAGS1_SCREEN); load_tiles(chicken_graphics, 0, 255, 4); load_palette(pal1, 0, 16); load_palette(pal2, 16, 16); // add_pause_int(pause_handler); for (;;) { p = raster; p2 = speeds; j = 0; x = 1; y = 16; while (get_vcount() != 0) { } x = (*p) >> 4; while (y < 176) { while (get_vcount() < y) { } if (j & 0x01) { load_palette(pal1, 0, 16); } else { load_palette(pal2, 0, 16); } scroll_bkg(x, y); (*p) += (*p2); p++; p2++; x = (*p) >> 4; y += 14; j++; while (get_vcount() < y) { } scroll_bkg(0, 0); y += 2; } load_palette(pal1, 0, 16); scroll_bkg(0, 0); wait_vblank_noint(); } } z88dk-1.8.ds1/examples/sms/chicken_graphics.asm0000755000175000017500000000015110630370127021111 0ustar tygrystygrys XLIB _chicken_graphics ._chicken_graphics BINARY "road.til" BINARY "sidewalk.til" BINARY "car1.til" z88dk-1.8.ds1/examples/sms/icons.til0000755000175000017500000000060010630364750016754 0ustar tygrystygrys$Hn` Hi Hi$Hn Hh Hh l ,HHH@DHHd6@M`$$,48@xx5U`u5U`u8@xx8@xx8@xx8@xx?_uuj{{Df"Dff"Dff"Dff"DffDf:F<<B<0< <z88dk-1.8.ds1/examples/sms/libctest.c0000755000175000017500000000115110630364750017106 0ustar tygrystygrys#include #include unsigned char pal1[] = {0x00, 0x20, 0x08, 0x28, 0x02, 0x22, 0x0A, 0x2A, 0x15, 0x35, 0x1D, 0x3D, 0x17, 0x37, 0x1F, 0x3F}; unsigned char pal2[] = {0x00, 0x03, 0x08, 0x28, 0x02, 0x22, 0x0A, 0x2A, 0x15, 0x35, 0x1D, 0x3D, 0x17, 0x37, 0x1F, 0x3F}; void main() { int y = 0; set_vdp_reg(VDP_REG_FLAGS1, VDP_REG_FLAGS1_SCREEN); load_tiles(standard_font, 0, 255, 1); load_palette(pal1, 0, 16); load_palette(pal2, 16, 16); printf("Hello, stdio!\nIs it working?\nI hope so."); gotoxy(5, 5); printf("Hello, gotoxy(%d, %d)!", 5, 5); for (;;) { wait_vblank_noint(); } } z88dk-1.8.ds1/examples/sms/Makefile0000755000175000017500000000242510630373256016577 0ustar tygrystygrys all: test.sms libctest.sms pongmstr.sms pngmstr2.sms apktest.sms chicken.sms testsnd.sms test.sms: test.c zcc +sms test.c -o test.sms -m echo test.map test.sym libctest.sms: libctest.c zcc +sms libctest.c -o libctest.sms -m echo libctest.map libctest.sym pong_graphics.o: pong_graphics.asm batnball.til numbers.til bkg.til icons.til z80asm -d -ns -nm -Mo pong_graphics.asm testtxt_apk.o: testtxt_apk.asm testtxt.apk z80asm -d -ns -nm -Mo testtxt_apk.asm pongmstr.sms: pong_graphics.o pongmstr.c zcc +sms pong_graphics.o pongmstr.c -o pongmstr.sms -m -create-app echo pongmstr.map pongmstr.sym pngmstr2.sms: pong_graphics.o pngmstr2.c zcc +sms pong_graphics.o pngmstr2.c -o pngmstr2.sms -m -create-app echo pngmstr2.map pngmstr2.sym apktest.sms: testtxt_apk.o apktest.c zcc +sms testtxt_apk.o apktest.c -o apktest.sms -m -create-app echo apktest.map apktest.sym chicken_graphics.o: chicken_graphics.asm road.til sidewalk.til car1.til z80asm -d -ns -nm -Mo chicken_graphics.asm chicken.sms: chicken_graphics.o chicken.c zcc +sms chicken_graphics.o chicken.c -o chicken.sms -m -create-app echo chicken.map chicken.sym testsnd.sms: testsnd.c zcc +sms testsnd.c -o testsnd.sms -m -create-app echo testsnd.map testsnd.sym clean: $(RM) *.bin *.i *.lib *.op* *.o *~ zcc_opt.def z88dk-1.8.ds1/examples/sms/numbers.til0000755000175000017500000000050010630364750017313 0ustar tygrystygrys||88xx~~||||<<|xx||| 0000|||||~~|z88dk-1.8.ds1/examples/sms/pngmstr2.c0000755000175000017500000003265510630364750017066 0ustar tygrystygrys#include #include unsigned char pal1[] = {0x00, 0x01, 0x02, 0x03, 0x10, 0x20, 0x30, 0x2B, 0x14, 0x24, 0x39, 0x0F, 0x00, 0x15, 0x2A, 0x3F}; unsigned char pal2[] = {0x00, 0x01, 0x02, 0x03, 0x10, 0x20, 0x30, 0x2B, 0x15, 0x35, 0x1D, 0x3D, 0x00, 0x15, 0x2A, 0x3F}; unsigned int bkg_bottom[] = {0x000F, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x000F,}; unsigned int bkg_top1[] = {0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0015,}; unsigned int bkg_top2[] = {0x0011, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0011,}; unsigned int lplayer_icons[] = {0x017, 0x019}; unsigned int rplayer_icons[] = {0x018, 0x01A, 0x01B, 0x01C}; unsigned int paddle_icons[] = {0x01D, 0x01E, 0x01F}; unsigned int spin_icons[] = {0x021, 0x020}; extern unsigned char pong_graphics[]; typedef struct { int x; int y; int size; int height; int controlled_by; int base_spr; int base_tile; int spd_x; int spd_y; int top_spd; int accel; int friction; } paddle_rec; typedef struct { int x; int y; int base_spr; int base_tile; int spd_x; int spd_y; int base_spd; int top_spd; int spin; int spin_friction; } ball_rec; typedef struct { int top; int bottom; int left; int right; int score0; int score1; int left_player; int right_player; int paddle_mode; int actual_paddle_count; int spin_on; } playfield_rec; int sig_shr(int number, int shift) { if (number < 0) { return -((-number) >> shift); } else { return number >> shift; } } int wait_joy1_release() { while (read_joypad1()) { wait_vblank_noint(); } } void draw_score_digits(int x, int y, int n) { unsigned int buffer[2]; buffer[0] = (n / 10) + 1; buffer[1] = (n % 10) + 1; set_bkg_map(buffer, x, y, 2, 1); } void draw_option_panel(int x, int y, playfield_rec *playfield) { unsigned int buffer[4]; unsigned int *p; p = buffer; *p = lplayer_icons[playfield->left_player]; p++; *p = rplayer_icons[playfield->right_player]; p++; *p = paddle_icons[playfield->paddle_mode]; p++; *p = spin_icons[playfield->spin_on]; set_bkg_map(buffer, x, y, 4, 1); } void draw_score(playfield_rec *playfield) { draw_score_digits(4, 0, playfield->score0); draw_score_digits(26, 0, playfield->score1); draw_option_panel(14, 0, playfield); } void draw_bkg() { set_bkg_map(bkg_top1, 0, 0, 32, 1); set_bkg_map(bkg_top2, 0, 1, 32, 1); set_bkg_map(bkg_bottom, 0, 23, 32, 1); } void draw_paddle(paddle_rec *paddle) { int x = (paddle->x >> 4); int y = (paddle->y >> 4); int spr = paddle->base_spr; int tile = paddle->base_tile; int i; set_sprite(spr, x, y, tile); y += 8; spr++; tile++; for (i = paddle->size; i; i--, y += 8, spr++) { set_sprite(spr, x, y, tile); } tile++; set_sprite(spr, x, y, tile); } void draw_paddles(paddle_rec *paddles, int count) { for (; count; count--, paddles++) { draw_paddle(paddles); } } void handle_paddle_joypad(int joy, paddle_rec *paddle) { if (joy & JOY_UP) { paddle->spd_y -= paddle->accel; } if (joy & JOY_DOWN) { paddle->spd_y += paddle->accel; } } void handle_paddle_joypad_lr(int joy, paddle_rec *paddle) { if (joy & JOY_LEFT) { paddle->spd_y -= paddle->accel; } if (joy & JOY_RIGHT) { paddle->spd_y += paddle->accel; } } void handle_paddle_ai(paddle_rec *paddle, ball_rec *ball) { int h = paddle->height >> 1; int y = paddle->y + h; if (ball->spd_x < 0) { return; } if (y > ball->y) { paddle->spd_y -= paddle->accel; } else if (y < ball->y) { paddle->spd_y += paddle->accel; } } void handle_paddle_physics(paddle_rec *paddle, playfield_rec *playfield) { paddle->x += paddle->spd_x; paddle->y += paddle->spd_y; if (paddle->spd_y < -paddle->top_spd) { paddle->spd_y = -paddle->top_spd; } else if (paddle->spd_y > paddle->top_spd) { paddle->spd_y = paddle->top_spd; } /* if (paddle->x < playfield->left) { paddle->x = playfield->left; paddle->spd_x = -paddle->spd_x; } if (paddle->x > playfield->right-8) { paddle->x = playfield->right-8; paddle->spd_x = -paddle->spd_x; } */ if (paddle->y < playfield->top) { paddle->y = playfield->top; paddle->spd_y = -paddle->spd_y; } if (paddle->y > playfield->bottom-paddle->height) { paddle->y = playfield->bottom-paddle->height; paddle->spd_y = -paddle->spd_y; } /* if (paddle->spd_x > 0) { if (paddle->spd_x > paddle->friction) { paddle->spd_x -= paddle->friction; } else { paddle->spd_x = 0; } } else { if (paddle->spd_x < -paddle->friction) { paddle->spd_x += paddle->friction; } else { paddle->spd_x = 0; } }*/ if (paddle->spd_y > 0) { if (paddle->spd_y > paddle->friction) { paddle->spd_y -= paddle->friction; } else { paddle->spd_y = 0; } } else { if (paddle->spd_y < -paddle->friction) { paddle->spd_y += paddle->friction; } else { paddle->spd_y = 0; } } } void draw_ball(ball_rec *ball) { int x = (ball->x >> 4); int y = (ball->y >> 4); int spr = ball->base_spr; int tile = ball->base_tile; set_sprite(spr, x, y, tile); } void deploy_ball(ball_rec *ball) { ball->x = 128 << 4; ball->y = 32 << 4; ball->base_spr = 12; ball->base_tile = 14; if (rand() & 0x01) { ball->spd_x = 0x18; } else { ball->spd_x = -0x18; } ball->spd_y = (rand() & 0x3F) - 0x20; ball->base_spd = 0x20; ball->top_spd = 0x60; ball->spin = 0; ball->spin_friction = 0x01; } void handle_ball_physics(ball_rec *ball, playfield_rec *playfield, paddle_rec paddles[], int paddle_count) { int i; int collided; paddle_rec *paddle; ball->x += ball->spd_x; ball->y += ball->spd_y; ball->spd_y -= sig_shr(ball->spin, 3); if (ball->spin > 0) { if (ball->spin > ball->spin_friction) { ball->spin -= ball->spin_friction; } else { ball->spin = 0; } } else { if (ball->spin < -ball->spin_friction) { ball->spin += ball->spin_friction; } else { ball->spin = 0; } } if (ball->spd_x < 0) { if (ball->spd_x < -ball->top_spd) { ball->spd_x = -ball->top_spd; } } else { if (ball->spd_x > ball->top_spd) { ball->spd_x = ball->top_spd; } } if (ball->x < playfield->left) { ball->x = playfield->left; ball->spd_x = -ball->spd_x; playfield->score0++; deploy_ball(ball); draw_score(playfield); } if (ball->x > playfield->right-8) { ball->x = playfield->right-8; ball->spd_x = -ball->spd_x; playfield->score1++; deploy_ball(ball); draw_score(playfield); } if (ball->spd_y < 0) { if (ball->spd_y < -ball->top_spd) { ball->spd_y = -ball->top_spd; } } else { if (ball->spd_y > ball->top_spd) { ball->spd_y = ball->top_spd; } } if (ball->y < playfield->top) { ball->y = playfield->top; ball->spd_y = -ball->spd_y; } if (ball->y > playfield->bottom-0x80) { ball->y = playfield->bottom-0x80; ball->spd_y = -ball->spd_y; } for (i = paddle_count, paddle = paddles; i; i--, paddle++) { if ((ball->y > paddle->y - 0x80) && (ball->y < paddle->y + paddle->height)) { collided = 0; if (ball->spd_x < 0) { if ((ball->x < paddle->x + 0x80) && (ball->x > paddle->x)) { ball->x = paddle->x + 0x80; ball->spd_x = -ball->spd_x; ball->spd_x += 0x02; ball->spin = paddle->spd_y/* + sig_shr(paddle->spd_y, 1)*/; collided = 1; } } else { if ((ball->x < paddle->x) && (ball->x > paddle->x - 0x80)) { ball->x = paddle->x - 0x80; ball->spd_x = -ball->spd_x; ball->spd_x -= 0x02; ball->spin = paddle->spd_y/* + sig_shr(paddle->spd_y, 1)*/; collided = 1; } } if (collided) { if (ball->y < paddle->y) { ball->spd_y -= 0x60; } else if (ball->y > paddle->y + paddle->height - 0x80) { ball->spd_y += 0x60; } if (!playfield->spin_on) { ball->spin = 0; } } } } } void setup_paddles(paddle_rec *paddles, playfield_rec *playfield) { paddle_rec *paddle; int x, xinc; int i; int half_paddle_count; int base_spr = 0; int base_tile = 11; int paddle_size = 2; int max_speed = 0x60; int controlled_by = 0; playfield->actual_paddle_count = 2; if (playfield->paddle_mode == 1) { playfield->actual_paddle_count = 4; } if (playfield->left_player == 1) { playfield->actual_paddle_count <<= 1; } half_paddle_count = playfield->actual_paddle_count >> 1; if (playfield->paddle_mode == 2) { paddle_size = 3; } for (i = 0, paddle = paddles; i != playfield->actual_paddle_count; i++, paddle++) { paddle->y = 80 << 4; paddle->size = paddle_size; paddle->height = (paddle->size + 2) << 7; paddle->base_spr = base_spr; paddle->base_tile = base_tile; paddle->spd_x = 0; paddle->spd_y = 0; paddle->top_spd = max_speed; paddle->accel = 0x0E; paddle->friction = 0x06; base_spr += paddle_size+2; } xinc = 32; if (half_paddle_count > 2) { xinc = 16; } xinc <<= 4; x = 8 << 4; controlled_by = 0; for (i = 0, paddle = paddles; i != half_paddle_count; i++, paddle++) { paddle->x = x; paddle->controlled_by = controlled_by; x += xinc; if (playfield->left_player == 1) { controlled_by++; } else { controlled_by = (controlled_by + 2) 0x03; } } controlled_by = 4; switch (playfield->right_player) { case 0: controlled_by = 1; break; case 1: max_speed = 0x40; break; case 2: max_speed = 0x80; break; } x = 240 << 4; for (i = 0; i != half_paddle_count; i++, paddle++) { paddle->x = x; paddle->controlled_by = controlled_by; paddle->top_spd = max_speed; x -= xinc; if (playfield->left_player == 0) { controlled_by = (controlled_by + 2) 0x03; } } } void select_options(paddle_rec *paddles, playfield_rec *playfield) { int done; int joy1; int incr, lim; int col = 0; int blink = 0; done = 0; while(!done) { joy1 = read_joypad1(); incr = 0; if (joy1 & (JOY_FIREA | JOY_FIREB)) { done = 1; } else if (joy1 & JOY_LEFT) { col--; } else if (joy1 & JOY_RIGHT) { col++; } else if (joy1 & JOY_UP) { incr = 1; } else if (joy1 & JOY_DOWN) { incr = -1; } if (incr != 0) { switch (col) { case 0: playfield->left_player += incr; playfield->left_player &= 0x01; break; case 1: playfield->right_player += incr; playfield->right_player &= 0x03; break; case 2: playfield->paddle_mode += incr; if (playfield->paddle_mode < 0) { playfield->paddle_mode = 2; } else if (playfield->paddle_mode > 2) { playfield->paddle_mode = 0; } break; case 3: playfield->spin_on += incr; playfield->spin_on &= 0x01; break; } draw_score(playfield); setup_paddles(paddles, playfield); draw_paddles(paddles, playfield.actual_paddle_count); } col &= 0x03; wait_vblank_noint(); if (blink & 0x10) { set_sprite(63, 0, -16, 1); } else { set_sprite(63, (col + 14) << 3, 0, 0x16); } if (joy1) { wait_joy1_release(); } blink++; } set_sprite(63, 0, -16, 1); } void main() { int joy1, joy2; int i; playfield_rec playfield; paddle_rec paddles[8], *paddle; ball_rec ball; playfield.top = 16 << 4; playfield.bottom = 184 << 4; playfield.left = 0 << 4; playfield.right = 255 << 4; playfield.score0 = 0; playfield.score1 = 0; playfield.left_player = 0; playfield.right_player = 2; playfield.paddle_mode = 0; playfield.actual_paddle_count = 1; playfield.spin_on = 1; setup_paddles(paddles, &playfield); set_vdp_reg(VDP_REG_FLAGS1, VDP_REG_FLAGS1_SCREEN); load_tiles(pong_graphics, 1, 64, 4); load_palette(pal1, 0, 16); load_palette(pal2, 16, 16); for (i = 0; i != 64; i++) { set_sprite(i, 0, -16, 0); } while (1) { draw_bkg(); draw_score(&playfield); draw_paddles(paddles, playfield.actual_paddle_count); select_options(paddles, &playfield); deploy_ball(&ball); for (;;) { /* joy1 = read_joypad1(); handle_paddle_joypad(joy1, paddle); handle_paddle_physics(paddle, &playfield); paddle++; joy2 = read_joypad2(); // handle_paddle_joypad(joy2, paddle); handle_paddle_ai(paddle, &ball); handle_paddle_physics(paddle, &playfield);*/ joy1 = read_joypad1(); joy2 = read_joypad2(); for (i = 0, paddle = paddles; i != playfield.actual_paddle_count; i++, paddle++) { switch (paddle->controlled_by) { case 0: handle_paddle_joypad(joy1, paddle); break; case 1: handle_paddle_joypad(joy2, paddle); break; case 2: handle_paddle_joypad_lr(joy1, paddle); break; case 3: handle_paddle_joypad_lr(joy2, paddle); break; default: handle_paddle_ai(paddle, &ball); } } handle_ball_physics(&ball, &playfield, paddles, playfield.actual_paddle_count); for (i = 0, paddle = paddles; i != playfield.actual_paddle_count; i++, paddle++) { handle_paddle_physics(paddle, &playfield); } wait_vblank_noint(); draw_paddles(paddles, playfield.actual_paddle_count); /* for (i = 0, paddle = paddles; i != playfield.actual_paddle_count; i++, paddle++) { draw_paddle(paddle); }*/ draw_ball(&ball); } } } z88dk-1.8.ds1/examples/sms/pong_graphics.asm0000755000175000017500000000017210630370127020453 0ustar tygrystygrys XLIB _pong_graphics ._pong_graphics BINARY "numbers.til" BINARY "batnball.til" BINARY "bkg.til" BINARY "icons.til"z88dk-1.8.ds1/examples/sms/pongmstr.c0000755000175000017500000002703710630364750017161 0ustar tygrystygrys#include #include unsigned char pal1[] = {0x00, 0x01, 0x02, 0x03, 0x10, 0x20, 0x30, 0x2B, 0x14, 0x24, 0x39, 0x0F, 0x00, 0x15, 0x2A, 0x3F}; unsigned char pal2[] = {0x00, 0x01, 0x02, 0x03, 0x10, 0x20, 0x30, 0x2B, 0x05, 0x0A, 0x0F, 0x3D, 0x00, 0x15, 0x2A, 0x3F}; unsigned int bkg_bottom[] = {0x000F, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x000F, 0x0010, 0x000F, 0x000F, 0x000F,}; unsigned int bkg_top1[] = {0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0015,}; unsigned int bkg_top2[] = {0x0011, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0013, 0x0012, 0x0013, 0x0013, 0x0011,}; unsigned int lplayer_icons[] = {0x017}; unsigned int rplayer_icons[] = {0x018, 0x01A, 0x01B, 0x01C}; unsigned int paddle_icons[] = {0x01D, 0x01F}; unsigned int spin_icons[] = {0x021, 0x020}; extern unsigned char pong_graphics[]; typedef struct { int x; int y; int size; int height; int controlled_by; int base_spr; int base_tile; int spd_x; int spd_y; int top_spd; int accel; int friction; } paddle_rec; typedef struct { int x; int y; int base_spr; int base_tile; int spd_x; int spd_y; int base_spd; int top_spd; int spin; int spin_friction; } ball_rec; typedef struct { int top; int bottom; int left; int right; int score0; int score1; int left_player; int right_player; int paddle_mode; int actual_paddle_count; int spin_on; } playfield_rec; int sig_shr(int number, int shift) { if (number < 0) { return -((-number) >> shift); } else { return number >> shift; } } int wait_joy1_release() { while (read_joypad1()) { wait_vblank_noint(); } } void draw_score_digits(int x, int y, int n) { unsigned int buffer[2]; buffer[0] = (n / 10) + 1; buffer[1] = (n % 10) + 1; set_bkg_map(buffer, x, y, 2, 1); } void draw_option_panel(int x, int y, playfield_rec *playfield) { unsigned int buffer[4]; unsigned int *p; p = buffer; *p = lplayer_icons[playfield->left_player]; p++; *p = rplayer_icons[playfield->right_player]; p++; *p = paddle_icons[playfield->paddle_mode]; p++; *p = spin_icons[playfield->spin_on]; set_bkg_map(buffer, x, y, 4, 1); } void draw_score(playfield_rec *playfield) { draw_score_digits(4, 0, playfield->score0); draw_score_digits(26, 0, playfield->score1); draw_option_panel(14, 0, playfield); } void draw_bkg() { set_bkg_map(bkg_top1, 0, 0, 32, 1); set_bkg_map(bkg_top2, 0, 1, 32, 1); set_bkg_map(bkg_bottom, 0, 23, 32, 1); } void draw_paddle(paddle_rec *paddle) { int x = (paddle->x >> 4); int y = (paddle->y >> 4); int spr = paddle->base_spr; int tile = paddle->base_tile; int i; set_sprite(spr, x, y, tile); y += 8; spr++; tile++; for (i = paddle->size; i; i--, y += 8, spr++) { set_sprite(spr, x, y, tile); } tile++; set_sprite(spr, x, y, tile); } void draw_paddles(paddle_rec *paddles, int count) { for (; count; count--, paddles++) { draw_paddle(paddles); } } void handle_paddle_joypad(int joy, paddle_rec *paddle) { if (joy & JOY_UP) { paddle->spd_y -= paddle->accel; } if (joy & JOY_DOWN) { paddle->spd_y += paddle->accel; } } void handle_paddle_ai(paddle_rec *paddle, ball_rec *ball) { int h = paddle->height >> 1; int y = paddle->y + h; if (ball->spd_x < 0) { return; } if (y > ball->y) { paddle->spd_y -= paddle->accel; } else if (y < ball->y) { paddle->spd_y += paddle->accel; } } void handle_paddle_physics(paddle_rec *paddle, playfield_rec *playfield) { paddle->x += paddle->spd_x; paddle->y += paddle->spd_y; if (paddle->spd_y < -paddle->top_spd) { paddle->spd_y = -paddle->top_spd; } else if (paddle->spd_y > paddle->top_spd) { paddle->spd_y = paddle->top_spd; } if (paddle->y < playfield->top) { paddle->y = playfield->top; paddle->spd_y = -paddle->spd_y; } if (paddle->y > playfield->bottom-paddle->height) { paddle->y = playfield->bottom-paddle->height; paddle->spd_y = -paddle->spd_y; } if (paddle->spd_y > 0) { if (paddle->spd_y > paddle->friction) { paddle->spd_y -= paddle->friction; } else { paddle->spd_y = 0; } } else { if (paddle->spd_y < -paddle->friction) { paddle->spd_y += paddle->friction; } else { paddle->spd_y = 0; } } } void draw_ball(ball_rec *ball) { int x = (ball->x >> 4); int y = (ball->y >> 4); int spr = ball->base_spr; int tile = ball->base_tile; set_sprite(spr, x, y, tile); } void deploy_ball(ball_rec *ball) { ball->x = 128 << 4; ball->y = 32 << 4; ball->base_spr = 12; ball->base_tile = 14; if (rand() & 0x01) { ball->spd_x = 0x18; } else { ball->spd_x = -0x18; } ball->spd_y = (rand() & 0x3F) - 0x20; ball->base_spd = 0x20; ball->top_spd = 0x60; ball->spin = 0; ball->spin_friction = 0x01; } void handle_ball_physics(ball_rec *ball, playfield_rec *playfield, paddle_rec paddles[], int paddle_count) { int i; int collided; paddle_rec *paddle; ball->x += ball->spd_x; ball->y += ball->spd_y; ball->spd_y -= sig_shr(ball->spin, 3); if (ball->spin > 0) { if (ball->spin > ball->spin_friction) { ball->spin -= ball->spin_friction; } else { ball->spin = 0; } } else { if (ball->spin < -ball->spin_friction) { ball->spin += ball->spin_friction; } else { ball->spin = 0; } } if (ball->spd_x < 0) { if (ball->spd_x < -ball->top_spd) { ball->spd_x = -ball->top_spd; } } else { if (ball->spd_x > ball->top_spd) { ball->spd_x = ball->top_spd; } } if (ball->x < playfield->left) { ball->x = playfield->left; ball->spd_x = -ball->spd_x; playfield->score0++; deploy_ball(ball); draw_score(playfield); } if (ball->x > playfield->right-8) { ball->x = playfield->right-8; ball->spd_x = -ball->spd_x; playfield->score1++; deploy_ball(ball); draw_score(playfield); } if (ball->spd_y < 0) { if (ball->spd_y < -ball->top_spd) { ball->spd_y = -ball->top_spd; } } else { if (ball->spd_y > ball->top_spd) { ball->spd_y = ball->top_spd; } } if (ball->y < playfield->top) { ball->y = playfield->top; ball->spd_y = -ball->spd_y; } if (ball->y > playfield->bottom-0x80) { ball->y = playfield->bottom-0x80; ball->spd_y = -ball->spd_y; } for (i = paddle_count, paddle = paddles; i; i--, paddle++) { if ((ball->y > paddle->y - 0x80) && (ball->y < paddle->y + paddle->height)) { collided = 0; if (ball->spd_x < 0) { if ((ball->x < paddle->x + 0x80) && (ball->x > paddle->x)) { ball->x = paddle->x + 0x80; ball->spd_x = -ball->spd_x; ball->spd_x += 0x04; ball->spin = paddle->spd_y/* + sig_shr(paddle->spd_y, 1)*/; collided = 1; } } else { if ((ball->x < paddle->x) && (ball->x > paddle->x - 0x80)) { ball->x = paddle->x - 0x80; ball->spd_x = -ball->spd_x; ball->spd_x -= 0x04; ball->spin = paddle->spd_y/* + sig_shr(paddle->spd_y, 1)*/; collided = 1; } } if (collided) { if (ball->y < paddle->y) { ball->spd_y -= 0x60; } else if (ball->y > paddle->y + paddle->height - 0x80) { ball->spd_y += 0x60; } if (!playfield->spin_on) { ball->spin = 0; } } } } } void setup_paddles(paddle_rec *paddles, playfield_rec *playfield) { paddle_rec *paddle; int i; int half_paddle_count; int base_spr = 0; int base_tile = 11; int paddle_size = 2; int max_speed = 0x60; int controlled_by = 0; playfield->actual_paddle_count = 2; half_paddle_count = playfield->actual_paddle_count >> 1; if (playfield->paddle_mode == 1) { paddle_size = 3; } for (i = 0, paddle = paddles; i != playfield->actual_paddle_count; i++, paddle++) { paddle->y = 80 << 4; paddle->size = paddle_size; paddle->height = (paddle->size + 2) << 7; paddle->base_spr = base_spr; paddle->base_tile = base_tile; paddle->spd_x = 0; paddle->spd_y = 0; paddle->top_spd = max_speed; paddle->accel = 0x0E; paddle->friction = 0x06; base_spr += paddle_size+2; } /*** left paddle ***/ paddle = paddles; paddle->x = 8 << 4; paddle->controlled_by = 0; /*** right paddle ***/ paddle++; switch (playfield->right_player) { case 0: controlled_by = 1; break; case 1: controlled_by = 4; max_speed = 0x30; break; case 2: controlled_by = 5; break; case 3: controlled_by = 6; max_speed = 0x80; break; } paddle->x = 240 << 4; paddle->controlled_by = controlled_by; paddle->top_spd = max_speed; } void select_options(paddle_rec *paddles, playfield_rec *playfield) { int done; int joy1; int incr, lim; int col = 1; int blink = 0; done = 0; while(!done) { joy1 = read_joypad1(); incr = 0; if (joy1 & (JOY_FIREA | JOY_FIREB)) { done = 1; } else if (joy1 & JOY_LEFT) { col--; } else if (joy1 & JOY_RIGHT) { col++; } else if (joy1 & JOY_UP) { incr = 1; } else if (joy1 & JOY_DOWN) { incr = -1; } if (incr != 0) { switch (col) { case 0: break; case 1: playfield->right_player += incr; playfield->right_player &= 0x03; break; case 2: playfield->paddle_mode += incr; playfield->paddle_mode &= 0x01; break; case 3: playfield->spin_on += incr; playfield->spin_on &= 0x01; break; } draw_score(playfield); } col &= 0x03; wait_vblank_noint(); if (blink & 0x10) { set_sprite(63, 0, -16, 1); } else { set_sprite(63, (col + 14) << 3, 0, 0x16); } if (joy1) { wait_joy1_release(); } blink++; } set_sprite(63, 0, -16, 1); } void main() { int joy1, joy2; int i; playfield_rec playfield; paddle_rec paddles[2], *paddle; ball_rec ball; playfield.top = 16 << 4; playfield.bottom = 184 << 4; playfield.left = 0 << 4; playfield.right = 255 << 4; playfield.score0 = 0; playfield.score1 = 0; playfield.left_player = 0; playfield.right_player = 2; playfield.paddle_mode = 0; playfield.actual_paddle_count = 1; playfield.spin_on = 1; setup_paddles(paddles, &playfield); set_vdp_reg(VDP_REG_FLAGS1, VDP_REG_FLAGS1_SCREEN); load_tiles(pong_graphics, 1, 64, 4); load_palette(pal1, 0, 16); load_palette(pal2, 16, 16); while (1) { for (i = 0; i != 64; i++) { set_sprite(i, 0, -16, 0); } draw_bkg(); draw_score(&playfield); select_options(paddles, &playfield); playfield.score0 = 0; playfield.score1 = 0; draw_score(&playfield); setup_paddles(paddles, playfield); deploy_ball(&ball); while ((playfield.score0 < 20) && (playfield.score1 < 20)) { joy1 = read_joypad1(); joy2 = read_joypad2(); for (i = 0, paddle = paddles; i != playfield.actual_paddle_count; i++, paddle++) { switch (paddle->controlled_by) { case 0: handle_paddle_joypad(joy1, paddle); break; case 1: handle_paddle_joypad(joy2, paddle); break; default: handle_paddle_ai(paddle, &ball); } } handle_ball_physics(&ball, &playfield, paddles, playfield.actual_paddle_count); for (i = 0, paddle = paddles; i != playfield.actual_paddle_count; i++, paddle++) { handle_paddle_physics(paddle, &playfield); } wait_vblank_noint(); draw_paddles(paddles, playfield.actual_paddle_count); draw_ball(&ball); } } } z88dk-1.8.ds1/examples/sms/road.til0000755000175000017500000000020010630364750016562 0ustar tygrystygrys??z88dk-1.8.ds1/examples/sms/sidewalk.til0000755000175000017500000000020010630364750017440 0ustar tygrystygrysz88dk-1.8.ds1/examples/sms/test.c0000755000175000017500000000464310630364750016265 0ustar tygrystygrys#include unsigned char pal1[] = {0x00, 0x20, 0x08, 0x28, 0x02, 0x22, 0x0A, 0x2A, 0x15, 0x35, 0x1D, 0x3D, 0x17, 0x37, 0x1F, 0x3F}; unsigned char pal2[] = {0x00, 0x03, 0x08, 0x28, 0x02, 0x22, 0x0A, 0x2A, 0x15, 0x35, 0x1D, 0x3D, 0x17, 0x37, 0x1F, 0x3F}; unsigned char chr1[] = {0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81, 0xC3, 0xC3, 0xFF, 0xFF, 0xC3, 0xC3, 0xC3, 0x00}; unsigned int bg1[] = {0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001}; char hello[] = {'H',0,'E',0,'L',0,'L',0,'O',0,',',0,' ',0,'W',0,'O',0,'R',0,'L',0,'D',0,'!',0}; char test[] = "this is a test"; char test2[] = "PAUSE"; char test3[] = "VBL"; void vbl_handler() { int i; int y; char *c; for (i = 48, y = 12, c = test3; *c; i--, y += 12, c++) { set_sprite(i, 12, y, *c); } } void pause_handler() { int i; int y; char *c; for (i = 63, y = 12, c = test2; *c; i--, y += 12, c++) { set_sprite(i, 12, y, *c); } } void main() { int x = 0; int y = 0; int i, j; int ply_x = 120; int ply_y = 92; int ply_tile = 'H'; int ply2_x = 120; int ply2_y = 100; int ply2_tile = 'H'; char *c; set_vdp_reg(VDP_REG_HINT_COUNTER, 0xFF); set_vdp_reg(VDP_REG_FLAGS1, VDP_REG_FLAGS1_SCREEN/* | VDP_REG_FLAGS1_VINT*/); set_bkg_map(bg1, 0, 0, 4, 4); set_bkg_map(hello, 0, 6, 13, 1); load_tiles(standard_font, 0, 255, 1); load_palette(pal1, 0, 16); load_palette(pal2, 16, 16); // add_raster_int(vbl_handler); add_pause_int(pause_handler); for (;;) { i = read_joypad1(); if (i & JOY_UP) { ply_y--; } if (i & JOY_DOWN) { ply_y++; } if (i & JOY_LEFT) { ply_x--; } if (i & JOY_RIGHT) { ply_x++; } if (i & JOY_FIREA) { ply_tile--; } if (i & JOY_FIREB) { ply_tile++; } i = read_joypad2(); if (i & JOY_UP) { ply2_y--; } if (i & JOY_DOWN) { ply2_y++; } if (i & JOY_LEFT) { ply2_x--; } if (i & JOY_RIGHT) { ply2_x++; } if (i & JOY_FIREA) { ply2_tile--; } if (i & JOY_FIREB) { ply2_tile++; } wait_vblank_noint(); scroll_bkg(x, y); x++; y += 2; if (y > 223) { // The BKG is 224 pixels tall. y = 0; } i = 0; j = -(x+x); for (c = test; *c; c++) { set_sprite(i, j, y, *c); i++; j += 8; } set_sprite(i, ply_x, ply_y, ply_tile); set_sprite(i+1, ply2_x, ply2_y, ply2_tile); } } z88dk-1.8.ds1/examples/sms/testsnd.c0000755000175000017500000000071710630364750016770 0ustar tygrystygrys#include void main() { int i, j; for (i = 0; i != 3; i++) { set_sound_freq(i, 300*(i+1)); set_sound_volume(i, 0x0F); for (j = 0; j != 70; j++) { wait_vblank_noint(); } } for (j = 0; j != 140; j++) { wait_vblank_noint(); } for (i = 0; i != 4; i++) { set_sound_volume(i, 0); } set_sound_freq(3, 0x04); set_sound_volume(3, 0x0F); for (j = 0; j != 140; j++) { wait_vblank_noint(); } set_sound_volume(3, 0); while (1) { } } z88dk-1.8.ds1/examples/sms/testtxt.apk0000755000175000017500000000006110630364750017344 0ustar tygrystygrysZ80 aPLibdecomprs~ =0This uantXn.0z88dk-1.8.ds1/examples/sms/testtxt_apk.asm0000755000175000017500000000007010630370127020177 0ustar tygrystygrys XLIB _testtxt_apk ._testtxt_apk BINARY "testtxt.apk" z88dk-1.8.ds1/examples/sound/0000755000175000017500000000000010765202715015457 5ustar tygrystygrysz88dk-1.8.ds1/examples/sound/clicktest.c0000644000175000017500000000046007363075343017615 0ustar tygrystygrys/* $Id: clicktest.c,v 1.1 2001/10/16 18:22:27 dom Exp $ */ #include #include main() { int x; bit_open(); while (1) { printf("+"); bit_click(); printf("-"); bit_click(); printf("."); bit_click(); bit_click(); } bit_close(); } z88dk-1.8.ds1/examples/sound/fx.c0000644000175000017500000000014507363075343016245 0ustar tygrystygrys#include #include int main() { int i; for (i=0; i < 8 ; i++ ) bit_fx(i); } z88dk-1.8.ds1/examples/sound/README0000644000175000017500000000021207363075343016337 0ustar tygrystygryscompile with either: zcc +z88 sndtest.c -lm zcc +zx sndtest.c -lm zcc +z88 fx.c zcc +zx fx.c Or ANSI libraries can be used of course z88dk-1.8.ds1/examples/sound/sndtest.c0000644000175000017500000000313207363075343017313 0ustar tygrystygrys/* $Id: sndtest.c,v 1.1 2001/10/16 18:22:27 dom Exp $ Messed up code samples to hack with */ #include //#include //#include main() { /* 261.625565290 C 277.182631135 C# 293.664768100 D 311.126983881 D# 329.627557039 E 349.228231549 F 369.994422674 F# 391.995436072 G 415.304697513 G# 440.000000000 A 466.163761616 A# 493.883301378 B */ //bit_play("C--C-CC+C++C+++C++++"); //bit_play("Bb-B-CC#DD#EFF#GG#AA#BC+"); // Fra Martino bit_play("C4DECCDECEFG8E4FG8G2AGFE4CG2AGFE4CDG-CCDG-CC"); // ZX DEMO /* bit_play("C8DEb4DC8"); bit_play("C8DEb4DC8"); bit_play("Eb8FGG"); bit_play("Eb8FGG"); bit_play("G8Ab4G8FEb4DC"); bit_play("G8Ab4G8FEb4DC"); bit_play("C8G-C"); bit_play("C8G-C"); */ /* char x[20]; ftoa(261.625565290,9,x); printf ("%s ",x); */ /* bit_frequency (0.3,261.625565290); bit_frequency (0.3,293.664768100); bit_frequency (0.3,329.627557039); bit_frequency (0.3,349.228231549); bit_frequency (0.3,391.995436072); bit_frequency (0.3,440.000000000); bit_frequency (0.3,493.883301378); bit_frequency (0.3,261.625565290*2); bit_frequency (0.3,atof("261.625565290")); bit_frequency (0.3,atof("293.664768100")); bit_frequency (0.3,atof("329.627557039")); bit_frequency (0.3,atof("349.228231549")); bit_frequency (0.3,atof("391.995436072")); bit_frequency (0.3,atof("440.000000000")); bit_frequency (0.3,atof("493.883301378")); bit_frequency (0.3,atof("261.625565290")*2); */ } z88dk-1.8.ds1/examples/sound/synthdemo.c0000755000175000017500000002002610434671713017641 0ustar tygrystygrys/* $Id: synthdemo.c,v 1.1 2006/05/23 20:42:51 stefano Exp $ The Synth library generates many waveforms basing on sound duration and 4 harmonics. It is possible to simulate several instruments or even two voices Synth demo #1: By varying the dinstance between harmonics it is possible to emulate polyphonic ensembles. In this case we almost neutralize the vibrations to get very low and clean sounds. Higher frequencies are emphasized. Synth demo #2 (second section): Now we play the same melody using the same trick, but the phases have been chosen to get as much harmonics as possible. The effect is very similar to what we can get with distortion. Note: in both the samples the note duration isn't accurate.. I still haven't found a formula for that, and obviously lower frequencies last longer. I set the values experimentally. Stefano Bodrato - 23/5/2006 */ #include #include int main() { printf("\n\nLow tones \n"); printf("1st theme \n"); bit_synth (100,200,200,40,40); bit_synth (100,200,200,33,33); bit_synth (100,177,177,37,37); bit_synth (100,150,150,44,44); bit_synth (100,160,160,50,50); bit_synth (100,200,200,40,40); bit_synth (100,133,133,44,44); bit_synth (100,150,150,44,44); bit_synth (100,160,160,50,50); bit_synth (100,200,200,40,40); bit_synth (100,150,150,44,44); bit_synth (100,177,177,37,37); bit_synth (100,133,133,40,40); bit_synth (100,133,133,44,44); bit_synth (150,200,200,50,50); printf("2nd theme \n"); bit_synth (100,133,133,53,53); bit_synth (100,133,133,50,50); bit_synth (100,150,150,44,44); bit_synth (100,150,150,53,53); bit_synth (100,160,160,50,50); bit_synth (100,177,177,44,44); bit_synth (100,200,200,40,40); bit_synth (100,160,160,40,40); bit_synth (100,150,150,60,60); bit_synth (100,150,150,44,44); bit_synth (100,133,133,53,53); bit_synth (100,160,160,50,50); bit_synth (100,150,150,44,44); bit_synth (100,133,133,53,53); bit_synth (150,200,200,50,50); printf("Variation on 1st theme \n"); bit_synth (50,200,200,40,40); bit_synth (50,200,200,37,37); bit_synth (50,200,200,33,33); bit_synth (50,200,200,40,40); bit_synth (50,177,177,33,33); bit_synth (50,177,177,37,37); bit_synth (50,150,150,40,40); bit_synth (50,150,150,44,44); bit_synth (50,160,160,50,50); bit_synth (50,160,160,44,44); bit_synth (50,200,200,40,40); bit_synth (50,200,200,50,50); bit_synth (50,133,133,44,44); bit_synth (50,133,133,50,50); bit_synth (50,150,150,44,44); bit_synth (50,150,150,40,40); bit_synth (50,160,160,50,50); bit_synth (50,160,160,33,33); bit_synth (50,200,200,37,37); bit_synth (50,200,200,40,40); bit_synth (50,150,150,44,44); bit_synth (50,150,150,40,40); bit_synth (50,177,177,37,37); bit_synth (50,177,177,44,44); bit_synth (50,133,133,40,40); bit_synth (50,133,133,37,37); bit_synth (50,133,133,44,44); bit_synth (50,133,133,40,40); bit_synth (50,200,200,50,50); bit_synth (50,200,200,40,40); bit_synth (50,200,200,50,50); printf("Variation on 2nd theme \n"); bit_synth (50,133,133,53,53); bit_synth (50,133,133,60,60); bit_synth (50,133,133,53,53); bit_synth (50,133,133,50,50); bit_synth (50,150,150,44,44); bit_synth (50,150,150,50,50); bit_synth (50,150,150,44,44); bit_synth (50,150,150,53,53); bit_synth (50,160,160,50,50); bit_synth (50,160,160,53,53); bit_synth (50,177,177,50,50); bit_synth (50,177,177,44,44); bit_synth (50,200,200,40,40); bit_synth (50,200,200,44,44); bit_synth (50,160,160,50,50); bit_synth (50,160,160,53,53); bit_synth (50,150,150,60,60); bit_synth (50,150,150,53,53); bit_synth (50,150,150,50,50); bit_synth (50,150,150,44,44); bit_synth (50,133,133,50,50); bit_synth (50,133,133,53,53); bit_synth (50,160,160,44,44); bit_synth (50,160,160,50,50); bit_synth (50,150,150,40,40); bit_synth (50,150,150,44,44); bit_synth (50,133,133,50,50); bit_synth (50,133,133,53,53); bit_synth (150,200,200,50,50); printf("\n\nDistortion \n"); printf("1st theme \n"); bit_synth (100,200,201,40,41); bit_synth (100,200,201,33,34); bit_synth (100,177,178,37,38); bit_synth (100,150,151,44,45); bit_synth (100,160,161,50,51); bit_synth (100,200,201,40,41); bit_synth (100,133,134,44,45); bit_synth (100,150,151,44,45); bit_synth (100,160,161,50,51); bit_synth (100,200,201,40,41); bit_synth (100,150,151,44,45); bit_synth (100,177,178,37,38); bit_synth (100,133,134,40,41); bit_synth (100,133,134,44,45); bit_synth (150,200,201,50,51); printf("2nd theme \n"); bit_synth (100,133,134,53,54); bit_synth (100,133,134,50,51); bit_synth (100,150,151,44,45); bit_synth (100,150,151,53,54); bit_synth (100,160,161,50,51); bit_synth (100,177,178,44,45); bit_synth (100,200,201,40,41); bit_synth (100,160,161,40,41); bit_synth (100,150,151,60,61); bit_synth (100,150,151,44,45); bit_synth (100,133,134,53,54); bit_synth (100,160,161,50,51); bit_synth (100,150,151,44,45); bit_synth (100,133,134,53,54); bit_synth (150,200,201,50,51); printf("Variation on 1st theme \n"); bit_synth (50,200,201,40,41); bit_synth (50,200,201,37,38); bit_synth (50,200,201,33,34); bit_synth (50,200,201,40,41); bit_synth (50,177,178,33,34); bit_synth (50,177,178,37,38); bit_synth (50,150,151,40,41); bit_synth (50,150,151,44,45); bit_synth (50,160,161,50,51); bit_synth (50,160,161,44,45); bit_synth (50,200,201,40,41); bit_synth (50,200,201,50,51); bit_synth (50,133,134,44,45); bit_synth (50,133,134,50,51); bit_synth (50,150,151,44,45); bit_synth (50,150,151,40,41); bit_synth (50,160,161,50,51); bit_synth (50,160,161,33,34); bit_synth (50,200,201,37,38); bit_synth (50,200,201,40,41); bit_synth (50,150,151,44,45); bit_synth (50,150,151,40,41); bit_synth (50,177,178,37,38); bit_synth (50,177,178,44,45); bit_synth (50,133,134,40,41); bit_synth (50,133,134,37,38); bit_synth (50,133,134,44,45); bit_synth (50,133,134,40,41); bit_synth (50,200,201,50,51); bit_synth (50,200,201,40,41); bit_synth (50,200,201,50,51); printf("Variation on 2nd theme \n"); bit_synth (50,133,134,53,54); bit_synth (50,133,134,60,61); bit_synth (50,133,134,53,54); bit_synth (50,133,134,50,51); bit_synth (50,150,151,44,45); bit_synth (50,150,151,50,51); bit_synth (50,150,151,44,45); bit_synth (50,150,151,53,54); bit_synth (50,160,161,50,51); bit_synth (50,160,161,53,54); bit_synth (50,177,178,50,51); bit_synth (50,177,178,44,45); bit_synth (50,200,201,40,41); bit_synth (50,200,201,44,45); bit_synth (50,160,161,50,51); bit_synth (50,160,161,53,54); bit_synth (50,150,151,60,61); bit_synth (50,150,151,53,54); bit_synth (50,150,151,50,51); bit_synth (50,150,151,44,45); bit_synth (50,133,134,50,51); bit_synth (50,133,134,53,54); bit_synth (50,160,161,44,45); bit_synth (50,160,161,50,51); bit_synth (50,150,151,40,41); bit_synth (50,150,151,44,45); bit_synth (50,133,134,50,51); bit_synth (50,133,134,53,54); bit_synth (150,200,201,50,51); } z88dk-1.8.ds1/examples/spectrum/0000755000175000017500000000000010765202715016171 5ustar tygrystygrysz88dk-1.8.ds1/examples/spectrum/ADV-A.Z800000644000175000017500000004415607130401707017270 0ustar tygrystygrysT?!6X'D:\:!6r:D12345<!9"2!9s`>!86!<6!@6͎͒!X'1@Small C+ ZX@ǜ&Faם %>[r̞6b)Ǡ4[Eeģģģģ&b4֦l|˧ԧ ".=Mvɨ%;  DOWND NORTN SOUTS EASTE WESTW GET PICK DROPPUT FIRESHOOBOOTSTARMOTOKEY LASEGUN USEDBAR BARSGOLDCOINMIRRBROKGLOVROPEFLOOBOARPLANSTALBLOCICE POOLWATELAKESLEEGREEMAN DOOR OPEN!UNLO!WIND"SMAL#SPAC#SHIP#SECU$FLIN%STON&DRAW'HELP(INVE)I )QUIT*STOP*ABOR*YES +Y +NO ,COMP-KEYB-TYPE.TURN/HAND0KILL1DANC2WALT2REMO3KICK4BREA4HIT 4BANG4BRIB5USE 6WITH6PUSH7THRE83 8TWO 92 9ONE :1 :MEND;FIX ;REPA;FOUR<4 <LOOK=STAN>TREE?CUT @SAW @WEARACROSBJUMPCRAVIDUP EU ECLIMEFUSEFREDEGR GMAINHAUX IFIELJSHIEJ     eloty~Ȅ˄΄΄Ǒ %9Za                                                                                 &                                 !        " " % ( + . . 1 4 %7 &:)*† ÆƆɆ̆φ҆=Ն"؆"؆%ۆ(ކ+..14%7&:='@4@6C@H6%KA3 BDP BDS 6V6[CDVCDS` 6c h& o2 t&w7 z: "==@"C1F1wF6I6R6U.(ZRJ]JbJg2j2p! F6u1$…x=EDž{4Dž~Eʅ5$υ6҅ ׅ=܅ ܅ᅞꅛ܅! 񅦇78􅩇7879797:7:;F6=Ƈ(ɇ("̇(%χ((҇(+҇(.҇(1҇(4ɇ=E9Շ>؇"؇Aއ3GA6DCAEI#N7HQ7IQ78V79V7<[7:c 7:[(=# $ % ms y !9ټ!:y!9ټ ¼m!@"w! E! !:y;!9! 9#+~!9n&|®3!9n&ón!9+!9!!9! 9~!9~ !9~ #!9#ތ*w)n!9!9!9! 9~!9~ __!9~ ~!9n&E!9#8*w|ʤ! E*w+"wð*w"w} ʸ ʾÈ3!ɀ*)ͅ!"!:#)N^#V*¼7*%!eͅ!")ͅn!"* [[! +*ss!+!w͠ͅ!"D!"F "¼.!*Fټ ¼ھ*Fټ¼Ǝ!*Fټ ¼*F#"FH*Fټ ¼*Fټ¼!*F#"FƎ|*!ͅ!"14Ê!"*Fټ;}o!9ټ ¼Z3Â!9ټ|L!9ټ ¼L*F#"F3:*F#"F " *Fټ;}o!9ټ ¼ҹ3!9ټ|L!9ټ ¼L*F#"F3ÙÂ!τ*)n&¼4*¼&#n&"!"##!"!"L!"13*^#Vkb|¢*LҚ* !ͅÚ*D|ʒ!ͅÚ!Щͅ!"¼ڹ*¼Ҵ*##^#Vkb¼ِ*¼ҳ* "*#"+n& ;)^#V*n&"50!"D!"!9*#"* "!"L!"*^!¼g!ٖ*#"+n&)^#V*n&"5* ҟ!9*#"T!ةͅ!"[*¼!N*)^#Vkb*¼߼!!m*Ǒ!N*)^#V!¼!*)*#"n&!*)^#V¼%!N*)^#V!¼ڒ!N*)^#V!¼ڒ!!!!ͅ!!Ò#ë!N!9)߼!96#6!!9)ͅ¼!ͅnû!9|-!ͅ!"!N*)^#V!¼҈* ¼j!&ͅ!"Å!N*)6#6! #Ö!Aͅ!"* ¼Ҵ!Vͅ!"3!N*)^#V*¼!N*)6#6! #3!N*)^#V!¼!N*)^#V!¼%!mͅ!"3!ͅ!"!N*)^#V*¼[!ͅ!"ɔ!N*)^#V!¼҅!N*)*ɔ!N*)^#V!¼һ! +!N*)*ɔ!ͅ!"!N*)^#V!¼!N*)6#6! +3!N*)^#V!¼%!ͅ!"3!ͅ!"!{*)ͅ!!"!"*"!*)!*)!N*)^#V!N*)!N*#)!N*#)!ͅ;!٪ͅ!9}!9ټY¼!"3!9ټN¼ !I3ɕ!ͅ!"!ͅY¼Z!ͅ!$ͅY¼Z!"*#"n&!*)!N*)*!N*)!"[*"!9!>ͅ*!!::n! 9ɖ74ʔ4JQX_q!]zB!H!!H!S!0!ҩ@#+*Fټ;}o!9ټ ¼`3é!9ټ|p3é!9ټ ¼҅3é!9#+!9ټ}*F#"F3:!n ×#î!H!c!9DM ) !|!cDM )  ýk b b b ߼Z~Z!!8h ¼y! a߼Ґz8Þ "!;}o!9ټ y!96!9}!9ټ ¼!9|!9+!E! E!Ev!9ټ v!9^#V!@¼K! E!Ev!9ټE!!9#+!9ټ}é! E3w*yͅ!Ҿí#Ø)ç!"̈́!#̙)N!+!9)ۙ!"!XͅY¼/!qͅ!ͅw*|@ȍÑ*XX!+[N*¼kȍÑ!ͅ*ʋ!+!"*Ț!"* "!ͅ* "VóPÑ*¼8/Ó!WELCOME TO ADVENTURE 'A' THE PLANET OF DEATH IN THIS ADVENTURE YOU FIND YOURSELF STRANDED ON AN ALIEN PLANET. YOUR AIM IS TO ESCAPE FROM THIS PLANET BY FINDING YOUR, NOW CAPTURED AND DISABLED, SPACE SHIP YOU WILL MEET VARIOUS HAZARDS AND DANGERS ON YOUR ADVENTURE, SOME NATURAL, SOME NOT, ALL OF WHICH YOU MUST OVERCOME TO SUCCEED GOOD LUCK, YOU WILL NEED IT! PRESS ANY KEY TO START IT SHOWS A MAN CLIMBING DOWN A PIT USING A ROPE HOW? I CANT REACH IT HAS FALLEN TO THE FLOOR HOW? ITS TOO WIDE.I FELL AND BROKE MY NECK UGH! HE IS ALL SLIMY HE VANISHED IN A PUFF OF SMOKE YOU ALSO BROKE THE MIRROR COMPUTER SAYS: 2 WEST,2 SOUTH FOR SPACE FLIGHT IT HAS WEAKENED IT IT HAD NO EFFECT I FELL AND KNOCKED MYSELF OUT. THE BARS LOOK LOOSE WHAT WITH? I SEE A GOLD COIN BRRR.THE WATERS TOO COLD THE FUSE HAS JUST BLOWN THE LIFT HAS BEEN ACTIVATED I SEE NOTHING SPECIAL KEEP OFF THE MIDDLE MEN,ONE MAY BE SHOCKING! VANITY WALTZ! TRY HELP POINTS OF COMPASS TRY LOOKING AROUND I CAN SEE A STEEP SLOPE AN ALARM SOUNDS.THE SECURITY GUARD SHOT ME FOR TRESPASSING. I CAN SEE A ROPE HANGING DOWN THE CHIMNEY. I AM NOT THAT DAFT.IT IS TOO DEEP. THE SPACE SHIP BLEW UP AND KILLED ME. THE SHIP HAS FLOWN INTO THE LARGE LIFT AND IS HOVERING THERE. THERE ARE FOUR BUTTONS OUTSIDE THE WINDOW MARKED 1,2,3 AND 4 THE LIFT HAS TAKEN ME UP TO A PLATEAU. CONGRATULATIONS, YOU HAVE MANAGED TO COMPLETE THIS ADVENTURE WITHOUT GETTING KILLED. THE LIFT HAS BECOME ELECTRIFIED I HAVE BEEN ELECTROCUTED IT IS A GOOD JOB I WAS WEARING RUBBER SOLED BOOTS. I WOULD KILL MYSELF IF I DID. I HAVE TURNED GREEN AND DROPPED DEAD. THE GREEN MAN AWOKE AND THROTTLED ME. THE GUARD WOKE AND SHOT ME. WHAT AT? I AM ON A MOUNTAIN PLATEAU TO THE NORTH THERE IS A STEEP CLIFF OBVIOUS EXITS ARE DOWN,EAST AND WEST I AM AT THE EDGE OF A DEEP PIT OBVIOUS EXITS ARE EAST I AM IN A DAMP LIMESTONE CAVE WITH STALACTITES HANGING DOWN. THE EXIT IS TO THE WEST THERE IS A PASSAGE TO THE NORTH I AM IN A DENSE FOREST THERE IS A ROPE HANGING FROM ONE TREE OBVIOUS EXITS ARE SOUTH AND WEST I AM BESIDE A LAKE EXITS ARE EAST AND NORTH.THERE IS A RAVINE TO THE WEST I AM IN A STRANGE HOUSE THE DOOR IS TO THE NORTH I AM IN AN OLD SHED THE EXIT IS TO THE EAST I AM IN A MAZE.THERE ARE PASSAGES EVERYWHERE I AM IN AN ICE CAVERN THERE IS AN EXIT TO THE EAST I AM IN A QUIET CAVERN THERE ARE EXITS WEST,EAST AND SOUTH I AM IN A WIND TUNNEL THERE IS A CLOSED DOOR AT THE END THERE IS ALSO AN EXIT TO THE WEST I AM IN A ROOM WITH A COMPUTER IN THE COMPUTER IS WORKING AND HAS A KEYBOARD THE EXIT IS WEST I AM IN A PASSAGE THERE IS A FORCE FIELD TO THE SOUTH : BEWARE OF SECURITY THERE ARE EXITS TO NORTH,EAST AND WEST I AM IN A LARGE HANGER THERE IS A LOCKED DOOR TO THE WEST THERE ARE ALSO EXITS EAST,NORTH AND SOUTH I AM IN A TALL LIFT.THE BUTTONS ARE VERY HIGH THE EXIT IS WEST I AM IN THE LIFT CONTROL ROOM THERE ARE THREE SWITCHES ON THE WALL.THEY ARE ALL OFF A SIGN SAYS : 5,4 NO DUSTY BIN RULES THE EXIT IS EAST I AM IN A PRISON CELL I AM IN A SPACE SHIP.THERE IS NO VISIBLE EXIT THERE IS A SMALL OPEN WINDOW IN THE SIDE THERE ARE ALSO TWO BUTTONS,ONE MARKED MAIN AND THE OTHER AUX. A PAIR OF BOOTSA STARTER MOTORA KEYA LASER GUNAN OUT OF ORDER SIGNA METAL BARA GOLD COINA MIRRORBROKEN GLASSA PAIR OF SLIMY GLOVESA ROPEA FLOOR BOARDA BROKEN FLOOR BOARDSTALACTITESA BLOCK OF ICEA POOL OF WATERA SMALL GREEN MAN SLEEPING ON THE MIRRORA SLEEPING GREEN MANA LOCKED DOORAN OPEN DOORA BARRED WINDOWA HOLE IN THE WALLA SMALL BUT POWERFULL SPACE SHIPA SLEEPING SECURITY MANA PIECE OF SHARP FLINTSOME STONESA DRAWING ON THE WALLA LOUDSPEAKER WITH DANCE MUSIC COMING OUTI CAN ALSO SEE : TELL ME WHAT TO DO I DONT UNDERSTAND I CANT GO IN THAT DIRECTION I CANT DO THAT YET I CANT Executed! I HAVE WITH ME THE FOLLOWING: WHICH I AM WEARINGNOTHING AT ALL I CANT. MY HANDS ARE FULL I AM NOT WEARING IT I CANT CARRY ANY MORE I ALREADY HAVE IT I DON'T SEE IT HERE I DONT HAVE IT I AM ALREADY WEARING IT DO YOU WISH TO TRY AGAIN? ANSWER YES OR NO OK.. DO YOU WANT TO SAVE THE GAME? SAVE NOT SUPPORTED DO YOU WISH TO CONTINUE? YOU HAVE A SCORE OF WANT TO RESTORE A GAME? RESTORE NOT SUPPORTED PRESS A KEYEVERYTHING IS DARK.I CANT SEE. ERROR !6!^9ʬë Ò##~Ǭ|Ǭ̬âկwwww!~Oy0nf|!uut!~7+~##?+z {!:b(Gh&)[`~#fo5}'2\:\(o&!~~(nfq#uti&8­nfU!9ϭzKEx~#ʓʨ ʹ2έ2ͭC ( 2 :ͭ<!'2ͭ زBzҭ0CE?KEKGCE8z CED~#[ K 2Iz CGîCED~#=(? 2Iz CGCED~#0:`isB00z¡CGCED"(\22Jz 5CGYCED;կ`isB0z CGCED~#!J(!`isB0z CGYCEDz CGCED~#;~#0Я:Я0 O Oz CGCED;G`iK 7?BE !K>wm  !K>w!K~ #C $!K:ͭ:G+2ͭ:=2ͭD !K:ͭD2ͭA !K:έY2έB !K:έw#w !K#>w!K~!Ӱ: 2έ#~=!~=2ͭJ~ !K>w!K~ 3:έ:ͭ> <2ͭ!2ͭ2έ< =2ͭ=2ͭ2έ=ֻ=Zʹ2έ2ͭK۱ !K>w!K~ :ͭ> <2ͭ!2ͭ :ͭ> =2ͭ2ͭ:έֻn!K~L !KF:έM !K~u >2\ :\@2\( :\2\ > 2 >2 :\2\ :\2\ >/2 2 :\28_2\ :2\&_(_:\2\(ײ0ײ(_(_:\dz2\:H\F% y&- y.32a:έW_!@"Z!F!:ͭ_()<W:έ< = :\w?2q_:_>2P !( ~ > ( # p؈pppPp pp pP p p p pp ؈ PP ب8h@pp xHx@@@xHxHHX pp 0pp0 p p PPxh(((`P ` p p p p  @@ PP pp @@````` 0 @0@@P`@ @@ @ @ pp p `@ ` @`А` ` p` @ `` ` `0@` @@````p  @ @ @  @` @@`p````p𐐐p p`а```P``` `@`@@@@ @@  P @  А```P``p P@@@@`P`А ` p @` p𐐐А````pЀp`@@@@@0P@`p` @ @  @  @@ ``` @P0`p`pp`pp`pp0`pppp ``p`p`pP` p`` p` p```0 0`𠠰````````PPp``` P@@P@@@@ P@@@@0 0` p0``0Pа`p`` @`@ 0Pp (PP(P(P TTTTTTTT (((((((((((( ((((((((((,(, << ,((, ,(((((((((((((<<((((PP`𰀀P@ @p@PPPPh pp PP PPP0@0ppppppppp @  @ @@ 8( ````  8 ` 0`pppp !@@6>2\2H\!XwXW_!@T]6$_!XT]:\wɯ2ͭ:έ<2έ!:=2έ8:\2H\ :W:ͭ<2ͭN#F#x( ~#~# `i||G(ogz怨Oz(_W|>DM!R0?= PYy͸xȗ_Wʼ7?+{_z!8ɳ7~ogʼ?+~#foʼ+ʼ7?+|(!#7ʼ+ʼ7?+}|{ozg}o|g0123456789ABCDEF! 9~S!9^#V! ¼8z!-!9y!9! 9ؽ!9^#V!9m|ʫ!9^#V!9:!)! 9^#V! 9mn&!9yݽ#|/g}/o*^|t "^!9NF^Vnfx(  # !!++!9N#Fy#^#V#~#fowZ# xC!9^#V6# xZQW P P P 3\MsWrW\GWq !v>>BB<DHpHDB@~BfZBBBBbRJFB29; x--) { printf ("%c[%umFore text color %u.\n",27,x,x); } for (x=40; x<48; x++) { printf ("%c[%umBack text color %u.\n",27,x,x); } /* Restore default text attributes */ printf ("%c[m",27); /* Cursor Position test "Draw" an X */ for (x=0; x<11; x++) { printf ("%c[%u;%uH*\n",27,10+x,25+x); printf ("%c[%u;%uH*\n",27,20-x,25+x); } } z88dk-1.8.ds1/examples/spectrum/c3d.c0000755000175000017500000000732110553474742017022 0ustar tygrystygrys /* Coloured lib3d demo - uses the "buffer" feature to avoid flicker uses cclg, cplot, ccopybuffer. The "lr64x48" #define activates the alternate resolution. Comment out the "bufferedgfx" #define to see what happens behind the scenes. build with: zcc +zx -lndos -lm -create-app lib3d.c - or - zcc +zx -lndos -lm -create-app -DALTLOWGFX lib3d.c $id:$ */ //#define ALTLOWGFX 1 #define bufferedgfx 1 #include #include //#include #include #define MX 10 #define MY 10 #define COLOR1 6 // foreground cube color #define COLOR2 2 // background cube color Vector_t cube[8] = { { -20 , 20, 20 }, { 20 , 20, 20 }, { 20 , -20, 20 }, { -20 , -20, 20 }, { -20 , 20, -20 }, { 20 , 20, -20 }, { 20 , -20, -20 }, { -20 , -20, -20 } }; static Vector_t rot; static Vector_t t; static Point_t p[8]; static unsigned c = 0; static int i; static int zf = 600; #ifdef ALTLOWGFX #define ddraw(x,y,x1,y1,c) cdraw(2*(x),y,2*(x1),y1,c); #else #define ddraw(x,y,x1,y1,c) cdraw(x,2*(y),x1,2*(y1),c); #endif void main() { cclg(0); // Clear screen and init pattern while(c != 13) { //if(ozkeyhit()) c = ozngetch(); //if(getk()) c = fgetc_cons(); c=getk(); switch(c) { case '1': zf -= 10; if(zf < 300) zf = 300; break; case '2': zf += 10; if(zf > 1000) zf = 1000; break; //case '3': // exit (0); } c = 0; for(i = 0; i < 8; i++) { ozcopyvector(&t,&cube[i]); ozrotatepointx(&t, rot.x); ozrotatepointy(&t, rot.y); t.z += zf; // zoom factor ozplotpoint(&t, &p[i]); } rot.y = (rot.y+1)%360; rot.x = (rot.x+2)%360; cclgbuffer(0); // clear color buffer (no pattern: faster) // top face ddraw(10+p[0].y + MX, 5+p[0].x + MY, 10+p[1].y + MX, 5+p[1].x + MY, COLOR2); ddraw(10+p[1].y + MX, 5+p[1].x + MY, 10+p[2].y + MX, 5+p[2].x + MY, COLOR2); ddraw(10+p[2].y + MX, 5+p[2].x + MY, 10+p[3].y + MX, 5+p[3].x + MY, COLOR2); ddraw(10+p[3].y + MX, 5+p[3].x + MY, 10+p[0].y + MX, 5+p[0].x + MY, COLOR2); // bottom face ddraw(10+p[4].y + MX, 5+p[4].x + MY, 10+p[5].y + MX, 5+p[5].x + MY, COLOR2); ddraw(10+p[5].y + MX, 5+p[5].x + MY, 10+p[6].y + MX, 5+p[6].x + MY, COLOR2); ddraw(10+p[6].y + MX, 5+p[6].x + MY, 10+p[7].y + MX, 5+p[7].x + MY, COLOR2); ddraw(10+p[7].y + MX, 5+p[7].x + MY, 10+p[4].y + MX, 5+p[4].x + MY, COLOR2); // side faces ddraw(10+p[0].y + MX, 5+p[0].x + MY, 10+p[4].y + MX, 5+p[4].x + MY, COLOR2); ddraw(10+p[1].y + MX, 5+p[1].x + MY, 10+p[5].y + MX, 5+p[5].x + MY, COLOR2); ddraw(10+p[2].y + MX, 5+p[2].x + MY, 10+p[6].y + MX, 5+p[6].x + MY, COLOR2); ddraw(10+p[3].y + MX, 5+p[3].x + MY, 10+p[7].y + MX, 5+p[7].x + MY, COLOR2); // top face ddraw(p[0].x + MX, p[0].y + MY, p[1].x + MX, p[1].y + MY, COLOR1); ddraw(p[1].x + MX, p[1].y + MY, p[2].x + MX, p[2].y + MY, COLOR1); ddraw(p[2].x + MX, p[2].y + MY, p[3].x + MX, p[3].y + MY, COLOR1); ddraw(p[3].x + MX, p[3].y + MY, p[0].x + MX, p[0].y + MY, COLOR1); // bottom face ddraw(p[4].x + MX, p[4].y + MY, p[5].x + MX, p[5].y + MY, COLOR1); ddraw(p[5].x + MX, p[5].y + MY, p[6].x + MX, p[6].y + MY, COLOR1); ddraw(p[6].x + MX, p[6].y + MY, p[7].x + MX, p[7].y + MY, COLOR1); ddraw(p[7].x + MX, p[7].y + MY, p[4].x + MX, p[4].y + MY, COLOR1); // side faces ddraw(p[0].x + MX, p[0].y + MY, p[4].x + MX, p[4].y + MY, COLOR1); ddraw(p[1].x + MX, p[1].y + MY, p[5].x + MX, p[5].y + MY, COLOR1); ddraw(p[2].x + MX, p[2].y + MY, p[6].x + MX, p[6].y + MY, COLOR1); ddraw(p[3].x + MX, p[3].y + MY, p[7].x + MX, p[7].y + MY, COLOR1); ccopybuffer(); // display new frame } } z88dk-1.8.ds1/examples/spectrum/ccoswave.c0000755000175000017500000000144610553474742020165 0ustar tygrystygrys/* Coloured lib3d demo - multi color 3d cosine wave build with: zcc +zx -lndos -lm -create-app ccoswave.c $id:$ */ #include #include #include #include main() { float x,y; char z,buf; cclg(0); // init pseudo-graphics pattern for (x=-3.0; x<3.0; x=x+0.06) { buf=100; for (y=-3.0; y<2.0; y=y+0.2) { z = (char) 35.0 - (6.0 * (y + 3.0) + ( 6.0 * cos (x*x + y*y) )); if (buf>z) { buf = z; // coloured "rings" //cplot ( (char) (9.0 * (x+3.0)), (char) z, (4.0 +(cos (x*x + y*y) * 2.0))); // this colouring option has a phase shift and evidences of the "waves" cplot ( (char) (9.0 * (x+3.0)), (char) z, (3.0 +(sin (x*x + y*y) * 2.0))); } } } while (getk() != 13) {}; } z88dk-1.8.ds1/examples/spectrum/cmandel.c0000755000175000017500000000301510553474742017750 0ustar tygrystygrys /* Coloured mandelbrot demo - shows the zxlowgfx capabilities uses cclg, cplot, cpoint (for the color cycling), ccopybuffer. The "lr64x48" #define activates the alternate resolution. Comment out the "bufferedgfx" #define to see what happens behind the scenes. build with: zcc +zx -lndos -lm -create-app cmandel.c - or - zcc +zx -lndos -lm -create-app -Dlr64x48 cmandel.c $Id: cmandel.c,v 1.2 2007/01/17 19:32:50 stefano Exp $ */ //#define DALTLOWGFX 1 #define bufferedgfx 1 #include #include #include void main() { float a,b,c,d,e,g,h,i,j; int x,y; int xmax,ymax; int k; float l,m,n,o,p; cclg(1); // Blue background #ifdef ALTLOWGFX xmax=64; ymax=24; #else xmax=32; ymax=48; #endif a=-2.0; b=2.0; c=a; d=b; //a=-0.765; b=-0.7651; //c=-0.095; d=-0.0951; e=4.0; g=(b-a)/(float)xmax; h=(d-c)/(float)ymax; for(y=ymax/2; y>=0; y--) { j=(float)y*h+c; for(x=xmax; x>=0; x--) { i=(float)x*g+a; k=0; l=0.0; m=0.0; n=0.0; o=0.0; l110: k++; if (k<50) //Iterates { p=n-o+i; m=2.0*l*m+j; l=p; n=l*l; o=m*m; if ((n+o)=0; k--) { for(y=ymax; y>=0; y--) { for(x=xmax; x>=0; x--) cplot (x,y,cpoint(x,y)+1) } ccopybuffer(); } ccopybuffer(); } z88dk-1.8.ds1/examples/spectrum/csprite.c0000755000175000017500000000330410553474742020017 0ustar tygrystygrys /* Coloured sprites demo - shows the zxlowgfx capabilities uses cputsprite The "lr64x48" #define activates the alternate resolution, build with: zcc +zx -lndos -create-app csprite.c - or - zcc +zx -lndos -create-app -Dlr64x48 csprite.c $Id: csprite.c,v 1.2 2007/01/17 19:32:50 stefano Exp $ */ //#define lr64x48 1 #include #include extern char mysprite[]; // sprite generated by Daniel McKinnon's z88dk Sprite Editor char hello[] = { 20, 6, 0x90 , 0x24 , 0x00 , 0x93 , 0x24 , 0x60 , 0xF4 , 0xA4 , 0x90 , 0x97 , 0x24 , 0x90 , 0x94 , 0x24 , 0x90 , 0x93 , 0x92 , 0x60 }; char chesspiece[] = { 21, 23, 0x00 , 0x00 , 0x00 , 0x3D , 0xF7 , 0x80 , 0x25 , 0x14 , 0x80 , 0x25 , 0x14 , 0x80 , 0x27 , 0x1C , 0x80 , 0x20 , 0x00 , 0x80 , 0x18 , 0x03 , 0x00 , 0x04 , 0x04 , 0x00 , 0x04 , 0x04 , 0x00 , 0x04 , 0x84 , 0x00 , 0x04 , 0x84 , 0x00 , 0x04 , 0x04 , 0x00 , 0x04 , 0x84 , 0x00 , 0x04 , 0x84 , 0x00 , 0x04 , 0x84 , 0x00 , 0x04 , 0x84 , 0x00 , 0x08 , 0x82 , 0x00 , 0x11 , 0x01 , 0x00 , 0x20 , 0x00 , 0x80 , 0x40 , 0x00 , 0x40 , 0x40 , 0x00 , 0x40 , 0x7F , 0xFF , 0xC0 , 0x00 , 0x00 , 0x00 }; // You have two ways to define a sprite; this one is done with the built-in assembler #asm ._mysprite defb 8,6 defb @10000001 defb @01011010 defb @00100100 defb @00100100 defb @01011010 defb @10000001 #endasm void main() { cclg(1); // Blue background cputsprite(4,15,2,chesspiece); cputsprite(5,14,3,chesspiece); cputsprite(6,14,2,chesspiece); cputsprite(0,1,0,hello); cputsprite(2,0,0,hello); cputsprite(0,10,11,mysprite); cputsprite(3,9,11,mysprite); } z88dk-1.8.ds1/examples/spectrum/dstar.c0000644000175000017500000002366307130401706017455 0ustar tygrystygrys/* * dstar.c * * dstarz88 is a conversion of a TI86 game I found with * source on www.ticalc.org. * * The original program was written by Andrew Von Dollen who * in turn based it on a HP game by Joe W. * * The aim of the game is to collect all the clear bubbles by * running over them. You control either the dark bubble or * the solid box. The dark bubble is used to collect the clear * bubbles, and the solid box is used as a sort of movable wall. * * Both objects carry on moving until they hit something else * (except for the dark bubble in the case of clear bubbles). * * The keys are defined in #define statements, and default thus: * * Up: Q * Down: A * Left: O * Right: P * Quit: G * Retry: H * Switch: [SPACE] * * Switch changes between the dark bubble and the solid box. * * This is the first game ever produced with the Small C compiler - * it was written as a statement saying that it is possible to * write something easily, quickly and efficiently using the * compiler. Hopefully it will be an encouragement for others to * do likewise! * * For your interest I've also included the original Z88 converted * assembler from which I worked - it's quite crude but it just * about functions, the C is much more refined! * * Enough twaddle, enjoy the game and study the source! * * d. 1/12/98 * * * Rejigged for the Spectrum 17/5/99 djm * */ /* Skip closeall() gunk */ #pragma output nostreams /* Call up the required header files */ #include #include #include /* dstar.h contains the levels and "sprite" data */ #include "dstar.h" #define NO 0 #define MAXLEVEL 25 #define STARTLEV 0 /* Start level -1 */ /* Block numbers.. */ #define WALL 1 #define BUBB 2 #define BALL 3 #define BOX 4 /* Key definitions, change these to define your keys! */ #define K_UP 'Q' #define K_DOWN 'A' #define K_LEFT 'O' #define K_RIGHT 'P' #define K_SWITCH 32 #define K_EXIT 'G' #define K_CLEAR 'H' /* Declare some variables to start off with! */ char balloffset; /* Ball position */ char boxoffset; /* Box position */ char ballorbox; /* 1 if box, 0 if ball */ char level; /* Take a guess! */ char board[144]; /* Level internal map thing */ char tiscr[1024]; /* Our very own TI86 screen! */ /* prototype to stop barfing */ void redrawscreen(void); main() { redrawscreen(); /* Define the windows */ playgame(); /* Play the game */ myexit(); /* Clean up after ourselves */ } myexit() { exit(0); /* Get outta here! */ } playgame() { setupgame(); /* Set level to 1, get level etc */ /* Loop while checkfinish() says we haven't finished! */ while ( checkfinish() ) { gamekeys(); /* Scan keys */ } } /* Set some variables up at the start.. */ setupgame() { ballorbox=NO; level=STARTLEV; setuplevel(); } gamekeys() { char *charptr; /* Set up a pointer to the variable we want to change (either for * box or for ball */ if (ballorbox) charptr=&boxoffset; else charptr=&balloffset; switch( toupper(getk()) ) { /* Use OZ to get the key */ case K_DOWN: down(charptr); break; case K_UP: up(charptr); break; case K_RIGHT: right(charptr); break; case K_LEFT: left(charptr); break; case K_SWITCH: ballorbox^=1; /* Toggle ball/box */ break; case K_EXIT: myexit(); case K_CLEAR: setuplevel(); } } /* Movement functions - all of these are pretty well similar so I * will only comment the first one - it's fairly obvious what is * happening though */ left(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn-1)) ) return; *(locn-1)=*locn; *locn=0; (*ptr)--; /* ptr is the location of blob */ drawboard(); /* Draw screen */ } } right(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn+1)) ) return; *(locn+1)=*locn; *locn=0; (*ptr)++; drawboard(); } } down(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn+16)) ) return; *(locn+16)=*locn; *locn=0; (*ptr)+=16; drawboard(); } } up(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if ( standardmiddle(*(locn-16)) ) return; *(locn-16)=*locn; *locn=0; (*ptr)-=16; drawboard(); } } /* Check to see if we're running into anything, if box is set then * if we hit anything we want to stop, if we're ball then if we * hit anything except for bubble we wanna stop */ standardmiddle(char nextpos) { if (ballorbox) return (nextpos); /* For box */ else if (nextpos==BUBB || nextpos==NO) return(0); return(1); } /* Check to see if a level is finished * There are 144 squares in each level, note the use of != instead of * >6)&3; *ptr2++=((*ptr)>>4)&3; *ptr2++=((*ptr)>>2)&3; *ptr2++=(*ptr)&3; ptr++; } } /* Now, plot the ball and box into the internal map */ ptr2=board; *(ptr2+balloffset)=BALL; *(ptr2+boxoffset)=BOX; drawboard(); } /* Define the text window and the graphics window * If can't open graphics window then exit gracefully */ void redrawscreen(void) { #asm ld hl,16384 ld de,16385 ld bc,6143 ld (hl),0 ldir ld (hl),56 ld bc,767 ldir ld a,7 out (254),a ld a,56 ld (23624),a ld a,8 ld (23568),a #endasm puts_cons("\x01\x20\x16\x21\x20 DStar Z88 - C Demo"); puts_cons("Original game By A Von Dollen"); puts_cons(" Converted to ZX By D Morris"); puts_cons(" Keys: Q,A,O,P,SPACE,H,G"); } /* Draw the board, mostly written in C, even though we did take a bit * of a performance hit when it was converted over from asm */ drawboard() { int x,y; char *ptr; ptr=board; for (y=0;y!=9;y++) { for (x=0;x!=16;x++) { puttiblock((*ptr++),x,y); } } dozxcopyasm(); } /* Dump a sprite onto the TI screen we've built * The TI screen is 16 characters wide by 8 deep i.e. half the size * of the Z88's map screen. It's stored line by line (sensible!) * * We enter with y being y/7 and x being x/8 (if we think in pixels) * So for each y we have to step down by 112. * The increment between rows is 16. */ puttiblock(char spr,int x, int y) { char *ptr2,*ptr; int i; /* We use this method instead of y*=112 because the compiler has special * cases for multiplying by ints less than 16 (except for 11 and 13 * (Hmmm, I wonder why?!?!) */ y=(y*14)*8; /* So, get where we want to dump our sprite into ptr */ ptr=tiscr+y+x; /* Calculate where the sprite is */ spr*=8; ptr2=sprites+spr; /* And dump it in there */ for (i=0; i!=7;i++) { *ptr=*(ptr2++); ptr+=16; } } /* Ooops, forgive me this one bit of assembler in the entire program! * This just copies the TI screen onto the OZ map. * * It really is easier to keep this routine in here, change it into * C if you like.. */ dozxcopyasm() { #asm ld de,18432+8 ld hl,_tiscr ld c,8*8-1 .zxscrcpy1 push de ld b,16 .zxscrcpy2 ld a,(hl) ld (de),a inc de inc hl djnz zxscrcpy2 pop de call drow dec c jr nz,zxscrcpy1 ret .drow inc d ld a,7 and d ret nz ld a,e add a,32 ld e,a ret c ld a,d sub 8 ld d,a ret #endasm } /* THE END! */ z88dk-1.8.ds1/examples/spectrum/dstar.h0000644000175000017500000003076407130401706017462 0ustar tygrystygrys/* * Sprite and level data for DStar * Stored in #asm statements * * Even though the sprites are only 7 bytes long, we align them at 8 * bytes, so calculations go that little bit quicker! */ extern char levels[]; extern char sprites[]; #asm .smc_sprites ;1=edge, 2=clear ball 3=moveable ball 4=moveable block defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 0 defb @01111110 defb @10101001 defb @11000111 defb @10110001 defb @11001011 defb @10100101 defb @01111110 defb 0 defb @00000000 defb @00011000 defb @00100100 defb @00100100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 defb @00011000 defb @00110100 defb @00111100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 defb @00111100 defb @00111100 defb @00111100 defb @00111100 defb @00000000 defb @00000000 defb 0 #endasm #asm .smc_levels defb 17,30 ;ball offset, box offset defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@00000000,@00000000,@10010001 defb @01000000,@00000000,@00000010,@00010101 defb @01000000,@00000000,@01011000,@00000001 defb @01000000,@01010010,@00000000,@00000101 defb @01010010,@00001000,@00000000,@10000001 defb @01001000,@00000000,@00100101,@00100001 defb @01000000,@00000101,@10000000,@00001001 defb @01010101,@01010101,@01010101,@01010101 .level2 defb 30,86 defb @00010000,@01000100,@01000000,@01000101 defb @01000000,@10000000,@00000000,@00000001 defb @00000001,@10000001,@10000000,@10000000 defb @01000100,@10000000,@00001000,@00010001 defb @00000000,@00000100,@00001000,@00000100 defb @01000000,@00010001,@00001000,@00000001 defb @00000001,@00000100,@01000000,@01101001 defb @01000000,@00000000,@00000000,@00000100 defb @00010000,@01000000,@00000000,@00010000 .level3 defb 30,46 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@10010001 defb @01000000,@01010000,@00000000,@01010001 defb @01000000,@01100000,@00000010,@00000001 defb @01001000,@00000000,@10010100,@00001001 defb @01000110,@00001000,@00100100,@00100101 defb @01000101,@10000110,@00001000,@10010101 defb @01100000,@00000101,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level4 defb 125,30 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01000000,@00000100,@00000000,@00000001 defb @01011001,@10001001,@10011001,@10011001 defb @01000100,@01100010,@01000100,@01000101 defb @01011001,@10011000,@10011001,@10011001 defb @01000000,@00000100,@00000000,@00000001 defb @01000000,@01000000,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level5 defb 17,110 defb @00010101,@01010101,@01010101,@01010100 defb @01000000,@01000000,@01000001,@00000001 defb @01000001,@10000100,@10000010,@00010001 defb @01010000,@00000000,@01000001,@00000001 defb @01100001,@10010000,@00000000,@00000101 defb @01010000,@00000001,@00100001,@00000001 defb @01100100,@00010001,@00010000,@00010001 defb @01000000,@01000000,@00100100,@00011001 defb @00010101,@01010101,@01010101,@01010100 .level6 defb 65,113 defb @00000000,@01010101,@01010101,@01010101 defb @00000001,@00000010,@00000001,@10001001 defb @00000100,@00000010,@00000000,@01000101 defb @00010000,@00000010,@00000000,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01010000,@00000010,@00000100,@00000101 defb @01000000,@00000010,@00000000,@01000001 defb @01000001,@00000010,@00000101,@10000001 defb @01010101,@01010101,@01010101,@01010101 .level7 defb 115,122 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00000001 defb @00010100,@01010100,@00011000,@01011001 defb @00011000,@00011000,@01000100,@01000100 defb @00000100,@00010000,@01010100,@01010000 defb @00010100,@00010000,@01100100,@01100100 defb @01000000,@00000000,@00000000,@00000001 defb @01000000,@01100000,@00000000,@00011001 defb @01010101,@01010101,@01010101,@01010101 .level8 defb 108,98 defb @01010101,@01010101,@01010101,@01010100 defb @01000010,@01010000,@00000000,@00000101 defb @01000001,@10000001,@01001000,@00000001 defb @01000010,@01010001,@00011000,@00000001 defb @01010000,@00000001,@01000001,@10010001 defb @01010001,@00000000,@00000010,@01100001 defb @01100010,@01000000,@10000001,@00010001 defb @01010000,@00000000,@00000000,@00000001 defb @00010101,@01010101,@01010101,@01010101 .level9 defb 30,72 defb @00000100,@01010101,@01010101,@01010100 defb @00011001,@10000000,@00000001,@00000001 defb @01100010,@01000000,@00100000,@00000100 defb @00010001,@00001001,@01000010,@01000001 defb @01000001,@10000110,@00100000,@00001001 defb @01000000,@00001001,@01000000,@00000100 defb @01100110,@00000000,@00000000,@00010000 defb @01000000,@00000000,@00000000,@01000000 defb @01010101,@01010101,@01010101,@00000000 .level10 defb 93,36 defb @00000000,@01010101,@01010101,@01010100 defb @01010101,@00100000,@00000000,@00000001 defb @01000000,@00000101,@01100010,@01001001 defb @01001000,@00000110,@00011000,@00000100 defb @01000000,@00000100,@00100000,@01001001 defb @01100110,@00000100,@10010000,@01000100 defb @00011000,@00000101,@01000001,@01010000 defb @01000000,@00000000,@00000100,@01000100 defb @00010101,@01010101,@01010000,@01000001 .level11 defb 30,108 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000001,@00000000,@00000001 defb @01000001,@10100000,@00000010,@10000101 defb @01010000,@00100000,@00010100,@00001001 defb @01100000,@00000110,@01101000,@00010101 defb @01010001,@01000000,@00010100,@00000001 defb @01100000,@10010010,@00000000,@00001001 defb @01011001,@01010000,@00000100,@00000101 defb @00010100,@01010101,@01010101,@01010100 .level12 defb 17,92 defb @01010000,@00000001,@01000001,@01010100 defb @01000101,@01010110,@00010101,@00100101 defb @01000000,@00101000,@00000000,@10000001 defb @01000101,@00000101,@10000001,@10010001 defb @01000100,@10000101,@01100001,@01000001 defb @01000101,@00000101,@00000001,@00010001 defb @01000000,@00001000,@00000000,@00000001 defb @01000000,@00000000,@00100000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level13 defb 18,113 defb @00010101,@01010101,@01010101,@01010100 defb @01000001,@00000000,@00000000,@10000101 defb @01000100,@00000110,@00000010,@01010001 defb @01000000,@00000000,@10000000,@00010001 defb @01001000,@00000000,@00000000,@00011001 defb @01000100,@00000000,@00100000,@00000001 defb @01010000,@00000000,@10001000,@00011001 defb @01000000,@01000000,@00100001,@00010001 defb @00010101,@01010101,@01010101,@01010100 .level14 defb 36,50 defb @01010101,@01010101,@01010101,@01010101 defb @01100110,@00000000,@00000000,@10011001 defb @01001001,@00000000,@00000001,@01000001 defb @01000000,@00000000,@00000010,@00000001 defb @01000000,@00000000,@00100100,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01001001,@00000000,@00000000,@01000001 defb @01100110,@00000000,@00000000,@10011001 defb @01010101,@01010101,@01010101,@01010101 .level15 defb 51,76 defb @00010101,@01010100,@01010101,@01010100 defb @01000000,@00001001,@00000000,@00100001 defb @01000100,@10000100,@00010000,@00100001 defb @01000000,@01000000,@01101000,@01100001 defb @00010001,@00000001,@00100000,@00010001 defb @01100000,@00000000,@00010000,@01100001 defb @00010000,@00000000,@10000000,@00000100 defb @01100000,@00000000,@00000000,@00001001 defb @00010101,@01010101,@01010101,@01010100 .level16 defb 35,19 defb @01010101,@01010101,@01010101,@01010101 defb @01010000,@01100010,@00000000,@00001001 defb @01100000,@10011000,@00000000,@00000101 defb @01010001,@01010000,@00001000,@00000101 defb @01010000,@00000010,@01100100,@00000001 defb @01101000,@00000000,@00001001,@10000001 defb @01010010,@00000000,@01010101,@10000001 defb @01011001,@00000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level17 defb 29,124 defb @01010101,@01010101,@01010101,@01010101 defb @01001001,@00000000,@00000000,@01000001 defb @01000100,@00100110,@10011000,@00010001 defb @01000000,@00011001,@01100100,@10000001 defb @01001001,@00000000,@00000010,@01000001 defb @01000010,@01100000,@00001001,@00000001 defb @01000100,@00010001,@01100100,@00010001 defb @01000000,@00100001,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level18 defb 115,26 defb @01010101,@01010101,@01010101,@01010101 defb @01001000,@00000010,@00000001,@00000001 defb @01000001,@10011000,@00000110,@00000001 defb @01000000,@01100100,@00000001,@10000001 defb @01000000,@10000001,@00000010,@01100001 defb @01000110,@01000000,@01001001,@00000001 defb @01001001,@10000100,@10000100,@00000001 defb @01100100,@00000100,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level19 defb 126,110 defb @01010101,@01010101,@01010101,@01010101 defb @01100000,@00010100,@00000000,@01011001 defb @01000100,@00010000,@00000000,@01100001 defb @01001001,@00000010,@01010000,@10000001 defb @01000100,@00000001,@10000000,@00000001 defb @01000000,@00010000,@00100100,@00000001 defb @01000101,@00100100,@01011000,@00010001 defb @01001001,@00011000,@00000000,@01010001 defb @01010101,@01010101,@01010101,@01010101 .level20 defb 77,66 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@10011000,@00000000,@00000001 defb @01011000,@00100100,@01011000,@00000101 defb @01000100,@01001000,@00000100,@00010001 defb @01000000,@01000001,@01000001,@00001001 defb @01000100,@00010000,@00100001,@00010001 defb @01010000,@00100101,@00011000,@00100101 defb @01000000,@00000000,@00100110,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level21 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@01000000,@00001000,@00000101 defb @01000000,@01000000,@00000000,@01000101 defb @01000000,@01011000,@00000000,@00100001 defb @01000010,@00000000,@10000000,@10000101 defb @01000000,@00010000,@00000101,@01100001 defb @01000010,@00100000,@00000010,@00101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level22 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01100100,@00011001,@00011000,@00010001 defb @01000000,@00010000,@00000000,@00000001 defb @01100000,@00010000,@01100000,@10000001 defb @01010001,@10000000,@00000010,@00010101 defb @01001000,@01000000,@01010110,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level23 defb 103,105 defb @00010101,@01010101,@01010101,@01010100 defb @01000100,@00011001,@00011000,@00010001 defb @01000000,@00100000,@01000000,@00000001 defb @01010000,@00010000,@00100001,@10000001 defb @01000001,@10000001,@00001010,@00100001 defb @01011000,@01000000,@01010010,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @00010101,@01010101,@01010101,@01010100 defb @00000000,@00000000,@00000000,@00000000 .level24 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000100,@00000000,@00000101 defb @01000101,@10001000,@00000001,@01100101 defb @01000110,@00000000,@00100100,@00010101 defb @01001010,@00001001,@00010100,@00000001 defb @01000110,@00100001,@00000000,@01010001 defb @01000101,@00000000,@01000101,@01101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level25 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01001000,@01011000,@00001000,@00000001 defb @01000000,@01100000,@10000001,@01000001 defb @01001000,@00000001,@01000001,@10000001 defb @01000110,@00000010,@01000000,@00100001 defb @01000101,@10000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 #endasm z88dk-1.8.ds1/examples/spectrum/gfx.c0000644000175000017500000000115307130401706017112 0ustar tygrystygrys #include #include #include struct window mine; /* Window structure */ main() { int j,i; clg(); /* Draw a series of concentric circles in the centre of the screen * these go off the screen but don't generate an error - very cool! */ for (i=90 ; i!=0; i--) { circle(128,96,i,1); if (i < 25 ) i--; } draw(0,0,255,63); /* Draw a diamond - weak, but it demonstrates relative drawing! */ plot(200,32); drawr(10,10); drawr(10,-10); drawr(-10,-10); drawr(-10,10); } z88dk-1.8.ds1/examples/spectrum/Makefile0000644000175000017500000000043207555321613017632 0ustar tygrystygrys all: dstar ansitest gfx save save: zcc +zx -vn save.c -o save.bin gfx: zcc +zx -vn gfx.c -o gfx.bin -lndos dstar: zcc +zx -vn dstar.c -o dstar.bin -lndos ansitest: zcc +zxansi -vn ansitest.c -o ansitest.bin -lndos clean: $(RM) *.bin *.i *.asm *.op* *.o *~ zcc_opt.def z88dk-1.8.ds1/examples/spectrum/README0000644000175000017500000000131007363075453017053 0ustar tygrystygrysIn this directory contain some examples which have been rejigged for the Spectrum, there's a config file in this directory, compile the examples using the makefile or you can do it by hand thusly: zcc +zx -oenigma.bin enigma.c -lndos zcc +zx -odstar.bin dstar.c -lndos zcc +zx -orpn.bin rpn.c -lndos zcc +zx -oadv_a.bin adv_a.c -lndos zcc +zx -o gfx.bin gfx.c -lndos zcc +zxan -o ansitest.bin ansitest.c -lndos The produced file runs from 32768 So what are they? enigma - Simple enigma machine simulator dstar - Short puzzle game rpn - Reverse Polish Notation Calculator adv_a - Artic Adventure 'A' - Planet of Death ansitest- Test of the ANSI terminal gfx - An extremely weak demo of the graphics routines z88dk-1.8.ds1/examples/spectrum/save.c0000644000175000017500000000023507363107362017275 0ustar tygrystygrys #include char *testing = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int main() { /* Save a short block */ tape_save("test",(void *)32768,testing,26); } z88dk-1.8.ds1/examples/spectrum/zxbasic.c0000755000175000017500000000326210750102064017774 0ustar tygrystygrys/* Interfacing to the ZX Spectrum BASIC demonstration on: - diagnostics - parameter passing - code execution Try adding BASIC commands in line 100 and 150, like 100 LET a$="Test": STOP Then, after run, try to PRINT b$ $Id: zxbasic.c,v 1.2 2008/01/30 14:05:40 stefano Exp $ */ #include #include #include #include char value[100]; int main() { if ( if1_installed() ) printf ("Interface 1 is active\n"); else if ( zx_interface1() ) printf ("Interface 1 is present (now activated)\n"); if ( if1_from_mdv() ) printf ("Program loaded from microdrive\n"); if ( currah_detect() ) printf ("CURRAH uSpeech is present\n"); if ( zx_issue3() ) { printf ("This is a Spectrum issue 3 or more\n"); } else { printf ("This Spectrum is issue 1 or 2 !\n"); } /* if ( zx_128() ) { printf ("This is a Spectrum 128K\n"); } else { printf ("This is a Spectrum 16 or 48K\n"); } */ if ( zx_128mode() ) { printf ("This Spectrum is working in 128K mode\n"); } else { printf ("This Spectrum is working in non-128K mode\n"); } printf ("Basic length: %u\n",zx_basic_length() ); printf ("Variables area length: %u\n",zx_var_length() ); printf ("Basic exec line 100 result: %u\n",zx_goto(100) ); printf ("Basic exec line 150 result: %u\n",zx_goto(150) ); zx_getstr ('a',value); printf ("Got string value in 'a' : %s\n",value); zx_setint ("n",100); zx_setint ("num",1234); printf ("Got numeric value in 'num' : %u\n", zx_getint ("num") ); printf ("Got numeric value in 'n' : %u\n", zx_getint ("n") ); zx_setstr ('b',"This is the b$ string, which nobody can deny..."); printf ("\n\nProgram end\n"); } z88dk-1.8.ds1/examples/spectrum/zxcurrah.c0000755000175000017500000000131510452230757020206 0ustar tygrystygrys/* ZX Spectrum and the Currah uSpeech lib demo $Id: zxcurrah.c,v 1.1 2006/07/03 15:04:15 stefano Exp $ */ #include #include #include #include /* 'Hello" word for direct mode */ char hello[] = {PH_H, PH_E | PH_PITCH, PH_LL, PH_O, PH___, PH_END}; int main() { if ( !currah_detect() ) { printf ("CURRAH uSpeech is present\n"); } else { printf ("Hello (from the direct engine)\n"); currah_direct (hello); sleep (1); printf ("\nHello (internal conversion functions)\n"); currah_speech ("hE(ll)o"); sleep (1); printf ("\n\nI am a ZX Spectrum talking\n"); currah_speech ("aY em a zed eks spEctrum tokin"); } printf ("\n\n\n(Program end).\n"); } z88dk-1.8.ds1/examples/ticalc/0000755000175000017500000000000010765202715015566 5ustar tygrystygrysz88dk-1.8.ds1/examples/ticalc/ansitest.c0000644000175000017500000000177607567116022017600 0ustar tygrystygrys/* * Test the ANSI terminal * * 15/4/2000 Stefano Bodrato * 21/11/2002 Stefano Bodrato - release for small displays test * * Compile with zcc +ti83ansi (or similar) ansitest.c */ #include "stdio.h" main() { int x; /* A stupid CSI escape code test (normally no use uses CSI) */ printf ("If you can read this, CSI is not working.\n"); printf ("%c2J",155); printf ("If this is the first thing you can read, CSI is OK.\n"); /* Cursor Position test "Draw" an X */ for (x=0; x<5; x++) { printf ("%c[%u;%uH*\n",27,1+x,21+x); printf ("%c[%u;%uH*\n",27,5-x,21+x); } /* Set Graphic Rendition test */ printf ("%c[1mBold Text\n",27); printf ("%c[2mDim text\n",27); printf ("%c[4mUnderlined Text\n",27); printf ("%c[24mUn-underlined text\n",27); printf ("%c[7mReverse Text\n",27); printf ("%c[27mUn-reverse text\n",27); /* Restore default text attributes */ printf ("%c[m",27); } z88dk-1.8.ds1/examples/ticalc/dstar.c0000644000175000017500000001351607302163237017053 0ustar tygrystygrys/* Ported to the Ti82/83/83+ (rest will follow) by Henk Poley * up,down,left,right - move ball/box * [Enter] - toggle ball/box * 7 - Quit * 9 - Restart level * +,- - CHEAT.... * * Original docs: * * dstar.c * * DStar Z88 - C Demo * Original TI game By A Von Dollen * Converted to Z88 By D Morris * Keys: Q,A,O,P,SPACE,H,G * * dstarz88 is a conversion of a TI86 game I found with * source on www.ticalc.org. * * The original program was written by Andrew Von Dollen who * in turn based it on a HP game by Joe W. * * The aim of the game is to collect all the clear bubbles by * running over them. You control either the dark bubble or * the solid box. The dark bubble is used to collect the clear * bubbles, and the solid box is used as a sort of movable wall. * * Both objects carry on moving until they hit something else * (except for the dark bubble in the case of clear bubbles). * * The keys are defined in #define statements, and default thus: * * Up: Q * Down: A * Left: O * Right: P * Quit: G * Retry: H * Switch: [SPACE] * * Switch changes between the dark bubble and the solid box. * * This is the first game ever produced with the Small C compiler - * it was written as a statement saying that it is possible to * write something easily, quickly and efficiently using the * compiler. Hopefully it will be an encouragement for others to * do likewise! * * For your interest I've also included the original Z88 converted * assembler from which I worked - it's quite crude but it just * about functions, the C is much more refined! * * Enough twaddle, enjoy the game and study the source! * * d. 1/12/98 * * This is the BASIC version of the program, compile with: * * zcc -lgfx dstar.c */ #include #include #include #include #include "dstar.h" void main() { Level = (STARTLEV-1); SetupLevel(); /* Display the first level */ /* Loop keyhandler till you finished the game */ while (CheckNotFinished()) Gamekeys(); } void Gamekeys(void) { char *charptr; /* Set up a pointer to the variable we want to change * (either the box or the ball) */ charptr = PieceIsBall ? &BoxOffset : &BallOffset; switch(getk()) { case K_DOWN: MovePiece(charptr,0,+1); break; case K_UP: MovePiece(charptr,0,-1); break; case K_RIGHT: MovePiece(charptr,+1,0); break; case K_LEFT: MovePiece(charptr,-1,0); break; case K_SWITCH: PieceIsBall^=1; /* Toggle ball/box */ break; case K_EXIT: exit(0); case K_NEXTLEV: /* Okay this IS cheating... */ if(++Level==MAXLEVEL) { --Level; break; } SetupLevel(); break; case K_PREVLEV: if(--Level==-1) { ++Level; break; } /* fall thrue */ case K_CLEAR: SetupLevel(); } } /* The level is stored 'compressed', taking up 38 bytes a time. * byte 0 - position of ball * byte 1 - position of box * 2-37 - Level data * * Level data is stored as two bits per block, so we have to shift our * picked up byte round to get it. */ void SetupLevel(void) { int x; char *ptr,*ptr2; /* Fresh level, so start with the ball */ PieceIsBall = FALSE; ptr2 = Board; /* We copy to the Board */ ptr = levels + (Level * 38); /* from the Level data */ /* First two bytes are the ball and the box position */ BallOffset = *ptr++; BoxOffset = *ptr++; /* Decompress Level into the Board */ for (x=0; x!=36; x++) { *ptr2++=((*ptr)>>6)&3; *ptr2++=((*ptr)>>4)&3; *ptr2++=((*ptr)>>2)&3; *ptr2++=( *ptr) &3; ptr++; } /* Put the ball and box into their Board position */ *(Board+BallOffset) = BALL; *(Board+BoxOffset) = BOX; DrawBoard(); /* Display the clean Board */ } void DrawBoard(void) { int x,y; char *ptr; ptr = Board; clg(); /* clear the screen */ for (y=0 ; y!=9 ; y++) { for (x=0 ; x!=16 ; x++) { putsprite(spr_or,(x*6),(y*6),sprites + (8 * (*ptr++))); } } } /* Check if a Level is (not) finished: * There are 144 squares in each Level * * Note the use of != instead of < or <= * - this is faster to execute on the Z80! */ char CheckNotFinished(void) { char *ptr; int i; ptr = Board; for(i=1 ; i!=144 ; i++) { if(*ptr++ == BUBB) return(TRUE); /* Are there any bubbles? */ } if(++Level == MAXLEVEL) return(FALSE); /* All levels done? */ SetupLevel(); /* If not => Next Level! */ return(TRUE); /* And keep scanning keys */ } /* Check to see if we're running into anything: * - The box stops for everything (exept empty space [= 0]) * - The ball stops for everything exept a bubble */ char TestNextPosIsStop(char nextpos) { if(!PieceIsBall) if (nextpos==BUBB) return(FALSE); return(nextpos); } void MovePiece(char *ptr, char plusx, char plusy) { char *locn; char temp,temp2; int x,y; temp = PieceIsBall + 3; temp2 = (plusx + (plusy * 16)); while(1) /* loop */ { locn = *(ptr) + Board; if(TestNextPosIsStop(*(locn+temp2))) return; /* till edge */ y = (*(ptr) / 16); x = (*(ptr) - (y * 16)) * 6; y *= 6; if(*(locn+temp2)==BUBB) putsprite(spr_xor,x+(plusx*6),y+(plusy*6),sprites + (8 * BUBB)); *(locn+temp2) = *locn; *locn = 0; /* remove old */ putsprite(spr_xor,x,y,sprites + (8 * temp)); /* put new */ putsprite(spr_xor,x+(plusx*6),y+(plusy*6),sprites + (8 * temp)); (*ptr) += temp2; } } z88dk-1.8.ds1/examples/ticalc/dstar.h0000644000175000017500000003277007302163237017063 0ustar tygrystygrys#pragma string name DStar #pragma output nostreams void MovePiece(char *ptr, char plusx, char plusy); char TestNextPosIsStop(char nextpos); char CheckNotFinished(void); void SetupLevel(void); void DrawBoard(void); void Gamekeys(void); char BallOffset; /* Ball position */ char BoxOffset; /* Box position */ char PieceIsBall; /* 1 = box, 0 = ball */ char Level; /* Guess! */ char Board[144]; /* Space for decompressed Level */ #define MAXLEVEL 25 /* Highest Level */ #define STARTLEV 1 /* Start Level */ #define TRUE 1 #define FALSE 0 /* Block numbers.. */ #define WALL 1 #define BUBB 2 #define BALL 3 #define BOX 4 /* Ti keyboard */ #define K_UP 11 /* arrow up */ #define K_DOWN 10 /* arrow down */ #define K_LEFT 8 /* arrow left */ #define K_RIGHT 9 /* arrow right */ #define K_NEXTLEV '+' #define K_PREVLEV '-' #define K_SWITCH 13 /* [Enter] */ #define K_EXIT '7' /* [Esc]/[Quit] */ #define K_CLEAR '9' extern char levels[]; extern char sprites[]; #asm ._sprites defb 6,6 defb @00000000 ; empty sprite defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 6,6 defb @01111000 ;1=edge, defb @10000100 defb @10000100 defb @10000100 defb @10000100 defb @01111000 defb 6,6 defb @00000000 ;2=bubble defb @00110000 defb @01001000 defb @01001000 defb @00110000 defb @00000000 defb 6,6 defb @00000000 ;3=moveable ball defb @00110000 defb @01101000 defb @01111000 defb @00110000 defb @00000000 defb 6,6 defb @00000000 ;4=moveable block defb @01111000 defb @01001000 defb @01001000 defb @01111000 defb @00000000 ._levels defb 17,30 ;ball offset, box offset defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@00000000,@00000000,@10010001 defb @01000000,@00000000,@00000010,@00010101 defb @01000000,@00000000,@01011000,@00000001 defb @01000000,@01010010,@00000000,@00000101 defb @01010010,@00001000,@00000000,@10000001 defb @01001000,@00000000,@00100101,@00100001 defb @01000000,@00000101,@10000000,@00001001 defb @01010101,@01010101,@01010101,@01010101 .level2 defb 30,86 defb @00010000,@01000100,@01000000,@01000101 defb @01000000,@10000000,@00000000,@00000001 defb @00000001,@10000001,@10000000,@10000000 defb @01000100,@10000000,@00001000,@00010001 defb @00000000,@00000100,@00001000,@00000100 defb @01000000,@00010001,@00001000,@00000001 defb @00000001,@00000100,@01000000,@01101001 defb @01000000,@00000000,@00000000,@00000100 defb @00010000,@01000000,@00000000,@00010000 .level3 defb 30,46 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@10010001 defb @01000000,@01010000,@00000000,@01010001 defb @01000000,@01100000,@00000010,@00000001 defb @01001000,@00000000,@10010100,@00001001 defb @01000110,@00001000,@00100100,@00100101 defb @01000101,@10000110,@00001000,@10010101 defb @01100000,@00000101,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level4 defb 125,30 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01000000,@00000100,@00000000,@00000001 defb @01011001,@10001001,@10011001,@10011001 defb @01000100,@01100010,@01000100,@01000101 defb @01011001,@10011000,@10011001,@10011001 defb @01000000,@00000100,@00000000,@00000001 defb @01000000,@01000000,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level5 defb 17,110 defb @00010101,@01010101,@01010101,@01010100 defb @01000000,@01000000,@01000001,@00000001 defb @01000001,@10000100,@10000010,@00010001 defb @01010000,@00000000,@01000001,@00000001 defb @01100001,@10010000,@00000000,@00000101 defb @01010000,@00000001,@00100001,@00000001 defb @01100100,@00010001,@00010000,@00010001 defb @01000000,@01000000,@00100100,@00011001 defb @00010101,@01010101,@01010101,@01010100 .level6 defb 65,113 defb @00000000,@01010101,@01010101,@01010101 defb @00000001,@00000010,@00000001,@10001001 defb @00000100,@00000010,@00000000,@01000101 defb @00010000,@00000010,@00000000,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01010000,@00000010,@00000100,@00000101 defb @01000000,@00000010,@00000000,@01000001 defb @01000001,@00000010,@00000101,@10000001 defb @01010101,@01010101,@01010101,@01010101 .level7 defb 115,122 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00000001 defb @00010100,@01010100,@00011000,@01011001 defb @00011000,@00011000,@01000100,@01000100 defb @00000100,@00010000,@01010100,@01010000 defb @00010100,@00010000,@01100100,@01100100 defb @01000000,@00000000,@00000000,@00000001 defb @01000000,@01100000,@00000000,@00011001 defb @01010101,@01010101,@01010101,@01010101 .level8 defb 108,98 defb @01010101,@01010101,@01010101,@01010100 defb @01000010,@01010000,@00000000,@00000101 defb @01000001,@10000001,@01001000,@00000001 defb @01000010,@01010001,@00011000,@00000001 defb @01010000,@00000001,@01000001,@10010001 defb @01010001,@00000000,@00000010,@01100001 defb @01100010,@01000000,@10000001,@00010001 defb @01010000,@00000000,@00000000,@00000001 defb @00010101,@01010101,@01010101,@01010101 .level9 defb 30,72 defb @00000100,@01010101,@01010101,@01010100 defb @00011001,@10000000,@00000001,@00000001 defb @01100010,@01000000,@00100000,@00000100 defb @00010001,@00001001,@01000010,@01000001 defb @01000001,@10000110,@00100000,@00001001 defb @01000000,@00001001,@01000000,@00000100 defb @01100110,@00000000,@00000000,@00010000 defb @01000000,@00000000,@00000000,@01000000 defb @01010101,@01010101,@01010101,@00000000 .level10 defb 93,36 defb @00000000,@01010101,@01010101,@01010100 defb @01010101,@00100000,@00000000,@00000001 defb @01000000,@00000101,@01100010,@01001001 defb @01001000,@00000110,@00011000,@00000100 defb @01000000,@00000100,@00100000,@01001001 defb @01100110,@00000100,@10010000,@01000100 defb @00011000,@00000101,@01000001,@01010000 defb @01000000,@00000000,@00000100,@01000100 defb @00010101,@01010101,@01010000,@01000001 .level11 defb 30,108 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000001,@00000000,@00000001 defb @01000001,@10100000,@00000010,@10000101 defb @01010000,@00100000,@00010100,@00001001 defb @01100000,@00000110,@01101000,@00010101 defb @01010001,@01000000,@00010100,@00000001 defb @01100000,@10010010,@00000000,@00001001 defb @01011001,@01010000,@00000100,@00000101 defb @00010100,@01010101,@01010101,@01010100 .level12 defb 17,92 defb @01010000,@00000001,@01000001,@01010100 defb @01000101,@01010110,@00010101,@00100101 defb @01000000,@00101000,@00000000,@10000001 defb @01000101,@00000101,@10000001,@10010001 defb @01000100,@10000101,@01100001,@01000001 defb @01000101,@00000101,@00000001,@00010001 defb @01000000,@00001000,@00000000,@00000001 defb @01000000,@00000000,@00100000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level13 defb 18,113 defb @00010101,@01010101,@01010101,@01010100 defb @01000001,@00000000,@00000000,@10000101 defb @01000100,@00000110,@00000010,@01010001 defb @01000000,@00000000,@10000000,@00010001 defb @01001000,@00000000,@00000000,@00011001 defb @01000100,@00000000,@00100000,@00000001 defb @01010000,@00000000,@10001000,@00011001 defb @01000000,@01000000,@00100001,@00010001 defb @00010101,@01010101,@01010101,@01010100 .level14 defb 36,50 defb @01010101,@01010101,@01010101,@01010101 defb @01100110,@00000000,@00000000,@10011001 defb @01001001,@00000000,@00000001,@01000001 defb @01000000,@00000000,@00000010,@00000001 defb @01000000,@00000000,@00100100,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01001001,@00000000,@00000000,@01000001 defb @01100110,@00000000,@00000000,@10011001 defb @01010101,@01010101,@01010101,@01010101 .level15 defb 51,76 defb @00010101,@01010100,@01010101,@01010100 defb @01000000,@00001001,@00000000,@00100001 defb @01000100,@10000100,@00010000,@00100001 defb @01000000,@01000000,@01101000,@01100001 defb @00010001,@00000001,@00100000,@00010001 defb @01100000,@00000000,@00010000,@01100001 defb @00010000,@00000000,@10000000,@00000100 defb @01100000,@00000000,@00000000,@00001001 defb @00010101,@01010101,@01010101,@01010100 .level16 defb 35,19 defb @01010101,@01010101,@01010101,@01010101 defb @01010000,@01100010,@00000000,@00001001 defb @01100000,@10011000,@00000000,@00000101 defb @01010001,@01010000,@00001000,@00000101 defb @01010000,@00000010,@01100100,@00000001 defb @01101000,@00000000,@00001001,@10000001 defb @01010010,@00000000,@01010101,@10000001 defb @01011001,@00000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level17 defb 29,124 defb @01010101,@01010101,@01010101,@01010101 defb @01001001,@00000000,@00000000,@01000001 defb @01000100,@00100110,@10011000,@00010001 defb @01000000,@00011001,@01100100,@10000001 defb @01001001,@00000000,@00000010,@01000001 defb @01000010,@01100000,@00001001,@00000001 defb @01000100,@00010001,@01100100,@00010001 defb @01000000,@00100001,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level18 defb 115,26 defb @01010101,@01010101,@01010101,@01010101 defb @01001000,@00000010,@00000001,@00000001 defb @01000001,@10011000,@00000110,@00000001 defb @01000000,@01100100,@00000001,@10000001 defb @01000000,@10000001,@00000010,@01100001 defb @01000110,@01000000,@01001001,@00000001 defb @01001001,@10000100,@10000100,@00000001 defb @01100100,@00000100,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level19 defb 126,110 defb @01010101,@01010101,@01010101,@01010101 defb @01100000,@00010100,@00000000,@01011001 defb @01000100,@00010000,@00000000,@01100001 defb @01001001,@00000010,@01010000,@10000001 defb @01000100,@00000001,@10000000,@00000001 defb @01000000,@00010000,@00100100,@00000001 defb @01000101,@00100100,@01011000,@00010001 defb @01001001,@00011000,@00000000,@01010001 defb @01010101,@01010101,@01010101,@01010101 .level20 defb 77,66 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@10011000,@00000000,@00000001 defb @01011000,@00100100,@01011000,@00000101 defb @01000100,@01001000,@00000100,@00010001 defb @01000000,@01000001,@01000001,@00001001 defb @01000100,@00010000,@00100001,@00010001 defb @01010000,@00100101,@00011000,@00100101 defb @01000000,@00000000,@00100110,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level21 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@01000000,@00001000,@00000101 defb @01000000,@01000000,@00000000,@01000101 defb @01000000,@01011000,@00000000,@00100001 defb @01000010,@00000000,@10000000,@10000101 defb @01000000,@00010000,@00000101,@01100001 defb @01000010,@00100000,@00000010,@00101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level22 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01100100,@00011001,@00011000,@00010001 defb @01000000,@00010000,@00000000,@00000001 defb @01100000,@00010000,@01100000,@10000001 defb @01010001,@10000000,@00000010,@00010101 defb @01001000,@01000000,@01010110,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level23 defb 103,105 defb @00010101,@01010101,@01010101,@01010100 defb @01000100,@00011001,@00011000,@00010001 defb @01000000,@00100000,@01000000,@00000001 defb @01010000,@00010000,@00100001,@10000001 defb @01000001,@10000001,@00001010,@00100001 defb @01011000,@01000000,@01010010,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @00010101,@01010101,@01010101,@01010100 defb @00000000,@00000000,@00000000,@00000000 .level24 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000100,@00000000,@00000101 defb @01000101,@10001000,@00000001,@01100101 defb @01000110,@00000000,@00100100,@00010101 defb @01001010,@00001001,@00010100,@00000001 defb @01000110,@00100001,@00000000,@01010001 defb @01000101,@00000000,@01000101,@01101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level25 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01001000,@01011000,@00001000,@00000001 defb @01000000,@01100000,@10000001,@01000001 defb @01001000,@00000001,@01000001,@10000001 defb @01000110,@00000010,@01000000,@00100001 defb @01000101,@10000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 #endasm z88dk-1.8.ds1/examples/ticalc/dstar2.c0000644000175000017500000002427707276715703017156 0ustar tygrystygrys/* * dstar.c * * DStar Z88 - C Demo * Original TI game By A Von Dollen * Converted to Z88 By D Morris * Keys: Q,A,O,P,SPACE,H,G * * dstarz88 is a conversion of a TI86 game I found with * source on www.ticalc.org. * * The original program was written by Andrew Von Dollen who * in turn based it on a HP game by Joe W. * * The aim of the game is to collect all the clear bubbles by * running over them. You control either the dark bubble or * the solid box. The dark bubble is used to collect the clear * bubbles, and the solid box is used as a sort of movable wall. * * Both objects carry on moving until they hit something else * (except for the dark bubble in the case of clear bubbles). * * The keys are defined in #define statements, and default thus: * * Up: Q * Down: A * Left: O * Right: P * Quit: G * Retry: H * Switch: [SPACE] * * Switch changes between the dark bubble and the solid box. * * This is the first game ever produced with the Small C compiler - * it was written as a statement saying that it is possible to * write something easily, quickly and efficiently using the * compiler. Hopefully it will be an encouragement for others to * do likewise! * * For your interest I've also included the original Z88 converted * assembler from which I worked - it's quite crude but it just * about functions, the C is much more refined! * * Enough twaddle, enjoy the game and study the source! * * d. 1/12/98 * * This is the BASIC version of the program, compile with: * * zcc -lgfx dstar.c */ #include #include #include #include #include "dstar.h" void main() { OpenWindow(); /* Open a window (if needed) */ Level = (STARTLEV-1); SetupLevel(); /* Display the first level */ /* Loop keyhandler till you finished the game */ while (CheckNotFinished()) Gamekeys(); MyExit(); /* Close the window (if needed) */ } void Gamekeys(void) { char *charptr; /* Set up a pointer to the variable we want to change * (either the box or the ball) */ charptr = PieceIsBall ? &BoxOffset : &BallOffset; switch(getk()) { case K_DOWN: MovePiece(charptr,0,+1); break; case K_UP: MovePiece(charptr,0,-1); break; case K_RIGHT: MovePiece(charptr,+1,0); break; case K_LEFT: MovePiece(charptr,-1,0); break; case K_SWITCH: PieceIsBall^=1; /* Toggle ball/box */ break; case K_EXIT: MyExit(); case K_NEXTLEV: /* Okay this IS cheating... */ if(++Level==MAXLEVEL) { --Level; break; } SetupLevel(); break; case K_PREVLEV: if(--Level==-1) { ++Level; break; } /* fall thrue */ case K_CLEAR: SetupLevel(); } } /* The level is stored 'compressed', taking up 38 bytes a time. * byte 0 - position of ball * byte 1 - position of box * 2-37 - Level data * * Level data is stored as two bits per block, so we have to shift our * picked up byte round to get it. */ void SetupLevel(void) { int x; char *ptr,*ptr2; /* Fresh level, so start with the ball */ PieceIsBall = FALSE; ptr2 = Board; /* We copy to the Board */ ptr = levels + (Level * 38); /* from the Level data */ /* First two bytes are the ball and the box position */ BallOffset = *ptr++; BoxOffset = *ptr++; /* Decompress Level into the Board */ for (x=0; x!=36; x++) { *ptr2++=((*ptr)>>6)&3; *ptr2++=((*ptr)>>4)&3; *ptr2++=((*ptr)>>2)&3; *ptr2++=( *ptr) &3; ptr++; } /* Put the ball and box into their Board position */ *(Board+BallOffset) = BALL; *(Board+BoxOffset) = BOX; DrawBoard(); /* Display the clean Board */ } /* Check if a Level is (not) finished: * There are 144 squares in each Level * * Note the use of != instead of < or <= * - this is faster to execute on the Z80! */ char CheckNotFinished(void) { char *ptr; int i; ptr = Board; for(i=1 ; i!=144 ; i++) { if(*ptr++ == BUBB) return(TRUE); /* Are there any bubbles? */ } if(++Level == MAXLEVEL) return(FALSE); /* All levels done? */ SetupLevel(); /* If not => Next Level! */ return(TRUE); /* And keep scanning keys */ } /* Check to see if we're running into anything: * - The box stops for everything (exept empty space [= 0]) * - The ball stops for everything exept a bubble */ char TestNextPosIsStop(char nextpos) { if(!PieceIsBall) if (nextpos==BUBB) return(FALSE); return(nextpos); } /*------------------------------------------------------------------------*/ /*------------------End-of-generic-routines-------------------------------*/ /*------------------------------------------------------------------------*/ #if defined __TI82__ || defined __TI83__ || defined __TI8X__ || defined __TI85__ || defined __TI86__ void DrawBoard(void) { int x,y; char *ptr; ptr = Board; clg(); /* clear the screen */ for (y=0 ; y!=9 ; y++) { for (x=0 ; x!=16 ; x++) { putsprite(spr_or,(x*6),(y*6),sprites + (8 * (*ptr++))); } } } void MovePiece(char *ptr, char plusx, char plusy) { char *locn; char temp,temp2; int x,y; temp = PieceIsBall + 3; temp2 = (plusx + (plusy * 16)); while(1) /* loop */ { locn = *(ptr) + Board; if(TestNextPosIsStop(*(locn+temp2))) return; /* till edge */ y = (*(ptr) / 16); x = (*(ptr) - (y * 16)) * 6; y *= 6; if(*(locn+temp2)==BUBB) putsprite(spr_xor,x+(plusx*6),y+(plusy*6),sprites + (8 * BUBB)); *(locn+temp2) = *locn; *locn = 0; /* remove old */ putsprite(spr_xor,x,y,sprites + (8 * temp)); /* put new */ putsprite(spr_xor,x+(plusx*6),y+(plusy*6),sprites + (8 * temp)); (*ptr) += temp2; } } #endif #ifdef __Z88__ /* Define the text window and the graphics window * If can't open graphics window then exit gracefully */ void OpenWindow(void) { struct window text; /* Clear the whole screen */ puts(baswindres); /* Define and open a text window with title and other embellishments * strings are at top for clearing, position etc */ text->number='3'; text->x=32+7; text->y=32+1; text->width=32+34; text->depth=32+7; text->type=131; text->graph=0; window(text); fputs(windtitle,stdout); text->x=32+8; text->y=32+3; text->width=32+32; text->depth=32+5; text->type=128; window(text); fputs(windclr,stdout); /* Now, try to open a map window.. */ graphics->graph=1; graphics->width=128; graphics->number='4'; if (window(graphics)) { puts("Sorry, Can't Open Map"); sleep(5); exit(0); } /* Sucessfully opened, now dump some info in the text window! */ puts( " DStar Z88 - C Demo" ); fputs("Original TI game By A Von Dollen",stdout); puts( " Converted to Z88 By D Morris" ); puts( " Keys: Q,A,O,P,SPACE,H,G" ); } /* Dump a sprite onto the TI screen we've built * The TI screen is 16 characters wide by 8 deep i.e. half the size * of the Z88's map screen. It's stored line by line (sensible!) * * We enter with y being y/7 and x being x/8 (if we think in pixels) * So for each y we have to step down by 112. * The increment between rows is 16. */ void puttiblock(char spr,int x, int y) { char *ptr2,*ptr; int i; /* We use this method instead of y*=112 because the compiler has special * cases for multiplying by ints less than 16 (except for 11 and 13 * (Hmmm, I wonder why?!?!) */ y=(y*14)*8; /* So, get where we want to dump our sprite into ptr */ ptr=tiscr+y+x; /* Calculate where the sprite is */ spr*=8; ptr2=sprites+spr; /* And dump it in there */ for (i=0; i!=7;i++) { *ptr=*(ptr2++); ptr+=16; } } void MyExit(void) { closegfx(graphics); /* Close the Map window */ puts(baswindres); exit(0); /* Get outta here! */ } /* Ooops, forgive me this one bit of assembler in the entire program! * This just copies the TI screen onto the OZ map. * * It really is easier to keep this routine in here, change it into * C if you like.. */ void CopyToScreen(void) { #asm LIB swapgfxbk call swapgfxbk call ozscrcpy jp swapgfxbk .ozscrcpy ld de,(base_graphics) ld hl,_tiscr ld c,8 .ozscrcpy1 push hl ld b,16 .ozscrcpy3 push bc push hl ld bc,16 ld a,8 .ozscrcpy2 ex af,af ld a,(hl) ld (de),a inc de add hl,bc ex af,af dec a jr nz,ozscrcpy2 pop hl inc hl pop bc djnz ozscrcpy3 pop hl push bc ld bc,16*8 add hl,bc pop bc dec c jr nz,ozscrcpy1 ;ret #endasm } #endif #if __SPECTRUM__ /* Define the text window and the graphics window * If can't open graphics window then exit gracefully */ void OpenWindow(void) { #asm ld hl,16384 ld de,16385 ld bc,6143 ld (hl),0 ldir ld (hl),56 ld bc,767 ldir ld a,7 out (254),a ld a,56 ld (23624),a ld a,8 ld (23568),a #endasm puts_cons("\x01\x20\x16\x21\x20 DStar Z88 - C Demo"); puts_cons("Original game By A Von Dollen"); puts_cons(" Converted to ZX By D Morris"); puts_cons(" Keys: Q,A,O,P,SPACE,H,G"); } /* Ooops, forgive me this one bit of assembler in the entire program! * This just copies the TI screen onto the map. * * It really is easier to keep this routine in here, change it into * C if you like.. */ void CopyToScreen(void) { #asm ld de,18432+8 ld hl,_tiscr ld c,8*8-1 .zxscrcpy1 push de ld b,16 .zxscrcpy2 ld a,(hl) ld (de),a inc de inc hl djnz zxscrcpy2 pop de call drow dec c jr nz,zxscrcpy1 ret .drow inc d ld a,7 and d ret nz ld a,e add a,32 ld e,a ret c ld a,d sub 8 ld d,a ;ret #endasm } #endif z88dk-1.8.ds1/examples/ticalc/dstar2.h0000644000175000017500000004045007276715703017152 0ustar tygrystygrys#pragma string name DStar void MovePiece(char *ptr, char plusx, char plusy); void puttiblock(char spr,int x, int y); char TestNextPosIsStop(char nextpos); char CheckNotFinished(void); void OpenWindow(void); void CopyToScreen(void); void SetupLevel(void); void DrawBoard(void); void Gamekeys(void); void MyExit(void); char BallOffset; /* Ball position */ char BoxOffset; /* Box position */ char PieceIsBall; /* 1 = box, 0 = ball */ char Level; /* Guess! */ char Board[144]; /* Space for decompressed Level */ #define MAXLEVEL 25 /* Highest Level */ #define STARTLEV 1 /* Start Level */ #define TRUE 1 #define FALSE 0 /* Block numbers.. */ #define WALL 1 #define BUBB 2 #define BALL 3 #define BOX 4 /*------------------------------------------------------------------------*/ /* Ti keyboard */ #if defined __TI82__ || defined __TI83__ || defined __TI8X__ || defined __TI85__ || defined __TI86__ #define K_UP 11 /* arrow up */ #define K_DOWN 10 /* arrow down */ #define K_LEFT 8 /* arrow left */ #define K_RIGHT 9 /* arrow right */ #define K_NEXTLEV '+' #define K_PREVLEV '-' #define K_SWITCH 13 /* [Enter] */ #define K_EXIT '7' /* [Esc]/[Quit] */ #define K_CLEAR '9' #endif /* QWERTY keyboard */ #if defined __Z88__ || defined __SPECTRUM__ || defined __ZX81__ || defined __VZ200__ #define K_UP 'Q' #define K_DOWN 'A' #define K_LEFT 'O' #define K_RIGHT 'P' #define K_NEXTLEV '+' #define K_PREVLEV '-' #define K_SWITCH 32 #define K_EXIT 'G' #define K_CLEAR 'H' #endif /*------------------------------------------------------------------------*/ #if !(defined __TI82__ || defined __TI83__ || defined __TI8X__ || defined __TI85__ || defined __TI86__) char tiscr[1024]; /* Our personal (virtual) Ti86 screen */ #endif #if defined __TI82__ || defined __TI83__ || defined __TI8X__ || defined __TI85__ || defined __TI86__ || defined __VZ200__ || __ZX81__ #pragma output nostreams #define OpenWindow() #define MyExit() exit(0) #endif #if defined __SPECTRUM__ #pragma output nostreams #define MyExit() exit(0) #endif #if defined __TI82__ || defined __TI83__ || defined __TI8X__ || defined __TI85__ || defined __TI86__ #define CopyToScreen() #endif #if defined __Z88__ char windtitle[]= { 1,'7','#','3',32+7,32+1,32+34,32+7,131, 1,'2','C','3',1,'4','+','T','U','R',1,'2','J','C', 1,'3','@',32,32, /*reset to (0,0)*/ 'D','S','t','a','r',' ','z','8','8', 1,'3','@',32,32 ,1,'2','A',32+34,0 }; char baswindres[]= { 1,'2','H','1',0x0C,0 }; char windclr[]= { 1,'2','C','3', 1,'3','@',32,32,1,'2','+','B',0 }; struct window graphics; #endif /*------------------------------------------------------------------------*/ extern char levels[]; extern char sprites[]; #if defined __TI82__ || defined __TI83__ || defined __TI8x__ #asm ._sprites defb 6,6 defb @00000000 ; empty sprite defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 6,6 defb @01111000 ;1=edge, defb @10000100 defb @10000100 defb @10000100 defb @10000100 defb @01111000 defb 6,6 defb @00000000 ;2=bubble defb @00110000 defb @01001000 defb @01001000 defb @00110000 defb @00000000 defb 6,6 defb @00000000 ;3=moveable ball defb @00110000 defb @01101000 defb @01111000 defb @00110000 defb @00000000 defb 6,6 defb @00000000 ;4=moveable block defb @01111000 defb @01001000 defb @01001000 defb @01111000 defb @00000000 #endasm #endif #if defined __TI85__ || defined __TI86__ #asm ._sprites defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 0 defb @01111110 ;1=edge, defb @10101001 defb @11000111 defb @10110001 defb @11001011 defb @10100101 defb @01111110 defb 0 defb @00000000 ;2=bubble defb @00011000 defb @00100100 defb @00100100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 ;3=moveable ball defb @00011000 defb @00110100 defb @00111100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 ;4=moveable block defb @00111100 defb @00111100 defb @00111100 defb @00111100 defb @00000000 defb @00000000 defb 0 #endasm #endif #asm ._levels defb 17,30 ;ball offset, box offset defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@00000000,@00000000,@10010001 defb @01000000,@00000000,@00000010,@00010101 defb @01000000,@00000000,@01011000,@00000001 defb @01000000,@01010010,@00000000,@00000101 defb @01010010,@00001000,@00000000,@10000001 defb @01001000,@00000000,@00100101,@00100001 defb @01000000,@00000101,@10000000,@00001001 defb @01010101,@01010101,@01010101,@01010101 .level2 defb 30,86 defb @00010000,@01000100,@01000000,@01000101 defb @01000000,@10000000,@00000000,@00000001 defb @00000001,@10000001,@10000000,@10000000 defb @01000100,@10000000,@00001000,@00010001 defb @00000000,@00000100,@00001000,@00000100 defb @01000000,@00010001,@00001000,@00000001 defb @00000001,@00000100,@01000000,@01101001 defb @01000000,@00000000,@00000000,@00000100 defb @00010000,@01000000,@00000000,@00010000 .level3 defb 30,46 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@10010001 defb @01000000,@01010000,@00000000,@01010001 defb @01000000,@01100000,@00000010,@00000001 defb @01001000,@00000000,@10010100,@00001001 defb @01000110,@00001000,@00100100,@00100101 defb @01000101,@10000110,@00001000,@10010101 defb @01100000,@00000101,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level4 defb 125,30 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01000000,@00000100,@00000000,@00000001 defb @01011001,@10001001,@10011001,@10011001 defb @01000100,@01100010,@01000100,@01000101 defb @01011001,@10011000,@10011001,@10011001 defb @01000000,@00000100,@00000000,@00000001 defb @01000000,@01000000,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level5 defb 17,110 defb @00010101,@01010101,@01010101,@01010100 defb @01000000,@01000000,@01000001,@00000001 defb @01000001,@10000100,@10000010,@00010001 defb @01010000,@00000000,@01000001,@00000001 defb @01100001,@10010000,@00000000,@00000101 defb @01010000,@00000001,@00100001,@00000001 defb @01100100,@00010001,@00010000,@00010001 defb @01000000,@01000000,@00100100,@00011001 defb @00010101,@01010101,@01010101,@01010100 .level6 defb 65,113 defb @00000000,@01010101,@01010101,@01010101 defb @00000001,@00000010,@00000001,@10001001 defb @00000100,@00000010,@00000000,@01000101 defb @00010000,@00000010,@00000000,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01010000,@00000010,@00000100,@00000101 defb @01000000,@00000010,@00000000,@01000001 defb @01000001,@00000010,@00000101,@10000001 defb @01010101,@01010101,@01010101,@01010101 .level7 defb 115,122 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00000001 defb @00010100,@01010100,@00011000,@01011001 defb @00011000,@00011000,@01000100,@01000100 defb @00000100,@00010000,@01010100,@01010000 defb @00010100,@00010000,@01100100,@01100100 defb @01000000,@00000000,@00000000,@00000001 defb @01000000,@01100000,@00000000,@00011001 defb @01010101,@01010101,@01010101,@01010101 .level8 defb 108,98 defb @01010101,@01010101,@01010101,@01010100 defb @01000010,@01010000,@00000000,@00000101 defb @01000001,@10000001,@01001000,@00000001 defb @01000010,@01010001,@00011000,@00000001 defb @01010000,@00000001,@01000001,@10010001 defb @01010001,@00000000,@00000010,@01100001 defb @01100010,@01000000,@10000001,@00010001 defb @01010000,@00000000,@00000000,@00000001 defb @00010101,@01010101,@01010101,@01010101 .level9 defb 30,72 defb @00000100,@01010101,@01010101,@01010100 defb @00011001,@10000000,@00000001,@00000001 defb @01100010,@01000000,@00100000,@00000100 defb @00010001,@00001001,@01000010,@01000001 defb @01000001,@10000110,@00100000,@00001001 defb @01000000,@00001001,@01000000,@00000100 defb @01100110,@00000000,@00000000,@00010000 defb @01000000,@00000000,@00000000,@01000000 defb @01010101,@01010101,@01010101,@00000000 .level10 defb 93,36 defb @00000000,@01010101,@01010101,@01010100 defb @01010101,@00100000,@00000000,@00000001 defb @01000000,@00000101,@01100010,@01001001 defb @01001000,@00000110,@00011000,@00000100 defb @01000000,@00000100,@00100000,@01001001 defb @01100110,@00000100,@10010000,@01000100 defb @00011000,@00000101,@01000001,@01010000 defb @01000000,@00000000,@00000100,@01000100 defb @00010101,@01010101,@01010000,@01000001 .level11 defb 30,108 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000001,@00000000,@00000001 defb @01000001,@10100000,@00000010,@10000101 defb @01010000,@00100000,@00010100,@00001001 defb @01100000,@00000110,@01101000,@00010101 defb @01010001,@01000000,@00010100,@00000001 defb @01100000,@10010010,@00000000,@00001001 defb @01011001,@01010000,@00000100,@00000101 defb @00010100,@01010101,@01010101,@01010100 .level12 defb 17,92 defb @01010000,@00000001,@01000001,@01010100 defb @01000101,@01010110,@00010101,@00100101 defb @01000000,@00101000,@00000000,@10000001 defb @01000101,@00000101,@10000001,@10010001 defb @01000100,@10000101,@01100001,@01000001 defb @01000101,@00000101,@00000001,@00010001 defb @01000000,@00001000,@00000000,@00000001 defb @01000000,@00000000,@00100000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level13 defb 18,113 defb @00010101,@01010101,@01010101,@01010100 defb @01000001,@00000000,@00000000,@10000101 defb @01000100,@00000110,@00000010,@01010001 defb @01000000,@00000000,@10000000,@00010001 defb @01001000,@00000000,@00000000,@00011001 defb @01000100,@00000000,@00100000,@00000001 defb @01010000,@00000000,@10001000,@00011001 defb @01000000,@01000000,@00100001,@00010001 defb @00010101,@01010101,@01010101,@01010100 .level14 defb 36,50 defb @01010101,@01010101,@01010101,@01010101 defb @01100110,@00000000,@00000000,@10011001 defb @01001001,@00000000,@00000001,@01000001 defb @01000000,@00000000,@00000010,@00000001 defb @01000000,@00000000,@00100100,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01001001,@00000000,@00000000,@01000001 defb @01100110,@00000000,@00000000,@10011001 defb @01010101,@01010101,@01010101,@01010101 .level15 defb 51,76 defb @00010101,@01010100,@01010101,@01010100 defb @01000000,@00001001,@00000000,@00100001 defb @01000100,@10000100,@00010000,@00100001 defb @01000000,@01000000,@01101000,@01100001 defb @00010001,@00000001,@00100000,@00010001 defb @01100000,@00000000,@00010000,@01100001 defb @00010000,@00000000,@10000000,@00000100 defb @01100000,@00000000,@00000000,@00001001 defb @00010101,@01010101,@01010101,@01010100 .level16 defb 35,19 defb @01010101,@01010101,@01010101,@01010101 defb @01010000,@01100010,@00000000,@00001001 defb @01100000,@10011000,@00000000,@00000101 defb @01010001,@01010000,@00001000,@00000101 defb @01010000,@00000010,@01100100,@00000001 defb @01101000,@00000000,@00001001,@10000001 defb @01010010,@00000000,@01010101,@10000001 defb @01011001,@00000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level17 defb 29,124 defb @01010101,@01010101,@01010101,@01010101 defb @01001001,@00000000,@00000000,@01000001 defb @01000100,@00100110,@10011000,@00010001 defb @01000000,@00011001,@01100100,@10000001 defb @01001001,@00000000,@00000010,@01000001 defb @01000010,@01100000,@00001001,@00000001 defb @01000100,@00010001,@01100100,@00010001 defb @01000000,@00100001,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level18 defb 115,26 defb @01010101,@01010101,@01010101,@01010101 defb @01001000,@00000010,@00000001,@00000001 defb @01000001,@10011000,@00000110,@00000001 defb @01000000,@01100100,@00000001,@10000001 defb @01000000,@10000001,@00000010,@01100001 defb @01000110,@01000000,@01001001,@00000001 defb @01001001,@10000100,@10000100,@00000001 defb @01100100,@00000100,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level19 defb 126,110 defb @01010101,@01010101,@01010101,@01010101 defb @01100000,@00010100,@00000000,@01011001 defb @01000100,@00010000,@00000000,@01100001 defb @01001001,@00000010,@01010000,@10000001 defb @01000100,@00000001,@10000000,@00000001 defb @01000000,@00010000,@00100100,@00000001 defb @01000101,@00100100,@01011000,@00010001 defb @01001001,@00011000,@00000000,@01010001 defb @01010101,@01010101,@01010101,@01010101 .level20 defb 77,66 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@10011000,@00000000,@00000001 defb @01011000,@00100100,@01011000,@00000101 defb @01000100,@01001000,@00000100,@00010001 defb @01000000,@01000001,@01000001,@00001001 defb @01000100,@00010000,@00100001,@00010001 defb @01010000,@00100101,@00011000,@00100101 defb @01000000,@00000000,@00100110,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level21 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@01000000,@00001000,@00000101 defb @01000000,@01000000,@00000000,@01000101 defb @01000000,@01011000,@00000000,@00100001 defb @01000010,@00000000,@10000000,@10000101 defb @01000000,@00010000,@00000101,@01100001 defb @01000010,@00100000,@00000010,@00101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level22 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01100100,@00011001,@00011000,@00010001 defb @01000000,@00010000,@00000000,@00000001 defb @01100000,@00010000,@01100000,@10000001 defb @01010001,@10000000,@00000010,@00010101 defb @01001000,@01000000,@01010110,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level23 defb 103,105 defb @00010101,@01010101,@01010101,@01010100 defb @01000100,@00011001,@00011000,@00010001 defb @01000000,@00100000,@01000000,@00000001 defb @01010000,@00010000,@00100001,@10000001 defb @01000001,@10000001,@00001010,@00100001 defb @01011000,@01000000,@01010010,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @00010101,@01010101,@01010101,@01010100 defb @00000000,@00000000,@00000000,@00000000 .level24 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000100,@00000000,@00000101 defb @01000101,@10001000,@00000001,@01100101 defb @01000110,@00000000,@00100100,@00010101 defb @01001010,@00001001,@00010100,@00000001 defb @01000110,@00100001,@00000000,@01010001 defb @01000101,@00000000,@01000101,@01101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level25 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01001000,@01011000,@00001000,@00000001 defb @01000000,@01100000,@10000001,@01000001 defb @01001000,@00000001,@01000001,@10000001 defb @01000110,@00000010,@01000000,@00100001 defb @01000101,@10000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 #endasm z88dk-1.8.ds1/examples/ticalc/enigma.c0000644000175000017500000000762007276715703017210 0ustar tygrystygrys/* 3 rotor Enigma simulation * Converted over to Small C by D Morris 11/9/98 * * As you can see Small C doesn't do multidimensional arrays! */ #include #include #include #pragma string name Enigma simulation /* Rotor Wirings */ unsigned char rotor[]="EKMFLGDQVZNTOWYHXUSPAIBRCJAJDKSIRUXBLHWTMCQGZNPYFVOEBDFHJLCPRTXVZNYEIWGAKMUSQOESOVPZJAYQUIRHXLNFTGKDCMWBVZBRGITYUPSDNHLXAWMJQOFECK"; unsigned char ref[]= "YRUHQSLDPXNGOKMIEBFZCWVJAT"; unsigned char notch[]="QEVJZ"; unsigned int flag=0; /*Encryption parameters */ unsigned char orderbak[3] = { 3, 1, 2 }; unsigned char ringsbak[3] = { 'W','X','T' }; unsigned char posbak[3] = { 'A','W','E' }; unsigned char plugbak[] = "AMTE"; void main() { unsigned int i,j,n; unsigned int ch; unsigned char order[]; unsigned char rings[]; unsigned char pos[]; unsigned char plug[]; n=0; /* restore rotors */ order = { 3, 1, 2 }; rings = { 'W','X','T' }; pos = { 'A','W','E' }; plug = "AMTE"; puts("Enter text to be (de)coded\nTo quit enter a ."); while(1>0) { ch=getchar(); ch=toupper(ch); if (ch == '.') return(0); if (!isalpha(ch)) continue; /* Step up first rotor */ pos[0]++; if (pos[0]>'Z') pos[0] -= 26; /* Check if second rotor reached notch last time */ if (flag) { /* Step up second and third rotors */ pos[1]++; if (pos[1]>'Z') pos[1] -= 26; pos[2]++; if (pos[2]>'Z') pos[2] -= 26; flag=0; } /* Step up seconond rotor if first rotor reached notch */ if (pos[0]==notch[order[0]-1]) { pos[1]++; if (pos[1]>'Z') pos[1] -= 26; if (pos[1]==notch[order[1]-1]) flag=1; } /*Swap pairs of letters on plugboard */ for (i=0; plug[i]; i+=2) { if (ch==plug[i]) ch=plug[i+1]; else if (ch==plug[i+1]) ch=plug[i]; } /* Rotors (forward) */ for (i=0; i<3; i++) { ch += pos[i]-'A'; if (ch>'Z') ch -=26; ch -= rings[i]-'A'; if (ch<'A') ch +=26; ch=rotor[((order[i]-1)*26)+ch-'A']; ch += rings[i]-'A'; if (ch>'Z') ch -=26; ch -= pos[i]-'A'; if (ch<'A') ch +=26; } /* Reflecting rotor */ ch=ref[ch-'A']; /*Rotors (Reverse) */ for (i=3; i; i--) { ch += pos[i-1]-'A'; if (ch>'Z') ch -=26; ch -= rings[i-1]-'A'; if (ch<'A') ch +=26; for (j=0; j<26; j++) if (rotor[(26*(order[i-1]-1))+j]==ch) break; ch=j+'A'; ch += rings[i-1]-'A'; if (ch>'Z') ch -=26; ch -= pos[i-1]-'A'; if (ch<'A') ch +=26; } /* Plugboard */ for (i=0; plug[i]; i+=2) { if (ch==plug[i]) ch=plug[i+1]; else if (ch==plug[i+1]) ch=plug[i]; } n++; putchar(ch); if (n%5==0) if (n%20==0) putchar('\n'); else putchar(' '); } } z88dk-1.8.ds1/examples/ticalc/graygfx.c0000644000175000017500000000201507276715703017410 0ustar tygrystygrys #include #include #include #pragma string name GrayTest main() { int x,a; g_clg(G_WHITE); for (x=1;x<95;x++) { a=50-x; g_plot (x,32-(a*a/80),G_BLACK); } g_draw(3,3,93,3,G_DARK); g_draw(3,3,3,61,G_DARK); g_draw(93,3,93,61,G_DARK); g_draw(3,61,93,61,G_DARK); g_draw(2,2,92,2,G_LIGHT); g_draw(2,2,2,60,G_LIGHT); g_draw(92,2,92,60,G_LIGHT); g_draw(2,60,92,60,G_LIGHT); /* Draw a diamond - weak, but it demonstrates relative drawing! */ g_plot(61,25,G_DARK); g_drawr(15,15,G_DARK); g_drawr(15,-15,G_DARK); g_drawr(-15,-15,G_DARK); g_drawr(-15,15,G_DARK); g_circle(30,30,20,1,G_BLACK); g_circle(30,30,28,1,G_BLACK); g_page(1); fill(8,30); fill(70,30); g_page(0); fill(30,5); g_circle(30,30,25,1,G_WHITE); g_circle(30,30,40,1,G_BLACK); g_circle(30,30,41,1,G_DARK); g_circle(30,30,42,1,G_LIGHT); g_circle(30,30,43,1,G_WHITE); //while (1 != 2) {}; } z88dk-1.8.ds1/examples/ticalc/mandel.c0000644000175000017500000000127407276715703017207 0ustar tygrystygrys #include #include #include #pragma string name GrayMandelbrot float a,b,c,d,e,g,h,i,j; int x,y; int xmax,ymax; int k; float l,m,n,o,p; void main() { g_clg(G_WHITE); xmax=70; ymax=63; a=-2.0; b=2.0; c=a; d=b; e=4.0; g=(b-a)/(float)xmax; h=(d-c)/(float)ymax; for(y=ymax; y>0; y--) { j=(float)y*h+c; for(x=xmax; x>0; x--) { i=(float)x*g+a; k=0; l=0.0; m=0.0; n=0.0; o=0.0; l110: k++; if (k<100) //Iterates { p=n-o+i; m=2.0*l*m+j; l=p; n=l*l; o=m*m; //printf ("%f ",e); if ((n+o) main() { int i; for (i=50 ; i>0; i=i-7) { circle(50,44,i,1); if (i < 15 ) i=i-1; } } z88dk-1.8.ds1/examples/ticalc/smile.c0000644000175000017500000000174507302163237017050 0ustar tygrystygrys/* Smiley Smiley * By Henk Poley * * Displays lots of Smileys in a ( = the same) smiley pattern. * * Idea taken from "SmallC4.1 for UsGard"-compiler. * * First ported to Ti8xcc. * Later on ported to the Z88DK. */ #pragma string name Smiley Smiley (picture) #pragma output nostreams #pragma data icon 0x3C,0x42,0xA5,0xA5,0x81,0xA5,0x5A,0x3C; #include #include char smile[] = { 8,8, 0x3C, /* defb @00111100 ; oooo */ 0x42, /* defb @01000010 ; o o */ 0xA5, /* defb @10100101 ;o o o o */ 0xA5, /* defb @10100101 ;o o o o */ 0x81, /* defb @10000001 ;o o */ 0xA5, /* defb @10100101 ;o o o o */ 0x5A, /* defb @01011010 ; o oo o */ 0x3C /* defb @00111100 ; oooo */ }; main() { char x, y, temp; for(y=0 ; y<8 ; y++) { temp = smile[y+2]; for(x=0 ; x<8 ; x++) { if(temp & 1) { putsprite(spr_or, 8 * x, 8 * y, smile); } temp >>= 1; } } getk(); /*pause*/ } z88dk-1.8.ds1/examples/ticalc/spritest.c0000644000175000017500000000511607302163237017610 0ustar tygrystygrys/* Sample for the putsprite command. We draw some garbage on the screen, then we put a masked arrow. It can be moved using arrows; ENTER exits. Improved version; the mask is drawn AFTER the sprite, so we reduce the flicker, and being the mask just "a border", it is put faster. */ #pragma string name Sprite/Mouse test #pragma output nostreams #pragma data icon 0x00,0x60,0x70,0x78,0x7C,0x18,0x0C,0x00; #include #include #if defined __TI82__ || defined __TI83__ || defined __TI8x__ #define SCREENX 96 #define SCREENY 64 #endif #if defined __TI85__ || defined __TI86__ #define SCREENX 128 #define SCREENY 64 #endif char bullet[] = { 11,3, 0xE0, 0xE0, /* defb @11100000, @11100000 */ 0xBF, 0xA0, /* defb @10111111, @10100000 */ 0xE0, 0xE0 /* defb @11100000, @11100000 */ }; char arrow[] = { 8,8, 0x00, /* defb @00000000 */ 0x60, /* defb @01100000 */ 0x70, /* defb @01110000 */ 0x78, /* defb @01111000 */ 0x7C, /* defb @01111100 */ 0x18, /* defb @00011000 */ 0x0C, /* defb @00001100 */ 0x00 /* defb @00000000 */ }; char arrow_mask[] = { 8,8, 0xE0, /* defb @11100000 */ 0x90, /* defb @10010000 */ 0x88, /* defb @10001000 */ 0x84, /* defb @10000100 */ 0x82, /* defb @10000010 */ 0xE6, /* defb @11100110 */ 0x12, /* defb @00010010 */ 0x1E /* defb @00011110 */ }; char arrow_bk[] = { 8,8, 0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0 }; main() { int x,y,z; int flag = 1; int speed = 1; char *ptr; for (x=10; x<39; x+=3) { putsprite(spr_or,2*x ,x,bullet); putsprite(spr_or,2*x-10,x,bullet); putsprite(spr_or,2*x+10,x,bullet); } x=40; y=20; bksave(x,y,arrow_bk); while(flag!=2) { switch(getk()) { case 11: /* arrow up */ y-=speed; flag=1; break; case 10: /* arrow down */ y+=speed; flag=1; break; case 9: /* arrow right */ x+=speed; flag=1; break; case 8: /* arrow left */ x-=speed; flag=1; break; case 13: /* [Enter] */ flag=2; break; default: /* reset speed */ speed=1; break; } if(x<0) x=0; if(y<0) y=0; if(x>(SCREENX-8)) x=(SCREENX-8); if(y>(SCREENY-8)) y=(SCREENY-8); if(flag==1) { if(speed<3) speed++; bkrestore(arrow_bk); bksave(x,y,arrow_bk); putsprite(spr_or,x,y,arrow); putsprite(spr_mask,x,y,arrow_mask); flag = 0; } } } z88dk-1.8.ds1/examples/ticalc/world.c0000644000175000017500000000040707302163237017060 0ustar tygrystygrys/* Hello World */ #include /* Description string for Ti calcs */ #pragma string name Hello World /* Icon for Ti calcs ('waving' hand) */ #pragma data icon 0x18,0x3C,0x3C,0xBC,0x7C,0x7C,0x3C,0x38; main() { printf("Hello World"); } z88dk-1.8.ds1/examples/vz/0000755000175000017500000000000010765202715014766 5ustar tygrystygrysz88dk-1.8.ds1/examples/vz/ADV.VZ0000644000175000017500000003235007130401707015656 0ustar tygrystygrys M/C PROGRAM!9"!9sL[!X'1pSmall C+ VZ pМ֜3N~ĝٝ+H_͞#OsΠ!Ho2RߣO |!æYiyΧ*:cxר(  DOWND NORTN SOUTS EASTE WESTW GET PICK DROPPUT FIRESHOOBOOTSTARMOTOKEY LASEGUN USEDBAR BARSGOLDCOINMIRRBROKGLOVROPEFLOOBOARPLANSTALBLOCICE POOLWATELAKESLEEGREEMAN DOOR OPEN!UNLO!WIND"SMAL#SPAC#SHIP#SECU$FLIN%STON&DRAW'HELP(INVE)I )QUIT*STOP*ABOR*YES +Y +NO ,COMP-KEYB-TYPE.TURN/HAND0KILL1DANC2WALT2REMO3KICK4BREA4HIT 4BANG4BRIB5USE 6WITH6PUSH7THRE83 8TWO 92 9ONE :1 :MEND;FIX ;REPA;FOUR<4 <LOOK=STAN>TREE?CUT @SAW @WEARACROSBJUMPCRAVIDUP EU ECLIMEFUSEFREDEGR GMAINHAUX IFIELJSHIEJ     RY\afknoz&GN                                                                                 &                                 ! z }              ! %$ &')y*y*†ņņȆˆΆццԆ!׆%$چ&'݆='-4-60@56%8Ay3yBD=BD@6C6HCDCCD@M6P U \ ad$ g' **-01l31d36o66t?6{B.(G?JJJOJT2W2]! 36b1$e=Eh4kEp5$u6x ą}=Ʌ Ʌ΅ׅɅ! ޅ78ᅖ78腚79텡79腚7:7:腚;F6= ( (((((((!=E&‡+ŇŇAyˇ3y·Gyч.҇61ՇC.܇E6߇#;7H>7I>78C79C7<H7:P7:H(y=y# $ % Z`flrx!9C!&N!9C ,Z! "d! 2! !&N;!9! 9P#+~!9n&|›3!9n&à[îî!9P+!9P!!9! 9P~!9~ !9~ #!9P#ˌ*dU[!9!9P!9! 9P~!9~ LL!9~ k!9n&2!9P#%*dͅ|ʑ! 2*dͅ+"dÝ*dͅ"dî} ʥ ʫîu3!*ͫ)Pr!"ɫ!q'#Ӎ)^#V*ͫ,$*ɫe!Rr!"ɫ)Pr[!"W*٫HH!٫P+*߫``!߫P+!dr͍!"!""Y,!*C ,ګ*C,ҳ!*C ,͎*#"5*C ,*C,!*#"ó|!yr!"W!w!"U*C;}o!9C ,G3o!9C|9!9C ,9*#"3'*#""Uwя*C;}o!9C ,Ҧ3Ώ!9C|9!9C ,9*#"3Æo!*ͫ)Pn&,!*Y,#n&"ͫ!"W##!"ϫ!"!"W3я*ϫ^#Vkb|*e҇*Y ql!rÇ*|!rÇ!r!"W,ڦ*Y,ҡ*ϫ##^#Vkb,Ɛ*U,Ҡ*ϫ P"S*S#"S+n&w()^#V*Sn&"˫!e!"!"W!9*S#"SԐ*ϫ P"ѫ!"!"W*ѫ^!,T!Ɩ*ѫ#"ѫ+n&)^#V*ѫn&"˫!*WwҌ!9*ѫ#"ѫA!ũr!"W[˫*ͫ,!*˫)^#Vkb*ͫ,ߑIߑ!!Nײ*˫qʹe!*˫)^#V!,!ի*˫)Pee*S#"Sn&!ի*˫)^#V,e!*˫)^#V!,!*˫)^#V!,!!!!Щr!!qð#Ø!!9P)PI!96#6!!9P)Pr,!r[è!9P|!r!"W!*˫)^#V!,u*׫,W!r!"Wr!*˫)6#6!׫P#Ã!.r!"W*׫,ҡ!Cr!"W !*˫)^#V*ͫ,Փ!*˫)6#6!׫P# !*˫)^#V!,!*˫)^#V!,!Zr!"W !mr!"W!*˫)^#V*ͫ,H!r!"Wö!*˫)^#V!,r!*˫)*ͫö!*˫)^#V!,Ҩ!׫P+!*˫)*ͫö!r!"W!*˫)^#V!,!*˫)6#6!׫P+ !*˫)^#V!,!r!"W !r!"W!h*˫)Pr!!"W!"W*˫"ͫ!ի*˫)!ի*˫)!*˫)^#V!*˫)!*˫#)P!*˫#)!r;!ƪr!9}!9CY,!"W3!9CN,!3ö!تr!"W!ުrY,G!r!rY,G!"Wî*ѫ#"ѫn&!ի*˫)!*˫)*ͫ!*˫)!"W[ӫ*˫"ӫ!9!+r*ӫ!!&ͤ[! 9Ƀ$!!7>EL^pJgy/!!!!@!͚!qҖ-#*C;}o!9C ,M3Ö!9C|]3Ö!9C ,r3Ö!9P#+!9C}*#"3'!nqð#Û!!P!9PDM ) !i|!PDM )  Pê8 wO wOwO IG~\G!!e8U ,f! aI}z\8Ë ͌!;}o!9C wf!9P6!9}!9C,!9P|!9P+!2! 2!2c!9C wc!9^#V! ,8! 2!2c!9C2!!9P#+!9C}Ö! 23d*fr!\ҫÚ#Å)իÔ!"ӫq!qΙ#ù)!!9P)Pș!"ͫ!ErY,!^r!urd*ի|-͵~*۫EE!۫P+[*ͫ,X͵~!r*ݫxx!ݫP+!"W*Wõ!"ϫњ*ϫ "ϫњךњ!r*ϫ "ϫњà=~*W,8À!WELCOME TO ADVENTURE 'A' THE PLANET OF DEATH IN THIS ADVENTURE YOU FIND YOURSELF STRANDED ON AN ALIEN PLANET. YOUR AIM IS TO ESCAPE FROM THIS PLANET BY FINDING YOUR, NOW CAPTURED AND DISABLED, SPACE SHIP YOU WILL MEET VARIOUS HAZARDS AND DANGERS ON YOUR ADVENTURE, SOME NATURAL, SOME NOT, ALL OF WHICH YOU MUST OVERCOME TO SUCCEED GOOD LUCK, YOU WILL NEED IT! PRESS ANY KEY TO START IT SHOWS A MAN CLIMBING DOWN A PIT USING A ROPE HOW? I CANT REACH IT HAS FALLEN TO THE FLOOR HOW? ITS TOO WIDE.I FELL AND BROKE MY NECK UGH! HE IS ALL SLIMY HE VANISHED IN A PUFF OF SMOKE YOU ALSO BROKE THE MIRROR COMPUTER SAYS: 2 WEST,2 SOUTH FOR SPACE FLIGHT IT HAS WEAKENED IT IT HAD NO EFFECT I FELL AND KNOCKED MYSELF OUT. THE BARS LOOK LOOSE WHAT WITH? I SEE A GOLD COIN BRRR.THE WATERS TOO COLD THE FUSE HAS JUST BLOWN THE LIFT HAS BEEN ACTIVATED I SEE NOTHING SPECIAL KEEP OFF THE MIDDLE MEN,ONE MAY BE SHOCKING! VANITY WALTZ! TRY HELP POINTS OF COMPASS TRY LOOKING AROUND I CAN SEE A STEEP SLOPE AN ALARM SOUNDS.THE SECURITY GUARD SHOT ME FOR TRESPASSING. I CAN SEE A ROPE HANGING DOWN THE CHIMNEY. I AM NOT THAT DAFT.IT IS TOO DEEP. THE SPACE SHIP BLEW UP AND KILLED ME. THE SHIP HAS FLOWN INTO THE LARGE LIFT AND IS HOVERING THERE. THERE ARE FOUR BUTTONS OUTSIDE THE WINDOW MARKED 1,2,3 AND 4 THE LIFT HAS TAKEN ME UP TO A PLATEAU. CONGRATULATIONS, YOU HAVE MANAGED TO COMPLETE THIS ADVENTURE WITHOUT GETTING KILLED. THE LIFT HAS BECOME ELECTRIFIED I HAVE BEEN ELECTROCUTED IT IS A GOOD JOB I WAS WEARING RUBBER SOLED BOOTS. I WOULD KILL MYSELF IF I DID. I HAVE TURNED GREEN AND DROPPED DEAD. THE GREEN MAN AWOKE AND THROTTLED ME. THE GUARD WOKE AND SHOT ME. WHAT AT? I AM ON A MOUNTAIN PLATEAU TO THE NORTH THERE IS A STEEP CLIFF OBVIOUS EXITS ARE DOWN,EAST AND WEST I AM AT THE EDGE OF A DEEP PIT OBVIOUS EXITS ARE EAST I AM IN A DAMP LIMESTONE CAVE WITH STALACTITES HANGING DOWN. THE EXIT IS TO THE WEST THERE IS A PASSAGE TO THE NORTH I AM IN A DENSE FOREST THERE IS A ROPE HANGING FROM ONE TREE OBVIOUS EXITS ARE SOUTH AND WEST I AM BESIDE A LAKE EXITS ARE EAST AND NORTH.THERE IS A RAVINE TO THE WEST I AM IN A STRANGE HOUSE THE DOOR IS TO THE NORTH I AM IN AN OLD SHED THE EXIT IS TO THE EAST I AM IN A MAZE.THERE ARE PASSAGES EVERYWHERE I AM IN AN ICE CAVERN THERE IS AN EXIT TO THE EAST I AM IN A QUIET CAVERN THERE ARE EXITS WEST,EAST AND SOUTH I AM IN A WIND TUNNEL THERE IS A CLOSED DOOR AT THE END THERE IS ALSO AN EXIT TO THE WEST I AM IN A ROOM WITH A COMPUTER IN THE COMPUTER IS WORKING AND HAS A KEYBOARD THE EXIT IS WEST I AM IN A PASSAGE THERE IS A FORCE FIELD TO THE SOUTH : BEWARE OF SECURITY THERE ARE EXITS TO NORTH,EAST AND WEST I AM IN A LARGE HANGER THERE IS A LOCKED DOOR TO THE WEST THERE ARE ALSO EXITS EAST,NORTH AND SOUTH I AM IN A TALL LIFT.THE BUTTONS ARE VERY HIGH THE EXIT IS WEST I AM IN THE LIFT CONTROL ROOM THERE ARE THREE SWITCHES ON THE WALL.THEY ARE ALL OFF A SIGN SAYS : 5,4 NO DUSTY BIN RULES THE EXIT IS EAST I AM IN A PRISON CELL I AM IN A SPACE SHIP.THERE IS NO VISIBLE EXIT THERE IS A SMALL OPEN WINDOW IN THE SIDE THERE ARE ALSO TWO BUTTONS,ONE MARKED MAIN AND THE OTHER AUX. A PAIR OF BOOTSA STARTER MOTORA KEYA LASER GUNAN OUT OF ORDER SIGNA METAL BARA GOLD COINA MIRRORBROKEN GLASSA PAIR OF SLIMY GLOVESA ROPEA FLOOR BOARDA BROKEN FLOOR BOARDSTALACTITESA BLOCK OF ICEA POOL OF WATERA SMALL GREEN MAN SLEEPING ON THE MIRRORA SLEEPING GREEN MANA LOCKED DOORAN OPEN DOORA BARRED WINDOWA HOLE IN THE WALLA SMALL BUT POWERFULL SPACE SHIPA SLEEPING SECURITY MANA PIECE OF SHARP FLINTSOME STONESA DRAWING ON THE WALLA LOUDSPEAKER WITH DANCE MUSIC COMING OUTI CAN ALSO SEE : TELL ME WHAT TO DO I DONT UNDERSTAND I CANT GO IN THAT DIRECTION I CANT DO THAT YET I CANT Executed! I HAVE WITH ME THE FOLLOWING: WHICH I AM WEARINGNOTHING AT ALL I CANT. MY HANDS ARE FULL I AM NOT WEARING IT I CANT CARRY ANY MORE I ALREADY HAVE IT I DON'T SEE IT HERE I DONT HAVE IT I AM ALREADY WEARING IT DO YOU WISH TO TRY AGAIN? ANSWER YES OR NO OK.. DO YOU WANT TO SAVE THE GAME? SAVE NOT SUPPORTED DO YOU WISH TO CONTINUE? YOU HAVE A SCORE OF WANT TO RESTORE A GAME? RESTORE NOT SUPPORTED PRESS A KEYEVERYTHING IS DARK.I CANT SEE. ERROR !"!Jҗx _##~ʔͭ|ʔ͙oկwwww!~Oy0nf|!uut!~7+~## +z {!:N(Gh&)[L~#fo!}2. .(o&!~~(nfq#uti&8͗nfͿ!9äzKxT~#h} T22C ( y2 :<!+2 'ͬz§CKKC z vC~#[   2z CC~#=(? 2z CC~#0:`iHB00zvCvC"(\2z 5C.C;ª`iHB0z CC~#!(!`iHB0z C.Cz ClC~#;»~#0:0 O Oz CvC;`i 7?BE ! >wm ! >w! ~#ܱ֯C $! ::+G2ܱ:+=2ܱD ! :2ܱA ! :.2ܱB ! :w#w ! #>w! ~!,:, 2#~=!+~=2ܱJS ! >w! ~ 3::> -<2!+۰22< -=222ܱ=b=/ܱܱT22ܱK° ! >w! ~ :> -<2!+m2 :> -=22ܱܱ:bܱnɱܱ! ~ܱxܱL ! F:M ! ~J 2 >@2( 2 >@2 2 >@2 2P4 a8 ?!ᱶ!p:(G :_w!p6 T]!p = 6 T]ɯ2:<2!,:,=2Ó! pp!q6 T]-:+W:<2yN#F#x( ~#~# `i||G(ogz怨Oz(_W|>DM!R0?= PYy"xȗ_W47?+{_z!8ɳ7~og4?+~#fo4+47?+|(!#74+47?+}|{ozg}o|g0123456789ABCDEF! 9~ҽ!9^#V! ,8!-!9PN!9! 9PB!9^#V!9Pײ|!9^#V!9Pͤ!! 9^#V! 9Pײn&!9PNG#|/g}/o*J|t "J!9NF^Vnfx(  # !!++!9N#Fy#^#V#~#fowĴ# x­!9^#V6# xĴûz88dk-1.8.ds1/examples/vz/dstar.c0000644000175000017500000002322707130401707016247 0ustar tygrystygrys/* * dstar.c * * dstarz88 is a conversion of a TI86 game I found with * source on www.ticalc.org. * * The original program was written by Andrew Von Dollen who * in turn based it on a HP game by Joe W. * * The aim of the game is to collect all the clear bubbles by * running over them. You control either the dark bubble or * the solid box. The dark bubble is used to collect the clear * bubbles, and the solid box is used as a sort of movable wall. * * Both objects carry on moving until they hit something else * (except for the dark bubble in the case of clear bubbles). * * The keys are defined in #define statements, and default thus: * * Up: Q * Down: A * Left: O * Right: P * Quit: G * Retry: H * Switch: [SPACE] * * Switch changes between the dark bubble and the solid box. * * This is the first game ever produced with the Small C compiler - * it was written as a statement saying that it is possible to * write something easily, quickly and efficiently using the * compiler. Hopefully it will be an encouragement for others to * do likewise! * * For your interest I've also included the original Z88 converted * assembler from which I worked - it's quite crude but it just * about functions, the C is much more refined! * * Enough twaddle, enjoy the game and study the source! * * d. 1/12/98 * * * Rejigged for the Spectrum 17/5/99 djm * * Ported to VZ200 2/5/99 - Stefano Bodrato * * Compile it, then run rbinary create a VZ loadable file; * start the emulator then poke 30862,0 / 30863,128 * * Type in a small basic program to enter in graphics mode: * 10 mode(1) * 20 X=usr(0) * * At last, RUN and play ! */ /* Skip closeall() gunk */ #pragma output nostreams /* Call up the required header files */ #include #include #include /* dstar.h contains the levels and "sprite" data */ #include "dstar.h" #define NO 0 #define MAXLEVEL 25 #define STARTLEV 0 /* Start level -1 */ /* Block numbers.. */ #define WALL 1 #define BUBB 2 #define BALL 3 #define BOX 4 /* Key definitions, change these to define your keys! */ #define K_UP 'Q' #define K_DOWN 'A' #define K_LEFT 'O' #define K_RIGHT 'P' #define K_SWITCH 32 #define K_EXIT 'G' #define K_CLEAR 'H' /* Declare some variables to start off with! */ char balloffset; /* Ball position */ char boxoffset; /* Box position */ char ballorbox; /* 1 if box, 0 if ball */ char level; /* Take a guess! */ char board[144]; /* Level internal map thing */ char tiscr[1024]; /* Our very own TI86 screen! */ /* prototype to stop barfing */ void redrawscreen(void); main() { redrawscreen(); /* Define the windows */ playgame(); /* Play the game */ myexit(); /* Clean up after ourselves */ } myexit() { exit(0); /* Get outta here! */ } playgame() { setupgame(); /* Set level to 1, get level etc */ /* Loop while checkfinish() says we haven't finished! */ while ( checkfinish() ) { gamekeys(); /* Scan keys */ } } /* Set some variables up at the start.. */ setupgame() { ballorbox=NO; level=STARTLEV; setuplevel(); } gamekeys() { char *charptr; /* Set up a pointer to the variable we want to change (either for * box or for ball */ if (ballorbox) charptr=&boxoffset; else charptr=&balloffset; switch( toupper(getk()) ) { /* Use OZ to get the key */ case K_DOWN: down(charptr); break; case K_UP: up(charptr); break; case K_RIGHT: right(charptr); break; case K_LEFT: left(charptr); break; case K_SWITCH: ballorbox^=1; /* Toggle ball/box */ break; case K_EXIT: myexit(); case K_CLEAR: setuplevel(); } } /* Movement functions - all of these are pretty well similar so I * will only comment the first one - it's fairly obvious what is * happening though */ left(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn-1)) ) return; *(locn-1)=*locn; *locn=0; (*ptr)--; /* ptr is the location of blob */ drawboard(); /* Draw screen */ } } right(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn+1)) ) return; *(locn+1)=*locn; *locn=0; (*ptr)++; drawboard(); } } down(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn+16)) ) return; *(locn+16)=*locn; *locn=0; (*ptr)+=16; drawboard(); } } up(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if ( standardmiddle(*(locn-16)) ) return; *(locn-16)=*locn; *locn=0; (*ptr)-=16; drawboard(); } } /* Check to see if we're running into anything, if box is set then * if we hit anything we want to stop, if we're ball then if we * hit anything except for bubble we wanna stop */ standardmiddle(char nextpos) { if (ballorbox) return (nextpos); /* For box */ else if (nextpos==BUBB || nextpos==NO) return(0); return(1); } /* Check to see if a level is finished * There are 144 squares in each level, note the use of != instead of * >6)&3; *ptr2++=((*ptr)>>4)&3; *ptr2++=((*ptr)>>2)&3; *ptr2++=(*ptr)&3; ptr++; } } /* Now, plot the ball and box into the internal map */ ptr2=board; *(ptr2+balloffset)=BALL; *(ptr2+boxoffset)=BOX; drawboard(); } /* Define the text window and the graphics window * If can't open graphics window then exit gracefully */ void redrawscreen(void) { /* Nothing here. Text and Graphics cannot be mixed on the VZ */ } /* Draw the board, mostly written in C, even though we did take a bit * of a performance hit when it was converted over from asm */ drawboard() { int x,y; char *ptr; ptr=board; for (y=0;y!=9;y++) { for (x=0;x!=16;x++) { puttiblock((*ptr++),x,y); } } dovzcopyasm(); } /* Dump a sprite onto the TI screen we've built * The TI screen is 16 characters wide by 8 deep i.e. half the size * of the Z88's map screen. It's stored line by line (sensible!) * * We enter with y being y/7 and x being x/8 (if we think in pixels) * So for each y we have to step down by 112. * The increment between rows is 16. */ puttiblock(char spr,int x, int y) { char *ptr2,*ptr; int i; /* We use this method instead of y*=112 because the compiler has special * cases for multiplying by ints less than 16 (except for 11 and 13 * (Hmmm, I wonder why?!?!) */ y=(y*14)*8; /* So, get where we want to dump our sprite into ptr */ ptr=tiscr+y+x; /* Calculate where the sprite is */ spr*=8; ptr2=sprites+spr; /* And dump it in there */ for (i=0; i!=7;i++) { *ptr=*(ptr2++); ptr+=16; } } /* Ooops, forgive me this one bit of assembler in the entire program! * This just copies the TI screen onto the OZ map. * * It really is easier to keep this routine in here, change it into * C if you like.. */ dovzcopyasm() { #asm ld de,28672 ld hl,_tiscr ld bc,1024 .cploop ld a,(hl) push bc ld b,4 .nibble1 rla push af rl c pop af rl c djnz nibble1 push bc push af ld a,c ld (de),a pop af pop bc inc de ld b,4 .nibble2 rla push af rl c pop af rl c djnz nibble2 push bc ld a,c ld (de),a pop bc inc de inc hl pop bc dec bc ld a,b or c jr nz,cploop /* Every function always has a ret at the end! So don't need one of * our own!! */ #endasm } /* THE END! */ z88dk-1.8.ds1/examples/vz/dstar.h0000644000175000017500000003076407130401707016260 0ustar tygrystygrys/* * Sprite and level data for DStar * Stored in #asm statements * * Even though the sprites are only 7 bytes long, we align them at 8 * bytes, so calculations go that little bit quicker! */ extern char levels[]; extern char sprites[]; #asm .smc_sprites ;1=edge, 2=clear ball 3=moveable ball 4=moveable block defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 0 defb @01111110 defb @10101001 defb @11000111 defb @10110001 defb @11001011 defb @10100101 defb @01111110 defb 0 defb @00000000 defb @00011000 defb @00100100 defb @00100100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 defb @00011000 defb @00110100 defb @00111100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 defb @00111100 defb @00111100 defb @00111100 defb @00111100 defb @00000000 defb @00000000 defb 0 #endasm #asm .smc_levels defb 17,30 ;ball offset, box offset defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@00000000,@00000000,@10010001 defb @01000000,@00000000,@00000010,@00010101 defb @01000000,@00000000,@01011000,@00000001 defb @01000000,@01010010,@00000000,@00000101 defb @01010010,@00001000,@00000000,@10000001 defb @01001000,@00000000,@00100101,@00100001 defb @01000000,@00000101,@10000000,@00001001 defb @01010101,@01010101,@01010101,@01010101 .level2 defb 30,86 defb @00010000,@01000100,@01000000,@01000101 defb @01000000,@10000000,@00000000,@00000001 defb @00000001,@10000001,@10000000,@10000000 defb @01000100,@10000000,@00001000,@00010001 defb @00000000,@00000100,@00001000,@00000100 defb @01000000,@00010001,@00001000,@00000001 defb @00000001,@00000100,@01000000,@01101001 defb @01000000,@00000000,@00000000,@00000100 defb @00010000,@01000000,@00000000,@00010000 .level3 defb 30,46 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@10010001 defb @01000000,@01010000,@00000000,@01010001 defb @01000000,@01100000,@00000010,@00000001 defb @01001000,@00000000,@10010100,@00001001 defb @01000110,@00001000,@00100100,@00100101 defb @01000101,@10000110,@00001000,@10010101 defb @01100000,@00000101,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level4 defb 125,30 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01000000,@00000100,@00000000,@00000001 defb @01011001,@10001001,@10011001,@10011001 defb @01000100,@01100010,@01000100,@01000101 defb @01011001,@10011000,@10011001,@10011001 defb @01000000,@00000100,@00000000,@00000001 defb @01000000,@01000000,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level5 defb 17,110 defb @00010101,@01010101,@01010101,@01010100 defb @01000000,@01000000,@01000001,@00000001 defb @01000001,@10000100,@10000010,@00010001 defb @01010000,@00000000,@01000001,@00000001 defb @01100001,@10010000,@00000000,@00000101 defb @01010000,@00000001,@00100001,@00000001 defb @01100100,@00010001,@00010000,@00010001 defb @01000000,@01000000,@00100100,@00011001 defb @00010101,@01010101,@01010101,@01010100 .level6 defb 65,113 defb @00000000,@01010101,@01010101,@01010101 defb @00000001,@00000010,@00000001,@10001001 defb @00000100,@00000010,@00000000,@01000101 defb @00010000,@00000010,@00000000,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01010000,@00000010,@00000100,@00000101 defb @01000000,@00000010,@00000000,@01000001 defb @01000001,@00000010,@00000101,@10000001 defb @01010101,@01010101,@01010101,@01010101 .level7 defb 115,122 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00000001 defb @00010100,@01010100,@00011000,@01011001 defb @00011000,@00011000,@01000100,@01000100 defb @00000100,@00010000,@01010100,@01010000 defb @00010100,@00010000,@01100100,@01100100 defb @01000000,@00000000,@00000000,@00000001 defb @01000000,@01100000,@00000000,@00011001 defb @01010101,@01010101,@01010101,@01010101 .level8 defb 108,98 defb @01010101,@01010101,@01010101,@01010100 defb @01000010,@01010000,@00000000,@00000101 defb @01000001,@10000001,@01001000,@00000001 defb @01000010,@01010001,@00011000,@00000001 defb @01010000,@00000001,@01000001,@10010001 defb @01010001,@00000000,@00000010,@01100001 defb @01100010,@01000000,@10000001,@00010001 defb @01010000,@00000000,@00000000,@00000001 defb @00010101,@01010101,@01010101,@01010101 .level9 defb 30,72 defb @00000100,@01010101,@01010101,@01010100 defb @00011001,@10000000,@00000001,@00000001 defb @01100010,@01000000,@00100000,@00000100 defb @00010001,@00001001,@01000010,@01000001 defb @01000001,@10000110,@00100000,@00001001 defb @01000000,@00001001,@01000000,@00000100 defb @01100110,@00000000,@00000000,@00010000 defb @01000000,@00000000,@00000000,@01000000 defb @01010101,@01010101,@01010101,@00000000 .level10 defb 93,36 defb @00000000,@01010101,@01010101,@01010100 defb @01010101,@00100000,@00000000,@00000001 defb @01000000,@00000101,@01100010,@01001001 defb @01001000,@00000110,@00011000,@00000100 defb @01000000,@00000100,@00100000,@01001001 defb @01100110,@00000100,@10010000,@01000100 defb @00011000,@00000101,@01000001,@01010000 defb @01000000,@00000000,@00000100,@01000100 defb @00010101,@01010101,@01010000,@01000001 .level11 defb 30,108 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000001,@00000000,@00000001 defb @01000001,@10100000,@00000010,@10000101 defb @01010000,@00100000,@00010100,@00001001 defb @01100000,@00000110,@01101000,@00010101 defb @01010001,@01000000,@00010100,@00000001 defb @01100000,@10010010,@00000000,@00001001 defb @01011001,@01010000,@00000100,@00000101 defb @00010100,@01010101,@01010101,@01010100 .level12 defb 17,92 defb @01010000,@00000001,@01000001,@01010100 defb @01000101,@01010110,@00010101,@00100101 defb @01000000,@00101000,@00000000,@10000001 defb @01000101,@00000101,@10000001,@10010001 defb @01000100,@10000101,@01100001,@01000001 defb @01000101,@00000101,@00000001,@00010001 defb @01000000,@00001000,@00000000,@00000001 defb @01000000,@00000000,@00100000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level13 defb 18,113 defb @00010101,@01010101,@01010101,@01010100 defb @01000001,@00000000,@00000000,@10000101 defb @01000100,@00000110,@00000010,@01010001 defb @01000000,@00000000,@10000000,@00010001 defb @01001000,@00000000,@00000000,@00011001 defb @01000100,@00000000,@00100000,@00000001 defb @01010000,@00000000,@10001000,@00011001 defb @01000000,@01000000,@00100001,@00010001 defb @00010101,@01010101,@01010101,@01010100 .level14 defb 36,50 defb @01010101,@01010101,@01010101,@01010101 defb @01100110,@00000000,@00000000,@10011001 defb @01001001,@00000000,@00000001,@01000001 defb @01000000,@00000000,@00000010,@00000001 defb @01000000,@00000000,@00100100,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01001001,@00000000,@00000000,@01000001 defb @01100110,@00000000,@00000000,@10011001 defb @01010101,@01010101,@01010101,@01010101 .level15 defb 51,76 defb @00010101,@01010100,@01010101,@01010100 defb @01000000,@00001001,@00000000,@00100001 defb @01000100,@10000100,@00010000,@00100001 defb @01000000,@01000000,@01101000,@01100001 defb @00010001,@00000001,@00100000,@00010001 defb @01100000,@00000000,@00010000,@01100001 defb @00010000,@00000000,@10000000,@00000100 defb @01100000,@00000000,@00000000,@00001001 defb @00010101,@01010101,@01010101,@01010100 .level16 defb 35,19 defb @01010101,@01010101,@01010101,@01010101 defb @01010000,@01100010,@00000000,@00001001 defb @01100000,@10011000,@00000000,@00000101 defb @01010001,@01010000,@00001000,@00000101 defb @01010000,@00000010,@01100100,@00000001 defb @01101000,@00000000,@00001001,@10000001 defb @01010010,@00000000,@01010101,@10000001 defb @01011001,@00000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level17 defb 29,124 defb @01010101,@01010101,@01010101,@01010101 defb @01001001,@00000000,@00000000,@01000001 defb @01000100,@00100110,@10011000,@00010001 defb @01000000,@00011001,@01100100,@10000001 defb @01001001,@00000000,@00000010,@01000001 defb @01000010,@01100000,@00001001,@00000001 defb @01000100,@00010001,@01100100,@00010001 defb @01000000,@00100001,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level18 defb 115,26 defb @01010101,@01010101,@01010101,@01010101 defb @01001000,@00000010,@00000001,@00000001 defb @01000001,@10011000,@00000110,@00000001 defb @01000000,@01100100,@00000001,@10000001 defb @01000000,@10000001,@00000010,@01100001 defb @01000110,@01000000,@01001001,@00000001 defb @01001001,@10000100,@10000100,@00000001 defb @01100100,@00000100,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level19 defb 126,110 defb @01010101,@01010101,@01010101,@01010101 defb @01100000,@00010100,@00000000,@01011001 defb @01000100,@00010000,@00000000,@01100001 defb @01001001,@00000010,@01010000,@10000001 defb @01000100,@00000001,@10000000,@00000001 defb @01000000,@00010000,@00100100,@00000001 defb @01000101,@00100100,@01011000,@00010001 defb @01001001,@00011000,@00000000,@01010001 defb @01010101,@01010101,@01010101,@01010101 .level20 defb 77,66 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@10011000,@00000000,@00000001 defb @01011000,@00100100,@01011000,@00000101 defb @01000100,@01001000,@00000100,@00010001 defb @01000000,@01000001,@01000001,@00001001 defb @01000100,@00010000,@00100001,@00010001 defb @01010000,@00100101,@00011000,@00100101 defb @01000000,@00000000,@00100110,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level21 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@01000000,@00001000,@00000101 defb @01000000,@01000000,@00000000,@01000101 defb @01000000,@01011000,@00000000,@00100001 defb @01000010,@00000000,@10000000,@10000101 defb @01000000,@00010000,@00000101,@01100001 defb @01000010,@00100000,@00000010,@00101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level22 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01100100,@00011001,@00011000,@00010001 defb @01000000,@00010000,@00000000,@00000001 defb @01100000,@00010000,@01100000,@10000001 defb @01010001,@10000000,@00000010,@00010101 defb @01001000,@01000000,@01010110,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level23 defb 103,105 defb @00010101,@01010101,@01010101,@01010100 defb @01000100,@00011001,@00011000,@00010001 defb @01000000,@00100000,@01000000,@00000001 defb @01010000,@00010000,@00100001,@10000001 defb @01000001,@10000001,@00001010,@00100001 defb @01011000,@01000000,@01010010,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @00010101,@01010101,@01010101,@01010100 defb @00000000,@00000000,@00000000,@00000000 .level24 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000100,@00000000,@00000101 defb @01000101,@10001000,@00000001,@01100101 defb @01000110,@00000000,@00100100,@00010101 defb @01001010,@00001001,@00010100,@00000001 defb @01000110,@00100001,@00000000,@01010001 defb @01000101,@00000000,@01000101,@01101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level25 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01001000,@01011000,@00001000,@00000001 defb @01000000,@01100000,@10000001,@01000001 defb @01001000,@00000001,@01000001,@10000001 defb @01000110,@00000010,@01000000,@00100001 defb @01000101,@10000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 #endasm z88dk-1.8.ds1/examples/vz/DSTAR.VZ0000644000175000017500000000726407130401707016127 0ustar tygrystygrys M/C PROGRAM!9"!9sI?!X'1pSmall C+ VZ~DZ˥~$$4<<<<<UUUUE@@X@RRH%!@ UUUUVD@E@D@@i@@.UUUU@@PQ@`H F$%E`UUUU}UUUU@@YDbDEY@@@AUUUUnUUT@@AAPAaP!d@@$UUTAqUUUE@P@AAUUUUszUUUU@TYDDTPdd@@`UUUUlbUUUTBPAHBQPAQab@PUUUHUUTb@  BAA @ @f@@UUU]$UUTU @bIH@ IfDAP@DUPAlUUUU@AP  `hQ@` YPUUT\PATEV%@(EDaAE@@ UUUUqUUTADQ@HD P@@!UUT$2UUUUfIA@@$@IAfUUUU3LTUT@ !D!@@ha `a` UUT#UUUUPb `QPPdh RUYUUUU|UUUUIAD&@dIAB` Dd@!UUUUsUUUUHA@d@aF@IIdAUUUU~nUUUU`YDaIPD@$E$XIQUUUUMBUUUU@X$XDH@AA D!P%%@&UUUUgiUUUUE@@@E@X!B@aB )UUUUgiUUUUd@``QH@V@@UUUUgiUUTD@ @P!A !X@R@@UUTgiUUUU@EeF$J F!QEEiUUUUgiUUUU@HX@`AHAF@!EUUUUNH!`~|_nQɯ2s!}2܆!sY|ʂ!Ç!)͊ׄ͗J!sY̓}2sH܆}AʒQʜPʦOʰ ʺG΄Hф!9_Y!t+YA| +Y}6!9_Y+}#!9_Y!t#YA|m#Y}6!9_Y#}+K!9_Y!t YA|ʽ Y}6!9_Y }Ø!9_Y!t YA| Y}6!9_Y }!sY|T!9Y!9YBv!9YBz!!!t!uҸÜ#+Æ#+YBҵ!Õ!Y#}2Bӆ!܆!!9!t!!Y&d#+Y}2#+Y}2!9}!9^#V! uD!9_#}+ !9}!9^#V!us!9_#}+O#+!9_Y.70}#+!9_Y.70}#+!9_Y.70}#+!9_Y0}#+b3!t!Y6!Y6n&!9!t! uҗD#++!9}!9^#V!uҔs!9_#}+O#+Y!9^#V!9_͞b;>!9! 9_)DM ) )))}!9_! 9_! 9Y)))}!9!a!9Y}!u:#+!9_#}+Y} p!~yy# x :K(Gh&)[I~#fo}.o&}o|g|J7?+{_z!8ɳ7~og~#fo|M!)0J7?+}|}o|g!9~o&a{oz88dk-1.8.ds1/examples/z88/0000755000175000017500000000000010765202715014760 5ustar tygrystygrysz88dk-1.8.ds1/examples/z88/ansitest.c0000644000175000017500000000166507130401707016760 0ustar tygrystygrys#include "stdio.h" main() { int x; /* A stupid CSI escape code test (normally no use uses CSI) */ printf ("If you can read this, CSI is not working.\n"); printf ("%c2J",155); printf ("If this the first thing you can read, CSI is OK.\n"); /* Set Graphic Rendition test */ printf ("%c[1mBold Text\n",27); printf ("%c[2mDim text\n",27); printf ("%c[4mUnderlined Text\n",27); printf ("%c[24mUn-underlined text\n",27); printf ("%c[7mReverse Text\n",27); printf ("%c[27mUn-reverse text\n",27); for (x=37; x>29; x--) { printf ("%c[%umFore text color %u.\n",27,x,x); } for (x=40; x<48; x++) { printf ("%c[%umBack text color %u.\n",27,x,x); } /* Restore default text attributes */ printf ("%c[m",27); /* Cursor Position test "Draw" an X */ for (x=0; x<11; x++) { printf ("%c[%u;%uH*\n",27,10+x,25+x); printf ("%c[%u;%uH*\n",27,20-x,25+x); } } z88dk-1.8.ds1/examples/z88/app/0000755000175000017500000000000010765202715015540 5ustar tygrystygrysz88dk-1.8.ds1/examples/z88/app/dstar.c0000644000175000017500000003353707130401707017026 0ustar tygrystygrys/* * dstar.c * * dstarz88 is a conversion of a TI86 game I found with * source on www.ticalc.org. * * The original program was written by Andrew Von Dollen who * in turn based it on a HP game by Joe W. * * The aim of the game is to collect all the clear bubbles by * running over them. You control either the dark bubble or * the solid box. The dark bubble is used to collect the clear * bubbles, and the solid box is used as a sort of movable wall. * * Both objects carry on moving until they hit something else * (except for the dark bubble in the case of clear bubbles). * * The keys are defined in #define statements, and default thus: * * Up: Q * Down: A * Left: O * Right: P * Quit: G * Retry: H * Switch: [SPACE] * * Switch changes between the dark bubble and the solid box. * * This is the first game ever produced with the Small C compiler - * it was written as a statement saying that it is possible to * write something easily, quickly and efficiently using the * compiler. Hopefully it will be an encouragement for others to * do likewise! * * For your interest I've also included the original Z88 converted * assembler from which I worked - it's quite crude but it just * about functions, the C is much more refined! * * Enough twaddle, enjoy the game and study the source! * * d. 1/12/98 * * This is the application version of the program, compile with: * * This example demonstrates the redrawscreen function which allows * you to supply a routine to redraw the screen and take the load * off of OZ. This is a bad app out of necessity really, you can * write good ones! - Have a look at the file doc/apps.html for * more details. */ /* * Compiler options, need expanded z88 (cos we use the map), need 5 * bad pages and we should write the .asm file in app format */ #pragma -expandz88 #pragma -reqpag=5 #pragma -make-app /* Call up the required header files */ #include #include #include /* dstar.h contains the levels and "sprite" data */ #include "dstar.h" #define NO 0 #define MAXLEVEL 25 #define STARTLEV 0 /* Start level -1 */ /* Block numbers.. */ #define WALL 1 #define BUBB 2 #define BALL 3 #define BOX 4 /* Key definitions, change these to define your keys! */ #define K_UP 'Q' #define K_DOWN 'A' #define K_LEFT 'O' #define K_RIGHT 'P' #define K_SWITCH 32 #define K_EXIT 'G' #define K_CLEAR 'H' /* Declare some variables to start off with! */ unsigned char balloffset; /* Ball position */ unsigned char boxoffset; /* Box position */ unsigned char ballorbox; /* 1 if box, 0 if ball */ unsigned char level; /* Take a guess! */ unsigned char gameon; /* Flag for redrawscreen */ unsigned char board[144]; /* Level internal map thing */ unsigned char tiscr[1024]; /* Our very own TI86 screen! */ /* Some character arrays to handle window functions */ unsigned char windtitle[]= { 1,'7','#','3',32+7,32+1,32+34,32+7,131, 1,'2','C','3',1,'4','+','T','U','R',1,'2','J','C', 1,'3','@',32,32, /*reset to (0,0)*/ 'D','S','t','a','r',' ','z','8','8', 1,'3','@',32,32 ,1,'2','A',32+34,0 }; unsigned char baswindres[]= { 1,'7','#','3',32,32,32+94,32+8,128,1,'2','C','3',0 }; unsigned char windclr[]= { 1,'2','C','3', 1,'3','@',32,32,1,'2','+','B',0 }; /* Used for the map, keep it global so we can close it easily! */ struct window graphics; /* prototype to stop barfing */ void redrawscreen(void); main() { gameon=0; redrawscreen(); /* Define the windows */ playgame(); /* Play the game */ myexit(); /* Clean up after ourselves */ } myexit() { closegfx(graphics); /* Close the Map window */ exit(0); /* Get outta here! */ } playgame() { setupgame(); /* Set level to 1, get level etc */ /* Loop while checkfinish() says we haven't finished! */ while ( checkfinish() ) { gamekeys(); /* Scan keys */ } } /* Set some variables up at the start.. */ setupgame() { ballorbox=NO; level=STARTLEV; setuplevel(); } gamekeys() { unsigned char *charptr; /* Set up a pointer to the variable we want to change (either for * box or for ball */ if (ballorbox) charptr=&boxoffset; else charptr=&balloffset; switch( getk() ) { /* Use OZ to get the key */ case K_DOWN: down(charptr); break; case K_UP: up(charptr); break; case K_RIGHT: right(charptr); break; case K_LEFT: left(charptr); break; case K_SWITCH: ballorbox^=1; /* Toggle ball/box */ break; case K_EXIT: myexit(); case K_CLEAR: setuplevel(); } } /* Movement functions - all of these are pretty well similar so I * will only comment the first one - it's fairly obvious what is * happening though */ left(unsigned char *ptr) { unsigned char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn-1)) ) return; *(locn-1)=*locn; *locn=0; (*ptr)--; /* ptr is the location of blob */ drawboard(); /* Draw screen */ } } right(unsigned char *ptr) { unsigned char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn+1)) ) return; *(locn+1)=*locn; *locn=0; (*ptr)++; drawboard(); } } down(unsigned char *ptr) { unsigned char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn+16)) ) return; *(locn+16)=*locn; *locn=0; (*ptr)+=16; drawboard(); } } up(unsigned char *ptr) { unsigned char *locn; while(1) { locn=*(ptr)+board; if ( standardmiddle(*(locn-16)) ) return; *(locn-16)=*locn; *locn=0; (*ptr)-=16; drawboard(); } } /* Check to see if we're running into anything, if box is set then * if we hit anything we want to stop, if we're ball then if we * hit anything except for bubble we wanna stop */ standardmiddle(unsigned char nextpos) { if (ballorbox) return (nextpos); /* For box */ else if (nextpos==BUBB || nextpos==NO) return(0); return(1); } /* Check to see if a level is finished * There are 144 squares in each level, note the use of != instead of * >6)&3; *ptr2++=((*ptr)>>4)&3; *ptr2++=((*ptr)>>2)&3; *ptr2++=(*ptr)&3; ptr++; } } /* Now, plot the ball and box into the internal map */ ptr2=board; *(ptr2+balloffset)=BALL; *(ptr2+boxoffset)=BOX; gameon=1; drawboard(); } /* Define the text window and the graphics window * If can't open graphics window then exit gracefully */ void __APPFUNC__ redrawscreen(void) { struct window text; /* * Clear the whole screen */ puts(baswindres); /* Define and open a text window with title and other embellishments * strings are at top for clearing, position etc */ text->number='3'; text->x=32+7; text->y=32+1; text->width=32+34; text->depth=32+7; text->type=131; text->graph=0; window(text); fputs(windtitle,stdout); text->x=32+8; text->y=32+3; text->width=32+32; text->depth=32+5; text->type=128; window(text); fputs(windclr,stdout); /* Now, try to open a map window.. */ graphics->graph=1; graphics->width=128; graphics->number='4'; if (window(graphics)) { puts("Sorry, Can't Open Map"); sleep(5); exit(0); } /* Sucessfully opened, now dump some info in the text window! */ puts(" DStar Z88 - C Demo"); fputs("Original TI game By A Von Dollen",stdout); puts(" Converted to Z88 By D Morris"); puts(" Keys: Q,A,O,P,SPACE,H,G"); if (gameon) drawboard(); } /* Draw the board, mostly written in C, even though we did take a bit * of a performance hit when it was converted over from asm */ drawboard() { int x,y; unsigned char *ptr; /* We let OZ in here, because we only go back to the loop once our * thing has hit something */ getk(); ptr=board; for (y=0;y!=9;y++) { for (x=0;x!=16;x++) { puttiblock((*ptr++),x,y); } } doozcopyasm(); } /* Dump a sprite onto the TI screen we've built * The TI screen is 16 characters wide by 8 deep i.e. half the size * of the Z88's map screen. It's stored line by line (sensible!) * * We enter with y being y/7 and x being x/8 (if we think in pixels) * So for each y we have to step down by 112. * The increment between rows is 16. */ puttiblock(unsigned char spr,int x, int y) { unsigned char *ptr2,*ptr; int i; /* We use this method instead of y*=112 because the compiler has special * cases for multiplying by ints less than 16 (except for 11 and 13 * (Hmmm, I wonder why?!?!) */ y=(y*14)*8; /* So, get where we want to dump our sprite into ptr */ ptr=tiscr+y+x; /* Calculate where the sprite is */ spr*=8; ptr2=sprites+spr; /* And dump it in there */ for (i=0; i!=7;i++) { *ptr=*(ptr2++); ptr+=16; } } /* Ooops, forgive me this one bit of assembler in the entire program! * This just copies the TI screen onto the OZ map. * * It really is easier to keep this routine in here, change it into * C if you like.. */ doozcopyasm() { #asm LIB swapgfxbk call swapgfxbk call ozscrcpy jp swapgfxbk .ozscrcpy ld de,(base_graphics) ld hl,_tiscr ld c,8 .ozscrcpy1 push hl ld b,16 .ozscrcpy3 push bc push hl ld bc,16 ld a,8 .ozscrcpy2 ex af,af ld a,(hl) ld (de),a inc de add hl,bc ex af,af dec a jr nz,ozscrcpy2 pop hl inc hl pop bc djnz ozscrcpy3 pop hl push bc ld bc,16*8 add hl,bc pop bc dec c jr nz,ozscrcpy1 /* Every function always has a ret at the end! So don't need one of * our own!! */ #endasm } /* * Now, some application info, have a look at doc/apps.html to see * what is going on! */ /* * This function handles menu codes */ void __APPFUNC__ handlecmds(int cmd) { switch(cmd) { case 0x82: myexit(); case 0x81: setuplevel(); break; } } #include #define HELP1 "A demo application made with z88dk - Small C+ Compiler" #define HELP2 "Converted from a TI86 game found with source on" #define HELP3 "www.ticalc.org. Converted to C and Z88 by" #define HELP4 "Dominic Morris " #define HELP5 "" #define HELP6 "v3.0 - 5.4.99 (djm)" #define APP_INFO "Made by z88dk" #define APP_KEY 'D' #define APP_NAME "Dstarz88" #define APP_TYPE AT_Bad #define TOPIC1 "Commands" #define TOPIC1ATTR TP_Help #define TOPIC1HELP1 "The only menu we have!" #define TOPIC1HELP2 "This contains actions that affect the game" #define TOPIC1_1 "Restart" #define TOPIC1_1KEY "CR" #define TOPIC1_1CODE $81 #define TOPIC1_1ATTR MN_Help #define TOPIC1_1HELP1 "Use this to restart the level" #define TOPIC1_1HELP2 "For example when you get terrible stuck!" #define TOPIC1_2 "Quit" #define TOPIC1_2KEY "CQ" #define TOPIC1_2CODE $82 #define TOPIC1_2ATTR MN_Help #define TOPIC1_2HELP1 "Use this to quit the game" #define TOPIc1_2HELP2 "Not that you'll ever get bored of the game!" #include /* THE END! */ z88dk-1.8.ds1/examples/z88/app/dstar.h0000644000175000017500000003076407130401710017024 0ustar tygrystygrys/* * Sprite and level data for DStar * Stored in #asm statements * * Even though the sprites are only 7 bytes long, we align them at 8 * bytes, so calculations go that little bit quicker! */ extern char levels[]; extern char sprites[]; #asm .smc_sprites ;1=edge, 2=clear ball 3=moveable ball 4=moveable block defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 0 defb @01111110 defb @10101001 defb @11000111 defb @10110001 defb @11001011 defb @10100101 defb @01111110 defb 0 defb @00000000 defb @00011000 defb @00100100 defb @00100100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 defb @00011000 defb @00110100 defb @00111100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 defb @00111100 defb @00111100 defb @00111100 defb @00111100 defb @00000000 defb @00000000 defb 0 #endasm #asm .smc_levels defb 17,30 ;ball offset, box offset defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@00000000,@00000000,@10010001 defb @01000000,@00000000,@00000010,@00010101 defb @01000000,@00000000,@01011000,@00000001 defb @01000000,@01010010,@00000000,@00000101 defb @01010010,@00001000,@00000000,@10000001 defb @01001000,@00000000,@00100101,@00100001 defb @01000000,@00000101,@10000000,@00001001 defb @01010101,@01010101,@01010101,@01010101 .level2 defb 30,86 defb @00010000,@01000100,@01000000,@01000101 defb @01000000,@10000000,@00000000,@00000001 defb @00000001,@10000001,@10000000,@10000000 defb @01000100,@10000000,@00001000,@00010001 defb @00000000,@00000100,@00001000,@00000100 defb @01000000,@00010001,@00001000,@00000001 defb @00000001,@00000100,@01000000,@01101001 defb @01000000,@00000000,@00000000,@00000100 defb @00010000,@01000000,@00000000,@00010000 .level3 defb 30,46 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@10010001 defb @01000000,@01010000,@00000000,@01010001 defb @01000000,@01100000,@00000010,@00000001 defb @01001000,@00000000,@10010100,@00001001 defb @01000110,@00001000,@00100100,@00100101 defb @01000101,@10000110,@00001000,@10010101 defb @01100000,@00000101,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level4 defb 125,30 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01000000,@00000100,@00000000,@00000001 defb @01011001,@10001001,@10011001,@10011001 defb @01000100,@01100010,@01000100,@01000101 defb @01011001,@10011000,@10011001,@10011001 defb @01000000,@00000100,@00000000,@00000001 defb @01000000,@01000000,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level5 defb 17,110 defb @00010101,@01010101,@01010101,@01010100 defb @01000000,@01000000,@01000001,@00000001 defb @01000001,@10000100,@10000010,@00010001 defb @01010000,@00000000,@01000001,@00000001 defb @01100001,@10010000,@00000000,@00000101 defb @01010000,@00000001,@00100001,@00000001 defb @01100100,@00010001,@00010000,@00010001 defb @01000000,@01000000,@00100100,@00011001 defb @00010101,@01010101,@01010101,@01010100 .level6 defb 65,113 defb @00000000,@01010101,@01010101,@01010101 defb @00000001,@00000010,@00000001,@10001001 defb @00000100,@00000010,@00000000,@01000101 defb @00010000,@00000010,@00000000,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01010000,@00000010,@00000100,@00000101 defb @01000000,@00000010,@00000000,@01000001 defb @01000001,@00000010,@00000101,@10000001 defb @01010101,@01010101,@01010101,@01010101 .level7 defb 115,122 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00000001 defb @00010100,@01010100,@00011000,@01011001 defb @00011000,@00011000,@01000100,@01000100 defb @00000100,@00010000,@01010100,@01010000 defb @00010100,@00010000,@01100100,@01100100 defb @01000000,@00000000,@00000000,@00000001 defb @01000000,@01100000,@00000000,@00011001 defb @01010101,@01010101,@01010101,@01010101 .level8 defb 108,98 defb @01010101,@01010101,@01010101,@01010100 defb @01000010,@01010000,@00000000,@00000101 defb @01000001,@10000001,@01001000,@00000001 defb @01000010,@01010001,@00011000,@00000001 defb @01010000,@00000001,@01000001,@10010001 defb @01010001,@00000000,@00000010,@01100001 defb @01100010,@01000000,@10000001,@00010001 defb @01010000,@00000000,@00000000,@00000001 defb @00010101,@01010101,@01010101,@01010101 .level9 defb 30,72 defb @00000100,@01010101,@01010101,@01010100 defb @00011001,@10000000,@00000001,@00000001 defb @01100010,@01000000,@00100000,@00000100 defb @00010001,@00001001,@01000010,@01000001 defb @01000001,@10000110,@00100000,@00001001 defb @01000000,@00001001,@01000000,@00000100 defb @01100110,@00000000,@00000000,@00010000 defb @01000000,@00000000,@00000000,@01000000 defb @01010101,@01010101,@01010101,@00000000 .level10 defb 93,36 defb @00000000,@01010101,@01010101,@01010100 defb @01010101,@00100000,@00000000,@00000001 defb @01000000,@00000101,@01100010,@01001001 defb @01001000,@00000110,@00011000,@00000100 defb @01000000,@00000100,@00100000,@01001001 defb @01100110,@00000100,@10010000,@01000100 defb @00011000,@00000101,@01000001,@01010000 defb @01000000,@00000000,@00000100,@01000100 defb @00010101,@01010101,@01010000,@01000001 .level11 defb 30,108 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000001,@00000000,@00000001 defb @01000001,@10100000,@00000010,@10000101 defb @01010000,@00100000,@00010100,@00001001 defb @01100000,@00000110,@01101000,@00010101 defb @01010001,@01000000,@00010100,@00000001 defb @01100000,@10010010,@00000000,@00001001 defb @01011001,@01010000,@00000100,@00000101 defb @00010100,@01010101,@01010101,@01010100 .level12 defb 17,92 defb @01010000,@00000001,@01000001,@01010100 defb @01000101,@01010110,@00010101,@00100101 defb @01000000,@00101000,@00000000,@10000001 defb @01000101,@00000101,@10000001,@10010001 defb @01000100,@10000101,@01100001,@01000001 defb @01000101,@00000101,@00000001,@00010001 defb @01000000,@00001000,@00000000,@00000001 defb @01000000,@00000000,@00100000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level13 defb 18,113 defb @00010101,@01010101,@01010101,@01010100 defb @01000001,@00000000,@00000000,@10000101 defb @01000100,@00000110,@00000010,@01010001 defb @01000000,@00000000,@10000000,@00010001 defb @01001000,@00000000,@00000000,@00011001 defb @01000100,@00000000,@00100000,@00000001 defb @01010000,@00000000,@10001000,@00011001 defb @01000000,@01000000,@00100001,@00010001 defb @00010101,@01010101,@01010101,@01010100 .level14 defb 36,50 defb @01010101,@01010101,@01010101,@01010101 defb @01100110,@00000000,@00000000,@10011001 defb @01001001,@00000000,@00000001,@01000001 defb @01000000,@00000000,@00000010,@00000001 defb @01000000,@00000000,@00100100,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01001001,@00000000,@00000000,@01000001 defb @01100110,@00000000,@00000000,@10011001 defb @01010101,@01010101,@01010101,@01010101 .level15 defb 51,76 defb @00010101,@01010100,@01010101,@01010100 defb @01000000,@00001001,@00000000,@00100001 defb @01000100,@10000100,@00010000,@00100001 defb @01000000,@01000000,@01101000,@01100001 defb @00010001,@00000001,@00100000,@00010001 defb @01100000,@00000000,@00010000,@01100001 defb @00010000,@00000000,@10000000,@00000100 defb @01100000,@00000000,@00000000,@00001001 defb @00010101,@01010101,@01010101,@01010100 .level16 defb 35,19 defb @01010101,@01010101,@01010101,@01010101 defb @01010000,@01100010,@00000000,@00001001 defb @01100000,@10011000,@00000000,@00000101 defb @01010001,@01010000,@00001000,@00000101 defb @01010000,@00000010,@01100100,@00000001 defb @01101000,@00000000,@00001001,@10000001 defb @01010010,@00000000,@01010101,@10000001 defb @01011001,@00000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level17 defb 29,124 defb @01010101,@01010101,@01010101,@01010101 defb @01001001,@00000000,@00000000,@01000001 defb @01000100,@00100110,@10011000,@00010001 defb @01000000,@00011001,@01100100,@10000001 defb @01001001,@00000000,@00000010,@01000001 defb @01000010,@01100000,@00001001,@00000001 defb @01000100,@00010001,@01100100,@00010001 defb @01000000,@00100001,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level18 defb 115,26 defb @01010101,@01010101,@01010101,@01010101 defb @01001000,@00000010,@00000001,@00000001 defb @01000001,@10011000,@00000110,@00000001 defb @01000000,@01100100,@00000001,@10000001 defb @01000000,@10000001,@00000010,@01100001 defb @01000110,@01000000,@01001001,@00000001 defb @01001001,@10000100,@10000100,@00000001 defb @01100100,@00000100,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level19 defb 126,110 defb @01010101,@01010101,@01010101,@01010101 defb @01100000,@00010100,@00000000,@01011001 defb @01000100,@00010000,@00000000,@01100001 defb @01001001,@00000010,@01010000,@10000001 defb @01000100,@00000001,@10000000,@00000001 defb @01000000,@00010000,@00100100,@00000001 defb @01000101,@00100100,@01011000,@00010001 defb @01001001,@00011000,@00000000,@01010001 defb @01010101,@01010101,@01010101,@01010101 .level20 defb 77,66 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@10011000,@00000000,@00000001 defb @01011000,@00100100,@01011000,@00000101 defb @01000100,@01001000,@00000100,@00010001 defb @01000000,@01000001,@01000001,@00001001 defb @01000100,@00010000,@00100001,@00010001 defb @01010000,@00100101,@00011000,@00100101 defb @01000000,@00000000,@00100110,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level21 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@01000000,@00001000,@00000101 defb @01000000,@01000000,@00000000,@01000101 defb @01000000,@01011000,@00000000,@00100001 defb @01000010,@00000000,@10000000,@10000101 defb @01000000,@00010000,@00000101,@01100001 defb @01000010,@00100000,@00000010,@00101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level22 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01100100,@00011001,@00011000,@00010001 defb @01000000,@00010000,@00000000,@00000001 defb @01100000,@00010000,@01100000,@10000001 defb @01010001,@10000000,@00000010,@00010101 defb @01001000,@01000000,@01010110,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level23 defb 103,105 defb @00010101,@01010101,@01010101,@01010100 defb @01000100,@00011001,@00011000,@00010001 defb @01000000,@00100000,@01000000,@00000001 defb @01010000,@00010000,@00100001,@10000001 defb @01000001,@10000001,@00001010,@00100001 defb @01011000,@01000000,@01010010,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @00010101,@01010101,@01010101,@01010100 defb @00000000,@00000000,@00000000,@00000000 .level24 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000100,@00000000,@00000101 defb @01000101,@10001000,@00000001,@01100101 defb @01000110,@00000000,@00100100,@00010101 defb @01001010,@00001001,@00010100,@00000001 defb @01000110,@00100001,@00000000,@01010001 defb @01000101,@00000000,@01000101,@01101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level25 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01001000,@01011000,@00001000,@00000001 defb @01000000,@01100000,@10000001,@01000001 defb @01001000,@00000001,@01000001,@10000001 defb @01000110,@00000010,@01000000,@00100001 defb @01000101,@10000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 #endasm z88dk-1.8.ds1/examples/z88/app/farmall/0000755000175000017500000000000010765202715017156 5ustar tygrystygrysz88dk-1.8.ds1/examples/z88/app/farmall/Makefile0000644000175000017500000000027507555321615020626 0ustar tygrystygrys all: info test info: @echo Building Far Malloc example.. test: zcc -vn -create-app test.c -lfarz88 -o test.bin clean: $(RM) test.bin $(RM) zcc_opt.def *~ *.op* *.o *i *.asm *.63 z88dk-1.8.ds1/examples/z88/app/farmall/README0000644000175000017500000000015307130401710020021 0ustar tygrystygrysThis is a short demo of the far routines in action, so now there's no excuse for not porting a vi clone!!! z88dk-1.8.ds1/examples/z88/app/farmall/test.c0000644000175000017500000000451210035044040020264 0ustar tygrystygrys/* * * Demo of the far malloc() routine * * djm 15/4/2000 */ /* Specify that we want to use far routines (do this before any includes) */ #define FARDATA 1 /* sccz80 magic, make application and far heapsize is 16384 */ #pragma -make-app #pragma -farheap=16384 #include #include #include #include #define SIZE 1024UL static char string1[]="This is string 1..dull as hell"; static char string2[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static char string3[]="The quick brown fox "; static char string4[]="jumped over the lazy dog"; void main() { char buffer[80]; /* Buffer for us to work in */ FILE *fp; far char *ptr; printf("Welcome to far demo v0.02 - 15/4/2000\n"); printf("Requesting %ld bytes of storage...",SIZE); ptr=malloc(SIZE); if (ptr==NULL) { printf("didn't get it quitting\n"); sleep(5); exit(0); } printf("got it at %ld\n",ptr); printf("size appears to be %d\n",*(far int *)(ptr-2)); printf("Copying %s to far\n",string2); strcpy(ptr,string2); printf("Printing from far: "); printfar(ptr); /* Now do a strcat test */ printf("\nCopying to far mem: \"%s\"\n",string3); strcpy(ptr,string3); printf("Concatenating: \"%s\"\n",string4); strcat(ptr,string4); printf("In far mem we have:"); printfar(ptr); strupr(ptr); printf("\nUpper case: "); printfar(ptr); strlwr(ptr); printf("\nLower case: "); printfar(ptr); #ifdef FILETEST /* Test the conversion routine now */ /* Change this to something you've got! */ strcpy(ptr,"a.uue"); printf("Opening a file using a far filename spec\n"); if ( (fp=fopen(ptr,"r")) != NULL ) { fgets(buffer,79,fp); fputs(buffer,stdout); fgets(buffer,79,fp); fputs(buffer,stdout); fclose(fp); } else { printf("Couldn't open file\n"); } #endif printf("Enough fun..now make something real!!!\n"); printf("Press Any Key\n"); free(ptr); getchar(); sleep(2); } printfar(far unsigned char *ptr) { int i=0; while (*ptr) { putchar(*ptr++); i++; if (i==256) { printf("\n256chars...aborting"); break; } } putchar('\n'); } #include #define HELP1 "A small demo application for testing the far malloc" #define HELP2 "and string functions." #define HELP3 "" #define HELP4 "v0.02 djm/gwl 15/4/2000" #define HELP5 "" #define APP_INFO "Made by z88dk" #define APP_KEY 'F' #define APP_NAME "Far demo" #include z88dk-1.8.ds1/examples/z88/app/Makefile0000644000175000017500000000071307555321614017204 0ustar tygrystygrys all: info rpn useless wc viewer dstar info: @echo Building Application examples.. rpn: zcc -vn -create-app rpn.c -o rpn.bin useless: zcc -vn -create-app useless.c -o useless.bin wc: zcc -vn -create-app wc.c -lz88 -o wc.bin viewer: zcc -vn -create-app viewer.c -lz88 -o viewer.bin dstar: zcc -vn -create-app dstar.c -lgfxapp -o dstar.bin clean: $(RM) rpn.bin useless.bin wc.bin view.bin dstar.bin $(RM) zcc_opt.def *~ *.op* *.o *i *.asm *.63 z88dk-1.8.ds1/examples/z88/app/README0000644000175000017500000000047307130401707016416 0ustar tygrystygrysDirectory containing C files which are built up into applications, compile thus: zcc -create-app -lgfxapp dstar.c zcc -create-app rpn.c zcc -create-app useless.c zcc -create-app -lz88 viewer.c zcc -create-app -lz88 wc.c [All other options are specified in the source file] Enjoy making apps with z88dk.. d. z88dk-1.8.ds1/examples/z88/app/rpn.c0000644000175000017500000000612107130401710016467 0ustar tygrystygrys/* * Reverse Polish Notation calculator - integer only! * * Nabbed from GBDK distribution, converted over to Small C+ * * Small C+ changes: * * - include * = #define for UBYTE WORD BYTE * * Added to Small C+ archive 14/3/99 djm * * I'm guessing that Pascal Felber originally wrote this, if * not, then I apologise. Actually, I believe he did, there's * a floating point example in K&R on which this is based. * * Enjoy it: enter expressions like 1000 2342 + then 2 * * or something like that, it's all a bit too much like Forth * for my liking! * * 5/5/99 Added compiler directives, changed everything to printf * (so as to pick up miniprintf) added "." to exit */ /* Compiler directives, no bad space, not expanded */ #pragma -make-app #pragma -reqpag=1 #pragma -no-expandz88 #include #include #include #define MAXOP 40 #define NUMBER '0' #define STACKSIZE 40 #define UBYTE unsigned char #define WORD int #define BYTE char UBYTE sp; WORD stack[STACKSIZE]; char s[MAXOP]; UBYTE pos; WORD n; void push(WORD l) { if(sp < STACKSIZE) stack[sp++] = l; else printf("Stack full\n"); } WORD pop() { if(sp > 0) return stack[--sp]; else printf("Stack empty\n"); return 0; } WORD top() { if(sp > 0) return stack[sp-1]; else printf("Stack empty\n"); return 0; } BYTE read_op() { if(pos == 0) { gets(s); } while(s[pos] == ' ' || s[pos] == '\t') pos++; if(s[pos] == '\0') { pos = 0; return('\n'); } if(!isdigit(s[pos])) return(s[pos++]); n = s[pos] - '0'; while(isdigit(s[++pos])) n = 10 * n + s[pos] - '0'; return NUMBER; } void main() { BYTE type; WORD op2; printf("RPN Calculator\n"); printf("Nabbed from GBDK archive\n"); sp = 0; pos = 0; while((type = read_op(s)) != 0) { switch(type) { case NUMBER: push(n); break; case '+': push(pop() + pop()); break; case '*': push(pop() * pop()); break; case '-': op2 = pop(); push(pop() - op2); break; case '/': op2 = pop(); if(op2 != 0) push(pop() / op2); else printf("Divide by 0\n"); break; case '.': exit(0); case '\n': printf("==> %d\n", top()); break; } } } void __APPFUNC__ handlecmds(int cmd) { switch(cmd) { case 0x81: exit(0); } } #include #define HELP1 "A demo application made with z88dk - Small C+ Compiler" #define HELP2 "Liberated from the GBDK. Original author is probably" #define HELP3 "probably Pascal Felber, minor change for the Z88 made" #define HELP4 "by Dominic Morris - This one is for you Garry " #define HELP5 "Contact: djm@jb.man.ac.uk - 5/5/99 (v2.1)" #define APP_INFO "Made by z88dk" #define APP_KEY 'R' #define APP_NAME "Rpn Demo" #define TOPIC1 "Commands" #define TOPIC1_1 "Quit" #define TOPIC1_1KEY "CQ" #define TOPIC1_1CODE $81 #include z88dk-1.8.ds1/examples/z88/app/useless.c0000644000175000017500000000614207130401707017364 0ustar tygrystygrys/* * A little pointless application to demonstrate menus, topics * commands, and various other functions. * * Not very interesting, but the source will hopefully be quite * informative! */ /* Compiler directives, no bad space, not expanded */ #pragma -make-app #pragma -reqpag=0 #pragma -no-expandz88 /* Call up the required header files */ #include #include char baswindres[]= { 1,'7','#','3',32,32,32+94,32+8,128,1,'2','C','3', 1,'2','+','S',1,'2','+','C',0 }; void redrawscreen(void); main() { redrawscreen(); /* Define the windows */ /* Loop forever */ while (1) getk(); } /* * Function called when we need to redraw the screen */ void __APPFUNC__ redrawscreen(void) { /* * Clear the whole screen */ fputs(baswindres,stdout); puts("A silly, pointless demo for app features"); } /* * Now, some application info, have a look at doc/apps.html to see * what is going on! */ /* * This function handles menu codes */ void __APPFUNC__ handlecmds(int cmd) { fputs("So you want to....",stdout); switch(cmd) { case 0x84: puts("Quit? Wait 1 second"); sleep(1); exit(0); case 0x81: puts("eat"); break; case 0x82: puts("drink"); break; case 0x83: puts("sleep"); break; } } #include #define HELP1 "A pointless demo application made with z88dk" #define HELP2 "Simply loops, points out menu selections and dies" #define HELP3 "..eventually..see source for details" #define HELP4 "" #define HELP5 "v0.1 - 9.4.99 (djm)" #define HELP6 "" #define APP_INFO "Made by z88dk" #define APP_KEY 'U' #define APP_NAME "Useless" #define APP_TYPE AT_Good #define TOPIC1 "Action" #define TOPIC1ATTR TP_Help #define TOPIC1HELP1 "Some help for the topic" #define TOPIC1HELP2 "And another line of help" #define TOPIC1_1 "Eat" #define TOPIC1_1KEY "AE" #define TOPIC1_1CODE $81 #define TOPIC1_1ATTR MN_Help #define TOPIC1_1HELP1 "Are you hungry?" #define TOPIC1_2 "Drink" #define TOPIC1_2KEY "AD" #define TOPIC1_2CODE $82 #define TOPIC1_2ATTR MN_Help #define TOPIC1_2HELP1 "Why yes, if you're offering, mine'd a" #define TOPIC1_2HELP2 "pint of something nice" #define TOPIC1_3 "Sleep" #define TOPIC1_3KEY "AS" #define TOPIC1_3CODE $83 #define TOPIC1_3ATTR MN_Help #define TOPIC1_3HELP1 "Yawn...." #define TOPIC2 "Commands" #define TOPIC2ATTR TP_Help #define TOPIC2HELP1 "From this menu you can quit this" #define TOPIC2HELP2 "Completely useless application" #define TOPIC2_1 "Quit" #define TOPIC2_1KEY "CQ" #define TOPIC2_1CODE $84 #define TOPIC2_1ATTR MN_Help #define TOPIC2_1HELP1 "Go on, leave me now!" #include /* THE END! */ z88dk-1.8.ds1/examples/z88/app/viewer.c0000644000175000017500000000357007130401710017176 0ustar tygrystygrys/* * A small program to dump out the contents of a file selected * from the Filer * * This is a popdown - use Q to quit. * * Applications are easy with z88dk! * * 11/4/99 djm */ /* Compiler directives, no bad space, not expanded */ #pragma -make-app #pragma -reqpag=0 #pragma -no-expandz88 /* Call up the required header files */ #include #include #include main() { char buffer[81]; unsigned char count; FILE *fp; count=0; if ( readmail(FILEMAIL,(far char *)buffer,81) == NULL ) { puts("\n\n\tNo input file, exiting"); sleep(1); exit(0); } if ( (fp=fopen(buffer,"r") ) == NULL ) { puts("\n\n\tCannot open file..sorry!"); puts(buffer); sleep(1); exit(0); } while (fgets(buffer,80,fp) != NULL) { fputs(buffer,stdout); ++count; if ( count == 8) { count=0; if ( getkey() == 'Q' ) { fclose(fp); exit(0); } } putchar('\n'); } fclose(fp); getkey(); exit(0); /* Saves space, by removing cleanup */ } #include /* * We're a popup so APP_INFO is not needed */ #define APP_INFO "" #define HELP1 "A simple text viewer written using z88dk" #define HELP2 "Select a file from the Filer and enter this app" #define HELP3 "Use 'Q' to quit the viewer" #define HELP4 "" #define HELP5 "v0.1 11.4.99 djm" #define HELP6 "Email:djm@jb.man.ac.uk" #define APP_KEY 'T' #define APP_NAME "Textview" #define APP_TYPE AT_Popd #define APP_TYPE2 AT2_Cl #include /* THE END! */ z88dk-1.8.ds1/examples/z88/app/wc.c0000644000175000017500000000442607130401707016315 0ustar tygrystygrys/* * wc.c * An imitation of the unix wc utility * * 26/4/99 djm * Another pointless application done because I want to corner * the market in throwaway apps and popdowns! * * Virtually the same as the viewer.c app, just a little bit * changed..see, it's really easy to do!! * * Although we use printf() miniprintf() gets used for us * and cuts the size of the app down...nice! */ /* Compiler directives, no bad space, not expanded */ #pragma -make-app #pragma -reqpag=0 #pragma -no-expandz88 #include #include #include #include int main() { char buffer[81]; int lcount; int wcount; int ccount; unsigned char word; unsigned char c; FILE *fp; if ( readmail(FILEMAIL,(far char *)buffer,81) == NULL ) { printf("No input file, exiting"); sleep(1); exit(0); } if ( (fp=fopen(buffer,"r") ) == NULL ) { printf("Cannot open file: %s...sorry!",buffer); sleep(1); exit(0); } lcount=wcount=ccount=0; printf("\001F\001R WORKING!!! \001R\001F\n"); while ((c = fgetc(fp)) != EOF) { ccount++; if (isspace(c)) { if (word) wcount++; word = 0; } else { word = 1; } if (c == '\n' || c == '\f' || c == '\l' ) lcount++; } fclose(fp); printf("\0013@ File %s Lines = %d Words = %d Chars = %d\n\n\001R PRESS ANY KEY \001R\n",buffer,lcount,wcount,ccount); getkey(); exit(0); /* Saves a bit of space on stack cleanup */ } #include /* * We're a popup so APP_INFO is not needed */ #define APP_INFO "" #define HELP1 "A simple imitation of wc from the Unix world" #define HELP2 "Select a file from the Filer and enter this app" #define HELP3 "Made with z88dk v1.2" #define HELP4 "" #define HELP5 "v0.1 26.4.99 djm" #define HELP6 "Email:djm@jb.man.ac.uk" #define APP_KEY 'W' #define APP_NAME "WordCount" #define APP_TYPE AT_Popd #define APP_TYPE2 AT2_Cl #include /* THE END! */ z88dk-1.8.ds1/examples/z88/cube.c0000644000175000017500000000626207555323103016046 0ustar tygrystygrys/***************************************************************************/ /* */ /* 3D Rotating Cube. Created for Amiga and PC by Stefan Henrikson 1993. */ /* */ /* Modified for Z88 BASIC 1993, SmallC+ Z88 1998 by Dennis Groning. */ /* */ /***************************************************************************/ #include #include #include #define MAX_X 256.0 #define MAX_Y 64.0 #define NODES 8 #define SIZE 24.0 /* djm speed ups */ #define MAX_X2 128.0 #define MAX_Y2 32.0 struct window win; /* Window structure */ main() { double x[NODES], y[NODES], z[NODES]; double vx, vy, vz; double xg[NODES], yg[NODES], zg[NODES]; double mx, my, halfangle; double cx,cy,cz,sx,sy,sz; double t1,t2,t3; int node; vx=0; vy=0; vz=0; /* Next line not needed */ /* mx=MAX_X2; my=MAX_Y2; */ win->graph=1; win->width=255; win->number='4'; /* Open map with width 256 on window #4 */ window(win); x[0]=-SIZE; y[0]=-SIZE; z[0]=-SIZE; x[1]=-SIZE; y[1]= SIZE; z[1]=-SIZE; x[2]= SIZE; y[2]= SIZE; z[2]=-SIZE; x[3]= SIZE; y[3]=-SIZE; z[3]=-SIZE; x[4]=-SIZE; y[4]=-SIZE; z[4]= SIZE; x[5]=-SIZE; y[5]= SIZE; z[5]= SIZE; x[6]= SIZE; y[6]= SIZE; z[6]= SIZE; x[7]= SIZE; y[7]=-SIZE; z[7]= SIZE; for(node=0;node!=NODES;node++) { xg[node]=x[node]; yg[node]=y[node]; zg[node]=z[node]; } while(getk()==0) { cx=cos(vx); cy=cos(vy); sx=sin(vx); sy=sin(vy); cz=cos(vz); sz=sin(vz); mx=(MAX_X2-SIZE*1.8)*cos(vx)+MAX_X2; my=(MAX_Y2-SIZE*1.8)*sin(vy)+MAX_Y2; for(node=0;node!=NODES;node++) { t1=yg[node]*cx-zg[node]*sx; t2=yg[node]*sx+zg[node]*cx; t3=xg[node]*cy; x[node] = (t3 + t2*sy)*cz; x[node] = x[node] - t1*sz; y[node] = (t3 + t2*sy)*sz; y[node] = y[node] + t1*cz; z[node]=-xg[node]*sy+t2*cy; } vx+=0.003; vy+=0.005; vz+=0.002; clg(); draw(x[0]+mx,y[0]+my,x[1]+mx,y[1]+my); draw(x[1]+mx,y[1]+my,x[2]+mx,y[2]+my); draw(x[2]+mx,y[2]+my,x[3]+mx,y[3]+my); draw(x[3]+mx,y[3]+my,x[0]+mx,y[0]+my); draw(x[4]+mx,y[4]+my,x[5]+mx,y[5]+my); draw(x[5]+mx,y[5]+my,x[6]+mx,y[6]+my); draw(x[6]+mx,y[6]+my,x[7]+mx,y[7]+my); draw(x[7]+mx,y[7]+my,x[4]+mx,y[4]+my); draw(x[0]+mx,y[0]+my,x[4]+mx,y[4]+my); draw(x[3]+mx,y[3]+my,x[7]+mx,y[7]+my); draw(x[2]+mx,y[2]+my,x[6]+mx,y[6]+my); draw(x[1]+mx,y[1]+my,x[5]+mx,y[5]+my); } closegfx(win); } z88dk-1.8.ds1/examples/z88/define.c0000644000175000017500000000333607130401707016355 0ustar tygrystygrys/* * Small C+ Example of how to define static strings to minimize * memory use and generate correct code! * * This code doesn't actually do anything, it's just a code example * * djm 13/3/99 */ /* Just in case you do want to compile this... */ #include struct strprt { char *j; char k[10]; }; /* * From v0.5 of the compiler, this definition now works correctly - a simple * rewrite of init() was required, previously it would fail spectacularly! * This bug was in the original Small C+ */ struct strprt mystr2[2] = { {"Hello!","Hellohell"}, {"Hello","Hello"} }; /* * Correct amount of Space reserved for it in the static vars at the * end. */ char blah[1]="hello"; char *j={"Hello"}; /* stored in literal queue */ char *m[]={"Hello"}; /* stored in literal queue */ char *n="Hello"; /* stired in literal queue */ char k[]="Hello"; /* dumped where it is */ char o[10]="Hello"; /* dumped where it is (with padding) */ char *l[3]={"Hello","Hello"}; /* correctly stored and represented (litq) */ /* * This construct now works correctly, the bug was in the original * Small C+ Code, fixing the struct problem automatically fixed * this problem! */ char *p[3]="Hello"; /* As above.. */ /* * Now for some int testing! - If these work, then longs will as well! * The literal queue obviously isn't used for these because we can't * initialise pointers except for *ptr=0; - it makes sense ya know! */ int ij = 1; int ik[]= { 1,2,3 }; int il[10]={ 1 }; main() { /* Local statics follow the same rules as for global statics */ static int l; /* Dumped at end with other statics */ static int k=2; /* Dumped as defw */ static char *j="Hello"; /* Stored in literal queue */ puts("fish"); puts("Hello"); return; } z88dk-1.8.ds1/examples/z88/dstar.c0000644000175000017500000002705607130401707016245 0ustar tygrystygrys/* * dstar.c * * dstarz88 is a conversion of a TI86 game I found with * source on www.ticalc.org. * * The original program was written by Andrew Von Dollen who * in turn based it on a HP game by Joe W. * * The aim of the game is to collect all the clear bubbles by * running over them. You control either the dark bubble or * the solid box. The dark bubble is used to collect the clear * bubbles, and the solid box is used as a sort of movable wall. * * Both objects carry on moving until they hit something else * (except for the dark bubble in the case of clear bubbles). * * The keys are defined in #define statements, and default thus: * * Up: Q * Down: A * Left: O * Right: P * Quit: G * Retry: H * Switch: [SPACE] * * Switch changes between the dark bubble and the solid box. * * This is the first game ever produced with the Small C compiler - * it was written as a statement saying that it is possible to * write something easily, quickly and efficiently using the * compiler. Hopefully it will be an encouragement for others to * do likewise! * * For your interest I've also included the original Z88 converted * assembler from which I worked - it's quite crude but it just * about functions, the C is much more refined! * * Enough twaddle, enjoy the game and study the source! * * d. 1/12/98 * * This is the BASIC version of the program, compile with: * * zcc -lgfx dstar.c * */ /* Call up the required header files */ #include #include #include /* dstar.h contains the levels and "sprite" data */ #include "dstar.h" #define NO 0 #define MAXLEVEL 25 #define STARTLEV 0 /* Start level -1 */ /* Block numbers.. */ #define WALL 1 #define BUBB 2 #define BALL 3 #define BOX 4 /* Key definitions, change these to define your keys! */ #define K_UP 'Q' #define K_DOWN 'A' #define K_LEFT 'O' #define K_RIGHT 'P' #define K_SWITCH 32 #define K_EXIT 'G' #define K_CLEAR 'H' /* Declare some variables to start off with! */ char balloffset; /* Ball position */ char boxoffset; /* Box position */ char ballorbox; /* 1 if box, 0 if ball */ char level; /* Take a guess! */ char board[144]; /* Level internal map thing */ char tiscr[1024]; /* Our very own TI86 screen! */ /* Some character arrays to handle window functions */ char windtitle[]= { 1,'7','#','3',32+7,32+1,32+34,32+7,131, 1,'2','C','3',1,'4','+','T','U','R',1,'2','J','C', 1,'3','@',32,32, /*reset to (0,0)*/ 'D','S','t','a','r',' ','z','8','8', 1,'3','@',32,32 ,1,'2','A',32+34,0 }; char baswindres[]= { 1,'2','H','1',0x0C,0 }; char windclr[]= { 1,'2','C','3', 1,'3','@',32,32,1,'2','+','B',0 }; /* Used for the map, keep it global so we can close it easily! */ struct window graphics; /* prototype to stop barfing */ void redrawscreen(void); main() { redrawscreen(); /* Define the windows */ playgame(); /* Play the game */ myexit(); /* Clean up after ourselves */ } myexit() { closegfx(graphics); /* Close the Map window */ puts(baswindres); exit(0); /* Get outta here! */ } playgame() { setupgame(); /* Set level to 1, get level etc */ /* Loop while checkfinish() says we haven't finished! */ while ( checkfinish() ) { gamekeys(); /* Scan keys */ } } /* Set some variables up at the start.. */ setupgame() { ballorbox=NO; level=STARTLEV; setuplevel(); } gamekeys() { char *charptr; /* Set up a pointer to the variable we want to change (either for * box or for ball */ if (ballorbox) charptr=&boxoffset; else charptr=&balloffset; switch( getk() ) { /* Use OZ to get the key */ case K_DOWN: down(charptr); break; case K_UP: up(charptr); break; case K_RIGHT: right(charptr); break; case K_LEFT: left(charptr); break; case K_SWITCH: ballorbox^=1; /* Toggle ball/box */ break; case K_EXIT: myexit(); case K_CLEAR: setuplevel(); } } /* Movement functions - all of these are pretty well similar so I * will only comment the first one - it's fairly obvious what is * happening though */ left(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn-1)) ) return; *(locn-1)=*locn; *locn=0; (*ptr)--; /* ptr is the location of blob */ drawboard(); /* Draw screen */ } } right(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn+1)) ) return; *(locn+1)=*locn; *locn=0; (*ptr)++; drawboard(); } } down(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if (standardmiddle(*(locn+16)) ) return; *(locn+16)=*locn; *locn=0; (*ptr)+=16; drawboard(); } } up(char *ptr) { char *locn; while(1) { locn=*(ptr)+board; if ( standardmiddle(*(locn-16)) ) return; *(locn-16)=*locn; *locn=0; (*ptr)-=16; drawboard(); } } /* Check to see if we're running into anything, if box is set then * if we hit anything we want to stop, if we're ball then if we * hit anything except for bubble we wanna stop */ standardmiddle(char nextpos) { if (ballorbox) return (nextpos); /* For box */ else if (nextpos==BUBB || nextpos==NO) return(0); return(1); } /* Check to see if a level is finished * There are 144 squares in each level, note the use of != instead of * >6)&3; *ptr2++=((*ptr)>>4)&3; *ptr2++=((*ptr)>>2)&3; *ptr2++=(*ptr)&3; ptr++; } } /* Now, plot the ball and box into the internal map */ ptr2=board; *(ptr2+balloffset)=BALL; *(ptr2+boxoffset)=BOX; drawboard(); } /* Define the text window and the graphics window * If can't open graphics window then exit gracefully */ void redrawscreen(void) { struct window text; /* * Clear the whole screen */ puts(baswindres); /* Define and open a text window with title and other embellishments * strings are at top for clearing, position etc */ text->number='3'; text->x=32+7; text->y=32+1; text->width=32+34; text->depth=32+7; text->type=131; text->graph=0; window(text); fputs(windtitle,stdout); text->x=32+8; text->y=32+3; text->width=32+32; text->depth=32+5; text->type=128; window(text); fputs(windclr,stdout); /* Now, try to open a map window.. */ graphics->graph=1; graphics->width=128; graphics->number='4'; if (window(graphics)) { puts("Sorry, Can't Open Map"); sleep(5); exit(0); } /* Sucessfully opened, now dump some info in the text window! */ puts(" DStar Z88 - C Demo"); fputs("Original TI game By A Von Dollen",stdout); puts(" Converted to Z88 By D Morris"); puts(" Keys: Q,A,O,P,SPACE,H,G"); } /* Draw the board, mostly written in C, even though we did take a bit * of a performance hit when it was converted over from asm */ drawboard() { int x,y; char *ptr; /* We let OZ in here, because we only go back to the loop once our * thing has hit something */ getk(); ptr=board; for (y=0;y!=9;y++) { for (x=0;x!=16;x++) { puttiblock((*ptr++),x,y); } } doozcopyasm(); } /* Dump a sprite onto the TI screen we've built * The TI screen is 16 characters wide by 8 deep i.e. half the size * of the Z88's map screen. It's stored line by line (sensible!) * * We enter with y being y/7 and x being x/8 (if we think in pixels) * So for each y we have to step down by 112. * The increment between rows is 16. */ puttiblock(char spr,int x, int y) { char *ptr2,*ptr; int i; /* We use this method instead of y*=112 because the compiler has special * cases for multiplying by ints less than 16 (except for 11 and 13 * (Hmmm, I wonder why?!?!) */ y=(y*14)*8; /* So, get where we want to dump our sprite into ptr */ ptr=tiscr+y+x; /* Calculate where the sprite is */ spr*=8; ptr2=sprites+spr; /* And dump it in there */ for (i=0; i!=7;i++) { *ptr=*(ptr2++); ptr+=16; } } /* Ooops, forgive me this one bit of assembler in the entire program! * This just copies the TI screen onto the OZ map. * * It really is easier to keep this routine in here, change it into * C if you like.. */ doozcopyasm() { #asm LIB swapgfxbk call swapgfxbk call ozscrcpy jp swapgfxbk .ozscrcpy ld de,(base_graphics) ld hl,_tiscr ld c,8 .ozscrcpy1 push hl ld b,16 .ozscrcpy3 push bc push hl ld bc,16 ld a,8 .ozscrcpy2 ex af,af ld a,(hl) ld (de),a inc de add hl,bc ex af,af dec a jr nz,ozscrcpy2 pop hl inc hl pop bc djnz ozscrcpy3 pop hl push bc ld bc,16*8 add hl,bc pop bc dec c jr nz,ozscrcpy1 /* Every function always has a ret at the end! So don't need one of * our own!! */ #endasm } /* THE END! */ z88dk-1.8.ds1/examples/z88/dstar.h0000644000175000017500000003076407130401707016252 0ustar tygrystygrys/* * Sprite and level data for DStar * Stored in #asm statements * * Even though the sprites are only 7 bytes long, we align them at 8 * bytes, so calculations go that little bit quicker! */ extern char levels[]; extern char sprites[]; #asm .smc_sprites ;1=edge, 2=clear ball 3=moveable ball 4=moveable block defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb @00000000 defb 0 defb @01111110 defb @10101001 defb @11000111 defb @10110001 defb @11001011 defb @10100101 defb @01111110 defb 0 defb @00000000 defb @00011000 defb @00100100 defb @00100100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 defb @00011000 defb @00110100 defb @00111100 defb @00011000 defb @00000000 defb @00000000 defb 0 defb @00000000 defb @00111100 defb @00111100 defb @00111100 defb @00111100 defb @00000000 defb @00000000 defb 0 #endasm #asm .smc_levels defb 17,30 ;ball offset, box offset defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@00000000,@00000000,@10010001 defb @01000000,@00000000,@00000010,@00010101 defb @01000000,@00000000,@01011000,@00000001 defb @01000000,@01010010,@00000000,@00000101 defb @01010010,@00001000,@00000000,@10000001 defb @01001000,@00000000,@00100101,@00100001 defb @01000000,@00000101,@10000000,@00001001 defb @01010101,@01010101,@01010101,@01010101 .level2 defb 30,86 defb @00010000,@01000100,@01000000,@01000101 defb @01000000,@10000000,@00000000,@00000001 defb @00000001,@10000001,@10000000,@10000000 defb @01000100,@10000000,@00001000,@00010001 defb @00000000,@00000100,@00001000,@00000100 defb @01000000,@00010001,@00001000,@00000001 defb @00000001,@00000100,@01000000,@01101001 defb @01000000,@00000000,@00000000,@00000100 defb @00010000,@01000000,@00000000,@00010000 .level3 defb 30,46 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@10010001 defb @01000000,@01010000,@00000000,@01010001 defb @01000000,@01100000,@00000010,@00000001 defb @01001000,@00000000,@10010100,@00001001 defb @01000110,@00001000,@00100100,@00100101 defb @01000101,@10000110,@00001000,@10010101 defb @01100000,@00000101,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level4 defb 125,30 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01000000,@00000100,@00000000,@00000001 defb @01011001,@10001001,@10011001,@10011001 defb @01000100,@01100010,@01000100,@01000101 defb @01011001,@10011000,@10011001,@10011001 defb @01000000,@00000100,@00000000,@00000001 defb @01000000,@01000000,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level5 defb 17,110 defb @00010101,@01010101,@01010101,@01010100 defb @01000000,@01000000,@01000001,@00000001 defb @01000001,@10000100,@10000010,@00010001 defb @01010000,@00000000,@01000001,@00000001 defb @01100001,@10010000,@00000000,@00000101 defb @01010000,@00000001,@00100001,@00000001 defb @01100100,@00010001,@00010000,@00010001 defb @01000000,@01000000,@00100100,@00011001 defb @00010101,@01010101,@01010101,@01010100 .level6 defb 65,113 defb @00000000,@01010101,@01010101,@01010101 defb @00000001,@00000010,@00000001,@10001001 defb @00000100,@00000010,@00000000,@01000101 defb @00010000,@00000010,@00000000,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01010000,@00000010,@00000100,@00000101 defb @01000000,@00000010,@00000000,@01000001 defb @01000001,@00000010,@00000101,@10000001 defb @01010101,@01010101,@01010101,@01010101 .level7 defb 115,122 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00000001 defb @00010100,@01010100,@00011000,@01011001 defb @00011000,@00011000,@01000100,@01000100 defb @00000100,@00010000,@01010100,@01010000 defb @00010100,@00010000,@01100100,@01100100 defb @01000000,@00000000,@00000000,@00000001 defb @01000000,@01100000,@00000000,@00011001 defb @01010101,@01010101,@01010101,@01010101 .level8 defb 108,98 defb @01010101,@01010101,@01010101,@01010100 defb @01000010,@01010000,@00000000,@00000101 defb @01000001,@10000001,@01001000,@00000001 defb @01000010,@01010001,@00011000,@00000001 defb @01010000,@00000001,@01000001,@10010001 defb @01010001,@00000000,@00000010,@01100001 defb @01100010,@01000000,@10000001,@00010001 defb @01010000,@00000000,@00000000,@00000001 defb @00010101,@01010101,@01010101,@01010101 .level9 defb 30,72 defb @00000100,@01010101,@01010101,@01010100 defb @00011001,@10000000,@00000001,@00000001 defb @01100010,@01000000,@00100000,@00000100 defb @00010001,@00001001,@01000010,@01000001 defb @01000001,@10000110,@00100000,@00001001 defb @01000000,@00001001,@01000000,@00000100 defb @01100110,@00000000,@00000000,@00010000 defb @01000000,@00000000,@00000000,@01000000 defb @01010101,@01010101,@01010101,@00000000 .level10 defb 93,36 defb @00000000,@01010101,@01010101,@01010100 defb @01010101,@00100000,@00000000,@00000001 defb @01000000,@00000101,@01100010,@01001001 defb @01001000,@00000110,@00011000,@00000100 defb @01000000,@00000100,@00100000,@01001001 defb @01100110,@00000100,@10010000,@01000100 defb @00011000,@00000101,@01000001,@01010000 defb @01000000,@00000000,@00000100,@01000100 defb @00010101,@01010101,@01010000,@01000001 .level11 defb 30,108 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000001,@00000000,@00000001 defb @01000001,@10100000,@00000010,@10000101 defb @01010000,@00100000,@00010100,@00001001 defb @01100000,@00000110,@01101000,@00010101 defb @01010001,@01000000,@00010100,@00000001 defb @01100000,@10010010,@00000000,@00001001 defb @01011001,@01010000,@00000100,@00000101 defb @00010100,@01010101,@01010101,@01010100 .level12 defb 17,92 defb @01010000,@00000001,@01000001,@01010100 defb @01000101,@01010110,@00010101,@00100101 defb @01000000,@00101000,@00000000,@10000001 defb @01000101,@00000101,@10000001,@10010001 defb @01000100,@10000101,@01100001,@01000001 defb @01000101,@00000101,@00000001,@00010001 defb @01000000,@00001000,@00000000,@00000001 defb @01000000,@00000000,@00100000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level13 defb 18,113 defb @00010101,@01010101,@01010101,@01010100 defb @01000001,@00000000,@00000000,@10000101 defb @01000100,@00000110,@00000010,@01010001 defb @01000000,@00000000,@10000000,@00010001 defb @01001000,@00000000,@00000000,@00011001 defb @01000100,@00000000,@00100000,@00000001 defb @01010000,@00000000,@10001000,@00011001 defb @01000000,@01000000,@00100001,@00010001 defb @00010101,@01010101,@01010101,@01010100 .level14 defb 36,50 defb @01010101,@01010101,@01010101,@01010101 defb @01100110,@00000000,@00000000,@10011001 defb @01001001,@00000000,@00000001,@01000001 defb @01000000,@00000000,@00000010,@00000001 defb @01000000,@00000000,@00100100,@00000001 defb @01000000,@00000010,@00000000,@00000001 defb @01001001,@00000000,@00000000,@01000001 defb @01100110,@00000000,@00000000,@10011001 defb @01010101,@01010101,@01010101,@01010101 .level15 defb 51,76 defb @00010101,@01010100,@01010101,@01010100 defb @01000000,@00001001,@00000000,@00100001 defb @01000100,@10000100,@00010000,@00100001 defb @01000000,@01000000,@01101000,@01100001 defb @00010001,@00000001,@00100000,@00010001 defb @01100000,@00000000,@00010000,@01100001 defb @00010000,@00000000,@10000000,@00000100 defb @01100000,@00000000,@00000000,@00001001 defb @00010101,@01010101,@01010101,@01010100 .level16 defb 35,19 defb @01010101,@01010101,@01010101,@01010101 defb @01010000,@01100010,@00000000,@00001001 defb @01100000,@10011000,@00000000,@00000101 defb @01010001,@01010000,@00001000,@00000101 defb @01010000,@00000010,@01100100,@00000001 defb @01101000,@00000000,@00001001,@10000001 defb @01010010,@00000000,@01010101,@10000001 defb @01011001,@00000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level17 defb 29,124 defb @01010101,@01010101,@01010101,@01010101 defb @01001001,@00000000,@00000000,@01000001 defb @01000100,@00100110,@10011000,@00010001 defb @01000000,@00011001,@01100100,@10000001 defb @01001001,@00000000,@00000010,@01000001 defb @01000010,@01100000,@00001001,@00000001 defb @01000100,@00010001,@01100100,@00010001 defb @01000000,@00100001,@10000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level18 defb 115,26 defb @01010101,@01010101,@01010101,@01010101 defb @01001000,@00000010,@00000001,@00000001 defb @01000001,@10011000,@00000110,@00000001 defb @01000000,@01100100,@00000001,@10000001 defb @01000000,@10000001,@00000010,@01100001 defb @01000110,@01000000,@01001001,@00000001 defb @01001001,@10000100,@10000100,@00000001 defb @01100100,@00000100,@00000000,@01000001 defb @01010101,@01010101,@01010101,@01010101 .level19 defb 126,110 defb @01010101,@01010101,@01010101,@01010101 defb @01100000,@00010100,@00000000,@01011001 defb @01000100,@00010000,@00000000,@01100001 defb @01001001,@00000010,@01010000,@10000001 defb @01000100,@00000001,@10000000,@00000001 defb @01000000,@00010000,@00100100,@00000001 defb @01000101,@00100100,@01011000,@00010001 defb @01001001,@00011000,@00000000,@01010001 defb @01010101,@01010101,@01010101,@01010101 .level20 defb 77,66 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@10011000,@00000000,@00000001 defb @01011000,@00100100,@01011000,@00000101 defb @01000100,@01001000,@00000100,@00010001 defb @01000000,@01000001,@01000001,@00001001 defb @01000100,@00010000,@00100001,@00010001 defb @01010000,@00100101,@00011000,@00100101 defb @01000000,@00000000,@00100110,@00000001 defb @01010101,@01010101,@01010101,@01010101 .level21 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000101,@01000000,@00001000,@00000101 defb @01000000,@01000000,@00000000,@01000101 defb @01000000,@01011000,@00000000,@00100001 defb @01000010,@00000000,@10000000,@10000101 defb @01000000,@00010000,@00000101,@01100001 defb @01000010,@00100000,@00000010,@00101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level22 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01100100,@00011001,@00011000,@00010001 defb @01000000,@00010000,@00000000,@00000001 defb @01100000,@00010000,@01100000,@10000001 defb @01010001,@10000000,@00000010,@00010101 defb @01001000,@01000000,@01010110,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level23 defb 103,105 defb @00010101,@01010101,@01010101,@01010100 defb @01000100,@00011001,@00011000,@00010001 defb @01000000,@00100000,@01000000,@00000001 defb @01010000,@00010000,@00100001,@10000001 defb @01000001,@10000001,@00001010,@00100001 defb @01011000,@01000000,@01010010,@00000001 defb @01000000,@00000100,@01000000,@10000001 defb @00010101,@01010101,@01010101,@01010100 defb @00000000,@00000000,@00000000,@00000000 .level24 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000100,@00000000,@00000101 defb @01000101,@10001000,@00000001,@01100101 defb @01000110,@00000000,@00100100,@00010101 defb @01001010,@00001001,@00010100,@00000001 defb @01000110,@00100001,@00000000,@01010001 defb @01000101,@00000000,@01000101,@01101001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 .level25 defb 103,105 defb @01010101,@01010101,@01010101,@01010101 defb @01000000,@00000000,@00000000,@00010001 defb @01001000,@01011000,@00001000,@00000001 defb @01000000,@01100000,@10000001,@01000001 defb @01001000,@00000001,@01000001,@10000001 defb @01000110,@00000010,@01000000,@00100001 defb @01000101,@10000100,@00000000,@00000001 defb @01010101,@01010101,@01010101,@01010101 defb @00000000,@00000000,@00000000,@00000000 #endasm z88dk-1.8.ds1/examples/z88/enigma_o.bas0000644000175000017500000000767707130401707017240 0ustar tygrystygrys *NAME Enigma Machine  rotor$(5,26)  pos(3),rings(3) # pos2(3),rings2(3) ( order(3) 2 Set up standard parameters &A ABCDEFGHIJKLMNOPQRSTUVWXYZ ,Protor$(1,1)="EKMFLGDQVZNTOWYHXUSPAIBRCJ" ,Urotor$(2,1)="AJDKSIRUXBLHWTMCQGZNPYFVOE" ,Zrotor$(3,1)="BDFHJLCPRTXVZNYEIWGAKMUSQO" ,_rotor$(4,1)="ESOVPZJAYQUIRHXLNFTGKDCMWB" ,drotor$(5,1)="VZBRGITYUPSDNHLXAWMJQOFECK" %nref$="YRUHQSLDPXNGOKMIEBFZCWVJAT" xnotch$="QEVJZ" }flag=0  USER ENCRYPTION DETAILS $order(0)=3:order(1)=1:order(2)=2 -rings(0)="W":rings(1)="X":rings(2)="T" 'pos(0)="A":pos(1)="W":pos(2)="E" plug$="AMTE"  menu k$= ! k$="E" k$="e" dostuff ! k$="v" k$="V" dispinfo $ k$="c" k$="C" changeparam  k$="h" k$="H" help  k$="q" k$="Q" k$="Q" :  dostuff  n%  "Text to (de)code ";text$  (text$)=0 title  "Original text: "; >count=0: n%=1 (text$): c$=text$,n%,1):dispchar: n% count=0:  "De(coded) text:"; store count=0: n%=1 (text$) encode(text$,n%,1))  n% restore k$=: , store 1 n 6 n=0 2 %;rings2(n)=rings(n):pos2(n)=pos(n) @ n E J restore O n T n=0 2 %Yrings(n)=rings2(n):pos(n)=pos2(n) ^ n c h dispinfo m c,n% rtitle w n%=1 5 $| "Rotor ";n%;" = ";rotor$(n%,1)  n%  "R: "; # n%=0 2: (rings(n%));: n%  " S: "; ! n%=0 2: (pos(n%));: n% ( " O: ";order(0);order(1);order(2);  " P: ";plug$; k$=:  changeparam  n% title * "Order: ";order(0);order(1);order(2)  n%=0 2  "Order ";n%;: order(n%)  n% :title: "Rings: ";(rings(0));(rings(1));(rings(2)) 7 n%=0 2: "Ring ";n%;: c$:rings(n%)=(c$): n% 4title: "Start: ";(pos(0));(pos(1));(pos(2)) 6 n%=0 2: "Start ";n%;: c$:pos(n%)=(c$): n% title: "Plugboard: ";plug$  "New plugboard ";plug$   encode(c$)  c,t,m% checkchar: c$=""  c=(c$) rotorstep(0) 1 flag=1 rotorstep(1):rotorstep(2):flag=0 \& pos(0)=(notch$,order(0),1)) rotorstep(1): pos(1)=(notch$,order(1),1)) flag=1 0plugboard :rotorforward Drotorreflect Nrotorback Xplugboard b PRINT CHARACTER ldispchar v  dispchar checkchar: c$="" ! (count/5)=count/5 " ";  c$; count=count+1:  checkchar 2 (c$)>="a" (c$)<="z" c$=((c$)-32) % (c$)<"A" (c$)>"Z" c$=""  rotorstep(p)  c c=pos(p) c=c+1  c>"Z" c=c-26 pos(p)=c $ L plugboard V i ` i=1 (plug$) 2 0j c$=plug$,i,1) c$=plug$,i+1,1): D~D )t c$=plug$,i+1,1) c$=plug$,i,1) ~ i   rotorforward  i,c  i=0 2 c=(c$) %c=c+(pos(i)-65): c>"Z" c=c-26 'c=c-(rings(i)-65): c<"A" c=c+26 *c$=rotor$(order(i),1),c-64,1):c=(c$) 'c=c+(rings(i)-65): c>"Z" c=c-26 %c=c-(pos(i)-65): c<"A" c=c+26 c$=(c)  i   rotorreflect c$=ref$,(c$)-64,1) ( F rotorback K i,j,c P i=2 0 -1 Uc=(c$) %Zc=c+(pos(i)-65): c>"Z" c=c-26 '_c=c-(rings(i)-65): c<"A" c=c+26 d j=1 26 ,i rotor$(order(i),1),j,1)=(c) DsE n j sc=j+64 'xc=c+(rings(i)-65): c>"Z" c=c-26 %}c=c-(pos(i)-65): c<"A" c=c+26 c$=(c)  i   menu title 0 1: "2+B E";: 1: "2-B]ncode/decode text" / 1: "2+B C";: 1: "2-B]hange parameters" - 1: "2+B V";: 1: "2-B]iew parameters" . 1: "2+B H";: 1: "2-B]elp/information" * 1: "2+B Q";: 1: "2-B]uit program"    title  7 1: "2+R Enigma Machine Simulator writ by Dom " " 1: "2-R" ; @ help Jtitle .O "This proogram is a software simulation" ,T "of the German Enigma cypher machine." .Y "It allows the encoding and decoding of" .^ "any string of CAPITAL letters - as per" c "the real machine." hk$=: (# Enigma Machine Simulator !2# Written by D Morris 23/4/98 <# My First Z88 program!!! z88dk-1.8.ds1/examples/z88/filetest.c0000644000175000017500000000127507555321614016753 0ustar tygrystygrys/* Short C Example for the Z88 Dev Kit * Insultingly simple just takes first 5 * lines of text file and displays them on * screen. * * Updated a little 5/5/99 */ #define ANSI_STDIO #include #include main() { FILE *fp; char line[81]; int i; /* Do yourself a favour and change the filename to something else! */ fp=fopen("filetest.c","r"); if ((fp == NULL)) { fputs("\nCan't open file, sorry",stdout); exit(0); } printn(fp,10,stdout); for (i=0; i!=5; i++) { fgets(line,80,fp); fputs(line,stdout); } fclose(fp); } z88dk-1.8.ds1/examples/z88/gfx.c0000644000175000017500000000153007130401707015701 0ustar tygrystygrys #include #include #include struct window mine; /* Window structure */ main() { int j,i; mine->graph=1; mine->width=255; mine->number='4'; /* Open map with width 256 on window #4 */ window(mine); /* Clear the graphics window */ clg(); /* Draw a series of concentric circles in the centre of the screen * these go off the screen but don't generate an error - very cool! */ for (i=50 ; i!=0; i--) { circle(128,32,i,1); if (i < 25 ) i--; } draw(0,0,255,63); /* Draw a diamond - weak, but it demonstrates relative drawing! */ plot(200,32); drawr(10,10); drawr(10,-10); drawr(-10,-10); drawr(-10,10); /* Close the graphics window */ closegfx(mine); } z88dk-1.8.ds1/examples/z88/macro.c0000644000175000017500000000057207130401707016223 0ustar tygrystygrys/* * At Last! Macros for z80asm * * Short example of how to do macros in Small C, this required a bit * of a rewrite of doasmfunc() but I think it needed it, anyway, here's * how to do them. Recognise the code?!?! * * djm 18/3/99 */ #define CLEAR(st,len) asm("ld\thl, "#st"\nld\tde,"#st"+1\nld\tbc,"#len"\nld\t(hl),0\nldir\n"); main() { CLEAR(16384,6911) } z88dk-1.8.ds1/examples/z88/Makefile0000644000175000017500000000106410765022536016422 0ustar tygrystygrys all: info ansitest cube cubez88 dstar gfx all16: info anstst16 cube cubez88 dstar gfx info: @echo Building examples.. ansitest: - zcc +z88 -lz88ansi_clib ansitest.c -o ansitest.bas anstst16: - zcc +z88 -lz88ans~1 ansitest.c -o ansitest.bas cube: - zcc +z88 -lm -lgfx cube.c -o cube.bas cubez88: - zcc +z88 -lmz -lgfx cube.c -o cubez88.bas dstar: - zcc +z88 -lgfx dstar.c -o dstar.bas gfx: - zcc +z88 -lgfx gfx.c -o gfx.bas clean: $(RM) ansitest.bas cube.bas cubez88.bas dstar.bas gfx.bas $(RM) zcc_opt.def *.op* *.o *.i *.asm *.err *.map *.sym z88dk-1.8.ds1/examples/z88/README0000644000175000017500000000051507130401707015633 0ustar tygrystygrysThis directory contains examples which run from BASIC, compile them thus: zcc -lm -lgfx cube.c Generic Maths zcc -lmz -lgfx cube.c Z88 Maths zcc -lgfx dstar.c zcc -lgfx gfx.c zcc rpn.c zcc sorter.c zcc enigma.c The other examples aren't meant to be compiled, but just brief demonstrations Or alternatively...use the makefile! z88dk-1.8.ds1/examples/zx81/0000755000175000017500000000000010765202715015141 5ustar tygrystygrysz88dk-1.8.ds1/examples/zx81/adv-a.p0000644000175000017500000003272010732671607016322 0ustar tygrystygrysrruuuuu]@7r !@v /2~Ò@?$$)0v@As@!91`sA!@6!@6!@6d[=n@A1*@!@"@+!}A!!4@~(*4@+>| F7g"4@!@ͻK%@"%@xB:'@X !;@ˆ ~7!'@?F{w* @͎A_>͵+͎AA:(@O:;@ʩyD<*A#"A|³A!A4äSmall C+ ZX81 \R^^^^^^^_0_`_t_______ `*`A`o`~`````a1aUa|aaubbbbc*cQcncxccddd4efeeeeeee1fff^gghhh;iKi[iaimiiiiiiiiiii jjEjZjhjujjjjjjj k  DOWND NORTN SOUTS EASTE WESTW GET PICK DROPPUT FIRESHOOBOOTSTARMOTOKEY LASEGUN USEDBAR BARSGOLDCOINMIRRBROKGLOVROPEFLOOBOARPLANSTALBLOCICE POOLWATELAKESLEEGREEMAN DOOR OPEN!UNLO!WIND"SMAL#SPAC#SHIP#SECU$FLIN%STON&DRAW'HELP(INVE)I )QUIT*STOP*ABOR*YES +Y +NO ,COMP-KEYB-TYPE.TURN/HAND0KILL1DANC2WALT2REMO3KICK4BREA4HIT 4BANG4BRIB5USE 6WITH6PUSH7THRE83 8TWO 92 9ONE :1 :MEND;FIX ;REPA;FOUR<4 <LOOK=STAN>TREE?CUT @SAW @WEARACROSBJUMPCRAVIDUP EU ECLIMEFUSEFREDEGR GMAINHAUX IFIELJSHIEJ     EEEEEEEEEEF FFFFFF%F(F+F+F6SFSvSSSSSSS                                                                                 &                                 ! hFG kFG nFG qFG tFG wFG zFG FG FG FH FH FH F H F H FH FH %FH &FH)GH*GHhF HkF#HnF&HqF)HtF,HwF/HF2HF5HF5HF8HF;HF>HFAHFAHFDHFGH%FJH&FMH='FPH4FSH6FVH@F[H6%F^HAGcH3GfHBDFiHBDFiH6FlH6FoHCDFvHCDFvHFiH6FyH FH FH FHFH FH FHFHFH1FH1FH6FH6FH6FH.(FHFHJFHJFHJGH2 GH2GH! GH6GH1$GH=E$GH4$GHE'GH5$,GH6/GH 4GH=9GH 9GH>GHGGH9GI! NGI78QGI78XG I79]GI79XG I7:eGI7:XG I;FmGI6rGI=yG#I(|G&I(G)I(G,I(G/I(G/I(G/I(G/I(G&I=EG2IG5IG5IAG;I3G>IGGAIGBI6GEICGLIEGOI#GRI7HGUI7IGXI78G]I79G]I7<G`I7:GhI7:GcI(GoI=GrI# $ % GeMGhMGhMGkMGnMGqM!99q!@͚o!99q 2qM! "A! }͊q͢M! !@͚o;M!9! 9Mq#̈́q+~!9n&|N3!9n&} 'N -N0NM#O#O!9Mq+̈́q!9Mq!PN!9! 9Mq~!9~ wNwN!9~ ÍN#!9Mq#̈́qPN*ARqM!9!9Mq̈́qêN!9! 9Mq~!9~ NN!9~ N!9n&͢M!9Mq#̈́qêN*AէR|O! }͊q͢M*AէR+"A#O*AէR"AM3!&B*m)MqM!"m!NO#qqҙO)m^#V*m2qҖO*mlq҄O!4kM!"m)PBMqMMKO!"9n*mOʺO!mMq+̈́q*mOO!mMq+̈́q!FkMEZ!"m!m"mOͪX";n2qғP!*m9q 2q P*m9q2q(P!wP+P*m9q 2qEP*m#"mQ*m9q 2qeP*m9q2qmP!wP*m#"m+P|ʏP![kM!"9nÖPÙPO!"7nâP*m9q}͊q;}o!99q 2qP3P!99q|Q!99q 2qQ*m#"m3âPP*m#"mͪX"7n}qZQ Q*m9q}͊q;}o!99q 2q/Q3WQ!99q|Q!99q 2qQ*m#"m3 QP!,F*m)MqlQn&2qҀQíQ*;n2qҟQ#n&"m!"9n##lQ!uI"m!"m!"9nÖP3ZQ*m^#Vkb|R*mlqR*;n qqQ!nkMR*m| R!kMR!kM!"9n2q2R*;n2q.S*m##^#Vkb2qRR*7n2q-S*m Mq"m*m#"m+n&}qҳR)VF^#V*mn&"m@lqҨR!"m!"9n*m#"m`R*m Mq"m!"m!"9nR*m^!2qR!xX*m#"m+n&)^#V*mn&"m@*9n}qS*m#"mR!kM!"9n[m*m2q!!m*m)^#Vkb*m2qqS?qqS!!Mrp*mqq!FSlq!!m*m)^#V!2q!!m*m)Mqlq?!*m#"mn&!m*m)^#V2q!ͳSlq!!m*m)^#V!2q-T!m*m)^#V!2q-T!!!!kM!NT#!qqұT!m!9Mq)Mq?qҮT!96#6!PB!9Mq)MqM2qҫT!kMMIT!9Mq|T!kM!"9n!m*m)^#V!2q U*m2qU!kM!"9nU!m*m)6#6!mMq#̈́q.U!lM!"9n*m2qLU!%lM!"9nU!m*m)^#V*m2qҀU!m*m)6#6!mMq#̈́qU!m*m)^#V!2qڬU!m*m)^#V!2qҽU! .8&0"&8@0!ho( (##~>rs p q w v " $:?()><=+-*/;,.'!~~(nfq#uti&n8onfp!9"Vp~ 2o2o@* ( .2o:o<2o>2o* @#T]! bk#6 !onp(5:o=2o>2o!͊pwnp:o<2o p* @#:o(G!:o_w~08:0-a8{0 A8[0!ho#( #(+~>N#F#x( ~#~# `i||G(ogzO(_Wqy qxȗ_W||M!jR0?WYɧR?ȧ~og|ƀGzƀ?{?~#fozƀG|ƀ}zƀG|ƀ?}?|7|ƀGzƀ{ɷR7?}|og}o|g0123456789ABCDEF! 9~q!9^#V! 2q8q!-!9Mq͚o!9! 9MqEr̈́q!9^#V!9Mqp|r!9^#V!9Mqͧq!q! 9^#V! 9Mqpn&!9Mq͚o|/g}/o#*A|t "A|R&x(  r|r!+&%x(~ržrkb+v "! vvvvvvvvvvvvvvvvvvvvvvvvvvz88dk-1.8.ds1/examples/zxvgs/0000755000175000017500000000000010765202715015510 5ustar tygrystygrysz88dk-1.8.ds1/examples/zxvgs/info.c0000644000175000017500000000322407637073073016617 0ustar tygrystygrys #include #include #pragma -make-app #define APP_NAME="INFO" int video() { #pragma asm LD DE,$FF00 LD HL,$0000 LD BC,$0000 RST 8 DEFB $A7 LD L,D LD H,0 #pragma endasm } main() { int ok1, ok2; printf("ZXVGS Info 0.30\n"); printf("(C) 2003-03-07 Jarek Adamski\n\n"); printf("Hardware type: "); switch(video()) {case 0x00: printf("Sinclair ZX Spectrum (+) ULA 6C001E-7"); break; case 0x01: printf("Sinclair ZX+ 128 AMSTRAD 40056"); break; case 0x02: printf("Amstrad ZX +2 ULA 7K010E5"); break; case 0x03: printf("Amstrad ZX +2A/+2B/+3 GATE ARRAY 40077"); break; case 0x0C: printf("MGT SAM Coup ASIC"); break; case 0x20: printf("Timex Sinclair 2068 TS 2068 - 60Hz"); break; case 0x21: printf("Timex Computer 2068 TS 2068 - 50Hz, grey"); break; case 0x22: printf("Timex Computer 2048 TS 2068 - 50Hz, black"); break; case 0x80: printf("ELWRO 800 Junior"); break; case 0x81: printf("Solum"); break; case 0xC0: printf("Pentagon"); break; case 0xC1: printf("ZS Scorpion"); break; case 0xF0: printf("Warajevo emulator"); break; default: printf("unknown"); } printf("\nAvailable memory: %dkB\n",16*(3+bnkfree())); printf("AY-3-891X sound: "); ok1=(opensound(1,077)==077); //device 1 is AY in ZX128 opensound(1,0); ok2=(opensound(2,077)==077); //device 2 is AY in TC2068 opensound(2,0); if (!(ok1 || ok2)) printf("not "); printf("available "); if (ok1) printf("in ZX128 mode "); if (ok1 && ok2) printf ("or "); if (ok2) printf("in TC2068 mode"); printf("\nSAA 1099 sound: "); ok1=(opensound(4,077)==077); //device 4 is SAA1099 in Sam opensound(4,0); if (!ok1) printf("not "); printf("available\n"); } z88dk-1.8.ds1/examples/zxvgs/loadscr.c0000644000175000017500000000010507637073073017306 0ustar tygrystygrys #include main() { loadany("ARGH!.SCR",0x4000,0x1B00); } z88dk-1.8.ds1/examples/zxvgs/Makefile0000644000175000017500000000020007645022016017135 0ustar tygrystygrys all: info info: zcc +zx -Cz+zxvgs -v -s info.c -create-app -lzxvgs clean: rm -f *.bin *.i *.asm *.op* *.o *~ zcc_opt.def z88dk-1.8.ds1/EXTENSIONS0000644000175000017500000000047007267011070014127 0ustar tygrystygrys$Id: EXTENSIONS,v 1.2 2001/04/17 09:51:52 stefano Exp $ sccz80 features several extensions to C to enable mixing of C and assembler: return_c - As return but sets carry flag return_nc - As return but resets carry flag iferror{...} else {..} - As "if { }" but checks carry flag (does else {...} if nc ) z88dk-1.8.ds1/GnuToBor.mak0000644000175000017500000001030307555321116014677 0ustar tygrystygrys# Makefile to make original z88dk GNU makefiles Borland DOS/Win compatible. # Substitute "\tcd .. ; ./b.sh" with "\tcd ..\n\tb.bat\n\tcd graphics". # Substitute "\tcd a ; make b" with "\tcd a\n\tmake b\n\tcd ..". # Substitute "\t@echo ''" with "\t@echo.". # Substitute "\t@echo '---> abc <---'" with "\t@echo ---- abc ----". # Substitute "\t./a.sh" with "\ta.bat". # Rename original Makefile to GNUmakefile. # Rename and filter original *.sh to *.bat. # Works with make from Borland and sed from UnxUtils. # http://www.borland.com/bcppbuilder/freecompiler/ # http://www.weihenstephan.de/~syring/win32/UnxUtils.html # This makefile should be named GnuToBor.mak, placed in z88dk and run from there. # Does not yet handle conversion of z88dk/Makefile. # Dennis Groning 30 May 2002. Z88DKDIR = c:\z88dk MFILES = \ $(Z88DKDIR)\Makefile \ # $(Z88DKDIR)\examples\spectrum\Makefile \ # $(Z88DKDIR)\examples\z88\Makefile \ # $(Z88DKDIR)\examples\z88\app\Makefile \ # $(Z88DKDIR)\examples\z88\app\farmall\Makefile \ $(Z88DKDIR)\libsrc\Makefile \ # $(Z88DKDIR)\libsrc\assert\Makefile \ # $(Z88DKDIR)\libsrc\ctype\Makefile \ $(Z88DKDIR)\libsrc\farz88\Makefile \ # $(Z88DKDIR)\libsrc\farz88\strings\Makefile \ $(Z88DKDIR)\libsrc\fcntl\Makefile \ # $(Z88DKDIR)\libsrc\fcntl\cpm\Makefile \ $(Z88DKDIR)\libsrc\fcntl\dummy\Makefile \ $(Z88DKDIR)\libsrc\fcntl\spectrum\Makefile \ # $(Z88DKDIR)\libsrc\fcntl\spectrum\plus3\Makefile \ # $(Z88DKDIR)\libsrc\fcntl\z88\Makefile \ # $(Z88DKDIR)\libsrc\games\Makefile \ $(Z88DKDIR)\libsrc\genmath\Makefile \ $(Z88DKDIR)\libsrc\graphics\Makefile \ $(Z88DKDIR)\libsrc\malloc\Makefile \ # $(Z88DKDIR)\libsrc\malloc\strings\Makefile \ # $(Z88DKDIR)\libsrc\net\Makefile \ # $(Z88DKDIR)\libsrc\printflike\Makefile \ $(Z88DKDIR)\libsrc\rex\Makefile \ # $(Z88DKDIR)\libsrc\rex\farcall\Makefile \ # $(Z88DKDIR)\libsrc\rex\graphics\Makefile \ $(Z88DKDIR)\libsrc\rs232\Makefile \ $(Z88DKDIR)\libsrc\rs232\Spectrum\Makefile \ # $(Z88DKDIR)\libsrc\rs232\Spectrum\if1\Makefile \ # $(Z88DKDIR)\libsrc\rs232\Spectrum\plus3\Makefile \ # $(Z88DKDIR)\libsrc\rs232\z88\Makefile \ # $(Z88DKDIR)\libsrc\setjmp\Makefile \ # $(Z88DKDIR)\libsrc\spectrum\Makefile \ $(Z88DKDIR)\libsrc\stdio\Makefile \ $(Z88DKDIR)\libsrc\stdio\8080\Makefile \ # $(Z88DKDIR)\libsrc\stdio\z88\Makefile \ $(Z88DKDIR)\libsrc\stdio\zsock\Makefile \ $(Z88DKDIR)\libsrc\stdlib\Makefile \ # $(Z88DKDIR)\libsrc\stdlib\spectrum\Makefile \ # $(Z88DKDIR)\libsrc\stdlib\z88\Makefile \ # $(Z88DKDIR)\libsrc\strings\Makefile \ $(Z88DKDIR)\libsrc\time\Makefile \ # $(Z88DKDIR)\libsrc\time\spectrum\Makefile \ # $(Z88DKDIR)\libsrc\time\z88\Makefile \ # $(Z88DKDIR)\libsrc\z80_crt0s\Makefile \ $(Z88DKDIR)\libsrc\z88\Makefile \ # $(Z88DKDIR)\libsrc\z88\fdstdio\Makefile \ # $(Z88DKDIR)\libsrc\z88math\Makefile \ # $(Z88DKDIR)\src\appmake\Makefile \ # $(Z88DKDIR)\src\copt\Makefile \ # $(Z88DKDIR)\src\cpp\Makefile \ # $(Z88DKDIR)\src\sccz80\Makefile \ # $(Z88DKDIR)\src\z80asm\Makefile \ # $(Z88DKDIR)\src\zcc\Makefile \ $(Z88DKDIR)\support\bogomips\Makefile SFILES = \ gamesdeps.sh \ gfxdeps.sh \ tideps.sh .path.sh = $(Z88DKDIR)\libsrc .path.bat = $(Z88DKDIR)\libsrc All: ToBor $(SFILES:.sh=.bat) ToBor: $(MFILES) &$(MAKE) -f GnuToBor.mak -DDIR=$(?D) -DTARGET=Makefile.mak ChangeDir UnBor: $(MFILES:Makefile=GNUmakefile) - &$(MAKE) -f GnuToBor.mak -DDIR=$(?D) -DTARGET=Makefile ChangeDir ChangeDir: cd $(DIR) $(MAKE) -f $(Z88DKDIR)\GnuToBor.mak -DDIR=$(DIR) $(TARGET) Makefile.mak: Makefile sed -f &&| s/^^\([^ ]\+cd[^ ]\+..\)\/[^ ]*;[^ ]*\(.*\)/\1\\ ^ \2\\ ^ cd graphics/ | < Makefile > Makefile.1 sed -f &&| s/^^\([^ ]\+cd[^ ]\+[^^^ ]\+\)[^ ]*;[^ ]*\(.*\)/\1\\ ^ \2\\ ^ cd ../ | < Makefile.1 > Makefile.2 sed "s/^\([ ]\+@echo\)[ ]\+''/\1./" < Makefile.2 > Makefile.3 sed "s/^\([ ]\+@echo[ ]\+\)'--->\(.*\)<---'/\1----\2----/" < Makefile.3 > Makefile.4 sed "s/^\([ ]\+\).\/\(.\+\).sh/\1\2.bat/" < Makefile.4 > Makefile.mak del Makefile.1 del Makefile.2 del Makefile.3 del Makefile.4 - ren Makefile GNUmakefile Makefile: - ren GNUmakefile Makefile - del Makefile.mak .sh.bat: sed "s/^[ ]*#.*//" < $*.sh > $*.bat z88dk-1.8.ds1/include/0000755000175000017500000000000010765202715014134 5ustar tygrystygrysz88dk-1.8.ds1/include/abc80.h0000644000175000017500000000043210712567173015205 0ustar tygrystygrys/* * Headerfile for ABC80 specific stuff * * $Id: abc80.h,v 1.2 2007/11/02 09:31:39 stefano Exp $ */ #ifndef __ABC80_H__ #define __ABC80_H__ #include ///////////// // GRAPHICS ///////////// // Invert graphics display extern void __LIB__ abc_inv (); #endif z88dk-1.8.ds1/include/abc800.h0000644000175000017500000000211610712567173015266 0ustar tygrystygrys/* * Headerfile for ABC800 specific stuff * * $Id: abc800.h,v 1.1 2007/11/02 09:31:39 stefano Exp $ */ #ifndef __ABC800_H__ #define __ABC800_H__ #include /////////////////////////////// // ABC 800 CRTC 6845 FUNCTIONS /////////////////////////////// // Set cursor shape extern int __LIB__ __FASTCALL__ abc_cursor(unsigned char shape); // Set a parameter to CRTC control register (VDU) extern int __LIB__ __FASTCALL__ abc_vdu(unsigned char register, unsigned char value); /* 00 - Horiz. total characters 01 - Horiz. displayed characters per line 02 - Horiz. synch position 03 - Horiz. synch width in characters 04 - Vert. total lines 05 - Vert. total adjust (scan lines) 06 - Vert. displayed rows 07 - Vert. synch position (character rows) 08 - Interlace mode 09 - Maximum scan line address 0A - Cursor start (scan line) 0B - Cursor end (scan line) 0C - Start address (MSB) 0D - Start address (LSB) 0E - Cursor address (MSB) (read/write) 0F - Cursor address (LSB) (read/write) 10 - Light pen (MSB) (read only) 11 - Light pen (LSB) (read only) */ #endif z88dk-1.8.ds1/include/adt.h0000644000175000017500000002701110577133640015057 0ustar tygrystygrys#ifndef _ADT_H #define _ADT_H /* * Abstract Data Types Library * * - Doubly Linked List + ; added 08.2005 aralbrec * - Heap ; added 08.2005 aralbrec * - Stack + ; added 09.2005 aralbrec * - Queue + ; added 09.2005 aralbrec * * The data types marked with "+" require a memory allocation policy * that allows memory to be allocated and freed implicitly. You can * determine how that memory is allocated by declaring the u_malloc * and u_free functions globally in your main.c file (here the examples * use the standard C malloc library functions but you could use the * block allocator, a mixture of the two, or something of your own): * * ( u_malloc must return carry flag set if allocation successful ) * void *u_malloc(uint size) { * return(malloc(size)); * lib function malloc sets carry * * } * * ( u_free must ignore addr == 0 ) * void u_free(void *addr) { * free(addr); * lib function free ignores 0 * * } * * If implemented in assembler, use the labels _u_malloc and _u_free * with HL as the parameter and return value. XDEF both labels to * make them globals. * */ #include /*** DOUBLY LINKED LIST Items are stored in an ordered list. Each list has a current pointer that can point at: a specific item, before the list or after the list. The list iterator is ListSearch, which searches from the item pointed at by the current pointer and stops when the matching function reports a match or when the current ptr points past the end of the list. In the following: void *delete <-> void [__FASTCALL__] (*delete)(void *item) void *match <-> char (*match)(void *item1, void *item2) return 0 if = */ struct adt_ListNode { /* Invisible to User, one for each item in list */ void *item; struct adt_ListNode *next; /* big endian */ struct adt_ListNode *prev; /* big endian */ }; struct adt_List { /* One as handle for each list */ uint count; /* number of NODEs in list */ uchar state; /* state of curr ptr: 1 = INLIST, 0 = BEFORE, 2 = AFTER */ struct adt_ListNode *current; /* points at current NODE in list, big endian */ struct adt_ListNode *head; /* points at first NODE in list, big endian */ struct adt_ListNode *tail; /* points at last NODE in list, big endian */ }; extern struct adt_List __LIB__ *adt_ListCreate(void); extern void __LIB__ __FASTCALL__ adt_ListCreateS(struct adt_List *list); extern void __LIB__ adt_ListDelete(struct adt_List *list, void *delete); /* from C: del = 0 to do nothing */ extern void __LIB__ adt_ListDeleteS(struct adt_List *list, void *delete); /* from C: del = 0 to do nothing */ extern uint __LIB__ __FASTCALL__ adt_ListCount(struct adt_List *list); extern void __LIB__ __FASTCALL__ *adt_ListFirst(struct adt_List *list); extern void __LIB__ __FASTCALL__ *adt_ListLast(struct adt_List *list); extern void __LIB__ __FASTCALL__ *adt_ListNext(struct adt_List *list); extern void __LIB__ __FASTCALL__ *adt_ListPrev(struct adt_List *list); extern void __LIB__ __FASTCALL__ *adt_ListCurr(struct adt_List *list); extern int __LIB__ adt_ListAdd(struct adt_List *list, void *item); extern int __LIB__ adt_ListInsert(struct adt_List *list, void *item); extern int __LIB__ adt_ListAppend(struct adt_List *list, void *item); extern int __LIB__ adt_ListPrepend(struct adt_List *list, void *item); extern void __LIB__ __FASTCALL__ *adt_ListRemove(struct adt_List *list); extern void __LIB__ adt_ListConcat(struct adt_List *list1, struct adt_List *list2); extern void __LIB__ __FASTCALL__ *adt_ListTrim(struct adt_List *list); extern void __LIB__ __FASTCALL__ *adt_ListPopFront(struct adt_List *list); extern void __LIB__ __FASTCALL__ adt_ListSetCurrBefore(struct adt_List *list); extern void __LIB__ __FASTCALL__ adt_ListSetCurrAfter(struct adt_List *list); extern void __LIB__ adt_ListSetCurr(struct adt_List *list, struct adt_ListNode *n); extern void __LIB__ *adt_ListSearch(struct adt_List *list, void *match, void *item1); // make CALLEE linkage default extern void __LIB__ __CALLEE__ adt_ListDelete_callee(struct adt_List *list, void *delete); /* from C: del = 0 to do nothing */ extern void __LIB__ __CALLEE__ adt_ListDeleteS_callee(struct adt_List *list, void *delete); /* from C: del = 0 to do nothing */ extern int __LIB__ __CALLEE__ adt_ListAdd_callee(struct adt_List *list, void *item); extern int __LIB__ __CALLEE__ adt_ListInsert_callee(struct adt_List *list, void *item); extern int __LIB__ __CALLEE__ adt_ListAppend_callee(struct adt_List *list, void *item); extern int __LIB__ __CALLEE__ adt_ListPrepend_callee(struct adt_List *list, void *item); extern void __LIB__ __CALLEE__ adt_ListConcat_callee(struct adt_List *list1, struct adt_List *list2); extern void __LIB__ __CALLEE__ adt_ListSetCurr_callee(struct adt_List *list, struct adt_ListNode *n); extern void __LIB__ __CALLEE__ *adt_ListSearch_callee(struct adt_List *list, void *match, void *item1); #define adt_ListDelete(a,b) adt_ListDelete_callee(a,b) #define adt_ListDeleteS(a,b) adt_ListDeleteS_callee(a,b) #define adt_ListAdd(a,b) adt_ListAdd_callee(a,b) #define adt_ListInsert(a,b) adt_ListInsert_callee(a,b) #define adt_ListAppend(a,b) adt_ListAppend_callee(a,b) #define adt_ListPrepend(a,b) adt_ListPrepend_callee(a,b) #define adt_ListConcat(a,b) adt_ListConcat_callee(a,b) #define adt_ListSetCurr(a,b) adt_ListSetCurr_callee(a,b) #define adt_ListSearch(a,b,c) adt_ListSearch_callee(a,b,c) #define adt_ListPopBack(a) adt_ListTrim(a) #define adt_ListPushBack(a,b) adt_ListAppend_callee(a,b) #define adt_ListPushFront(a,b) adt_ListPrepend_callee(a,b) /*** HEAP (PRIORITY QUEUE) The heap is an array of void* with indices 1..N used to store items. Items in a heap are stored in a special order that allows single item insertion and ordered extraction quickly. When an array is sorted in this special order, it is said to posses the heap property. Heapify can be used to convert an unsorted random array into a heap with the heap property. HeapAdd is used to add items to a valid heap incrementally. HeapExtract pulls items out of the heap one at a time in order. Besides returning the smallest (min heap) / largest (max heap) item in the heap, HeapExtract will also write the extracted item to the end of the array. If all items in an array are extracted one after the other, the array, after all extractions, will be sorted in ascending order (max heap) or descending order (min heap). This is an implementation of heapsort. In the following: void *compare <-> char (*compare)(void **item1, void **item2) return negative if item1>item2 for max heap (extract largest item first) return negative if item1 void [__FASTCALL__] (*delete)(void *item) an opportunity for user clean up if a non-empty queue is deleted */ struct adt_QueueNode { /* One for each item in queue, invisible to user */ void *item; struct adt_QueueNode *next; }; struct adt_Queue { /* A single handle for each queue created */ uint count; struct adt_QueueNode *front; struct adt_QueueNode *back; }; extern struct adt_Queue __LIB__ *adt_QueueCreate(void); extern void __LIB__ __FASTCALL__ *adt_QueueCreateS(struct adt_Queue *q); extern void __LIB__ adt_QueueDelete(struct adt_Queue *q, void *delete); /* from C: del = 0 to do nothing */ extern void __LIB__ adt_QueueDeleteS(struct adt_Queue *q, void *delete); /* from C: del = 0 to do nothing */ extern uint __LIB__ __FASTCALL__ adt_QueueCount(struct adt_Queue *q); extern void __LIB__ __FASTCALL__ *adt_QueueFront(struct adt_Queue *q); extern void __LIB__ __FASTCALL__ *adt_QueueBack(struct adt_Queue *q); extern void __LIB__ __FASTCALL__ *adt_QueuePopFront(struct adt_Queue *q); extern void __LIB__ __FASTCALL__ *adt_QueuePopBack(struct adt_Queue *q); extern int __LIB__ adt_QueuePushFront(struct adt_Queue *q, void *item); extern int __LIB__ adt_QueuePushBack(struct adt_Queue *q, void *item); // make CALLEE linkage default extern void __LIB__ __CALLEE__ adt_QueueDelete_callee(struct adt_Queue *q, void *delete); extern void __LIB__ __CALLEE__ adt_QueueDeleteS_callee(struct adt_Queue *q, void *delete); extern int __LIB__ __CALLEE__ adt_QueuePushFront_callee(struct adt_Queue *q, void *item); extern int __LIB__ __CALLEE__ adt_QueuePushBack_callee(struct adt_Queue *q, void *item); #define adt_QueueDelete(a,b) adt_QueueDelete_callee(a,b) #define adt_QueueDeleteS(a,b) adt_QueueDeleteS_callee(a,b) #define adt_QueuePushFront(a,b) adt_QueuePushFront_callee(a,b) #define adt_QueuePushBack(a,b) adt_QueuePushBack_callee(a,b) /*** STACK A standard LIFO stack. Items are pushed onto the top of a stack and are popped off the top as well. In the following: void *delete <-> void [__FASTCALL__] (*delete)(void *item) an opportunity for user clean up if a non-empty stack is deleted */ struct adt_StackNode { /* One for each item in stack */ void *item; struct adt_Stack *next; }; struct adt_Stack { uint count; /* Number of items in stack */ struct adt_StackNode *next; /* Pointer to top item in stack */ }; extern struct adt_Stack __LIB__ *adt_StackCreate(void); extern void __LIB__ __FASTCALL__ adt_StackCreateS(struct adt_Stack *s); extern void __LIB__ adt_StackDelete(struct adt_Stack *s, void *delete); /* from C: del = 0 to do nothing */ extern void __LIB__ adt_StackDeleteS(struct adt_Stack *s, void *delete); /* from C: del = 0 to do nothing */ extern int __LIB__ adt_StackPush(struct adt_Stack *s, void *item); extern void __LIB__ __FASTCALL__ *adt_StackPop(struct adt_Stack *s); extern void __LIB__ __FASTCALL__ *adt_StackPeek(struct adt_Stack *s); extern uint __LIB__ __FASTCALL__ adt_StackCount(struct adt_Stack *s); // make CALLEE linkage default extern void __LIB__ __CALLEE__ adt_StackDelete_callee(struct adt_Stack *s, void *delete); extern void __LIB__ __CALLEE__ adt_StackDeleteS_callee(struct adt_Stack *s, void *delete); extern int __LIB__ __CALLEE__ adt_StackPush_callee(struct adt_Stack *s, void *item); #define adt_StackDelete(a,b) adt_StackDelete_callee(a,b) #define adt_StackDeleteS(a,b) adt_StackDeleteS_callee(a,b) #define adt_StackPush(a,b) adt_StackPush_callee(a,b) #endif z88dk-1.8.ds1/include/algorithm.h0000644000175000017500000001272010604123040016256 0ustar tygrystygrys#ifndef _ALGORITHM_H #define _ALGORITHM_H ////////////////////////////////////////////////////////////////// // // // ALGORITHMS // // // // A home for interesting and useful algorithm implementations. // // Link to -lalgorithm when using functions from this library. // // // // Contents: // // // // 1. A* Search Algorithm, 01.2007 aralbrec // // // ////////////////////////////////////////////////////////////////// #include /*****************************************************************/ // 1. A* Search Algorithm, 01.2007 aralbrec // See http://en.wikipedia.org/wiki/A%2A_search_algorithm // Program must also be linked with -ladt to access priority queue /*****************************************************************/ // // The A* Search Algorithm finds the shortest path between any // two nodes. It is a best-search-first algorithm, meaning it // pursues paths of lowest cost first. This implementation of A* // uses the heap implementation from the Abstract Data Types // library as a priority queue. Each path is stored as an 8-byte // block, which is dynamically allocated by A* functions through // the usual u_malloc() and u_free() functions (see the wiki topic // on memory allocation for details if you are unfamiliar with // how z88dk libraries implicitly allocate dynamic memory). // // To use A*, you must provide functions with the following // signatures: // // a. void [[__FASTCALL__]] astar_TestAndClose(uint node); // // Mark the node as 'closed' and return carry flag set // if the node was already closed previously. C functions // should make use of the special z88dk keywords return_c() // and return_nc() to exit with known carry flag state. // // b. void astar_Successor(uint *node, uint *cost); // // This function enumerates all the neighbours of node, one // after the other on successive calls. With node not -1, a // new start node is indicated. If node is -1, the next // neighbour of the last valid node supplied should be returned. // This function indicates to the algorithm the connectivity // of the map. // // If node is not -1, write into node its first neighbour // and the cost of moving from that node to this neighbour // into cost. // // If node is -1, write the next neighbour into node and the // cost of moving from the last valid node to this neighbour // into cost. // // Return with carry flag set when there are no more neighbours // and reset if the neighbour returned is valid. C functions // should use the z88dk keywords return_c() and return_c() // to exit with known carry flag state. // // c. uint [[__FASTCALL__]] astar_DestCost(uint node) // // (optional) Estimate the cost from the node indicated to // the destination node. These nodes may be widely separated // so a cartesian distance metric is probably simplest. // // This function is only called by astar_EstimateBestPath(). // If astar_EstimateBestPath() is not used, this function need // not be defined. // // Prior to calling the A* search algorithm, function pointers // must be declared globally and assigned to point at the above // function implementations: // // void *astar_TestAndClose, *astar_Successor, *astar_DestCost; // // Additionally a number of variables A* uses must be declared // globally and initialized: // // uint astar_startNode; /* init to starting node */ // uint astar_destNode; /* init to finish node */ // // void **astar_queue; /* address of array of 2-byte entries */ // uint astar_queueSize; /* max num entries available in array */ // uint astar_queueN; /* no init necessary */ // // A* uses the Abstract Data Type library's heap data type to // implement the priority queue. The latter three variables // indicate the location of a static array to use for the heap, // the max size of the heap, and the current number of entries // in the heap. See the ADT library documentation for more // details. // struct astar_path { // 7 bytes uint node; // +0 last node of this path uchar ref_count; // +2 reference count for this path struct astar_path *prefix; // +3 path leading to this node uint cost; // +5 cost of this path 0-65535 }; extern struct astar_path __LIB__ *astar_Search(void); extern struct astar_path __LIB__ __FASTCALL__ *astar_SearchResume(struct astar_path *p); extern struct astar_path __LIB__ __FASTCALL__ *astar_EstimateBestPath(struct astar_path *p); extern uint __LIB__ __FASTCALL__ astar_PathLength(struct astar_path *p); extern uint __LIB__ *astar_WalkPath(struct astar_path *p, uint *node_arr, uint n); extern uint __LIB__ __CALLEE__ *astar_WalkPath_callee(struct astar_path *p, uint *node_arr, uint n); extern void __LIB__ __FASTCALL__ astar_DeletePath(struct astar_path *p); extern void __LIB__ __FASTCALL__ astar_CleanUp(struct astar_path *p); #define astar_WalkPath(a,b,c) astar_WalkPath_callee(a,b,c) #endif z88dk-1.8.ds1/include/application.h0000644000175000017500000001336410640012112016575 0ustar tygrystygrys/* * Header file which will build the application DOR and all * that gubbins, most of it is already predefined, so you * may want to create your own hacked up version of this * if you need a special configuration * * The default application type is AT_BAD|AT_DRAW and a default * of 8k required page * * This file is somewhat bizarre in that we include it after * we define something - these defines are given to use via * including the file dor.h * * You should supply all the variables defined in the #ifndef * clauses below, if not, you'll end up with the defaults! * * 7/4/99 djm Commands and topics now supported -see command?.h * for details on these brutes...it ain't fun!! * * Packages are now supported (work for 16k packages) * * $Id: application.h,v 1.3 2007/06/25 19:15:22 dom Exp $ */ #ifndef HELP1 #define HELP1 "An application made with the z88dk" #define HELP2 "For more information on the z88dk" #define HELP3 "See http://www.z88dk.org" #endif #ifndef HELP2 #define HELP2 "" #endif #ifndef HELP3 #define HELP3 "" #endif #ifndef HELP4 #define HELP4 "" #endif #ifndef HELP5 #define HELP5 "" #endif #ifndef HELP6 #define HELP6 "" #endif #ifndef APP_INFO #define APP_INFO "Made by z88dk" #endif #ifndef APP_NAME #define APP_NAME "z88dkapp" #endif #ifndef APP_KEY #define APP_KEY 'A' #endif #ifndef APP_TYPE #define APP_TYPE AT_Def #endif #ifndef APP_TYPE2 #define APP_TYPE2 AT2_Cl #endif /* * Some macros which do our generation for us */ #define APPLBYTE(b) defb b #define APPLNAME(b) defm b &0 #define HELPTEXT(b) defm b &127 #define APPLTEXT(b) defm b #pragma asm ; Here we go, with lots of assembler! INCLUDE "#dor.def" INCLUDE "zcc_opt.def" ; The universal saviour file! XREF app_entrypoint ; The real starting point for our apps XDEF applname ; So startup can pick it up XDEF in_dor XDEF in_dor_seg_setup XDEF in_dor_seg0 XDEF in_dor_seg1 XDEF in_dor_seg2 XDEF in_dor_seg3 ; How much bad memory do we actually need ; If reqpag is defined already do nothing, else default to $20 pages IF ( reqpag = 0 ) | reqpag ELSE defc reqpag = $20 ENDIF ;Safe workspace needed by app (user specifies so can have app using ;static vars that is still good...) be careful though! IF !safedata defc safedata = 0 ENDIF .dummy_entry jp app_entrypoint IF ( (reqpag=0) | (reqpag >= 32) ) scf ; no bad or >8k bad needed ret ELSE ld bc,8192+(reqpag*256) ld de,8192+8192 or a ret ENDIF ; Initally let us consider only single bank applications defc in_bank = 63 ; Application DOR .in_dor defb 0,0,0 ; links to parent, brother, son defb 0,0,0 ; brother /* Packages use the son DOR link */ #ifdef MAKE_PACKAGE defw in_package_dor defb in_bank #else defw 0 ;brother_add defb 0 ;brother_bank #endif defb $83 ; DOR type - application defb indorend-indorstart .indorstart defb '@' ; key to info section defb ininfend-ininfstart .ininfstart defw 0 APPLBYTE(APP_KEY) IF reqpag = 0 defb 0 ELSE IF reqpag <=32 defb 32 ELSE defb reqpag ; contigious RAM ENDIF ENDIF defw 0 ; overhead defw 0 ; unsafe workspace defw 55+safedata ; safe workspace (used for startup vars) ; and user specifed safe data defw dummy_entry ; entry point ; These are set up by appmake, but we can define top for certain .in_dor_seg_setup .in_dor_seg0 defb 0 ; segment bindings .in_dor_seg1 defb 0 .in_dor_seg2 defb 0 .in_dor_seg3 defb in_bank APPLBYTE(APP_TYPE) ; at_bad etc APPLBYTE(APP_TYPE2) ;caps lock .ininfend defb 'H' ; key to help section defb inhlpend-inhlpstart .inhlpstart defw in_topics defb in_bank defw in_commands defb in_bank defw in_help defb in_bank defb 0,0,0 ; no tokens .inhlpend defb 'N' ; key to name section defb innamend-innamstart .innamstart APPLNAME(APP_NAME) .innamend defb $ff .indorend ; topics, shoved in header file to make this one more readable! .in_topics defb 0 #include ; end marker for end of topics .incom_topend defb 0 /* * Command entries, to keep the file smaller, included */ .in_commands defb 0 #include #include #include #include #include #include #include .in_coms_end defb 0 ;end marker ; Help entries .in_help defb $7f HELPTEXT(HELP1) HELPTEXT(HELP2) HELPTEXT(HELP3) HELPTEXT(HELP4) HELPTEXT(HELP5) HELPTEXT(HELP6) defb 0 /* * Help files for commands and topics, help0.h is for topics, rest are for * commands for topic n - we assume that there isn't more than 8k of em, if * there is then the whole DOR collapses! */ #include #include #include #include #include #include #include #include .applname APPLNAME(APP_INFO) #pragma endasm z88dk-1.8.ds1/include/assert.h0000644000175000017500000000124307363076307015614 0ustar tygrystygrys/* * * assert.h * * Assertion - use liberally for debugging. Defining NDEBUG * turns assertions off. * assert(exp) where exp is non-zero does nothing, while * assert(exp) where exp evaluates to zero aborts the program * with a message like * * Assertion failed: prog.c line 123: "exp" * * djm 28/2/2000 * * $Id: assert.h,v 1.3 2001/10/16 18:30:31 dom Exp $ * */ #ifndef __ASSERT_H__ #define __ASSERT_H__ #ifndef NDEBUG extern void __LIB__ l_assert(int, char *, char *); #define assert(exp) if((exp==0)) {l_assert(__LINE__, __FILE__, #exp );} #else #define assert(exp) #endif /* NDEBUG */ #endif /* _ASSERT_H */ z88dk-1.8.ds1/include/balloc.h0000644000175000017500000000624310552633310015537 0ustar tygrystygrys#ifndef _BALLOC_H #define _BALLOC_H /* * Block Memory Allocator * 04.2004 aralbrec * * Complements or replaces the standard C library's malloc allocator. The standard * C library's malloc functions manage a single contiguous block of memory from * which requests for variable-sized blocks of memory are satisfied. Because those * sizes are variable, over the course of the program running external fragmentation * can become an issue. This is a situation where there are lots of small available * chunks of memory available within the large block, but memory requests can no * longer be satisfied because none of those chunks, taken individually, are large * enough. Managing such a memory block for any size memory requests also adds to * running time overhead. * * A block memory allocator is designed to be quick, solve the external fragmentation * issue and be able to make use of free memory scattered around the memory map. * The allocator manages up to 127 memory queues, with each queue containing a list * of memory blocks of the same size. A memory request requests a block of memory * from a specific queue, retrieving a block of known size. The size of blocks in * each queue and the number of queues are something you decide --- you are * responsible for initializing the queues by adding free memory to them. That * free memory can be bits and pieces scattered around your memory map (10 bytes * from here, 356 bytes from there, etc). * * Read the discussion under "BAQTBL" below to learn how to declare the queue table. * Use ba_Init to clear the queues to empty and ba_AddMem to add memory to those * queues. ba_BestFit can return blocks of memory of at least a certain size -- * see the source for comments. * * - maximum of 127 memory queues * - minimum block size is 2 bytes * - actual memory used for each block is size+1 bytes * (one hidden byte is used to identify the queue a block belongs to) */ #include /* * BAQTBL is a macro that declares the queue table statically. * "numq" is the number of memory queues that will be managed. * * An alternative is to declare the location of the queue table * in memory using some inline assembler in your main.c file: * * #asm * XDEF _ba_qtbl * DEFC _ba_qtbl = addr * #endasm * * The table will not then be compiled as part of the final binary. * * One of these declarations must be performed once in your main.c file. */ #define BAQTBL(numq) uchar ba_qtbl[numq*2]; extern void __LIB__ __FASTCALL__ ba_Init(uchar numq /* >=1 */); extern void __LIB__ *ba_AddMem(uchar q, uchar numblocks /* >=1 */, uint size /* >=2 */, void *addr); extern void __LIB__ __CALLEE__ *ba_AddMem_callee(uchar q, uchar numblocks, uint size, void *addr); extern uint __LIB__ __FASTCALL__ ba_BlockCount(uchar q); extern void __LIB__ __FASTCALL__ *ba_Malloc(uchar q); extern void __LIB__ __FASTCALL__ ba_Free(void *addr); extern void __LIB__ *ba_BestFit(uchar q, uchar numq /* >=1 */); extern void __LIB__ __CALLEE__ *ba_BestFit_callee(uchar q, uchar numq); #define ba_AddMem(a,b,c,d) ba_AddMem_callee(a,b,c,d) #define ba_BestFit(a,b) ba_BestFit_callee(a,b) #endif z88dk-1.8.ds1/include/conio.h0000755000175000017500000000124610027024007015405 0ustar tygrystygrys/* * Small C+ Library * * conio.h - old apps compatibility * this helps expecially with the kbhit() instruction * it exists on many old compilers; the mingw port has it * on "conio.h", so here it is ! * * stefano - 18/3/2004 * * $Id: conio.h,v 1.1 2004/03/20 11:16:23 stefano Exp $ */ #ifndef __CONIO_H__ #define __CONIO_H__ // this is used by getch, putch and ungetch. #include #define getch() fgetc(stdin) #define getche() getch() // not sure about this one... #define putch(bp,fp) fputc(bp,fp) // #define ungetch(bp) ungetc(bp,stdout) // this one doesn't work #define kbhit() (getk() ? 1 : 0) #endif /* _CONIO_H */ z88dk-1.8.ds1/include/cpm.h0000644000175000017500000001027107500670265015067 0ustar tygrystygrys#ifndef __CPM_H__ #define __CPM_H__ /* * CPM Specific Header File * * Many of these values have been obtained via reference to * Hitech C * * $Id: cpm.h,v 1.5 2002/06/09 15:13:57 dom Exp $ */ #include /* Maximum number of open files. If you want to change this then you * should recompile the CPM library and change the crt0 code to creat * enough space for the the FCBs */ #define MAXFILE 10 /* Whether we want fileio to support devices (default, no), if you * change it then recompile the library */ #if 0 #define DEVICES #endif /* Size of CPM Sector */ #define SECSIZE 128 /* Falgs for fcp->use */ #define U_READ 1 /* file open for reading */ #define U_WRITE 2 /* file open for writing */ #define U_RDWR 3 /* open for read and write */ #define U_CON 4 /* device is console */ #define U_RDR 5 /* device is reader */ #define U_PUN 6 /* device is punch */ #define U_LST 7 /* list device */ #define __STDIO_EOFMARKER 26 /* End of file marker (^Z) */ #define __STDIO_BINARY 1 /* We should consider binary */ struct fcb { u8_t drive; /* drive code */ char name[8]; /* file name */ char ext[3]; /* file type */ u8_t extent; /* file extent */ char filler[2]; /* not used */ char records; /* number of records in present extent */ char discmap[16]; /* CP/M disc map */ char next_record; /* next record to read or write */ u8_t ranrec[3]; /* random record number (24 bit no. ) */ /* Below here is used by the library */ unsigned long rwptr; /* read/write pointer in bytes */ u8_t use; /* use flag */ u8_t uid; /* user id belonging to this file */ }; extern struct fcb _fcb[MAXFILE]; /* BDOS calls */ #define CPM_RCON 1 /* read console */ #define CPM_WCON 2 /* write console */ #define CPM_RRDR 3 /* read reader */ #define CPM_WPUN 4 /* write punch */ #define CPM_WLST 5 /* write list */ #define CPM_DCIO 6 /* direct console I/O */ #define CPM_GIOB 7 /* get I/O byte */ #define CPM_SIOB 8 /* set I/O byte */ #define CPM_RCOB 10 /* read console buffered */ #define CPM_ICON 11 /* interrogate console ready */ #define CPM_VERS 12 /* return version number */ #define CPM_RDS 13 /* reset disk system */ #define CPM_LGIN 14 /* log in and select disk */ #define CPM_OPN 15 /* open file */ #define CPM_CLS 16 /* close file */ #define CPM_FFST 17 /* find first */ #define CPM_FNXT 18 /* find next */ #define CPM_DEL 19 /* delete file */ #define CPM_READ 20 /* read next record */ #define CPM_WRIT 21 /* write next record */ #define CPM_MAKE 22 /* create file */ #define CPM_REN 23 /* rename file */ #define CPM_ILOG 24 /* get bit map of logged in disks */ #define CPM_IDRV 25 /* interrogate drive number */ #define CPM_SDMA 26 /* set DMA address for i/o */ #define CPM_SUID 32 /* set/get user id */ #define CPM_RRAN 33 /* read random record */ #define CPM_WRAN 34 /* write random record */ #define CPM_CFS 35 /* compute file size */ #define CPM_DSEG 51 /* set DMA segment */ /* The CPM bdos call */ extern int __LIB__ bdos(int func,int arg); /* Get a free FCB */ extern struct fcb __LIB__ *getfcb(void); /* Fill up the filename stuff */ extern int __LIB__ setfcb(struct fcb *fc, unsigned char *name); extern void __LIB__ parsefcb(struct fcb *fc, unsigned char *name); /* Write the file offset into the FCB */ extern void __LIB__ putoffset(char *dest, long val); /* Set/get userid */ #define setuid(u) bdos(CPM_SUID,u) #define getuid() bdos(CPM_SUID,0xFF) /* Write an offset as 3 bytes */ extern void __LIB__ _putoffset(unsigned char *where,long offset); /* Mark an FCB as being unused */ #define clearfcb(f) (f)->use = 0 #endif z88dk-1.8.ds1/include/ctype.h0000644000175000017500000000134610546027450015433 0ustar tygrystygrys#ifndef __CTYPE_H__ #define __CTYPE_H__ extern int __LIB__ __FASTCALL__ isalpha(int); extern int __LIB__ __FASTCALL__ isalnum(int); extern int __LIB__ __FASTCALL__ isascii(int); extern int __LIB__ __FASTCALL__ iscntrl(int); extern int __LIB__ __FASTCALL__ isdigit(int); extern int __LIB__ __FASTCALL__ isgraph(int); extern int __LIB__ __FASTCALL__ isupper(int); extern int __LIB__ __FASTCALL__ islower(int); extern int __LIB__ __FASTCALL__ isprint(int); extern int __LIB__ __FASTCALL__ ispunct(int); extern int __LIB__ __FASTCALL__ isspace(int); extern int __LIB__ __FASTCALL__ isxdigit(int); extern int __LIB__ __FASTCALL__ toascii(int); extern int __LIB__ __FASTCALL__ toupper(int); extern int __LIB__ __FASTCALL__ tolower(int); #endif z88dk-1.8.ds1/include/debug.h0000644000175000017500000000123207501075757015401 0ustar tygrystygrys/* * Debugging Routines * * $Id: debug.h,v 1.1 2002/06/10 10:14:07 stefano Exp $ */ #ifndef __DEBUG_H__ #define __DEBUG_H__ #define MYSELF = 0xFFFF /* Disassembles a line; returns the address for the next line if MYSELF, disassembles the current program location */ extern unsigned int __LIB__ disz80(unsigned int address, unsigned int lines); /* Dump on screen: if MYSELF address is given, displays #count stack words and returns the current SP value (dump excluded), otherwise dumps memory bytes and returns the address reached */ extern unsigned int __LIB__ dump(unsigned int address,unsigned int count); #endif z88dk-1.8.ds1/include/dor.h0000644000175000017500000000241607270057010015065 0ustar tygrystygrys/* * Really, really short header file which defines the application * types. * * To make an app do the following: * * #include * * define your config here * * #include * * And with a bit of luck, an application DOR will be created - * hurrah! * * We're quite naughty cos the default is not to redraw the screen * very bad, but we can't avoid this at the moment due to the generic * library routines * * djm 1/4/99 * * $Id: dor.h,v 1.2 2001/04/20 16:04:24 dom Exp $ */ #define AT_Good 1 #define AT_Bad 2 #define AT_Ugly 4 #define AT_Popd 8 #define AT_Ones 16 #define AT_Draw 32 #define AT_Film 64 #define AT_Boot 128 #define AT_Def AT_Bad | AT_Draw #define AT2_Cl 1 #define AT2_Icl 2 #define AT2_Ie 128 /* * Some #defines for menus, these should be orred together * All other bits should be zero, default is 0 */ #define MN_Col 1 #define MN_Hidden 4 #define MN_Safe 8 #define MN_Help 16 #define MN_Def 0 /* * Now for topics! */ #define TP_An 1 #define TP_Inf 2 #define TP_Help 16 #define TP_Def 0 z88dk-1.8.ds1/include/fcntl.h0000644000175000017500000000271010640547666015424 0ustar tygrystygrys/* * Small C+ Library * * fnctl.h - low level file routines * * djm 27/4/99 * * $Id: fcntl.h,v 1.7 2007/06/27 20:59:34 dom Exp $ */ #ifndef __FCNTL_H__ #define __FCNTL_H__ #include #define O_RDONLY 0 #define O_WRONLY 1 #define O_APPEND 256 #define SEEK_SET 0 #define SEEK_CUR 1 #define SEEK_END 2 /* O_BINARY has no significence */ #define O_BINARY 0 typedef int mode_t; extern int __LIB__ open(far char *name, int flags, mode_t mode); extern int __LIB__ creat(far char *name, mode_t mode); extern int __LIB__ close(int fd); extern size_t __LIB__ read(int fd, void *ptr, size_t len); extern size_t __LIB__ write(int fd, void *ptr, size_t len); extern long __LIB__ lseek(int fd,long posn, int whence); extern long __LIB__ tell(int fd); extern int __LIB__ __FASTCALL__ readbyte(int fd); extern int __LIB__ writebyte(int fd, int c); /* Open a file returning the explicit filename, with length len */ extern int __LIB__ open_z88(far char *name, int flags, mode_t mode, char *explicit, size_t len); /* As above except the filename is near - good for ZSock devices (z88)*/ extern int __LIB__ nropen(char *name, int flags, mode_t mode, char *explicit, size_t len); extern int __LIB__ mkdir(char *, int mode); extern char __LIB__ *getcwd(char *buf, size_t maxlen); /* Following two only implemented for Sprinter ATM (20.11.2002) */ extern int __LIB__ rmdir(char *); extern char __LIB__ *getwd(char *buf); #endif /* _FCNTL_H */ z88dk-1.8.ds1/include/float.h0000644000175000017500000000305107721503700015405 0ustar tygrystygrys#ifndef __FLOAT_H__ #define __FLOAT_H__ /* * Some more floating point routines..I can't remember * why these are separated out.. * * $Id: float.h,v 1.7 2003/08/22 21:14:40 dom Exp $ */ extern double __LIB__ fmod(); extern double __LIB__ amax(double,double); extern double __LIB__ fabs(double); extern double __LIB__ amin(double,double); extern double __LIB__ floor(double); extern double __LIB__ ceil(double); extern double __LIB__ fprand(void); /* Generic only */ extern double __LIB__ __FASTCALL__ zfloat(int); extern int __LIB__ fpseed(double); /* Seed random number */ #ifndef _HAVE_ATOF_ #define _HAVE_ATOF_ extern double __LIB__ atof(char *); #endif /* * Some support routines for floating point printf */ extern void __LIB__ ftoa(double, int, char *); extern void __LIB__ ftoe(double, int, char *); /* * Some constant nicked from /usr/include/math.h */ # define M_E 2.7182818284590452354 /* e */ # define M_LOG2E 1.4426950408889634074 /* log_2 e */ # define M_LOG10E 0.43429448190325182765 /* log_10 e */ # define M_LN2 0.69314718055994530942 /* log_e 2 */ # define M_LN10 2.30258509299404568402 /* log_e 10 */ # define M_PI 3.14159265358979323846 /* pi */ # define M_PI_2 1.57079632679489661923 /* pi/2 */ # define M_PI_4 0.78539816339744830962 /* pi/4 */ # define M_1_PI 0.31830988618379067154 /* 1/pi */ # define M_2_PI 0.63661977236758134308 /* 2/pi */ # define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ # define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ # define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #endif z88dk-1.8.ds1/include/games.h0000644000175000017500000000405010725024476015402 0ustar tygrystygrys#ifndef __GAMES_H__ #define __GAMES_H__ /* * Videogames support code * * Stefano, Jan 2001 * * $Id: games.h,v 1.8 2007/12/03 16:05:18 stefano Exp $ * */ /* save the sprite background in another sprite */ extern __LIB__ bksave(int x, int y, void *sprite); extern __LIB__ bkrestore(void *sprite); /* pick up a sprite directly from the screen */ extern __LIB__ getsprite(int x, int y, void *sprite); // This isn't still finished /* draw a sprite of variable size */ extern __LIB__ putsprite(int ortype, int x, int y, void *sprite); #define spr_and 166+47*256 // CPL - AND (HL) #define spr_or 182 // OR (HL) #define spr_xor 174 // XOR (HL) #define spr_mask spr_and #define SPR_AND spr_and #define SPR_OR spr_or #define SPR_XOR spr_xor #define SPR_MASK spr_and /* Joystick (or whatever game device) control function */ extern __LIB__ joystick(int game_device); #define MOVE_RIGHT 1 #define MOVE_LEFT 2 #define MOVE_DOWN 4 #define MOVE_UP 8 #define MOVE_FIRE 16 #define MOVE_FIRE1 MOVE_FIRE #define MOVE_FIRE2 32 #define MOVE_FIRE3 64 #define MOVE_FIRE4 128 #ifdef SPECTRUM unsigned char *joystick_type[] = {"Kempston","Sinclair 1","Sinclair 2","Cursor","Fuller"}; #define GAME_DEVICES 5 #endif #ifdef TI82 unsigned char *joystick_type[] = {"Cursor,2nd-Alpha"}; #define GAME_DEVICES 1 #endif #ifdef TI83 unsigned char *joystick_type[] = {"Cursor,2nd-Alpha"}; #define GAME_DEVICES 1 #endif #ifdef TI85 unsigned char *joystick_type[] = {"Cursor,2nd-Alpha"}; #define GAME_DEVICES 1 #endif #ifdef TI86 unsigned char *joystick_type[] = {"Cursor,2nd-Alpha"}; #define GAME_DEVICES 1 #endif #ifdef ZXVGS unsigned char *joystick_type[] = { "Joystick 0", "Joystick 1", "Joystick 2", "Joystick 3"}; #define GAME_DEVICES 4 #endif #ifdef MSX unsigned char *joystick_type[] = { "QAOP-MN", "Joystick 1", "Joystick 2"}; #define GAME_DEVICES 3 #endif #ifndef GAME_DEVICES unsigned char *joystick_type[] = {"QAOP-MN","8246-05"}; #define GAME_DEVICES 2 #endif #endif z88dk-1.8.ds1/include/graphics.h0000644000175000017500000000462310661324041016102 0ustar tygrystygrys/* * Graphics Routines * * Since no one actually used these routines I've taken it upon * myself to rewrite the entry conditions so that they are actually * useful and easy to use (hurrah!) * * djm 12/4/2000 * * Stefano has converted many of these routines to the new ports * Some will work, some will not. djm 6/6/2000 * * $Id: graphics.h,v 1.6 2007/08/17 13:52:33 stefano Exp $ */ #ifndef __GFX_H__ #define __GFX_H__ /* Structure to use when opening a window - as per usual, if graph <> 0 * then open graphics window number with width (pixels) width */ struct window { char number; char x; char y; char width; char depth; char type; char graph; } ; /* Fills an area */ extern __LIB__ fill(int x, int y); /* Plot a pixel to screen */ extern __LIB__ plot(int x, int y); /* Unplot a pixel */ extern __LIB__ unplot(int x, int y); /* XORs a pixel on screen */ extern __LIB__ xorplot(int x, int y); /* Get pixel status */ extern __LIB__ point(int x, int y); /* Get horizontal or vertical pixel bar, up to 16 pixel long */ extern __LIB__ multipoint(int hv, int length, int x, int y); /* Draw a line */ extern __LIB__ draw(int x1, int y1, int x2, int y2); /* Remove a line */ extern __LIB__ undraw(int x1, int y1, int x2, int y2); /* Relative draw */ extern __LIB__ drawr(int px, int py); /* Remove a relative draw */ extern __LIB__ undrawr(int px, int py); /* Draw a box */ extern __LIB__ drawb(int tlx, int tly, int width, int height); /* Undraw a box */ extern __LIB__ undrawb(int tlx, int tly, int width, int height); /* Draw a dotted border */ extern __LIB__ xorborder(int tlx, int tly, int width, int height); /* Draw a circle */ extern __LIB__ circle(int x, int y, int radius, int skip); /* Undraw a circle */ extern __LIB__ uncircle(int x, int y, int radius, int skip); /* Clear map */ extern __LIB__ clg(void); /* Clear area of map */ extern __LIB__ clga(int tlx, int tly, int width, int height); #ifndef SPECTRUM /* Open a z88 window..either graphics or text */ extern __LIB__ window(struct window *); /* Scroll map left by one pixel */ extern __LIB__ lscroll(int x, int y, int width, int height, int pixels); /* Scroll map right by one pixel (unwritten) */ extern __LIB__ rscroll(int x, int y, int width, int height, int pixels); /* Close the map */ extern __LIB__ closegfx(struct window *); #endif #endif z88dk-1.8.ds1/include/gray.h0000644000175000017500000000170607363076307015261 0ustar tygrystygrys#ifndef __GRAY_H__ #define __GRAY_H__ /* * Gray Library. Originally written for TI calcs but * hopefully it will grow in the future... * * $Id: gray.h,v 1.4 2001/10/16 18:30:31 dom Exp $ */ #pragma output GRAYlib #define G_BLACK 0 #define G_DARK 1 #define G_GRAY 2 #define G_LIGHT 2 #define G_WHITE 3 /* Select actual gray page for the standard gfx funtions */ extern __LIB__ g_page(int page); /* Plot a pixel to screen */ extern __LIB__ g_plot(int x, int y, int GrayLevel); /* Get pixel status */ extern __LIB__ g_point(int x, int y); /* Draw a line */ extern __LIB__ g_draw(int x1, int y1, int x2, int y2, int GrayLevel); /* Relative draw */ extern __LIB__ g_drawr(int px, int py, int GrayLevel); /* Draw a box */ extern __LIB__ g_drawb(int tlx, int tly, int width, int height, int GrayLevel); /* Draw a circle */ extern __LIB__ g_circle(int x, int y, int radius, int skip, int GrayLevel); /* Clear map */ extern __LIB__ g_clg(int GrayLevel); #endif z88dk-1.8.ds1/include/gui.h0000644000175000017500000001005207461464606015077 0ustar tygrystygrys/* gui.h - simple GUI functions */ #ifndef __GUI_H__ #define __GUI_H__ #include "gui.h" #include "malloc.h" #include "stdio.h" #include "graphics.h" #ifdef ALTGUI #include "games.h" #endif #define WIN_BORDER 1 #define WIN_LITE_BORDER 2 #define WIN_SHADOW 4 #define win_border WIN_BORDER #define win_lite_border WIN_LITE_BORDER #define win_shadow WIN_SHADOW struct gui_win { char *back; char x; char y; char width; char height; char flags; }; #ifdef ALTGUI char topleft[] = { 4,4, 0x30, 0x40, 0x80, 0x80 }; char topleft_mask[] = { 4,4, 0x30, 0x70, 0xF0, 0xF0 }; char topright[] = { 4,4, 0xC0, 0x20, 0x10, 0x10 }; char topright_mask[] = { 4,4, 0xC0, 0xE0, 0xF0, 0xF0 }; char bottomleft[] = { 4,4, 0x80, 0x80, 0x40, 0x30 }; char bottomleft_mask[] = { 4,4, 0xF0, 0xF0, 0x70, 0x30 }; char bottomright[] = { 4,4, 0x10, 0x10, 0x20, 0xC0 }; char bottomright_mask[] = { 4,4, 0xF0, 0xF0, 0xE0, 0xC0 }; #endif win_open(struct gui_win win) { int x; win->back=malloc( 4+(win->width/8+1 + (win->flags & WIN_SHADOW)) * (win->height+(win->flags & WIN_SHADOW)) ); sprintf(win->back, "%c%c",win->width+(win->flags & WIN_SHADOW),win->height+(win->flags & WIN_SHADOW) ); bksave(win->x,win->y,win->back); #ifdef ALTGUI if ((win->flags & WIN_SHADOW) > 0) { putsprite(spr_or,win->x+win->width-2,win->y+5,topright_mask); putsprite(spr_or,win->x+win->width-2,win->y+win->height-2,bottomright_mask); putsprite(spr_or,win->x+5,win->y+win->height-2,bottomleft_mask); for (x=-1; x<4; x++) { //horizontal shadow draw(win->x+9,win->y+win->height-1+x,win->x+win->width-3,win->y+win->height-1+x); //vertical shadow draw(win->x+win->width-1+x,win->y+9,win->x+win->width-1+x,win->y+win->height-3); } } clga(win->x, win->y+5, win->width, win->height-10); clga(win->x+5, win->y, win->width-10, win->height); putsprite(spr_mask,win->x+1,win->y+1,topleft_mask); putsprite(spr_or,win->x+1,win->y+1,topleft); putsprite(spr_mask,win->x+win->width-5,win->y+1,topright_mask); putsprite(spr_or,win->x+win->width-5,win->y+1,topright); putsprite(spr_mask,win->x+1,win->y+win->height-5,bottomleft_mask); putsprite(spr_or,win->x+1,win->y+win->height-5,bottomleft); putsprite(spr_mask,win->x+win->width-5,win->y+win->height-5,bottomright_mask); putsprite(spr_or,win->x+win->width-5,win->y+win->height-5,bottomright); draw(win->x+5,win->y,win->x+win->width-6,win->y); draw(win->x+5,win->y+win->height-1,win->x+win->width-6,win->y+win->height-1); draw(win->x,win->y+5,win->x,win->y+win->height-6); draw(win->x+win->width-1,win->y+5,win->x+win->width-1,win->y+win->height-6); //xorborder(win->x, win->y, win->width, win->height); //draw(win->x,win->y+5,win->x,win->y-10); //draw(win->x,win->y+5,win->x,win->y-10); #else if ((win->flags & WIN_SHADOW) > 0) { for (x=1; x<4; x++) drawb (win->x+4,win->y+4,win->width-x,win->height-x); } clga(win->x, win->y, win->width, win->height); if ((win->flags & WIN_BORDER) > 0) drawb(win->x, win->y, win->width, win->height); if ((win->flags & WIN_LITE_BORDER) > 0) xorborder(win->x, win->y, win->width, win->height); #endif } win_close(struct gui_win win) { bkrestore(win->back); free(win->back); } // This is still broken win_move(int x, int y, struct gui_win win) { char *winsave; winsave=malloc( 2+(win->width/8+1 + (win->flags & WIN_SHADOW)) * (win->height+(win->flags & WIN_SHADOW)) ); sprintf(winsave, "%c%c",win->width+(win->flags & WIN_SHADOW),win->height+(win->flags & WIN_SHADOW) ); getsprite(win->x,win->y,winsave); bkrestore(win->back); free(win->back); //win->x=x; win->y=y; //win_open(win); //putsprite(x,y,winsave); free(winsave); } #endif z88dk-1.8.ds1/include/im2.h0000644000175000017500000000463010756163361015002 0ustar tygrystygrys#ifndef _IM2_H #define _IM2_H /* * IM2 Interrupt Library * 04.2004, 11.2006, 02.2008 aralbrec * */ #include #define M_BEGIN_ISR(name) void name(void) { asm("push\taf\npush\tbc\npush\tde\npush\thl\nex\taf,af\nexx\npush\taf\npush\tbc\npush\tde\npush\thl\npush\tix\npush\tiy\n"); #define M_END_ISR asm("pop\tiy\npop\tix\npop\thl\npop\tde\npop\tbc\npop\taf\nexx\nex\taf,af\npop\thl\npop\tde\npop\tbc\npop\taf\nei\nreti\n"); } #define M_BEGIN_ISR_LIGHT(name) void name(void) { asm("push\taf\npush\tbc\npush\tde\npush\thl\n"); #define M_END_ISR_LIGHT asm("pop\thl\npop\tde\npop\tbc\npop\taf\nei\nreti\n"); } /* * In the following: * * void *isr <=> void (*isr)(void) * void *hook <=> void (*hook)(void) +++ * * +++ if the carry flag is set at exit, succeeding hooks * on a particular interrupt will not be executed. */ extern void __LIB__ __FASTCALL__ im2_Init(void *tableaddr); /* * tableaddr = 16-bit address of the interrupt vector table, LSB ignored * and assumed to be zero. */ extern void __LIB__ *im2_InstallISR(uchar vector, void *isr); extern void __LIB__ im2_EmptyISR(void); extern void __LIB__ *im2_CreateGenericISR(uchar numhooks /* >=1 */, void *addr); extern void __LIB__ *im2_CreateGenericISRLight(uchar numhooks /* >=1 */, void *addr); extern void __LIB__ im2_RegHookFirst(uchar vector, void *hook); extern void __LIB__ im2_RegHookLast(uchar vector, void *hook); extern int __LIB__ im2_RemoveHook(uchar vector, void *hook); extern void __LIB__ __CALLEE__ *im2_InstallISR_callee(uchar vector, void *isr); extern void __LIB__ __CALLEE__ *im2_CreateGenericISR_callee(uchar numhooks, void *addr); extern void __LIB__ __CALLEE__ *im2_CreateGenericISRLight_callee(uchar numhooks, void *addr); extern void __LIB__ __CALLEE__ im2_RegHookFirst_callee(uchar vector, void *hook); extern void __LIB__ __CALLEE__ im2_RegHookLast_callee(uchar vector, void *hook); extern int __LIB__ __CALLEE__ im2_RemoveHook_callee(uchar vector, void *hook); #define im2_InstallISR(a,b) im2_InstallISR_callee(a,b) #define im2_CreateGenericISR(a,b) im2_CreateGenericISR_callee(a,b) #define im2_CreateGenericISRLight(a,b) im2_CreateGenericISRLight_callee(a,b) #define im2_RegHooKFirst(a,b) im2_RegHookFirst_callee(a,b) #define im2_RegHookLast(a,b) im2_RegHookLast_callee(a,b) #define im2_RemoveHook(a,b) im2_RemoveHook_callee(a,b) #endif z88dk-1.8.ds1/include/input.h0000644000175000017500000002570110763607556015463 0ustar tygrystygrys#ifndef _INPUT_H #define _INPUT_H /* * Functions for Reading Keyboards, Joysticks and Mice */ #include /* * 1. KEYBOARD * * Every port must implement all of the following: * * uint in_GetKey(void) * Returns ascii code representing a single key press or zero * if no/too many keys pressed. Must implement key debounce, * key start repeat and key repeat (below). * * void in_GetKeyReset(void) * Resets the in_GetKey state machine. * * uint in_Inkey(void) * Returns ascii code representing a single key press or zero * if no/too many keys pressed. Reflects the instantaneous * state of the keyboard. * * uint in_KeyPressed(uint scancode) * Accepts a 16-bit scancode, returned by in_LookupKey, that * identifies a specific key. Returns non-zero if the key * is pressed and zero if it is not. Intended to operate * correctly if many keys are simultaneously pressed. * * uint in_LookupKey(uchar c) * Given the ascii code of a character, returns a 16-bit * scancode that identifies a key or key combination that * must be pressed in order to generate the ascii code. * If no key combination can generate the code, 0 is returned. * The scancode is used by in_KeyPressed and in_JoyKeyboard * to scan the keyboard. * * uint in_Pause(uint msec) * Pause for a period of time measured in milliseconds. * Return early if a key is pressed, reporting the amount of * time remaining. This must be a busy wait interval; resist * the use of interrupts to keep the function useful even * with interrupts disabled. If msec==0 wait until key * is pressed. * * void in_Wait(unit msec) * Similar to in_Pause but waits the entire period. * * void in_WaitForKey(void) * Wait until any key is pressed. * * void in_WaitForNoKey(void) * Wait until no keys are pressed. * * * If your program uses the in_GetKey function you must declare * the following variables: * * uchar in_KeyDebounce; * Number of ticks before a keypress is acknowledged. * Set to 1 for no debouncing. * * uchar in_KeyStartRepeat; * Number of ticks after debounce before a key starts repeating. * * uchar in_KeyRepeatPeriod; * Repeat key rate measured in ticks. * * uint in_KbdState; * Reserved variable (don't alter, only declare). * * A tick in this context is the rate at which in_GetKey() is called. * * Declaring these C variables statically will cause them to * be compiled as part of the final binary. Alternatively (required * if the final binary is to be ROMable) the locations of these * variables in RAM can be specified using special extern syntax. * * Example: * * extern char in_KeyDebounce(50000); * extern char in_KeyStartRepeat(50001); * extern char in_KeyRepeatPeriod(50002); * extern int in_KbdState(50003); */ extern uint __LIB__ in_GetKey(void); extern void __LIB__ in_GetKeyReset(void); extern uint __LIB__ in_Inkey(void); extern uint __LIB__ __FASTCALL__ in_KeyPressed(uint scancode); extern uint __LIB__ __FASTCALL__ in_LookupKey(uchar c); extern uint __LIB__ __FASTCALL__ in_Pause(uint msec); extern void __LIB__ __FASTCALL__ in_Wait(uint msec); extern void __LIB__ in_WaitForKey(void); extern void __LIB__ in_WaitForNoKey(void); /* * 2. JOYSTICK * * All joystick functions return a single byte in the format * F000RLDU (active high) to indicate state of directions and * fire button. Do not assume that any directions are * mutually exclusive as on traditional joysticks (ie up and * down cannot normally be simultaneously asserted) since * joysticks may be simulated by other devices on certain * machines. * * Every port must provide at minimum: * * - in_JoyKeyboard, a keyboard joystick with user-definable * keys for directions and fire button. * * Protoypes for platform-specific joystick functions are * included from the target machine's implementation * dependent header file (eg spectrum.h for the zx spectrum) * but are also listed in the comments below. * * It is possible to use a function pointer to use one of * a number of joystick functions selected by the user from * a menu since all joystick functions can accept the * same parameter and return a value in the same format. * * Example using Sinclair Spectrum joystick functions: * * uchar choice, dirs; * void *joyfunc; * pointer to joystick function * * char *joynames[]; * an array of joystick names * * struct in_UDK k; * * k.fire = in_LookupKey('m'); * fill in keys for key joystick * * k.left = in_LookupKey('o'); * in case it is chosen * * (etc) * ... * printf("You have selected the %s joystick\n", joynames[choice]); * switch (choice) { * case 0 : joyfunc = in_JoyKeyboard; break; * case 1 : joyfunc = in_JoyKempston; break; * case 2 : joyfunc = in_JoySinclair1; break; * default: joyfunc = in_JoySinclair2; break; * } * ... * dirs = (joyfunc)(&k); * if (dirs & in_FIRE) * printf("pressed fire!\n"); * * None of the joystick functions expect a parameter with the * exception of in_JoyKeyboard. Therefore the joystick function * call through the pointer should always be made with the parameter * expected by in_JoyKeyboard. The other joystick functions will * simply ignore it. * */ #define in_FIRE 0x80 #define in_UP 0x01 #define in_DOWN 0x02 #define in_LEFT 0x04 #define in_RIGHT 0x08 #define in_FIRE1 0x80 #define in_FIRE2 0x40 /* not currently used */ struct in_UDK { /* user defined keys structure */ uint fire; /* these are 16-bit scancodes returned */ uint right; /* by in_LookupKey() that should be */ uint left; /* populated by the programmer */ uint down; uint up; }; extern uint __LIB__ __FASTCALL__ in_JoyKeyboard(struct in_UDK *u); #ifdef SPECTRUM #include /* Adds: 1 in_JoyKempston, 2 in_JoySinclair1, 3 in_JoySinclair2, 4 in_JoyFuller, 5 in_JoyTimex1, 6 in_JoyTimex2 */ #endif /* * 3. MOUSE * * Each mouse supported must implement at minimum three functions: * * void in_MouseNAMEInit(void) * Initializes the mouse by setting coordinates to (0,0) and performing * any hw initialization. (0,0) is located at the top left corner of the * screen * * void in_MouseNAME(uchar *buttons, uint *xcoord, uint *ycoord) * Read the mouse, returning single byte 00000MRL active high for buttons + * 16-bit X and Y coords for current mouse position * * void in_MouseNAMESetPos(uint xcoord, uint ycoord) * Move the mouse's position to given (x,y) coord * * Functions should handle out of bounds (X,Y) coords gracefully. Each port * defines macros IN_MAX_X and IN_MAX_Y to indicate maximum X and Y values. * * Every port must implement the simulated mouse which attempts * to simulate a mouse using a connected joystick: * * - in_MouseSimInit * - in_MouseSim * - in_MouseSimSetPos * * Protoypes for platform-specific mouse functions are * included from the target machine's implementation * dependent header file (eg spectrum.h for the zx spectrum) * and are listed in comments below. * * As with the joystick functions, it is possible to use * function pointers to use one of a number of mice selected * by the user from a menu. * * Example using Sinclair Spectrum mice: * * uchar choice, b; * void *mouseinit, *mouseread, *mousesetpos; * void **mousefunc; * void *mousename[]; * struct in_UDM m; * struct in_UDK k; * uint x, y; * struct in_MD deltas[] = { * 3,0x10,0x10, * 3 times one pixel move * * 3,0x20,0x20, * 3 times two pixel move * * 5,0x40,0x40, * 5 times four pixel move * * 255,0x80,0x80 * forever eight pixel move * * }; * * k.fire = in_LookupKey('m'); * fill in keys for key joystick * * k.left = in_LookupKey('o'); * in case it is needed * * (etc) * ... * m.keys = &k; * m.joyfunc = in_JoyKeyboard; * simulated mouse will use key joystick * * m.delta = deltas; * acceleration profile * * ... * printf("You have selected the %s mouse\n", mousename[choice]); * switch (choice) { * case 0 : mouseinit = in_MouseSimInit; * mousesetpos = in_MouseSimSetPos; * mouseread = in_MouseSim; * break; * case 1 : mouseinit = in_MouseAMXInit2; * mousesetpos = in_MouseAMXSetPos; * mouseread = in_MouseAMX; * break; * default: mouseinit = in_MouseKempInit; * mousesetpos = in_MouseKempSetPos; * mouseread = in_MouseKemp; * break; * } * * (mouseinit)(&m); * ... * (mouseread)(&m, &b, &x, &y); * if (b & in_BUT1) * printf("button pressed at coord (%d,%d)!\n", x, y); * */ #define in_MLEFT 0x01 #define in_MRIGHT 0x02 #define in_MMID 0x04 #define in_BUT1 0x01 #define in_BUT2 0x02 #define in_BUT3 0x04 struct in_MD { /* mouse deltas for struct in_UDM */ uchar maxcount; /* number of times to use this mouse delta */ uint dx; /* x += dx if mouse moved in horizontal dir */ uint dy; /* y += dy if mouse moved in vertical dir */ }; struct in_UDM { /* user defined mouse structure */ struct in_UDK *keys; /* parameter if in_JoyKeyboard() is used else ignored */ void *joyfunc; /* joystick function for reading input */ struct in_MD **delta; /* pointer to array of in_MD; last max count must be 255 */ uchar state; /* current index into delta array */ uchar count; /* current count */ uint y; /* current (x,y) coordinate, fixed point */ uint x; }; extern void __LIB__ in_MouseSimInit(struct in_UDM *u); extern void __LIB__ in_MouseSim(struct in_UDM *u, uchar *buttons, uint *xcoord, uint *ycoord); extern void __LIB__ in_MouseSimSetPos(struct in_UDM *u, uint xcoord, uint ycoord); extern void __LIB__ __FASTCALL__ in_MouseSimInit_fastcall(struct in_UDM *u); extern void __LIB__ __CALLEE__ in_MouseSim_callee(struct in_UDM *u, uchar *buttons, uint *xcoord, uint *ycoord); extern void __LIB__ __CALLEE__ in_MouseSimSetPos_callee(struct in_UDM *u, uint xcoord, uint ycoord); #define in_MouseSimInit(a) in_MouseSimInit_fastcall(a) #define in_MouseSim(a,b,c,d) in_MouseSim_callee(a,b,c,d) #define in_MouseSimSetPos(a,b,c) in_MouseSimSetPos_callee(a,b,c) #ifdef SPECTRUM #define IN_MAX_X 255 /* largest x coord */ #define IN_MAX_Y 191 /* largest y coord */ #include /* Adds: 1 in_MouseKempInit, in_MouseKemp, in_MouseKempSetPos 2 in_MouseAMXInit, in_MouseAMXInit2, in_MouseAMX, in_MouseAMXSetPos Both the AMX mouse and the Kempston mouse require variables to be declared, see spectrum.h for details. */ #endif #endif z88dk-1.8.ds1/include/iso646.h0000644000175000017500000000055307363076307015350 0ustar tygrystygrys/* * Standard library for z88dk * * A concession to ISO C * * $Id: iso646.h,v 1.3 2001/10/16 18:30:31 dom Exp $ */ #ifndef __ISO646_H__ #define __ISO646_H__ #define and && #define and_eq &= #define bitand & #define bitor | #define compl ~ #define not ! #define not_eq != #define or || #define or_eq |= #define xor ^ #define xor_eq ^= #endif z88dk-1.8.ds1/include/lib3d.h0000755000175000017500000000214407747723147015323 0ustar tygrystygrys/* lib3d.h Structs for standard Wizard 3d and 4d math functions Copyright 2002, Mark Hamilton */ #define PI 3.14159265358979 typedef struct { int x, y, z; } Vector_t; typedef struct { int x, y; } Point_t; typedef struct { int pitch, roll, yaw; int x, y, z; } Cam_t; /* protos */ extern __LIB__ ozrotatepointx(Vector_t *v, int rot); extern __LIB__ ozrotatepointy(Vector_t *v, int rot); extern __LIB__ ozrotatepointz(Vector_t *v, int rot); extern __LIB__ ozplotpointcam(Vector_t *v, Cam_t *c, Point_t *p); extern __LIB__ ozplotpoint(Vector_t *v, Point_t *p); extern __LIB__ ozcopyvector(Vector_t *dest, Vector_t *src); extern __LIB__ oztranslatevector(Vector_t *v, Vector_t *offset); /* Integer sin functions taken from the lib3d library, OZ7xx DK by Hamilton, Green and Pruss isin and icos return a value from -16384 to +16384 */ extern int __LIB__ isin(unsigned degrees); /* input must be between 0 and 360 */ extern int __LIB__ icos(unsigned degrees); /* input must be between 0 and 360 */ extern int __LIB__ div16384(long value); /* divide by 16384 */ z88dk-1.8.ds1/include/limits.h0000644000175000017500000000075207433560117015613 0ustar tygrystygrys#ifndef __LIMITS_H__ #define __LIMITS_H__ /* $Id: limits.h,v 1.4 2002/02/16 22:42:23 dom Exp $ */ #define CHAR_BIT 8 #define INT_MAX 32767 #define INT_MIN (-32768) #define LONG_MAX 2147483647L #define LONG_MIN (-2147483648L) #define SCHAR_MAX 127 #define SCHAR_MIN (-128) #define CHAR_MAX SCHAR_MAX #define CHAR_MIN SCHAR_MIN #define SHRT_MAX 32767 #define SHRT_MIN (-32768) #define UCHAR_MAX 255U #define UINT_MAX 65535U #define ULONG_MAX 4294967295LU #define USHRT_MAX 65535U #endif z88dk-1.8.ds1/include/malloc.h0000644000175000017500000001364710633631502015561 0ustar tygrystygrys#ifndef __MALLOC_H__ #define __MALLOC_H__ /* * Now some trickery to link in the correct routines for far * * $Id: malloc.h,v 1.11 2007/06/12 23:58:58 aralbrec Exp $ */ #ifndef FARDATA // The Near Malloc Library is still a simple first // fit linear search of a list of free blocks. The // list of free blocks is kept sorted by address so // that merging of adjacent blocks can occur. // // The block memory allocator (balloc.lib) is an // alternative for allocating blocks of fixed size. // Its main advantage is that it is very quick O(1) // in comparison to the O(N) of this library. // // Space must be declared to hold the process's // standard heap: // // long heap; // // An alternative is to reserve four bytes // in RAM at address xxxx using: // // extern long heap(xxxx); // // The heap must be initialized to empty with a // call to mallinit() or by setting heap=0L. // Then available memory must be added by one or // more calls to sbrk() as in: // // mallinit(); /* heap = 0L; is an alternative */ // sbrk(50000,4000); /* add 4000 bytes from 50000-53999 inclusive */ // sbrk(25000,126); /* add 126 bytes from 25000-25125 inclusive */ // a = malloc(100); extern void __LIB__ mallinit(void); extern void __LIB__ sbrk(void *addr, unsigned int size); extern void __LIB__ __CALLEE__ sbrk_callee(void *addr, unsigned int size); extern void __LIB__ *calloc(unsigned int nobj, unsigned int size); extern void __LIB__ __CALLEE__ *calloc_callee(unsigned int nobj, unsigned int size); extern void __LIB__ __FASTCALL__ free(void *addr); extern void __LIB__ __FASTCALL__ *malloc(unsigned int size); extern void __LIB__ *realloc(void *p, unsigned int size); extern void __LIB__ __CALLEE__ *realloc_callee(void *p, unsigned int size); extern void __LIB__ mallinfo(unsigned int *total, unsigned int *largest); extern void __LIB__ __CALLEE__ mallinfo_callee(unsigned int *total, unsigned int *largest); #define sbrk(a,b) sbrk_callee(a,b) #define calloc(a,b) calloc_callee(a,b) #define realloc(a,b) realloc_callee(a,b) #define mallinfo(a,b) mallinfo_callee(a,b) // The following is to allow programs using the // older version of the near malloc library to // continue to work #define HEAPSIZE(bp) unsigned char heap[bp+4]; #define heapinit(a) mallinit(); sbrk_callee(heap+4,a); #define getfree() asm("LIB\tMAHeapInfo\nXREF\t_heap\nld\thl,_heap\ncall\tMAHeapInfo\nex\tde,hl\n"); #define getlarge() asm("LIB\tMAHeapInfo\nXREF\t_heap\nld\thl,_heap\ncall\tMAHeapInfo\nld\tl,c\nld\th,b\n"); #define realloc_down(a,b) realloc_callee(a,b); // Named Heap Functions // // The near malloc library supports multiple independent // heaps; by referring to one by name, allocation // and deallocation can be performed from a specific heap. // // To create a new heap, simply declare a long to hold // the heap's pointer as in: // // long myheap; // // or, to place in RAM at specific address xxxx: // // extern long myheap(xxxx); // // Heaps must be initialized to empty with a call to // HeapCreate() or by setting them =0L (myheap=0L; eg). // Then available memory must be added to the heap // with one or more calls to HeapSbrk(): // // HeapCreate(&myheap); /* myheap = 0L; */ // HeapSbrk(&myheap, 50000, 5000); /* add memory to heap */ // a = HeapAlloc(&myheap, 14); // // The main intent of multiple heaps is to allow various // heaps to be valid in different memory configurations, allowing // program segments to get valid near memory while different // memory configurations are active. // // The stdlib functions implicitly use the heap named "heap". // So, for example, a call to HeapAlloc(heap,size) is equivalent // to a call to malloc(size). extern void __LIB__ __FASTCALL__ HeapCreate(void *heap); extern void __LIB__ HeapSbrk(void *heap, void *addr, unsigned int size); extern void __LIB__ __CALLEE__ HeapSbrk_callee(void *heap, void *addr, unsigned int size); extern void __LIB__ *HeapCalloc(void *heap, unsigned int nobj, unsigned int size); extern void __LIB__ __CALLEE__ *HeapCalloc_callee(void *heap, unsigned int nobj, unsigned int size); extern void __LIB__ HeapFree(void *heap, void *addr); extern void __LIB__ __CALLEE__ HeapFree_callee(void *heap, void *addr); extern void __LIB__ *HeapAlloc(void *heap, unsigned int size); extern void __LIB__ __CALLEE__ *HeapAlloc_callee(void *heap, unsigned int size); extern void __LIB__ *HeapRealloc(void *heap, void *p, unsigned int size); extern void __LIB__ __CALLEE__ *HeapRealloc_callee(void *heap, void *p, unsigned int size); extern void __LIB__ HeapInfo(unsigned int *total, unsigned int *largest, void *heap); extern void __LIB__ __CALLEE__ HeapInfo_callee(unsigned int *total, unsigned int *largest, void *heap); #define HeapSbrk(a,b,c) HeapSbrk_callee(a,b,c) #define HeapCalloc(a,b,c) HeapCalloc_callee(a,b,c) #define HeapFree(a,b) HeapFree_callee(a,b) #define HeapAlloc(a,b) HeapAlloc_callee(a,b) #define HeapRealloc(a,b,c) HeapRealloc_callee(a,b,c) #define HeapInfo(a,b,c) HeapInfo_callee(a,b,c) #else /* * Now some definitions for far functions */ #define calloc(a,b) calloc_far(a,b) #define malloc(a) malloc_far(a) #define free(a) free_far(a) // realloc, sbrk, mallinit, mallinfo not implemented in far lib #define realloc(a,b) #define sbrk(a,b) heapinit_far(b) #define mallinit() #define mallinfo(a,b) // these are for compatibility with the older version of the near malloc lib #define HEAPSIZE(bp) #define getfree() #define getlarge() #define heapinit(a) heapinit_far(a) extern far void __LIB__ *calloc_far(int, int); extern far void __LIB__ *malloc_far(long); extern void __LIB__ free_far(far void *); extern void __LIB__ freeall_far(); /* Create the correct memory spec */ #ifdef MAKE_PACKAGE #pragma output far_mmset #endif #endif /* FARDATA */ #endif /* _MALLOC_H */ z88dk-1.8.ds1/include/math.h0000644000175000017500000000266007730045423015241 0ustar tygrystygrys#ifndef __MATH_H__ #define __MATH_H__ /* $Id: math.h,v 1.9 2003/09/11 10:14:43 dom Exp $ */ extern double __LIB__ acos(double); /* arc cosine */ extern double __LIB__ asin(double); /* arc cosine */ extern double __LIB__ atan(double); /* arc tangent */ extern double __LIB__ atan2(double,double); /* atan2(a,b) = arc tangent of a/b */ extern double __LIB__ cos(double); /* cosine */ extern double __LIB__ cosh(double); /* hyperbolic cosine */ extern double __LIB__ exp(double); /* exponential */ extern double __LIB__ log(double); /* natural logarithm */ extern double __LIB__ log10(double); /* log base 10 */ extern double __LIB__ pow(double,double); /* pow(x,y) = x**y */ extern double __LIB__ sin(double); /* sine */ extern double __LIB__ sinh(double); /* hyperbolic sine */ extern double __LIB__ sqrt(double); /* square root */ extern double __LIB__ tan(double); /* tangent */ extern double __LIB__ tanh(double); /* hyperbolic tangent */ #ifndef _HAVE_ATOF_ #define _HAVE_ATOF_ extern double __LIB__ atof(char *); #endif /* Some additional CPC only routines now */ #if __CPC__ && __NATIVE_MATH__ #define _LIBRARY_POW10 extern double __LIB__ pow10(int x); /* pow(10,x) - CPC only */ extern void __LIB__ deg(); extern void __LIB__ rad(); extern double __LIB__ pi(); #endif #if __Z88__ && __NATIVE_MATH__ extern double __LIB__ pi(); #endif #ifndef _LIBRARY_POW10 #define pow10(x) pow(10.,x) #endif #endif /* _MATH_H */ z88dk-1.8.ds1/include/msx.h0000755000175000017500000000376210731744165015132 0ustar tygrystygrys/* * Headerfile for MSX specific stuff * * $Id: msx.h,v 1.4 2007/12/18 13:17:41 stefano Exp $ */ #ifndef __MSX_H__ #define __MSX_H__ #include // PSG register, sound, ... // Init the PSG (reset sound etc..) extern void __LIB__ msx_initpsg(); // Play a sound by PSG extern void __LIB__ msx_sound(int reg, int val); // Reat the PSG register extern int __LIB__ __FASTCALL__ msx_readpsg(int regno); // Video related functions // Set the screen mode extern void __LIB__ __FASTCALL__ msx_screen(int mode); // Get the screen mode extern int __LIB__ msx_screenmode(); // VRAM read extern int __LIB__ __FASTCALL__ msx_vpeek(int address); // VRAM write extern void __LIB__ msx_vpoke(int address, int value); // Switch to text mode extern void __LIB__ msx_text(); // Disable screen extern void __LIB__ msx_blank(); // Enable screen extern void __LIB__ msx_noblank(); // Change the MSX color attributes extern int __LIB__ msx_color(int foreground, int background, int border); #define TRANSPARENT 0x00 #define BLACK 0x01 #define MEDIUM_GREEN 0x02 #define LIGHT_GREEN 0x03 #define DARK_BLUE 0x04 #define LIGHT_BLUE 0x05 #define DARK_RED 0x06 #define CYAN 0x07 #define MEDIUM_RED 0x08 #define LIGHT_RED 0x09 #define DARK_YELLOW 0x0A #define LIGHT_YELLOW 0x0B #define DARK_GREEN 0x0C #define MAGENTA 0x0D #define GRAY 0x0E #define WHITE 0x0F // Misc functions // Check if MSX 1 or MSX 2 extern int __LIB__ msx_type(); // Detect the VRAM size (in KB) extern int __LIB__ msx_vram(); // Check if the line printer is ready (1=ready, 0 if not) extern int __LIB__ msx_lpt(); // Check if Ctrl-STOP is being pressed (1=if pressed, 0 if not) extern int __LIB__ msx_break(); // Clear the keyboard buffer extern void __LIB__ msx_clearkey(); // Disable the CTRL-STOP effect (when a BASIC routine is being called) extern void __LIB__ msx_breakoff(); // Restore the CTRL-STOP break command extern void __LIB__ msx_breakon(); #endif z88dk-1.8.ds1/include/net/0000755000175000017500000000000010765202715014722 5ustar tygrystygrysz88dk-1.8.ds1/include/net/device.h0000644000175000017500000000352207470310063016327 0ustar tygrystygrys/* * Defs for a ZSock device driver * * djm 25/1/2000 * * $Id: device.h,v 1.7 2002/05/14 22:31:15 dom Exp $ */ #ifndef __NET_DEVICE_H__ #define __NET_DEVICE_H__ /* Address to which a plugin device is loaded */ #define DRIVER_ADDR 8192 /* Structure for the pkt drivers */ #ifdef SCCZ80 struct pktdrive { char magic[10]; /* ZS0PKTDRV\0 */ char *type; /* SLIP/PPP etc */ char *copymsg; /* (C) string */ int (*initfunc)(); /* Initialise function */ int (*queuefn)(); /* Insert packet into queue */ int (*sendfn)(); /* Spew bytes out */ int (*readfn)(); /* Read packet from dev */ void (*onlinefn)(); /* Turn device online */ void (*offlinefn)(); /* Turn device offline (supply 1 for hangup, 0 for not hangup */ void (*statusfn)(); }; #else struct pktdrive { char magic[10]; /* ZS0PKTDRV\0 */ char *type; /* SLIP/PPP etc */ char *copymsg; /* (C) string */ int (*initfunc)(); /* Initialise function */ void (*queuefn)(void *pkt,u16_t len); /* Insert packet into queue */ void *(*sendfn)(); /* Spew bytes out */ int (*readfn)(void **pkt); /* Read packet from dev */ void (*onlinefn)(); /* Turn device online */ void (*offlinefn)(int); /* Turn device offline (supply 1 for hangup, 0 for not hangup */ int (*statusfn)(); }; #endif #ifndef _KERNEL /* * Routines for use by any packet drivers or apps * if they really feel the need.. */ /* Set the host IP address, returns it as well..network order! */ extern ipaddr_t __LIB__ __SHARED__ SetHostAddr(ipaddr_t ip); /* * Set the name servers - supply both, if ns1 == 0 then no DNS * returns number of nameservers */ extern size_t __LIB__ __SHARED__ SetNameServers(ipaddr_t ns1, ipaddr_t ns2); #endif /* _KERNEL */ #endif /* _NET_DEVICE_H */ z88dk-1.8.ds1/include/net/hton.h0000644000175000017500000000114107744601743016047 0ustar tygrystygrys/* * Small C+ TCP Implementation * * hton.h * * Routines for the conversiono between network and host types * * djm 24/4/99 * * $Id: hton.h,v 1.4 2003/10/19 21:36:35 dom Exp $ */ #ifndef __HTON_H__ #define __HTON_H__ /* Get the types */ #include #include extern IPADDR_T __LIB__ __FASTCALL__ htonl(IPADDR_T); extern TCPPORT_T __LIB__ __FASTCALL__ htons(TCPPORT_T); #define ntohs(x) htons(x) #define ntohl(x) htonl(x) #define HTONS(x) htons(x) #define HTONL(x) htonl(x) #define NTOHS(x) htons(x) #define NTOHL(x) htonl(x) #endif /* HTON_H */ z88dk-1.8.ds1/include/net/inet.h0000644000175000017500000000721707477506314016051 0ustar tygrystygrys/* * Small C+ TCP Implementation * * inet.h * * Defines all constants * * djm 24/4/99 * * $Id: inet.h,v 1.9 2002/06/05 22:12:28 dom Exp $ */ #ifndef __NET_INET_H__ #define __NET_INET_H__ #include typedef u32_t ipaddr_t; typedef u16_t tcpport_t; #define IPADDR_T u32_t #define TCPPORT_T u16_t /* Macro to turn an IP address into a UDWORD */ #define IP_ADDR(a,b,c,d) (d<<24 | c<<16 | b<<8 | a ) /* Some sizes */ #define IP_MAX_HDR_SIZE 60 #define TCP_MAX_HDR_SIZE 60 #define IP_MIN_HDR_SIZE 20 #define TCP_MIN_HDR_SIZE 20 /* TCP Header */ struct tcp_header { tcpport_t srcport; tcpport_t dstport; u32_t seqnum; u32_t acknum; u8_t offset; u8_t flags; u16_t window; u16_t cksum; u16_t urgptr; }; #define TH_DO_MASK 0xf0 #define TH_FLAGS_MASK 0x3f /* IP Header */ struct ip_header { u8_t version; u8_t tos; u16_t length; u16_t ident; u16_t frag; u8_t ttl; u8_t protocol; u16_t cksum; ipaddr_t source; ipaddr_t dest; }; /* Some IP flags */ #define IP_OFFMASK 0x1fff #define IP_MF 0x2000 #define IP_DF 0x4000 /* ICMP Header */ struct icmp_header { u8_t type; u8_t code; u16_t cksum; u32_t unused; /* Used for various things */ char data[28]; /* Make up to 64 bytes */ }; /* UDP Header */ struct udp_header { tcpport_t srcport; tcpport_t dstport; u16_t length; u16_t cksum; }; typedef struct udp_header udp_header_t; typedef struct ip_header ip_header_t; typedef struct tcp_header tcp_header_t; typedef struct icmp_header icmp_header_t; /* The various IP protocols */ #define prot_ICMP 1 #define prot_IGMP 2 #define prot_TCP 6 #define prot_UDP 17 #define prot_ALL 254 /* This is used to indicate a TCP socket is now under user * control (and has been unlinked from sock list * 88 is as random as any number I hope.. */ #define CONN_CLOSED 88 /* This is to mung it up completely */ #define BADIPTYPE 159 #define MAX_ICMPMSGS 17 /* ICMP Packet types */ /* Message types */ #define ECHO_REPLY 0 /* Echo Reply */ #define DEST_UNREACH 3 /* Destination Unreachable */ #define QUENCH 4 /* Source Quench */ #define REDIRECT 5 /* Redirect */ #define ECHO_REQUEST 8 /* Echo Request */ #define TIME_EXCEED 11 /* Time-to-live Exceeded */ #define PARAM_PROB 12 /* Parameter Problem */ #define TIMESTAMP 13 /* Timestamp */ #define TIME_REPLY 14 /* Timestamp Reply */ #define INFO_RQST 15 /* Information Request */ #define INFO_REPLY 16 /* Information Reply */ /* Destination Unreachable codes */ #define NET_UNREACH 0 /* Net unreachable */ #define HOST_UNREACH 1 /* Host unreachable */ #define PROT_UNREACH 2 /* Protocol unreachable */ #define PORT_UNREACH 3 /* Port unreachable */ #define FRAG_NEEDED 4 /* Fragmentation needed and DF set */ #define ROUTE_FAIL 5 /* Source route failed */ /* Time Exceeded codes */ #define TTL_EXCEED 0 /* Time-to-live exceeded */ #define FRAG_EXCEED 1 /* Fragment reassembly time exceeded */ /* Redirect message codes */ #define REDR_NET 0 /* Redirect for the network */ #define REDR_HOST 1 /* Redirect for the host */ #define REDR_TOS 2 /* Redirect for Type of Service, or-ed with prev */ #endif /* _NET_INET_H */ z88dk-1.8.ds1/include/net/misc.h0000644000175000017500000000513507363076310016032 0ustar tygrystygrys/* * API For Zsock * * Miscellaenous routines which don't fit in * anywhere * * djm 13/2/2000 * * $Id: misc.h,v 1.5 2001/10/16 18:30:32 dom Exp $ */ #ifndef __NET_MISC_H__ #define __NET_MISC_H__ #include /* * Convert dotted string to network address * CAUTION: RETURNS 0 ON FAILURE!!! */ extern ipaddr_t __LIB__ __SHARED__ inet_addr(char *cp); /* Convert network address to dotted string, returns where the string is */ /* First one assumes base 10 and full complement of digits */ extern char __LIB__ __SHARED__ *inet_ntoa(IPADDR_T in, char *b); /* full version, may not make it into the final cut! */ extern char __LIB__ __SHARED__ *inet_ntoa_full(IPADDR_T in, char *b); /* * Check and set user timeouts */ extern long __LIB__ __SHARED__ tcp_settimeout(int secs); extern long __LIB__ __SHARED__ tcp_setctimeout(int centisecs); extern int __LIB__ __SHARED__ tcp_chktimeout(long time); /* * Page in and out Zsock data bank to segment two * * pagein returns old binding which pageout needs */ extern u8_t __LIB__ __SHARED__ tcp_pagein(void); extern u8_t __LIB__ __SHARED__ tcp_pageout(u8_t); /* * Allocate memory from the ZSock heap..useful for daemons * Since they probably won't have their own memory...use * sparingly since we've only got 16k... */ extern void __LIB__ __SHARED__ *tcp_malloc(int); extern void __LIB__ __SHARED__ *tcp_calloc(int,int); extern void __LIB__ __SHARED__ tcp_free(void *); /* * Turn the device on/offline * If flag !=0 then hangup line (offline) */ #define HANGUP 1 #define NOHANGUP 0 extern void __LIB__ __SHARED__ DeviceOffline(int flag); extern void __LIB__ __SHARED__ DeviceOnline(); /* * Routines for use by any packet drivers or apps * if they really feel the need.. */ /* Get the host IP address in network order */ extern ipaddr_t __LIB__ __SHARED__ GetHostAddr(void); /* Get the current domainname into buf, buf must be MAXDOMSIZ (50) */ extern u8_t __LIB__ __SHARED__ *GetDomain(u8_t *buf); /* * Return the network information structure - copy it into a * user supplied buffer for them to mess with - don't let 'em * near ours!!! User supplies buf with size size, we copy as * much as possible, if size=0 then we have it all */ extern size_t __LIB__ __SHARED__ GetNetStat(u8_t *buf, size_t size); /* * Register a CatchAll handler */ extern int __LIB__ __SHARED__ tcp_RegCatchall(int); /* * Hopefully Dev only busy call */ extern void __LIB__ __SHARED__ GoTCP(void); /* * Kill daemon sockets on port for a particular protocol */ extern int __LIB__ __SHARED__ killdaemon(tcpport_t port, char protocol); #endif /* !_NET_MISC_H */ z88dk-1.8.ds1/include/net/netstats.h0000644000175000017500000000366007363076310016745 0ustar tygrystygrys#ifndef __NET_NETSTATS_H__ #define __NET_NETSTATS_H__ #include #include /* * This file contains definitions for the stats * for TCP stack - pkts recvd etc * * djm 28/1/2000 * * $Id: netstats.h,v 1.4 2001/10/16 18:30:32 dom Exp $ */ typedef unsigned int nstat_t; typedef unsigned long nlen_t; struct sysstat_s { /* IP layer */ nstat_t ip_recvd; nlen_t ip_recvlen; nstat_t ip_badck; nstat_t ip_badlen; nstat_t ip_sent; /* UDP layer */ nstat_t udp_recvd; nlen_t udp_recvlen; nstat_t udp_badck; nstat_t udp_sent; nlen_t udp_sentlen; /* TCP layer */ nstat_t tcp_recvd; nlen_t tcp_recvdlen; nstat_t tcp_badck; nstat_t tcp_rstrecvd; nstat_t tcp_sent; nlen_t tcp_sentlen; nstat_t tcp_rstsent; nstat_t tcp_connreqs; nstat_t tcp_connaccs; nstat_t tcp_estab; nstat_t tcp_closed; /* ICMP layer */ nstat_t icmp_recvd; nstat_t icmp_badck; nstat_t icmp_sent; nstat_t icmp_icmp; nstat_t icmp_inp[MAX_ICMPMSGS]; nstat_t icmp_out[MAX_ICMPMSGS]; }; /* Length of the netstat structure */ #define NETSTAT_SIZE 128 /* Number of values (excluding icmp_inp/_out */ #define NETSTAT_NUM 25 /* * Text for netstats, if there's an 'l' in the first column it * means the value we print is long */ #ifdef NETSTAT_TXT static char *netstat_txt[]= { "IP: %u pkts recvd", "lIP: %lu bytes recvd", "IP: %u bad cksums", "IP: %u bad lengths", "IP: %u pkts sent", "UDP: %u pkts recvd", "lUDP: %lu bytes recvd", "UDP: %u bad cksums", "UDP: %u pkts sent", "lUDP: %lu bytes sent", "TCP: %u pkts recvd", "lTCP: %lu bytes recvd", "TCP: %u bad cksums", "TCP: %u rsts recvd", "TCP: %u pkts sent", "lTCP: %lu bytes sent", "TCP: %u rsts sent", "TCP: %u conns requests", "TCP: %u conn accepts", "TCP: %u conns established", "TCP: %u conns closed", "ICMP: %u pkts recvd", "ICMP: %u cksum errors", "ICMP: %u ICMP msgs sent", "ICMP: %u msgs not sent cos old msg was icmp"}; #endif #endif z88dk-1.8.ds1/include/net/resolv.h0000644000175000017500000000440007425024167016405 0ustar tygrystygrys/* * Small C+ Z88 TCP stack * * resolv.h * * Various resolving functions * * (See UNIX manpage for info!) * * djm 13/2/2000 * * $Id: resolv.h,v 1.5 2002/01/27 16:19:03 dom Exp $ */ #ifndef __NET_RESOLV_H__ #define __NET_RESOLV_H__ #include /* A couple of macros to make life easier... */ #define gethostbyname(a) resolve(a) #define gethostbyaddr(a,b) reverse_addr_lookup(a,b) /* * DNS resolving * * resolve takes a name and gets a network order IP addres * t'other takes a network order IP address and gets a name * (shoves it into *name and returns TRUE/FALSE for success/failure */ extern ipaddr_t __LIB__ __SHARED__ resolve(char *name); extern int __LIB__ __SHARED__ reverse_addr_lookup(ipaddr_t ipaddr, char *name); /* The getxxbyXX routines are now implemented in the library not the kernel */ struct data_entry { u8_t *name; tcpport_t port; u8_t protocol; }; /* * Services * * getservbyname returns a (host order) port number for the service * getservbyport returns a portname for the service supplied. The name * is stashed in store (no checks made) * getservproto* returns the appropriate protocol for a service * i.e. 6 = TCP, 27 = UDP , if a service both UDP & TCP returns * most common - usu TCP */ extern int __LIB__ getservbyname(char *name); extern char __LIB__ *getservbyport(int port, char *store); extern char __LIB__ getservprotobyport(int port); extern char __LIB__ getservprotobyname(char *name); /* * Protocols * * We don't have many of them but even so... * * getprotobyname returns the protocol number of the given protocol * getprotobynumber does it the other way round */ extern int __LIB__ getprotobyname(char *name); extern char __LIB__ *getprotobynumber(int proto, char *store); /* * Networks...let's be complete here! */ extern int __LIB__ getnetbyname(char *name); extern char __LIB__ *getnetbynumber(int network, char *store); /* The helper routines */ extern tcpport_t __LIB__ getxxbyname(struct data_entry *,char *name); extern char __LIB__ *getxxbyport(struct data_entry *, int, char *store); extern struct data_entry *get_services(); extern struct data_entry *get_networks(); extern struct data_entry *get_protocols(); #endif /* _NET_RESOLV_H */ z88dk-1.8.ds1/include/net/resolver.h0000644000175000017500000000537607470310063016742 0ustar tygrystygrys#ifndef __NET_RESOLVER_H__ #define __NET_RESOLVER_H__ /* * This file is included by the ZSock kernel * **DO NOT USE IN USER PROGRAMS!! * * $Id: resolver.h,v 1.5 2002/05/14 22:31:15 dom Exp $ */ /* Max domain name size to play with */ #define DOMSIZE 128 /* * Header for the DOMAIN queries * ALL OF THESE ARE u8_t SWAPPED QUANTITIES! */ struct dhead { u16_t ident; /* unique identifier */ u16_t flags; u16_t qdcount; /* question section, # of entries */ u16_t ancount; /* answers, how many */ u16_t nscount; /* count of name server RRs */ u16_t arcount; /* number of "additional" records */ }; /* * flag masks for the flags field of the DOMAIN header */ #define DQR 0x8000 /* query = 0, response = 1 */ #define DOPCODE 0x7100 /* opcode, see below */ #define DAA 0x0400 /* Authoritative answer */ #define DTC 0x0200 /* Truncation, response was cut off at 512 */ #define DRD 0x0100 /* Recursion desired */ #define DRA 0x0080 /* Recursion available */ #define DRCODE 0x000F /* response code, see below */ /* opcode possible values: */ #define DOPQUERY 0 /* a standard query */ #define DOPIQ 1 /* an inverse query */ #define DOPCQM 2 /* a completion query, multiple reply */ #define DOPCQU 3 /* a completion query, single reply */ /* the rest reserved for future */ /* legal response codes: */ #define DROK 0 /* okay response */ #define DRFORM 1 /* format error */ #define DRFAIL 2 /* their problem, server failed */ #define DRNAME 3 /* name error, we know name doesn't exist */ #define DRNOPE 4 /* no can do request */ #define DRNOWAY 5 /* name server refusing to do request */ #define DTYPEA 1 /* host address resource record (RR) */ #define DTYPEPTR 12 /* a domain name ptr */ #define DIN 1 /* ARPA internet class */ #define DWILD 255 /* wildcard for several of the classifications */ /* * a resource record is made up of a compressed domain name followed by * this structure. All of these ints need to be byteswapped before use. */ struct rrpart { u16_t rtype; /* resource record type = DTYPEA */ u16_t rclass; /* RR class = DIN */ u32_t ttl; /* time-to-live, changed to 32 bits */ u16_t rdlength; /* length of next field */ u8_t rdata[DOMSIZE]; /* data field */ }; /* * data for domain name lookup */ struct useek { struct dhead h; u8_t x[DOMSIZE]; }; #endif /* _NET_RESOLVER_H */ z88dk-1.8.ds1/include/net/socket.h0000644000175000017500000000765307477506314016406 0ustar tygrystygrys/* * ZSock API * * Socket orientated routines * * djm 13/2/2000 * * $Id: socket.h,v 1.6 2002/06/05 22:12:28 dom Exp $ */ #ifndef __NET_SOCKET_H__ #define __NET_SOCKET_H__ #include #include /* * You don't wanna know what a SOCKET is..trust me!! */ #define SOCKET void /* * Write data at dp of length len to socket s * * Returns length written */ extern size_t __LIB__ __SHARED__ sock_write(SOCKET *s,void *dp,size_t len); /* * Write byte c to socket s * * Returns length written */ extern size_t __LIB__ __SHARED__ sock_putc(char c,SOCKET *s); /* * Write a null terminated string to socket s * * Returns length written */ extern size_t __LIB__ __SHARED__ sock_puts(SOCKET *s,char *dp); /* * Flush the socket (Valid for TCP) */ extern void __LIB__ __SHARED__ sock_flush(SOCKET *s); /* * Read up to len bytes to address dp from socket s * * Return length read */ #define MSG_PEEK 0x02 #define MSG_DONTWAIT 0x40 extern size_t __LIB__ __SHARED__ sock_recv(SOCKET *s,u8_t *dp,size_t len,u8_t flags); extern size_t __LIB__ __SHARED__ sock_read(SOCKET *s,u8_t *dp,size_t len); /* * Close a socket */ extern void __LIB__ __SHARED__ sock_close(SOCKET *s); /* * Abort a connection */ extern void __LIB__ __SHARED__ sock_abort(SOCKET *s); /* * Shutdown a socket - finish with it completely */ extern void __LIB__ __SHARED__ sock_shutdown(SOCKET *s); /* * Test to see if a socket has data ready, returns amount * of data available to read */ extern size_t __LIB__ __SHARED__ sock_dataready(SOCKET *s); /* * Test whether a socket is open * returns TRUE/FALSE */ extern bool_t __LIB__ __SHARED__ sock_opened(SOCKET *s); /* * Test whether a socket is closed * returns TRUE/FALSE */ extern bool_t __LIB__ __SHARED__ sock_closed(SOCKET *s); /* * Open a socket for either listen or active connection * * ipaddr = network order ip address to listen/connect * lport/dport = host order port to listen/connect to * datahandler = supply as NULL * protocol = prot_TCP or prot_UDP */ extern SOCKET __LIB__ __SHARED__ *sock_listen(ipaddr_t ipaddr,tcpport_t lport,void (*datahandler)(),char protocol); extern SOCKET __LIB__ __SHARED__ *sock_pair_listen(ipaddr_t ipaddr,tcpport_t lport,tcpport_t dport,void (*datahandler)(),char protocol); extern SOCKET __LIB__ __SHARED__ *sock_open(ipaddr_t ipaddr,tcpport_t dport,void (*datahandler)(),char protocol); /* * Check and set timeouts on a socket (not used much) * * chk_timeout returns TRUE/FALSE for timedout/not */ extern void __LIB__ __SHARED__ sock_settimeout(SOCKET *s,int time); extern int __LIB__ __SHARED__ sock_chktimeout(SOCKET *s); /* * Some routines suitable for daemons */ /* Read/write user pointer associated with socket */ extern int __LIB__ __SHARED__ sock_setptr(SOCKET *s, void *ptr); extern void __LIB__ __SHARED__ *sock_getptr(SOCKET *s); /* Resize the tcp input queue size - returns the size the buffer is now set to*/ extern int __LIB__ __SHARED__ sock_setrsize(SOCKET *s, int size); /* Set the UDP socket mode to something */ extern int __LIB__ __SHARED__ sock_setmode(SOCKET *s, int mode); /* Set the datahandler for a socket (handler is package call) */ extern int __LIB__ __SHARED__ sock_sethandler(SOCKET *s, int call); /* Wait for a socket to become established, checks for ^C, returns 1 * on successfull open or 0 on ^C detected */ extern int __LIB__ __SHARED__ sock_waitopen(SOCKET *s); extern int __LIB__ __SHARED__ sock_waitclose(SOCKET *s); /* * Set the ttl and tos for a socket (defaults are 255 and 0 respectively) */ extern void __LIB__ __SHARED__ sock_settos(SOCKET *s,u8_t tos); extern void __LIB__ __SHARED__ sock_setttl(SOCKET *s,u8_t ttl); struct sockinfo_t { u8_t protocol; ipaddr_t local_addr; tcpport_t local_port; ipaddr_t remote_addr; tcpport_t remote_port; u8_t ttl; }; extern int __LIB__ __SHARED__ sock_getinfo(SOCKET *s, struct sockinfo_t *); #endif /* _NET_SOCKET_H */ z88dk-1.8.ds1/include/net/stdio.h0000644000175000017500000000067707363076310016227 0ustar tygrystygrys#ifndef __NET_STDIO_H__ #define __NET_STDIO_H__ /* * Some hooks for the stdio style routines * * Do not include yourself - system file!! * * $Id: stdio.h,v 1.3 2001/10/16 18:30:32 dom Exp $ */ extern int __LIB__ fgetc_net(void *s); extern int __LIB__ fputc_net(void *s, int c); extern int __LIB__ closenet(void *s); extern int __LIB__ opennet(FILE *fp, char *name,char *exp, size_t len); extern int __LIB__ fflush_net(void *s); #endif z88dk-1.8.ds1/include/net/tcpsock.h0000644000175000017500000001057407500670265016552 0ustar tygrystygrys/* * Small C+ TCP Stack * * Definitions for TCP Socket * * djm 24/4/99 * * $Id: tcpsock.h,v 1.5 2002/06/09 15:13:57 dom Exp $ */ #ifndef _NET_TCPSOCK_H #define _NET_TCPSOCK_H #include /* UDP Socket */ #define UDPSOCKET struct udpsocket UDPSOCKET { UDPSOCKET *next; u8_t ip_type; pid_t pid; /* Future... */ u8_t *errmsg; u8_t handlertype; /* Internal/Package */ #ifdef CYBIKO int (*datahandler)(void *,int,ip_header_t *,udp_header_t *,UDPSOCKET *); #else int (*datahandler)(); #endif u32_t timeout; ipaddr_t myaddr; tcpport_t myport; ipaddr_t hisaddr; tcpport_t hisport; u8_t tos; u8_t ttl; u16_t recvsize; u8_t *recvbuff; u16_t recvoffs; /* How much in buffer */ u16_t recvread; /* How much read from buffer */ u8_t *user; /* Some user pointers for us.. */ u8_t sockmode; /* bit 0 set = ascii unset = binary */ }; #define UDPMODE_ASC 1 #define UDPMODE_CKSUM 2 /* TCP Socket */ #define TCPSOCKET struct socket #define tcp_MAXDATA 512 TCPSOCKET { TCPSOCKET *next; u8_t ip_type; /* TCP/UDP */ pid_t pid; /* Future */ u8_t *errmsg; /* Set on close etc */ u8_t handlertype; /* Internal/package */ #ifdef CYBIKO int (*datahandler)(void *,int,TCPSOCKET *); #else int(*datahandler)(); #endif u32_t timeout; ipaddr_t myaddr; tcpport_t myport; ipaddr_t hisaddr; tcpport_t hisport; u8_t tos; u8_t ttl; /* receive buffer stuff - this is handled via pointers because not * everything needs a recv buffer - only true apps, size can be * adjusted upwards... */ i16_t recvsize; /* Size of recv buffer */ u8_t *recvbuff; i16_t recvoffs; /* how much in buffer */ i16_t recvread; /* how much read from buffer */ u8_t *appptr; /* Used by application */ u8_t state; u32_t acknum; u32_t seqnum; i16_t unacked; /* Amount of unacked data */ u8_t unhappy; u8_t flags; u8_t recent; /* Set if recently retransmitted */ u16_t window; /* His window */ /* Van Jacobson's algorithm */ u8_t cwindow; /* Congestion window */ u8_t wwindow; u16_t vj_sa; u16_t vj_sd; u16_t vj_last; u16_t rto; u8_t karn_count; /* Retransmission timeout procedure - in clock ticks */ u32_t rtt_lasttran; /* Last transmission time */ /* u32_t rtt_smooth; */ /* Smoothed round trip time */ /* u32_t rtt_delay; */ /* Delay for next transmission */ u32_t rtt_time; /* Time for next transmission */ u16_t mss; u32_t inactive_to; /* * send buffer stuff, handling via pointers as well, we set the size * at the start, can resize upwards if we want, but we don't adjust * the size at all */ u8_t *sendbuff; /* Where the buffer is */ i16_t sendsize; /* Size of send buffer */ i16_t sendoffs; /* Offset in buffer */ }; /* TCP flags */ #define tcp_flagFIN 0x01 #define tcp_flagSYN 0x02 #define tcp_flagRST 0x04 #define tcp_flagPUSH 0x08 #define tcp_flagACK 0x10 #define tcp_flagURG 0x20 /* * TCP states, from tcp manual. * Note: close-wait state is bypassed by automatically closing a connection * when a FIN is received. This is easy to undo. */ #define tcp_stateNONE 0 /* bound */ #define tcp_stateLISTEN 1 /* listening for connection */ #define tcp_stateSYNSENT 2 /* syn sent, active open */ #define tcp_stateSYNREC 3 /* syn received, synack+syn sent. */ #define tcp_stateESTAB 4 /* established */ #define tcp_stateESTCL 5 #define tcp_stateFINWT1 6 /* sent FIN */ #define tcp_stateFINWT2 7 /* sent FIN, received FINACK */ #define tcp_stateCLOSEWT 8 #define tcp_stateCLOSING 9 /* sent FIN, received FIN (waiting for FINACK) */ #define tcp_stateLASTACK 10 /* fin received, finack+fin sent */ #define tcp_stateTIMEWT 11 /* dally after sending final FINACK */ #define tcp_stateCLOSEMSL 12 #define tcp_stateCLOSED 13 /* finack received */ #endif /* _NET_TCPSOCK_H */ z88dk-1.8.ds1/include/net/telnet.h0000644000175000017500000002456707363076310016404 0ustar tygrystygrys/* $NetBSD: telnet.h,v 1.4 1994/10/26 00:56:46 cgd Exp $ */ /* $Id: telnet.h,v 1.3 2001/10/16 18:30:32 dom Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)telnet.h 8.1 (Berkeley) 6/2/93 */ #ifndef __NET_TELNET_H__ #define __NET_TELNET_H__ /* * Definitions for the TELNET protocol. */ #define IAC 255 /* interpret as command: */ #define DONT 254 /* you are not to use option */ #define DO 253 /* please, you use option */ #define WONT 252 /* I won't use option */ #define WILL 251 /* I will use option */ #define SB 250 /* interpret as subnegotiation */ #define GA 249 /* you may reverse the line */ #define EL 248 /* erase the current line */ #define EC 247 /* erase the current character */ #define AYT 246 /* are you there */ #define AO 245 /* abort output--but let prog finish */ #define IP 244 /* interrupt process--permanently */ #define BREAK 243 /* break */ #define DM 242 /* data mark--for connect. cleaning */ #define NOP 241 /* nop */ #define SE 240 /* end sub negotiation */ #define EOR 239 /* end of record (transparent mode) */ #define ABORT 238 /* Abort process */ #define SUSP 237 /* Suspend process */ #define xEOF 236 /* End of file: EOF is already used... */ #define SYNCH 242 /* for telfunc calls */ #ifdef TELCMDS char *telcmds[] = { "EOF", "SUSP", "ABORT", "EOR", "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, }; #else extern char *telcmds[]; #endif #define TELCMD_FIRST xEOF #define TELCMD_LAST IAC #define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ (unsigned int)(x) >= TELCMD_FIRST) #define TELCMD(x) telcmds[(x)-TELCMD_FIRST] /* telnet options */ #define TELOPT_BINARY 0 /* 8-bit data path */ #define TELOPT_ECHO 1 /* echo */ #define TELOPT_RCP 2 /* prepare to reconnect */ #define TELOPT_SGA 3 /* suppress go ahead */ #define TELOPT_NAMS 4 /* approximate message size */ #define TELOPT_STATUS 5 /* give status */ #define TELOPT_TM 6 /* timing mark */ #define TELOPT_RCTE 7 /* remote controlled transmission and echo */ #define TELOPT_NAOL 8 /* negotiate about output line width */ #define TELOPT_NAOP 9 /* negotiate about output page size */ #define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ #define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ #define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ #define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ #define TELOPT_XASCII 17 /* extended ascic character set */ #define TELOPT_LOGOUT 18 /* force logout */ #define TELOPT_BM 19 /* byte macro */ #define TELOPT_DET 20 /* data entry terminal */ #define TELOPT_SUPDUP 21 /* supdup protocol */ #define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ #define TELOPT_SNDLOC 23 /* send location */ #define TELOPT_TTYPE 24 /* terminal type */ #define TELOPT_EOR 25 /* end or record */ #define TELOPT_TUID 26 /* TACACS user identification */ #define TELOPT_OUTMRK 27 /* output marking */ #define TELOPT_TTYLOC 28 /* terminal location number */ #define TELOPT_3270REGIME 29 /* 3270 regime */ #define TELOPT_X3PAD 30 /* X.3 PAD */ #define TELOPT_NAWS 31 /* window size */ #define TELOPT_TSPEED 32 /* terminal speed */ #define TELOPT_LFLOW 33 /* remote flow control */ #define TELOPT_LINEMODE 34 /* Linemode option */ #define TELOPT_XDISPLOC 35 /* X Display Location */ #define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ #define TELOPT_AUTHENTICATION 37/* Authenticate */ #define TELOPT_ENCRYPT 38 /* Encryption option */ #define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ #define TELOPT_EXOPL 255 /* extended-options-list */ #define NTELOPTS (1+TELOPT_NEW_ENVIRON) #ifdef TELOPTS char *telopts[NTELOPTS+1] = { "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", "TACACS UID", "OUTPUT MARKING", "TTYLOC", "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON", 0, }; #define TELOPT_FIRST TELOPT_BINARY #define TELOPT_LAST TELOPT_NEW_ENVIRON #define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) #define TELOPT(x) telopts[(x)-TELOPT_FIRST] #endif /* sub-option qualifiers */ #define TELQUAL_IS 0 /* option is... */ #define TELQUAL_SEND 1 /* send option */ #define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ #define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ #define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ #define LFLOW_OFF 0 /* Disable remote flow control */ #define LFLOW_ON 1 /* Enable remote flow control */ #define LFLOW_RESTART_ANY 2 /* Restart output on any char */ #define LFLOW_RESTART_XON 3 /* Restart output only on XON */ /* * LINEMODE suboptions */ #define LM_MODE 1 #define LM_FORWARDMASK 2 #define LM_SLC 3 #define MODE_EDIT 0x01 #define MODE_TRAPSIG 0x02 #define MODE_ACK 0x04 #define MODE_SOFT_TAB 0x08 #define MODE_LIT_ECHO 0x10 #define MODE_MASK 0x1f /* Not part of protocol, but needed to simplify things... */ #define MODE_FLOW 0x0100 #define MODE_ECHO 0x0200 #define MODE_INBIN 0x0400 #define MODE_OUTBIN 0x0800 #define MODE_FORCE 0x1000 #define SLC_SYNCH 1 #define SLC_BRK 2 #define SLC_IP 3 #define SLC_AO 4 #define SLC_AYT 5 #define SLC_EOR 6 #define SLC_ABORT 7 #define SLC_EOF 8 #define SLC_SUSP 9 #define SLC_EC 10 #define SLC_EL 11 #define SLC_EW 12 #define SLC_RP 13 #define SLC_LNEXT 14 #define SLC_XON 15 #define SLC_XOFF 16 #define SLC_FORW1 17 #define SLC_FORW2 18 #define NSLC 18 /* * For backwards compatability, we define SLC_NAMES to be the * list of names if SLC_NAMES is not defined. */ #define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, #ifdef SLC_NAMES char *slc_names[] = { SLC_NAMELIST }; #else extern char *slc_names[]; #define SLC_NAMES SLC_NAMELIST #endif #define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) #define SLC_NAME(x) slc_names[x] #define SLC_NOSUPPORT 0 #define SLC_CANTCHANGE 1 #define SLC_VARIABLE 2 #define SLC_DEFAULT 3 #define SLC_LEVELBITS 0x03 #define SLC_FUNC 0 #define SLC_FLAGS 1 #define SLC_VALUE 2 #define SLC_ACK 0x80 #define SLC_FLUSHIN 0x40 #define SLC_FLUSHOUT 0x20 #define OLD_ENV_VAR 1 #define OLD_ENV_VALUE 0 #define NEW_ENV_VAR 0 #define NEW_ENV_VALUE 1 #define ENV_ESC 2 #define ENV_USERVAR 3 /* * AUTHENTICATION suboptions */ /* * Who is authenticating who ... */ #define AUTH_WHO_CLIENT 0 /* Client authenticating server */ #define AUTH_WHO_SERVER 1 /* Server authenticating client */ #define AUTH_WHO_MASK 1 /* * amount of authentication done */ #define AUTH_HOW_ONE_WAY 0 #define AUTH_HOW_MUTUAL 2 #define AUTH_HOW_MASK 2 #define AUTHTYPE_NULL 0 #define AUTHTYPE_KERBEROS_V4 1 #define AUTHTYPE_KERBEROS_V5 2 #define AUTHTYPE_SPX 3 #define AUTHTYPE_MINK 4 #define AUTHTYPE_CNT 5 #define AUTHTYPE_TEST 99 #ifdef AUTH_NAMES char *authtype_names[] = { "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, }; #else extern char *authtype_names[]; #endif #define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) #define AUTHTYPE_NAME(x) authtype_names[x] /* * ENCRYPTion suboptions */ #define ENCRYPT_IS 0 /* I pick encryption type ... */ #define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ #define ENCRYPT_REPLY 2 /* Initial setup response */ #define ENCRYPT_START 3 /* Am starting to send encrypted */ #define ENCRYPT_END 4 /* Am ending encrypted */ #define ENCRYPT_REQSTART 5 /* Request you start encrypting */ #define ENCRYPT_REQEND 6 /* Request you send encrypting */ #define ENCRYPT_ENC_KEYID 7 #define ENCRYPT_DEC_KEYID 8 #define ENCRYPT_CNT 9 #define ENCTYPE_ANY 0 #define ENCTYPE_DES_CFB64 1 #define ENCTYPE_DES_OFB64 2 #define ENCTYPE_CNT 3 #ifdef ENCRYPT_NAMES char *encrypt_names[] = { "IS", "SUPPORT", "REPLY", "START", "END", "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", 0, }; char *enctype_names[] = { "ANY", "DES_CFB64", "DES_OFB64", 0, }; #else extern char *encrypt_names[]; extern char *enctype_names[]; #endif #define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) #define ENCRYPT_NAME(x) encrypt_names[x] #define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) #define ENCTYPE_NAME(x) enctype_names[x] #endif /* !_TELNET_H_ */ z88dk-1.8.ds1/include/net/tftp.h0000644000175000017500000000676507363076310016066 0ustar tygrystygrys/* $Id: tftp.h,v 1.3 2001/10/16 18:30:32 dom Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)tftp.h 5.4 (Berkeley) 4/3/91 */ #ifndef __NET_TFTP_H__ #define __NET_TFTP_H__ #include /* * Trivial File Transfer Protocol (IEN-133) */ #define SEGSIZE 512 /* data segment size */ /* * Packet types. */ #define RRQ 01 /* read request */ #define WRQ 02 /* write request */ #define DATA 03 /* data packet */ #define ACK 04 /* acknowledgement */ #define ERROR 05 /* error code */ struct tftphdr { u16_t th_opcode; /* packet type */ union tftp_0xx { u16_t tu_block; /* block # */ u16_t tu_code; /* error code */ u8_t tu_stuff[1]; /* request packet stuff */ } th_u; u8_t th_data[1]; /* data or error string */ }; #define th_block th_u.tu_block #define th_code th_u.tu_code #define th_stuff th_u.tu_stuff #define th_msg th_data /* * Error codes. */ #define EUNDEF 0 /* not defined */ #define ENOTFOUND 1 /* file not found */ #define EACCESS 2 /* access violation */ #define ENOSPACE 3 /* disk full or allocation exceeded */ #define EBADOP 4 /* illegal TFTP operation */ #define EBADID 5 /* unknown transfer ID */ #define EEXISTS 6 /* file already exists */ #define ENOUSER 7 /* no such user */ #define TFTPTIMEOUT 5 /* djm timeout in secs */ #endif /* !_TFTP_H_ */ z88dk-1.8.ds1/include/net/zsfiles.h0000644000175000017500000000064107363076310016553 0ustar tygrystygrys/* * Small C+ TCP Library * * defs needed solely by initial config * * djm 29/1/2000 * * $Id: zsfiles.h,v 1.3 2001/10/16 18:30:32 dom Exp $ */ #ifndef __NET_ZSFILES_H__ #define __NET_ZSFILES_H__ /* Where files are located on the Z88 */ #define DOMAIN_FILE ":ram.0/resolv.cfg" #define HOSTNAME_FILE ":ram.0/hostname" #define DEVICE_FILE ":ram.0/netdev" #endif /* _NET_ZSFILES_H */ z88dk-1.8.ds1/include/net/zsockerrs.h0000755000175000017500000000160007363076310017120 0ustar tygrystygrys#ifndef __NET_ZSOCKERRS_H__ #define __NET_ZSOCKERRS_H__ /* * This file lists the errors returned by ZSock to an * application. They overlap with OZ errors (*have* to) * * UNIX errnos in brackets in comment * * djm 7/1/2000 * * Still not sure how to tie these in.... * * $Id: zsockerrs.h,v 1.3 2001/10/16 18:30:32 dom Exp $ */ #define EOK 0 /* Hey we're fine! RC_OK */ #define ENETDOWN 6 /* (50) Network down RC_Na */ #define EMSGSIZE 7 /* (41) Message too long (UDP) */ #define ENOMEM 0x0A /* (12) Out of memory */ #define EPROTONOSUPPORT 0x46 /* (46) Protocol family not supp */ #define EADDRINUSE 0x47 /* (48) Address already in use */ #define ETIMEDOUT 2 /* (60) Conn timed out */ #define ECONNREFUSED 0x66 /* (61) Conn refused */ #define EDESTADDRREQ 0x0C /* (39) Dest addr needed */ #define ESHUTDOWN 0x0B /* (58) Can't send after shutdown */ #endif /* !_NET_ZSOCKERRS_H */ z88dk-1.8.ds1/include/newbrain.h0000755000175000017500000003644310635717761016137 0ustar tygrystygrys/* * Grundy Newbrain specific functions * * $Id: newbrain.h,v 1.8 2007/06/19 09:20:49 stefano Exp $ */ #ifndef __NEWBRAIN_H__ #define __NEWBRAIN_H__ #include /* structures for streams, devices, etc..*/ struct NB_STREAM { u8_t stream; /* stream number */ u8_t driver; /* driver number */ u8_t port; /* port number */ u8_t unused; /* unused */ u16_t address; /* own memory address */ }; struct NB_DRIVER { u8_t entries; /* Number of entry points less 1 */ u8_t openin; /* open for input -0- */ u8_t openout; /* open for output -1- */ u8_t dinput; /* reads a byte from device -2- */ u8_t doutput; /* outputs a byte -3- */ u8_t dclose; /* close the device -4- */ // u8_t move; /* not always implemented -5- */ }; /* mewbrain "system variables" */ #define NB_TOPN 1 /* transfer for Z80 wakeup after power down */ #define NB_JOPN 2 /* jump location for Z80 wakeup after power down */ #define NB_B3PRM 4 /* lower bound of RAM allocation to user program */ #define NB_B4 6 /* upper bound +1 of RAM allocation to user program */ #define NB_TRST8 8 /* transfer for RST 8, used by maths and cassette */ #define NB_JRST8 9 /* jump location for RST 8 */ #define NB_DEV0 0x0B /* default console device in BASIC */ #define NB_EXCESS 0x0C /* for TV device driver */ #define NB_TV0 0x0D /* for TV device driver - flash clock */ #define NB_TV2 0x0E /* for TV device driver - cursor flags */ #define NB_TV1 0x0F /* for TV device driver - character at cursor */ #define NB_TV1 0x0F /* for TV device driver - character at cursor */ #define NB_TEXM 0x10 /* transfer for RST 16, user program intercept "call by name" */ #define NB_JEXM 0x11 /* jump location for RST 16 */ #define NB_DEV2 0x13 /* default store device (LOAD and SAVE, etc.. in BASIC) */ #define NB_SAVE2 0x14 /* IX save for communicating between IOS and user program */ #define NB_SAVE3 0x16 /* IY save for communicating between IOS and user program */ #define NB_TEXMNC 0x18 /* transfer for RST 24, user program intercept, "call no carry by name" */ #define NB_JEXMNC 0x19 /* jump location for RST 24 */ #define NB_PL1EN 0x1B /* PRINT line length for TAB and POS in BASIC */ #define NB_PHPOS 0x1C /* PRINT head position for TAB and POS in BASIC */ #define NB_PZLEN 0x1D /* PRINT zone length TAB and POS in BASIC */ #define NB_SAVE1 0x1E /* SP save for power down */ #define NB_TRST32 0x20 /* transfer for RST 32, use by OS intercept, "call by name" */ #define NB_JRST32 0x21 /* jump location for RST 32 */ #define NB_BRKBUF 0x23 /* used by break detection routines */ #define NB_ENREGMAP 0x24 /* last byte sent to enable port register */ #define NB_IOPUTC 0x25 /* I/O power user count */ #define NB_UP 0x26 /* user program address defaults to BASIC */ #define NB_TRST40 0x28 /* transfer for RST 40, use by OS intercept, "call no carry by name" */ #define NB_JRST40 0x29 /* jump location for RST 40 */ #define NB_KBMODE 0x2B /* graphics and shift key lock status */ #define NB_GSPR 0x2C /* user program make space routine address */ #define NB_RSPR 0x2E /* user program return space routine address */ #define NB_TRST48 0x30 /* transfer for RST 48 */ #define NB_JRST48 0x31 /* jump location for RST 48 */ #define NB_BUFLG 0x33 /* when set indicates buffer in motion */ #define NB_DPSP 0x34 /* default parameter string pointer for device 0, */ /* initially points to string "L24" */ #define NB_DPSL 0x36 /* string length of DPSP */ #define NB_TINT 0x38 /* transfer for RST 56, mode 1 device interrupt service */ #define NB_JINT 0x39 /* jump location for RST 56 */ #define NB_COPCTL 0x3B /* COP control, interrupt acknowledge byte written to COP */ /* in response to a COP interrupt */ #define NB_COPST 0x3C /* COP status, set by COP interrupt service routine */ #define NB_COPBUFF 0x3D /* data characters to COP */ #define NB_OUTBUFF 0x3E /* VF display buffer (LCD) */ #define NB_TIMBUFF 0x40 /* COP internal counter value used to time the 1 minute power down interval */ #define NB_CHKSUM 0x50 /* tape transfer accumulated checksum */ #define NB_CLACK 0x52 /* count of COP interrupts */ #define NB_STRTAB 0x56 /* address of start of stream table */ #define NB_DEVTAB 0x58 /* address of start of device table */ #define NB_TVCUR 0x5A /* address of cursor position */ #define NB_TVRAM 0x5C /* start address of TV own memory */ #define NB_OTHER1 0x5E /* reserved for driver which needs to mantain page zero memory.. */ #define NB_OTHER2 0x60 /* ..address variable if own memory moves */ #define NB_IOSRAM 0x62 /* address of device driver own memory area for streams */ #define NB_STRTOP 0x64 /* address of top of stream table */ #define NB_TNMI 0x66 /* transfer for NMI, (normally not used, NMI pin strapped high) */ #define NB_JNMI 0x67 /* jump location for NMI */ #define NB_FICLKM 0x69 /* frame interrupt counter, while video device is active */ #define NB_TBRP 0x6C /* transmit baud rate parameter */ #define NB_RBRP 0x6D /* receive baud rate parameter */ #define NB_CHAR_SET_LOCATION 0x77 /* device driver codes */ #define DEV_TVIO 0 /* screen editor, I/O */ #define DEV_TP1IO 1 /* primary tape device */ #define DEV_TP2IO 2 /* secondary tape device */ #define DEV_LIIO 3 /* VF display, (LCD) "16" */ #define DEV_TLIO 4 /* combined TL and VF display */ #define DEV_KBWIO 5 /* keyboard, wait for a key */ #define DEV_KBIIO 6 /* keyboard, immediate */ #define DEV_UPIO 7 /* User Port */ #define DEV_LPIO 8 /* most common printer device */ #define DEV_JGIO 9 /* alias for software driven V24 */ #define DEV_DUMMY 10 /* similar to /dev/null */ #define DEV_GRAPHICS 11 /* graphics device */ #define DEV_BDISCIO 12 /* disk binary file, sequential access */ #define DEV_TDISCIO 13 /* disk text file, sequential access */ #define DEV_RDISCIO 14 /* disk binary file, random access */ #define DEV_SDISCIO 15 /* disk directory access */ #define DEV_LP2IO 16 /* printer, various hardware, "l0*0" */ #define DEV_JG2IO 17 /* serial PUN/RDR, string, "n*0" */ #define DEV_SSEIO 18 /* 80 columns simplified TTY device */ #define DEV_KBFIO 19 /* enhanced fuffered keyboard driver */ #define DEV_SMDD 20 /* Serial Memory Device: RAMDISK */ #define DEV_LP3IO 21 /* less common printer device */ #define DEV_HRG 33 /* high resolution graphics "*0" */ /* IOS and generic ERRORS */ #define NB_ERR_NOROOM 100 /* Error code: no space for new stream */ #define NB_ERR_NOSTRM 105 /* Error code: no stream table entry */ #define NB_ERR_NODEV 106 /* Error code: invalid device */ #define NB_ERR_DEVOPN 107 /* Error code: device/port pair already open */ #define NB_ERR_STROPN 108 /* Error code: stream already open */ #define NB_ERR_REQERR 109 /* Error code: illegal request code */ /* i.e. attempt to read following an "open out" */ #define NB_ERR_PARAMETER 110 /* Syntax error in parameter string */ #define NB_ERR_NOPOWER 111 /* Device without mains power connected */ #define NB_ERR_STREAM_CLOSED 115 /* Linked stream has been closed */ /* GRAPHICS and screen device control errors */ #define NB_ERR_FILLMEM 112 /* Insufficient memory for FILL request */ #define NB_ERR_NOSCREEN 113 /* Linked stream is not a screen device */ #define NB_ERR_HEIGHT 114 /* No memory space for requested height */ #define NB_ERR_SCREEN_POS 116 /* Screen position illegal in context */ #define NB_ERR_GRAPH_COMMAND 117 /* Invalid graph command or PEN parm. */ #define NB_ERR_GRAPH_INPUT 118 /* Cannot input from graph dev. Use PEN */ #define NB_ERR_GRAPH_OUTPUT 119 /* Cannot output to graph while reading */ /* TAPE IO ERRORS */ #define NB_ERR_TAPE_HARDWARE 130 /* Cassette hardware error */ #define NB_ERR_TAPE_LENGTH 131 /* Data block in tape too long for buffer */ #define NB_ERR_TAPE_CHECKSUM 132 /* Cassette checksum error */ #define NB_ERR_TAPE_EOF 133 /* End of file or hardware failure */ #define NB_ERR_TAPE_SEQUENCE 134 /* Data out of sequence or hardware failure */ #define NB_ERR_TAPE_MODE 135 /* Reading on a 'write' channel or vice versa */ #define NB_ERR_TAPE_SYNTAX 136 /* Syntax error in parameter string */ /* DISCIO ERRORS (normally for devices 12, 13, 14 or 15) */ #define NB_ERR_FILENAME 150 /* Bad filename */ #define NB_ERR_INPUT 151 /* Input error */ #define NB_ERR_OUTPUT 152 /* Output error */ #define NB_ERR_DIRECTORY 153 /* Directory error */ #define NB_ERR_INIT 154 /* Initialization error */ #define NB_ERR_TRANSACTION 155 /* Transaction error on dev 14 or 15 */ #define NB_ERR_NONZERO_PORT 156 /* Opening dev 15 with a non-zero port */ #define NB_ERR_FILENAME_LONG 157 /* Filename too long */ #define NB_ERR_TRANSACTION_TYPE 158 /* Transaction type error on dev 15 */ #define NB_ERR_RANDOM_TRANSPUT 159 /* Random transput error, beyond 8MB or zero pos. */ /* SMDD ERRORS (serial memory device driver) */ #define NB_ERR_SMDD_EOF 192 /* read past end of file */ #define NB_ERR_SMDD_NOROOM 193 /* insufficient memory to create object */ #define NB_ERR_SMDD_HLM 197 /* attempt to read past High Level Mark */ #define NB_ERR_SMDD_SAMEDIR 198 /* attempt to open 2nd directory with same name as an active one */ /* JGIO - ACIA drivers ERRORS */ #define NB_ERR_ACIA_SYNTAX 120 /* Syntax error in parameter string */ #define NB_ERR_ACIA_PORT 121 /* Port number different than zero for serial dev. */ #define NB_ERR_ACIA_TIMEOUT 200 /* Time out on serial input port */ #define NB_ERR_ACIA_BUFFER 206 /* ACIA buffer not available */ #define NB_ERR_ACIA_BUSY 207 /* ACIA or buffer already in use */ #define NB_ERR_ACIA_OUTPUT 208 /* ACIA not ready for output OR buffer full */ #define NB_ERR_ACIA_BUFFERED 209 /* Cannot use LP and V24 on EIM unless both are unbuffered */ #define NB_ERR_ACIA_INPUT 210 /* ACIA not ready for input OR buffer empty */ #define NB_ERR_ACIA_BAUD_RATE 211 /* Baud rates differ from ACIA aready open on same module */ #define NB_ERR_ACIA_BAUD_RANGE 212 /* Error 212 Cannot use baud rate over 19200 on EIM (early releases) */ #define NB_ERR_ACIA_N0 213 /* Cannot use protocol N for buffered operation - use N*0 */ #define NB_ERR_ACIA_BUFFER_NO 214 /* Illegal ACIA or buffer number */ #define NB_ERR_ACIA_BITS 215 /* Illegal combination of Data bits, Stop bits, and parity */ #define NB_ERR_ACIA_FRAME 216 /* ACIA frame error */ #define NB_ERR_ACIA_OVERRUN 217 /* ACIA overrun error OR buffer overrun */ #define NB_ERR_ACIA_PARITY 218 /* ACIA parity error */ #define NB_ERR_ACIA_CARRIER 219 /* ACIA loss-of-carrier error */ #define NB_ERR_ACIA_MODULE 220 /* ACIA number is on a module that is not connected */ /* TN111 CENTRONICS Printer Device Driver errors */ #define NB_ERR_TN111_READ 109 /* Attempt was made to read from printer */ // #define NB_ERR_TN111_PARAMETER 110 /* Syntax error in parameter string */ #define NB_ERR_TN111_MEMORY 120 /* Insufficient memory to allocate buffer */ /* GRAPHICS device commands */ #define NBGR_ESCAPE 16 #define NBGR_MOVE 0 #define NBGR_TURN 1 #define NBGR_ARC 2 #define NBGR_TURNBY 3 #define NBGR_MODE 4 #define NBGR_FILL 5 #define NBGR_COLOUR 6 #define NBGR_GTEXT 7 #define NBGR_PEN 8 #define NBGR_DOT 9 #define NBGR_RANGE 10 #define NBGR_CENTRE 11 #define NBGR_MOVEBY 12 #define NBGR_DRAW 13 #define NBGR_DRAWBY 14 #define NBGR_BACKGROUND 15 #define NBGR_WIPE 16 #define NBGR_AXES 17 #define NBGR_PLACE 18 #define NBGR_RADIANS 19 #define NBGR_DEGREES 20 #define NBGR_CIRCLE 21 #define NBGR_DUMP 22 /* SDISCIO device commands (disk directory control) */ #define NBSD_DELETE 0 /* delete a file, wildcards allowed */ #define NBSD_RENAME 1 /* rename a file, wildcards not allowed */ #define NBSD_SETDISK 2 /* select default disk drive (capital letter) */ #define NBSD_FIRST 3 /* search for first file, wildcards allowed */ #define NBSD_NEXT 4 /* search for next file, wildcards allowed */ #define NBSD_GETDISK 5 /* get default disk drive (capital letter) */ #define NBSD_RESET 6 /* CONSOLE control characters */ #define NBCON_ESCAPE 27 #define NBCON_CRLF 13 #define NBCON_CURSON 6 #define NBCON_CURSOFF 7 #define NBCON_TAB 9 #define NBCON_CURLEFT 8 #define NBCON_CURRIGHT 26 #define NBCON_CURUP 11 #define NBCON_CURDOWN 10 #define NBCON_CURHOME 12 #define NBCON_CURHOMEL 28 #define NBCON_CURHOMER 29 #define NBCON_CURXY 22 /* two bytes must follow */ #define NBCON_LINECLS 30 #define NBCON_LINEINS 1 #define NBCON_CLS 31 #define NBCON_TVCTL 23 /* * LCD display handling (position from 0 to 15) * lowercase characters are not ASCII coded */ extern void __LIB__ fputc_lcd(int position, int character); extern void __LIB__ __FASTCALL__ fputs_lcd( char *text ); /* * Check if break has been pressed */ extern int __LIB__ break_status(); /* * warm_reset: jump to BASIC entry */ extern void __LIB__ warm_reset(); /* * newbrain resident OS related libraries */ #define INP 0x32 /* open mode for input with 'nb_open'*/ #define OUTP 0x33 /* open mode for output with 'nb_open'*/ extern int __LIB__ nb_open( int mode, int stream, int device, int port, char *paramstr ); extern void __LIB__ __FASTCALL__ nb_close( int stream ); extern void __LIB__ nb_clear( ); extern void __LIB__ nb_putc( int stream, char byte ); extern void __LIB__ nb_puts( int stream, char *text ); extern int __LIB__ nb_putblock( int stream, char *bytes, int length ); extern void __LIB__ nb_putval( int stream, int value ); extern char __LIB__ __FASTCALL__ nb_getc( int stream ); extern char __LIB__ *nb_gets( int stream, char *bytes, int length ); extern int __LIB__ nb_getblock( int stream, char *bytes, int length ); #endifz88dk-1.8.ds1/include/oz/0000755000175000017500000000000010765202715014564 5ustar tygrystygrysz88dk-1.8.ds1/include/oz/command0.h0000644000175000017500000000676307130401716016441 0ustar tygrystygrys/* * Main Topic include file * * Do not include yourself!! */ #ifdef TOPIC1 .in_topic1 defb in_topic1end - in_topic1 APPLTEXT(TOPIC1) #ifdef TOPIC1HELP1 defb ( in_topic1_hlp - in_help) / 256 defb ( in_topic1_hlp - in_help) % 256 #else defb 0,0 ;ptr to help - use \0 of TOPIC1 #endif #ifdef TOPIC1ATTR APPLBYTE(TOPIC1ATTR) #else defb 0 #endif defb in_topic1end - in_topic1 .in_topic1end #endif /* TOPIC1 */ #ifdef TOPIC2 .in_topic2 defb in_topic2end - in_topic2 APPLTEXT(TOPIC2) #ifdef TOPIC2HELP1 defb ( in_topic2_hlp - in_help) / 256 defb ( in_topic2_hlp - in_help) % 256 #else defb 0,0 ;ptr to help - use \0 of TOPIC2 #endif #ifdef TOPIC2ATTR APPLBYTE(TOPIC2ATTR) #else defb 0 #endif defb in_topic2end - in_topic2 .in_topic2end #endif /* TOPIC2 */ #ifdef TOPIC3 .in_topic3 defb in_topic3end - in_topic3 APPLTEXT(TOPIC3) #ifdef TOPIC3HELP1 defb ( in_topic3_hlp - in_help) / 256 defb ( in_topic3_hlp - in_help) % 256 #else defb 0,0 ;ptr to help - use \0 of TOPIC3 #endif #ifdef TOPIC3ATTR APPLBYTE(TOPIC3ATTR) #else defb 0 #endif defb in_topic3end - in_topic3 .in_topic3end #endif /* TOPIC3 */ #ifdef TOPIC4 .in_topic4 defb in_topic4end - in_topic4 APPLTEXT(TOPIC4) #ifdef TOPIC4HELP1 defb ( in_topic4_hlp - in_help) / 256 defb ( in_topic4_hlp - in_help) % 256 #else defb 0,0 ;ptr to help - use \0 of TOPIC4 #endif #ifdef TOPIC4ATTR APPLBYTE(TOPIC4ATTR) #else defb 0 #endif defb in_topic4end - in_topic4 .in_topic4end #endif /* TOPIC4 */ #ifdef TOPIC5 .in_topic5 defb in_topic5end - in_topic5 APPLTEXT(TOPIC5) #ifdef TOPIC5HELP1 defb ( in_topic5_hlp - in_help) / 256 defb ( in_topic5_hlp - in_help) % 256 #else defb 0,0 ;ptr to help - use \0 of TOPIC5 #endif #ifdef TOPIC5ATTR APPLBYTE(TOPIC5ATTR) #else defb 0 #endif defb in_topic5end - in_topic5 .in_topic5end #endif /* TOPIC5 */ #ifdef TOPIC6 .in_topic6 defb in_topic6end - in_topic6 APPLTEXT(TOPIC6) #ifdef TOPIC6HELP1 defb ( in_topic6_hlp - in_help) / 256 defb ( in_topic6_hlp - in_help) % 256 #else defb 0,0 ;ptr to help - use \0 of TOPIC6 #endif #ifdef TOPIC6ATTR APPLBYTE(TOPIC6ATTR) #else defb 0 #endif defb in_topic6end - in_topic6 .in_topic6end #endif /* TOPIC6 */ #ifdef TOPIC7 .in_topic7 defb in_topic7end - in_topic7 APPLTEXT(TOPIC7) #ifdef TOPIC7HELP1 defb ( in_topic7_hlp - in_help) / 256 defb ( in_topic7_hlp - in_help) % 256 #else defb 0,0 ;ptr to help - use \0 of TOPIC7 #endif #ifdef TOPIC7ATTR APPLBYTE(TOPIC7ATTR) #else defb 0 #endif defb in_topic7end - in_topic7 .in_topic7end #endif /* TOPIC7 */ z88dk-1.8.ds1/include/oz/command1.h0000644000175000017500000003271007130401716016431 0ustar tygrystygrys/* * Header for command entries for Topic 1 * * Do not include yourself - included by application.h * * 7/4/99 djm */ #ifdef TOPIC1_1 .in_com_1_1 defb in_com_1_1end - in_com_1_1 APPLBYTE(TOPIC1_1CODE) APPLNAME(TOPIC1_1KEY) APPLTEXT(TOPIC1_1) #ifdef TOPIC1_1HELP1 defb (in_com_hlp1_1 - in_help) /256 defb (in_com_hlp1_1 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC1_1HELP1) */ #ifdef TOPIC1_1ATTR APPLBYTE(TOPIC1_1ATTR) #else defb 0 #endif /* TOPIC1_1ATTR */ defb in_com_1_1end - in_com_1_1 .in_com_1_1end #endif /* TOPIC1_1 */ #ifdef TOPIC1_2 .in_com_1_2 defb in_com_1_2end - in_com_1_2 APPLBYTE(TOPIC1_2CODE) APPLNAME(TOPIC1_2KEY) APPLTEXT(TOPIC1_2) #ifdef TOPIC1_2HELP1 defb (in_com_hlp1_2 - in_help) /256 defb (in_com_hlp1_2 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC1_2HELP1) */ #ifdef TOPIC1_2ATTR APPLBYTE(TOPIC1_2ATTR) #else defb 0 #endif /* TOPIC1_2ATTR */ defb in_com_1_2end - in_com_1_2 .in_com_1_2end #endif /* TOPIC1_2 */ #ifdef TOPIC1_3 .in_com_1_3 defb in_com_1_3end - in_com_1_3 APPLBYTE(TOPIC1_3CODE) APPLNAME(TOPIC1_3KEY) APPLNAME(TOPIC1_3) #ifdef TOPIC1_3HELP1 defb (in_com_hlp1_3 - in_help) /256 defb (in_com_hlp1_3 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_3HELP1) */ #ifdef TOPIC1_3ATTR APPLBYTE(TOPIC1_3ATTR) #else defb 0 #endif /* TOPIC1_3ATTR */ defb in_com_1_3end - in_com_1_3 .in_com_1_3end #endif /* TOPIC1_3 */ #ifdef TOPIC1_4 .in_com_1_4 defb in_com_1_4end - in_com_1_4 APPLBYTE(TOPIC1_4CODE) APPLNAME(TOPIC1_4KEY) APPLNAME(TOPIC1_4) #ifdef TOPIC1_4HELP1 defb (in_com_hlp1_4 - in_help) /256 defb (in_com_hlp1_4 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_4HELP1) */ #ifdef TOPIC1_4ATTR APPLBYTE(TOPIC1_4ATTR) #else defb 0 #endif /* TOPIC1_4ATTR */ defb in_com_1_4end - in_com_1_4 .in_com_1_4end #endif /* TOPIC1_4 */ #ifdef TOPIC1_5 .in_com_1_5 defb in_com_1_5end - in_com_1_5 APPLBYTE(TOPIC1_5CODE) APPLNAME(TOPIC1_5KEY) APPLNAME(TOPIC1_5) #ifdef TOPIC1_5HELP1 defb (in_com_hlp1_5 - in_help) /256 defb (in_com_hlp1_5 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_5HELP1) */ #ifdef TOPIC1_5ATTR APPLBYTE(TOPIC1_5ATTR) #else defb 0 #endif /* TOPIC1_5ATTR */ defb in_com_1_5end - in_com_1_5 .in_com_1_5end #endif /* TOPIC1_5 */ #ifdef TOPIC1_6 .in_com_1_6 defb in_com_1_6end - in_com_1_6 APPLBYTE(TOPIC1_6CODE) APPLNAME(TOPIC1_6KEY) APPLNAME(TOPIC1_6) #ifdef TOPIC1_6HELP1 defb (in_com_hlp1_6 - in_help) /256 defb (in_com_hlp1_6 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_6HELP1) */ #ifdef TOPIC1_6ATTR APPLBYTE(TOPIC1_6ATTR) #else defb 0 #endif /* TOPIC1_6ATTR */ defb in_com_1_6end - in_com_1_6 .in_com_1_6end #endif /* TOPIC1_6 */ #ifdef TOPIC1_7 .in_com_1_7 defb in_com_1_7end - in_com_1_7 APPLBYTE(TOPIC1_7CODE) APPLNAME(TOPIC1_7KEY) APPLNAME(TOPIC1_7) #ifdef TOPIC1_7HELP1 defb (in_com_hlp1_7 - in_help) /256 defb (in_com_hlp1_7 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_7HELP1) */ #ifdef TOPIC1_7ATTR APPLBYTE(TOPIC1_7ATTR) #else defb 0 #endif /* TOPIC1_7ATTR */ defb in_com_1_7end - in_com_1_7 .in_com_1_7end #endif /* TOPIC1_7 */ #ifdef TOPIC1_8 .in_com_1_8 defb in_com_1_8end - in_com_1_8 APPLBYTE(TOPIC1_8CODE) APPLNAME(TOPIC1_8KEY) APPLNAME(TOPIC1_8) #ifdef TOPIC1_8HELP1 defb (in_com_hlp1_8 - in_help) /256 defb (in_com_hlp1_8 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_8HELP1) */ #ifdef TOPIC1_8ATTR APPLBYTE(TOPIC1_8ATTR) #else defb 0 #endif /* TOPIC1_8ATTR */ defb in_com_1_8end - in_com_1_8 .in_com_1_8end #endif /* TOPIC1_8 */ #ifdef TOPIC1_9 .in_com_1_9 defb in_com_1_9end - in_com_1_9 APPLBYTE(TOPIC1_9CODE) APPLNAME(TOPIC1_9KEY) APPLNAME(TOPIC1_9) #ifdef TOPIC1_9HELP1 defb (in_com_hlp1_9 - in_help) /256 defb (in_com_hlp1_9 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_9HELP1) */ #ifdef TOPIC1_9ATTR APPLBYTE(TOPIC1_9ATTR) #else defb 0 #endif /* TOPIC1_9ATTR */ defb in_com_1_9end - in_com_1_9 .in_com_1_9end #endif /* TOPIC1_9 */ #ifdef TOPIC1_10 .in_com_1_10 defb in_com_1_10end - in_com_1_10 APPLBYTE(TOPIC1_10CODE) APPLNAME(TOPIC1_10KEY) APPLNAME(TOPIC1_10) #ifdef TOPIC1_10HELP1 defb (in_com_hlp1_10 - in_help) /256 defb (in_com_hlp1_10 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_10HELP1) */ #ifdef TOPIC1_10ATTR APPLBYTE(TOPIC1_10ATTR) #else defb 0 #endif /* TOPIC1_10ATTR */ defb in_com_1_10end - in_com_1_10 .in_com_1_10end #endif /* TOPIC1_10 */ #ifdef TOPIC1_11 .in_com_1_11 defb in_com_1_11end - in_com_1_11 APPLBYTE(TOPIC1_11CODE) APPLNAME(TOPIC1_11KEY) APPLNAME(TOPIC1_11) #ifdef TOPIC1_11HELP1 defb (in_com_hlp1_11 - in_help) /256 defb (in_com_hlp1_11 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_11HELP1) */ #ifdef TOPIC1_11ATTR APPLBYTE(TOPIC1_11ATTR) #else defb 0 #endif /* TOPIC1_11ATTR */ defb in_com_1_11end - in_com_1_11 .in_com_1_11end #endif /* TOPIC1_11 */ #ifdef TOPIC1_12 .in_com_1_12 defb in_com_1_12end - in_com_1_12 APPLBYTE(TOPIC1_12CODE) APPLNAME(TOPIC1_12KEY) APPLNAME(TOPIC1_12) #ifdef TOPIC1_12HELP1 defb (in_com_hlp1_12 - in_help) /256 defb (in_com_hlp1_12 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_12HELP1) */ #ifdef TOPIC1_12ATTR APPLBYTE(TOPIC1_12ATTR) #else defb 0 #endif /* TOPIC1_12ATTR */ defb in_com_1_12end - in_com_1_12 .in_com_1_12end #endif /* TOPIC1_12 */ #ifdef TOPIC1_13 .in_com_1_13 defb in_com_1_13end - in_com_1_13 APPLBYTE(TOPIC1_13CODE) APPLNAME(TOPIC1_13KEY) APPLNAME(TOPIC1_13) #ifdef TOPIC1_13HELP1 defb (in_com_hlp1_13 - in_help) /256 defb (in_com_hlp1_13 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_13HELP1) */ #ifdef TOPIC1_13ATTR APPLBYTE(TOPIC1_13ATTR) #else defb 0 #endif /* TOPIC1_13ATTR */ defb in_com_1_13end - in_com_1_13 .in_com_1_13end #endif /* TOPIC1_13 */ #ifdef TOPIC1_14 .in_com_1_14 defb in_com_1_14end - in_com_1_14 APPLBYTE(TOPIC1_14CODE) APPLNAME(TOPIC1_14KEY) APPLNAME(TOPIC1_14) #ifdef TOPIC1_14HELP1 defb (in_com_hlp1_14 - in_help) /256 defb (in_com_hlp1_14 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_14HELP1) */ #ifdef TOPIC1_14ATTR APPLBYTE(TOPIC1_14ATTR) #else defb 0 #endif /* TOPIC1_14ATTR */ defb in_com_1_14end - in_com_1_14 .in_com_1_14end #endif /* TOPIC1_14 */ #ifdef TOPIC1_15 .in_com_1_15 defb in_com_1_15end - in_com_1_15 APPLBYTE(TOPIC1_15CODE) APPLNAME(TOPIC1_15KEY) APPLNAME(TOPIC1_15) #ifdef TOPIC1_15HELP1 defb (in_com_hlp1_15 - in_help) /256 defb (in_com_hlp1_15 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_15HELP1) */ #ifdef TOPIC1_15ATTR APPLBYTE(TOPIC1_15ATTR) #else defb 0 #endif /* TOPIC1_15ATTR */ defb in_com_1_15end - in_com_1_15 .in_com_1_15end #endif /* TOPIC1_15 */ #ifdef TOPIC1_16 .in_com_1_16 defb in_com_1_16end - in_com_1_16 APPLBYTE(TOPIC1_16CODE) APPLNAME(TOPIC1_16KEY) APPLNAME(TOPIC1_16) #ifdef TOPIC1_16HELP1 defb (in_com_hlp1_16 - in_help) /256 defb (in_com_hlp1_16 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_16HELP1) */ #ifdef TOPIC1_16ATTR APPLBYTE(TOPIC1_16ATTR) #else defb 0 #endif /* TOPIC1_16ATTR */ defb in_com_1_16end - in_com_1_16 .in_com_1_16end #endif /* TOPIC1_16 */ #ifdef TOPIC1_17 .in_com_1_17 defb in_com_1_17end - in_com_1_17 APPLBYTE(TOPIC1_17CODE) APPLNAME(TOPIC1_17KEY) APPLNAME(TOPIC1_17) #ifdef TOPIC1_17HELP1 defb (in_com_hlp1_17 - in_help) /256 defb (in_com_hlp1_17 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_17HELP1) */ #ifdef TOPIC1_17ATTR APPLBYTE(TOPIC1_17ATTR) #else defb 0 #endif /* TOPIC1_17ATTR */ defb in_com_1_17end - in_com_1_17 .in_com_1_17end #endif /* TOPIC1_17 */ #ifdef TOPIC1_18 .in_com_1_18 defb in_com_1_18end - in_com_1_18 APPLBYTE(TOPIC1_18CODE) APPLNAME(TOPIC1_18KEY) APPLNAME(TOPIC1_18) #ifdef TOPIC1_18HELP1 defb (in_com_hlp1_18 - in_help) /256 defb (in_com_hlp1_18 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_18HELP1) */ #ifdef TOPIC1_18ATTR APPLBYTE(TOPIC1_18ATTR) #else defb 0 #endif /* TOPIC1_18ATTR */ defb in_com_1_18end - in_com_1_18 .in_com_1_18end #endif /* TOPIC1_18 */ #ifdef TOPIC1_19 .in_com_1_19 defb in_com_1_19end - in_com_1_19 APPLBYTE(TOPIC1_19CODE) APPLNAME(TOPIC1_19KEY) APPLNAME(TOPIC1_19) #ifdef TOPIC1_19HELP1 defb (in_com_hlp1_19 - in_help) /256 defb (in_com_hlp1_19 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_19HELP1) */ #ifdef TOPIC1_19ATTR APPLBYTE(TOPIC1_19ATTR) #else defb 0 #endif /* TOPIC1_19ATTR */ defb in_com_1_19end - in_com_1_19 .in_com_1_19end #endif /* TOPIC1_19 */ #ifdef TOPIC1_20 .in_com_1_20 defb in_com_1_20end - in_com_1_20 APPLBYTE(TOPIC1_20CODE) APPLNAME(TOPIC1_20KEY) APPLNAME(TOPIC1_20) #ifdef TOPIC1_20HELP1 defb (in_com_hlp1_20 - in_help) /256 defb (in_com_hlp1_20 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_20HELP1) */ #ifdef TOPIC1_20ATTR APPLBYTE(TOPIC1_20ATTR) #else defb 0 #endif /* TOPIC1_20ATTR */ defb in_com_1_20end - in_com_1_20 .in_com_1_20end #endif /* TOPIC1_20 */ #ifdef TOPIC1_21 .in_com_1_21 defb in_com_1_21end - in_com_1_21 APPLBYTE(TOPIC1_21CODE) APPLNAME(TOPIC1_21KEY) APPLNAME(TOPIC1_21) #ifdef TOPIC1_21HELP1 defb (in_com_hlp1_21 - in_help) /256 defb (in_com_hlp1_21 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_21HELP1) */ #ifdef TOPIC1_21ATTR APPLBYTE(TOPIC1_21ATTR) #else defb 0 #endif /* TOPIC1_21ATTR */ defb in_com_1_21end - in_com_1_21 .in_com_1_21end #endif /* TOPIC1_21 */ #ifdef TOPIC1_22 .in_com_1_22 defb in_com_1_22end - in_com_1_22 APPLBYTE(TOPIC1_22CODE) APPLNAME(TOPIC1_22KEY) APPLNAME(TOPIC1_22) #ifdef TOPIC1_22HELP1 defb (in_com_hlp1_22 - in_help) /256 defb (in_com_hlp1_22 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_22HELP1) */ #ifdef TOPIC1_22ATTR APPLBYTE(TOPIC1_22ATTR) #else defb 0 #endif /* TOPIC1_22ATTR */ defb in_com_1_22end - in_com_1_22 .in_com_1_22end #endif /* TOPIC1_22 */ #ifdef TOPIC1_23 .in_com_1_23 defb in_com_1_23end - in_com_1_23 APPLBYTE(TOPIC1_23CODE) APPLNAME(TOPIC1_23KEY) APPLNAME(TOPIC1_23) #ifdef TOPIC1_23HELP1 defb (in_com_hlp1_23 - in_help) /256 defb (in_com_hlp1_23 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_23HELP1) */ #ifdef TOPIC1_23ATTR APPLBYTE(TOPIC1_23ATTR) #else defb 0 #endif /* TOPIC1_23ATTR */ defb in_com_1_23end - in_com_1_23 .in_com_1_23end #endif /* TOPIC1_23 */ #ifdef TOPIC1_24 .in_com_1_24 defb in_com_1_24end - in_com_1_24 APPLBYTE(TOPIC1_24CODE) APPLNAME(TOPIC1_24KEY) APPLNAME(TOPIC1_24) #ifdef TOPIC1_24HELP1 defb (in_com_hlp1_24 - in_help) /256 defb (in_com_hlp1_24 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC1_24HELP1) */ #ifdef TOPIC1_24ATTR APPLBYTE(TOPIC1_24ATTR) #else defb 0 #endif /* TOPIC1_24ATTR */ defb in_com_1_24end - in_com_1_24 .in_com_1_24end #endif /* TOPIC1_24 */ /* * If we have the first item of next topic, then we carry on! */ #ifdef TOPIC2_1 defb 1 ;end marker of current topic #endif z88dk-1.8.ds1/include/oz/command2.h0000644000175000017500000003271007130401716016432 0ustar tygrystygrys/* * Header for command entries for Topic 2 * * Do not include yourself - included by application.h * * 7/4/99 djm */ #ifdef TOPIC2_1 .in_com_2_1 defb in_com_2_1end - in_com_2_1 APPLBYTE(TOPIC2_1CODE) APPLNAME(TOPIC2_1KEY) APPLTEXT(TOPIC2_1) #ifdef TOPIC2_1HELP1 defb (in_com_hlp2_1 - in_help) /256 defb (in_com_hlp2_1 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC2_1HELP1) */ #ifdef TOPIC2_1ATTR APPLBYTE(TOPIC2_1ATTR) #else defb 0 #endif /* TOPIC2_1ATTR */ defb in_com_2_1end - in_com_2_1 .in_com_2_1end #endif /* TOPIC2_1 */ #ifdef TOPIC2_2 .in_com_2_2 defb in_com_2_2end - in_com_2_2 APPLBYTE(TOPIC2_2CODE) APPLNAME(TOPIC2_2KEY) APPLTEXT(TOPIC2_2) #ifdef TOPIC2_2HELP1 defb (in_com_hlp2_2 - in_help) /256 defb (in_com_hlp2_2 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC2_2HELP1) */ #ifdef TOPIC2_2ATTR APPLBYTE(TOPIC2_2ATTR) #else defb 0 #endif /* TOPIC2_2ATTR */ defb in_com_2_2end - in_com_2_2 .in_com_2_2end #endif /* TOPIC2_2 */ #ifdef TOPIC2_3 .in_com_2_3 defb in_com_2_3end - in_com_2_3 APPLBYTE(TOPIC2_3CODE) APPLNAME(TOPIC2_3KEY) APPLNAME(TOPIC2_3) #ifdef TOPIC2_3HELP1 defb (in_com_hlp2_3 - in_help) /256 defb (in_com_hlp2_3 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_3HELP1) */ #ifdef TOPIC2_3ATTR APPLBYTE(TOPIC2_3ATTR) #else defb 0 #endif /* TOPIC2_3ATTR */ defb in_com_2_3end - in_com_2_3 .in_com_2_3end #endif /* TOPIC2_3 */ #ifdef TOPIC2_4 .in_com_2_4 defb in_com_2_4end - in_com_2_4 APPLBYTE(TOPIC2_4CODE) APPLNAME(TOPIC2_4KEY) APPLNAME(TOPIC2_4) #ifdef TOPIC2_4HELP1 defb (in_com_hlp2_4 - in_help) /256 defb (in_com_hlp2_4 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_4HELP1) */ #ifdef TOPIC2_4ATTR APPLBYTE(TOPIC2_4ATTR) #else defb 0 #endif /* TOPIC2_4ATTR */ defb in_com_2_4end - in_com_2_4 .in_com_2_4end #endif /* TOPIC2_4 */ #ifdef TOPIC2_5 .in_com_2_5 defb in_com_2_5end - in_com_2_5 APPLBYTE(TOPIC2_5CODE) APPLNAME(TOPIC2_5KEY) APPLNAME(TOPIC2_5) #ifdef TOPIC2_5HELP1 defb (in_com_hlp2_5 - in_help) /256 defb (in_com_hlp2_5 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_5HELP1) */ #ifdef TOPIC2_5ATTR APPLBYTE(TOPIC2_5ATTR) #else defb 0 #endif /* TOPIC2_5ATTR */ defb in_com_2_5end - in_com_2_5 .in_com_2_5end #endif /* TOPIC2_5 */ #ifdef TOPIC2_6 .in_com_2_6 defb in_com_2_6end - in_com_2_6 APPLBYTE(TOPIC2_6CODE) APPLNAME(TOPIC2_6KEY) APPLNAME(TOPIC2_6) #ifdef TOPIC2_6HELP1 defb (in_com_hlp2_6 - in_help) /256 defb (in_com_hlp2_6 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_6HELP1) */ #ifdef TOPIC2_6ATTR APPLBYTE(TOPIC2_6ATTR) #else defb 0 #endif /* TOPIC2_6ATTR */ defb in_com_2_6end - in_com_2_6 .in_com_2_6end #endif /* TOPIC2_6 */ #ifdef TOPIC2_7 .in_com_2_7 defb in_com_2_7end - in_com_2_7 APPLBYTE(TOPIC2_7CODE) APPLNAME(TOPIC2_7KEY) APPLNAME(TOPIC2_7) #ifdef TOPIC2_7HELP1 defb (in_com_hlp2_7 - in_help) /256 defb (in_com_hlp2_7 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_7HELP1) */ #ifdef TOPIC2_7ATTR APPLBYTE(TOPIC2_7ATTR) #else defb 0 #endif /* TOPIC2_7ATTR */ defb in_com_2_7end - in_com_2_7 .in_com_2_7end #endif /* TOPIC2_7 */ #ifdef TOPIC2_8 .in_com_2_8 defb in_com_2_8end - in_com_2_8 APPLBYTE(TOPIC2_8CODE) APPLNAME(TOPIC2_8KEY) APPLNAME(TOPIC2_8) #ifdef TOPIC2_8HELP1 defb (in_com_hlp2_8 - in_help) /256 defb (in_com_hlp2_8 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_8HELP1) */ #ifdef TOPIC2_8ATTR APPLBYTE(TOPIC2_8ATTR) #else defb 0 #endif /* TOPIC2_8ATTR */ defb in_com_2_8end - in_com_2_8 .in_com_2_8end #endif /* TOPIC2_8 */ #ifdef TOPIC2_9 .in_com_2_9 defb in_com_2_9end - in_com_2_9 APPLBYTE(TOPIC2_9CODE) APPLNAME(TOPIC2_9KEY) APPLNAME(TOPIC2_9) #ifdef TOPIC2_9HELP1 defb (in_com_hlp2_9 - in_help) /256 defb (in_com_hlp2_9 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_9HELP1) */ #ifdef TOPIC2_9ATTR APPLBYTE(TOPIC2_9ATTR) #else defb 0 #endif /* TOPIC2_9ATTR */ defb in_com_2_9end - in_com_2_9 .in_com_2_9end #endif /* TOPIC2_9 */ #ifdef TOPIC2_10 .in_com_2_10 defb in_com_2_10end - in_com_2_10 APPLBYTE(TOPIC2_10CODE) APPLNAME(TOPIC2_10KEY) APPLNAME(TOPIC2_10) #ifdef TOPIC2_10HELP1 defb (in_com_hlp2_10 - in_help) /256 defb (in_com_hlp2_10 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_10HELP1) */ #ifdef TOPIC2_10ATTR APPLBYTE(TOPIC2_10ATTR) #else defb 0 #endif /* TOPIC2_10ATTR */ defb in_com_2_10end - in_com_2_10 .in_com_2_10end #endif /* TOPIC2_10 */ #ifdef TOPIC2_11 .in_com_2_11 defb in_com_2_11end - in_com_2_11 APPLBYTE(TOPIC2_11CODE) APPLNAME(TOPIC2_11KEY) APPLNAME(TOPIC2_11) #ifdef TOPIC2_11HELP1 defb (in_com_hlp2_11 - in_help) /256 defb (in_com_hlp2_11 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_11HELP1) */ #ifdef TOPIC2_11ATTR APPLBYTE(TOPIC2_11ATTR) #else defb 0 #endif /* TOPIC2_11ATTR */ defb in_com_2_11end - in_com_2_11 .in_com_2_11end #endif /* TOPIC2_11 */ #ifdef TOPIC2_12 .in_com_2_12 defb in_com_2_12end - in_com_2_12 APPLBYTE(TOPIC2_12CODE) APPLNAME(TOPIC2_12KEY) APPLNAME(TOPIC2_12) #ifdef TOPIC2_12HELP1 defb (in_com_hlp2_12 - in_help) /256 defb (in_com_hlp2_12 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_12HELP1) */ #ifdef TOPIC2_12ATTR APPLBYTE(TOPIC2_12ATTR) #else defb 0 #endif /* TOPIC2_12ATTR */ defb in_com_2_12end - in_com_2_12 .in_com_2_12end #endif /* TOPIC2_12 */ #ifdef TOPIC2_13 .in_com_2_13 defb in_com_2_13end - in_com_2_13 APPLBYTE(TOPIC2_13CODE) APPLNAME(TOPIC2_13KEY) APPLNAME(TOPIC2_13) #ifdef TOPIC2_13HELP1 defb (in_com_hlp2_13 - in_help) /256 defb (in_com_hlp2_13 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_13HELP1) */ #ifdef TOPIC2_13ATTR APPLBYTE(TOPIC2_13ATTR) #else defb 0 #endif /* TOPIC2_13ATTR */ defb in_com_2_13end - in_com_2_13 .in_com_2_13end #endif /* TOPIC2_13 */ #ifdef TOPIC2_14 .in_com_2_14 defb in_com_2_14end - in_com_2_14 APPLBYTE(TOPIC2_14CODE) APPLNAME(TOPIC2_14KEY) APPLNAME(TOPIC2_14) #ifdef TOPIC2_14HELP1 defb (in_com_hlp2_14 - in_help) /256 defb (in_com_hlp2_14 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_14HELP1) */ #ifdef TOPIC2_14ATTR APPLBYTE(TOPIC2_14ATTR) #else defb 0 #endif /* TOPIC2_14ATTR */ defb in_com_2_14end - in_com_2_14 .in_com_2_14end #endif /* TOPIC2_14 */ #ifdef TOPIC2_15 .in_com_2_15 defb in_com_2_15end - in_com_2_15 APPLBYTE(TOPIC2_15CODE) APPLNAME(TOPIC2_15KEY) APPLNAME(TOPIC2_15) #ifdef TOPIC2_15HELP1 defb (in_com_hlp2_15 - in_help) /256 defb (in_com_hlp2_15 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_15HELP1) */ #ifdef TOPIC2_15ATTR APPLBYTE(TOPIC2_15ATTR) #else defb 0 #endif /* TOPIC2_15ATTR */ defb in_com_2_15end - in_com_2_15 .in_com_2_15end #endif /* TOPIC2_15 */ #ifdef TOPIC2_16 .in_com_2_16 defb in_com_2_16end - in_com_2_16 APPLBYTE(TOPIC2_16CODE) APPLNAME(TOPIC2_16KEY) APPLNAME(TOPIC2_16) #ifdef TOPIC2_16HELP1 defb (in_com_hlp2_16 - in_help) /256 defb (in_com_hlp2_16 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_16HELP1) */ #ifdef TOPIC2_16ATTR APPLBYTE(TOPIC2_16ATTR) #else defb 0 #endif /* TOPIC2_16ATTR */ defb in_com_2_16end - in_com_2_16 .in_com_2_16end #endif /* TOPIC2_16 */ #ifdef TOPIC2_17 .in_com_2_17 defb in_com_2_17end - in_com_2_17 APPLBYTE(TOPIC2_17CODE) APPLNAME(TOPIC2_17KEY) APPLNAME(TOPIC2_17) #ifdef TOPIC2_17HELP1 defb (in_com_hlp2_17 - in_help) /256 defb (in_com_hlp2_17 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_17HELP1) */ #ifdef TOPIC2_17ATTR APPLBYTE(TOPIC2_17ATTR) #else defb 0 #endif /* TOPIC2_17ATTR */ defb in_com_2_17end - in_com_2_17 .in_com_2_17end #endif /* TOPIC2_17 */ #ifdef TOPIC2_18 .in_com_2_18 defb in_com_2_18end - in_com_2_18 APPLBYTE(TOPIC2_18CODE) APPLNAME(TOPIC2_18KEY) APPLNAME(TOPIC2_18) #ifdef TOPIC2_18HELP1 defb (in_com_hlp2_18 - in_help) /256 defb (in_com_hlp2_18 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_18HELP1) */ #ifdef TOPIC2_18ATTR APPLBYTE(TOPIC2_18ATTR) #else defb 0 #endif /* TOPIC2_18ATTR */ defb in_com_2_18end - in_com_2_18 .in_com_2_18end #endif /* TOPIC2_18 */ #ifdef TOPIC2_19 .in_com_2_19 defb in_com_2_19end - in_com_2_19 APPLBYTE(TOPIC2_19CODE) APPLNAME(TOPIC2_19KEY) APPLNAME(TOPIC2_19) #ifdef TOPIC2_19HELP1 defb (in_com_hlp2_19 - in_help) /256 defb (in_com_hlp2_19 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_19HELP1) */ #ifdef TOPIC2_19ATTR APPLBYTE(TOPIC2_19ATTR) #else defb 0 #endif /* TOPIC2_19ATTR */ defb in_com_2_19end - in_com_2_19 .in_com_2_19end #endif /* TOPIC2_19 */ #ifdef TOPIC2_20 .in_com_2_20 defb in_com_2_20end - in_com_2_20 APPLBYTE(TOPIC2_20CODE) APPLNAME(TOPIC2_20KEY) APPLNAME(TOPIC2_20) #ifdef TOPIC2_20HELP1 defb (in_com_hlp2_20 - in_help) /256 defb (in_com_hlp2_20 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_20HELP1) */ #ifdef TOPIC2_20ATTR APPLBYTE(TOPIC2_20ATTR) #else defb 0 #endif /* TOPIC2_20ATTR */ defb in_com_2_20end - in_com_2_20 .in_com_2_20end #endif /* TOPIC2_20 */ #ifdef TOPIC2_21 .in_com_2_21 defb in_com_2_21end - in_com_2_21 APPLBYTE(TOPIC2_21CODE) APPLNAME(TOPIC2_21KEY) APPLNAME(TOPIC2_21) #ifdef TOPIC2_21HELP1 defb (in_com_hlp2_21 - in_help) /256 defb (in_com_hlp2_21 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_21HELP1) */ #ifdef TOPIC2_21ATTR APPLBYTE(TOPIC2_21ATTR) #else defb 0 #endif /* TOPIC2_21ATTR */ defb in_com_2_21end - in_com_2_21 .in_com_2_21end #endif /* TOPIC2_21 */ #ifdef TOPIC2_22 .in_com_2_22 defb in_com_2_22end - in_com_2_22 APPLBYTE(TOPIC2_22CODE) APPLNAME(TOPIC2_22KEY) APPLNAME(TOPIC2_22) #ifdef TOPIC2_22HELP1 defb (in_com_hlp2_22 - in_help) /256 defb (in_com_hlp2_22 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_22HELP1) */ #ifdef TOPIC2_22ATTR APPLBYTE(TOPIC2_22ATTR) #else defb 0 #endif /* TOPIC2_22ATTR */ defb in_com_2_22end - in_com_2_22 .in_com_2_22end #endif /* TOPIC2_22 */ #ifdef TOPIC2_23 .in_com_2_23 defb in_com_2_23end - in_com_2_23 APPLBYTE(TOPIC2_23CODE) APPLNAME(TOPIC2_23KEY) APPLNAME(TOPIC2_23) #ifdef TOPIC2_23HELP1 defb (in_com_hlp2_23 - in_help) /256 defb (in_com_hlp2_23 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_23HELP1) */ #ifdef TOPIC2_23ATTR APPLBYTE(TOPIC2_23ATTR) #else defb 0 #endif /* TOPIC2_23ATTR */ defb in_com_2_23end - in_com_2_23 .in_com_2_23end #endif /* TOPIC2_23 */ #ifdef TOPIC2_24 .in_com_2_24 defb in_com_2_24end - in_com_2_24 APPLBYTE(TOPIC2_24CODE) APPLNAME(TOPIC2_24KEY) APPLNAME(TOPIC2_24) #ifdef TOPIC2_24HELP1 defb (in_com_hlp2_24 - in_help) /256 defb (in_com_hlp2_24 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC2_24HELP1) */ #ifdef TOPIC2_24ATTR APPLBYTE(TOPIC2_24ATTR) #else defb 0 #endif /* TOPIC2_24ATTR */ defb in_com_2_24end - in_com_2_24 .in_com_2_24end #endif /* TOPIC2_24 */ /* * If we have the first item of next topic, then we carry on! */ #ifdef TOPIC3_1 defb 1 ;end marker of current topic #endif z88dk-1.8.ds1/include/oz/command3.h0000644000175000017500000003271007130401715016432 0ustar tygrystygrys/* * Header for command entries for Topic 3 * * Do not include yourself - included by application.h * * 7/4/99 djm */ #ifdef TOPIC3_1 .in_com_3_1 defb in_com_3_1end - in_com_3_1 APPLBYTE(TOPIC3_1CODE) APPLNAME(TOPIC3_1KEY) APPLTEXT(TOPIC3_1) #ifdef TOPIC3_1HELP1 defb (in_com_hlp3_1 - in_help) /256 defb (in_com_hlp3_1 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC3_1HELP1) */ #ifdef TOPIC3_1ATTR APPLBYTE(TOPIC3_1ATTR) #else defb 0 #endif /* TOPIC3_1ATTR */ defb in_com_3_1end - in_com_3_1 .in_com_3_1end #endif /* TOPIC3_1 */ #ifdef TOPIC3_2 .in_com_3_2 defb in_com_3_2end - in_com_3_2 APPLBYTE(TOPIC3_2CODE) APPLNAME(TOPIC3_2KEY) APPLTEXT(TOPIC3_2) #ifdef TOPIC3_2HELP1 defb (in_com_hlp3_2 - in_help) /256 defb (in_com_hlp3_2 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC3_2HELP1) */ #ifdef TOPIC3_2ATTR APPLBYTE(TOPIC3_2ATTR) #else defb 0 #endif /* TOPIC3_2ATTR */ defb in_com_3_2end - in_com_3_2 .in_com_3_2end #endif /* TOPIC3_2 */ #ifdef TOPIC3_3 .in_com_3_3 defb in_com_3_3end - in_com_3_3 APPLBYTE(TOPIC3_3CODE) APPLNAME(TOPIC3_3KEY) APPLNAME(TOPIC3_3) #ifdef TOPIC3_3HELP1 defb (in_com_hlp3_3 - in_help) /256 defb (in_com_hlp3_3 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_3HELP1) */ #ifdef TOPIC3_3ATTR APPLBYTE(TOPIC3_3ATTR) #else defb 0 #endif /* TOPIC3_3ATTR */ defb in_com_3_3end - in_com_3_3 .in_com_3_3end #endif /* TOPIC3_3 */ #ifdef TOPIC3_4 .in_com_3_4 defb in_com_3_4end - in_com_3_4 APPLBYTE(TOPIC3_4CODE) APPLNAME(TOPIC3_4KEY) APPLNAME(TOPIC3_4) #ifdef TOPIC3_4HELP1 defb (in_com_hlp3_4 - in_help) /256 defb (in_com_hlp3_4 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_4HELP1) */ #ifdef TOPIC3_4ATTR APPLBYTE(TOPIC3_4ATTR) #else defb 0 #endif /* TOPIC3_4ATTR */ defb in_com_3_4end - in_com_3_4 .in_com_3_4end #endif /* TOPIC3_4 */ #ifdef TOPIC3_5 .in_com_3_5 defb in_com_3_5end - in_com_3_5 APPLBYTE(TOPIC3_5CODE) APPLNAME(TOPIC3_5KEY) APPLNAME(TOPIC3_5) #ifdef TOPIC3_5HELP1 defb (in_com_hlp3_5 - in_help) /256 defb (in_com_hlp3_5 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_5HELP1) */ #ifdef TOPIC3_5ATTR APPLBYTE(TOPIC3_5ATTR) #else defb 0 #endif /* TOPIC3_5ATTR */ defb in_com_3_5end - in_com_3_5 .in_com_3_5end #endif /* TOPIC3_5 */ #ifdef TOPIC3_6 .in_com_3_6 defb in_com_3_6end - in_com_3_6 APPLBYTE(TOPIC3_6CODE) APPLNAME(TOPIC3_6KEY) APPLNAME(TOPIC3_6) #ifdef TOPIC3_6HELP1 defb (in_com_hlp3_6 - in_help) /256 defb (in_com_hlp3_6 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_6HELP1) */ #ifdef TOPIC3_6ATTR APPLBYTE(TOPIC3_6ATTR) #else defb 0 #endif /* TOPIC3_6ATTR */ defb in_com_3_6end - in_com_3_6 .in_com_3_6end #endif /* TOPIC3_6 */ #ifdef TOPIC3_7 .in_com_3_7 defb in_com_3_7end - in_com_3_7 APPLBYTE(TOPIC3_7CODE) APPLNAME(TOPIC3_7KEY) APPLNAME(TOPIC3_7) #ifdef TOPIC3_7HELP1 defb (in_com_hlp3_7 - in_help) /256 defb (in_com_hlp3_7 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_7HELP1) */ #ifdef TOPIC3_7ATTR APPLBYTE(TOPIC3_7ATTR) #else defb 0 #endif /* TOPIC3_7ATTR */ defb in_com_3_7end - in_com_3_7 .in_com_3_7end #endif /* TOPIC3_7 */ #ifdef TOPIC3_8 .in_com_3_8 defb in_com_3_8end - in_com_3_8 APPLBYTE(TOPIC3_8CODE) APPLNAME(TOPIC3_8KEY) APPLNAME(TOPIC3_8) #ifdef TOPIC3_8HELP1 defb (in_com_hlp3_8 - in_help) /256 defb (in_com_hlp3_8 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_8HELP1) */ #ifdef TOPIC3_8ATTR APPLBYTE(TOPIC3_8ATTR) #else defb 0 #endif /* TOPIC3_8ATTR */ defb in_com_3_8end - in_com_3_8 .in_com_3_8end #endif /* TOPIC3_8 */ #ifdef TOPIC3_9 .in_com_3_9 defb in_com_3_9end - in_com_3_9 APPLBYTE(TOPIC3_9CODE) APPLNAME(TOPIC3_9KEY) APPLNAME(TOPIC3_9) #ifdef TOPIC3_9HELP1 defb (in_com_hlp3_9 - in_help) /256 defb (in_com_hlp3_9 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_9HELP1) */ #ifdef TOPIC3_9ATTR APPLBYTE(TOPIC3_9ATTR) #else defb 0 #endif /* TOPIC3_9ATTR */ defb in_com_3_9end - in_com_3_9 .in_com_3_9end #endif /* TOPIC3_9 */ #ifdef TOPIC3_10 .in_com_3_10 defb in_com_3_10end - in_com_3_10 APPLBYTE(TOPIC3_10CODE) APPLNAME(TOPIC3_10KEY) APPLNAME(TOPIC3_10) #ifdef TOPIC3_10HELP1 defb (in_com_hlp3_10 - in_help) /256 defb (in_com_hlp3_10 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_10HELP1) */ #ifdef TOPIC3_10ATTR APPLBYTE(TOPIC3_10ATTR) #else defb 0 #endif /* TOPIC3_10ATTR */ defb in_com_3_10end - in_com_3_10 .in_com_3_10end #endif /* TOPIC3_10 */ #ifdef TOPIC3_11 .in_com_3_11 defb in_com_3_11end - in_com_3_11 APPLBYTE(TOPIC3_11CODE) APPLNAME(TOPIC3_11KEY) APPLNAME(TOPIC3_11) #ifdef TOPIC3_11HELP1 defb (in_com_hlp3_11 - in_help) /256 defb (in_com_hlp3_11 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_11HELP1) */ #ifdef TOPIC3_11ATTR APPLBYTE(TOPIC3_11ATTR) #else defb 0 #endif /* TOPIC3_11ATTR */ defb in_com_3_11end - in_com_3_11 .in_com_3_11end #endif /* TOPIC3_11 */ #ifdef TOPIC3_12 .in_com_3_12 defb in_com_3_12end - in_com_3_12 APPLBYTE(TOPIC3_12CODE) APPLNAME(TOPIC3_12KEY) APPLNAME(TOPIC3_12) #ifdef TOPIC3_12HELP1 defb (in_com_hlp3_12 - in_help) /256 defb (in_com_hlp3_12 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_12HELP1) */ #ifdef TOPIC3_12ATTR APPLBYTE(TOPIC3_12ATTR) #else defb 0 #endif /* TOPIC3_12ATTR */ defb in_com_3_12end - in_com_3_12 .in_com_3_12end #endif /* TOPIC3_12 */ #ifdef TOPIC3_13 .in_com_3_13 defb in_com_3_13end - in_com_3_13 APPLBYTE(TOPIC3_13CODE) APPLNAME(TOPIC3_13KEY) APPLNAME(TOPIC3_13) #ifdef TOPIC3_13HELP1 defb (in_com_hlp3_13 - in_help) /256 defb (in_com_hlp3_13 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_13HELP1) */ #ifdef TOPIC3_13ATTR APPLBYTE(TOPIC3_13ATTR) #else defb 0 #endif /* TOPIC3_13ATTR */ defb in_com_3_13end - in_com_3_13 .in_com_3_13end #endif /* TOPIC3_13 */ #ifdef TOPIC3_14 .in_com_3_14 defb in_com_3_14end - in_com_3_14 APPLBYTE(TOPIC3_14CODE) APPLNAME(TOPIC3_14KEY) APPLNAME(TOPIC3_14) #ifdef TOPIC3_14HELP1 defb (in_com_hlp3_14 - in_help) /256 defb (in_com_hlp3_14 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_14HELP1) */ #ifdef TOPIC3_14ATTR APPLBYTE(TOPIC3_14ATTR) #else defb 0 #endif /* TOPIC3_14ATTR */ defb in_com_3_14end - in_com_3_14 .in_com_3_14end #endif /* TOPIC3_14 */ #ifdef TOPIC3_15 .in_com_3_15 defb in_com_3_15end - in_com_3_15 APPLBYTE(TOPIC3_15CODE) APPLNAME(TOPIC3_15KEY) APPLNAME(TOPIC3_15) #ifdef TOPIC3_15HELP1 defb (in_com_hlp3_15 - in_help) /256 defb (in_com_hlp3_15 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_15HELP1) */ #ifdef TOPIC3_15ATTR APPLBYTE(TOPIC3_15ATTR) #else defb 0 #endif /* TOPIC3_15ATTR */ defb in_com_3_15end - in_com_3_15 .in_com_3_15end #endif /* TOPIC3_15 */ #ifdef TOPIC3_16 .in_com_3_16 defb in_com_3_16end - in_com_3_16 APPLBYTE(TOPIC3_16CODE) APPLNAME(TOPIC3_16KEY) APPLNAME(TOPIC3_16) #ifdef TOPIC3_16HELP1 defb (in_com_hlp3_16 - in_help) /256 defb (in_com_hlp3_16 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_16HELP1) */ #ifdef TOPIC3_16ATTR APPLBYTE(TOPIC3_16ATTR) #else defb 0 #endif /* TOPIC3_16ATTR */ defb in_com_3_16end - in_com_3_16 .in_com_3_16end #endif /* TOPIC3_16 */ #ifdef TOPIC3_17 .in_com_3_17 defb in_com_3_17end - in_com_3_17 APPLBYTE(TOPIC3_17CODE) APPLNAME(TOPIC3_17KEY) APPLNAME(TOPIC3_17) #ifdef TOPIC3_17HELP1 defb (in_com_hlp3_17 - in_help) /256 defb (in_com_hlp3_17 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_17HELP1) */ #ifdef TOPIC3_17ATTR APPLBYTE(TOPIC3_17ATTR) #else defb 0 #endif /* TOPIC3_17ATTR */ defb in_com_3_17end - in_com_3_17 .in_com_3_17end #endif /* TOPIC3_17 */ #ifdef TOPIC3_18 .in_com_3_18 defb in_com_3_18end - in_com_3_18 APPLBYTE(TOPIC3_18CODE) APPLNAME(TOPIC3_18KEY) APPLNAME(TOPIC3_18) #ifdef TOPIC3_18HELP1 defb (in_com_hlp3_18 - in_help) /256 defb (in_com_hlp3_18 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_18HELP1) */ #ifdef TOPIC3_18ATTR APPLBYTE(TOPIC3_18ATTR) #else defb 0 #endif /* TOPIC3_18ATTR */ defb in_com_3_18end - in_com_3_18 .in_com_3_18end #endif /* TOPIC3_18 */ #ifdef TOPIC3_19 .in_com_3_19 defb in_com_3_19end - in_com_3_19 APPLBYTE(TOPIC3_19CODE) APPLNAME(TOPIC3_19KEY) APPLNAME(TOPIC3_19) #ifdef TOPIC3_19HELP1 defb (in_com_hlp3_19 - in_help) /256 defb (in_com_hlp3_19 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_19HELP1) */ #ifdef TOPIC3_19ATTR APPLBYTE(TOPIC3_19ATTR) #else defb 0 #endif /* TOPIC3_19ATTR */ defb in_com_3_19end - in_com_3_19 .in_com_3_19end #endif /* TOPIC3_19 */ #ifdef TOPIC3_20 .in_com_3_20 defb in_com_3_20end - in_com_3_20 APPLBYTE(TOPIC3_20CODE) APPLNAME(TOPIC3_20KEY) APPLNAME(TOPIC3_20) #ifdef TOPIC3_20HELP1 defb (in_com_hlp3_20 - in_help) /256 defb (in_com_hlp3_20 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_20HELP1) */ #ifdef TOPIC3_20ATTR APPLBYTE(TOPIC3_20ATTR) #else defb 0 #endif /* TOPIC3_20ATTR */ defb in_com_3_20end - in_com_3_20 .in_com_3_20end #endif /* TOPIC3_20 */ #ifdef TOPIC3_21 .in_com_3_21 defb in_com_3_21end - in_com_3_21 APPLBYTE(TOPIC3_21CODE) APPLNAME(TOPIC3_21KEY) APPLNAME(TOPIC3_21) #ifdef TOPIC3_21HELP1 defb (in_com_hlp3_21 - in_help) /256 defb (in_com_hlp3_21 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_21HELP1) */ #ifdef TOPIC3_21ATTR APPLBYTE(TOPIC3_21ATTR) #else defb 0 #endif /* TOPIC3_21ATTR */ defb in_com_3_21end - in_com_3_21 .in_com_3_21end #endif /* TOPIC3_21 */ #ifdef TOPIC3_22 .in_com_3_22 defb in_com_3_22end - in_com_3_22 APPLBYTE(TOPIC3_22CODE) APPLNAME(TOPIC3_22KEY) APPLNAME(TOPIC3_22) #ifdef TOPIC3_22HELP1 defb (in_com_hlp3_22 - in_help) /256 defb (in_com_hlp3_22 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_22HELP1) */ #ifdef TOPIC3_22ATTR APPLBYTE(TOPIC3_22ATTR) #else defb 0 #endif /* TOPIC3_22ATTR */ defb in_com_3_22end - in_com_3_22 .in_com_3_22end #endif /* TOPIC3_22 */ #ifdef TOPIC3_23 .in_com_3_23 defb in_com_3_23end - in_com_3_23 APPLBYTE(TOPIC3_23CODE) APPLNAME(TOPIC3_23KEY) APPLNAME(TOPIC3_23) #ifdef TOPIC3_23HELP1 defb (in_com_hlp3_23 - in_help) /256 defb (in_com_hlp3_23 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_23HELP1) */ #ifdef TOPIC3_23ATTR APPLBYTE(TOPIC3_23ATTR) #else defb 0 #endif /* TOPIC3_23ATTR */ defb in_com_3_23end - in_com_3_23 .in_com_3_23end #endif /* TOPIC3_23 */ #ifdef TOPIC3_24 .in_com_3_24 defb in_com_3_24end - in_com_3_24 APPLBYTE(TOPIC3_24CODE) APPLNAME(TOPIC3_24KEY) APPLNAME(TOPIC3_24) #ifdef TOPIC3_24HELP1 defb (in_com_hlp3_24 - in_help) /256 defb (in_com_hlp3_24 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC3_24HELP1) */ #ifdef TOPIC3_24ATTR APPLBYTE(TOPIC3_24ATTR) #else defb 0 #endif /* TOPIC3_24ATTR */ defb in_com_3_24end - in_com_3_24 .in_com_3_24end #endif /* TOPIC3_24 */ /* * If we have the first item of next topic, then we carry on! */ #ifdef TOPIC4_1 defb 1 ;end marker of current topic #endif z88dk-1.8.ds1/include/oz/command4.h0000644000175000017500000003271007130401715016433 0ustar tygrystygrys/* * Header for command entries for Topic 4 * * Do not include yourself - included by application.h * * 7/4/99 djm */ #ifdef TOPIC4_1 .in_com_4_1 defb in_com_4_1end - in_com_4_1 APPLBYTE(TOPIC4_1CODE) APPLNAME(TOPIC4_1KEY) APPLTEXT(TOPIC4_1) #ifdef TOPIC4_1HELP1 defb (in_com_hlp4_1 - in_help) /256 defb (in_com_hlp4_1 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC4_1HELP1) */ #ifdef TOPIC4_1ATTR APPLBYTE(TOPIC4_1ATTR) #else defb 0 #endif /* TOPIC4_1ATTR */ defb in_com_4_1end - in_com_4_1 .in_com_4_1end #endif /* TOPIC4_1 */ #ifdef TOPIC4_2 .in_com_4_2 defb in_com_4_2end - in_com_4_2 APPLBYTE(TOPIC4_2CODE) APPLNAME(TOPIC4_2KEY) APPLTEXT(TOPIC4_2) #ifdef TOPIC4_2HELP1 defb (in_com_hlp4_2 - in_help) /256 defb (in_com_hlp4_2 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC4_2HELP1) */ #ifdef TOPIC4_2ATTR APPLBYTE(TOPIC4_2ATTR) #else defb 0 #endif /* TOPIC4_2ATTR */ defb in_com_4_2end - in_com_4_2 .in_com_4_2end #endif /* TOPIC4_2 */ #ifdef TOPIC4_3 .in_com_4_3 defb in_com_4_3end - in_com_4_3 APPLBYTE(TOPIC4_3CODE) APPLNAME(TOPIC4_3KEY) APPLNAME(TOPIC4_3) #ifdef TOPIC4_3HELP1 defb (in_com_hlp4_3 - in_help) /256 defb (in_com_hlp4_3 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_3HELP1) */ #ifdef TOPIC4_3ATTR APPLBYTE(TOPIC4_3ATTR) #else defb 0 #endif /* TOPIC4_3ATTR */ defb in_com_4_3end - in_com_4_3 .in_com_4_3end #endif /* TOPIC4_3 */ #ifdef TOPIC4_4 .in_com_4_4 defb in_com_4_4end - in_com_4_4 APPLBYTE(TOPIC4_4CODE) APPLNAME(TOPIC4_4KEY) APPLNAME(TOPIC4_4) #ifdef TOPIC4_4HELP1 defb (in_com_hlp4_4 - in_help) /256 defb (in_com_hlp4_4 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_4HELP1) */ #ifdef TOPIC4_4ATTR APPLBYTE(TOPIC4_4ATTR) #else defb 0 #endif /* TOPIC4_4ATTR */ defb in_com_4_4end - in_com_4_4 .in_com_4_4end #endif /* TOPIC4_4 */ #ifdef TOPIC4_5 .in_com_4_5 defb in_com_4_5end - in_com_4_5 APPLBYTE(TOPIC4_5CODE) APPLNAME(TOPIC4_5KEY) APPLNAME(TOPIC4_5) #ifdef TOPIC4_5HELP1 defb (in_com_hlp4_5 - in_help) /256 defb (in_com_hlp4_5 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_5HELP1) */ #ifdef TOPIC4_5ATTR APPLBYTE(TOPIC4_5ATTR) #else defb 0 #endif /* TOPIC4_5ATTR */ defb in_com_4_5end - in_com_4_5 .in_com_4_5end #endif /* TOPIC4_5 */ #ifdef TOPIC4_6 .in_com_4_6 defb in_com_4_6end - in_com_4_6 APPLBYTE(TOPIC4_6CODE) APPLNAME(TOPIC4_6KEY) APPLNAME(TOPIC4_6) #ifdef TOPIC4_6HELP1 defb (in_com_hlp4_6 - in_help) /256 defb (in_com_hlp4_6 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_6HELP1) */ #ifdef TOPIC4_6ATTR APPLBYTE(TOPIC4_6ATTR) #else defb 0 #endif /* TOPIC4_6ATTR */ defb in_com_4_6end - in_com_4_6 .in_com_4_6end #endif /* TOPIC4_6 */ #ifdef TOPIC4_7 .in_com_4_7 defb in_com_4_7end - in_com_4_7 APPLBYTE(TOPIC4_7CODE) APPLNAME(TOPIC4_7KEY) APPLNAME(TOPIC4_7) #ifdef TOPIC4_7HELP1 defb (in_com_hlp4_7 - in_help) /256 defb (in_com_hlp4_7 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_7HELP1) */ #ifdef TOPIC4_7ATTR APPLBYTE(TOPIC4_7ATTR) #else defb 0 #endif /* TOPIC4_7ATTR */ defb in_com_4_7end - in_com_4_7 .in_com_4_7end #endif /* TOPIC4_7 */ #ifdef TOPIC4_8 .in_com_4_8 defb in_com_4_8end - in_com_4_8 APPLBYTE(TOPIC4_8CODE) APPLNAME(TOPIC4_8KEY) APPLNAME(TOPIC4_8) #ifdef TOPIC4_8HELP1 defb (in_com_hlp4_8 - in_help) /256 defb (in_com_hlp4_8 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_8HELP1) */ #ifdef TOPIC4_8ATTR APPLBYTE(TOPIC4_8ATTR) #else defb 0 #endif /* TOPIC4_8ATTR */ defb in_com_4_8end - in_com_4_8 .in_com_4_8end #endif /* TOPIC4_8 */ #ifdef TOPIC4_9 .in_com_4_9 defb in_com_4_9end - in_com_4_9 APPLBYTE(TOPIC4_9CODE) APPLNAME(TOPIC4_9KEY) APPLNAME(TOPIC4_9) #ifdef TOPIC4_9HELP1 defb (in_com_hlp4_9 - in_help) /256 defb (in_com_hlp4_9 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_9HELP1) */ #ifdef TOPIC4_9ATTR APPLBYTE(TOPIC4_9ATTR) #else defb 0 #endif /* TOPIC4_9ATTR */ defb in_com_4_9end - in_com_4_9 .in_com_4_9end #endif /* TOPIC4_9 */ #ifdef TOPIC4_10 .in_com_4_10 defb in_com_4_10end - in_com_4_10 APPLBYTE(TOPIC4_10CODE) APPLNAME(TOPIC4_10KEY) APPLNAME(TOPIC4_10) #ifdef TOPIC4_10HELP1 defb (in_com_hlp4_10 - in_help) /256 defb (in_com_hlp4_10 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_10HELP1) */ #ifdef TOPIC4_10ATTR APPLBYTE(TOPIC4_10ATTR) #else defb 0 #endif /* TOPIC4_10ATTR */ defb in_com_4_10end - in_com_4_10 .in_com_4_10end #endif /* TOPIC4_10 */ #ifdef TOPIC4_11 .in_com_4_11 defb in_com_4_11end - in_com_4_11 APPLBYTE(TOPIC4_11CODE) APPLNAME(TOPIC4_11KEY) APPLNAME(TOPIC4_11) #ifdef TOPIC4_11HELP1 defb (in_com_hlp4_11 - in_help) /256 defb (in_com_hlp4_11 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_11HELP1) */ #ifdef TOPIC4_11ATTR APPLBYTE(TOPIC4_11ATTR) #else defb 0 #endif /* TOPIC4_11ATTR */ defb in_com_4_11end - in_com_4_11 .in_com_4_11end #endif /* TOPIC4_11 */ #ifdef TOPIC4_12 .in_com_4_12 defb in_com_4_12end - in_com_4_12 APPLBYTE(TOPIC4_12CODE) APPLNAME(TOPIC4_12KEY) APPLNAME(TOPIC4_12) #ifdef TOPIC4_12HELP1 defb (in_com_hlp4_12 - in_help) /256 defb (in_com_hlp4_12 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_12HELP1) */ #ifdef TOPIC4_12ATTR APPLBYTE(TOPIC4_12ATTR) #else defb 0 #endif /* TOPIC4_12ATTR */ defb in_com_4_12end - in_com_4_12 .in_com_4_12end #endif /* TOPIC4_12 */ #ifdef TOPIC4_13 .in_com_4_13 defb in_com_4_13end - in_com_4_13 APPLBYTE(TOPIC4_13CODE) APPLNAME(TOPIC4_13KEY) APPLNAME(TOPIC4_13) #ifdef TOPIC4_13HELP1 defb (in_com_hlp4_13 - in_help) /256 defb (in_com_hlp4_13 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_13HELP1) */ #ifdef TOPIC4_13ATTR APPLBYTE(TOPIC4_13ATTR) #else defb 0 #endif /* TOPIC4_13ATTR */ defb in_com_4_13end - in_com_4_13 .in_com_4_13end #endif /* TOPIC4_13 */ #ifdef TOPIC4_14 .in_com_4_14 defb in_com_4_14end - in_com_4_14 APPLBYTE(TOPIC4_14CODE) APPLNAME(TOPIC4_14KEY) APPLNAME(TOPIC4_14) #ifdef TOPIC4_14HELP1 defb (in_com_hlp4_14 - in_help) /256 defb (in_com_hlp4_14 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_14HELP1) */ #ifdef TOPIC4_14ATTR APPLBYTE(TOPIC4_14ATTR) #else defb 0 #endif /* TOPIC4_14ATTR */ defb in_com_4_14end - in_com_4_14 .in_com_4_14end #endif /* TOPIC4_14 */ #ifdef TOPIC4_15 .in_com_4_15 defb in_com_4_15end - in_com_4_15 APPLBYTE(TOPIC4_15CODE) APPLNAME(TOPIC4_15KEY) APPLNAME(TOPIC4_15) #ifdef TOPIC4_15HELP1 defb (in_com_hlp4_15 - in_help) /256 defb (in_com_hlp4_15 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_15HELP1) */ #ifdef TOPIC4_15ATTR APPLBYTE(TOPIC4_15ATTR) #else defb 0 #endif /* TOPIC4_15ATTR */ defb in_com_4_15end - in_com_4_15 .in_com_4_15end #endif /* TOPIC4_15 */ #ifdef TOPIC4_16 .in_com_4_16 defb in_com_4_16end - in_com_4_16 APPLBYTE(TOPIC4_16CODE) APPLNAME(TOPIC4_16KEY) APPLNAME(TOPIC4_16) #ifdef TOPIC4_16HELP1 defb (in_com_hlp4_16 - in_help) /256 defb (in_com_hlp4_16 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_16HELP1) */ #ifdef TOPIC4_16ATTR APPLBYTE(TOPIC4_16ATTR) #else defb 0 #endif /* TOPIC4_16ATTR */ defb in_com_4_16end - in_com_4_16 .in_com_4_16end #endif /* TOPIC4_16 */ #ifdef TOPIC4_17 .in_com_4_17 defb in_com_4_17end - in_com_4_17 APPLBYTE(TOPIC4_17CODE) APPLNAME(TOPIC4_17KEY) APPLNAME(TOPIC4_17) #ifdef TOPIC4_17HELP1 defb (in_com_hlp4_17 - in_help) /256 defb (in_com_hlp4_17 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_17HELP1) */ #ifdef TOPIC4_17ATTR APPLBYTE(TOPIC4_17ATTR) #else defb 0 #endif /* TOPIC4_17ATTR */ defb in_com_4_17end - in_com_4_17 .in_com_4_17end #endif /* TOPIC4_17 */ #ifdef TOPIC4_18 .in_com_4_18 defb in_com_4_18end - in_com_4_18 APPLBYTE(TOPIC4_18CODE) APPLNAME(TOPIC4_18KEY) APPLNAME(TOPIC4_18) #ifdef TOPIC4_18HELP1 defb (in_com_hlp4_18 - in_help) /256 defb (in_com_hlp4_18 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_18HELP1) */ #ifdef TOPIC4_18ATTR APPLBYTE(TOPIC4_18ATTR) #else defb 0 #endif /* TOPIC4_18ATTR */ defb in_com_4_18end - in_com_4_18 .in_com_4_18end #endif /* TOPIC4_18 */ #ifdef TOPIC4_19 .in_com_4_19 defb in_com_4_19end - in_com_4_19 APPLBYTE(TOPIC4_19CODE) APPLNAME(TOPIC4_19KEY) APPLNAME(TOPIC4_19) #ifdef TOPIC4_19HELP1 defb (in_com_hlp4_19 - in_help) /256 defb (in_com_hlp4_19 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_19HELP1) */ #ifdef TOPIC4_19ATTR APPLBYTE(TOPIC4_19ATTR) #else defb 0 #endif /* TOPIC4_19ATTR */ defb in_com_4_19end - in_com_4_19 .in_com_4_19end #endif /* TOPIC4_19 */ #ifdef TOPIC4_20 .in_com_4_20 defb in_com_4_20end - in_com_4_20 APPLBYTE(TOPIC4_20CODE) APPLNAME(TOPIC4_20KEY) APPLNAME(TOPIC4_20) #ifdef TOPIC4_20HELP1 defb (in_com_hlp4_20 - in_help) /256 defb (in_com_hlp4_20 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_20HELP1) */ #ifdef TOPIC4_20ATTR APPLBYTE(TOPIC4_20ATTR) #else defb 0 #endif /* TOPIC4_20ATTR */ defb in_com_4_20end - in_com_4_20 .in_com_4_20end #endif /* TOPIC4_20 */ #ifdef TOPIC4_21 .in_com_4_21 defb in_com_4_21end - in_com_4_21 APPLBYTE(TOPIC4_21CODE) APPLNAME(TOPIC4_21KEY) APPLNAME(TOPIC4_21) #ifdef TOPIC4_21HELP1 defb (in_com_hlp4_21 - in_help) /256 defb (in_com_hlp4_21 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_21HELP1) */ #ifdef TOPIC4_21ATTR APPLBYTE(TOPIC4_21ATTR) #else defb 0 #endif /* TOPIC4_21ATTR */ defb in_com_4_21end - in_com_4_21 .in_com_4_21end #endif /* TOPIC4_21 */ #ifdef TOPIC4_22 .in_com_4_22 defb in_com_4_22end - in_com_4_22 APPLBYTE(TOPIC4_22CODE) APPLNAME(TOPIC4_22KEY) APPLNAME(TOPIC4_22) #ifdef TOPIC4_22HELP1 defb (in_com_hlp4_22 - in_help) /256 defb (in_com_hlp4_22 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_22HELP1) */ #ifdef TOPIC4_22ATTR APPLBYTE(TOPIC4_22ATTR) #else defb 0 #endif /* TOPIC4_22ATTR */ defb in_com_4_22end - in_com_4_22 .in_com_4_22end #endif /* TOPIC4_22 */ #ifdef TOPIC4_23 .in_com_4_23 defb in_com_4_23end - in_com_4_23 APPLBYTE(TOPIC4_23CODE) APPLNAME(TOPIC4_23KEY) APPLNAME(TOPIC4_23) #ifdef TOPIC4_23HELP1 defb (in_com_hlp4_23 - in_help) /256 defb (in_com_hlp4_23 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_23HELP1) */ #ifdef TOPIC4_23ATTR APPLBYTE(TOPIC4_23ATTR) #else defb 0 #endif /* TOPIC4_23ATTR */ defb in_com_4_23end - in_com_4_23 .in_com_4_23end #endif /* TOPIC4_23 */ #ifdef TOPIC4_24 .in_com_4_24 defb in_com_4_24end - in_com_4_24 APPLBYTE(TOPIC4_24CODE) APPLNAME(TOPIC4_24KEY) APPLNAME(TOPIC4_24) #ifdef TOPIC4_24HELP1 defb (in_com_hlp4_24 - in_help) /256 defb (in_com_hlp4_24 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC4_24HELP1) */ #ifdef TOPIC4_24ATTR APPLBYTE(TOPIC4_24ATTR) #else defb 0 #endif /* TOPIC4_24ATTR */ defb in_com_4_24end - in_com_4_24 .in_com_4_24end #endif /* TOPIC4_24 */ /* * If we have the first item of next topic, then we carry on! */ #ifdef TOPIC5_1 defb 1 ;end marker of current topic #endif z88dk-1.8.ds1/include/oz/command5.h0000644000175000017500000003271007130401715016434 0ustar tygrystygrys/* * Header for command entries for Topic 5 * * Do not include yourself - included by application.h * * 7/4/99 djm */ #ifdef TOPIC5_1 .in_com_5_1 defb in_com_5_1end - in_com_5_1 APPLBYTE(TOPIC5_1CODE) APPLNAME(TOPIC5_1KEY) APPLTEXT(TOPIC5_1) #ifdef TOPIC5_1HELP1 defb (in_com_hlp5_1 - in_help) /256 defb (in_com_hlp5_1 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC5_1HELP1) */ #ifdef TOPIC5_1ATTR APPLBYTE(TOPIC5_1ATTR) #else defb 0 #endif /* TOPIC5_1ATTR */ defb in_com_5_1end - in_com_5_1 .in_com_5_1end #endif /* TOPIC5_1 */ #ifdef TOPIC5_2 .in_com_5_2 defb in_com_5_2end - in_com_5_2 APPLBYTE(TOPIC5_2CODE) APPLNAME(TOPIC5_2KEY) APPLTEXT(TOPIC5_2) #ifdef TOPIC5_2HELP1 defb (in_com_hlp5_2 - in_help) /256 defb (in_com_hlp5_2 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC5_2HELP1) */ #ifdef TOPIC5_2ATTR APPLBYTE(TOPIC5_2ATTR) #else defb 0 #endif /* TOPIC5_2ATTR */ defb in_com_5_2end - in_com_5_2 .in_com_5_2end #endif /* TOPIC5_2 */ #ifdef TOPIC5_3 .in_com_5_3 defb in_com_5_3end - in_com_5_3 APPLBYTE(TOPIC5_3CODE) APPLNAME(TOPIC5_3KEY) APPLNAME(TOPIC5_3) #ifdef TOPIC5_3HELP1 defb (in_com_hlp5_3 - in_help) /256 defb (in_com_hlp5_3 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_3HELP1) */ #ifdef TOPIC5_3ATTR APPLBYTE(TOPIC5_3ATTR) #else defb 0 #endif /* TOPIC5_3ATTR */ defb in_com_5_3end - in_com_5_3 .in_com_5_3end #endif /* TOPIC5_3 */ #ifdef TOPIC5_4 .in_com_5_4 defb in_com_5_4end - in_com_5_4 APPLBYTE(TOPIC5_4CODE) APPLNAME(TOPIC5_4KEY) APPLNAME(TOPIC5_4) #ifdef TOPIC5_4HELP1 defb (in_com_hlp5_4 - in_help) /256 defb (in_com_hlp5_4 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_4HELP1) */ #ifdef TOPIC5_4ATTR APPLBYTE(TOPIC5_4ATTR) #else defb 0 #endif /* TOPIC5_4ATTR */ defb in_com_5_4end - in_com_5_4 .in_com_5_4end #endif /* TOPIC5_4 */ #ifdef TOPIC5_5 .in_com_5_5 defb in_com_5_5end - in_com_5_5 APPLBYTE(TOPIC5_5CODE) APPLNAME(TOPIC5_5KEY) APPLNAME(TOPIC5_5) #ifdef TOPIC5_5HELP1 defb (in_com_hlp5_5 - in_help) /256 defb (in_com_hlp5_5 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_5HELP1) */ #ifdef TOPIC5_5ATTR APPLBYTE(TOPIC5_5ATTR) #else defb 0 #endif /* TOPIC5_5ATTR */ defb in_com_5_5end - in_com_5_5 .in_com_5_5end #endif /* TOPIC5_5 */ #ifdef TOPIC5_6 .in_com_5_6 defb in_com_5_6end - in_com_5_6 APPLBYTE(TOPIC5_6CODE) APPLNAME(TOPIC5_6KEY) APPLNAME(TOPIC5_6) #ifdef TOPIC5_6HELP1 defb (in_com_hlp5_6 - in_help) /256 defb (in_com_hlp5_6 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_6HELP1) */ #ifdef TOPIC5_6ATTR APPLBYTE(TOPIC5_6ATTR) #else defb 0 #endif /* TOPIC5_6ATTR */ defb in_com_5_6end - in_com_5_6 .in_com_5_6end #endif /* TOPIC5_6 */ #ifdef TOPIC5_7 .in_com_5_7 defb in_com_5_7end - in_com_5_7 APPLBYTE(TOPIC5_7CODE) APPLNAME(TOPIC5_7KEY) APPLNAME(TOPIC5_7) #ifdef TOPIC5_7HELP1 defb (in_com_hlp5_7 - in_help) /256 defb (in_com_hlp5_7 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_7HELP1) */ #ifdef TOPIC5_7ATTR APPLBYTE(TOPIC5_7ATTR) #else defb 0 #endif /* TOPIC5_7ATTR */ defb in_com_5_7end - in_com_5_7 .in_com_5_7end #endif /* TOPIC5_7 */ #ifdef TOPIC5_8 .in_com_5_8 defb in_com_5_8end - in_com_5_8 APPLBYTE(TOPIC5_8CODE) APPLNAME(TOPIC5_8KEY) APPLNAME(TOPIC5_8) #ifdef TOPIC5_8HELP1 defb (in_com_hlp5_8 - in_help) /256 defb (in_com_hlp5_8 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_8HELP1) */ #ifdef TOPIC5_8ATTR APPLBYTE(TOPIC5_8ATTR) #else defb 0 #endif /* TOPIC5_8ATTR */ defb in_com_5_8end - in_com_5_8 .in_com_5_8end #endif /* TOPIC5_8 */ #ifdef TOPIC5_9 .in_com_5_9 defb in_com_5_9end - in_com_5_9 APPLBYTE(TOPIC5_9CODE) APPLNAME(TOPIC5_9KEY) APPLNAME(TOPIC5_9) #ifdef TOPIC5_9HELP1 defb (in_com_hlp5_9 - in_help) /256 defb (in_com_hlp5_9 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_9HELP1) */ #ifdef TOPIC5_9ATTR APPLBYTE(TOPIC5_9ATTR) #else defb 0 #endif /* TOPIC5_9ATTR */ defb in_com_5_9end - in_com_5_9 .in_com_5_9end #endif /* TOPIC5_9 */ #ifdef TOPIC5_10 .in_com_5_10 defb in_com_5_10end - in_com_5_10 APPLBYTE(TOPIC5_10CODE) APPLNAME(TOPIC5_10KEY) APPLNAME(TOPIC5_10) #ifdef TOPIC5_10HELP1 defb (in_com_hlp5_10 - in_help) /256 defb (in_com_hlp5_10 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_10HELP1) */ #ifdef TOPIC5_10ATTR APPLBYTE(TOPIC5_10ATTR) #else defb 0 #endif /* TOPIC5_10ATTR */ defb in_com_5_10end - in_com_5_10 .in_com_5_10end #endif /* TOPIC5_10 */ #ifdef TOPIC5_11 .in_com_5_11 defb in_com_5_11end - in_com_5_11 APPLBYTE(TOPIC5_11CODE) APPLNAME(TOPIC5_11KEY) APPLNAME(TOPIC5_11) #ifdef TOPIC5_11HELP1 defb (in_com_hlp5_11 - in_help) /256 defb (in_com_hlp5_11 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_11HELP1) */ #ifdef TOPIC5_11ATTR APPLBYTE(TOPIC5_11ATTR) #else defb 0 #endif /* TOPIC5_11ATTR */ defb in_com_5_11end - in_com_5_11 .in_com_5_11end #endif /* TOPIC5_11 */ #ifdef TOPIC5_12 .in_com_5_12 defb in_com_5_12end - in_com_5_12 APPLBYTE(TOPIC5_12CODE) APPLNAME(TOPIC5_12KEY) APPLNAME(TOPIC5_12) #ifdef TOPIC5_12HELP1 defb (in_com_hlp5_12 - in_help) /256 defb (in_com_hlp5_12 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_12HELP1) */ #ifdef TOPIC5_12ATTR APPLBYTE(TOPIC5_12ATTR) #else defb 0 #endif /* TOPIC5_12ATTR */ defb in_com_5_12end - in_com_5_12 .in_com_5_12end #endif /* TOPIC5_12 */ #ifdef TOPIC5_13 .in_com_5_13 defb in_com_5_13end - in_com_5_13 APPLBYTE(TOPIC5_13CODE) APPLNAME(TOPIC5_13KEY) APPLNAME(TOPIC5_13) #ifdef TOPIC5_13HELP1 defb (in_com_hlp5_13 - in_help) /256 defb (in_com_hlp5_13 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_13HELP1) */ #ifdef TOPIC5_13ATTR APPLBYTE(TOPIC5_13ATTR) #else defb 0 #endif /* TOPIC5_13ATTR */ defb in_com_5_13end - in_com_5_13 .in_com_5_13end #endif /* TOPIC5_13 */ #ifdef TOPIC5_14 .in_com_5_14 defb in_com_5_14end - in_com_5_14 APPLBYTE(TOPIC5_14CODE) APPLNAME(TOPIC5_14KEY) APPLNAME(TOPIC5_14) #ifdef TOPIC5_14HELP1 defb (in_com_hlp5_14 - in_help) /256 defb (in_com_hlp5_14 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_14HELP1) */ #ifdef TOPIC5_14ATTR APPLBYTE(TOPIC5_14ATTR) #else defb 0 #endif /* TOPIC5_14ATTR */ defb in_com_5_14end - in_com_5_14 .in_com_5_14end #endif /* TOPIC5_14 */ #ifdef TOPIC5_15 .in_com_5_15 defb in_com_5_15end - in_com_5_15 APPLBYTE(TOPIC5_15CODE) APPLNAME(TOPIC5_15KEY) APPLNAME(TOPIC5_15) #ifdef TOPIC5_15HELP1 defb (in_com_hlp5_15 - in_help) /256 defb (in_com_hlp5_15 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_15HELP1) */ #ifdef TOPIC5_15ATTR APPLBYTE(TOPIC5_15ATTR) #else defb 0 #endif /* TOPIC5_15ATTR */ defb in_com_5_15end - in_com_5_15 .in_com_5_15end #endif /* TOPIC5_15 */ #ifdef TOPIC5_16 .in_com_5_16 defb in_com_5_16end - in_com_5_16 APPLBYTE(TOPIC5_16CODE) APPLNAME(TOPIC5_16KEY) APPLNAME(TOPIC5_16) #ifdef TOPIC5_16HELP1 defb (in_com_hlp5_16 - in_help) /256 defb (in_com_hlp5_16 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_16HELP1) */ #ifdef TOPIC5_16ATTR APPLBYTE(TOPIC5_16ATTR) #else defb 0 #endif /* TOPIC5_16ATTR */ defb in_com_5_16end - in_com_5_16 .in_com_5_16end #endif /* TOPIC5_16 */ #ifdef TOPIC5_17 .in_com_5_17 defb in_com_5_17end - in_com_5_17 APPLBYTE(TOPIC5_17CODE) APPLNAME(TOPIC5_17KEY) APPLNAME(TOPIC5_17) #ifdef TOPIC5_17HELP1 defb (in_com_hlp5_17 - in_help) /256 defb (in_com_hlp5_17 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_17HELP1) */ #ifdef TOPIC5_17ATTR APPLBYTE(TOPIC5_17ATTR) #else defb 0 #endif /* TOPIC5_17ATTR */ defb in_com_5_17end - in_com_5_17 .in_com_5_17end #endif /* TOPIC5_17 */ #ifdef TOPIC5_18 .in_com_5_18 defb in_com_5_18end - in_com_5_18 APPLBYTE(TOPIC5_18CODE) APPLNAME(TOPIC5_18KEY) APPLNAME(TOPIC5_18) #ifdef TOPIC5_18HELP1 defb (in_com_hlp5_18 - in_help) /256 defb (in_com_hlp5_18 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_18HELP1) */ #ifdef TOPIC5_18ATTR APPLBYTE(TOPIC5_18ATTR) #else defb 0 #endif /* TOPIC5_18ATTR */ defb in_com_5_18end - in_com_5_18 .in_com_5_18end #endif /* TOPIC5_18 */ #ifdef TOPIC5_19 .in_com_5_19 defb in_com_5_19end - in_com_5_19 APPLBYTE(TOPIC5_19CODE) APPLNAME(TOPIC5_19KEY) APPLNAME(TOPIC5_19) #ifdef TOPIC5_19HELP1 defb (in_com_hlp5_19 - in_help) /256 defb (in_com_hlp5_19 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_19HELP1) */ #ifdef TOPIC5_19ATTR APPLBYTE(TOPIC5_19ATTR) #else defb 0 #endif /* TOPIC5_19ATTR */ defb in_com_5_19end - in_com_5_19 .in_com_5_19end #endif /* TOPIC5_19 */ #ifdef TOPIC5_20 .in_com_5_20 defb in_com_5_20end - in_com_5_20 APPLBYTE(TOPIC5_20CODE) APPLNAME(TOPIC5_20KEY) APPLNAME(TOPIC5_20) #ifdef TOPIC5_20HELP1 defb (in_com_hlp5_20 - in_help) /256 defb (in_com_hlp5_20 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_20HELP1) */ #ifdef TOPIC5_20ATTR APPLBYTE(TOPIC5_20ATTR) #else defb 0 #endif /* TOPIC5_20ATTR */ defb in_com_5_20end - in_com_5_20 .in_com_5_20end #endif /* TOPIC5_20 */ #ifdef TOPIC5_21 .in_com_5_21 defb in_com_5_21end - in_com_5_21 APPLBYTE(TOPIC5_21CODE) APPLNAME(TOPIC5_21KEY) APPLNAME(TOPIC5_21) #ifdef TOPIC5_21HELP1 defb (in_com_hlp5_21 - in_help) /256 defb (in_com_hlp5_21 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_21HELP1) */ #ifdef TOPIC5_21ATTR APPLBYTE(TOPIC5_21ATTR) #else defb 0 #endif /* TOPIC5_21ATTR */ defb in_com_5_21end - in_com_5_21 .in_com_5_21end #endif /* TOPIC5_21 */ #ifdef TOPIC5_22 .in_com_5_22 defb in_com_5_22end - in_com_5_22 APPLBYTE(TOPIC5_22CODE) APPLNAME(TOPIC5_22KEY) APPLNAME(TOPIC5_22) #ifdef TOPIC5_22HELP1 defb (in_com_hlp5_22 - in_help) /256 defb (in_com_hlp5_22 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_22HELP1) */ #ifdef TOPIC5_22ATTR APPLBYTE(TOPIC5_22ATTR) #else defb 0 #endif /* TOPIC5_22ATTR */ defb in_com_5_22end - in_com_5_22 .in_com_5_22end #endif /* TOPIC5_22 */ #ifdef TOPIC5_23 .in_com_5_23 defb in_com_5_23end - in_com_5_23 APPLBYTE(TOPIC5_23CODE) APPLNAME(TOPIC5_23KEY) APPLNAME(TOPIC5_23) #ifdef TOPIC5_23HELP1 defb (in_com_hlp5_23 - in_help) /256 defb (in_com_hlp5_23 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_23HELP1) */ #ifdef TOPIC5_23ATTR APPLBYTE(TOPIC5_23ATTR) #else defb 0 #endif /* TOPIC5_23ATTR */ defb in_com_5_23end - in_com_5_23 .in_com_5_23end #endif /* TOPIC5_23 */ #ifdef TOPIC5_24 .in_com_5_24 defb in_com_5_24end - in_com_5_24 APPLBYTE(TOPIC5_24CODE) APPLNAME(TOPIC5_24KEY) APPLNAME(TOPIC5_24) #ifdef TOPIC5_24HELP1 defb (in_com_hlp5_24 - in_help) /256 defb (in_com_hlp5_24 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC5_24HELP1) */ #ifdef TOPIC5_24ATTR APPLBYTE(TOPIC5_24ATTR) #else defb 0 #endif /* TOPIC5_24ATTR */ defb in_com_5_24end - in_com_5_24 .in_com_5_24end #endif /* TOPIC5_24 */ /* * If we have the first item of next topic, then we carry on! */ #ifdef TOPIC6_1 defb 1 ;end marker of current topic #endif z88dk-1.8.ds1/include/oz/command6.h0000644000175000017500000003271007130401715016435 0ustar tygrystygrys/* * Header for command entries for Topic 6 * * Do not include yourself - included by application.h * * 7/4/99 djm */ #ifdef TOPIC6_1 .in_com_6_1 defb in_com_6_1end - in_com_6_1 APPLBYTE(TOPIC6_1CODE) APPLNAME(TOPIC6_1KEY) APPLTEXT(TOPIC6_1) #ifdef TOPIC6_1HELP1 defb (in_com_hlp6_1 - in_help) /256 defb (in_com_hlp6_1 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC6_1HELP1) */ #ifdef TOPIC6_1ATTR APPLBYTE(TOPIC6_1ATTR) #else defb 0 #endif /* TOPIC6_1ATTR */ defb in_com_6_1end - in_com_6_1 .in_com_6_1end #endif /* TOPIC6_1 */ #ifdef TOPIC6_2 .in_com_6_2 defb in_com_6_2end - in_com_6_2 APPLBYTE(TOPIC6_2CODE) APPLNAME(TOPIC6_2KEY) APPLTEXT(TOPIC6_2) #ifdef TOPIC6_2HELP1 defb (in_com_hlp6_2 - in_help) /256 defb (in_com_hlp6_2 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC6_2HELP1) */ #ifdef TOPIC6_2ATTR APPLBYTE(TOPIC6_2ATTR) #else defb 0 #endif /* TOPIC6_2ATTR */ defb in_com_6_2end - in_com_6_2 .in_com_6_2end #endif /* TOPIC6_2 */ #ifdef TOPIC6_3 .in_com_6_3 defb in_com_6_3end - in_com_6_3 APPLBYTE(TOPIC6_3CODE) APPLNAME(TOPIC6_3KEY) APPLNAME(TOPIC6_3) #ifdef TOPIC6_3HELP1 defb (in_com_hlp6_3 - in_help) /256 defb (in_com_hlp6_3 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_3HELP1) */ #ifdef TOPIC6_3ATTR APPLBYTE(TOPIC6_3ATTR) #else defb 0 #endif /* TOPIC6_3ATTR */ defb in_com_6_3end - in_com_6_3 .in_com_6_3end #endif /* TOPIC6_3 */ #ifdef TOPIC6_4 .in_com_6_4 defb in_com_6_4end - in_com_6_4 APPLBYTE(TOPIC6_4CODE) APPLNAME(TOPIC6_4KEY) APPLNAME(TOPIC6_4) #ifdef TOPIC6_4HELP1 defb (in_com_hlp6_4 - in_help) /256 defb (in_com_hlp6_4 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_4HELP1) */ #ifdef TOPIC6_4ATTR APPLBYTE(TOPIC6_4ATTR) #else defb 0 #endif /* TOPIC6_4ATTR */ defb in_com_6_4end - in_com_6_4 .in_com_6_4end #endif /* TOPIC6_4 */ #ifdef TOPIC6_5 .in_com_6_5 defb in_com_6_5end - in_com_6_5 APPLBYTE(TOPIC6_5CODE) APPLNAME(TOPIC6_5KEY) APPLNAME(TOPIC6_5) #ifdef TOPIC6_5HELP1 defb (in_com_hlp6_5 - in_help) /256 defb (in_com_hlp6_5 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_5HELP1) */ #ifdef TOPIC6_5ATTR APPLBYTE(TOPIC6_5ATTR) #else defb 0 #endif /* TOPIC6_5ATTR */ defb in_com_6_5end - in_com_6_5 .in_com_6_5end #endif /* TOPIC6_5 */ #ifdef TOPIC6_6 .in_com_6_6 defb in_com_6_6end - in_com_6_6 APPLBYTE(TOPIC6_6CODE) APPLNAME(TOPIC6_6KEY) APPLNAME(TOPIC6_6) #ifdef TOPIC6_6HELP1 defb (in_com_hlp6_6 - in_help) /256 defb (in_com_hlp6_6 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_6HELP1) */ #ifdef TOPIC6_6ATTR APPLBYTE(TOPIC6_6ATTR) #else defb 0 #endif /* TOPIC6_6ATTR */ defb in_com_6_6end - in_com_6_6 .in_com_6_6end #endif /* TOPIC6_6 */ #ifdef TOPIC6_7 .in_com_6_7 defb in_com_6_7end - in_com_6_7 APPLBYTE(TOPIC6_7CODE) APPLNAME(TOPIC6_7KEY) APPLNAME(TOPIC6_7) #ifdef TOPIC6_7HELP1 defb (in_com_hlp6_7 - in_help) /256 defb (in_com_hlp6_7 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_7HELP1) */ #ifdef TOPIC6_7ATTR APPLBYTE(TOPIC6_7ATTR) #else defb 0 #endif /* TOPIC6_7ATTR */ defb in_com_6_7end - in_com_6_7 .in_com_6_7end #endif /* TOPIC6_7 */ #ifdef TOPIC6_8 .in_com_6_8 defb in_com_6_8end - in_com_6_8 APPLBYTE(TOPIC6_8CODE) APPLNAME(TOPIC6_8KEY) APPLNAME(TOPIC6_8) #ifdef TOPIC6_8HELP1 defb (in_com_hlp6_8 - in_help) /256 defb (in_com_hlp6_8 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_8HELP1) */ #ifdef TOPIC6_8ATTR APPLBYTE(TOPIC6_8ATTR) #else defb 0 #endif /* TOPIC6_8ATTR */ defb in_com_6_8end - in_com_6_8 .in_com_6_8end #endif /* TOPIC6_8 */ #ifdef TOPIC6_9 .in_com_6_9 defb in_com_6_9end - in_com_6_9 APPLBYTE(TOPIC6_9CODE) APPLNAME(TOPIC6_9KEY) APPLNAME(TOPIC6_9) #ifdef TOPIC6_9HELP1 defb (in_com_hlp6_9 - in_help) /256 defb (in_com_hlp6_9 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_9HELP1) */ #ifdef TOPIC6_9ATTR APPLBYTE(TOPIC6_9ATTR) #else defb 0 #endif /* TOPIC6_9ATTR */ defb in_com_6_9end - in_com_6_9 .in_com_6_9end #endif /* TOPIC6_9 */ #ifdef TOPIC6_10 .in_com_6_10 defb in_com_6_10end - in_com_6_10 APPLBYTE(TOPIC6_10CODE) APPLNAME(TOPIC6_10KEY) APPLNAME(TOPIC6_10) #ifdef TOPIC6_10HELP1 defb (in_com_hlp6_10 - in_help) /256 defb (in_com_hlp6_10 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_10HELP1) */ #ifdef TOPIC6_10ATTR APPLBYTE(TOPIC6_10ATTR) #else defb 0 #endif /* TOPIC6_10ATTR */ defb in_com_6_10end - in_com_6_10 .in_com_6_10end #endif /* TOPIC6_10 */ #ifdef TOPIC6_11 .in_com_6_11 defb in_com_6_11end - in_com_6_11 APPLBYTE(TOPIC6_11CODE) APPLNAME(TOPIC6_11KEY) APPLNAME(TOPIC6_11) #ifdef TOPIC6_11HELP1 defb (in_com_hlp6_11 - in_help) /256 defb (in_com_hlp6_11 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_11HELP1) */ #ifdef TOPIC6_11ATTR APPLBYTE(TOPIC6_11ATTR) #else defb 0 #endif /* TOPIC6_11ATTR */ defb in_com_6_11end - in_com_6_11 .in_com_6_11end #endif /* TOPIC6_11 */ #ifdef TOPIC6_12 .in_com_6_12 defb in_com_6_12end - in_com_6_12 APPLBYTE(TOPIC6_12CODE) APPLNAME(TOPIC6_12KEY) APPLNAME(TOPIC6_12) #ifdef TOPIC6_12HELP1 defb (in_com_hlp6_12 - in_help) /256 defb (in_com_hlp6_12 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_12HELP1) */ #ifdef TOPIC6_12ATTR APPLBYTE(TOPIC6_12ATTR) #else defb 0 #endif /* TOPIC6_12ATTR */ defb in_com_6_12end - in_com_6_12 .in_com_6_12end #endif /* TOPIC6_12 */ #ifdef TOPIC6_13 .in_com_6_13 defb in_com_6_13end - in_com_6_13 APPLBYTE(TOPIC6_13CODE) APPLNAME(TOPIC6_13KEY) APPLNAME(TOPIC6_13) #ifdef TOPIC6_13HELP1 defb (in_com_hlp6_13 - in_help) /256 defb (in_com_hlp6_13 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_13HELP1) */ #ifdef TOPIC6_13ATTR APPLBYTE(TOPIC6_13ATTR) #else defb 0 #endif /* TOPIC6_13ATTR */ defb in_com_6_13end - in_com_6_13 .in_com_6_13end #endif /* TOPIC6_13 */ #ifdef TOPIC6_14 .in_com_6_14 defb in_com_6_14end - in_com_6_14 APPLBYTE(TOPIC6_14CODE) APPLNAME(TOPIC6_14KEY) APPLNAME(TOPIC6_14) #ifdef TOPIC6_14HELP1 defb (in_com_hlp6_14 - in_help) /256 defb (in_com_hlp6_14 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_14HELP1) */ #ifdef TOPIC6_14ATTR APPLBYTE(TOPIC6_14ATTR) #else defb 0 #endif /* TOPIC6_14ATTR */ defb in_com_6_14end - in_com_6_14 .in_com_6_14end #endif /* TOPIC6_14 */ #ifdef TOPIC6_15 .in_com_6_15 defb in_com_6_15end - in_com_6_15 APPLBYTE(TOPIC6_15CODE) APPLNAME(TOPIC6_15KEY) APPLNAME(TOPIC6_15) #ifdef TOPIC6_15HELP1 defb (in_com_hlp6_15 - in_help) /256 defb (in_com_hlp6_15 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_15HELP1) */ #ifdef TOPIC6_15ATTR APPLBYTE(TOPIC6_15ATTR) #else defb 0 #endif /* TOPIC6_15ATTR */ defb in_com_6_15end - in_com_6_15 .in_com_6_15end #endif /* TOPIC6_15 */ #ifdef TOPIC6_16 .in_com_6_16 defb in_com_6_16end - in_com_6_16 APPLBYTE(TOPIC6_16CODE) APPLNAME(TOPIC6_16KEY) APPLNAME(TOPIC6_16) #ifdef TOPIC6_16HELP1 defb (in_com_hlp6_16 - in_help) /256 defb (in_com_hlp6_16 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_16HELP1) */ #ifdef TOPIC6_16ATTR APPLBYTE(TOPIC6_16ATTR) #else defb 0 #endif /* TOPIC6_16ATTR */ defb in_com_6_16end - in_com_6_16 .in_com_6_16end #endif /* TOPIC6_16 */ #ifdef TOPIC6_17 .in_com_6_17 defb in_com_6_17end - in_com_6_17 APPLBYTE(TOPIC6_17CODE) APPLNAME(TOPIC6_17KEY) APPLNAME(TOPIC6_17) #ifdef TOPIC6_17HELP1 defb (in_com_hlp6_17 - in_help) /256 defb (in_com_hlp6_17 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_17HELP1) */ #ifdef TOPIC6_17ATTR APPLBYTE(TOPIC6_17ATTR) #else defb 0 #endif /* TOPIC6_17ATTR */ defb in_com_6_17end - in_com_6_17 .in_com_6_17end #endif /* TOPIC6_17 */ #ifdef TOPIC6_18 .in_com_6_18 defb in_com_6_18end - in_com_6_18 APPLBYTE(TOPIC6_18CODE) APPLNAME(TOPIC6_18KEY) APPLNAME(TOPIC6_18) #ifdef TOPIC6_18HELP1 defb (in_com_hlp6_18 - in_help) /256 defb (in_com_hlp6_18 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_18HELP1) */ #ifdef TOPIC6_18ATTR APPLBYTE(TOPIC6_18ATTR) #else defb 0 #endif /* TOPIC6_18ATTR */ defb in_com_6_18end - in_com_6_18 .in_com_6_18end #endif /* TOPIC6_18 */ #ifdef TOPIC6_19 .in_com_6_19 defb in_com_6_19end - in_com_6_19 APPLBYTE(TOPIC6_19CODE) APPLNAME(TOPIC6_19KEY) APPLNAME(TOPIC6_19) #ifdef TOPIC6_19HELP1 defb (in_com_hlp6_19 - in_help) /256 defb (in_com_hlp6_19 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_19HELP1) */ #ifdef TOPIC6_19ATTR APPLBYTE(TOPIC6_19ATTR) #else defb 0 #endif /* TOPIC6_19ATTR */ defb in_com_6_19end - in_com_6_19 .in_com_6_19end #endif /* TOPIC6_19 */ #ifdef TOPIC6_20 .in_com_6_20 defb in_com_6_20end - in_com_6_20 APPLBYTE(TOPIC6_20CODE) APPLNAME(TOPIC6_20KEY) APPLNAME(TOPIC6_20) #ifdef TOPIC6_20HELP1 defb (in_com_hlp6_20 - in_help) /256 defb (in_com_hlp6_20 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_20HELP1) */ #ifdef TOPIC6_20ATTR APPLBYTE(TOPIC6_20ATTR) #else defb 0 #endif /* TOPIC6_20ATTR */ defb in_com_6_20end - in_com_6_20 .in_com_6_20end #endif /* TOPIC6_20 */ #ifdef TOPIC6_21 .in_com_6_21 defb in_com_6_21end - in_com_6_21 APPLBYTE(TOPIC6_21CODE) APPLNAME(TOPIC6_21KEY) APPLNAME(TOPIC6_21) #ifdef TOPIC6_21HELP1 defb (in_com_hlp6_21 - in_help) /256 defb (in_com_hlp6_21 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_21HELP1) */ #ifdef TOPIC6_21ATTR APPLBYTE(TOPIC6_21ATTR) #else defb 0 #endif /* TOPIC6_21ATTR */ defb in_com_6_21end - in_com_6_21 .in_com_6_21end #endif /* TOPIC6_21 */ #ifdef TOPIC6_22 .in_com_6_22 defb in_com_6_22end - in_com_6_22 APPLBYTE(TOPIC6_22CODE) APPLNAME(TOPIC6_22KEY) APPLNAME(TOPIC6_22) #ifdef TOPIC6_22HELP1 defb (in_com_hlp6_22 - in_help) /256 defb (in_com_hlp6_22 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_22HELP1) */ #ifdef TOPIC6_22ATTR APPLBYTE(TOPIC6_22ATTR) #else defb 0 #endif /* TOPIC6_22ATTR */ defb in_com_6_22end - in_com_6_22 .in_com_6_22end #endif /* TOPIC6_22 */ #ifdef TOPIC6_23 .in_com_6_23 defb in_com_6_23end - in_com_6_23 APPLBYTE(TOPIC6_23CODE) APPLNAME(TOPIC6_23KEY) APPLNAME(TOPIC6_23) #ifdef TOPIC6_23HELP1 defb (in_com_hlp6_23 - in_help) /256 defb (in_com_hlp6_23 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_23HELP1) */ #ifdef TOPIC6_23ATTR APPLBYTE(TOPIC6_23ATTR) #else defb 0 #endif /* TOPIC6_23ATTR */ defb in_com_6_23end - in_com_6_23 .in_com_6_23end #endif /* TOPIC6_23 */ #ifdef TOPIC6_24 .in_com_6_24 defb in_com_6_24end - in_com_6_24 APPLBYTE(TOPIC6_24CODE) APPLNAME(TOPIC6_24KEY) APPLNAME(TOPIC6_24) #ifdef TOPIC6_24HELP1 defb (in_com_hlp6_24 - in_help) /256 defb (in_com_hlp6_24 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC6_24HELP1) */ #ifdef TOPIC6_24ATTR APPLBYTE(TOPIC6_24ATTR) #else defb 0 #endif /* TOPIC6_24ATTR */ defb in_com_6_24end - in_com_6_24 .in_com_6_24end #endif /* TOPIC6_24 */ /* * If we have the first item of next topic, then we carry on! */ #ifdef TOPIC7_1 defb 1 ;end marker of current topic #endif z88dk-1.8.ds1/include/oz/command7.h0000644000175000017500000003245607130401716016446 0ustar tygrystygrys/* * Header for command entries for Topic 7 * * Do not include yourself - included by application.h * * 7/4/99 djm */ #ifdef TOPIC7_1 .in_com_7_1 defb in_com_7_1end - in_com_7_1 APPLBYTE(TOPIC7_1CODE) APPLNAME(TOPIC7_1KEY) APPLTEXT(TOPIC7_1) #ifdef TOPIC7_1HELP1 defb (in_com_hlp7_1 - in_help) /256 defb (in_com_hlp7_1 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC7_1HELP1) */ #ifdef TOPIC7_1ATTR APPLBYTE(TOPIC7_1ATTR) #else defb 0 #endif /* TOPIC7_1ATTR */ defb in_com_7_1end - in_com_7_1 .in_com_7_1end #endif /* TOPIC7_1 */ #ifdef TOPIC7_2 .in_com_7_2 defb in_com_7_2end - in_com_7_2 APPLBYTE(TOPIC7_2CODE) APPLNAME(TOPIC7_2KEY) APPLTEXT(TOPIC7_2) #ifdef TOPIC7_2HELP1 defb (in_com_hlp7_2 - in_help) /256 defb (in_com_hlp7_2 - in_help) %256 #else defb 0,0 ;pointer to help - use \0 #endif /* TOPIC7_2HELP1) */ #ifdef TOPIC7_2ATTR APPLBYTE(TOPIC7_2ATTR) #else defb 0 #endif /* TOPIC7_2ATTR */ defb in_com_7_2end - in_com_7_2 .in_com_7_2end #endif /* TOPIC7_2 */ #ifdef TOPIC7_3 .in_com_7_3 defb in_com_7_3end - in_com_7_3 APPLBYTE(TOPIC7_3CODE) APPLNAME(TOPIC7_3KEY) APPLNAME(TOPIC7_3) #ifdef TOPIC7_3HELP1 defb (in_com_hlp7_3 - in_help) /256 defb (in_com_hlp7_3 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_3HELP1) */ #ifdef TOPIC7_3ATTR APPLBYTE(TOPIC7_3ATTR) #else defb 0 #endif /* TOPIC7_3ATTR */ defb in_com_7_3end - in_com_7_3 .in_com_7_3end #endif /* TOPIC7_3 */ #ifdef TOPIC7_4 .in_com_7_4 defb in_com_7_4end - in_com_7_4 APPLBYTE(TOPIC7_4CODE) APPLNAME(TOPIC7_4KEY) APPLNAME(TOPIC7_4) #ifdef TOPIC7_4HELP1 defb (in_com_hlp7_4 - in_help) /256 defb (in_com_hlp7_4 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_4HELP1) */ #ifdef TOPIC7_4ATTR APPLBYTE(TOPIC7_4ATTR) #else defb 0 #endif /* TOPIC7_4ATTR */ defb in_com_7_4end - in_com_7_4 .in_com_7_4end #endif /* TOPIC7_4 */ #ifdef TOPIC7_5 .in_com_7_5 defb in_com_7_5end - in_com_7_5 APPLBYTE(TOPIC7_5CODE) APPLNAME(TOPIC7_5KEY) APPLNAME(TOPIC7_5) #ifdef TOPIC7_5HELP1 defb (in_com_hlp7_5 - in_help) /256 defb (in_com_hlp7_5 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_5HELP1) */ #ifdef TOPIC7_5ATTR APPLBYTE(TOPIC7_5ATTR) #else defb 0 #endif /* TOPIC7_5ATTR */ defb in_com_7_5end - in_com_7_5 .in_com_7_5end #endif /* TOPIC7_5 */ #ifdef TOPIC7_6 .in_com_7_6 defb in_com_7_6end - in_com_7_6 APPLBYTE(TOPIC7_6CODE) APPLNAME(TOPIC7_6KEY) APPLNAME(TOPIC7_6) #ifdef TOPIC7_6HELP1 defb (in_com_hlp7_6 - in_help) /256 defb (in_com_hlp7_6 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_6HELP1) */ #ifdef TOPIC7_6ATTR APPLBYTE(TOPIC7_6ATTR) #else defb 0 #endif /* TOPIC7_6ATTR */ defb in_com_7_6end - in_com_7_6 .in_com_7_6end #endif /* TOPIC7_6 */ #ifdef TOPIC7_7 .in_com_7_7 defb in_com_7_7end - in_com_7_7 APPLBYTE(TOPIC7_7CODE) APPLNAME(TOPIC7_7KEY) APPLNAME(TOPIC7_7) #ifdef TOPIC7_7HELP1 defb (in_com_hlp7_7 - in_help) /256 defb (in_com_hlp7_7 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_7HELP1) */ #ifdef TOPIC7_7ATTR APPLBYTE(TOPIC7_7ATTR) #else defb 0 #endif /* TOPIC7_7ATTR */ defb in_com_7_7end - in_com_7_7 .in_com_7_7end #endif /* TOPIC7_7 */ #ifdef TOPIC7_8 .in_com_7_8 defb in_com_7_8end - in_com_7_8 APPLBYTE(TOPIC7_8CODE) APPLNAME(TOPIC7_8KEY) APPLNAME(TOPIC7_8) #ifdef TOPIC7_8HELP1 defb (in_com_hlp7_8 - in_help) /256 defb (in_com_hlp7_8 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_8HELP1) */ #ifdef TOPIC7_8ATTR APPLBYTE(TOPIC7_8ATTR) #else defb 0 #endif /* TOPIC7_8ATTR */ defb in_com_7_8end - in_com_7_8 .in_com_7_8end #endif /* TOPIC7_8 */ #ifdef TOPIC7_9 .in_com_7_9 defb in_com_7_9end - in_com_7_9 APPLBYTE(TOPIC7_9CODE) APPLNAME(TOPIC7_9KEY) APPLNAME(TOPIC7_9) #ifdef TOPIC7_9HELP1 defb (in_com_hlp7_9 - in_help) /256 defb (in_com_hlp7_9 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_9HELP1) */ #ifdef TOPIC7_9ATTR APPLBYTE(TOPIC7_9ATTR) #else defb 0 #endif /* TOPIC7_9ATTR */ defb in_com_7_9end - in_com_7_9 .in_com_7_9end #endif /* TOPIC7_9 */ #ifdef TOPIC7_10 .in_com_7_10 defb in_com_7_10end - in_com_7_10 APPLBYTE(TOPIC7_10CODE) APPLNAME(TOPIC7_10KEY) APPLNAME(TOPIC7_10) #ifdef TOPIC7_10HELP1 defb (in_com_hlp7_10 - in_help) /256 defb (in_com_hlp7_10 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_10HELP1) */ #ifdef TOPIC7_10ATTR APPLBYTE(TOPIC7_10ATTR) #else defb 0 #endif /* TOPIC7_10ATTR */ defb in_com_7_10end - in_com_7_10 .in_com_7_10end #endif /* TOPIC7_10 */ #ifdef TOPIC7_11 .in_com_7_11 defb in_com_7_11end - in_com_7_11 APPLBYTE(TOPIC7_11CODE) APPLNAME(TOPIC7_11KEY) APPLNAME(TOPIC7_11) #ifdef TOPIC7_11HELP1 defb (in_com_hlp7_11 - in_help) /256 defb (in_com_hlp7_11 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_11HELP1) */ #ifdef TOPIC7_11ATTR APPLBYTE(TOPIC7_11ATTR) #else defb 0 #endif /* TOPIC7_11ATTR */ defb in_com_7_11end - in_com_7_11 .in_com_7_11end #endif /* TOPIC7_11 */ #ifdef TOPIC7_12 .in_com_7_12 defb in_com_7_12end - in_com_7_12 APPLBYTE(TOPIC7_12CODE) APPLNAME(TOPIC7_12KEY) APPLNAME(TOPIC7_12) #ifdef TOPIC7_12HELP1 defb (in_com_hlp7_12 - in_help) /256 defb (in_com_hlp7_12 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_12HELP1) */ #ifdef TOPIC7_12ATTR APPLBYTE(TOPIC7_12ATTR) #else defb 0 #endif /* TOPIC7_12ATTR */ defb in_com_7_12end - in_com_7_12 .in_com_7_12end #endif /* TOPIC7_12 */ #ifdef TOPIC7_13 .in_com_7_13 defb in_com_7_13end - in_com_7_13 APPLBYTE(TOPIC7_13CODE) APPLNAME(TOPIC7_13KEY) APPLNAME(TOPIC7_13) #ifdef TOPIC7_13HELP1 defb (in_com_hlp7_13 - in_help) /256 defb (in_com_hlp7_13 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_13HELP1) */ #ifdef TOPIC7_13ATTR APPLBYTE(TOPIC7_13ATTR) #else defb 0 #endif /* TOPIC7_13ATTR */ defb in_com_7_13end - in_com_7_13 .in_com_7_13end #endif /* TOPIC7_13 */ #ifdef TOPIC7_14 .in_com_7_14 defb in_com_7_14end - in_com_7_14 APPLBYTE(TOPIC7_14CODE) APPLNAME(TOPIC7_14KEY) APPLNAME(TOPIC7_14) #ifdef TOPIC7_14HELP1 defb (in_com_hlp7_14 - in_help) /256 defb (in_com_hlp7_14 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_14HELP1) */ #ifdef TOPIC7_14ATTR APPLBYTE(TOPIC7_14ATTR) #else defb 0 #endif /* TOPIC7_14ATTR */ defb in_com_7_14end - in_com_7_14 .in_com_7_14end #endif /* TOPIC7_14 */ #ifdef TOPIC7_15 .in_com_7_15 defb in_com_7_15end - in_com_7_15 APPLBYTE(TOPIC7_15CODE) APPLNAME(TOPIC7_15KEY) APPLNAME(TOPIC7_15) #ifdef TOPIC7_15HELP1 defb (in_com_hlp7_15 - in_help) /256 defb (in_com_hlp7_15 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_15HELP1) */ #ifdef TOPIC7_15ATTR APPLBYTE(TOPIC7_15ATTR) #else defb 0 #endif /* TOPIC7_15ATTR */ defb in_com_7_15end - in_com_7_15 .in_com_7_15end #endif /* TOPIC7_15 */ #ifdef TOPIC7_16 .in_com_7_16 defb in_com_7_16end - in_com_7_16 APPLBYTE(TOPIC7_16CODE) APPLNAME(TOPIC7_16KEY) APPLNAME(TOPIC7_16) #ifdef TOPIC7_16HELP1 defb (in_com_hlp7_16 - in_help) /256 defb (in_com_hlp7_16 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_16HELP1) */ #ifdef TOPIC7_16ATTR APPLBYTE(TOPIC7_16ATTR) #else defb 0 #endif /* TOPIC7_16ATTR */ defb in_com_7_16end - in_com_7_16 .in_com_7_16end #endif /* TOPIC7_16 */ #ifdef TOPIC7_17 .in_com_7_17 defb in_com_7_17end - in_com_7_17 APPLBYTE(TOPIC7_17CODE) APPLNAME(TOPIC7_17KEY) APPLNAME(TOPIC7_17) #ifdef TOPIC7_17HELP1 defb (in_com_hlp7_17 - in_help) /256 defb (in_com_hlp7_17 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_17HELP1) */ #ifdef TOPIC7_17ATTR APPLBYTE(TOPIC7_17ATTR) #else defb 0 #endif /* TOPIC7_17ATTR */ defb in_com_7_17end - in_com_7_17 .in_com_7_17end #endif /* TOPIC7_17 */ #ifdef TOPIC7_18 .in_com_7_18 defb in_com_7_18end - in_com_7_18 APPLBYTE(TOPIC7_18CODE) APPLNAME(TOPIC7_18KEY) APPLNAME(TOPIC7_18) #ifdef TOPIC7_18HELP1 defb (in_com_hlp7_18 - in_help) /256 defb (in_com_hlp7_18 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_18HELP1) */ #ifdef TOPIC7_18ATTR APPLBYTE(TOPIC7_18ATTR) #else defb 0 #endif /* TOPIC7_18ATTR */ defb in_com_7_18end - in_com_7_18 .in_com_7_18end #endif /* TOPIC7_18 */ #ifdef TOPIC7_19 .in_com_7_19 defb in_com_7_19end - in_com_7_19 APPLBYTE(TOPIC7_19CODE) APPLNAME(TOPIC7_19KEY) APPLNAME(TOPIC7_19) #ifdef TOPIC7_19HELP1 defb (in_com_hlp7_19 - in_help) /256 defb (in_com_hlp7_19 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_19HELP1) */ #ifdef TOPIC7_19ATTR APPLBYTE(TOPIC7_19ATTR) #else defb 0 #endif /* TOPIC7_19ATTR */ defb in_com_7_19end - in_com_7_19 .in_com_7_19end #endif /* TOPIC7_19 */ #ifdef TOPIC7_20 .in_com_7_20 defb in_com_7_20end - in_com_7_20 APPLBYTE(TOPIC7_20CODE) APPLNAME(TOPIC7_20KEY) APPLNAME(TOPIC7_20) #ifdef TOPIC7_20HELP1 defb (in_com_hlp7_20 - in_help) /256 defb (in_com_hlp7_20 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_20HELP1) */ #ifdef TOPIC7_20ATTR APPLBYTE(TOPIC7_20ATTR) #else defb 0 #endif /* TOPIC7_20ATTR */ defb in_com_7_20end - in_com_7_20 .in_com_7_20end #endif /* TOPIC7_20 */ #ifdef TOPIC7_21 .in_com_7_21 defb in_com_7_21end - in_com_7_21 APPLBYTE(TOPIC7_21CODE) APPLNAME(TOPIC7_21KEY) APPLNAME(TOPIC7_21) #ifdef TOPIC7_21HELP1 defb (in_com_hlp7_21 - in_help) /256 defb (in_com_hlp7_21 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_21HELP1) */ #ifdef TOPIC7_21ATTR APPLBYTE(TOPIC7_21ATTR) #else defb 0 #endif /* TOPIC7_21ATTR */ defb in_com_7_21end - in_com_7_21 .in_com_7_21end #endif /* TOPIC7_21 */ #ifdef TOPIC7_22 .in_com_7_22 defb in_com_7_22end - in_com_7_22 APPLBYTE(TOPIC7_22CODE) APPLNAME(TOPIC7_22KEY) APPLNAME(TOPIC7_22) #ifdef TOPIC7_22HELP1 defb (in_com_hlp7_22 - in_help) /256 defb (in_com_hlp7_22 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_22HELP1) */ #ifdef TOPIC7_22ATTR APPLBYTE(TOPIC7_22ATTR) #else defb 0 #endif /* TOPIC7_22ATTR */ defb in_com_7_22end - in_com_7_22 .in_com_7_22end #endif /* TOPIC7_22 */ #ifdef TOPIC7_23 .in_com_7_23 defb in_com_7_23end - in_com_7_23 APPLBYTE(TOPIC7_23CODE) APPLNAME(TOPIC7_23KEY) APPLNAME(TOPIC7_23) #ifdef TOPIC7_23HELP1 defb (in_com_hlp7_23 - in_help) /256 defb (in_com_hlp7_23 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_23HELP1) */ #ifdef TOPIC7_23ATTR APPLBYTE(TOPIC7_23ATTR) #else defb 0 #endif /* TOPIC7_23ATTR */ defb in_com_7_23end - in_com_7_23 .in_com_7_23end #endif /* TOPIC7_23 */ #ifdef TOPIC7_24 .in_com_7_24 defb in_com_7_24end - in_com_7_24 APPLBYTE(TOPIC7_24CODE) APPLNAME(TOPIC7_24KEY) APPLNAME(TOPIC7_24) #ifdef TOPIC7_24HELP1 defb (in_com_hlp7_24 - in_help) /256 defb (in_com_hlp7_24 - in_help) %256 #else defb 0 ;pointer to help - use \0 #endif /* TOPIC7_24HELP1) */ #ifdef TOPIC7_24ATTR APPLBYTE(TOPIC7_24ATTR) #else defb 0 #endif /* TOPIC7_24ATTR */ defb in_com_7_24end - in_com_7_24 .in_com_7_24end #endif /* TOPIC7_24 */ z88dk-1.8.ds1/include/oz/help0.h0000644000175000017500000000621107130401715015736 0ustar tygrystygrys/* * Help File for Commands in Topics * * Don't include yourself!!! */ #ifdef TOPIC1HELP1 .in_topic1_hlp defb $7F HELPTEXT(TOPIC1HELP1) #ifdef TOPIC1HELP2 HELPTEXT(TOPIC1HELP2) #endif #ifdef TOPIC1HELP3 HELPTEXT(TOPIC1HELP3) #endif #ifdef TOPIC1HELP4 HELPTEXT(TOPIC1HELP4) #endif #ifdef TOPIC1HELP5 HELPTEXT(TOPIC1HELP5) #endif #ifdef TOPIC1HELP6 HELPTEXT(TOPIC1HELP6) #endif defb 0 ;end marker #endif /* TOPIC1HELP1 - overall */ #ifdef TOPIC2HELP1 .in_TOPIC2_hlp defb $7F HELPTEXT(TOPIC2HELP1) #ifdef TOPIC2HELP2 HELPTEXT(TOPIC2HELP2) #endif #ifdef TOPIC2HELP3 HELPTEXT(TOPIC2HELP3) #endif #ifdef TOPIC2HELP4 HELPTEXT(TOPIC2HELP4) #endif #ifdef TOPIC2HELP5 HELPTEXT(TOPIC2HELP5) #endif #ifdef TOPIC2HELP6 HELPTEXT(TOPIC2HELP6) #endif defb 0 ;end marker #endif /* TOPIC2HELP1 - overall */ #ifdef TOPIC3HELP1 .in_TOPIC3_hlp defb $7F HELPTEXT(TOPIC3HELP1) #ifdef TOPIC3HELP2 HELPTEXT(TOPIC3HELP2) #endif #ifdef TOPIC3HELP3 HELPTEXT(TOPIC3HELP3) #endif #ifdef TOPIC3HELP4 HELPTEXT(TOPIC3HELP4) #endif #ifdef TOPIC3HELP5 HELPTEXT(TOPIC3HELP5) #endif #ifdef TOPIC3HELP6 HELPTEXT(TOPIC3HELP6) #endif defb 0 ;end marker #endif /* TOPIC3HELP1 - overall */ #ifdef TOPIC4HELP1 .in_TOPIC4_hlp defb $7F HELPTEXT(TOPIC4HELP1) #ifdef TOPIC4HELP2 HELPTEXT(TOPIC4HELP2) #endif #ifdef TOPIC4HELP3 HELPTEXT(TOPIC4HELP3) #endif #ifdef TOPIC4HELP4 HELPTEXT(TOPIC4HELP4) #endif #ifdef TOPIC4HELP5 HELPTEXT(TOPIC4HELP5) #endif #ifdef TOPIC4HELP6 HELPTEXT(TOPIC4HELP6) #endif defb 0 ;end marker #endif /* TOPIC4HELP1 - overall */ #ifdef TOPIC5HELP1 .in_TOPIC5_hlp defb $7F HELPTEXT(TOPIC5HELP1) #ifdef TOPIC5HELP2 HELPTEXT(TOPIC5HELP2) #endif #ifdef TOPIC5HELP3 HELPTEXT(TOPIC5HELP3) #endif #ifdef TOPIC5HELP4 HELPTEXT(TOPIC5HELP4) #endif #ifdef TOPIC5HELP5 HELPTEXT(TOPIC5HELP5) #endif #ifdef TOPIC5HELP6 HELPTEXT(TOPIC5HELP6) #endif defb 0 ;end marker #endif /* TOPIC5HELP1 - overall */ #ifdef TOPIC6HELP1 .in_TOPIC6_hlp defb $7F HELPTEXT(TOPIC6HELP1) #ifdef TOPIC6HELP2 HELPTEXT(TOPIC6HELP2) #endif #ifdef TOPIC6HELP3 HELPTEXT(TOPIC6HELP3) #endif #ifdef TOPIC6HELP4 HELPTEXT(TOPIC6HELP4) #endif #ifdef TOPIC6HELP5 HELPTEXT(TOPIC6HELP5) #endif #ifdef TOPIC6HELP6 HELPTEXT(TOPIC6HELP6) #endif defb 0 ;end marker #endif /* TOPIC6HELP1 - overall */ #ifdef TOPIC7HELP1 .in_TOPIC7_hlp defb $7F HELPTEXT(TOPIC7HELP1) #ifdef TOPIC7HELP2 HELPTEXT(TOPIC7HELP2) #endif #ifdef TOPIC7HELP3 HELPTEXT(TOPIC7HELP3) #endif #ifdef TOPIC7HELP4 HELPTEXT(TOPIC7HELP4) #endif #ifdef TOPIC7HELP5 HELPTEXT(TOPIC7HELP5) #endif #ifdef TOPIC7HELP6 HELPTEXT(TOPIC7HELP6) #endif defb 0 ;end marker #endif /* TOPIC7HELP1 - overall */ z88dk-1.8.ds1/include/oz/help1.h0000644000175000017500000002655107130401716015751 0ustar tygrystygrys/* * Help File for Commands in Topic 1 * * Don't include yourself!!! */ #ifdef TOPIC1_1HELP1 .in_com_hlp1_1 defb $7F HELPTEXT(TOPIC1_1HELP1) #ifdef TOPIC1_1HELP2 HELPTEXT(TOPIC1_1HELP2) #endif #ifdef TOPIC1_1HELP3 HELPTEXT(TOPIC1_1HELP3) #endif #ifdef TOPIC1_1HELP4 HELPTEXT(TOPIC1_1HELP4) #endif #ifdef TOPIC1_1HELP5 HELPTEXT(TOPIC1_1HELP5) #endif #ifdef TOPIC1_1HELP6 HELPTEXT(TOPIC1_1HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_1HELP1 - overall */ #ifdef TOPIC1_2HELP1 .in_com_hlp1_2 defb $7F HELPTEXT(TOPIC1_2HELP1) #ifdef TOPIC1_2HELP2 HELPTEXT(TOPIC1_2HELP2) #endif #ifdef TOPIC1_2HELP3 HELPTEXT(TOPIC1_2HELP3) #endif #ifdef TOPIC1_2HELP4 HELPTEXT(TOPIC1_2HELP4) #endif #ifdef TOPIC1_2HELP5 HELPTEXT(TOPIC1_2HELP5) #endif #ifdef TOPIC1_2HELP6 HELPTEXT(TOPIC1_2HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_2HELP1 - overall */ #ifdef TOPIC1_3HELP1 .in_com_hlp1_3 defb $7F HELPTEXT(TOPIC1_3HELP1) #ifdef TOPIC1_3HELP2 HELPTEXT(TOPIC1_3HELP2) #endif #ifdef TOPIC1_3HELP3 HELPTEXT(TOPIC1_3HELP3) #endif #ifdef TOPIC1_3HELP4 HELPTEXT(TOPIC1_3HELP4) #endif #ifdef TOPIC1_3HELP5 HELPTEXT(TOPIC1_3HELP5) #endif #ifdef TOPIC1_3HELP6 HELPTEXT(TOPIC1_3HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_3HELP1 - overall */ #ifdef TOPIC1_4HELP1 .in_com_hlp1_4 defb $7F HELPTEXT(TOPIC1_4HELP1) #ifdef TOPIC1_4HELP2 HELPTEXT(TOPIC1_4HELP2) #endif #ifdef TOPIC1_4HELP3 HELPTEXT(TOPIC1_4HELP3) #endif #ifdef TOPIC1_4HELP4 HELPTEXT(TOPIC1_4HELP4) #endif #ifdef TOPIC1_4HELP5 HELPTEXT(TOPIC1_4HELP5) #endif #ifdef TOPIC1_4HELP6 HELPTEXT(TOPIC1_4HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_4HELP1 - overall */ #ifdef TOPIC1_5HELP1 .in_com_hlp1_5 defb $7F HELPTEXT(TOPIC1_5HELP1) #ifdef TOPIC1_5HELP2 HELPTEXT(TOPIC1_5HELP2) #endif #ifdef TOPIC1_5HELP3 HELPTEXT(TOPIC1_5HELP3) #endif #ifdef TOPIC1_5HELP4 HELPTEXT(TOPIC1_5HELP4) #endif #ifdef TOPIC1_5HELP5 HELPTEXT(TOPIC1_5HELP5) #endif #ifdef TOPIC1_5HELP6 HELPTEXT(TOPIC1_5HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_5HELP1 - overall */ #ifdef TOPIC1_6HELP1 .in_com_hlp1_6 defb $7F HELPTEXT(TOPIC1_6HELP1) #ifdef TOPIC1_6HELP2 HELPTEXT(TOPIC1_6HELP2) #endif #ifdef TOPIC1_6HELP3 HELPTEXT(TOPIC1_6HELP3) #endif #ifdef TOPIC1_6HELP4 HELPTEXT(TOPIC1_6HELP4) #endif #ifdef TOPIC1_6HELP5 HELPTEXT(TOPIC1_6HELP5) #endif #ifdef TOPIC1_6HELP6 HELPTEXT(TOPIC1_6HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_6HELP1 - overall */ #ifdef TOPIC1_7HELP1 .in_com_hlp1_7 defb $7F HELPTEXT(TOPIC1_7HELP1) #ifdef TOPIC1_7HELP2 HELPTEXT(TOPIC1_7HELP2) #endif #ifdef TOPIC1_7HELP3 HELPTEXT(TOPIC1_7HELP3) #endif #ifdef TOPIC1_7HELP4 HELPTEXT(TOPIC1_7HELP4) #endif #ifdef TOPIC1_7HELP5 HELPTEXT(TOPIC1_7HELP5) #endif #ifdef TOPIC1_7HELP6 HELPTEXT(TOPIC1_7HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_7HELP1 - overall */ #ifdef TOPIC1_8HELP1 .in_com_hlp1_8 defb $7F HELPTEXT(TOPIC1_8HELP1) #ifdef TOPIC1_8HELP2 HELPTEXT(TOPIC1_8HELP2) #endif #ifdef TOPIC1_8HELP3 HELPTEXT(TOPIC1_8HELP3) #endif #ifdef TOPIC1_8HELP4 HELPTEXT(TOPIC1_8HELP4) #endif #ifdef TOPIC1_8HELP5 HELPTEXT(TOPIC1_8HELP5) #endif #ifdef TOPIC1_8HELP6 HELPTEXT(TOPIC1_8HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_8HELP1 - overall */ #ifdef TOPIC1_9HELP1 .in_com_hlp1_9 defb $7F HELPTEXT(TOPIC1_9HELP1) #ifdef TOPIC1_9HELP2 HELPTEXT(TOPIC1_9HELP2) #endif #ifdef TOPIC1_9HELP3 HELPTEXT(TOPIC1_9HELP3) #endif #ifdef TOPIC1_9HELP4 HELPTEXT(TOPIC1_9HELP4) #endif #ifdef TOPIC1_9HELP5 HELPTEXT(TOPIC1_9HELP5) #endif #ifdef TOPIC1_9HELP6 HELPTEXT(TOPIC1_9HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_9HELP1 - overall */ #ifdef TOPIC1_10HELP1 .in_com_hlp1_10 defb $7F HELPTEXT(TOPIC1_10HELP1) #ifdef TOPIC1_10HELP2 HELPTEXT(TOPIC1_10HELP2) #endif #ifdef TOPIC1_10HELP3 HELPTEXT(TOPIC1_10HELP3) #endif #ifdef TOPIC1_10HELP4 HELPTEXT(TOPIC1_10HELP4) #endif #ifdef TOPIC1_10HELP5 HELPTEXT(TOPIC1_10HELP5) #endif #ifdef TOPIC1_10HELP6 HELPTEXT(TOPIC1_10HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_10HELP1 - overall */ #ifdef TOPIC1_11HELP1 .in_com_hlp1_11 defb $7F HELPTEXT(TOPIC1_11HELP1) #ifdef TOPIC1_11HELP2 HELPTEXT(TOPIC1_11HELP2) #endif #ifdef TOPIC1_11HELP3 HELPTEXT(TOPIC1_11HELP3) #endif #ifdef TOPIC1_11HELP4 HELPTEXT(TOPIC1_11HELP4) #endif #ifdef TOPIC1_11HELP5 HELPTEXT(TOPIC1_11HELP5) #endif #ifdef TOPIC1_11HELP6 HELPTEXT(TOPIC1_11HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_11HELP1 - overall */ #ifdef TOPIC1_12HELP1 .in_com_hlp1_12 defb $7F HELPTEXT(TOPIC1_12HELP1) #ifdef TOPIC1_12HELP2 HELPTEXT(TOPIC1_12HELP2) #endif #ifdef TOPIC1_12HELP3 HELPTEXT(TOPIC1_12HELP3) #endif #ifdef TOPIC1_12HELP4 HELPTEXT(TOPIC1_12HELP4) #endif #ifdef TOPIC1_12HELP5 HELPTEXT(TOPIC1_12HELP5) #endif #ifdef TOPIC1_12HELP6 HELPTEXT(TOPIC1_12HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_12HELP1 - overall */ #ifdef TOPIC1_13HELP1 .in_com_hlp1_13 defb $7F HELPTEXT(TOPIC1_13HELP1) #ifdef TOPIC1_13HELP2 HELPTEXT(TOPIC1_13HELP2) #endif #ifdef TOPIC1_13HELP3 HELPTEXT(TOPIC1_13HELP3) #endif #ifdef TOPIC1_13HELP4 HELPTEXT(TOPIC1_13HELP4) #endif #ifdef TOPIC1_13HELP5 HELPTEXT(TOPIC1_13HELP5) #endif #ifdef TOPIC1_13HELP6 HELPTEXT(TOPIC1_13HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_13HELP1 - overall */ #ifdef TOPIC1_14HELP1 .in_com_hlp1_14 defb $7F HELPTEXT(TOPIC1_14HELP1) #ifdef TOPIC1_14HELP2 HELPTEXT(TOPIC1_14HELP2) #endif #ifdef TOPIC1_14HELP3 HELPTEXT(TOPIC1_14HELP3) #endif #ifdef TOPIC1_14HELP4 HELPTEXT(TOPIC1_14HELP4) #endif #ifdef TOPIC1_14HELP5 HELPTEXT(TOPIC1_14HELP5) #endif #ifdef TOPIC1_14HELP6 HELPTEXT(TOPIC1_14HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_14HELP1 - overall */ #ifdef TOPIC1_15HELP1 .in_com_hlp1_15 defb $7F HELPTEXT(TOPIC1_15HELP1) #ifdef TOPIC1_15HELP2 HELPTEXT(TOPIC1_15HELP2) #endif #ifdef TOPIC1_15HELP3 HELPTEXT(TOPIC1_15HELP3) #endif #ifdef TOPIC1_15HELP4 HELPTEXT(TOPIC1_15HELP4) #endif #ifdef TOPIC1_15HELP5 HELPTEXT(TOPIC1_15HELP5) #endif #ifdef TOPIC1_15HELP6 HELPTEXT(TOPIC1_15HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_15HELP1 - overall */ #ifdef TOPIC1_16HELP1 .in_com_hlp1_16 defb $7F HELPTEXT(TOPIC1_16HELP1) #ifdef TOPIC1_16HELP2 HELPTEXT(TOPIC1_16HELP2) #endif #ifdef TOPIC1_16HELP3 HELPTEXT(TOPIC1_16HELP3) #endif #ifdef TOPIC1_16HELP4 HELPTEXT(TOPIC1_16HELP4) #endif #ifdef TOPIC1_16HELP5 HELPTEXT(TOPIC1_16HELP5) #endif #ifdef TOPIC1_16HELP6 HELPTEXT(TOPIC1_16HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_16HELP1 - overall */ #ifdef TOPIC1_17HELP1 .in_com_hlp1_17 defb $7F HELPTEXT(TOPIC1_17HELP1) #ifdef TOPIC1_17HELP2 HELPTEXT(TOPIC1_17HELP2) #endif #ifdef TOPIC1_17HELP3 HELPTEXT(TOPIC1_17HELP3) #endif #ifdef TOPIC1_17HELP4 HELPTEXT(TOPIC1_17HELP4) #endif #ifdef TOPIC1_17HELP5 HELPTEXT(TOPIC1_17HELP5) #endif #ifdef TOPIC1_17HELP6 HELPTEXT(TOPIC1_17HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_17HELP1 - overall */ #ifdef TOPIC1_18HELP1 .in_com_hlp1_18 defb $7F HELPTEXT(TOPIC1_18HELP1) #ifdef TOPIC1_18HELP2 HELPTEXT(TOPIC1_18HELP2) #endif #ifdef TOPIC1_18HELP3 HELPTEXT(TOPIC1_18HELP3) #endif #ifdef TOPIC1_18HELP4 HELPTEXT(TOPIC1_18HELP4) #endif #ifdef TOPIC1_18HELP5 HELPTEXT(TOPIC1_18HELP5) #endif #ifdef TOPIC1_18HELP6 HELPTEXT(TOPIC1_18HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_18HELP1 - overall */ #ifdef TOPIC1_19HELP1 .in_com_hlp1_19 defb $7F HELPTEXT(TOPIC1_19HELP1) #ifdef TOPIC1_19HELP2 HELPTEXT(TOPIC1_19HELP2) #endif #ifdef TOPIC1_19HELP3 HELPTEXT(TOPIC1_19HELP3) #endif #ifdef TOPIC1_19HELP4 HELPTEXT(TOPIC1_19HELP4) #endif #ifdef TOPIC1_19HELP5 HELPTEXT(TOPIC1_19HELP5) #endif #ifdef TOPIC1_19HELP6 HELPTEXT(TOPIC1_19HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_19HELP1 - overall */ #ifdef TOPIC1_20HELP1 .in_com_hlp1_20 defb $7F HELPTEXT(TOPIC1_20HELP1) #ifdef TOPIC1_20HELP2 HELPTEXT(TOPIC1_20HELP2) #endif #ifdef TOPIC1_20HELP3 HELPTEXT(TOPIC1_20HELP3) #endif #ifdef TOPIC1_20HELP4 HELPTEXT(TOPIC1_20HELP4) #endif #ifdef TOPIC1_20HELP5 HELPTEXT(TOPIC1_20HELP5) #endif #ifdef TOPIC1_20HELP6 HELPTEXT(TOPIC1_20HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_20HELP1 - overall */ #ifdef TOPIC1_21HELP1 .in_com_hlp1_21 defb $7F HELPTEXT(TOPIC1_21HELP1) #ifdef TOPIC1_21HELP2 HELPTEXT(TOPIC1_21HELP2) #endif #ifdef TOPIC1_21HELP3 HELPTEXT(TOPIC1_21HELP3) #endif #ifdef TOPIC1_21HELP4 HELPTEXT(TOPIC1_21HELP4) #endif #ifdef TOPIC1_21HELP5 HELPTEXT(TOPIC1_21HELP5) #endif #ifdef TOPIC1_21HELP6 HELPTEXT(TOPIC1_21HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_21HELP1 - overall */ #ifdef TOPIC1_22HELP1 .in_com_hlp1_22 defb $7F HELPTEXT(TOPIC1_22HELP1) #ifdef TOPIC1_22HELP2 HELPTEXT(TOPIC1_22HELP2) #endif #ifdef TOPIC1_22HELP3 HELPTEXT(TOPIC1_22HELP3) #endif #ifdef TOPIC1_22HELP4 HELPTEXT(TOPIC1_22HELP4) #endif #ifdef TOPIC1_22HELP5 HELPTEXT(TOPIC1_22HELP5) #endif #ifdef TOPIC1_22HELP6 HELPTEXT(TOPIC1_22HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_22HELP1 - overall */ #ifdef TOPIC1_23HELP1 .in_com_hlp1_23 defb $7F HELPTEXT(TOPIC1_23HELP1) #ifdef TOPIC1_23HELP2 HELPTEXT(TOPIC1_23HELP2) #endif #ifdef TOPIC1_23HELP3 HELPTEXT(TOPIC1_23HELP3) #endif #ifdef TOPIC1_23HELP4 HELPTEXT(TOPIC1_23HELP4) #endif #ifdef TOPIC1_23HELP5 HELPTEXT(TOPIC1_23HELP5) #endif #ifdef TOPIC1_23HELP6 HELPTEXT(TOPIC1_23HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_23HELP1 - overall */ #ifdef TOPIC1_24HELP1 .in_com_hlp1_24 defb $7F HELPTEXT(TOPIC1_24HELP1) #ifdef TOPIC1_24HELP2 HELPTEXT(TOPIC1_24HELP2) #endif #ifdef TOPIC1_24HELP3 HELPTEXT(TOPIC1_24HELP3) #endif #ifdef TOPIC1_24HELP4 HELPTEXT(TOPIC1_24HELP4) #endif #ifdef TOPIC1_24HELP5 HELPTEXT(TOPIC1_24HELP5) #endif #ifdef TOPIC1_24HELP6 HELPTEXT(TOPIC1_24HELP6) #endif defb 0 ;end marker #endif /* TOPIC1_24HELP1 - overall */ z88dk-1.8.ds1/include/oz/help2.h0000644000175000017500000002655107130401715015751 0ustar tygrystygrys/* * Help File for Commands in Topic 2 * * Don't include yourself!!! */ #ifdef TOPIC2_1HELP1 .in_com_hlp2_1 defb $7F HELPTEXT(TOPIC2_1HELP1) #ifdef TOPIC2_1HELP2 HELPTEXT(TOPIC2_1HELP2) #endif #ifdef TOPIC2_1HELP3 HELPTEXT(TOPIC2_1HELP3) #endif #ifdef TOPIC2_1HELP4 HELPTEXT(TOPIC2_1HELP4) #endif #ifdef TOPIC2_1HELP5 HELPTEXT(TOPIC2_1HELP5) #endif #ifdef TOPIC2_1HELP6 HELPTEXT(TOPIC2_1HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_1HELP1 - overall */ #ifdef TOPIC2_2HELP1 .in_com_hlp2_2 defb $7F HELPTEXT(TOPIC2_2HELP1) #ifdef TOPIC2_2HELP2 HELPTEXT(TOPIC2_2HELP2) #endif #ifdef TOPIC2_2HELP3 HELPTEXT(TOPIC2_2HELP3) #endif #ifdef TOPIC2_2HELP4 HELPTEXT(TOPIC2_2HELP4) #endif #ifdef TOPIC2_2HELP5 HELPTEXT(TOPIC2_2HELP5) #endif #ifdef TOPIC2_2HELP6 HELPTEXT(TOPIC2_2HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_2HELP1 - overall */ #ifdef TOPIC2_3HELP1 .in_com_hlp2_3 defb $7F HELPTEXT(TOPIC2_3HELP1) #ifdef TOPIC2_3HELP2 HELPTEXT(TOPIC2_3HELP2) #endif #ifdef TOPIC2_3HELP3 HELPTEXT(TOPIC2_3HELP3) #endif #ifdef TOPIC2_3HELP4 HELPTEXT(TOPIC2_3HELP4) #endif #ifdef TOPIC2_3HELP5 HELPTEXT(TOPIC2_3HELP5) #endif #ifdef TOPIC2_3HELP6 HELPTEXT(TOPIC2_3HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_3HELP1 - overall */ #ifdef TOPIC2_4HELP1 .in_com_hlp2_4 defb $7F HELPTEXT(TOPIC2_4HELP1) #ifdef TOPIC2_4HELP2 HELPTEXT(TOPIC2_4HELP2) #endif #ifdef TOPIC2_4HELP3 HELPTEXT(TOPIC2_4HELP3) #endif #ifdef TOPIC2_4HELP4 HELPTEXT(TOPIC2_4HELP4) #endif #ifdef TOPIC2_4HELP5 HELPTEXT(TOPIC2_4HELP5) #endif #ifdef TOPIC2_4HELP6 HELPTEXT(TOPIC2_4HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_4HELP1 - overall */ #ifdef TOPIC2_5HELP1 .in_com_hlp2_5 defb $7F HELPTEXT(TOPIC2_5HELP1) #ifdef TOPIC2_5HELP2 HELPTEXT(TOPIC2_5HELP2) #endif #ifdef TOPIC2_5HELP3 HELPTEXT(TOPIC2_5HELP3) #endif #ifdef TOPIC2_5HELP4 HELPTEXT(TOPIC2_5HELP4) #endif #ifdef TOPIC2_5HELP5 HELPTEXT(TOPIC2_5HELP5) #endif #ifdef TOPIC2_5HELP6 HELPTEXT(TOPIC2_5HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_5HELP1 - overall */ #ifdef TOPIC2_6HELP1 .in_com_hlp2_6 defb $7F HELPTEXT(TOPIC2_6HELP1) #ifdef TOPIC2_6HELP2 HELPTEXT(TOPIC2_6HELP2) #endif #ifdef TOPIC2_6HELP3 HELPTEXT(TOPIC2_6HELP3) #endif #ifdef TOPIC2_6HELP4 HELPTEXT(TOPIC2_6HELP4) #endif #ifdef TOPIC2_6HELP5 HELPTEXT(TOPIC2_6HELP5) #endif #ifdef TOPIC2_6HELP6 HELPTEXT(TOPIC2_6HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_6HELP1 - overall */ #ifdef TOPIC2_7HELP1 .in_com_hlp2_7 defb $7F HELPTEXT(TOPIC2_7HELP1) #ifdef TOPIC2_7HELP2 HELPTEXT(TOPIC2_7HELP2) #endif #ifdef TOPIC2_7HELP3 HELPTEXT(TOPIC2_7HELP3) #endif #ifdef TOPIC2_7HELP4 HELPTEXT(TOPIC2_7HELP4) #endif #ifdef TOPIC2_7HELP5 HELPTEXT(TOPIC2_7HELP5) #endif #ifdef TOPIC2_7HELP6 HELPTEXT(TOPIC2_7HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_7HELP1 - overall */ #ifdef TOPIC2_8HELP1 .in_com_hlp2_8 defb $7F HELPTEXT(TOPIC2_8HELP1) #ifdef TOPIC2_8HELP2 HELPTEXT(TOPIC2_8HELP2) #endif #ifdef TOPIC2_8HELP3 HELPTEXT(TOPIC2_8HELP3) #endif #ifdef TOPIC2_8HELP4 HELPTEXT(TOPIC2_8HELP4) #endif #ifdef TOPIC2_8HELP5 HELPTEXT(TOPIC2_8HELP5) #endif #ifdef TOPIC2_8HELP6 HELPTEXT(TOPIC2_8HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_8HELP1 - overall */ #ifdef TOPIC2_9HELP1 .in_com_hlp2_9 defb $7F HELPTEXT(TOPIC2_9HELP1) #ifdef TOPIC2_9HELP2 HELPTEXT(TOPIC2_9HELP2) #endif #ifdef TOPIC2_9HELP3 HELPTEXT(TOPIC2_9HELP3) #endif #ifdef TOPIC2_9HELP4 HELPTEXT(TOPIC2_9HELP4) #endif #ifdef TOPIC2_9HELP5 HELPTEXT(TOPIC2_9HELP5) #endif #ifdef TOPIC2_9HELP6 HELPTEXT(TOPIC2_9HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_9HELP1 - overall */ #ifdef TOPIC2_10HELP1 .in_com_hlp2_10 defb $7F HELPTEXT(TOPIC2_10HELP1) #ifdef TOPIC2_10HELP2 HELPTEXT(TOPIC2_10HELP2) #endif #ifdef TOPIC2_10HELP3 HELPTEXT(TOPIC2_10HELP3) #endif #ifdef TOPIC2_10HELP4 HELPTEXT(TOPIC2_10HELP4) #endif #ifdef TOPIC2_10HELP5 HELPTEXT(TOPIC2_10HELP5) #endif #ifdef TOPIC2_10HELP6 HELPTEXT(TOPIC2_10HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_10HELP1 - overall */ #ifdef TOPIC2_11HELP1 .in_com_hlp2_11 defb $7F HELPTEXT(TOPIC2_11HELP1) #ifdef TOPIC2_11HELP2 HELPTEXT(TOPIC2_11HELP2) #endif #ifdef TOPIC2_11HELP3 HELPTEXT(TOPIC2_11HELP3) #endif #ifdef TOPIC2_11HELP4 HELPTEXT(TOPIC2_11HELP4) #endif #ifdef TOPIC2_11HELP5 HELPTEXT(TOPIC2_11HELP5) #endif #ifdef TOPIC2_11HELP6 HELPTEXT(TOPIC2_11HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_11HELP1 - overall */ #ifdef TOPIC2_12HELP1 .in_com_hlp2_12 defb $7F HELPTEXT(TOPIC2_12HELP1) #ifdef TOPIC2_12HELP2 HELPTEXT(TOPIC2_12HELP2) #endif #ifdef TOPIC2_12HELP3 HELPTEXT(TOPIC2_12HELP3) #endif #ifdef TOPIC2_12HELP4 HELPTEXT(TOPIC2_12HELP4) #endif #ifdef TOPIC2_12HELP5 HELPTEXT(TOPIC2_12HELP5) #endif #ifdef TOPIC2_12HELP6 HELPTEXT(TOPIC2_12HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_12HELP1 - overall */ #ifdef TOPIC2_13HELP1 .in_com_hlp2_13 defb $7F HELPTEXT(TOPIC2_13HELP1) #ifdef TOPIC2_13HELP2 HELPTEXT(TOPIC2_13HELP2) #endif #ifdef TOPIC2_13HELP3 HELPTEXT(TOPIC2_13HELP3) #endif #ifdef TOPIC2_13HELP4 HELPTEXT(TOPIC2_13HELP4) #endif #ifdef TOPIC2_13HELP5 HELPTEXT(TOPIC2_13HELP5) #endif #ifdef TOPIC2_13HELP6 HELPTEXT(TOPIC2_13HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_13HELP1 - overall */ #ifdef TOPIC2_14HELP1 .in_com_hlp2_14 defb $7F HELPTEXT(TOPIC2_14HELP1) #ifdef TOPIC2_14HELP2 HELPTEXT(TOPIC2_14HELP2) #endif #ifdef TOPIC2_14HELP3 HELPTEXT(TOPIC2_14HELP3) #endif #ifdef TOPIC2_14HELP4 HELPTEXT(TOPIC2_14HELP4) #endif #ifdef TOPIC2_14HELP5 HELPTEXT(TOPIC2_14HELP5) #endif #ifdef TOPIC2_14HELP6 HELPTEXT(TOPIC2_14HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_14HELP1 - overall */ #ifdef TOPIC2_15HELP1 .in_com_hlp2_15 defb $7F HELPTEXT(TOPIC2_15HELP1) #ifdef TOPIC2_15HELP2 HELPTEXT(TOPIC2_15HELP2) #endif #ifdef TOPIC2_15HELP3 HELPTEXT(TOPIC2_15HELP3) #endif #ifdef TOPIC2_15HELP4 HELPTEXT(TOPIC2_15HELP4) #endif #ifdef TOPIC2_15HELP5 HELPTEXT(TOPIC2_15HELP5) #endif #ifdef TOPIC2_15HELP6 HELPTEXT(TOPIC2_15HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_15HELP1 - overall */ #ifdef TOPIC2_16HELP1 .in_com_hlp2_16 defb $7F HELPTEXT(TOPIC2_16HELP1) #ifdef TOPIC2_16HELP2 HELPTEXT(TOPIC2_16HELP2) #endif #ifdef TOPIC2_16HELP3 HELPTEXT(TOPIC2_16HELP3) #endif #ifdef TOPIC2_16HELP4 HELPTEXT(TOPIC2_16HELP4) #endif #ifdef TOPIC2_16HELP5 HELPTEXT(TOPIC2_16HELP5) #endif #ifdef TOPIC2_16HELP6 HELPTEXT(TOPIC2_16HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_16HELP1 - overall */ #ifdef TOPIC2_17HELP1 .in_com_hlp2_17 defb $7F HELPTEXT(TOPIC2_17HELP1) #ifdef TOPIC2_17HELP2 HELPTEXT(TOPIC2_17HELP2) #endif #ifdef TOPIC2_17HELP3 HELPTEXT(TOPIC2_17HELP3) #endif #ifdef TOPIC2_17HELP4 HELPTEXT(TOPIC2_17HELP4) #endif #ifdef TOPIC2_17HELP5 HELPTEXT(TOPIC2_17HELP5) #endif #ifdef TOPIC2_17HELP6 HELPTEXT(TOPIC2_17HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_17HELP1 - overall */ #ifdef TOPIC2_18HELP1 .in_com_hlp2_18 defb $7F HELPTEXT(TOPIC2_18HELP1) #ifdef TOPIC2_18HELP2 HELPTEXT(TOPIC2_18HELP2) #endif #ifdef TOPIC2_18HELP3 HELPTEXT(TOPIC2_18HELP3) #endif #ifdef TOPIC2_18HELP4 HELPTEXT(TOPIC2_18HELP4) #endif #ifdef TOPIC2_18HELP5 HELPTEXT(TOPIC2_18HELP5) #endif #ifdef TOPIC2_18HELP6 HELPTEXT(TOPIC2_18HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_18HELP1 - overall */ #ifdef TOPIC2_19HELP1 .in_com_hlp2_19 defb $7F HELPTEXT(TOPIC2_19HELP1) #ifdef TOPIC2_19HELP2 HELPTEXT(TOPIC2_19HELP2) #endif #ifdef TOPIC2_19HELP3 HELPTEXT(TOPIC2_19HELP3) #endif #ifdef TOPIC2_19HELP4 HELPTEXT(TOPIC2_19HELP4) #endif #ifdef TOPIC2_19HELP5 HELPTEXT(TOPIC2_19HELP5) #endif #ifdef TOPIC2_19HELP6 HELPTEXT(TOPIC2_19HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_19HELP1 - overall */ #ifdef TOPIC2_20HELP1 .in_com_hlp2_20 defb $7F HELPTEXT(TOPIC2_20HELP1) #ifdef TOPIC2_20HELP2 HELPTEXT(TOPIC2_20HELP2) #endif #ifdef TOPIC2_20HELP3 HELPTEXT(TOPIC2_20HELP3) #endif #ifdef TOPIC2_20HELP4 HELPTEXT(TOPIC2_20HELP4) #endif #ifdef TOPIC2_20HELP5 HELPTEXT(TOPIC2_20HELP5) #endif #ifdef TOPIC2_20HELP6 HELPTEXT(TOPIC2_20HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_20HELP1 - overall */ #ifdef TOPIC2_21HELP1 .in_com_hlp2_21 defb $7F HELPTEXT(TOPIC2_21HELP1) #ifdef TOPIC2_21HELP2 HELPTEXT(TOPIC2_21HELP2) #endif #ifdef TOPIC2_21HELP3 HELPTEXT(TOPIC2_21HELP3) #endif #ifdef TOPIC2_21HELP4 HELPTEXT(TOPIC2_21HELP4) #endif #ifdef TOPIC2_21HELP5 HELPTEXT(TOPIC2_21HELP5) #endif #ifdef TOPIC2_21HELP6 HELPTEXT(TOPIC2_21HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_21HELP1 - overall */ #ifdef TOPIC2_22HELP1 .in_com_hlp2_22 defb $7F HELPTEXT(TOPIC2_22HELP1) #ifdef TOPIC2_22HELP2 HELPTEXT(TOPIC2_22HELP2) #endif #ifdef TOPIC2_22HELP3 HELPTEXT(TOPIC2_22HELP3) #endif #ifdef TOPIC2_22HELP4 HELPTEXT(TOPIC2_22HELP4) #endif #ifdef TOPIC2_22HELP5 HELPTEXT(TOPIC2_22HELP5) #endif #ifdef TOPIC2_22HELP6 HELPTEXT(TOPIC2_22HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_22HELP1 - overall */ #ifdef TOPIC2_23HELP1 .in_com_hlp2_23 defb $7F HELPTEXT(TOPIC2_23HELP1) #ifdef TOPIC2_23HELP2 HELPTEXT(TOPIC2_23HELP2) #endif #ifdef TOPIC2_23HELP3 HELPTEXT(TOPIC2_23HELP3) #endif #ifdef TOPIC2_23HELP4 HELPTEXT(TOPIC2_23HELP4) #endif #ifdef TOPIC2_23HELP5 HELPTEXT(TOPIC2_23HELP5) #endif #ifdef TOPIC2_23HELP6 HELPTEXT(TOPIC2_23HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_23HELP1 - overall */ #ifdef TOPIC2_24HELP1 .in_com_hlp2_24 defb $7F HELPTEXT(TOPIC2_24HELP1) #ifdef TOPIC2_24HELP2 HELPTEXT(TOPIC2_24HELP2) #endif #ifdef TOPIC2_24HELP3 HELPTEXT(TOPIC2_24HELP3) #endif #ifdef TOPIC2_24HELP4 HELPTEXT(TOPIC2_24HELP4) #endif #ifdef TOPIC2_24HELP5 HELPTEXT(TOPIC2_24HELP5) #endif #ifdef TOPIC2_24HELP6 HELPTEXT(TOPIC2_24HELP6) #endif defb 0 ;end marker #endif /* TOPIC2_24HELP1 - overall */ z88dk-1.8.ds1/include/oz/help3.h0000644000175000017500000002655107130401715015752 0ustar tygrystygrys/* * Help File for Commands in Topic 3 * * Don't include yourself!!! */ #ifdef TOPIC3_1HELP1 .in_com_hlp3_1 defb $7F HELPTEXT(TOPIC3_1HELP1) #ifdef TOPIC3_1HELP2 HELPTEXT(TOPIC3_1HELP2) #endif #ifdef TOPIC3_1HELP3 HELPTEXT(TOPIC3_1HELP3) #endif #ifdef TOPIC3_1HELP4 HELPTEXT(TOPIC3_1HELP4) #endif #ifdef TOPIC3_1HELP5 HELPTEXT(TOPIC3_1HELP5) #endif #ifdef TOPIC3_1HELP6 HELPTEXT(TOPIC3_1HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_1HELP1 - overall */ #ifdef TOPIC3_2HELP1 .in_com_hlp3_2 defb $7F HELPTEXT(TOPIC3_2HELP1) #ifdef TOPIC3_2HELP2 HELPTEXT(TOPIC3_2HELP2) #endif #ifdef TOPIC3_2HELP3 HELPTEXT(TOPIC3_2HELP3) #endif #ifdef TOPIC3_2HELP4 HELPTEXT(TOPIC3_2HELP4) #endif #ifdef TOPIC3_2HELP5 HELPTEXT(TOPIC3_2HELP5) #endif #ifdef TOPIC3_2HELP6 HELPTEXT(TOPIC3_2HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_2HELP1 - overall */ #ifdef TOPIC3_3HELP1 .in_com_hlp3_3 defb $7F HELPTEXT(TOPIC3_3HELP1) #ifdef TOPIC3_3HELP2 HELPTEXT(TOPIC3_3HELP2) #endif #ifdef TOPIC3_3HELP3 HELPTEXT(TOPIC3_3HELP3) #endif #ifdef TOPIC3_3HELP4 HELPTEXT(TOPIC3_3HELP4) #endif #ifdef TOPIC3_3HELP5 HELPTEXT(TOPIC3_3HELP5) #endif #ifdef TOPIC3_3HELP6 HELPTEXT(TOPIC3_3HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_3HELP1 - overall */ #ifdef TOPIC3_4HELP1 .in_com_hlp3_4 defb $7F HELPTEXT(TOPIC3_4HELP1) #ifdef TOPIC3_4HELP2 HELPTEXT(TOPIC3_4HELP2) #endif #ifdef TOPIC3_4HELP3 HELPTEXT(TOPIC3_4HELP3) #endif #ifdef TOPIC3_4HELP4 HELPTEXT(TOPIC3_4HELP4) #endif #ifdef TOPIC3_4HELP5 HELPTEXT(TOPIC3_4HELP5) #endif #ifdef TOPIC3_4HELP6 HELPTEXT(TOPIC3_4HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_4HELP1 - overall */ #ifdef TOPIC3_5HELP1 .in_com_hlp3_5 defb $7F HELPTEXT(TOPIC3_5HELP1) #ifdef TOPIC3_5HELP2 HELPTEXT(TOPIC3_5HELP2) #endif #ifdef TOPIC3_5HELP3 HELPTEXT(TOPIC3_5HELP3) #endif #ifdef TOPIC3_5HELP4 HELPTEXT(TOPIC3_5HELP4) #endif #ifdef TOPIC3_5HELP5 HELPTEXT(TOPIC3_5HELP5) #endif #ifdef TOPIC3_5HELP6 HELPTEXT(TOPIC3_5HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_5HELP1 - overall */ #ifdef TOPIC3_6HELP1 .in_com_hlp3_6 defb $7F HELPTEXT(TOPIC3_6HELP1) #ifdef TOPIC3_6HELP2 HELPTEXT(TOPIC3_6HELP2) #endif #ifdef TOPIC3_6HELP3 HELPTEXT(TOPIC3_6HELP3) #endif #ifdef TOPIC3_6HELP4 HELPTEXT(TOPIC3_6HELP4) #endif #ifdef TOPIC3_6HELP5 HELPTEXT(TOPIC3_6HELP5) #endif #ifdef TOPIC3_6HELP6 HELPTEXT(TOPIC3_6HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_6HELP1 - overall */ #ifdef TOPIC3_7HELP1 .in_com_hlp3_7 defb $7F HELPTEXT(TOPIC3_7HELP1) #ifdef TOPIC3_7HELP2 HELPTEXT(TOPIC3_7HELP2) #endif #ifdef TOPIC3_7HELP3 HELPTEXT(TOPIC3_7HELP3) #endif #ifdef TOPIC3_7HELP4 HELPTEXT(TOPIC3_7HELP4) #endif #ifdef TOPIC3_7HELP5 HELPTEXT(TOPIC3_7HELP5) #endif #ifdef TOPIC3_7HELP6 HELPTEXT(TOPIC3_7HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_7HELP1 - overall */ #ifdef TOPIC3_8HELP1 .in_com_hlp3_8 defb $7F HELPTEXT(TOPIC3_8HELP1) #ifdef TOPIC3_8HELP2 HELPTEXT(TOPIC3_8HELP2) #endif #ifdef TOPIC3_8HELP3 HELPTEXT(TOPIC3_8HELP3) #endif #ifdef TOPIC3_8HELP4 HELPTEXT(TOPIC3_8HELP4) #endif #ifdef TOPIC3_8HELP5 HELPTEXT(TOPIC3_8HELP5) #endif #ifdef TOPIC3_8HELP6 HELPTEXT(TOPIC3_8HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_8HELP1 - overall */ #ifdef TOPIC3_9HELP1 .in_com_hlp3_9 defb $7F HELPTEXT(TOPIC3_9HELP1) #ifdef TOPIC3_9HELP2 HELPTEXT(TOPIC3_9HELP2) #endif #ifdef TOPIC3_9HELP3 HELPTEXT(TOPIC3_9HELP3) #endif #ifdef TOPIC3_9HELP4 HELPTEXT(TOPIC3_9HELP4) #endif #ifdef TOPIC3_9HELP5 HELPTEXT(TOPIC3_9HELP5) #endif #ifdef TOPIC3_9HELP6 HELPTEXT(TOPIC3_9HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_9HELP1 - overall */ #ifdef TOPIC3_10HELP1 .in_com_hlp3_10 defb $7F HELPTEXT(TOPIC3_10HELP1) #ifdef TOPIC3_10HELP2 HELPTEXT(TOPIC3_10HELP2) #endif #ifdef TOPIC3_10HELP3 HELPTEXT(TOPIC3_10HELP3) #endif #ifdef TOPIC3_10HELP4 HELPTEXT(TOPIC3_10HELP4) #endif #ifdef TOPIC3_10HELP5 HELPTEXT(TOPIC3_10HELP5) #endif #ifdef TOPIC3_10HELP6 HELPTEXT(TOPIC3_10HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_10HELP1 - overall */ #ifdef TOPIC3_11HELP1 .in_com_hlp3_11 defb $7F HELPTEXT(TOPIC3_11HELP1) #ifdef TOPIC3_11HELP2 HELPTEXT(TOPIC3_11HELP2) #endif #ifdef TOPIC3_11HELP3 HELPTEXT(TOPIC3_11HELP3) #endif #ifdef TOPIC3_11HELP4 HELPTEXT(TOPIC3_11HELP4) #endif #ifdef TOPIC3_11HELP5 HELPTEXT(TOPIC3_11HELP5) #endif #ifdef TOPIC3_11HELP6 HELPTEXT(TOPIC3_11HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_11HELP1 - overall */ #ifdef TOPIC3_12HELP1 .in_com_hlp3_12 defb $7F HELPTEXT(TOPIC3_12HELP1) #ifdef TOPIC3_12HELP2 HELPTEXT(TOPIC3_12HELP2) #endif #ifdef TOPIC3_12HELP3 HELPTEXT(TOPIC3_12HELP3) #endif #ifdef TOPIC3_12HELP4 HELPTEXT(TOPIC3_12HELP4) #endif #ifdef TOPIC3_12HELP5 HELPTEXT(TOPIC3_12HELP5) #endif #ifdef TOPIC3_12HELP6 HELPTEXT(TOPIC3_12HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_12HELP1 - overall */ #ifdef TOPIC3_13HELP1 .in_com_hlp3_13 defb $7F HELPTEXT(TOPIC3_13HELP1) #ifdef TOPIC3_13HELP2 HELPTEXT(TOPIC3_13HELP2) #endif #ifdef TOPIC3_13HELP3 HELPTEXT(TOPIC3_13HELP3) #endif #ifdef TOPIC3_13HELP4 HELPTEXT(TOPIC3_13HELP4) #endif #ifdef TOPIC3_13HELP5 HELPTEXT(TOPIC3_13HELP5) #endif #ifdef TOPIC3_13HELP6 HELPTEXT(TOPIC3_13HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_13HELP1 - overall */ #ifdef TOPIC3_14HELP1 .in_com_hlp3_14 defb $7F HELPTEXT(TOPIC3_14HELP1) #ifdef TOPIC3_14HELP2 HELPTEXT(TOPIC3_14HELP2) #endif #ifdef TOPIC3_14HELP3 HELPTEXT(TOPIC3_14HELP3) #endif #ifdef TOPIC3_14HELP4 HELPTEXT(TOPIC3_14HELP4) #endif #ifdef TOPIC3_14HELP5 HELPTEXT(TOPIC3_14HELP5) #endif #ifdef TOPIC3_14HELP6 HELPTEXT(TOPIC3_14HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_14HELP1 - overall */ #ifdef TOPIC3_15HELP1 .in_com_hlp3_15 defb $7F HELPTEXT(TOPIC3_15HELP1) #ifdef TOPIC3_15HELP2 HELPTEXT(TOPIC3_15HELP2) #endif #ifdef TOPIC3_15HELP3 HELPTEXT(TOPIC3_15HELP3) #endif #ifdef TOPIC3_15HELP4 HELPTEXT(TOPIC3_15HELP4) #endif #ifdef TOPIC3_15HELP5 HELPTEXT(TOPIC3_15HELP5) #endif #ifdef TOPIC3_15HELP6 HELPTEXT(TOPIC3_15HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_15HELP1 - overall */ #ifdef TOPIC3_16HELP1 .in_com_hlp3_16 defb $7F HELPTEXT(TOPIC3_16HELP1) #ifdef TOPIC3_16HELP2 HELPTEXT(TOPIC3_16HELP2) #endif #ifdef TOPIC3_16HELP3 HELPTEXT(TOPIC3_16HELP3) #endif #ifdef TOPIC3_16HELP4 HELPTEXT(TOPIC3_16HELP4) #endif #ifdef TOPIC3_16HELP5 HELPTEXT(TOPIC3_16HELP5) #endif #ifdef TOPIC3_16HELP6 HELPTEXT(TOPIC3_16HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_16HELP1 - overall */ #ifdef TOPIC3_17HELP1 .in_com_hlp3_17 defb $7F HELPTEXT(TOPIC3_17HELP1) #ifdef TOPIC3_17HELP2 HELPTEXT(TOPIC3_17HELP2) #endif #ifdef TOPIC3_17HELP3 HELPTEXT(TOPIC3_17HELP3) #endif #ifdef TOPIC3_17HELP4 HELPTEXT(TOPIC3_17HELP4) #endif #ifdef TOPIC3_17HELP5 HELPTEXT(TOPIC3_17HELP5) #endif #ifdef TOPIC3_17HELP6 HELPTEXT(TOPIC3_17HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_17HELP1 - overall */ #ifdef TOPIC3_18HELP1 .in_com_hlp3_18 defb $7F HELPTEXT(TOPIC3_18HELP1) #ifdef TOPIC3_18HELP2 HELPTEXT(TOPIC3_18HELP2) #endif #ifdef TOPIC3_18HELP3 HELPTEXT(TOPIC3_18HELP3) #endif #ifdef TOPIC3_18HELP4 HELPTEXT(TOPIC3_18HELP4) #endif #ifdef TOPIC3_18HELP5 HELPTEXT(TOPIC3_18HELP5) #endif #ifdef TOPIC3_18HELP6 HELPTEXT(TOPIC3_18HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_18HELP1 - overall */ #ifdef TOPIC3_19HELP1 .in_com_hlp3_19 defb $7F HELPTEXT(TOPIC3_19HELP1) #ifdef TOPIC3_19HELP2 HELPTEXT(TOPIC3_19HELP2) #endif #ifdef TOPIC3_19HELP3 HELPTEXT(TOPIC3_19HELP3) #endif #ifdef TOPIC3_19HELP4 HELPTEXT(TOPIC3_19HELP4) #endif #ifdef TOPIC3_19HELP5 HELPTEXT(TOPIC3_19HELP5) #endif #ifdef TOPIC3_19HELP6 HELPTEXT(TOPIC3_19HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_19HELP1 - overall */ #ifdef TOPIC3_20HELP1 .in_com_hlp3_20 defb $7F HELPTEXT(TOPIC3_20HELP1) #ifdef TOPIC3_20HELP2 HELPTEXT(TOPIC3_20HELP2) #endif #ifdef TOPIC3_20HELP3 HELPTEXT(TOPIC3_20HELP3) #endif #ifdef TOPIC3_20HELP4 HELPTEXT(TOPIC3_20HELP4) #endif #ifdef TOPIC3_20HELP5 HELPTEXT(TOPIC3_20HELP5) #endif #ifdef TOPIC3_20HELP6 HELPTEXT(TOPIC3_20HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_20HELP1 - overall */ #ifdef TOPIC3_21HELP1 .in_com_hlp3_21 defb $7F HELPTEXT(TOPIC3_21HELP1) #ifdef TOPIC3_21HELP2 HELPTEXT(TOPIC3_21HELP2) #endif #ifdef TOPIC3_21HELP3 HELPTEXT(TOPIC3_21HELP3) #endif #ifdef TOPIC3_21HELP4 HELPTEXT(TOPIC3_21HELP4) #endif #ifdef TOPIC3_21HELP5 HELPTEXT(TOPIC3_21HELP5) #endif #ifdef TOPIC3_21HELP6 HELPTEXT(TOPIC3_21HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_21HELP1 - overall */ #ifdef TOPIC3_22HELP1 .in_com_hlp3_22 defb $7F HELPTEXT(TOPIC3_22HELP1) #ifdef TOPIC3_22HELP2 HELPTEXT(TOPIC3_22HELP2) #endif #ifdef TOPIC3_22HELP3 HELPTEXT(TOPIC3_22HELP3) #endif #ifdef TOPIC3_22HELP4 HELPTEXT(TOPIC3_22HELP4) #endif #ifdef TOPIC3_22HELP5 HELPTEXT(TOPIC3_22HELP5) #endif #ifdef TOPIC3_22HELP6 HELPTEXT(TOPIC3_22HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_22HELP1 - overall */ #ifdef TOPIC3_23HELP1 .in_com_hlp3_23 defb $7F HELPTEXT(TOPIC3_23HELP1) #ifdef TOPIC3_23HELP2 HELPTEXT(TOPIC3_23HELP2) #endif #ifdef TOPIC3_23HELP3 HELPTEXT(TOPIC3_23HELP3) #endif #ifdef TOPIC3_23HELP4 HELPTEXT(TOPIC3_23HELP4) #endif #ifdef TOPIC3_23HELP5 HELPTEXT(TOPIC3_23HELP5) #endif #ifdef TOPIC3_23HELP6 HELPTEXT(TOPIC3_23HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_23HELP1 - overall */ #ifdef TOPIC3_24HELP1 .in_com_hlp3_24 defb $7F HELPTEXT(TOPIC3_24HELP1) #ifdef TOPIC3_24HELP2 HELPTEXT(TOPIC3_24HELP2) #endif #ifdef TOPIC3_24HELP3 HELPTEXT(TOPIC3_24HELP3) #endif #ifdef TOPIC3_24HELP4 HELPTEXT(TOPIC3_24HELP4) #endif #ifdef TOPIC3_24HELP5 HELPTEXT(TOPIC3_24HELP5) #endif #ifdef TOPIC3_24HELP6 HELPTEXT(TOPIC3_24HELP6) #endif defb 0 ;end marker #endif /* TOPIC3_24HELP1 - overall */ z88dk-1.8.ds1/include/oz/help4.h0000644000175000017500000002655107130401715015753 0ustar tygrystygrys/* * Help File for Commands in Topic 4 * * Don't include yourself!!! */ #ifdef TOPIC4_1HELP1 .in_com_hlp4_1 defb $7F HELPTEXT(TOPIC4_1HELP1) #ifdef TOPIC4_1HELP2 HELPTEXT(TOPIC4_1HELP2) #endif #ifdef TOPIC4_1HELP3 HELPTEXT(TOPIC4_1HELP3) #endif #ifdef TOPIC4_1HELP4 HELPTEXT(TOPIC4_1HELP4) #endif #ifdef TOPIC4_1HELP5 HELPTEXT(TOPIC4_1HELP5) #endif #ifdef TOPIC4_1HELP6 HELPTEXT(TOPIC4_1HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_1HELP1 - overall */ #ifdef TOPIC4_2HELP1 .in_com_hlp4_2 defb $7F HELPTEXT(TOPIC4_2HELP1) #ifdef TOPIC4_2HELP2 HELPTEXT(TOPIC4_2HELP2) #endif #ifdef TOPIC4_2HELP3 HELPTEXT(TOPIC4_2HELP3) #endif #ifdef TOPIC4_2HELP4 HELPTEXT(TOPIC4_2HELP4) #endif #ifdef TOPIC4_2HELP5 HELPTEXT(TOPIC4_2HELP5) #endif #ifdef TOPIC4_2HELP6 HELPTEXT(TOPIC4_2HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_2HELP1 - overall */ #ifdef TOPIC4_3HELP1 .in_com_hlp4_3 defb $7F HELPTEXT(TOPIC4_3HELP1) #ifdef TOPIC4_3HELP2 HELPTEXT(TOPIC4_3HELP2) #endif #ifdef TOPIC4_3HELP3 HELPTEXT(TOPIC4_3HELP3) #endif #ifdef TOPIC4_3HELP4 HELPTEXT(TOPIC4_3HELP4) #endif #ifdef TOPIC4_3HELP5 HELPTEXT(TOPIC4_3HELP5) #endif #ifdef TOPIC4_3HELP6 HELPTEXT(TOPIC4_3HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_3HELP1 - overall */ #ifdef TOPIC4_4HELP1 .in_com_hlp4_4 defb $7F HELPTEXT(TOPIC4_4HELP1) #ifdef TOPIC4_4HELP2 HELPTEXT(TOPIC4_4HELP2) #endif #ifdef TOPIC4_4HELP3 HELPTEXT(TOPIC4_4HELP3) #endif #ifdef TOPIC4_4HELP4 HELPTEXT(TOPIC4_4HELP4) #endif #ifdef TOPIC4_4HELP5 HELPTEXT(TOPIC4_4HELP5) #endif #ifdef TOPIC4_4HELP6 HELPTEXT(TOPIC4_4HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_4HELP1 - overall */ #ifdef TOPIC4_5HELP1 .in_com_hlp4_5 defb $7F HELPTEXT(TOPIC4_5HELP1) #ifdef TOPIC4_5HELP2 HELPTEXT(TOPIC4_5HELP2) #endif #ifdef TOPIC4_5HELP3 HELPTEXT(TOPIC4_5HELP3) #endif #ifdef TOPIC4_5HELP4 HELPTEXT(TOPIC4_5HELP4) #endif #ifdef TOPIC4_5HELP5 HELPTEXT(TOPIC4_5HELP5) #endif #ifdef TOPIC4_5HELP6 HELPTEXT(TOPIC4_5HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_5HELP1 - overall */ #ifdef TOPIC4_6HELP1 .in_com_hlp4_6 defb $7F HELPTEXT(TOPIC4_6HELP1) #ifdef TOPIC4_6HELP2 HELPTEXT(TOPIC4_6HELP2) #endif #ifdef TOPIC4_6HELP3 HELPTEXT(TOPIC4_6HELP3) #endif #ifdef TOPIC4_6HELP4 HELPTEXT(TOPIC4_6HELP4) #endif #ifdef TOPIC4_6HELP5 HELPTEXT(TOPIC4_6HELP5) #endif #ifdef TOPIC4_6HELP6 HELPTEXT(TOPIC4_6HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_6HELP1 - overall */ #ifdef TOPIC4_7HELP1 .in_com_hlp4_7 defb $7F HELPTEXT(TOPIC4_7HELP1) #ifdef TOPIC4_7HELP2 HELPTEXT(TOPIC4_7HELP2) #endif #ifdef TOPIC4_7HELP3 HELPTEXT(TOPIC4_7HELP3) #endif #ifdef TOPIC4_7HELP4 HELPTEXT(TOPIC4_7HELP4) #endif #ifdef TOPIC4_7HELP5 HELPTEXT(TOPIC4_7HELP5) #endif #ifdef TOPIC4_7HELP6 HELPTEXT(TOPIC4_7HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_7HELP1 - overall */ #ifdef TOPIC4_8HELP1 .in_com_hlp4_8 defb $7F HELPTEXT(TOPIC4_8HELP1) #ifdef TOPIC4_8HELP2 HELPTEXT(TOPIC4_8HELP2) #endif #ifdef TOPIC4_8HELP3 HELPTEXT(TOPIC4_8HELP3) #endif #ifdef TOPIC4_8HELP4 HELPTEXT(TOPIC4_8HELP4) #endif #ifdef TOPIC4_8HELP5 HELPTEXT(TOPIC4_8HELP5) #endif #ifdef TOPIC4_8HELP6 HELPTEXT(TOPIC4_8HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_8HELP1 - overall */ #ifdef TOPIC4_9HELP1 .in_com_hlp4_9 defb $7F HELPTEXT(TOPIC4_9HELP1) #ifdef TOPIC4_9HELP2 HELPTEXT(TOPIC4_9HELP2) #endif #ifdef TOPIC4_9HELP3 HELPTEXT(TOPIC4_9HELP3) #endif #ifdef TOPIC4_9HELP4 HELPTEXT(TOPIC4_9HELP4) #endif #ifdef TOPIC4_9HELP5 HELPTEXT(TOPIC4_9HELP5) #endif #ifdef TOPIC4_9HELP6 HELPTEXT(TOPIC4_9HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_9HELP1 - overall */ #ifdef TOPIC4_10HELP1 .in_com_hlp4_10 defb $7F HELPTEXT(TOPIC4_10HELP1) #ifdef TOPIC4_10HELP2 HELPTEXT(TOPIC4_10HELP2) #endif #ifdef TOPIC4_10HELP3 HELPTEXT(TOPIC4_10HELP3) #endif #ifdef TOPIC4_10HELP4 HELPTEXT(TOPIC4_10HELP4) #endif #ifdef TOPIC4_10HELP5 HELPTEXT(TOPIC4_10HELP5) #endif #ifdef TOPIC4_10HELP6 HELPTEXT(TOPIC4_10HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_10HELP1 - overall */ #ifdef TOPIC4_11HELP1 .in_com_hlp4_11 defb $7F HELPTEXT(TOPIC4_11HELP1) #ifdef TOPIC4_11HELP2 HELPTEXT(TOPIC4_11HELP2) #endif #ifdef TOPIC4_11HELP3 HELPTEXT(TOPIC4_11HELP3) #endif #ifdef TOPIC4_11HELP4 HELPTEXT(TOPIC4_11HELP4) #endif #ifdef TOPIC4_11HELP5 HELPTEXT(TOPIC4_11HELP5) #endif #ifdef TOPIC4_11HELP6 HELPTEXT(TOPIC4_11HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_11HELP1 - overall */ #ifdef TOPIC4_12HELP1 .in_com_hlp4_12 defb $7F HELPTEXT(TOPIC4_12HELP1) #ifdef TOPIC4_12HELP2 HELPTEXT(TOPIC4_12HELP2) #endif #ifdef TOPIC4_12HELP3 HELPTEXT(TOPIC4_12HELP3) #endif #ifdef TOPIC4_12HELP4 HELPTEXT(TOPIC4_12HELP4) #endif #ifdef TOPIC4_12HELP5 HELPTEXT(TOPIC4_12HELP5) #endif #ifdef TOPIC4_12HELP6 HELPTEXT(TOPIC4_12HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_12HELP1 - overall */ #ifdef TOPIC4_13HELP1 .in_com_hlp4_13 defb $7F HELPTEXT(TOPIC4_13HELP1) #ifdef TOPIC4_13HELP2 HELPTEXT(TOPIC4_13HELP2) #endif #ifdef TOPIC4_13HELP3 HELPTEXT(TOPIC4_13HELP3) #endif #ifdef TOPIC4_13HELP4 HELPTEXT(TOPIC4_13HELP4) #endif #ifdef TOPIC4_13HELP5 HELPTEXT(TOPIC4_13HELP5) #endif #ifdef TOPIC4_13HELP6 HELPTEXT(TOPIC4_13HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_13HELP1 - overall */ #ifdef TOPIC4_14HELP1 .in_com_hlp4_14 defb $7F HELPTEXT(TOPIC4_14HELP1) #ifdef TOPIC4_14HELP2 HELPTEXT(TOPIC4_14HELP2) #endif #ifdef TOPIC4_14HELP3 HELPTEXT(TOPIC4_14HELP3) #endif #ifdef TOPIC4_14HELP4 HELPTEXT(TOPIC4_14HELP4) #endif #ifdef TOPIC4_14HELP5 HELPTEXT(TOPIC4_14HELP5) #endif #ifdef TOPIC4_14HELP6 HELPTEXT(TOPIC4_14HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_14HELP1 - overall */ #ifdef TOPIC4_15HELP1 .in_com_hlp4_15 defb $7F HELPTEXT(TOPIC4_15HELP1) #ifdef TOPIC4_15HELP2 HELPTEXT(TOPIC4_15HELP2) #endif #ifdef TOPIC4_15HELP3 HELPTEXT(TOPIC4_15HELP3) #endif #ifdef TOPIC4_15HELP4 HELPTEXT(TOPIC4_15HELP4) #endif #ifdef TOPIC4_15HELP5 HELPTEXT(TOPIC4_15HELP5) #endif #ifdef TOPIC4_15HELP6 HELPTEXT(TOPIC4_15HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_15HELP1 - overall */ #ifdef TOPIC4_16HELP1 .in_com_hlp4_16 defb $7F HELPTEXT(TOPIC4_16HELP1) #ifdef TOPIC4_16HELP2 HELPTEXT(TOPIC4_16HELP2) #endif #ifdef TOPIC4_16HELP3 HELPTEXT(TOPIC4_16HELP3) #endif #ifdef TOPIC4_16HELP4 HELPTEXT(TOPIC4_16HELP4) #endif #ifdef TOPIC4_16HELP5 HELPTEXT(TOPIC4_16HELP5) #endif #ifdef TOPIC4_16HELP6 HELPTEXT(TOPIC4_16HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_16HELP1 - overall */ #ifdef TOPIC4_17HELP1 .in_com_hlp4_17 defb $7F HELPTEXT(TOPIC4_17HELP1) #ifdef TOPIC4_17HELP2 HELPTEXT(TOPIC4_17HELP2) #endif #ifdef TOPIC4_17HELP3 HELPTEXT(TOPIC4_17HELP3) #endif #ifdef TOPIC4_17HELP4 HELPTEXT(TOPIC4_17HELP4) #endif #ifdef TOPIC4_17HELP5 HELPTEXT(TOPIC4_17HELP5) #endif #ifdef TOPIC4_17HELP6 HELPTEXT(TOPIC4_17HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_17HELP1 - overall */ #ifdef TOPIC4_18HELP1 .in_com_hlp4_18 defb $7F HELPTEXT(TOPIC4_18HELP1) #ifdef TOPIC4_18HELP2 HELPTEXT(TOPIC4_18HELP2) #endif #ifdef TOPIC4_18HELP3 HELPTEXT(TOPIC4_18HELP3) #endif #ifdef TOPIC4_18HELP4 HELPTEXT(TOPIC4_18HELP4) #endif #ifdef TOPIC4_18HELP5 HELPTEXT(TOPIC4_18HELP5) #endif #ifdef TOPIC4_18HELP6 HELPTEXT(TOPIC4_18HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_18HELP1 - overall */ #ifdef TOPIC4_19HELP1 .in_com_hlp4_19 defb $7F HELPTEXT(TOPIC4_19HELP1) #ifdef TOPIC4_19HELP2 HELPTEXT(TOPIC4_19HELP2) #endif #ifdef TOPIC4_19HELP3 HELPTEXT(TOPIC4_19HELP3) #endif #ifdef TOPIC4_19HELP4 HELPTEXT(TOPIC4_19HELP4) #endif #ifdef TOPIC4_19HELP5 HELPTEXT(TOPIC4_19HELP5) #endif #ifdef TOPIC4_19HELP6 HELPTEXT(TOPIC4_19HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_19HELP1 - overall */ #ifdef TOPIC4_20HELP1 .in_com_hlp4_20 defb $7F HELPTEXT(TOPIC4_20HELP1) #ifdef TOPIC4_20HELP2 HELPTEXT(TOPIC4_20HELP2) #endif #ifdef TOPIC4_20HELP3 HELPTEXT(TOPIC4_20HELP3) #endif #ifdef TOPIC4_20HELP4 HELPTEXT(TOPIC4_20HELP4) #endif #ifdef TOPIC4_20HELP5 HELPTEXT(TOPIC4_20HELP5) #endif #ifdef TOPIC4_20HELP6 HELPTEXT(TOPIC4_20HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_20HELP1 - overall */ #ifdef TOPIC4_21HELP1 .in_com_hlp4_21 defb $7F HELPTEXT(TOPIC4_21HELP1) #ifdef TOPIC4_21HELP2 HELPTEXT(TOPIC4_21HELP2) #endif #ifdef TOPIC4_21HELP3 HELPTEXT(TOPIC4_21HELP3) #endif #ifdef TOPIC4_21HELP4 HELPTEXT(TOPIC4_21HELP4) #endif #ifdef TOPIC4_21HELP5 HELPTEXT(TOPIC4_21HELP5) #endif #ifdef TOPIC4_21HELP6 HELPTEXT(TOPIC4_21HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_21HELP1 - overall */ #ifdef TOPIC4_22HELP1 .in_com_hlp4_22 defb $7F HELPTEXT(TOPIC4_22HELP1) #ifdef TOPIC4_22HELP2 HELPTEXT(TOPIC4_22HELP2) #endif #ifdef TOPIC4_22HELP3 HELPTEXT(TOPIC4_22HELP3) #endif #ifdef TOPIC4_22HELP4 HELPTEXT(TOPIC4_22HELP4) #endif #ifdef TOPIC4_22HELP5 HELPTEXT(TOPIC4_22HELP5) #endif #ifdef TOPIC4_22HELP6 HELPTEXT(TOPIC4_22HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_22HELP1 - overall */ #ifdef TOPIC4_23HELP1 .in_com_hlp4_23 defb $7F HELPTEXT(TOPIC4_23HELP1) #ifdef TOPIC4_23HELP2 HELPTEXT(TOPIC4_23HELP2) #endif #ifdef TOPIC4_23HELP3 HELPTEXT(TOPIC4_23HELP3) #endif #ifdef TOPIC4_23HELP4 HELPTEXT(TOPIC4_23HELP4) #endif #ifdef TOPIC4_23HELP5 HELPTEXT(TOPIC4_23HELP5) #endif #ifdef TOPIC4_23HELP6 HELPTEXT(TOPIC4_23HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_23HELP1 - overall */ #ifdef TOPIC4_24HELP1 .in_com_hlp4_24 defb $7F HELPTEXT(TOPIC4_24HELP1) #ifdef TOPIC4_24HELP2 HELPTEXT(TOPIC4_24HELP2) #endif #ifdef TOPIC4_24HELP3 HELPTEXT(TOPIC4_24HELP3) #endif #ifdef TOPIC4_24HELP4 HELPTEXT(TOPIC4_24HELP4) #endif #ifdef TOPIC4_24HELP5 HELPTEXT(TOPIC4_24HELP5) #endif #ifdef TOPIC4_24HELP6 HELPTEXT(TOPIC4_24HELP6) #endif defb 0 ;end marker #endif /* TOPIC4_24HELP1 - overall */ z88dk-1.8.ds1/include/oz/help5.h0000644000175000017500000002655107130401715015754 0ustar tygrystygrys/* * Help File for Commands in Topic 5 * * Don't include yourself!!! */ #ifdef TOPIC5_1HELP1 .in_com_hlp5_1 defb $7F HELPTEXT(TOPIC5_1HELP1) #ifdef TOPIC5_1HELP2 HELPTEXT(TOPIC5_1HELP2) #endif #ifdef TOPIC5_1HELP3 HELPTEXT(TOPIC5_1HELP3) #endif #ifdef TOPIC5_1HELP4 HELPTEXT(TOPIC5_1HELP4) #endif #ifdef TOPIC5_1HELP5 HELPTEXT(TOPIC5_1HELP5) #endif #ifdef TOPIC5_1HELP6 HELPTEXT(TOPIC5_1HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_1HELP1 - overall */ #ifdef TOPIC5_2HELP1 .in_com_hlp5_2 defb $7F HELPTEXT(TOPIC5_2HELP1) #ifdef TOPIC5_2HELP2 HELPTEXT(TOPIC5_2HELP2) #endif #ifdef TOPIC5_2HELP3 HELPTEXT(TOPIC5_2HELP3) #endif #ifdef TOPIC5_2HELP4 HELPTEXT(TOPIC5_2HELP4) #endif #ifdef TOPIC5_2HELP5 HELPTEXT(TOPIC5_2HELP5) #endif #ifdef TOPIC5_2HELP6 HELPTEXT(TOPIC5_2HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_2HELP1 - overall */ #ifdef TOPIC5_3HELP1 .in_com_hlp5_3 defb $7F HELPTEXT(TOPIC5_3HELP1) #ifdef TOPIC5_3HELP2 HELPTEXT(TOPIC5_3HELP2) #endif #ifdef TOPIC5_3HELP3 HELPTEXT(TOPIC5_3HELP3) #endif #ifdef TOPIC5_3HELP4 HELPTEXT(TOPIC5_3HELP4) #endif #ifdef TOPIC5_3HELP5 HELPTEXT(TOPIC5_3HELP5) #endif #ifdef TOPIC5_3HELP6 HELPTEXT(TOPIC5_3HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_3HELP1 - overall */ #ifdef TOPIC5_4HELP1 .in_com_hlp5_4 defb $7F HELPTEXT(TOPIC5_4HELP1) #ifdef TOPIC5_4HELP2 HELPTEXT(TOPIC5_4HELP2) #endif #ifdef TOPIC5_4HELP3 HELPTEXT(TOPIC5_4HELP3) #endif #ifdef TOPIC5_4HELP4 HELPTEXT(TOPIC5_4HELP4) #endif #ifdef TOPIC5_4HELP5 HELPTEXT(TOPIC5_4HELP5) #endif #ifdef TOPIC5_4HELP6 HELPTEXT(TOPIC5_4HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_4HELP1 - overall */ #ifdef TOPIC5_5HELP1 .in_com_hlp5_5 defb $7F HELPTEXT(TOPIC5_5HELP1) #ifdef TOPIC5_5HELP2 HELPTEXT(TOPIC5_5HELP2) #endif #ifdef TOPIC5_5HELP3 HELPTEXT(TOPIC5_5HELP3) #endif #ifdef TOPIC5_5HELP4 HELPTEXT(TOPIC5_5HELP4) #endif #ifdef TOPIC5_5HELP5 HELPTEXT(TOPIC5_5HELP5) #endif #ifdef TOPIC5_5HELP6 HELPTEXT(TOPIC5_5HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_5HELP1 - overall */ #ifdef TOPIC5_6HELP1 .in_com_hlp5_6 defb $7F HELPTEXT(TOPIC5_6HELP1) #ifdef TOPIC5_6HELP2 HELPTEXT(TOPIC5_6HELP2) #endif #ifdef TOPIC5_6HELP3 HELPTEXT(TOPIC5_6HELP3) #endif #ifdef TOPIC5_6HELP4 HELPTEXT(TOPIC5_6HELP4) #endif #ifdef TOPIC5_6HELP5 HELPTEXT(TOPIC5_6HELP5) #endif #ifdef TOPIC5_6HELP6 HELPTEXT(TOPIC5_6HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_6HELP1 - overall */ #ifdef TOPIC5_7HELP1 .in_com_hlp5_7 defb $7F HELPTEXT(TOPIC5_7HELP1) #ifdef TOPIC5_7HELP2 HELPTEXT(TOPIC5_7HELP2) #endif #ifdef TOPIC5_7HELP3 HELPTEXT(TOPIC5_7HELP3) #endif #ifdef TOPIC5_7HELP4 HELPTEXT(TOPIC5_7HELP4) #endif #ifdef TOPIC5_7HELP5 HELPTEXT(TOPIC5_7HELP5) #endif #ifdef TOPIC5_7HELP6 HELPTEXT(TOPIC5_7HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_7HELP1 - overall */ #ifdef TOPIC5_8HELP1 .in_com_hlp5_8 defb $7F HELPTEXT(TOPIC5_8HELP1) #ifdef TOPIC5_8HELP2 HELPTEXT(TOPIC5_8HELP2) #endif #ifdef TOPIC5_8HELP3 HELPTEXT(TOPIC5_8HELP3) #endif #ifdef TOPIC5_8HELP4 HELPTEXT(TOPIC5_8HELP4) #endif #ifdef TOPIC5_8HELP5 HELPTEXT(TOPIC5_8HELP5) #endif #ifdef TOPIC5_8HELP6 HELPTEXT(TOPIC5_8HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_8HELP1 - overall */ #ifdef TOPIC5_9HELP1 .in_com_hlp5_9 defb $7F HELPTEXT(TOPIC5_9HELP1) #ifdef TOPIC5_9HELP2 HELPTEXT(TOPIC5_9HELP2) #endif #ifdef TOPIC5_9HELP3 HELPTEXT(TOPIC5_9HELP3) #endif #ifdef TOPIC5_9HELP4 HELPTEXT(TOPIC5_9HELP4) #endif #ifdef TOPIC5_9HELP5 HELPTEXT(TOPIC5_9HELP5) #endif #ifdef TOPIC5_9HELP6 HELPTEXT(TOPIC5_9HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_9HELP1 - overall */ #ifdef TOPIC5_10HELP1 .in_com_hlp5_10 defb $7F HELPTEXT(TOPIC5_10HELP1) #ifdef TOPIC5_10HELP2 HELPTEXT(TOPIC5_10HELP2) #endif #ifdef TOPIC5_10HELP3 HELPTEXT(TOPIC5_10HELP3) #endif #ifdef TOPIC5_10HELP4 HELPTEXT(TOPIC5_10HELP4) #endif #ifdef TOPIC5_10HELP5 HELPTEXT(TOPIC5_10HELP5) #endif #ifdef TOPIC5_10HELP6 HELPTEXT(TOPIC5_10HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_10HELP1 - overall */ #ifdef TOPIC5_11HELP1 .in_com_hlp5_11 defb $7F HELPTEXT(TOPIC5_11HELP1) #ifdef TOPIC5_11HELP2 HELPTEXT(TOPIC5_11HELP2) #endif #ifdef TOPIC5_11HELP3 HELPTEXT(TOPIC5_11HELP3) #endif #ifdef TOPIC5_11HELP4 HELPTEXT(TOPIC5_11HELP4) #endif #ifdef TOPIC5_11HELP5 HELPTEXT(TOPIC5_11HELP5) #endif #ifdef TOPIC5_11HELP6 HELPTEXT(TOPIC5_11HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_11HELP1 - overall */ #ifdef TOPIC5_12HELP1 .in_com_hlp5_12 defb $7F HELPTEXT(TOPIC5_12HELP1) #ifdef TOPIC5_12HELP2 HELPTEXT(TOPIC5_12HELP2) #endif #ifdef TOPIC5_12HELP3 HELPTEXT(TOPIC5_12HELP3) #endif #ifdef TOPIC5_12HELP4 HELPTEXT(TOPIC5_12HELP4) #endif #ifdef TOPIC5_12HELP5 HELPTEXT(TOPIC5_12HELP5) #endif #ifdef TOPIC5_12HELP6 HELPTEXT(TOPIC5_12HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_12HELP1 - overall */ #ifdef TOPIC5_13HELP1 .in_com_hlp5_13 defb $7F HELPTEXT(TOPIC5_13HELP1) #ifdef TOPIC5_13HELP2 HELPTEXT(TOPIC5_13HELP2) #endif #ifdef TOPIC5_13HELP3 HELPTEXT(TOPIC5_13HELP3) #endif #ifdef TOPIC5_13HELP4 HELPTEXT(TOPIC5_13HELP4) #endif #ifdef TOPIC5_13HELP5 HELPTEXT(TOPIC5_13HELP5) #endif #ifdef TOPIC5_13HELP6 HELPTEXT(TOPIC5_13HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_13HELP1 - overall */ #ifdef TOPIC5_14HELP1 .in_com_hlp5_14 defb $7F HELPTEXT(TOPIC5_14HELP1) #ifdef TOPIC5_14HELP2 HELPTEXT(TOPIC5_14HELP2) #endif #ifdef TOPIC5_14HELP3 HELPTEXT(TOPIC5_14HELP3) #endif #ifdef TOPIC5_14HELP4 HELPTEXT(TOPIC5_14HELP4) #endif #ifdef TOPIC5_14HELP5 HELPTEXT(TOPIC5_14HELP5) #endif #ifdef TOPIC5_14HELP6 HELPTEXT(TOPIC5_14HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_14HELP1 - overall */ #ifdef TOPIC5_15HELP1 .in_com_hlp5_15 defb $7F HELPTEXT(TOPIC5_15HELP1) #ifdef TOPIC5_15HELP2 HELPTEXT(TOPIC5_15HELP2) #endif #ifdef TOPIC5_15HELP3 HELPTEXT(TOPIC5_15HELP3) #endif #ifdef TOPIC5_15HELP4 HELPTEXT(TOPIC5_15HELP4) #endif #ifdef TOPIC5_15HELP5 HELPTEXT(TOPIC5_15HELP5) #endif #ifdef TOPIC5_15HELP6 HELPTEXT(TOPIC5_15HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_15HELP1 - overall */ #ifdef TOPIC5_16HELP1 .in_com_hlp5_16 defb $7F HELPTEXT(TOPIC5_16HELP1) #ifdef TOPIC5_16HELP2 HELPTEXT(TOPIC5_16HELP2) #endif #ifdef TOPIC5_16HELP3 HELPTEXT(TOPIC5_16HELP3) #endif #ifdef TOPIC5_16HELP4 HELPTEXT(TOPIC5_16HELP4) #endif #ifdef TOPIC5_16HELP5 HELPTEXT(TOPIC5_16HELP5) #endif #ifdef TOPIC5_16HELP6 HELPTEXT(TOPIC5_16HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_16HELP1 - overall */ #ifdef TOPIC5_17HELP1 .in_com_hlp5_17 defb $7F HELPTEXT(TOPIC5_17HELP1) #ifdef TOPIC5_17HELP2 HELPTEXT(TOPIC5_17HELP2) #endif #ifdef TOPIC5_17HELP3 HELPTEXT(TOPIC5_17HELP3) #endif #ifdef TOPIC5_17HELP4 HELPTEXT(TOPIC5_17HELP4) #endif #ifdef TOPIC5_17HELP5 HELPTEXT(TOPIC5_17HELP5) #endif #ifdef TOPIC5_17HELP6 HELPTEXT(TOPIC5_17HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_17HELP1 - overall */ #ifdef TOPIC5_18HELP1 .in_com_hlp5_18 defb $7F HELPTEXT(TOPIC5_18HELP1) #ifdef TOPIC5_18HELP2 HELPTEXT(TOPIC5_18HELP2) #endif #ifdef TOPIC5_18HELP3 HELPTEXT(TOPIC5_18HELP3) #endif #ifdef TOPIC5_18HELP4 HELPTEXT(TOPIC5_18HELP4) #endif #ifdef TOPIC5_18HELP5 HELPTEXT(TOPIC5_18HELP5) #endif #ifdef TOPIC5_18HELP6 HELPTEXT(TOPIC5_18HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_18HELP1 - overall */ #ifdef TOPIC5_19HELP1 .in_com_hlp5_19 defb $7F HELPTEXT(TOPIC5_19HELP1) #ifdef TOPIC5_19HELP2 HELPTEXT(TOPIC5_19HELP2) #endif #ifdef TOPIC5_19HELP3 HELPTEXT(TOPIC5_19HELP3) #endif #ifdef TOPIC5_19HELP4 HELPTEXT(TOPIC5_19HELP4) #endif #ifdef TOPIC5_19HELP5 HELPTEXT(TOPIC5_19HELP5) #endif #ifdef TOPIC5_19HELP6 HELPTEXT(TOPIC5_19HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_19HELP1 - overall */ #ifdef TOPIC5_20HELP1 .in_com_hlp5_20 defb $7F HELPTEXT(TOPIC5_20HELP1) #ifdef TOPIC5_20HELP2 HELPTEXT(TOPIC5_20HELP2) #endif #ifdef TOPIC5_20HELP3 HELPTEXT(TOPIC5_20HELP3) #endif #ifdef TOPIC5_20HELP4 HELPTEXT(TOPIC5_20HELP4) #endif #ifdef TOPIC5_20HELP5 HELPTEXT(TOPIC5_20HELP5) #endif #ifdef TOPIC5_20HELP6 HELPTEXT(TOPIC5_20HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_20HELP1 - overall */ #ifdef TOPIC5_21HELP1 .in_com_hlp5_21 defb $7F HELPTEXT(TOPIC5_21HELP1) #ifdef TOPIC5_21HELP2 HELPTEXT(TOPIC5_21HELP2) #endif #ifdef TOPIC5_21HELP3 HELPTEXT(TOPIC5_21HELP3) #endif #ifdef TOPIC5_21HELP4 HELPTEXT(TOPIC5_21HELP4) #endif #ifdef TOPIC5_21HELP5 HELPTEXT(TOPIC5_21HELP5) #endif #ifdef TOPIC5_21HELP6 HELPTEXT(TOPIC5_21HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_21HELP1 - overall */ #ifdef TOPIC5_22HELP1 .in_com_hlp5_22 defb $7F HELPTEXT(TOPIC5_22HELP1) #ifdef TOPIC5_22HELP2 HELPTEXT(TOPIC5_22HELP2) #endif #ifdef TOPIC5_22HELP3 HELPTEXT(TOPIC5_22HELP3) #endif #ifdef TOPIC5_22HELP4 HELPTEXT(TOPIC5_22HELP4) #endif #ifdef TOPIC5_22HELP5 HELPTEXT(TOPIC5_22HELP5) #endif #ifdef TOPIC5_22HELP6 HELPTEXT(TOPIC5_22HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_22HELP1 - overall */ #ifdef TOPIC5_23HELP1 .in_com_hlp5_23 defb $7F HELPTEXT(TOPIC5_23HELP1) #ifdef TOPIC5_23HELP2 HELPTEXT(TOPIC5_23HELP2) #endif #ifdef TOPIC5_23HELP3 HELPTEXT(TOPIC5_23HELP3) #endif #ifdef TOPIC5_23HELP4 HELPTEXT(TOPIC5_23HELP4) #endif #ifdef TOPIC5_23HELP5 HELPTEXT(TOPIC5_23HELP5) #endif #ifdef TOPIC5_23HELP6 HELPTEXT(TOPIC5_23HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_23HELP1 - overall */ #ifdef TOPIC5_24HELP1 .in_com_hlp5_24 defb $7F HELPTEXT(TOPIC5_24HELP1) #ifdef TOPIC5_24HELP2 HELPTEXT(TOPIC5_24HELP2) #endif #ifdef TOPIC5_24HELP3 HELPTEXT(TOPIC5_24HELP3) #endif #ifdef TOPIC5_24HELP4 HELPTEXT(TOPIC5_24HELP4) #endif #ifdef TOPIC5_24HELP5 HELPTEXT(TOPIC5_24HELP5) #endif #ifdef TOPIC5_24HELP6 HELPTEXT(TOPIC5_24HELP6) #endif defb 0 ;end marker #endif /* TOPIC5_24HELP1 - overall */ z88dk-1.8.ds1/include/oz/help6.h0000644000175000017500000002655107130401715015755 0ustar tygrystygrys/* * Help File for Commands in Topic 6 * * Don't include yourself!!! */ #ifdef TOPIC6_1HELP1 .in_com_hlp6_1 defb $7F HELPTEXT(TOPIC6_1HELP1) #ifdef TOPIC6_1HELP2 HELPTEXT(TOPIC6_1HELP2) #endif #ifdef TOPIC6_1HELP3 HELPTEXT(TOPIC6_1HELP3) #endif #ifdef TOPIC6_1HELP4 HELPTEXT(TOPIC6_1HELP4) #endif #ifdef TOPIC6_1HELP5 HELPTEXT(TOPIC6_1HELP5) #endif #ifdef TOPIC6_1HELP6 HELPTEXT(TOPIC6_1HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_1HELP1 - overall */ #ifdef TOPIC6_2HELP1 .in_com_hlp6_2 defb $7F HELPTEXT(TOPIC6_2HELP1) #ifdef TOPIC6_2HELP2 HELPTEXT(TOPIC6_2HELP2) #endif #ifdef TOPIC6_2HELP3 HELPTEXT(TOPIC6_2HELP3) #endif #ifdef TOPIC6_2HELP4 HELPTEXT(TOPIC6_2HELP4) #endif #ifdef TOPIC6_2HELP5 HELPTEXT(TOPIC6_2HELP5) #endif #ifdef TOPIC6_2HELP6 HELPTEXT(TOPIC6_2HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_2HELP1 - overall */ #ifdef TOPIC6_3HELP1 .in_com_hlp6_3 defb $7F HELPTEXT(TOPIC6_3HELP1) #ifdef TOPIC6_3HELP2 HELPTEXT(TOPIC6_3HELP2) #endif #ifdef TOPIC6_3HELP3 HELPTEXT(TOPIC6_3HELP3) #endif #ifdef TOPIC6_3HELP4 HELPTEXT(TOPIC6_3HELP4) #endif #ifdef TOPIC6_3HELP5 HELPTEXT(TOPIC6_3HELP5) #endif #ifdef TOPIC6_3HELP6 HELPTEXT(TOPIC6_3HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_3HELP1 - overall */ #ifdef TOPIC6_4HELP1 .in_com_hlp6_4 defb $7F HELPTEXT(TOPIC6_4HELP1) #ifdef TOPIC6_4HELP2 HELPTEXT(TOPIC6_4HELP2) #endif #ifdef TOPIC6_4HELP3 HELPTEXT(TOPIC6_4HELP3) #endif #ifdef TOPIC6_4HELP4 HELPTEXT(TOPIC6_4HELP4) #endif #ifdef TOPIC6_4HELP5 HELPTEXT(TOPIC6_4HELP5) #endif #ifdef TOPIC6_4HELP6 HELPTEXT(TOPIC6_4HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_4HELP1 - overall */ #ifdef TOPIC6_5HELP1 .in_com_hlp6_5 defb $7F HELPTEXT(TOPIC6_5HELP1) #ifdef TOPIC6_5HELP2 HELPTEXT(TOPIC6_5HELP2) #endif #ifdef TOPIC6_5HELP3 HELPTEXT(TOPIC6_5HELP3) #endif #ifdef TOPIC6_5HELP4 HELPTEXT(TOPIC6_5HELP4) #endif #ifdef TOPIC6_5HELP5 HELPTEXT(TOPIC6_5HELP5) #endif #ifdef TOPIC6_5HELP6 HELPTEXT(TOPIC6_5HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_5HELP1 - overall */ #ifdef TOPIC6_6HELP1 .in_com_hlp6_6 defb $7F HELPTEXT(TOPIC6_6HELP1) #ifdef TOPIC6_6HELP2 HELPTEXT(TOPIC6_6HELP2) #endif #ifdef TOPIC6_6HELP3 HELPTEXT(TOPIC6_6HELP3) #endif #ifdef TOPIC6_6HELP4 HELPTEXT(TOPIC6_6HELP4) #endif #ifdef TOPIC6_6HELP5 HELPTEXT(TOPIC6_6HELP5) #endif #ifdef TOPIC6_6HELP6 HELPTEXT(TOPIC6_6HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_6HELP1 - overall */ #ifdef TOPIC6_7HELP1 .in_com_hlp6_7 defb $7F HELPTEXT(TOPIC6_7HELP1) #ifdef TOPIC6_7HELP2 HELPTEXT(TOPIC6_7HELP2) #endif #ifdef TOPIC6_7HELP3 HELPTEXT(TOPIC6_7HELP3) #endif #ifdef TOPIC6_7HELP4 HELPTEXT(TOPIC6_7HELP4) #endif #ifdef TOPIC6_7HELP5 HELPTEXT(TOPIC6_7HELP5) #endif #ifdef TOPIC6_7HELP6 HELPTEXT(TOPIC6_7HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_7HELP1 - overall */ #ifdef TOPIC6_8HELP1 .in_com_hlp6_8 defb $7F HELPTEXT(TOPIC6_8HELP1) #ifdef TOPIC6_8HELP2 HELPTEXT(TOPIC6_8HELP2) #endif #ifdef TOPIC6_8HELP3 HELPTEXT(TOPIC6_8HELP3) #endif #ifdef TOPIC6_8HELP4 HELPTEXT(TOPIC6_8HELP4) #endif #ifdef TOPIC6_8HELP5 HELPTEXT(TOPIC6_8HELP5) #endif #ifdef TOPIC6_8HELP6 HELPTEXT(TOPIC6_8HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_8HELP1 - overall */ #ifdef TOPIC6_9HELP1 .in_com_hlp6_9 defb $7F HELPTEXT(TOPIC6_9HELP1) #ifdef TOPIC6_9HELP2 HELPTEXT(TOPIC6_9HELP2) #endif #ifdef TOPIC6_9HELP3 HELPTEXT(TOPIC6_9HELP3) #endif #ifdef TOPIC6_9HELP4 HELPTEXT(TOPIC6_9HELP4) #endif #ifdef TOPIC6_9HELP5 HELPTEXT(TOPIC6_9HELP5) #endif #ifdef TOPIC6_9HELP6 HELPTEXT(TOPIC6_9HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_9HELP1 - overall */ #ifdef TOPIC6_10HELP1 .in_com_hlp6_10 defb $7F HELPTEXT(TOPIC6_10HELP1) #ifdef TOPIC6_10HELP2 HELPTEXT(TOPIC6_10HELP2) #endif #ifdef TOPIC6_10HELP3 HELPTEXT(TOPIC6_10HELP3) #endif #ifdef TOPIC6_10HELP4 HELPTEXT(TOPIC6_10HELP4) #endif #ifdef TOPIC6_10HELP5 HELPTEXT(TOPIC6_10HELP5) #endif #ifdef TOPIC6_10HELP6 HELPTEXT(TOPIC6_10HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_10HELP1 - overall */ #ifdef TOPIC6_11HELP1 .in_com_hlp6_11 defb $7F HELPTEXT(TOPIC6_11HELP1) #ifdef TOPIC6_11HELP2 HELPTEXT(TOPIC6_11HELP2) #endif #ifdef TOPIC6_11HELP3 HELPTEXT(TOPIC6_11HELP3) #endif #ifdef TOPIC6_11HELP4 HELPTEXT(TOPIC6_11HELP4) #endif #ifdef TOPIC6_11HELP5 HELPTEXT(TOPIC6_11HELP5) #endif #ifdef TOPIC6_11HELP6 HELPTEXT(TOPIC6_11HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_11HELP1 - overall */ #ifdef TOPIC6_12HELP1 .in_com_hlp6_12 defb $7F HELPTEXT(TOPIC6_12HELP1) #ifdef TOPIC6_12HELP2 HELPTEXT(TOPIC6_12HELP2) #endif #ifdef TOPIC6_12HELP3 HELPTEXT(TOPIC6_12HELP3) #endif #ifdef TOPIC6_12HELP4 HELPTEXT(TOPIC6_12HELP4) #endif #ifdef TOPIC6_12HELP5 HELPTEXT(TOPIC6_12HELP5) #endif #ifdef TOPIC6_12HELP6 HELPTEXT(TOPIC6_12HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_12HELP1 - overall */ #ifdef TOPIC6_13HELP1 .in_com_hlp6_13 defb $7F HELPTEXT(TOPIC6_13HELP1) #ifdef TOPIC6_13HELP2 HELPTEXT(TOPIC6_13HELP2) #endif #ifdef TOPIC6_13HELP3 HELPTEXT(TOPIC6_13HELP3) #endif #ifdef TOPIC6_13HELP4 HELPTEXT(TOPIC6_13HELP4) #endif #ifdef TOPIC6_13HELP5 HELPTEXT(TOPIC6_13HELP5) #endif #ifdef TOPIC6_13HELP6 HELPTEXT(TOPIC6_13HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_13HELP1 - overall */ #ifdef TOPIC6_14HELP1 .in_com_hlp6_14 defb $7F HELPTEXT(TOPIC6_14HELP1) #ifdef TOPIC6_14HELP2 HELPTEXT(TOPIC6_14HELP2) #endif #ifdef TOPIC6_14HELP3 HELPTEXT(TOPIC6_14HELP3) #endif #ifdef TOPIC6_14HELP4 HELPTEXT(TOPIC6_14HELP4) #endif #ifdef TOPIC6_14HELP5 HELPTEXT(TOPIC6_14HELP5) #endif #ifdef TOPIC6_14HELP6 HELPTEXT(TOPIC6_14HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_14HELP1 - overall */ #ifdef TOPIC6_15HELP1 .in_com_hlp6_15 defb $7F HELPTEXT(TOPIC6_15HELP1) #ifdef TOPIC6_15HELP2 HELPTEXT(TOPIC6_15HELP2) #endif #ifdef TOPIC6_15HELP3 HELPTEXT(TOPIC6_15HELP3) #endif #ifdef TOPIC6_15HELP4 HELPTEXT(TOPIC6_15HELP4) #endif #ifdef TOPIC6_15HELP5 HELPTEXT(TOPIC6_15HELP5) #endif #ifdef TOPIC6_15HELP6 HELPTEXT(TOPIC6_15HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_15HELP1 - overall */ #ifdef TOPIC6_16HELP1 .in_com_hlp6_16 defb $7F HELPTEXT(TOPIC6_16HELP1) #ifdef TOPIC6_16HELP2 HELPTEXT(TOPIC6_16HELP2) #endif #ifdef TOPIC6_16HELP3 HELPTEXT(TOPIC6_16HELP3) #endif #ifdef TOPIC6_16HELP4 HELPTEXT(TOPIC6_16HELP4) #endif #ifdef TOPIC6_16HELP5 HELPTEXT(TOPIC6_16HELP5) #endif #ifdef TOPIC6_16HELP6 HELPTEXT(TOPIC6_16HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_16HELP1 - overall */ #ifdef TOPIC6_17HELP1 .in_com_hlp6_17 defb $7F HELPTEXT(TOPIC6_17HELP1) #ifdef TOPIC6_17HELP2 HELPTEXT(TOPIC6_17HELP2) #endif #ifdef TOPIC6_17HELP3 HELPTEXT(TOPIC6_17HELP3) #endif #ifdef TOPIC6_17HELP4 HELPTEXT(TOPIC6_17HELP4) #endif #ifdef TOPIC6_17HELP5 HELPTEXT(TOPIC6_17HELP5) #endif #ifdef TOPIC6_17HELP6 HELPTEXT(TOPIC6_17HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_17HELP1 - overall */ #ifdef TOPIC6_18HELP1 .in_com_hlp6_18 defb $7F HELPTEXT(TOPIC6_18HELP1) #ifdef TOPIC6_18HELP2 HELPTEXT(TOPIC6_18HELP2) #endif #ifdef TOPIC6_18HELP3 HELPTEXT(TOPIC6_18HELP3) #endif #ifdef TOPIC6_18HELP4 HELPTEXT(TOPIC6_18HELP4) #endif #ifdef TOPIC6_18HELP5 HELPTEXT(TOPIC6_18HELP5) #endif #ifdef TOPIC6_18HELP6 HELPTEXT(TOPIC6_18HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_18HELP1 - overall */ #ifdef TOPIC6_19HELP1 .in_com_hlp6_19 defb $7F HELPTEXT(TOPIC6_19HELP1) #ifdef TOPIC6_19HELP2 HELPTEXT(TOPIC6_19HELP2) #endif #ifdef TOPIC6_19HELP3 HELPTEXT(TOPIC6_19HELP3) #endif #ifdef TOPIC6_19HELP4 HELPTEXT(TOPIC6_19HELP4) #endif #ifdef TOPIC6_19HELP5 HELPTEXT(TOPIC6_19HELP5) #endif #ifdef TOPIC6_19HELP6 HELPTEXT(TOPIC6_19HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_19HELP1 - overall */ #ifdef TOPIC6_20HELP1 .in_com_hlp6_20 defb $7F HELPTEXT(TOPIC6_20HELP1) #ifdef TOPIC6_20HELP2 HELPTEXT(TOPIC6_20HELP2) #endif #ifdef TOPIC6_20HELP3 HELPTEXT(TOPIC6_20HELP3) #endif #ifdef TOPIC6_20HELP4 HELPTEXT(TOPIC6_20HELP4) #endif #ifdef TOPIC6_20HELP5 HELPTEXT(TOPIC6_20HELP5) #endif #ifdef TOPIC6_20HELP6 HELPTEXT(TOPIC6_20HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_20HELP1 - overall */ #ifdef TOPIC6_21HELP1 .in_com_hlp6_21 defb $7F HELPTEXT(TOPIC6_21HELP1) #ifdef TOPIC6_21HELP2 HELPTEXT(TOPIC6_21HELP2) #endif #ifdef TOPIC6_21HELP3 HELPTEXT(TOPIC6_21HELP3) #endif #ifdef TOPIC6_21HELP4 HELPTEXT(TOPIC6_21HELP4) #endif #ifdef TOPIC6_21HELP5 HELPTEXT(TOPIC6_21HELP5) #endif #ifdef TOPIC6_21HELP6 HELPTEXT(TOPIC6_21HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_21HELP1 - overall */ #ifdef TOPIC6_22HELP1 .in_com_hlp6_22 defb $7F HELPTEXT(TOPIC6_22HELP1) #ifdef TOPIC6_22HELP2 HELPTEXT(TOPIC6_22HELP2) #endif #ifdef TOPIC6_22HELP3 HELPTEXT(TOPIC6_22HELP3) #endif #ifdef TOPIC6_22HELP4 HELPTEXT(TOPIC6_22HELP4) #endif #ifdef TOPIC6_22HELP5 HELPTEXT(TOPIC6_22HELP5) #endif #ifdef TOPIC6_22HELP6 HELPTEXT(TOPIC6_22HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_22HELP1 - overall */ #ifdef TOPIC6_23HELP1 .in_com_hlp6_23 defb $7F HELPTEXT(TOPIC6_23HELP1) #ifdef TOPIC6_23HELP2 HELPTEXT(TOPIC6_23HELP2) #endif #ifdef TOPIC6_23HELP3 HELPTEXT(TOPIC6_23HELP3) #endif #ifdef TOPIC6_23HELP4 HELPTEXT(TOPIC6_23HELP4) #endif #ifdef TOPIC6_23HELP5 HELPTEXT(TOPIC6_23HELP5) #endif #ifdef TOPIC6_23HELP6 HELPTEXT(TOPIC6_23HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_23HELP1 - overall */ #ifdef TOPIC6_24HELP1 .in_com_hlp6_24 defb $7F HELPTEXT(TOPIC6_24HELP1) #ifdef TOPIC6_24HELP2 HELPTEXT(TOPIC6_24HELP2) #endif #ifdef TOPIC6_24HELP3 HELPTEXT(TOPIC6_24HELP3) #endif #ifdef TOPIC6_24HELP4 HELPTEXT(TOPIC6_24HELP4) #endif #ifdef TOPIC6_24HELP5 HELPTEXT(TOPIC6_24HELP5) #endif #ifdef TOPIC6_24HELP6 HELPTEXT(TOPIC6_24HELP6) #endif defb 0 ;end marker #endif /* TOPIC6_24HELP1 - overall */ z88dk-1.8.ds1/include/oz/help7.h0000644000175000017500000002655107130401715015756 0ustar tygrystygrys/* * Help File for Commands in Topic 7 * * Don't include yourself!!! */ #ifdef TOPIC7_1HELP1 .in_com_hlp7_1 defb $7F HELPTEXT(TOPIC7_1HELP1) #ifdef TOPIC7_1HELP2 HELPTEXT(TOPIC7_1HELP2) #endif #ifdef TOPIC7_1HELP3 HELPTEXT(TOPIC7_1HELP3) #endif #ifdef TOPIC7_1HELP4 HELPTEXT(TOPIC7_1HELP4) #endif #ifdef TOPIC7_1HELP5 HELPTEXT(TOPIC7_1HELP5) #endif #ifdef TOPIC7_1HELP6 HELPTEXT(TOPIC7_1HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_1HELP1 - overall */ #ifdef TOPIC7_2HELP1 .in_com_hlp7_2 defb $7F HELPTEXT(TOPIC7_2HELP1) #ifdef TOPIC7_2HELP2 HELPTEXT(TOPIC7_2HELP2) #endif #ifdef TOPIC7_2HELP3 HELPTEXT(TOPIC7_2HELP3) #endif #ifdef TOPIC7_2HELP4 HELPTEXT(TOPIC7_2HELP4) #endif #ifdef TOPIC7_2HELP5 HELPTEXT(TOPIC7_2HELP5) #endif #ifdef TOPIC7_2HELP6 HELPTEXT(TOPIC7_2HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_2HELP1 - overall */ #ifdef TOPIC7_3HELP1 .in_com_hlp7_3 defb $7F HELPTEXT(TOPIC7_3HELP1) #ifdef TOPIC7_3HELP2 HELPTEXT(TOPIC7_3HELP2) #endif #ifdef TOPIC7_3HELP3 HELPTEXT(TOPIC7_3HELP3) #endif #ifdef TOPIC7_3HELP4 HELPTEXT(TOPIC7_3HELP4) #endif #ifdef TOPIC7_3HELP5 HELPTEXT(TOPIC7_3HELP5) #endif #ifdef TOPIC7_3HELP6 HELPTEXT(TOPIC7_3HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_3HELP1 - overall */ #ifdef TOPIC7_4HELP1 .in_com_hlp7_4 defb $7F HELPTEXT(TOPIC7_4HELP1) #ifdef TOPIC7_4HELP2 HELPTEXT(TOPIC7_4HELP2) #endif #ifdef TOPIC7_4HELP3 HELPTEXT(TOPIC7_4HELP3) #endif #ifdef TOPIC7_4HELP4 HELPTEXT(TOPIC7_4HELP4) #endif #ifdef TOPIC7_4HELP5 HELPTEXT(TOPIC7_4HELP5) #endif #ifdef TOPIC7_4HELP6 HELPTEXT(TOPIC7_4HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_4HELP1 - overall */ #ifdef TOPIC7_5HELP1 .in_com_hlp7_5 defb $7F HELPTEXT(TOPIC7_5HELP1) #ifdef TOPIC7_5HELP2 HELPTEXT(TOPIC7_5HELP2) #endif #ifdef TOPIC7_5HELP3 HELPTEXT(TOPIC7_5HELP3) #endif #ifdef TOPIC7_5HELP4 HELPTEXT(TOPIC7_5HELP4) #endif #ifdef TOPIC7_5HELP5 HELPTEXT(TOPIC7_5HELP5) #endif #ifdef TOPIC7_5HELP6 HELPTEXT(TOPIC7_5HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_5HELP1 - overall */ #ifdef TOPIC7_6HELP1 .in_com_hlp7_6 defb $7F HELPTEXT(TOPIC7_6HELP1) #ifdef TOPIC7_6HELP2 HELPTEXT(TOPIC7_6HELP2) #endif #ifdef TOPIC7_6HELP3 HELPTEXT(TOPIC7_6HELP3) #endif #ifdef TOPIC7_6HELP4 HELPTEXT(TOPIC7_6HELP4) #endif #ifdef TOPIC7_6HELP5 HELPTEXT(TOPIC7_6HELP5) #endif #ifdef TOPIC7_6HELP6 HELPTEXT(TOPIC7_6HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_6HELP1 - overall */ #ifdef TOPIC7_7HELP1 .in_com_hlp7_7 defb $7F HELPTEXT(TOPIC7_7HELP1) #ifdef TOPIC7_7HELP2 HELPTEXT(TOPIC7_7HELP2) #endif #ifdef TOPIC7_7HELP3 HELPTEXT(TOPIC7_7HELP3) #endif #ifdef TOPIC7_7HELP4 HELPTEXT(TOPIC7_7HELP4) #endif #ifdef TOPIC7_7HELP5 HELPTEXT(TOPIC7_7HELP5) #endif #ifdef TOPIC7_7HELP6 HELPTEXT(TOPIC7_7HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_7HELP1 - overall */ #ifdef TOPIC7_8HELP1 .in_com_hlp7_8 defb $7F HELPTEXT(TOPIC7_8HELP1) #ifdef TOPIC7_8HELP2 HELPTEXT(TOPIC7_8HELP2) #endif #ifdef TOPIC7_8HELP3 HELPTEXT(TOPIC7_8HELP3) #endif #ifdef TOPIC7_8HELP4 HELPTEXT(TOPIC7_8HELP4) #endif #ifdef TOPIC7_8HELP5 HELPTEXT(TOPIC7_8HELP5) #endif #ifdef TOPIC7_8HELP6 HELPTEXT(TOPIC7_8HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_8HELP1 - overall */ #ifdef TOPIC7_9HELP1 .in_com_hlp7_9 defb $7F HELPTEXT(TOPIC7_9HELP1) #ifdef TOPIC7_9HELP2 HELPTEXT(TOPIC7_9HELP2) #endif #ifdef TOPIC7_9HELP3 HELPTEXT(TOPIC7_9HELP3) #endif #ifdef TOPIC7_9HELP4 HELPTEXT(TOPIC7_9HELP4) #endif #ifdef TOPIC7_9HELP5 HELPTEXT(TOPIC7_9HELP5) #endif #ifdef TOPIC7_9HELP6 HELPTEXT(TOPIC7_9HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_9HELP1 - overall */ #ifdef TOPIC7_10HELP1 .in_com_hlp7_10 defb $7F HELPTEXT(TOPIC7_10HELP1) #ifdef TOPIC7_10HELP2 HELPTEXT(TOPIC7_10HELP2) #endif #ifdef TOPIC7_10HELP3 HELPTEXT(TOPIC7_10HELP3) #endif #ifdef TOPIC7_10HELP4 HELPTEXT(TOPIC7_10HELP4) #endif #ifdef TOPIC7_10HELP5 HELPTEXT(TOPIC7_10HELP5) #endif #ifdef TOPIC7_10HELP6 HELPTEXT(TOPIC7_10HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_10HELP1 - overall */ #ifdef TOPIC7_11HELP1 .in_com_hlp7_11 defb $7F HELPTEXT(TOPIC7_11HELP1) #ifdef TOPIC7_11HELP2 HELPTEXT(TOPIC7_11HELP2) #endif #ifdef TOPIC7_11HELP3 HELPTEXT(TOPIC7_11HELP3) #endif #ifdef TOPIC7_11HELP4 HELPTEXT(TOPIC7_11HELP4) #endif #ifdef TOPIC7_11HELP5 HELPTEXT(TOPIC7_11HELP5) #endif #ifdef TOPIC7_11HELP6 HELPTEXT(TOPIC7_11HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_11HELP1 - overall */ #ifdef TOPIC7_12HELP1 .in_com_hlp7_12 defb $7F HELPTEXT(TOPIC7_12HELP1) #ifdef TOPIC7_12HELP2 HELPTEXT(TOPIC7_12HELP2) #endif #ifdef TOPIC7_12HELP3 HELPTEXT(TOPIC7_12HELP3) #endif #ifdef TOPIC7_12HELP4 HELPTEXT(TOPIC7_12HELP4) #endif #ifdef TOPIC7_12HELP5 HELPTEXT(TOPIC7_12HELP5) #endif #ifdef TOPIC7_12HELP6 HELPTEXT(TOPIC7_12HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_12HELP1 - overall */ #ifdef TOPIC7_13HELP1 .in_com_hlp7_13 defb $7F HELPTEXT(TOPIC7_13HELP1) #ifdef TOPIC7_13HELP2 HELPTEXT(TOPIC7_13HELP2) #endif #ifdef TOPIC7_13HELP3 HELPTEXT(TOPIC7_13HELP3) #endif #ifdef TOPIC7_13HELP4 HELPTEXT(TOPIC7_13HELP4) #endif #ifdef TOPIC7_13HELP5 HELPTEXT(TOPIC7_13HELP5) #endif #ifdef TOPIC7_13HELP6 HELPTEXT(TOPIC7_13HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_13HELP1 - overall */ #ifdef TOPIC7_14HELP1 .in_com_hlp7_14 defb $7F HELPTEXT(TOPIC7_14HELP1) #ifdef TOPIC7_14HELP2 HELPTEXT(TOPIC7_14HELP2) #endif #ifdef TOPIC7_14HELP3 HELPTEXT(TOPIC7_14HELP3) #endif #ifdef TOPIC7_14HELP4 HELPTEXT(TOPIC7_14HELP4) #endif #ifdef TOPIC7_14HELP5 HELPTEXT(TOPIC7_14HELP5) #endif #ifdef TOPIC7_14HELP6 HELPTEXT(TOPIC7_14HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_14HELP1 - overall */ #ifdef TOPIC7_15HELP1 .in_com_hlp7_15 defb $7F HELPTEXT(TOPIC7_15HELP1) #ifdef TOPIC7_15HELP2 HELPTEXT(TOPIC7_15HELP2) #endif #ifdef TOPIC7_15HELP3 HELPTEXT(TOPIC7_15HELP3) #endif #ifdef TOPIC7_15HELP4 HELPTEXT(TOPIC7_15HELP4) #endif #ifdef TOPIC7_15HELP5 HELPTEXT(TOPIC7_15HELP5) #endif #ifdef TOPIC7_15HELP6 HELPTEXT(TOPIC7_15HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_15HELP1 - overall */ #ifdef TOPIC7_16HELP1 .in_com_hlp7_16 defb $7F HELPTEXT(TOPIC7_16HELP1) #ifdef TOPIC7_16HELP2 HELPTEXT(TOPIC7_16HELP2) #endif #ifdef TOPIC7_16HELP3 HELPTEXT(TOPIC7_16HELP3) #endif #ifdef TOPIC7_16HELP4 HELPTEXT(TOPIC7_16HELP4) #endif #ifdef TOPIC7_16HELP5 HELPTEXT(TOPIC7_16HELP5) #endif #ifdef TOPIC7_16HELP6 HELPTEXT(TOPIC7_16HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_16HELP1 - overall */ #ifdef TOPIC7_17HELP1 .in_com_hlp7_17 defb $7F HELPTEXT(TOPIC7_17HELP1) #ifdef TOPIC7_17HELP2 HELPTEXT(TOPIC7_17HELP2) #endif #ifdef TOPIC7_17HELP3 HELPTEXT(TOPIC7_17HELP3) #endif #ifdef TOPIC7_17HELP4 HELPTEXT(TOPIC7_17HELP4) #endif #ifdef TOPIC7_17HELP5 HELPTEXT(TOPIC7_17HELP5) #endif #ifdef TOPIC7_17HELP6 HELPTEXT(TOPIC7_17HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_17HELP1 - overall */ #ifdef TOPIC7_18HELP1 .in_com_hlp7_18 defb $7F HELPTEXT(TOPIC7_18HELP1) #ifdef TOPIC7_18HELP2 HELPTEXT(TOPIC7_18HELP2) #endif #ifdef TOPIC7_18HELP3 HELPTEXT(TOPIC7_18HELP3) #endif #ifdef TOPIC7_18HELP4 HELPTEXT(TOPIC7_18HELP4) #endif #ifdef TOPIC7_18HELP5 HELPTEXT(TOPIC7_18HELP5) #endif #ifdef TOPIC7_18HELP6 HELPTEXT(TOPIC7_18HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_18HELP1 - overall */ #ifdef TOPIC7_19HELP1 .in_com_hlp7_19 defb $7F HELPTEXT(TOPIC7_19HELP1) #ifdef TOPIC7_19HELP2 HELPTEXT(TOPIC7_19HELP2) #endif #ifdef TOPIC7_19HELP3 HELPTEXT(TOPIC7_19HELP3) #endif #ifdef TOPIC7_19HELP4 HELPTEXT(TOPIC7_19HELP4) #endif #ifdef TOPIC7_19HELP5 HELPTEXT(TOPIC7_19HELP5) #endif #ifdef TOPIC7_19HELP6 HELPTEXT(TOPIC7_19HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_19HELP1 - overall */ #ifdef TOPIC7_20HELP1 .in_com_hlp7_20 defb $7F HELPTEXT(TOPIC7_20HELP1) #ifdef TOPIC7_20HELP2 HELPTEXT(TOPIC7_20HELP2) #endif #ifdef TOPIC7_20HELP3 HELPTEXT(TOPIC7_20HELP3) #endif #ifdef TOPIC7_20HELP4 HELPTEXT(TOPIC7_20HELP4) #endif #ifdef TOPIC7_20HELP5 HELPTEXT(TOPIC7_20HELP5) #endif #ifdef TOPIC7_20HELP6 HELPTEXT(TOPIC7_20HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_20HELP1 - overall */ #ifdef TOPIC7_21HELP1 .in_com_hlp7_21 defb $7F HELPTEXT(TOPIC7_21HELP1) #ifdef TOPIC7_21HELP2 HELPTEXT(TOPIC7_21HELP2) #endif #ifdef TOPIC7_21HELP3 HELPTEXT(TOPIC7_21HELP3) #endif #ifdef TOPIC7_21HELP4 HELPTEXT(TOPIC7_21HELP4) #endif #ifdef TOPIC7_21HELP5 HELPTEXT(TOPIC7_21HELP5) #endif #ifdef TOPIC7_21HELP6 HELPTEXT(TOPIC7_21HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_21HELP1 - overall */ #ifdef TOPIC7_22HELP1 .in_com_hlp7_22 defb $7F HELPTEXT(TOPIC7_22HELP1) #ifdef TOPIC7_22HELP2 HELPTEXT(TOPIC7_22HELP2) #endif #ifdef TOPIC7_22HELP3 HELPTEXT(TOPIC7_22HELP3) #endif #ifdef TOPIC7_22HELP4 HELPTEXT(TOPIC7_22HELP4) #endif #ifdef TOPIC7_22HELP5 HELPTEXT(TOPIC7_22HELP5) #endif #ifdef TOPIC7_22HELP6 HELPTEXT(TOPIC7_22HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_22HELP1 - overall */ #ifdef TOPIC7_23HELP1 .in_com_hlp7_23 defb $7F HELPTEXT(TOPIC7_23HELP1) #ifdef TOPIC7_23HELP2 HELPTEXT(TOPIC7_23HELP2) #endif #ifdef TOPIC7_23HELP3 HELPTEXT(TOPIC7_23HELP3) #endif #ifdef TOPIC7_23HELP4 HELPTEXT(TOPIC7_23HELP4) #endif #ifdef TOPIC7_23HELP5 HELPTEXT(TOPIC7_23HELP5) #endif #ifdef TOPIC7_23HELP6 HELPTEXT(TOPIC7_23HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_23HELP1 - overall */ #ifdef TOPIC7_24HELP1 .in_com_hlp7_24 defb $7F HELPTEXT(TOPIC7_24HELP1) #ifdef TOPIC7_24HELP2 HELPTEXT(TOPIC7_24HELP2) #endif #ifdef TOPIC7_24HELP3 HELPTEXT(TOPIC7_24HELP3) #endif #ifdef TOPIC7_24HELP4 HELPTEXT(TOPIC7_24HELP4) #endif #ifdef TOPIC7_24HELP5 HELPTEXT(TOPIC7_24HELP5) #endif #ifdef TOPIC7_24HELP6 HELPTEXT(TOPIC7_24HELP6) #endif defb 0 ;end marker #endif /* TOPIC7_24HELP1 - overall */ z88dk-1.8.ds1/include/oz.h0000755000175000017500000000125707747723147014762 0ustar tygrystygrys#ifndef __OZ_H__ #define __OZ_H__ /* Control file for include OZ7xx stuff */ /* $Id: oz.h,v 1.7 2003/10/29 11:37:11 stefano Exp $ */ //#include #include #include #include #include #include #include #include //#include /* functions renamed to have a double mode use the -DOZDK parameter to activate this */ #ifdef OZDK #pragma set OZDK #define ozgetch ozgetch2 #define ozkeyhit ozkeyhit2 #else #define ozgetch fgetc_cons #define ozkeyhit getk #endif #define getch ozgetch #include #include #endif z88dk-1.8.ds1/include/oz700/0000755000175000017500000000000010765202715015013 5ustar tygrystygrysz88dk-1.8.ds1/include/oz700/ozfont.h0000644000175000017500000000217207745730251016512 0ustar tygrystygrys/* HTC Compatibility Library and OZ extras Fonts $Id: ozfont.h,v 1.4 2003/10/23 10:42:49 stefano Exp $ */ #ifndef _OZFONT_H #define _OZFONT_H #ifndef _OZ_BYTE typedef unsigned char byte; #define _OZ_BYTE #endif /* 12 bytes long */ struct ozfontheader { unsigned checksum; unsigned magic; /* 0x466F */ unsigned length; /* including length of header */ byte first; byte last; byte bitmap_height; byte line_height; /* recommended */ byte maxwidth; byte active; }; struct ozfonttableentry { byte width; unsigned offset; }; extern byte *ozfontpointers[]; extern byte ozcustomactivefont; extern byte _LIB_ ozscancustomfonts(void); extern void _LIB_ ozsetfontpointer(byte *font); extern void _LIB_ ozclearcustomfontslot(byte slot); extern void _LIB_ ozwritecustomfontbyte(byte slot,unsigned offset,byte value); extern void _LIB_ ozwritecustomfontmem(byte slot,byte *fontdata); #define MASK_CUSTOM0 1 #define MASK_CUSTOM1 2 #define FONT_CUSTOM0 4 #define FONT_CUSTOM1 5 #define FONT_TEMPORARY 6 #define MAX_CUSTOM_SLOT_SIZE 0x0D80 #endif z88dk-1.8.ds1/include/oz700/ozgfx.h0000644000175000017500000001153207747247130016331 0ustar tygrystygrys/* HTC Compatibility Library and OZ extras 1. GRAPHICS AND DISPLAY $Id: ozgfx.h,v 1.7 2003/10/27 16:56:56 stefano Exp $ */ #include #ifndef _OZGFX_H #define _OZGFX_H #ifndef OZ7XX #define OZ7XX #ifdef putchar # undef putchar int putchar(char c); #endif #endif #ifndef _OZ_BYTE typedef unsigned char byte; #define _OZ_BYTE #endif //#ifndef NULL //#define NULL ((void*)0) //#endif #define GREYSHADE_WHITE 0 #define GREYSHADE_BLACK 3 #define GREYSHADE_GREY1 1 #define GREYSHADE_GREY2 2 #define WHITE 0 #define BLACK 1 #define XOR 2 #define FILL 4 #define UNFILL 0 #define FONT_PC_NORMAL 1 #define FONT_PC_LARGE 0 #define FONT_OZ_NORMAL 3 #define FONT_OZ_LARGE 2 extern __LIB__ ozsetactivepage(byte page); extern __LIB__ ozsetdisplaypage(byte page); extern byte __LIB__ ozgetactivepage(void); extern byte __LIB__ ozgetdisplaypage(void); extern __LIB__ ozdisplayactivepage(void); extern __LIB__ ozactivatedisplaypage(void); extern __LIB__ ozcopypage(byte dest, byte src); #define ozswapactivedisplaypages ozswapactivedisplay extern __LIB__ ozswapactivedisplay(void); #define MAX_DISPLAYPAGES 2 //extern __LIB__ ozcls(void); #define ozcls clg #define _ozpoint ozpoint //extern int __LIB__ _ozpoint(byte x, byte y, byte color); extern int __LIB__ ozpoint(int x, int y, byte color); /*int ozpoint(int x, int y, byte color) { if (x>239 || y>80) return -1; if (color = BLACK) plot (x,y); if (color = WHITE) unplot (x,y); } */ extern __LIB__ ozcircle(int x,int y,byte r,byte color); /* void ozcircle(int x,int y,byte r,byte color) { if (color = BLACK) circle (x,y,r,1); if (color = WHITE) uncircle (x,y,r,1); } */ #define _ozline ozline extern __LIB__ ozline(int x,int y,int x2,int y2,byte color); //extern __LIB__ _ozline(byte x,byte y,byte x2,byte y2,byte color); /* void ozline(int x,int y,int x2,int y2,byte color) { if (color = BLACK) draw (x,y,x2,y2); if (color = WHITE) undraw (x,y,x2,y2); } */ #define _ozhline ozhline extern __LIB__ ozhline(byte x,byte y,byte len,byte color); /* void _ozhline(byte x,byte y,byte len,byte color) { if (color = BLACK) draw (x,y,x,y+len); if (color = WHITE) undraw (x,y,x,y+len); } */ #define _ozvline ozvline extern __LIB__ ozvline(byte x,byte y,byte len,byte color); /* void _ozvline(byte x,byte y,byte len,byte color) { if (color = BLACK) draw (x,y,x+len,y); if (color = WHITE) undraw (x,y,x+len,y); } */ extern __LIB__ ozdisplayorbyte(unsigned offset, byte v); extern __LIB__ ozdisplayputbyte(unsigned offset, byte v); extern __LIB__ ozdisplayandbyte(unsigned offset, byte v); extern __LIB__ ozdisplayinbyte(unsigned offset); //#define ozgetpoint point //extern int __LIB__ ozgetpoint(int x, int y); int ozgetpoint(int x, int y) { return (!point (x,y)); } #define _ozbox ozbox extern __LIB__ ozbox(byte x, byte y, byte width, byte height); //extern __LIB__ ozbox(int x, int y, int width, int height); /* void ozbox(int x, int y, int width, int height) { drawb (x,y,width,height); } */ /* extern __LIB__ ozsetgreyscale(byte grey); extern byte __LIB__ ozgetgreyscale(void); extern __LIB__ ozgreyfilledcircle(int x,int y,byte r,byte shade); extern __LIB__ ozgreycircle(int x,int y,byte r,byte shade); extern __LIB__ ozgreyline(int x1,int y1,int x2,int y2,byte shade); extern int __LIB__ ozgreypoint(int x1,int y1,byte shade); extern byte __LIB__ ozgetfontheight(byte f); extern int __LIB__ ozgreyputs(int x,int y,byte shade,char *s); extern __LIB__ ozgreycls(void); extern __LIB__ ozgreyfilledbox(int x,int y,int w,int h,byte shade); extern __LIB__ ozgreybox(int x,int y,int w,int h,byte shade); extern int __LIB__ ozgreygetpoint(int x, int y); extern int __LIB__ ozgreyeditline(byte x0,byte y0,char *s,byte slen,byte xlen,byte shade); extern int __LIB__ ozgreyputch(int x,int y,byte shade,char c); */ #define _ozfilledbox ozfilledbox extern __LIB__ ozfilledbox(int x,int y,int w,int h,byte color); //extern __LIB__ _ozfilledbox(byte x,byte y,byte w,byte h,byte color); extern __LIB__ ozscroll(unsigned numbytes); extern __LIB__ ozscrolldown(unsigned numbytes); extern __LIB__ ozscrollclear(void); extern __LIB__ ozsavescreen(void); extern __LIB__ ozrestorescreen(void); //extern __LIB__ _ozputsprite(byte x,byte y,byte height,byte *sprite); #define _ozputsprite ozputsprite extern __LIB__ ozputsprite(byte x,byte y,byte height,byte *sprite); extern char __LIB__ *ozputsgetend(void); extern int __LIB__ ozputs_system(int x, int y, char *string); extern int __LIB__ ozputs(int x, int y, char *string); // extern __LIB__ ozfont(byte fontnum); #define ozfont ozsetfont extern __LIB__ ozgetfont(); extern __LIB__ ozsetfont(byte fontnum); extern int __LIB__ ozputch(int x, int y, char c); extern __LIB__ ozscrollright(byte y , byte rows); extern __LIB__ ozscrollleft(byte y , byte rows); #endif z88dk-1.8.ds1/include/oz700/ozinput.h0000644000175000017500000000664207747247130016712 0ustar tygrystygrys/* HTC Compatibility Library and OZ extras 2. KEYBOARD AND INPUT $Id: ozinput.h,v 1.5 2003/10/27 16:56:56 stefano Exp $ */ #ifndef _OZINPUT_H #define _OZINPUT_H #ifndef _OZ_BYTE typedef unsigned char byte; #define _OZ_BYTE #endif /* functions renamed to have a double mode use the -DOZDK parameter to activate this */ #ifdef OZDK extern int __LIB__ oznkeyhit2(void); extern int __LIB__ ozkeyhit2(void); extern unsigned __APPFUNC__ __LIB__ ozgetch2(void); extern unsigned __LIB__ ozngetch2(void); extern unsigned __LIB__ ngetch2(void); extern __LIB__ ozungetch2(unsigned key); #endif extern __LIB__ ozrestorekeysettings(void); extern __LIB__ ozsavekeysettings(void); #define SETTINGS_LENGTH 14 extern __LIB__ ozcopyfromcursettings(byte *p); extern __LIB__ ozcopytocursettings(byte *p); #define OZEDITLINE_ERROR -2 #define OZEDITLINE_CANCEL -1 //extern int __LIB__ ozeditline(byte x0,byte y0,char *s,byte slen,byte xlen); extern int __LIB__ ozeditline(byte x0,byte y0,char *s,byte slen,byte xlen); extern __LIB__ ozkbdon(void); extern __LIB__ ozkbdoff(void); extern __LIB__ ozkeyclear(void); extern byte __LIB__ ozkeyupper(byte mask); extern byte __LIB__ ozkeylower(byte mask); //extern unsigned __LIB__ getch(void); //extern int __LIB__ kbhit(void); //extern int __LIB__ nkbhit(void); extern byte __LIB__ ozgetrepeatspeed(void); extern byte __LIB__ ozgetrepeatdelay(void); extern __LIB__ ozsetrepeatspeed(byte val); extern __LIB__ ozsetrepeatdelay(byte val); extern __LIB__ ozclick(byte state); extern byte __LIB__ ozgetclick(void); extern byte _ozkeyrepeatspeed; extern byte _ozkeyrepeatdelay; #ifndef _OZMENU_H #define _OZMENU_H struct ozmenuentry { unsigned key; char *label; }; extern int __LIB__ ozmenu(int x,int y,char *title,unsigned start,unsigned num_entries, struct ozmenuentry *menu, byte options); #define OZMENU_NUMBERED 1 #define OZMENU_NOEXIT 2 #define OZMENU_NOLIGHT 4 #endif /* for ozgetch() */ #define KEY_LEFT_SHIFT 0x0800 #define KEY_RIGHT_SHIFT 0x8036 #define KEY_2ND 0x8037 #define KEY_LOWER_ESC 0x8058 #define KEY_UPPER_ESC 0x8067 #define KEY_NEWLINE 0x0D #define KEY_RETURN 0x0D #define KEY_MYPROGRAMS 0x7015 #define KEY_MAIN 0x7025 #define KEY_USER1 0x70E9 #define KEY_USER2 0x70EA #define KEY_USER3 0x70EB #define KEY_TELEPHONE KEY_USER1 #define KEY_SCHEDULE KEY_USER2 #define KEY_CALENDAR KEY_USER2 #define KEY_MEMO KEY_USER3 #define KEY_LOWER_MENU 0x8032 #define KEY_NEW 0x8033 #define KEY_BACKSPACE 0x0008 #define KEY_BACKSPACE_16K 0x8057 #define KEY_CATEGORY 0x8035 #define KEY_LOWER_ENTER 0x8038 #define KEY_POWER 0x803A #define KEY_BACKLIGHT 0x803B #define KEY_DOWN 0x8041 #define KEY_UP 0x8040 #define KEY_LEFT 0x8042 #define KEY_RIGHT 0x8043 #define KEY_PAGEUP 0x8044 #define KEY_PAGEDOWN 0x8045 #define KEY_DEL 0x8057 #define KEY_UPPER_ENTER 0x8066 #define KEY_UPPER_MENU 0x8068 /* for getch() */ #define NO_KEY 0xFFFF #define MASKSHIFT 0x0800 #define MASKCATEGORY 0x0400 #define MASKCTRL 0x0200 #define MASK2ND 0x0100 #ifndef NULL #define NULL ((void*)0) #endif extern unsigned __LIB__ ozautoofftime; extern unsigned __LIB__ ozautoblanktime; extern unsigned __LIB__ ozautolightofftime; extern unsigned __LIB__ ozgetchblank(void); #endif z88dk-1.8.ds1/include/oz700/ozint.h0000755000175000017500000000107407745264647016354 0ustar tygrystygrys/* HTC Compatibility Library and OZ extras 5. INTERRUPT HANDLING $Id: ozint.h,v 1.1 2003/10/21 17:15:19 stefano Exp $ */ extern __LIB__ _ozcustomisr(void); extern int __LIB__ ozsetisr(void *f); /* set custom ISR with paging */ extern int __LIB__ _ozsetisr(void *f); /* same, but no paging--routine must always be paged in */ extern __LIB__ ozisroff(void); /* turn off custom ISR (set im 1) */ extern __LIB__ ozdisableinterrupts(void); extern __LIB__ ozenableinterrupts(void); extern __LIB__ ozintwait(void); z88dk-1.8.ds1/include/oz700/ozmisc.h0000755000175000017500000000500507747247130016501 0ustar tygrystygrys/* HTC Compatibility Library and OZ extras $Id: ozmisc.h,v 1.3 2003/10/27 16:56:56 stefano Exp $ */ #ifndef _OZMISC_H #define _OZMISC_H #ifndef _OZ_BYTE typedef unsigned char byte; #define _OZ_BYTE #endif #define ozis770() (MODEL770PC==ozdetectmodel()) //void ozsetautorun(byte number); byte ozgetautorun(void); byte ozgetmembyte(unsigned page, unsigned offset); extern __LIB__ ozfarmemcpy(unsigned dest_page,unsigned dest_offset,unsigned src_page, unsigned src_offset,unsigned length); extern __LIB__ ozcopytopage(unsigned dest_page,unsigned dest_offset,byte *src,unsigned length); extern __LIB__ ozexitto(unsigned key); extern __LIB__ ozfast(void); //void ozslow(void); #define ozslow ozunblankscreen extern __LIB__ ozkeyclick(void); extern __LIB__ ozdelay(unsigned d); //void exit(int ignored_exit_code); extern byte __LIB__ ozportin(byte port); extern __LIB__ ozportout(byte port, byte value); extern __LIB__ ozsound(unsigned value); extern __LIB__ ozquiet(void); extern __LIB__ ozinitsound(void); extern unsigned _oz1hz; extern unsigned _oz64hz_word; extern unsigned long _oz64hz_dword; byte __LIB__ ozdetectmodel(void); #define MODELMASK_MEMORY 1 #define MODELMASK_770 2 #define MODELMASK_M 4 #define MODEL700PC 0 #define MODEL730PC 0 #define MODEL750PC MODELMASK_MEMORY #define MODEL770PC (MODELMASK_MEMORY | MODELMASK_770) #define MODEL700M MODELMASK_M #define MODEL750M (MODELMASK_MEMORY | MODELMASK_M) #define MODEL770M (MODELMASK_MEMORY | MODELMASK_770 | MODEMASK_M) /* 770M NOT YET EXISTENT OR DETECTED, BUT IF IT IS */ /* MADE, THAT WILL BE ITS MODEL NUMBER */ char __LIB__ *ozgetnextfilename(byte mode); #define FIND_RESET 1 #define FIND_OWNED 2 byte __LIB__ ozgetpowerkeyhandling(void); extern __LIB__ ozsetpowerkeyhandling(byte state); extern unsigned __LIB__ ozkeydelay64hz(unsigned len); extern __LIB__ ozdelay64hz(unsigned length); extern __LIB__ oz64hztimeron(void); extern __LIB__ oz64hztimeroff(void); extern byte __LIB__ ozget64hztimerstate(void); extern __LIB__ ozinstallmemorywiper(void); extern byte __LIB__ _ozprogoptions; extern byte __LIB__ _ozclick_setting; #define OZ_OPTION_SCROLL_FULL 1 #define OZ_OPTION_NO_SOUND 2 #define OZ_OPTION_KEY_AFTER_BLANK 4 extern byte __LIB__ ozgetstatus(void); #define OZ_STATUS_CAPSLOCK 2 #define OZ_STATUS_LOCKED 16 #define OZ_STATUS_BACKLIGHT 64 #define OZ_STATUS_BATTERYLOW 128 //#ifndef NULL //#define NULL ((void*)0) //#endif #endifz88dk-1.8.ds1/include/oz700/ozscreen.h0000644000175000017500000000074107745264647017036 0ustar tygrystygrys/* HTC Compatibility Library and OZ extras 3. BACKLIGHT AND SCREEN CONTROL $Id: ozscreen.h,v 1.2 2003/10/21 17:15:19 stefano Exp $ */ #ifndef _OZSCREEN_H #define _OZSCREEN_H extern __LIB__ oztogglelight(void); extern __LIB__ ozsetlight(int l); //int ozgetlight(void); extern __LIB__ ozblankscreen(void); extern __LIB__ ozunblankscreen(void); extern __LIB__ ozsetcontrast(int c); extern int __LIB__ ozgetcontrast(void); #define MAX_CONTRAST 0x3F #endif z88dk-1.8.ds1/include/oz700/ozserial.h0000755000175000017500000000325607745264647017045 0ustar tygrystygrys/* HTC Compatibility Library and OZ extras 6. SERIAL PORT I/O $Id: ozserial.h,v 1.1 2003/10/21 17:15:19 stefano Exp $ */ #include #ifndef _OZSERIAL_H #define _OZSERIAL_H #ifndef _OZ_BYTE typedef unsigned char byte; #define _OZ_BYTE #endif extern __LIB__ ozsnap(void); extern byte __LIB__ ozgetrxhandshaking(void); extern __LIB__ ozsetrxhandshaking(byte state); extern __LIB__ ozclearserialbuffer(void); extern __LIB__ ozdatabits(byte databits); extern int __LIB__ ozserialgetc(void); extern __LIB__ ozsetbaud(unsigned baud); extern unsigned __LIB__ ozgetbaud(void); extern __LIB__ ozstopbits(char stopbits); extern __LIB__ ozparity(byte parity); extern byte __LIB__ ozgetlcr(void); extern __LIB__ ozsetlcr(byte lcr); extern int __LIB__ ozserialin(void); extern __LIB__ ozserialout(char c); extern __LIB__ ozserinton(void); //extern __LIB__ _ozserinton(void); extern __LIB__ ozserintoff(void); //extern __LIB__ _ozserintoff(void); /* for ozparity() */ #define NO_PARITY 0 #define ODD_PARITY 0x08 #define EVEN_PARITY 0x18 #define HIGH_PARITY 0x28 #define LOW_PARITY 0x38 /* for ozstopbits() */ #define ONE_STOP_BIT 0 #define TWO_STOP_BITS 4 #define ONE_POINT_FIVE_STOP_BITS 4 /* for ozbaud() */ #define BAUD76800 2 #define BAUD51200 3 #define BAUD38400 4 #define BAUD30720 5 #define BAUD25600 6 #define BAUD19200 8 #define BAUD9600 16 #define BAUD4800 32 #define BAUD2400 64 #define BAUD1200 128 #define BAUD600 256 #define BAUD300 512 #define BAUD150 1024 /* for ozdatabits() */ #define DATABITS5 0 #define DATABITS6 1 #define DATABITS7 2 #define DATABITS8 3 /* for ozxxxlcr() */ #define BREAKSTATE 0x40 #endif z88dk-1.8.ds1/include/oz700/oztime.h0000644000175000017500000000106507745264647016515 0ustar tygrystygrys/* HTC Compatibility Library and OZ extras 4. TIME $Id: oztime.h,v 1.2 2003/10/21 17:15:19 stefano Exp $ */ #ifndef _OZTIME_H #define _OZTIME_H #ifndef _OZ_BYTE typedef unsigned char byte; #define _OZ_BYTE #endif extern unsigned __LIB__ ozsec(void); extern unsigned __LIB__ ozmin(void); extern unsigned __LIB__ ozhour(void); extern unsigned __LIB__ ozweekday(void); extern unsigned __LIB__ ozmonth(void); extern unsigned __LIB__ ozday(void); extern unsigned __LIB__ ozyear(void); extern unsigned long __LIB__ oztime(void); #endif z88dk-1.8.ds1/include/oz700/scaldate.h0000755000175000017500000000527107745264647016774 0ustar tygrystygrys/* HTC Compatibility Library and OZ extras * +++Date last modified: 05-Jul-1997 * ** scalar date routines -- public domain by Ray Gardner ** Numerically, these will work over the range 1/01/01 thru 14699/12/31. ** Practically, these only work from the beginning of the Gregorian ** calendar thru 14699/12/31. The Gregorian calendar took effect in ** much of Europe in about 1582, some parts of Germany in about 1700, in ** England and the colonies in about 1752ff, and in Russia in 1918. Ported to Z88DK by Stefano Bodrato - Oct. 2003 $Id: scaldate.h,v 1.1 2003/10/21 17:15:19 stefano Exp $ */ #ifndef SCALDATE__H #define SCALDATE__H typedef enum {Error_ = -1, Success_, False_ = 0, True_} Boolean_T; /* ** Define ISO_CAL to be 1 for ISO (Mon-Sun) calendars ** ** ISO defines the first week with 4 or more days in it to be week #1. */ #ifndef ISO_CAL #define ISO_CAL 0 #endif #if (ISO_CAL != 0 && ISO_CAL != 1) #error ISO_CAL must be set to either 0 or 1 #endif #if ISO_CAL enum DOW_T {DOW_IGNORE = -1, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY}; #else enum DOW_T {DOW_IGNORE = -1, SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY}; #endif /* ** Daylight savings time rules. ** ** Rules include a month, date, and day. If the day is DOW_IGNORE, DST will ** start on the month and date specified. If a day is specified (the ** interpretation of the day parameter is subject to the value of ISO_CAL), ** DST will start on the first such day following (or equal to) the specified ** date, or stop on the first such day preceding (or equal to) the specified ** date. ** ** The defaults defined for the U.S. mean that DST will begin on the first ** Sunday after (or on) April 1 and end on the last Sunday preceding (or on) ** October 31. */ extern unsigned DST_start_mo; extern unsigned DST_start_dt; extern enum DOW_T DST_start_dy; extern unsigned DST_stop_mo; extern unsigned DST_stop_dt; extern enum DOW_T DST_stop_dy; int isleap (unsigned yr); long ymd_to_scalar (unsigned yr, unsigned mo, unsigned day); void scalar_to_ymd (long scalar, unsigned *yr, unsigned *mo, unsigned *day); int daynum(int year, int month, int day); int weeknum(int year, int month, int day); Boolean_T valiDate(unsigned yr, unsigned mo, unsigned day); unsigned dow(unsigned yr, unsigned mo, unsigned day); unsigned DOW(unsigned y, unsigned m, unsigned d); long today(void); extern char *MoonPhaseText[8]; unsigned moonphase(unsigned yr, unsigned mo, unsigned dy); int getfdate (int handle, long *date); int getdatef (char *fname, long *date); #endif /* SCALDATE__H */ z88dk-1.8.ds1/include/package.h0000644000175000017500000000203707270057010015673 0ustar tygrystygrys/* * Package.h * * Defns(!) for package DORS * * djm 9/2/2000 * * $Id: package.h,v 1.2 2001/04/20 16:04:24 dom Exp $ */ #ifdef MAKE_PACKAGE typedef struct { int (*fn)(); } package_str; #define PKGNAME_MAC(b) defm b & 0 #pragma asm INCLUDE "#error.def" INCLUDE "#packages.def" ; Some needed routines ; $00xx Package Info .packg_inf ld hl,pkg_name ld a,($4D3) ld b,a ;name of pkg in bhl ld c,$01 ;Version of handling reqd ld de,PACK_VERSION and a ;success ret .pkg_name PKGNAME_MAC(PACK_NAME) .packg_exp #ifdef PACK_BOOT ld a,b ;Check for autoboot cp exp_boot ;Fc=0 if so, we want to autoboot ret z #endif ld a,RC_UNK scf ret ; Other essential routines have to be done by the app itself ; Start the package DOR .in_package_dor defb PACKAGE_ID #ifdef OLDPACK defm "oZ" #else defb 'P' #endif defb MAX_CALL_NUM defw packg_inf ;Get information defw _pack_ayt ;Are You There + Allocate defw _pack_bye ;Bye..and deallocate defw _pack_dat ;Return info abt resources defw packg_exp ;Expansion #pragma endasm #endif z88dk-1.8.ds1/include/rect.h0000644000175000017500000000430310540744601015236 0ustar tygrystygrys#ifndef _RECT_H #define _RECT_H /* * Points, Intervals and Rectangles * 05.2006 aralbrec * */ #include /* * A library of routines that can check for and compute intersections amongst * points, intervals and rectangles. 8-bit and 16-bit coordinates are supported * by two sets of subroutines. In both cases, the coordinate space wraps so * that, for example, an 8-bit interval beginning at coordinate 250 with width * 50 occupies the points [250,255]+[0,43] inclusive (ie 250 right through 43). * */ struct r_Ival8 { uchar coord; // +0 uchar width; // +1 }; struct r_Ival16 { uint coord; // +0 uint width; // +2 }; struct r_Rect8 { uchar x; // +0 struct r_Ival8 uchar width; // +1 uchar y; // +2 struct r_Ival8 uchar height; // +3 }; struct r_Rect16 { uint x; // +0 struct r_Ival16 uint width; // +2 uint y; // +4 struct r_Ival16 uint height; // +6 }; // Detect whether points, intervals and rectangles intersect extern int __LIB__ r_IsPtInIval8(uchar x, struct r_Ival8 *i); extern int __LIB__ r_IsPtInRect8(uchar x, uchar y, struct r_Rect8 *r); extern int __LIB__ r_IsIvalInIval8(struct r_Ival8 *i1, struct r_Ival8 *i2); extern int __LIB__ r_IsRectInRect8(struct r_Rect8 *r1, struct r_Rect8 *r2); extern int __LIB__ r_IsPtInIval16(uint x, struct r_Ival16 *i); extern int __LIB__ r_IsPtInRect16(uint x, uint y, struct r_Rect16 *r); extern int __LIB__ r_IsIvalInIval16(struct r_Ival16 *i1, struct r_Ival16 *i2); extern int __LIB__ r_IsRectInRect16(struct r_Rect16 *r1, struct r_Rect16 *r2); // Return the result of interval and rectangle intersections extern int __LIB__ r_IntersectIval8(struct r_Ival8 *i1, struct r_Ival8 *i2, struct r_Ival8 *result); extern int __LIB__ r_IntersectRect8(struct r_Rect8 *r1, struct r_Rect8 *r2, struct r_Rect8 *result); extern int __LIB__ r_IntersectIval16(struct r_Ival16 *i1, struct r_Ival16 *i2, struct r_Ival16 *result); extern int __LIB__ r_IntersectRect16(struct r_Rect16 *r1, struct r_Rect16 *r2, struct r_Rect16 *result); #endif z88dk-1.8.ds1/include/residos/0000755000175000017500000000000010765202715015604 5ustar tygrystygrysz88dk-1.8.ds1/include/residos/package.h0000644000175000017500000001051310637546265017361 0ustar tygrystygrys/* * Header for defining Residos Packages * * $Id: package.h,v 1.1 2007/06/24 19:57:41 dom Exp $ */ #ifndef __RESIDOS_PACKAGE_H__ #define __RESIDOS_PACKAGE_H__ #ifdef MAKE_PACKAGE #define PACKAGE_ADD(m) static void *package_## m= m #define PACKAGE_END static char package_call_end = 0xff #asm INCLUDE "#zxsysvar48.def" ; INSTALL has no entry parameters, and may corrupt any registers. ; Most packages simply return Fc=1 to indicate success. However, if your ; package needs extra resources (such as additional RAM banks) it may try ; to allocate them here. If it fails, after tidying up it should return ; Fc=0 and A=error code (such as A=brc_resi_noroom). .Cpackage_install #if PACKAGE_INSTALL_FUNC jp PACKAGE_INSTALL_FUNC #else scf ; package always succeeds ret #endif ; BYE has no entry parameters, and may corrupt any registers. ; It should return Fc=1 to indicate it can safely be uninstalled. ; If some internal resources are in use by external programs, it should ; return Fc=0 and A=rc_resi_package_in_use. .Cpackage_bye #if PACKAGE_BYE_FUNC jp PACKAGE_INSTALL_FUNC #else scf ; package always succeeds ret #endif ; INFO takes a reason code in A and returns package information appropriate, ; together with Fc=1 to indicate success. ; Unknown/unsupported reasons must return Fc=0 and A=rc_resi_unknown_reason. ; Reasons supported by this test package are: ; info_version - return version number in BC (binary-coded decimal) ; info_error - store text for error B in the printer buffer (terminate ; with bit 7 set) .Cpackage_info cp info_version jr z,package_getversion #ifdef PACKAGE_ERROR_FUNCTION cp info_error jr nz,package_badreason ld l,b ; error code is in B ld h,0 push hl call PACKAGE_ERROR_FUNC pop bc ; c = error code ld a,h or l jr z, package_badreason ld de,PR_BUFF-1 ; copy the error text to the printer buffer ex de,hl .package_error ld a,(de) and a jr nz,package_error1 set 7,(hl) ; Last character should toggle bit 7 ld a,c ; package code and a ; Fc=0, Fz=0 ret .package_error1 inc hl inc de ld (hl),a jr package_error #endif .package_badreason ld a,rc_resi_unknown_reason ; other reasons unknown and a ret .package_getversion ld bc,PACKAGE_VERSION ; version number scf ; success! ret ; EXP takes a reason code in A and performs appropriate actions. ; Unknown/unsupported reasons must return Fc=0 and A=rc_resi_unknown_reason. .Cpackage_exp ld a,rc_resi_unknown_reason and a ; no reasons are handled ret ; The HOOK, CHANNELS, FS and NMI calls are used only for packages ; which register themselves with the appropriate capabilities. ; Packages not providing one or more of these calls should ; simply return Fc=0 and A=rc_resi_package_not_found. ; HOOK enters with H corrupted, L=hook code value. All other registers ; are as they were when the hook code was invoked, and so can be used ; as input parameters. All standard registers (including HL) and IX ; can be used as output parameters. ; It is probably good practice to use the convention of returning ; Fc=1 for success, or Fc=0 and A=error code. This is not required, though. ; None of them are implemented at the moment .Cpackage_hook .Cpackage_channels .Cpackage_fs .Cpackage_nmi ld a,rc_resi_package_not_found and a ret .package_call_table defw Cpackage_install defw Cpackage_bye defw Cpackage_info defw Cpackage_exp defw Cpackage_hook defw Cpackage_channels defw Cpackage_fs defw Cpackage_nmi ; User code should use PACKAGE_ADD straight after this and end with PACKAGE_END #endasm #endif /* MAKE_PACKAGE */ #endif /* __RESIDOS_PACKAGE_H__ */ z88dk-1.8.ds1/include/rex/0000755000175000017500000000000010765202715014732 5ustar tygrystygrysz88dk-1.8.ds1/include/rex/CalendarDB.h0000644000175000017500000000376307422637455017044 0ustar tygrystygrys/*************************************************************** * CalendarDB.h * Header for Rex addin program. ***************************************************************/ #ifndef CALENDARDB_H #define CALENDARDB_H // Table 2000 enum CAL_SCHED_FIELD { CAL_SCHED_RECID = 1, CAL_SCHED_SCHEDULEID, CAL_SCHED_RPT_TYPE, //see CAL_RPT_TYPE CAL_SCHED_SCHED_REP_TYPE, //see CAL_SCD_RPT_TYPE CAL_SCHED_FREQUENCY, CAL_SCHED_NUMBER_OF_DAYS, CAL_SCHED_RPT_DAY, CAL_SCHED_RPT_MONTH, CAL_SCHED_RPT_DAYOFWEEK, CAL_SCHED_RPT_WEEKOFMONTH, CAL_SCHED_RPT_STARTDATE, CAL_SCHED_RPT_ENDDATE, CAL_SCHED_TIMEZONE, CAL_SCHED_SEARCHTYPE, //see CAL_SRCH_TYPE CAL_SCHED_SEARCHKEY, CAL_SCHED_ALARM, CAL_SCHED_ALARM_UNIT, //see ALARM_UNIT CAL_SCHED_STARTTIME, CAL_SCHED_ENDTIME, CAL_SCHED_TYPE, //see CAL_TYPE CAL_SCHED_EXCLUDE, CAL_SCHED_TITLE, CAL_SCHED_PLACE, CAL_SCHED_NOTE }; enum CAL_RPT_TYPE { CAL_RPT_NOREPEAT = 1, CAL_RPT_DAYLY, CAL_RPT_WEEKLY, CAL_RPT_MONTHLY, CAL_RPT_MONTHLY_BY_POS, CAL_RPT_YEARLY }; enum CAL_SCD_RPT_TYPE { CAL_SRPT_NOREPEAT = 1, CAL_SRPT_REPEAT }; enum CAL_SRCH_TYPE { CAL_SRCH_ALL = 1, CAL_SRCH_SINGLE, CAL_SRCH_YEARLY }; enum CAL_TYPE { CAL_TYPE_SYUKUJITU = 1, CAL_TYPE_KINENBI, CAL_TYPE_EVENT, CAL_TYPE_YOTEI }; enum ALARM_UNIT { CAL_ALM_NONE = 0, CAL_ALM_MINS, CAL_ALM_HOURS, CAL_ALM_DAYS }; enum CAL_SCHED_INX { CAL_SCHED_INX_RECID = 1, CAL_SCHED_INX_SCHEDID, CAL_SCHED_INX_SEARCH }; //Table 2001: see StatusDB.h //Table 2002 enum CAL_ALARM_FIELD { CAL_ALARM_RECID = 1, CAL_ALARM_RPT_TYPE, CAL_ALARM_FREQUENCY, CAL_ALARM_RPT_DAY, CAL_ALARM_RPT_MONTH, CAL_ALARM_RPT_DAYOFWEEK, CAL_ALARM_RPT_WEEKOFMONTH, CAL_ALARM_RPT_STARTDATE, CAL_ALARM_RPT_ENDDATE, CAL_ALARM_SEARCHTYPE, CAL_ALARM_SEARCHKEY, CAL_ALARM_ALARM, CAL_ALARM_ALARM_UNIT, CAL_ALARM_STARTTIME, CAL_ALARM_EXCLUDE }; enum CAL_ALARM_INX { CAL_ALARM_INX_RECID = 1, CAL_ALARM_INX_SEARCH }; #endif z88dk-1.8.ds1/include/rex/Database.h0000644000175000017500000001263207422637455016624 0ustar tygrystygrys/*************************************************************** * Database.h * Header for Rex addin program. * ***************************************************************/ #ifndef __DATABASE__ #define __DATABASE__ /*----- field types -----*/ #define DB_INT8 1 #define DB_INT16 2 #define DB_INT32 3 #define DB_FXDSTR 11 #define DB_FXDDAT 12 #define DB_VARSTR 21 #define DB_VARDAT 22 #define DB_RECID 90 /*----- error codes -----*/ #define DB_ERROR -1 #define DB_ERR_SYS -2 #define DB_ERR_PARM -3 #define DB_STORAGE_FULL -4 #define DB_CACHE_OVERFLOW -5 #define DB_OUT_OF_MEMORY -6 #define DB_REC_BUF_OVERFLOW -7 #define DB_NOT_FOUND -8 #define DB_DUPLICATE_KEYS -9 #define DB_DBID_USED -10 #define DB_NO_MORE_RECORD -11 #define DB_NO_CURRENT_REC -12 #define DB_ERR_SOFFS -13 #define DB_ILLEGAL_OPERATION -14 #define DB_ERR_COMM -15 #define DB_ERR_FILE -16 #define DB_NOT_IMPLEMENTED -17 /*----- max index field size -----*/ #define DB_MAX_SIZE_32 5 #define DB_MAX_SIZE_64 6 #define DB_MAX_SIZE_128 7 #define DB_MAX_SIZE_256 8 #define DB_MAX_SIZE_512 9 /*----- field definition -----*/ typedef struct tDbFieldDef { unsigned char type; /* field type */ unsigned char size; /* field size */ } tDbFieldDef; /*----- index field definition -----*/ typedef struct tDbIndexFieldDef { unsigned char field_no; /* field no. */ unsigned char ordering_type; /* ordering type */ unsigned char max_size; /* maximum size for index */ /*2000.04.13*/ } tDbIndexFieldDef; /*----- index definition -----*/ typedef struct tDbIndexDef { tDbIndexFieldDef *fields; /* array of field def. */ } tDbIndexDef; /* * Database IDs */ #define DBID_UNKNOWN 0 #define DBID_COMMONSEARCHHISTORY 120 #define DBID_SHELLADDIN 150 #define DBID_SETUPINFO 160 #define DBID_DEVICEID 170 #define DBID_ADDRESS 1000 #define DBID_CALENDAR 2000 #define DBID_CALENDAR_STATUS 2001 #define DBID_CALENDAR_ALARM 2002 #define DBID_CALENDAR_TEXT 2004 #define DBID_TASK 3000 #define DBID_TASK_STATUS 3001 #define DBID_TASK_2 3002 //unknown #define DBID_TASK_3 3003 //unknown #define DBID_TASK_TEXTINF 3004 #define DBID_MEMO 4000 #define DBID_MEMO_STATUS 4001 #define DBID_MEMO_CATEGORY 4002 #define DBID_MEMO_CATLINK 4003 #define DBID_MEMO_TEXTINF 4004 #define DBID_MAIL 5000 #define DBID_DICTIONARY 7000 #define DBID_CLOCK 8000 #define DBID_PICTURE 10000 #define DBID_REXPENSE_LIST1 10100 #define DBID_REXPENSE_LIST2 10200 #define DBID_REXPENSE_LIST3 10300 #define DBID_REXPENSE_LIST4 10400 #define DBID_REXPENSE_LIST5 10500 #define DBID_WEB 20000 #define DS_DB_INITIALIZE 0xD0 #define DS_DB_CREATE 0xD2 #define DS_DB_OPEN 0xD4 #define DS_DB_CLOSE 0xD6 #define DS_DB_INSERT_RECORD 0xD8 #define DS_DB_DELETE_RECORD 0xDA #define DS_DB_READ_RECORD 0xDC #define DS_DB_NEXT_RECORD 0xE2 #define DS_DB_PREVIOUS_RECORD 0xE4 #define DS_DB_UPDATE_FIELD 0xE8 #define DS_DB_TEXT_OP 0xEA #define DS_DB_FLUSH 0xEC #define DS_DB_DESTROY 0xF0 #define DS_DB_OPEN_SESSION 0xF2 #define DS_DB_MISC 0xF6 extern unsigned int __LIB__ DbFindRecord(int, char, char, ... ); extern unsigned long __LIB__ DbGetRecordCount( int ); extern unsigned int __LIB__ DbInsertRecord(int, ... ); extern unsigned int __LIB__ DbReadRecord(int, ... ); extern unsigned int __LIB__ DbUpdateRecord(int, ... ); extern unsigned int __LIB__ DbReadField(int, int, ... ); extern unsigned int __LIB__ DbUpdateField(int, int, ... ); extern unsigned int __LIB__ DbReadText(int, ... ); extern unsigned int __LIB__ DbInsertText(int, ... ); extern unsigned int __LIB__ DbDeleteText(int, ... ); /* * Functions via SYSCALLx */ #define DbInitialize( ) SYSCALL0( DS_DB_INITIALIZE ) #define DbCreate( arg1, arg2, arg3 ) SYSCALL3( DS_DB_CREATE, arg1, arg2, arg3 ) #define DbOpen( arg1 ) SYSCALL1( DS_DB_OPEN, arg1 ) #define DbClose( arg1 ) SYSCALL1( DS_DB_CLOSE, arg1 ) #define DbDeleteRecord( arg1 ) SYSCALL1( DS_DB_DELETE_RECORD, arg1 ) #define DbDestroy( arg1 ) SYSCALL1( DS_DB_DESTROY, arg1 ) #define DbNextRecord( arg1 ) SYSCALL1( DS_DB_NEXT_RECORD, arg1 ) #define DbPreviousRecord( arg1 ) SYSCALL1( DS_DB_PREVIOUS_RECORD, arg1 ) #define DbFlush( ) SYSCALL0( DS_DB_FLUSH ) #define DbOpenSession( ) SYSCALL1( DS_DB_OPEN_SESSION, 0 ) #define DbGetFieldSize( arg1, arg2, arg3 ) SYSCALL4( DS_DB_MISC, 0x03, arg1, arg2, arg3 ) #define DbBeginTransaction( ) SYSCALL1( DS_DB_MISC, 0x07 ) #define DbCommitTransaction( ) SYSCALL1( DS_DB_MISC, 0x08 ) #define DbRollbackTransaction( ) SYSCALL1( DS_DB_MISC, 0x09 ) #define DbGetTransactionError( ) SYSCALL1( DS_DB_MISC, 0x0A ) #define DbEndTransaction( arg1, arg2 ) SYSCALL3( DS_DB_MISC, 0x0B, arg1 , arg2 ) #endif z88dk-1.8.ds1/include/rex/library.h0000644000175000017500000000056207455117713016557 0ustar tygrystygrys/**************************************************************** * library.h * * Header for Rex addin program. * * * ****************************************************************/ #ifndef _LIB_H_ #define _LIB_H_ #pragma -shareoffset=12 #pragma -shared-file #define getFuncID() asm("ld\tix,10\nadd\tix,sp\nld\tl,(ix+0)\nld\th,(ix+1)") #endif z88dk-1.8.ds1/include/rex/MemoDB.h0000644000175000017500000000150707422637455016222 0ustar tygrystygrys/*************************************************************** * MemoDB.h * Header for Rex addin program. ***************************************************************/ #ifndef MEMODB_H #define MEMODB_H //Table 4000 enum { MEMO_RECID = 1, MEMO_TITLE, MEMO_ISREAD, MEMO_LINE, MEMO_SHIORI, MEMO_BODY, MEMO_CATEGORY }; enum { IDX_MEMO_ID = 1, IDX_MEMO_TITLE }; //Table 4001: see StatusDB.h //Table 4002 enum { MEMOCAT_ID = 1, MEMOCAT_NAME, MEMOCAT_RECORDS, MEMOCAT_IMPREC }; enum { IDX_MEMOCAT_ID = 1, IDX_MEMOCAT_NAME }; //Table 4003 enum { MEMOLNK_MEMO_RECID = 1, MEMOLNK_CATEGORY_SEQ, MEMOLNK_CATEGORY_ID, MEMOLNK_HEADING, MEMOLNK_CATHEADING }; enum { IDX_MEMOLNK_KEY = 1, IDX_MEMOLNK_HEADING, IDX_MEMOLNK_CATSEQ }; //Table 4004: see TextInfDB.h #endif z88dk-1.8.ds1/include/rex/message.h0000644000175000017500000000747707422637455016557 0ustar tygrystygrys/*************************************************************** * message.h * Header for Rex addin program. ***************************************************************/ #ifndef _MSG_ #define _MSG_ #define MSG_DS_PAINT 0x01 #define MSG_DS_CLOSE 0x02 #define MSG_DS_COMMAND 0x03 #define MSG_DS_SHORTCUT 0x04 #define MSG_DS_KEY_DOWN 0x10 #define MSG_DS_KEY_UP 0x11 #define MSG_DS_CHAR 0x12 #define MSG_DS_TOUCH_DOWN 0x20 #define MSG_DS_TOUCH_UP 0x21 #define MSG_DS_TOUCH_MOVE 0x22 #define MSG_DS_SCROLLUP_REPEAT 0x23 #define MSG_DS_SCROLLDOWN_REPEAT 0x24 #define MSG_DS_PAGEUP_REPEAT 0x25 #define MSG_DS_PAGEDOWN_REPEAT 0x26 #define MSG_DS_SCROLLUP_UP 0x27 #define MSG_DS_SCROLLDOWN_UP 0x28 #define MSG_DS_PAGEUP_UP 0x29 #define MSG_DS_PAGEDOWN_UP 0x2a #define MSG_DS_SCROLLUP 0x30 #define MSG_DS_SCROLLDOWN 0x31 #define MSG_DS_RIGHTSCROLL 0x32 #define MSG_DS_LEFTSCROLL 0x33 #define MSG_DS_PAGEUP 0x34 #define MSG_DS_PAGEDOWN 0x35 #define MSG_DS_SCROLL_THUMB 0x36 #define MSG_DS_SCROLL_THUMB_DOWN 0x37 #define MSG_DS_TIMER1 0x40 #define MSG_DS_ALARM 0x41 #define MSG_DS_POWERON 0x42 #define MSG_DS_COMMAND_DOWN 0x43 #define MSG_DS_COMMAND_REPEAT 0x44 #define MSG_DS_COMMAND_UP 0x45 #define MSG_DS_POWEROFF 0x46 #define MSG_DS_AUTOPOWEROFF 0x47 #define MSG_DS_BATTERY_DETECT 0x48 #define MSG_BASE 0xB000 #define ID_COMPONENT_EDIT 0x40 #define ID_COMPONENT_SETTING 0x41 #define ID_COMPONENT_SEARCH 0x42 #define ID_COMPONENT_CLOSE 0x43 #define ID_COMPONENT_TODAY 0x44 #define ID_COMPONENT_DAY 0x45 #define ID_COMPONENT_MONTH 0x46 #define ID_COMPONENT_WEEK 0x47 #define ID_COMPONENT_CATEGORY 0x48 #define ID_COMPONENT_LIST 0x49 #define ID_COMPONENT_PASTE 0x4a #define ID_COMPONENT_RETURN 0x4b #define ID_COMPONENT_SAINYU 0x4c #define ID_COMPONENT_SYOUSAI 0x4d #define ID_COMPONENT_END 0x4e #define ID_COMPONENT_EIWA 0x4f #define ID_COMPONENT_WAEI 0x50 #define ID_COMPONENT_KOKUGO 0x51 #define ID_COMPONENT_COMPLETE 0x52 #define ID_COMPONENT_CANCEL 0x53 #define ID_COMPONENT_ARROWUP 0x54 #define ID_COMPONENT_ARROWDOWN 0x55 #define ID_COMPONENT_ARROWRIGHT 0x56 #define ID_COMPONENT_ARROWLEFT 0x57 #define ID_COMPONENT_ARROWDUP 0x58 #define ID_COMPONENT_ARROWDDOWN 0x59 #define ID_COMPONENT_CONTINUE 0x5a #define ID_COMPONENT_AM 0x5b #define ID_COMPONENT_PM 0x5c #define ID_COMPONENT_ALARM 0x5d #define ID_COMPONENT_KEY 0x5f #define ID_COMPONENT_GRAY32 0x60 #define ID_COMPONENT_GRAY40 0x61 #define ID_COMPONENT_GRAY45 0x62 #define ID_COMPONENT_EDIT_START 0x63 #define ID_COMPONENT_GOTAB 0x64 #define ID_COMPONENT_ARROWUP_WIDE 0x65 #define ID_COMPONENT_ARROWDOWN_WIDE 0x66 #define ID_COMPONENT_CLOSEP 0x67 #define ID_SCROLLUP 0xF0 #define ID_SCROLLDOWN 0xF1 #define ID_PAGEUP 0xF2 #define ID_PAGEDOWN 0xF3 #define ID_SCROLL_THUMB_DOWN 0xF4 #define KEY_TOP_A 0x0001 #define KEY_BACK_A 0x0002 #define KEY_ENTER_A 0x0004 #define KEY_UP_A 0x0008 #define KEY_DOWN_A 0x0010 #define KEY_TOP_B KEY_TOP_A +0x0100 #define KEY_BACK_B KEY_BACK_A +0x0100 #define KEY_ENTER_B KEY_ENTER_A+0x0100 #define KEY_UP_B KEY_UP_A +0x0100 #define KEY_DOWN_B KEY_DOWN_A +0x0100 #define KEY_TOP_C KEY_TOP_A +0x0200 #define KEY_BACK_C KEY_BACK_A +0x0200 #define KEY_ENTER_C KEY_ENTER_A+0x0200 #define KEY_UP_C KEY_UP_A +0x0200 #define KEY_DOWN_C KEY_DOWN_A +0x0200 #define KEY_TOP_D KEY_TOP_A +0x0400 #define KEY_BACK_D KEY_BACK_A +0x0400 #define KEY_ENTER_D KEY_ENTER_A+0x0400 #define KEY_UP_D KEY_UP_A +0x0400 #define KEY_DOWN_D KEY_DOWN_A +0x0400 #define KEY_TOP_E KEY_TOP_A +0x0800 #define KEY_BACK_E KEY_BACK_A +0x0800 #define KEY_ENTER_E KEY_ENTER_A+0x0800 #define KEY_UP_E KEY_UP_A +0x0800 #define KEY_DOWN_E KEY_DOWN_A +0x0800 #define TP_MODE_A 0x00 #define TP_MODE_B 0x01 #define TP_MODE_C 0x02 #define TP_MODE_D 0x04 #define TP_MODE_E 0x08 #endif /* _MSG_ */ z88dk-1.8.ds1/include/rex/register.h0000644000175000017500000000710207422637455016740 0ustar tygrystygrys/**************************************************************** * register.h * * Header for Rex addin program. * * * ****************************************************************/ #ifndef _REGISTER_ #define _REGISTER_ extern int __LIB__ output8(int, int); extern int __LIB__ input8(int); #define REGISTER_WRITE( arg1, arg2 ) output8( arg1, arg2 ) #define REGISTER_READ( arg1 ) input8( arg1 ) #define REG_MEMTYPE 0x00 #define REG_BANK1_LO 0x01 #define REG_BANK1_HI 0x02 #define REG_BANK2_LO 0x03 #define REG_BANK2_HI 0x04 #define REG_INT_REGDAT 0x05 #define REG_INT_REGRST 0x06 #define REG_INT_MASK 0x07 #define REG_HALT 0x08 #define REG_FRC 0x09 #define REG_EXEC 0x0a #define REG_EXT_CTRL 0x0b #define REG_BLD_CTRL 0x0c #define REG_KI_DATA 0x10 #define REG_KO_DATA 0x11 #define REG_P_DATA 0x12 #define REG_P_IOSET 0x13 #define REG_P_OUTSET 0x14 #define REG_ALM 0x15 #define REG_MELODY 0x16 #define REG_MELFRQ_LO 0x17 #define REG_MELFRQ_HI 0x18 #define REG_MLDALM 0x19 #define REG_RMT_CTRL1 0x1a #define REG_RMT_CTRL2 0x1b #define REG_RMT_CTRL3 0x1c #define REG_SIOCLK 0x1d #define REG_RTC 0x1f #define REG_SRLCD_DSP 0x20 #define REG_SRLCD_SEG 0x21 #define REG_SRLCD_LO 0x22 #define REG_SRLCD_HI 0x23 #define REG_SRLCD_COM 0x24 #define REG_RMLCD_SEG1 0x25 #define REG_RMLCD_SEG2 0x27 #define REG_RMLCD_SEG3 0x29 #define REG_RMLCD_COM 0x2b #define REG_DRV_CTRL 0x2d #define REG_RTC_1SEC 0x30 #define REG_RTC_10SEC 0x31 #define REG_RTC_1MIN 0x32 #define REG_RTC_10MIN 0x33 #define REG_RTC_1HR 0x34 #define REG_RTC_10HR 0x35 #define REG_RTC_DAY 0x36 #define REG_RTC_1DAY 0x37 #define REG_RTC_10DAY 0x38 #define REG_RTC_1MON 0x39 #define REG_RTC_10MON 0x3a #define REG_RTC_1YR 0x3b #define REG_RTC_10YR 0x3c #define REG_RTC_PAGE 0x3d #define REG_RTC_TEST 0x3e #define REG_RTC_RESET 0x3f #define REG_RTC_24 0x3a #define REG_RTC_URU 0x3b #define REG_SIO_RDB 0x40 #define REG_SIO_TDB 0x40 #define REG_SIO_DLL 0x40 #define REG_SIO_IER 0x41 #define REG_SIO_DLM 0x41 #define REG_SIO_IIR 0x42 #define REG_SIO_LCR 0x43 #define REG_SIO_MCR 0x44 #define REG_SIO_LSR 0x45 #define REG_SIO_MSR 0x46 #define REG_SIO_SCR 0x47 /* LCDC I/O & RS232C Driver */ #define REG_LCEN 0x50 #define REG_LCMD 0x51 /* Key Scan */ #define REG_SCNEN 0x60 #define REG_ATPC 0x68 #define REG_COLD 0x69 #define REG_COLU 0x6A #define REG_ROWD 0x6B #define REG_ROWU 0x6C /* Card Status Register */ #define REG_CDSTS 0x70 #define MemoryType16M 0x00 #define MemoryType32M (1<<0) #define InterruptRegisterKEY (1<<0) #define InterruptRegisterRTC (1<<1) #define InterruptRegisterSIO (1<<2) #define InterruptRegisterBLD (1<<3) #define InterruptRegisterTIM1 (1<<4) #define InterruptRegisterTIM64 (1<<5) #define InterruptRegisterTIM8K (1<<6) #define InterruptRegisterEXT (1<<7) #define InterruptMaskKEY (1<<0) #define InterruptMaskRTC (1<<1) #define InterruptMaskSIO (1<<2) #define InterruptMaskBLD (1<<3) #define InterruptMaskTIM1 (1<<4) #define InterruptMaskTIM64 (1<<5) #define InterruptMaskTIM8K (1<<6) #define InterruptMaskEXT (1<<7) #define HaltSettingStop 0x00 #define HaltSettingIdle 0x01 #define KinputDataKI0 (1<<0) #define KinputDataKI1 (1<<1) #define KinputDataKI2 (1<<2) #define KinputDataKI3 (1<<3) #define KinputDataKI4 (1<<4) #define KinputDataKI5 (1<<5) #define KinputDataKI6 (1<<6) #define KinputDataKI7 (1<<7) #endif z88dk-1.8.ds1/include/rex/rex.h0000644000175000017500000000244207455117713015710 0ustar tygrystygrys/**************************************************************** * rex.h * * Header for Rex addin program. * * * ****************************************************************/ #ifndef _REX_H_ #define _REX_H_ #include #include #include #include #include #include #include #include #include #include #include extern int __LIB__ DsPrintf(int, int, int, char*); /* * Graphic routines by Waleed Hasan */ extern int __LIB__ DsClearScreen(void); extern int __LIB__ DsFillScreen(int); extern int __LIB__ DsGetPixelAddr(int, int, unsigned char*); extern int __LIB__ DsSetPixel(int, int); extern int __LIB__ DsDisplayCircle(int, int, int); extern int __LIB__ DsDisplayEllipse(int, int, int, int); /* * farcall functions */ extern unsigned long __LIB__ farcall(); #if !_NOFLOAT_ extern double __LIB__ farcalld(); #endif extern int __LIB__ findlib(unsigned char*); extern int __LIB__ DsTrace(char*, ... ); #define DsDisplayBitmapDrawFar( arg1, arg2, arg3, arg4, arg5 ) SYSCALL5( DS_DISPLAY_BITMAP_DRAW, arg1, arg2, arg3, arg4, arg5 ) #define FindLibrary( arg1 ) findlib( arg1 ) #endif /* _REX_H_ */ z88dk-1.8.ds1/include/rex/StatusDB.h0000644000175000017500000000057607422637455016615 0ustar tygrystygrys/*************************************************************** * StatusDB.h * Header for Rex addin program. ***************************************************************/ #ifndef STATUSDB_H #define STATUSDB_H enum { STATUS_RECID = 1, STATUS_STATUS }; enum { IDX_STATUS_RECID = 1 }; #define REX_NEW 1 #define REX_MODIFIED 2 #define REX_DELETED 3 #endif z88dk-1.8.ds1/include/rex/struct.h0000644000175000017500000000100107422637455016430 0ustar tygrystygrys/*************************************************************** * struct.h * Header for Rex addin program. ***************************************************************/ #ifndef _STRUCT_ #define _STRUCT_ typedef struct { unsigned int PointX; unsigned int PointY; } POINT; typedef struct { unsigned int x; unsigned int y; unsigned int cx; unsigned int cy; } RECT; typedef struct { unsigned int message; unsigned char bCode; unsigned int sCode; POINT pt; } MSG; #endif /* _STRUCT_ */ z88dk-1.8.ds1/include/rex/syscall.h0000644000175000017500000003064307455117713016570 0ustar tygrystygrys/****************************************************************/ /* syscall.h /* Header for Rex addin program. /****************************************************************/ #ifndef _SYSTEMCALL_ #define _SYSTEMCALL_ extern int __LIB__ SYSCALL0(int); extern int __LIB__ SYSCALL1(int,...); extern int __LIB__ SYSCALL1P(int,...); extern int __LIB__ SYSCALL2(int,...); extern int __LIB__ SYSCALL3(int,...); extern int __LIB__ SYSCALL4(int,...); extern int __LIB__ SYSCALL4D(int,...); extern int __LIB__ SYSCALL5(int,...); extern int __LIB__ SYSCALL5P(int,...); extern int __LIB__ SYSCALL6(int,...); extern int __LIB__ SYSCALL6P(int,...); #define DS_TIME_GET 0x00 #define DS_TIME_SET 0x02 #define DS_LOCAL_TIME_GET 0x04 #define DS_TIME_24_GET 0x06 #define DS_TIME_24_SET 0x08 #define DS_TIME_SUMMER_GET 0x0a #define DS_TIME_SUMMER_SET 0x0c #define DS_MONTH_PERIOD_GET 0x0E #define DS_HOME_CITY_GET 0x10 #define DS_HOME_CITY_SET 0x12 #define DS_ALARM_TIME_GET 0x14 #define DS_ALARM_TIME_SET 0x16 #define DS_ALARM_ENABLE 0x18 #define DS_ALARM_SET 0x1A #define DS_BEEP_ON 0x1C #define DS_BEEP_SET 0x1E #define DS_SHELL_REFRESH_TOP 0x20 #define DS_SHELL_PROGRAM_TERM 0x22 #define DS_SHELL_PROGRAM_EXEC 0x24 #define DS_TIME_FORMAT_GET 0x26 #define DS_TIME_FORMAT_SET 0x28 #define DS_EVENT_MESSAGE_GET 0x2A #define DS_EVENT_ADD 0x2C #define DS_EVENT_DELETE 0x2E #define DS_EVENT_CLEAR 0x30 #define DS_EVENT_ENABLE 0x32 #define DS_EVENT_DISABLE 0x34 #define DS_EVENT_STATUS_GET 0x36 #define DS_EVENT_PRIORITY_GET 0x38 #define DS_READ_MESSAGE 0x3a #define DS_READ_LAST_MESSAGE 0x3c #define DS_TRAVEL_CITY_SET 0x3e #define DS_ADDIN_EXECUTE 0x40 #define DS_ADDIN_TERMINATE 0x42 #define DS_TRAVEL_TIME_GET 0x44 #define DS_TRAVEL_TIME_SET 0x46 #define DS_TRAVEL_CITY_GET 0x48 #define DS_DISPLAY_COMPONENT 0x4a #define DS_SET_SCROLL_SIZE 0x4c #define DS_DIALOG_SCROLL_THUMB_SET 0x4e #define DS_DISP_LINE 0x50 #define DS_DISP_POINT_GET 0x52 #define DS_DISP_POINT_SET 0x54 #define DS_DISP_CIRCLE 0x56 #define DS_DISP_BLOCK_CLEAR 0x58 #define DS_DISP_BLOCK_REV 0x5A #define DS_DISP_BLOCK 0x5C #define DS_DISP_BLOCK_STORE 0x5E #define DS_DISP_BLOCK_RESTORE 0x60 #define DS_DISP_IMAGE_OR 0x62 #define DS_DISP_WAIT_ICON_DRAW 0x64 #define DS_TEXT_OUT 0x66 #define DS_DIALOG_EDIT_SHOW 0x68 #define DS_DIALOG_SCROLL_DRAW 0x6A #define DS_DIALOG_EVENT_SET 0x6C #define DS_DIALOG_EVENT_DRAW 0x6E #define DS_DIALOG_CHECK_BOX_SET 0x70 #define DS_DIALOG_CHECK_BOX_DRAW 0x72 #define DS_DISPLAY_BITMAP_DRAW 0x72 #define DS_DIALOG_COMPONENT_DRAW 0x74 #define DS_RESOURCE_CHANGE 0x76 #define DS_ICON_DRAW 0x78 /*#define DS_ICON_MOVE 0x7A*/ #define DS_DIALOG_TEXT_BUTTON 0x7a #define DS_ICON_REVERSE 0x7C #define DS_POWER_IDLE_MODE_ENTRY 0x80 #define DS_POWER_STOP_MODE_ENTRY 0x82 #define DS_POWER_MODE_GET 0x84 #define DS_POWER_MODE_SET 0x86 #define DS_POWER_BAT_INFO 0x88 #define DS_POWER_LINE_CHECK 0x8A #define DS_POWER_OFF_TIME_SET 0x8C #define DS_POWER_HALT_ENABLE 0x8E #define DS_KEY_CODE_GET 0x90 #define DS_KEY_REPEAT_SET 0x92 #define DS_KEY_CLICK_SET 0x94 #define DS_FEP_EXECUTE 0x96 #define DS_SOFT_KEY_CLOSE 0x98 #define DS_TOUCH_CALIBRATION 0x9A #define DS_TOUCH_CLICK_SET 0x9C #define DS_TOUCH_DATA_GET 0x9E #define DS_JSTR_CMP 0xA0 #define DS_MALLOC 0xA2 #define DS_REALLOC 0xA4 #define DS_FREE 0xA6 #define DS_VERSION_GET 0xA8 #define DS_ADDIN_PREV_GET 0xaa #define DS_ADDIN_PREV_SET 0xac #define DS_SYSCALL_EXTENDED 0xCE #define DS_DB_INITIALIZE 0xD0 #define DS_DB_CREATE 0xD2 #define DS_DB_OPEN 0xD4 #define DS_DB_CLOSE 0xD6 #define DS_DB_INSERT_RECORD 0xD8 #define DS_DB_DELETE_RECORD 0xDA #define DS_DB_READ_RECORD 0xDC #define DS_DB_READ_FIELD 0xDE #define DS_DB_FIND_RECORD 0xE0 #define DS_DB_NEXT_RECORD 0xE2 #define DS_DB_PREVIOUS_RECORD 0xE4 #define DS_DB_UPDATE_RECORD 0xE6 #define DS_DB_UPDATE_FIELD 0xE8 #define DS_DB_TEXT_OP 0xEA #define DS_DB_FLUSH 0xEC #define DS_DB_GET_RECORD_COUNT 0xEE #define DS_DB_DESTROY 0xF0 #define DS_DB_SESSION 0xF2 #define DS_DB_COPY_FIELD 0xF4 #define DS_DB_MISC 0xF6 #define DsTimeGet( arg1, arg2 ) SYSCALL2( DS_TIME_GET, arg1, arg2 ) #define DsTimeSet( arg1, arg2 ) SYSCALL2( DS_TIME_SET, arg1, arg2 ) #define DsLocalTimeGet( arg1, arg2, arg3 ) SYSCALL3( DS_LOCAL_TIME_GET, (int)arg1, (int)arg2, arg3 ) #define DsTime24Get() SYSCALL0( DS_TIME_24_GET ) #define DsTime24Set( arg1 ) SYSCALL1( DS_TIME_24_SET, arg1 ) #define DsTimeSummerGet( arg1 ) SYSCALL1( DS_TIME_SUMMER_GET, arg1 ) #define DsTimeSummerSet( arg1, arg2 ) SYSCALL2( DS_TIME_SUMMER_SET, arg1, arg2 ) #define DsMonthPeriodGet( arg1 ) SYSCALL1( DS_MONTH_PERIOD_GET, arg1 ) #define DsHomeCityGet() SYSCALL0( DS_HOME_CITY_GET ) #define DsHomeCitySet( arg1 ) SYSCALL1( DS_HOME_CITY_SET, arg1 ) #define DsTimeFormatGet() SYSCALL0( DS_TIME_FORMAT_GET ) #define DsTimeFormatSet( arg1 ) SYSCALL1( DS_TIME_FORMAT_SET, arg1 ) #define DsTravelTimeGet( arg1, arg2 ) SYSCALL2( DS_TRAVEL_TIME_GET, arg1, arg2 ) #define DsTravelTimeSet( arg1, arg2 ) SYSCALL2( DS_TRAVEL_TIME_SET, arg1, arg2 ) #define DsTravelCityGet() SYSCALL0( DS_TRAVEL_CITY_GET ) #define DsTravelCitySet( arg1 ) SYSCALL1( DS_TRAVEL_CITY_SET, arg1 ) #define DsAlarmTimeGet( arg1 ) SYSCALL1( DS_ALARM_TIME_GET, arg1 ) #define DsAlarmTimeSet( arg1 ) SYSCALL1( DS_ALARM_TIME_SET, arg1 ) #define DsAlarmEnable( arg1 ) SYSCALL1( DS_ALARM_ENABLE, arg1 ) #define DsAlarmSet( arg1 ) SYSCALL1( DS_ALARM_SET, arg1 ) #define DsBeepOn( arg1 ) SYSCALL1( DS_BEEP_ON, arg1 ) #define DsBeepSet( arg1 ) SYSCALL1( DS_BEEP_SET, arg1 ) #define DsShellRefreshTopMode() SYSCALL0( DS_SHELL_REFRESH_TOP ) #define DsProgramTerminate( arg1 ) SYSCALL1( DS_SHELL_PROGRAM_TERM, arg1 ) #define DsProgramExecute( arg1 ) SYSCALL1( DS_SHELL_PROGRAM_EXEC, arg1 ) #define DsEventMessageGet( arg1 ) SYSCALL1( DS_EVENT_MESSAGE_GET, arg1 ) #define DsReadMessage( arg1, arg2 ) SYSCALL2( DS_READ_MESSAGE, arg1, arg2 ) #define DsReadLastMessage( arg1 ) SYSCALL1( DS_READ_LAST_MESSAGE, arg1 ) #define DsEventAdd( arg1, arg2, arg3, arg4, arg5, arg6 ) \ SYSCALL6( DS_EVENT_ADD, arg1, arg2, arg3, arg4, arg5, arg6 ) #define DsEventDelete( ) SYSCALL0( DS_EVENT_DELETE ) #define DsEventClear( ) SYSCALL0( DS_EVENT_CLEAR ) #define DsEventEnable( arg1 ) SYSCALL1( DS_EVENT_ENABLE, arg1 ) #define DsEventDisable( arg1 ) SYSCALL1( DS_EVENT_DISABLE, arg1 ) #define DsEventStatusGet( arg1 ) SYSCALL1( DS_EVENT_STATUS_GET, arg1 ) #define DsEventPriorityGet() SYSCALL0( DS_EVENT_PRIORITY_GET ) #define DsAddinExecute( arg1 ) SYSCALL1( DS_ADDIN_EXECUTE, arg1 ) #define DsAddinTerminate() SYSCALL0( DS_ADDIN_TERMINATE ) #define DsDisplayComponent( arg1, arg2, arg3 ) SYSCALL3( DS_DISPLAY_COMPONENT, arg1, arg2, arg3 ) #define DsSetScrollSize( arg1 ) SYSCALL1( DS_SET_SCROLL_SIZE, arg1 ) #define DsDialogScrollThumbSet( arg1 ) SYSCALL1( DS_DIALOG_SCROLL_THUMB_SET, arg1 ) #define DsDisplayLine( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALL5( DS_DISP_LINE, arg1, arg2, arg3, arg4, arg5 ) #define DsDisplayPointGet( arg1, arg2 ) SYSCALL2( DS_DISP_POINT_GET, arg1, arg2 ) #define DsDisplayPointSet( arg1, arg2, arg3 ) SYSCALL3( DS_DISP_POINT_SET, arg1, arg2, arg3 ) #if 0 #define DsDisplayCircle( arg1, arg2, arg3, arg4, arg5 ) SYSCALL5( DS_DISP_CIRCLE, arg1, arg2, arg3, arg4, arg5 ) #endif #define DsDisplayBlockClear( arg1, arg2, arg3, arg4 ) \ SYSCALL4( DS_DISP_BLOCK_CLEAR, arg1, arg2, arg3, arg4 ) #if 0 #define DsClearScreen() SYSCALL4( DS_DISP_BLOCK_CLEAR, 0, 0, 240, 120 ) #endif #define DsDisplayBlockReverse( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALL5( DS_DISP_BLOCK_REV, arg1, arg2, arg3, arg4, arg5 ) #define DsDisplayBlock( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALL5( DS_DISP_BLOCK, arg1, arg2, arg3, arg4, arg5 ) #define DsDisplayBlockStore( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALL5( DS_DISP_BLOCK_STORE, arg1, arg2, arg3, arg4, arg5 ) #define DsDisplayBlockRestore( arg1, arg2 ) SYSCALL2( DS_DISP_BLOCK_RESTORE, arg1, arg2 ) #define DsDisplayImageDrawOr() SYSCALL0( DS_DISP_IMAGE_OR ) #define DsDisplayWaitIconDraw( arg1 ) SYSCALL1( DS_DISP_WAIT_ICON_DRAW, arg1 ) #define DsTextOut( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALL5P( DS_TEXT_OUT, arg1, arg2, arg3, arg4, arg5 ) #define DsDisplayBitmapDraw( arg1, arg2, arg3, arg4 ) \ SYSCALL4D( DS_DISPLAY_BITMAP_DRAW, arg1, arg2, arg3, arg4 ) #define DsDialogEditShow( arg1 ) SYSCALL1( DS_DIALOG_EDIT_SHOW, arg1 ) #define DsDialogScrollBarDraw( arg1, arg2, arg3, arg4 ) \ SYSCALL4( DS_DIALOG_SCROLL_DRAW, arg1, arg2, arg3, arg4 ) #define DsDialogEventSet( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALL5( DS_DIALOG_EVENT_SET, arg1, arg2, arg3, arg4, arg5 ) #define DsDialogEventDraw( arg1, arg2, arg3, arg4 ) \ SYSCALL4D( DS_DIALOG_EVENT_DRAW, arg1, arg2, arg3, arg4 ) #define DsDialogCheckBoxSet( arg1, arg2, arg3, arg4 ) \ SYSCALL4( DS_DIALOG_CHECK_BOX_SET, arg1, arg2, arg3, arg4 ) #define DsDialogCheckBoxDraw( arg1, arg2, arg3, arg4 ) \ SYSCALL4( DS_DIALOG_CHECK_BOX_DRAW, arg1, arg2, arg3, arg4 ) #define DsDialogComponentDraw( arg1, arg2, arg3, arg4 ) \ SYSCALL4( DS_DIALOG_COMPONENT_DRAW, arg1, arg2, arg3, arg4 ) #define DsResourceGet( arg1 ) SYSCALL1( DS_RESOURCE_GET, arg1 ) #define DsResourceChange( arg1 ) SYSCALL1( DS_RESOURCE_CHANGE, arg1 ) #define DsIconDraw( arg1, arg2, arg3, arg4 ) SYSCALL4D( DS_ICON_DRAW, arg1, arg2, arg3, arg4 ) #define DsIconMove( arg1, arg2, arg3, arg4 ) SYSCALL4( DS_ICON_MOVE, arg1, arg2, arg3, arg4 ) #define DsIConReverse( arg1 ) SYSCALL1( DS_ICON_REVERSE, arg1 ) #define DsDialogTextButton( arg1, arg2, arg3, arg4, arg5, arg6 ) \ SYSCALL6P( DS_DIALOG_TEXT_BUTTON, arg1, arg2, arg3, arg4, arg5, arg6 ) #define DsPowerIdleModeEntry() SYSCALL0( DS_POWER_IDLE_MODE_ENTRY ) #define DsPowerStopModeEntry() SYSCALL0( DS_POWER_STOP_MODE_ENTRY ) #define DsPowerModeGet() SYSCALL0( DS_POWER_MODE_GET ) #define DsPowerModeSet() SYSCALL0( DS_POWER_MODE_SET ) #define DsPowerBatteryInfoGet() SYSCALL0( DS_POWER_BAT_INFO ) #define DsPowerLineCheck() SYSCALL0( DS_POWER_LINE_CHECK ) #define DsPowerOffTimeSet( arg1 ) SYSCALL1( DS_POWER_OFF_TIME_SET, arg1 ) #define DsPowerHaltEnable() SYSCALL0( DS_POWER_HALT_ENABLE ) #define DsKeyCodeGet() SYSCALL0( DS_KEY_CODE_GET ) #define DsKeyRepeatSet( arg1 ) SYSCALL1( DS_KEY_REPEAT_SET, arg1 ) #define DsKeyClickSet( arg1 ) SYSCALL1( DS_KEY_CLICK_SET, arg1 ) #define DsSoftKeyClose() SYSCALL0( DS_SOFT_KEY_CLOSE ) #define DsTouchCalibration( arg1 ) SYSCALL1( DS_TOUCH_CALIBRATION, arg1 ) #define DsTouchClickSet( arg1 ) SYSCALL1( DS_TOUCH_CLICK_SET, arg1 ) #define DsTouchDataGet( arg1 ) SYSCALL1P( DS_TOUCH_DATA_GET, arg1 ) #define DsFepExecute() SYSCALL0( DS_FEP_EXECUTE ) #define DsJStrCmp( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALL5C( DS_JSTR_CMP, arg1, arg2, arg3, arg4, arg5 ) #define DsMalloc( arg1 ) (void *)SYSCALL1( DS_MALLOC, arg1 ) #define DsRealloc( arg1, arg2 ) (void *)SYSCALL2( DS_REALLOC, arg1, arg2 ) #define DsFree( arg1 ) SYSCALL1( DS_FREE, arg1 ) #define DsVersionGet() SYSCALL0( DS_VERSION_GET ) #define DsAddinPrevGet() SYSCALL0( DS_ADDIN_PREV_GET ) #define DsAddinPrevSet( arg1 ) SYSCALL1( DS_ADDIN_PREV_SET, arg1 ) #define DsDbInitialize( ) SYSCALL0( DS_DB_INITIALIZE ) #define DsDbCreate( arg1, arg2, arg3 ) SYSCALL3( DS_DB_CREATE, arg1, arg2, arg3 ) #define DsDbOpen( arg1 ) SYSCALL1( DS_DB_OPEN, arg1 ) #define DsDbClose( arg1 ) SYSCALL1( DS_DB_CLOSE, arg1 ) #define DsDbInsertRecord( arg1, arg2 ) SYSCALL2( DS_DB_INSERT_RECORD, arg1, arg2 ) #define DsDbDeleteRecord( arg1 ) SYSCALL1( DS_DB_DELETE_RECORD, arg1 ) #define DsDbReadRecord( arg1, arg2 ) SYSCALL2( DS_DB_READ_RECORD, arg1, arg2 ) #define DsDbReadField( arg1, arg2, arg3 ) SYSCALL3( DS_DB_READ_FIELD, arg1, arg2, arg3 ) #define DsDbFindRecord( arg1, arg2, arg3, arg4 ) \ SYSCALL4( DS_DB_FIND_RECORD, arg1, arg2, arg3, arg4 ) #define DsDbNextRecord( arg1 ) SYSCALL1( DS_DB_NEXT_RECORD, arg1 ) #define DsDbPreviousRecord( arg1 ) SYSCALL1( DS_DB_PREVIOUS_RECORD, arg1 ) #define DsDbUpdateRecord( arg1, arg2 ) SYSCALL2( DS_DB_UPDATE_RECORD, arg1, arg2 ) #define DsDbUpdateField( arg1, arg2, arg3 ) SYSCALL3( DS_DB_UPDATE_FIELD, arg1, arg2, arg3 ) #define DsDbTextOp() SYSCALL0( DS_DB_TEXT_OP ) #define DsDbFlush() SYSCALL0( DS_DB_FLUSH ) #endif /* _SYSTEMCALL_ */ z88dk-1.8.ds1/include/rex/syscallEx.h0000644000175000017500000001417107376224150017057 0ustar tygrystygrys/*************************************************************** * syscallEx.h * Header for Rex addin program. ***************************************************************/ #ifndef _SYSTEMCALLEX_ #define _SYSTEMCALLEX_ extern int __LIB__ SYSCALLEX(int,...); extern int __LIB__ SYSCALLEXL(int,...); #define DS_TEXT_OUT_24 0x0001 #define DS_TEXT_WIDTH 0x0002 #define DS_IS_ZENKAKU 0x0003 #define DS_VSCROLL_AREA 0x0005 #define DS_GET_BYTE_BY_PIXEL 0x0006 #define DS_GET_PIXEL_BY_BYTE 0x0007 #define DS_STRCPY 0x0009 #define DS_MEMCPY 0x000A #define DS_CAL_CURRENT_TIME 0x0101 #define DS_CAL_DATE_TIME 0x0102 #define DS_CAL_TIME_DATE 0x0103 #define DS_CAL_DAY_OF_WEEK_D 0x0104 #define DS_CAL_DAY_OF_WEEK 0x0105 #define DS_CAL_STRFTIME 0x0106 #define DS_CAL_DAY_ADD 0x0107 #define DS_CAL_MONTH_ADD 0x0108 #define DS_CAL_MAX_DAY_OF_MONTH 0x0109 #define DS_CAL_NTH_XDAY_IN_MONTH 0x010A #define DS_CAL_INT_TO_STR 0x010B #define DS_CAL_DAY_TO_STR 0x010C #define DS_CAL_STRFTIME_24 0x010D #define DS_CAL_DAY_TO_STR_E 0x010E #define DS_CAL_DATE_TO_STR 0x010F #define DS_CAL_WEEK_OF_YEAR 0x0110 #define DS_CAL_MINUTE_ADD 0x0111 #define DS_SLEEP 0x0201 #define DS_SYNCHRONIZE 0x0211 #define DS_SETUP_INFO_SET 0x0221 #define DS_PASSWD_ENABLE 0x0222 #define DS_PASSWD_SET 0x0223 #define DS_PASSWD_GET 0x0224 #define DS_USER_INFO_GET 0x0225 #define DS_ALARM_UPDATE 0x0226 #define DS_FLASH_WRITE_START 0x0231 #define DS_FLASH_WRITE_END 0x0232 #define DS_SYSTEM_ERROR_SET 0x0241 #define DS_SYSTEM_ERROR_GET 0x0242 #define DS_SHORTCUT_MASK 0x0250 #define DS_POWER_OFF_COUNT_CLEAR 0x0260 #define DS_SOFTWARE_KEYBOARD 0x0301 #define DS_SOFTWARE_KEYBOARD_SET_INPUT_MODE 0x0302 #define DS_SOFTWARE_KEYBOARD_WITH_YOMI 0x0303 #define DS_DIALOG_WINDOW 0x0311 #define DS_DISPLAY_DAB 0x0321 #define DsTextOut24( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALLEX( DS_TEXT_OUT_24, arg1, arg2, arg3, arg4, arg5 ) #define DsTextOut24A( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALLEX( DS_TEXT_OUT_24, arg1, arg2, arg3, arg4, address_24_of(arg5) ) #define DsTextWidth( arg1 ) SYSCALLEX( DS_TEXT_WIDTH, arg1 ) #define IsZenkaku( arg1 ) SYSCALLEX( DS_IS_ZENKAKU, arg1 ) #define DsVScrollArea( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALLEX( DS_VSCROLL_AREA, arg1, arg2, arg3, arg4, arg5 ) #define DsGetByteByPixel( arg1, arg2 ) SYSCALLEX( DS_GET_BYTE_BY_PIXEL, arg1, arg2 ) #define DsGetPixelByByte( arg1, arg2 ) SYSCALLEX( DS_GET_PIXEL_BY_BYTE, arg1, arg2 ) #define DsStrCpy( arg1, arg2 ) SYSCALLEX( DS_STRCPY, arg1, arg2 ) #define DsStrCpyA( arg1, arg2 ) SYSCALLEX( DS_STRCPY, arg1, address_24_of(arg2) ) #define DsMemCpy( arg1, arg2, arg3 ) SYSCALLEX( DS_MEMCPY, arg1, arg2, arg3 ) #define DsMemCpyA( arg1, arg2, arg3 ) SYSCALLEX( DS_MEMCPY, arg1, arg2, address_24_of(arg3) ) #define DsCalCurrentTime( arg1, arg2 ) SYSCALLEX( DS_CAL_CURRENT_TIME, arg1, arg2 ) #define DsCalDateTime( arg1 ) SYSCALLEXL( DS_CAL_DATE_TIME, arg1 ) #define DsCalTimeDate( arg1, arg2 ) SYSCALLEX( DS_CAL_TIME_DATE, arg1, arg2 ) #define DsCalDayOfWeekD( arg1 ) SYSCALLEX( DS_CAL_DAY_OF_WEEK_D, arg1 ) #define DsCalDayOfWeek( arg1 ) SYSCALLEX( DS_CAL_DAY_OF_WEEK, arg1 ) #define DsCalStrFTime( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALLEX( DS_CAL_STRFTIME, arg1, arg2, arg3, arg4, arg5 ) #define DsCalDayAdd( arg1, arg2 ) SYSCALLEX( DS_CAL_DAY_ADD, arg1, arg2 ) #define DsCalMonthAdd( arg1, arg2 ) SYSCALLEX( DS_CAL_MONTH_ADD, arg1, arg2 ) #define DsCalMaxDayOfMonth( arg1 ) SYSCALLEX( DS_CAL_MAX_DAY_OF_MONTH, arg1 ) #define DsCalNthXdayInMonth( arg1, arg2, arg3, arg4) \ SYSCALLEX( DS_CAL_NTH_XDAY_IN_MONTH, arg1, arg2, arg3, arg4 ) #define DsCalIntToStr( arg1, arg2, arg3, arg4 ) SYSCALLEX( DS_CAL_INT_TO_STR, arg1, arg2, arg3, arg4 ) #define DsCalDayToStr( arg1, arg2 ) SYSCALLEX( DS_CAL_DAY_TO_STR, arg1, arg2 ) #define DsCalStrFTime24( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALLEX( DS_CAL_STRFTIME_24, arg1, arg2, arg3, arg4, arg5 ) #define DsCalStrFTime24A( arg1, arg2, arg3, arg4, arg5 ) \ SYSCALLEX( DS_CAL_STRFTIME_24, arg1, arg2, address_24_of(arg3), arg4, arg5 ) #define DsCalDayToStrE( arg1, arg2 ) SYSCALLEX( DS_CAL_DAY_TO_STR_E, arg1, arg2 ) #define DsCalDateToStr( arg1, arg2, arg3 ) SYSCALLEX( DS_CAL_DATE_TO_STR, arg1, arg2, arg3 ) #define DsCalWeekOfYear( arg1, arg2 ) SYSCALLEX( DS_CAL_WEEK_OF_YEAR, arg1, arg2 ) #define DsCalMinuteAdd( arg1, arg2, arg3 ) SYSCALLEX( DS_CAL_MINUTE_ADD, arg1, arg2, arg3 ) #define DsSleep( arg1 ) SYSCALLEX( DS_SLEEP, arg1 ) #define DsSynchronize( ) SYSCALLEX( DS_SYNCHRONIZE ) #define DsSetupInfoSet( ) SYSCALLEX( DS_SETUP_INFO_SET ) #define DsPasswdEnable( arg1 ) SYSCALLEX( DS_PASSWD_ENABLE, arg1 ) #define DsPasswdSet( arg1 ) SYSCALLEX( DS_PASSWD_SET, arg1 ) #define DsPasswdGet( arg1 ) SYSCALLEX( DS_PASSWD_GET, arg1 ) #define DsUserInfoGet( arg1, arg2, arg3, arg4 ) SYSCALLEX( DS_USER_INFO_GET, arg1, arg2, arg3, arg4 ) #define DsAlarmUpdate( ) SYSCALLEX( DS_ALARM_UPDATE ) #define DsFlashWriteStart( ) SYSCALLEX( DS_FLASH_WRITE_START ) #define DsFlashWriteEnd( ) SYSCALLEX( DS_FLASH_WRITE_END ) #define DsSystemErrorSet( arg1, arg2, arg3 ) SYSCALLEX( DS_SYSTEM_ERROR_SET, arg1, arg2, arg3 ) #define DsSystemErrorGet( arg1, arg2 ) SYSCALLEX( DS_SYSTEM_ERROR_GET, arg1, arg2 ) #define DsShortcutMask( arg1 ) SYSCALLEX( DS_SHORTCUT_MASK, arg1 ) #define DsPowerOffCountClear() SYSCALLEX( DS_POWER_OFF_COUNT_CLEAR ) #define DsSoftwareKeyboard( arg1, arg2 ) SYSCALLEX( DS_SOFTWARE_KEYBOARD, arg1, arg2 ) #define DsSoftwareKeyboardSetInputMode( arg1, arg2, arg3 ) \ SYSCALLEX( DS_SOFTWARE_KEYBOARD_SET_INPUT_MODE, arg1, arg2, arg3 ) #define DsSoftwareKeyboardWithYomi( arg1, arg2, arg3 ) \ SYSCALLEX( DS_SOFTWARE_KEYBOARD_WITH_YOMI, arg1, arg2, arg3 ) #define DsDialogWindow( arg1, arg2, arg3, arg4 ) \ SYSCALLEX( DS_DIALOG_WINDOW, arg1, arg2, arg3, arg4 ) #define DsDisplayTab( arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ) \ SYSCALLEX( DS_DISPLAY_DAB, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ) #endif /* _SYSTEMCALLEX_ */ z88dk-1.8.ds1/include/rex/TaskDB.h0000644000175000017500000000105707422637455016227 0ustar tygrystygrys/*************************************************************** * TaskDB.h * Header for Rex addin program. ***************************************************************/ #ifndef TASKDB_H #define TASKDB_H //Table 3000 enum { TASK_RECID = 1, TASK_TITLE, TASK_NOTES, TASK_STARTDATE, TASK_DUEDATE, TASK_COMPLETE, TASK_PRIORITY, TASK_ENDDATE, TASK_ALARMDATE }; enum { IDX_TASK_ID = 1, IDX_TASK_TITLE }; //Table 3001: see StatusDB.h //Table 3002: unknown //Table 3003: unknown //Table 3004: see TextInfDB.h #endif z88dk-1.8.ds1/include/rex/TextInfDB.h0000644000175000017500000000055407422637455016707 0ustar tygrystygrys/*************************************************************** * TextInfDB.h * Header for Rex addin program. ***************************************************************/ #ifndef TEXTINFDB_H #define TEXTINFDB_H enum { TEXTINF_RECID = 1, TEXTINF_TOTAL_LINE, TEXTINF_TOTAL_BYTE, TEXTINF_DATA }; enum { IDX_TEXTINF_RECID = 1 }; #endif z88dk-1.8.ds1/include/rs232.h0000644000175000017500000000473107425022424015161 0ustar tygrystygrys/* * rs232.h * * RS232 prototypes for z88dk - not all machines supported! * * Based on the API from cc65 */ #ifndef __RS232_H__ #define __RS232_H__ #include /* Baudrate settings */ #define RS_BAUD_50 0x00 #define RS_BAUD_110 0x01 #define RS_BAUD_134_5 0x02 #define RS_BAUD_300 0x03 #define RS_BAUD_600 0x04 #define RS_BAUD_1200 0x05 #define RS_BAUD_2400 0x06 #define RS_BAUD_4800 0x07 #define RS_BAUD_9600 0x08 #define RS_BAUD_19200 0x09 #define RS_BAUD_38400 0x0A #define RS_BAUD_57600 0x0B #define RS_BAUD_115200 0x0C #define RS_BAUD_230400 0x0D /* Stop bit settings */ #define RS_STOP_1 0x00 #define RS_STOP_2 0x80 /* Data bit settings */ #define RS_BITS_5 0x60 #define RS_BITS_6 0x40 #define RS_BITS_7 0x20 #define RS_BITS_8 0x00 /* Parity settings */ #define RS_PAR_NONE 0x00 #define RS_PAR_ODD 0x20 #define RS_PAR_EVEN 0x60 #define RS_PAR_MARK 0xA0 #define RS_PAR_SPACE 0xE0 /* Error codes returned by all functions */ #define RS_ERR_OK 0x00 /* Not an error - relax */ #define RS_ERR_NOT_INITIALIZED 0x01 /* Module not initialized */ #define RS_ERR_BAUD_TOO_FAST 0x02 /* Cannot handle baud rate */ #define RS_ERR_BAUD_NOT_AVAIL 0x03 /* Baud rate not available */ #define RS_ERR_NO_DATA 0x04 /* Nothing to read */ #define RS_ERR_OVERFLOW 0x05 /* No room in send buffer */ /* The functions: Call params, then init then put/get finally close */ /* Set up the parameters for the serial interface use | of parameters above */ extern u8_t __LIB__ rs232_params(u8_t params,u8_t parity); /* Initialise the serial interface */ extern u8_t __LIB__ rs232_init(); /* Close the interface */ extern u8_t __LIB__ rs232_close(); /* Write a byte to the serial interface */ extern u8_t __FASTCALL__ __LIB__ rs232_put(i8_t); /* Read a byte from the serial, returns RS_ERR_NO_DATA if an error, places data in the pointer supplied */ extern u8_t __FASTCALL__ __LIB__ rs232_get(i8_t *); #endif z88dk-1.8.ds1/include/setjmp.h0000644000175000017500000000062210640012331015570 0ustar tygrystygrys/* * setjmp.h * * Routines for dealing with longjmps * * $Id: setjmp.h,v 1.4 2007/06/25 19:17:45 dom Exp $ */ #ifndef __SETJMP_H__ #define __SETJMP_H__ /* * We have no register variables so we just need to * save sp and pc */ typedef struct { int sp; int pc; } jmp_buf; extern int __LIB__ setjmp(jmp_buf env); extern void __LIB__ longjmp(jmp_buf env, int val); #endif /* _SETJMP_H */ z88dk-1.8.ds1/include/sms.h0000755000175000017500000000652410630370127015113 0ustar tygrystygrys/* * Sega Master System * * $Id: sms.h,v 1.2 2007/06/02 22:33:59 dom Exp $ */ #ifndef __SMS_H__ #define __SMS_H__ #define VDP_REG_FLAGS0 0x80 // Screen sync off #define VDP_REG_FLAGS0_SYNC 0x01 // Normal or enable stretch screen #define VDP_REG_FLAGS0_STRETCH 0x02 // Causes graphics change (related to screen addr?) #define VDP_REG_FLAGS0_CHANGE 0x04 // Shift sprites left by 1 character #define VDP_REG_FLAGS0_SHIFT 0x08 // Horizontal interupts enable #define VDP_REG_FLAGS0_HINT 0x10 // Display extra column on LHS of screen #define VDP_REG_FLAGS0_LHS 0x20 // Top 2 rows of screen horizontal non-scrolling #define VDP_REG_FLAGS0_LOCKTOP 0x40 // Right side of screen vertical non-scrolling #define VDP_REG_FLAGS0_LOCKRIGHT 0x80 #define VDP_REG_FLAGS1 0x81 // Double sized pixels in sprites #define VDP_REG_FLAGS1_DOUBLE 0x01 // 8x16 sprites #define VDP_REG_FLAGS1_8x16 0x02 // 0? #define VDP_REG_FLAGS1_BIT2 0x04 // Stretch screen by 6 rows #define VDP_REG_FLAGS1_STRETCH6 0x08 // Stretch screen by 4 rows #define VDP_REG_FLAGS1_STRETCH4 0x10 // Vertical interrupts enable #define VDP_REG_FLAGS1_VINT 0x20 // Screen enable #define VDP_REG_FLAGS1_SCREEN 0x40 // 0? #define VDP_REG_FLAGS1_BIT7 0x80 #define VDP_REG_HINT_COUNTER 0x8A // Bkg tile appears in front of the sprites #define BKG_ATTR_PRIO 0x1000 // Bkg tile uses sprite palette #define BKG_ATTR_SPRPAL 0x0800 // Bkg tile is vertically flipped #define BKG_ATTR_VFLIP 0x0400 // Bkg tile is horizontally flipped #define BKG_ATTR_HFLIP 0x0200 // Bkg tile uses the second tileset #define BKG_ATTR_2NDTILESET 0x0100 #define JOY_UP 0x01 #define JOY_DOWN 0x02 #define JOY_LEFT 0x04 #define JOY_RIGHT 0x08 #define JOY_FIREA 0x10 #define JOY_FIREB 0x20 typedef char INT8; typedef unsigned char UINT8; typedef int INT16; typedef unsigned int UINT16; typedef long INT32; typedef unsigned long UINT32; typedef INT8 BYTE; typedef UINT8 UBYTE; typedef INT16 WORD; typedef UINT16 UWORD; typedef INT32 LWORD; typedef UINT32 ULWORD; typedef INT32 DWORD; typedef UINT32 UDWORD; #ifndef NULL #define NULL 0 #endif #ifndef FALSE #define FALSE 0 #define TRUE 1 #endif /* Useful definition for fixed point values */ typedef union _fixed { struct { UBYTE l; UBYTE h; } b; UWORD w; } fixed; extern void __LIB__ load_palette(unsigned char *data, int index, int count); extern void __LIB__ load_tiles(unsigned char *data, int index, int count, int bpp); extern void __LIB__ set_bkg_map(unsigned int *data, int x, int y, int w, int h); extern void __LIB__ scroll_bkg(int x, int y); extern int __LIB__ get_vcount(); extern int __LIB__ wait_vblank_noint(); extern void __LIB__ set_sprite(int n, int x, int y, int tile); extern int __LIB__ read_joypad1(); extern int __LIB__ read_joypad2(); extern void __LIB__ set_vdp_reg(int reg, int value); extern void __LIB__ gotoxy(int x, int y); extern void __LIB__ aplib_depack(unsigned char *src, unsigned char *dest); extern void __LIB__ add_raster_int(void *ptr); extern void __LIB__ add_pause_int(void *ptr); extern void __LIB__ set_sound_freq(int channel, int freq); extern void __LIB__ set_sound_volume(int channel, int volume); extern void __LIB__ standard_font(); /* Actually data *not* a function */ extern unsigned char pause_flag; #endif z88dk-1.8.ds1/include/sound.h0000644000175000017500000000356610725756724015461 0ustar tygrystygrys#ifndef __SOUND_H__ #define __SOUND_H__ /* * Sound support code * * Stefano, Oct 2001 - First release * Dec 2001 - Added Mattel Aquarius * Dec 2007 - Various fixes and improvements * * $Id: sound.h,v 1.9 2007/12/06 11:32:36 stefano Exp $ */ /* 1 bit sound library */ #pragma output NEED1bitsound extern __LIB__ bit_open(); extern __LIB__ bit_close(); extern __LIB__ bit_click(); /* Sound effects; every library contains 8 different sounds (effect no. 0..7) */ extern __LIB__ bit_fx(int effect); extern __LIB__ bit_fx2(int effect); extern __LIB__ bit_fx3(int effect); extern __LIB__ bit_fx4(int effect); /* 1 BIT SYNTH - Polyphony and multitimbric effects */ extern __LIB__ bit_synth(int duration, int frequency1, int frequency2, int frequency3, int frequency4); /* "period": the higher value, the lower tone ! */ extern __LIB__ bit_beep(int duration, int period); /* Real frequency ! Duration is in ms */ extern __LIB__ bit_frequency(float duration, float frequency); /* Play a song (example: "2A--A-B-CDEFGAB5C+") */ extern __LIB__ bit_play(unsigned char melody[]); /* Platform specific parameters (mainly timing stuff) */ #ifdef SPECTRUM #define BEEP_TSTATES 437500.0 /* 3.5 Mhz; float value = CPU_CLOCK*125 */ #endif #ifdef MSX #define BEEP_TSTATES 447500.0 /* 3.58 Mhz */ #endif #ifdef AQUARIUS #define BEEP_TSTATES 500000.0 /* 4 Mhz */ #endif #ifdef TICALC // TICALC, TI82, TI83, TI8X, TI85, TI86, SHARP OZ #define BEEP_TSTATES 750000.0 /* 6 Mhz */ /* TI-83 Plus should have 1875000.0 (15 Mhz) if Silver Edition */ /* #define BEEP_TSTATES 1875000.0 */ #endif #ifdef ACE #define BEEP_TSTATES 406250.0 /* 3.25 Mhz */ #endif /* We always get Z88, so it can't be a condition */ #ifndef BEEP_TSTATES #define BEEP_TSTATES 410000.0 /* Z88 -- 3.28 Mhz */ #endif #endif z88dk-1.8.ds1/include/spectrum.h0000644000175000017500000003317310754330255016155 0ustar tygrystygrys/* * Headerfile for Spectrum specific stuff * * $Id: spectrum.h,v 1.26 2008/02/12 14:43:57 stefano Exp $ */ #ifndef __SPECTRUM_H__ #define __SPECTRUM_H__ #include ///////////// // CONSTANTS ///////////// // Attributes #define BLACK 0x00 #define BLUE 0x01 #define RED 0x02 #define MAGENTA 0x03 #define GREEN 0x04 #define CYAN 0x05 #define YELLOW 0x06 #define WHITE 0x07 #define INK_BLACK 0x00 #define INK_BLUE 0x01 #define INK_RED 0x02 #define INK_MAGENTA 0x03 #define INK_GREEN 0x04 #define INK_CYAN 0x05 #define INK_YELLOW 0x06 #define INK_WHITE 0x07 #define PAPER_BLACK 0x00 #define PAPER_BLUE 0x08 #define PAPER_RED 0x10 #define PAPER_MAGENTA 0x18 #define PAPER_GREEN 0x20 #define PAPER_CYAN 0x28 #define PAPER_YELLOW 0x30 #define PAPER_WHITE 0x38 #define BRIGHT 0x40 #define FLASH 0x80 // Basic Tokens #define TK_RND 165 #define TK_INKEYS 166 #define TK_PI 167 #define TK_FN 168 #define TK_POINT 169 #define TK_SCREENS 170 #define TK_ATTR 171 #define TK_AT 172 #define TK_TAB 173 #define TK_VALS 174 #define TK_CODE 175 #define TK_VAL 176 #define TK_LEN 177 #define TK_SIN 178 #define TK_COS 179 #define TK_TAN 180 #define TK_ASN 181 #define TK_ACS 182 #define TK_ATN 183 #define TK_LN 184 #define TK_EXP 185 #define TK_INT 186 #define TK_SQR 187 #define TK_SGN 188 #define TK_ABS 189 #define TK_PEEK 190 #define TK_IN 191 #define TK_USR 192 #define TK_STRS 193 #define TK_CHRS 194 #define TK_NOT 195 #define TK_BIN 196 #define TK_OR 197 #define TK_AND 198 #define TK_LEQ 199 #define TK_GEQ 200 #define TK_NEQ 201 #define TK_LINE 202 #define TK_THEN 203 #define TK_TO 204 #define TK_STEP 205 #define TK_DEF_FN 206 #define TK_CAT 207 #define TK_FORMAT 208 #define TK_MOVE 209 #define TK_ERASE 210 #define TK_OPEN 211 #define TK_CLOSE 212 #define TK_MERGE 213 #define TK_VERIFY 214 #define TK_BEEP 215 #define TK_CIRCLE 216 #define TK_INK 217 #define TK_PAPER 218 #define TK_FLASH 219 #define TK_BRIGHT 220 #define TK_INVERSE 221 #define TK_OVER 222 #define TK_OUT 223 #define TK_LPRINT 224 #define TK_LLIST 225 #define TK_STOP 226 #define TK_READ 227 #define TK_DATA 228 #define TK_RESTORE 229 #define TK_NEW 230 #define TK_BORDER 231 #define TK_CONTINUE 232 #define TK_CONT 232 #define TK_DIM 233 #define TK_REM 234 #define TK_FOR 235 #define TK_GO_TO 236 #define TK_GO_SUB 237 #define TK_INPUT 238 #define TK_LOAD 239 #define TK_LIST 240 #define TK_LET 241 #define TK_PAUSE 242 #define TK_NEXT 243 #define TK_POKE 244 #define TK_PRINT 245 #define TK_PLOT 246 #define TK_RUN 247 #define TK_SAVE 248 #define TK_RANDOMIZE 249 #define TK_RAND 249 #define TK_IF 250 #define TK_CLS 251 #define TK_DRAW 252 #define TK_CLEAR 253 #define TK_RETURN 254 #define TK_COPY 255 /////////////////////////////////////////// // DIAGNOSTICS AND HARDWARE IDENTIFICATION /////////////////////////////////////////// extern int __LIB__ zx_128mode(void); // true or false extern int __LIB__ zx_floatingbus(void); // true or false extern int __LIB__ zx_issue3(void); // true or false extern int __LIB__ zx_type(void); // 0:48K - 1: 128K - 2: TS2068 extern int __LIB__ zx_model(void); extern int __LIB__ zx_basic_length(void); extern int __LIB__ zx_var_length(void); extern int __LIB__ zx_printer(void); extern int __LIB__ zx_soundchip(void); extern int __LIB__ zx_timexsound(void); extern int __LIB__ zx_fullerstick(void); extern int __LIB__ zx_kempstonmouse(void); extern int __LIB__ zx_kempston(void); extern int __LIB__ zx_iss_stick(void); extern int __LIB__ zx_mb02(void); extern int __LIB__ zx_multiface(void); extern int __LIB__ zx_disciple(void); extern int __LIB__ zx_plus3fdc(void); extern int __LIB__ zx_extsys(void); extern int __LIB__ zx_basemem(void); extern int __LIB__ zx_break(void); /////////////////////////////// // INTERFACE FOR CALLING BASIC /////////////////////////////// extern int __LIB__ __FASTCALL__ zx_syntax(char *statement); extern int __LIB__ __FASTCALL__ zx_goto(int line); extern int __LIB__ zx_getstr(char variable, char *value); extern void __LIB__ zx_setstr(char variable, char *value); extern int __LIB__ __FASTCALL__ zx_getint(char *variable); extern void __LIB__ zx_setint(char *variable, int value); extern int __LIB__ __CALLEE__ zx_getstr_callee(char variable, char *value); extern void __LIB__ __CALLEE__ zx_setstr_callee(char variable, char *value); extern void __LIB__ __CALLEE__ zx_setint_callee(char *variable, int value); #define zx_getstr(a,b) zx_getstr_callee(a,b) #define zx_setstr(a,b) zx_setstr_callee(a,b) #define zx_setint(a,b) zx_setint_callee(a,b) //////////// // TAPE I/O //////////// struct zxtapehdr { // standard tape header unsigned char type; char name[10]; size_t length; size_t address; size_t offset; }; extern int __LIB__ tape_save(char *name, size_t loadstart,void *start, size_t len); extern int __LIB__ tape_save_block(void *addr, size_t len, unsigned char type); extern int __LIB__ tape_load_block(void *addr, size_t len, unsigned char type); extern int __LIB__ __CALLEE__ tape_save_block_callee(void *addr, size_t len, unsigned char type); extern int __LIB__ __CALLEE__ tape_load_block_callee(void *addr, size_t len, unsigned char type); #define tape_save_block(a,b,c) tape_save_block_callee(a,b,c) #define tape_load_block(a,b,c) tape_load_block_callee(a,b,c) /////////////////////////////////// // DISK AND OTHER MASS STORAGE I/O /////////////////////////////////// // +3 Disk #ifdef PLUS3 // if it's a +3 we want the dodos routine #pragma output NEEDplus3dodos extern int __LIB__ findhand(void); extern void __LIB__ freehand(int); #endif // RESIDOS #ifdef RESIDOS // if it's residos then we want dodos routines #pragma output NEEDresidos extern int __LIB__ findhand(void); extern void __LIB__ freehand(int); #endif ///////////////////////////////////////////////////////////////// // INPUT DEVICES: KEYBOARD, JOYSTICK AND MICE (SEE ALSO INPUT.H) ///////////////////////////////////////////////////////////////// // Joystick Functions extern unsigned int __LIB__ in_JoyFuller(void); extern unsigned int __LIB__ in_JoyKempston(void); extern unsigned int __LIB__ in_JoySinclair1(void); extern unsigned int __LIB__ in_JoySinclair2(void); extern unsigned int __LIB__ in_JoyTimex1(void); extern unsigned int __LIB__ in_JoyTimex2(void); // AMX Mouse // // To use you must declare the following global variables // uint in_AMXcoordX, in_AMXcoordY, in_AMXdeltaX, in_AMXdeltaY; extern void __LIB__ in_MouseAMXInit(uchar xvector, uchar yvector); extern void __LIB__ in_MouseAMX(uchar *buttons, uint *xcoord, uint *ycoord); extern void __LIB__ in_MouseAMXSetPos(uint xcoord, uint ycoord); extern void __LIB__ __CALLEE__ in_MouseAMXInit_callee(uchar xvector, uchar yvector); extern void __LIB__ __CALLEE__ in_MouseAMX_callee(uchar *buttons, uint *xcoord, uint *ycoord); extern void __LIB__ __CALLEE__ in_MouseAMXSetPos_callee(uint xcoord, uint ycoord); #define in_MouseAMXInit(a,b) in_MouseAMXInit_callee(a,b) #define in_MouseAMX(a,b,c) in_MouseAMX_callee(a,b,c) #define in_MouseAMXSetPos(a,b) in_MouseAMXSetPos_callee(a,b) // Kempston Mouse // // To use you must declare the following global variables // uchar in_KempcoordX, in_KempcoordY, in_KemprawX, in_KemprawY; extern void __LIB__ in_MouseKempInit(void); extern void __LIB__ in_MouseKemp(uchar *buttons, uint *xcoord, uint *ycoord); extern void __LIB__ in_MouseKempSetPos(uint xcoord, uint ycoord); extern void __LIB__ __CALLEE__ in_MouseKemp_callee(uchar *buttons, uint *xcoord, uint *ycoord); extern void __LIB__ __CALLEE__ in_MouseKempSetPos_callee(uint xcoord, uint ycoord); #define in_MouseKemp(a,b,c) in_MouseKemp_callee(a,b,c) #define in_MouseKempSetPos(a,b) in_MouseKempSetPos_callee(a,b) ////////////////////////// // DISPLAY FILE FUNCTIONS ////////////////////////// extern void __LIB__ __FASTCALL__ zx_border(uchar colour); extern uint __LIB__ zx_attr(uchar row, uchar col); extern uint __LIB__ zx_screenstr(uchar row, uchar col); extern uint __LIB__ __CALLEE__ zx_attr_callee(uchar row, uchar col); extern uint __LIB__ __CALLEE__ zx_screenstr_callee(uchar row, uchar col); #define zx_attr(a,b) zx_attr_callee(a,b) #define zx_screenstr(a,b) zx_screenstr_callee(a,b) // In the following, screen address refers to a pixel address within the display file while // attribute address refers to the attributes area. // // Function names are constructed from the following atoms: // // saddr = screen address // aaddr = attribute address // // px = pixel x coordinate (0..255) // py = pixel y coordinate (0..191) // pxy = pixel (x,y) coordinate // // cx = character x coordinate (0..31) // cy = character y coordinate (0..23) // cyx = character (y,x) coordinate - ordering borrowed from Sinclair Basic // // So for example: // // zx_saddr2cy(saddr) will return the character y coordinate corresponding to the given screen address // zx_saddr2aaddr(saddr) will return the attribute address corresponding to the given screen address // zx_pxy2aaddr(px,py) will return the attribute address corresponding to the given (x,y) pixel coordinate // // Some functions will return with carry flag set if coordinates or addresses move out of // bounds. In these cases the special z88dk keywords iferror() and ifnerror() can be used // to test the carry flag and determine if invalid results are returned. Check with the // wiki documentation or the asm source files to see which functions support this. If // comments in the asm source file do not mention this it is not supported. // DISPLAY PIXEL ADDRESS MANIPULATORS extern uchar __LIB__ *zx_cyx2saddr(uchar row, uchar col); extern uchar __LIB__ __FASTCALL__ *zx_cy2saddr(uchar row); // cx assumed 0 extern uchar __LIB__ *zx_pxy2saddr(uchar xcoord, uchar ycoord, uchar *mask); extern uchar __LIB__ __FASTCALL__ *zx_py2saddr(uchar ycoord); // px assumed 0 extern uint __LIB__ __FASTCALL__ zx_saddr2cx(void *pixeladdr); extern uint __LIB__ __FASTCALL__ zx_saddr2cy(void *pixeladdr); extern uint __LIB__ zx_saddr2px(void *pixeladdr, uchar mask); extern uint __LIB__ __FASTCALL__ zx_saddr2py(void *pixeladdr); extern uchar __LIB__ __FASTCALL__ *zx_saddr2aaddr(void *pixeladdr); extern uchar __LIB__ __FASTCALL__ *zx_saddrcdown(void *pixeladdr); extern uchar __LIB__ __FASTCALL__ *zx_saddrcleft(void *pixeladdr); extern uchar __LIB__ __FASTCALL__ *zx_saddrcright(void *pixeladdr); extern uchar __LIB__ __FASTCALL__ *zx_saddrcup(void *pixeladdr); extern uchar __LIB__ __FASTCALL__ *zx_saddrpdown(void *pixeladdr); extern uchar __LIB__ *zx_saddrpleft(void *pixeladdr, uchar *mask); extern uchar __LIB__ *zx_saddrpright(void *pixeladdr, uchar *mask); extern uchar __LIB__ __FASTCALL__ *zx_saddrpup(void *pixeladdr); extern uchar __LIB__ __CALLEE__ *zx_cyx2saddr_callee(uchar row, uchar col); extern uchar __LIB__ __CALLEE__ *zx_pxy2saddr_callee(uchar xcoord, uchar ycoord, uchar *mask); extern uint __LIB__ __CALLEE__ zx_saddr2px_callee(void *pixeladdr, uchar mask); extern uchar __LIB__ __CALLEE__ *zx_saddrpleft_callee(void *pixeladdr, uchar *mask); extern uchar __LIB__ __CALLEE__ *zx_saddrpright_callee(void *pixeladdr, uchar *mask); #define zx_cyx2saddr(a,b) zx_cyx2saddr_callee(a,b) #define zx_pxy2saddr(a,b,c) zx_pxy2saddr_callee(a,b,c) #define zx_saddr2px(a,b) zx_saddr2px_callee(a,b) #define zx_saddrpleft(a,b) zx_saddrpleft_callee(a,b) #define zx_saddrpright(a,b) zx_saddrpright_callee(a,b) // DISPLAY ATTRIBUTE ADDRESS MANIPULATORS extern uchar __LIB__ *zx_cyx2aaddr(uchar row, uchar col); extern uchar __LIB__ __FASTCALL__ *zx_cy2aaddr(uchar row); // cx assumed 0 extern uchar __LIB__ *zx_pxy2aaddr(uchar xcoord, uchar ycoord); extern uchar __LIB__ __FASTCALL__ *zx_py2aaddr(uchar ycoord); // px assumed 0 extern uint __LIB__ __FASTCALL__ zx_aaddr2cx(void *attraddr); extern uint __LIB__ __FASTCALL__ zx_aaddr2cy(void *attraddr); extern uint __LIB__ __FASTCALL__ zx_aaddr2px(void *attraddr); extern uint __LIB__ __FASTCALL__ zx_aaddr2py(void *attraddr); extern uchar __LIB__ __FASTCALL__ *zx_aaddr2saddr(void *attraddr); extern uchar __LIB__ __FASTCALL__ *zx_aaddrcdown(void *attraddr); extern uchar __LIB__ __FASTCALL__ *zx_aaddrcleft(void *attraddr); extern uchar __LIB__ __FASTCALL__ *zx_aaddrcright(void *attraddr); extern uchar __LIB__ __FASTCALL__ *zx_aaddrcup(void *attraddr); extern uchar __LIB__ __CALLEE__ *zx_cyx2aaddr_callee(uchar row, uchar col); extern uchar __LIB__ __CALLEE__ *zx_pxy2aaddr_callee(uchar xcoord, uchar ycoord); #define zx_cyx2aaddr(a,b) zx_cyx2aaddr_callee(a,b) #define zx_pxy2aaddr(a,b) zx_pxy2aaddr_callee(a,b) #endif z88dk-1.8.ds1/include/sprites/0000755000175000017500000000000010765202715015625 5ustar tygrystygrysz88dk-1.8.ds1/include/sprites/readme.txt0000644000175000017500000000052010415666567017633 0ustar tygrystygrysHeader files for each hardware API for all platforms go here. Library code for the hardware API is already included in the platform's default library (this means you do not need to link to anything extra to use the API). Header files for a software sprite engine are copied here when the software sprite engine is configured and made. z88dk-1.8.ds1/include/stdarg.h0000644000175000017500000000173707363076310015601 0ustar tygrystygrys/* * A nice old stdarg.h * * djm 28/2/2000 * * Will this work? Who knows! * * NB. va_start must be called immediately after calling * the function - i.e. no auto variables can be initialised * (except to constants) * * NB2. The first call to va_next returns with the value * of the first named argument, the 2nd call returns the * value of the 2nd named argument etc etc * * I've only tested this with 2 byte arguments but it * seems to work... * * $Id: stdarg.h,v 1.3 2001/10/16 18:30:32 dom Exp $ */ #ifndef __STDARG_H__ #define __STDARG_H__ #ifndef DEF_GETARG #define DEF_GETARG extern int __LIB__ getarg(void); #endif #define va_list unsigned char * #define va_start(ap,last) ap=(getarg()*2)+&last-2 #define va_arg(ap,type) (type *)*(ap-=sizeof(type)) #define va_end(ap) /* * This (non-standard) macro could be used by routines * with a similar setup to the library printf routines */ #define va_addr(ap,type) (ap-=sizeof(type)) #endif /* _STDARG_H */ z88dk-1.8.ds1/include/stdio.h0000755000175000017500000001411310705630630015425 0ustar tygrystygrys#ifndef __STDIO_H__ #define __STDIO_H__ /* $Id: stdio.h,v 1.14 2007/10/18 10:12:40 stefano Exp $ */ #undef __STDIO_BINARY /* By default don't consider binary files */ #ifdef FDSTDIO #include #else #ifdef __SPECTRUM__ #include #endif #ifdef __ZX81__ #include #endif #ifdef __CPM__ #include #endif #ifdef ZXVGS #include #endif /* * This is the new stdio library - everything is pretty much * generic - just a few machine specific routines are needed * and these are clearly marked */ #include #include #ifndef NULL #define NULL ((void *)0) #endif #ifndef EOF #define EOF (-1) #endif #define FILENAME_MAX 128 /* If you change this then you also have to pad out {zcc}/lib/stdio_fp.asm, * recompile the libs and fiddle with app_crt0.asm - best leave it! */ #define FOPEN_MAX 10 /* Indicate to the frontend that we want the new streams stuff */ #pragma output ANSIstdio struct filestr { union f0xx { int fd; u8_t *ptr; } desc; u8_t flags; u8_t ungetc; }; /* For asm routines kinda handy to have a nice DEFVARS of the structure*/ #ifdef STDIO_ASM #asm DEFVARS 0 { fp_desc ds.w 1 fp_flags ds.b 1 fp_ungetc ds.b 1 } #endasm #endif #define FILE struct filestr /* System is used for initial std* streams * Network streams do not set IOREAD/IOWRITE, it is assumed that * they are read/write always */ #define _IOUSE 1 #define _IOREAD 2 #define _IOWRITE 4 #define _IOEOF 8 #define _IOSYSTEM 16 #define _IONETWORK 32 #define _IOTEXT 64 #define _IOSTRING 128 extern struct filestr _sgoioblk[FOPEN_MAX]; #define stdin &_sgoioblk[0] #define stdout &_sgoioblk[1] #define stderr &_sgoioblk[2] /* Macros for things we don't use */ #define clearerr(f) #ifdef NET_STDIO extern int __LIB__ fflush(FILE *); #else #define fflush(f) #endif /* Our new and improved functions!! */ extern FILE __LIB__ *fopen(far char *name, unsigned char *mode); extern FILE __LIB__ *fopen_z88(far char *name, unsigned char *mode, unsigned char *explicit, size_t len); extern FILE __LIB__ *freopen(far char *name, unsigned char *mode, FILE *fp); extern FILE __LIB__ *freopen_z88(far char *n, unsigned char *m, FILE *fp, unsigned char *explicit, size_t len); extern FILE __LIB__ *fdopen(int fildes, unsigned char *mode); extern int __LIB__ fclose(FILE *fp); extern void __LIB__ closeall(); extern char __LIB__ *fgets(unsigned char *s, int, FILE *fp); extern int __LIB__ fputs(unsigned char *s, FILE *fp); extern int __LIB__ fputc(int c, FILE *fp); #define getc(f) fgetc(f) extern int __LIB__ fgetc(FILE *fp); extern int __LIB__ ungetc(int c, FILE *); extern int __LIB__ feof(FILE *fp); extern int __LIB__ puts(unsigned char *); /* Routines for file positioning */ extern fpos_t __LIB__ ftell(FILE *fp); extern int __LIB__ fgetpos(FILE *fp, fpos_t *pos); #define fsetpos(fp,pos) fseek(fp,pos,SEEK_SET) #define rewind(fp) fseek(fp,0L,SEEK_SET) extern int __LIB__ fseek(FILE *fp, fpos_t offset, int whence); /* Block read/writing */ extern int __LIB__ fread(void *ptr, int size, int num, FILE *); extern int __LIB__ fwrite(void *ptr, int size, int num, FILE *); /* You shouldn't use gets. z88 gets() is limited to 255 characters */ extern int __LIB__ gets(char *s); /* Some standard macros */ #define putc(bp,fp) fputc(bp,fp) #define putchar(bp) fputc(bp,stdout) #define getchar() fgetc(stdin) /* * Yes! vfprintf is deliberately without a __LIB__ cos * a jp to the real routine is in the startup code */ extern int __LIB__ printf(char *,...); extern int __LIB__ fprintf(FILE *,char *,...); extern int __LIB__ sprintf(char *,char *,...); extern int vfprintf(FILE *,unsigned char *fmt,void *ap); extern int __LIB__ vsprintf(char *str,unsigned char *fmt,void *ap); #define vprintf(ctl,arg) vfprintf(stdout,ctl,arg) /* real printf cores */ extern int __LIB__ vfprintf_mini(FILE *, unsigned char *, void *); extern int __LIB__ vfprintf_comp(FILE *, unsigned char *, void *); extern int __LIB__ vfprintf_fp(FILE *, unsigned char *, void *); extern __LIB__ printn(int number, int radix,FILE *file); extern int __LIB__ ltoa_any(long in,unsigned char *str, int sz, unsigned int radix, int signflag); /* * Scanf family */ extern int __LIB__ scanf(unsigned char *fmt,...); extern int __LIB__ fscanf(FILE *,unsigned char *fmt,...); extern int __LIB__ sscanf(char *,unsigned char *fmt,...); extern int __LIB__ vfscanf(FILE *, unsigned char *fmt, void *ap); extern int __LIB__ vsscanf(char *str, unsigned char *fmt, void *ap); #define vscanf(ctl,arg) vfscanf(stdout,ctl,arg) /* * Used in variable argument lists */ #ifndef DEF_GETARG #define DEF_GETARG extern int __LIB__ getarg(void); #endif /* * Support routines * * fchkstd checks for std* varieties * * f(put|get)c_cons write/read byte to console (to avoid having * file open for them) used internally, but you could use them * (but may change etc etc) */ extern int __LIB__ fchkstd(FILE *); /* All functions below here are machine specific */ extern int __LIB__ fgetc_cons(); extern int __LIB__ fputc_cons(char c); extern int __LIB__ fgets_cons(char *s, int n); /* Abandon file - can be the generic version */ extern void __LIB__ fabandon(FILE *); /* Get file position for file handle fd */ extern long __LIB__ fdtell(int fd); extern int __LIB__ fdgetpos(int fd, fpos_t *posn); /* Rename a file */ extern int __LIB__ rename(char *s, char *d); /* Remove a file */ extern int __LIB__ remove(char *name); /* * Non-standard, but useful for games: * * getk() returns key currently pressed or 0 if none * getkey() waits for a key to be pressed before returning * puts_cons() is like puts() but o/p directly to screen * printk() is a printf directly to console (bypasses streams) * this is not available for the ANSI terminal libraries */ extern int __LIB__ getk(); #define getkey() fgetc_cons() extern void __LIB__ puts_cons(); extern void __LIB__ printk(char *fmt,...); /* * Networking stdio routines */ #ifdef NET_STDIO #include #endif #endif /* !FDSTDIO */ #endif /* _STDIO_H */ z88dk-1.8.ds1/include/stdlib.h0000644000175000017500000001663610712616525015602 0ustar tygrystygrys#ifndef __STDLIB_H__ #define __STDLIB_H__ /* * Lots of nice support functions here and a few defines * to support some functions * * $Id: stdlib.h,v 1.33 2007/11/02 12:51:33 stefano Exp $ */ #include /**********************************/ /* STANDARD K&R LIBRARY FUNCTIONS */ /**********************************/ ////////////////////////////////// //// String <-> Number Conversions ////////////////////////////////// // double atof(char *s); /* check math library for availability */ extern int __LIB__ __FASTCALL__ atoi(char *s); extern long __LIB__ __FASTCALL__ atol(char *s); extern char __LIB__ *itoa(char *s, int n); extern char __LIB__ __CALLEE__ *itoa_callee(char *s, int n); extern char __LIB__ *utoa(char *s, uint n); extern char __LIB__ __CALLEE__ *utoa_callee(char *s, uint n); extern char __LIB__ *ltoa(char *s, long n); extern char __LIB__ __CALLEE__ *ltoa_callee(char *s, long n); extern char __LIB__ *ultoa(char *s, unsigned long n); extern char __LIB__ __CALLEE__ *ultoa_callee(char *s, unsigned long n); #define itoa(a,b) itoa_callee(a,b) #define utoa(a,b) utoa_callee(a,b) #define ltoa(a,b) ltoa_callee(a,b) #define ultoa(a,b) ultoa_callee(a,b) // double strtod(char *s, char **endp); /* check math library for availability */ extern long __LIB__ strtol(char *s, char **endp, int base); extern long __LIB__ __CALLEE__ strtol_callee(char *s, char **endp, int base); extern unsigned long __LIB__ strtoul(char *s, char **endp, int base); #define strtol(a,b,c) strtol_callee(a,b,c) #define strtoul(a,b,c) strtol_callee(a,b,c) /////////////////// //// Random Numbers /////////////////// // The pseudo-random number generator requires a 16-bit seed. // The seed is present in the crt0 for a given platform, but if // you wish to define your own then do it in whatever way you wish // and add the following pragma to your source code: // #pragma output HAVESEED extern int std_seed; #define RAND_MAX 32767 #define M_SRAND(a) asm("ld\thl,"#a"\nld\t(_std_seed),hl\n"); extern int __LIB__ rand(void); extern void __LIB__ randomize(void); extern void __LIB__ __FASTCALL__ srand(unsigned int seed); // Not sure why Rex has it's own rand() routine using different seed? #define randRex() rand() ////////////////////// //// Memory Allocation ////////////////////// // Before using the malloc library you must initialize the heap -- see malloc.h for details // calloc(), malloc(), realloc(), free(), mallinit(), mallinfo(), sbrk() #include /////////////////////// //// System Environment /////////////////////// // Z88: abort is a macro to exit with RC_Err - only for apps #define abort() exit(15) #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 extern void __LIB__ __FASTCALL__ exit(int status); extern int __LIB__ __FASTCALL__ atexit(void *fcn); // int system(char *s); /* might be implemented in target's library but doubtful */ // char *getenv(char *name); /* might be implemented in target's library but doubtful */ extern void __LIB__ sleep(int); extern int __LIB__ getopt (int, char **, char *); extern char *optarg; /* getopt(3) external variables */ extern int opterr; extern int optind; extern int optopt; extern int optreset; #ifdef __Z88__ extern int system(char *text); /* should this be in the z88 library? */ #endif ////////////////// //// Search & Sort ////////////////// // These are not quite ansi (array items are assumed to be two bytes in length). Also look // into the heapsort implementation in the abstract data types library (adt.h) as a stack- // usage-free alternative to quicksort. // // void *cmp == char (*cmp)(void *key, void *datum); extern void __LIB__ *l_bsearch(void *key, void *base, unsigned int n, void *cmp); extern void __LIB__ __CALLEE__ *l_bsearch_callee(void *key, void *base, unsigned int n, void *cmp); extern void __LIB__ l_qsort(void *base, unsigned int size, void *cmp); extern void __LIB__ __CALLEE__ l_qsort_callee(void *base, unsigned int size, void *cmp); #define l_bsearch(a,b,c,d) l_bsearch_callee(a,b,c,d) #define l_qsort(a,b,c) l_qsort_callee(a,b,c) ////////////////////////// //// Misc Number Functions ////////////////////////// extern int __LIB__ __FASTCALL__ abs(int n); extern long __LIB__ labs(long n); extern long __LIB__ __CALLEE__ labs_callee(long n); #define labs(a) labs_callee(a) struct div_t { int quot; int rem; }; struct ldiv_t { long quot; long rem; }; typedef struct div_t div_t; typedef struct ldiv_t ldiv_t; // div_t div(int num, int denom); /* not implemented because can't return structs! */ // ldiv_t ldiv(long num, long denom); /* not implemented because can't return structs! */ extern void __LIB__ div(div_t *d, int num, int denom); extern void __LIB__ __CALLEE__ div_callee(div_t *d, int num, int denom); extern void __LIB__ ldiv(ldiv_t *d, long num, long denom); extern void __LIB__ __CALLEE__ ldiv_callee(ldiv_t *d, long num, long denom); #define div(a,b,c) div_callee(a,b,c) #define ldiv(a,b,c) ldiv_callee(a,b,c) extern uint __LIB__ __FASTCALL__ isqrt(uint n); /******************************************************/ /* NON-STANDARD BUT GENERALLY USEFUL FOR Z80 MACHINES */ /******************************************************/ ////////////// //// I/O PORTS ////////////// // For accessing 16-bit i/o ports from C. The macros can be // used to inline code if the parameters resolve to constants. extern unsigned int __LIB__ __FASTCALL__ inp(unsigned int port); extern void __LIB__ outp(unsigned int port, unsigned char byte); extern void __LIB__ __CALLEE__ outp_callee(unsigned int port, unsigned char byte); #define outp(a,b) outp_callee(a,b) #define M_INP(port) asm("ld\tbc,"#port"\nin\tl,(c)\nld\th,0\n"); #define M_OUTP(port,byte) asm("ld\tbc,"#port"\nld\ta,"#byte"\nout\t(c),a\n"); /////////////////////////////// //// Direct Memory Manipulation /////////////////////////////// extern void __LIB__ __FASTCALL__ *swapendian(void *addr); // The macros can be used to inline code if the parameters resolve to constants extern void __LIB__ bpoke(void *addr, unsigned char byte); extern void __LIB__ __CALLEE__ bpoke_callee(void *addr, unsigned char byte); extern void __LIB__ wpoke(void *addr, unsigned int word); extern void __LIB__ __CALLEE__ wpoke_callee(void *addr, unsigned int word); extern unsigned char __LIB__ __FASTCALL__ bpeek(void *addr); extern unsigned int __LIB__ __FASTCALL__ wpeek(void *addr); #define bpoke(a,b) bpoke_callee(a,b) #define wpoke(a,b) wpoke_callee(a,b) #define M_BPOKE(addr,byte) asm("ld\thl,"#addr"\nld\t(hl),"#byte"\n"); #define M_WPOKE(addr,word) asm("ld\thl,"#addr"\nld\t(hl),"#word"%256\ninc\thl\nld\t(hl),"#word"/256\n"); #define M_BPEEK(addr) asm("ld\thl,("#addr")\nld\th,0\n"); #define M_WPEEK(addr) asm("ld\thl,("#addr")\n"); ///////////////////////// // ACCURATE T-STATE DELAY ///////////////////////// extern void __LIB__ __FASTCALL__ delay(unsigned int tstates); // at least 160 T /*********/ /* OTHER */ /*********/ // Non standard stdlib.h defs (mode is ignored) #ifdef __Z88__ extern __LIB__ csleep(int); /* Very non standard! sleep for centisecs! (z88)*/ #endif #endif z88dk-1.8.ds1/include/string.h0000644000175000017500000001675110642611174015622 0ustar tygrystygrys#ifndef __STRINGS_H__ #define __STRINGS_H__ /* * This is strings.h * * We have virtually a full set of these routines! * Most of the common ones have been tested and * used in my programs (dom). * * BSDisms are catered for by #defines.. * * $Id: string.h,v 1.19 2007/07/04 03:22:36 aralbrec Exp $ */ #include // First a list of functions using CALLER and FASTCALL linkage extern int __LIB__ __FASTCALL__ strlen(char *); extern char __LIB__ *strcat(char *, char *); extern int __LIB__ strcmp(char *, char *); extern char __LIB__ *strcpy(char *, char *); extern char __LIB__ *strncat(char *, char *, uint); extern int __LIB__ strncmp(char *, char *, uint); extern char __LIB__ *strncpy(char *, char *, uint); extern char __LIB__ __FASTCALL__ *strrev(char *); extern char __LIB__ *strchr(unsigned char *, unsigned char); extern char __LIB__ *strrchr(unsigned char *, unsigned char); extern char __LIB__ *strrstrip(char *, char); extern char __LIB__ *strstrip(char *, uint); extern char __LIB__ *strstr(char *, char *); extern char __LIB__ *strrstr(char *, char *); extern char __LIB__ *strtok(char *, char *); extern char __LIB__ *strpbrk(char *, char *); extern int __LIB__ strpos(char *, uint); extern int __LIB__ strcspn(char *, char *); extern int __LIB__ strspn(char *, char *); extern int __LIB__ stricmp(char *, char *); extern int __LIB__ strcasecmp(char *, char *); extern int __LIB__ strnicmp(char *, char *, uint); extern int __LIB__ strncasecmp(char *, char *, uint); extern char __LIB__ __FASTCALL__ *strlwr(char *); extern char __LIB__ __FASTCALL__ *strupr(char *); extern void __LIB__ *memset(void *, unsigned char, uint); extern void __LIB__ *memcpy(void *, void *,uint); extern void __LIB__ *memmove(void *, void *, uint); extern void __LIB__ *memchr(void *, unsigned char, uint); extern int __LIB__ memcmp(void *, void *, uint); extern void __LIB__ *memswap(void *, void *, uint); extern void __LIB__ *memopi(void *, void *, uint, uint); extern void __LIB__ *memopd(void *, void *, uint, uint); extern char __LIB__ __FASTCALL__ *strdup(char *); // And now a list of the same non-FASTCALL functions using CALLEE linkage extern char __LIB__ __CALLEE__ *strcat_callee(char *, char *); extern int __LIB__ __CALLEE__ strcmp_callee(char *, char *); extern char __LIB__ __CALLEE__ *strcpy_callee(char *, char *); extern char __LIB__ __CALLEE__ *strncat_callee(char *, char *, uint); extern int __LIB__ __CALLEE__ strncmp_callee(char *, char *, uint); extern char __LIB__ __CALLEE__ *strncpy_callee(char *, char *, uint); extern char __LIB__ __CALLEE__ *strchr_callee(unsigned char *, unsigned char); extern char __LIB__ __CALLEE__ *strrchr_callee(unsigned char *, unsigned char); extern char __LIB__ __CALLEE__ *strrstrip_callee(char *, char); extern char __LIB__ __CALLEE__ *strstrip_callee(char *, uint); extern char __LIB__ __CALLEE__ *strstr_callee(char *, char *); extern char __LIB__ __CALLEE__ *strrstr_callee(char *, char *); extern char __LIB__ __CALLEE__ *strtok_callee(char *, char *); extern char __LIB__ __CALLEE__ *strpbrk_callee(char *, char *); extern int __LIB__ __CALLEE__ strpos_callee(char *, uint); extern int __LIB__ __CALLEE__ strcspn_callee(char *, char *); extern int __LIB__ __CALLEE__ strspn_callee(char *, char *); extern int __LIB__ __CALLEE__ stricmp_callee(char *, char *); extern int __LIB__ __CALLEE__ strnicmp_callee(char *, char *, uint); extern void __LIB__ __CALLEE__ *memset_callee(void *, unsigned char, uint); extern void __LIB__ __CALLEE__ *memcpy_callee(void *, void *,uint); extern void __LIB__ __CALLEE__ *memmove_callee(void *, void *, uint); extern void __LIB__ __CALLEE__ *memchr_callee(void *, unsigned char, uint); extern int __LIB__ __CALLEE__ memcmp_callee(void *, void *, uint); extern void __LIB__ __CALLEE__ *memswap_callee(void *, void *, uint); extern void __LIB__ __CALLEE__ *memopi_callee(void *, void *, uint, uint); extern void __LIB__ __CALLEE__ *memopd_callee(void *, void *, uint, uint); // And now we make CALLEE linkage default to make compiled progs shorter and faster // These defines will generate warnings for function pointers but that's ok #define strcat(a,b) strcat_callee(a,b) #define strcmp(a,b) strcmp_callee(a,b) #define strcpy(a,b) strcpy_callee(a,b) #define strncat(a,b,c) strncat_callee(a,b,c) #define strncmp(a,b,c) strncmp_callee(a,b,c) #define strncpy(a,b,c) strncpy_callee(a,b,c) #define strchr(a,b) strchr_callee(a,b) #define strrchr(a,b) strrchr_callee(a,b) #define strrstrip(a,b) strrstrip_callee(a,b) #define strstrip(a,b) strstrip_callee(a,b) #define strstr(a,b) strstr_callee(a,b) #define strrstr(a,b) strrstr_callee(a,b) #define strtok(a,b) strtok_callee(a,b) #define strpbrk(a,b) strpbrk_callee(a,b) #define strpos(a,b) strpos_callee(a,b) #define strcspn(a,b) strcspn_callee(a,b) #define strspn(a,b) strspn_callee(a,b) #define stricmp(a,b) stricmp_callee(a,b) #define strnicmp(a,b,c) strnicmp_callee(a,b,c) #define strcasecmp(a,b) stricmp_callee(a,b) #define strncasecmp(a,b,c) strnicmp_callee(a,b,c) #define memset(a,b,c) memset_callee(a,b,c) #define memcpy(a,b,c) memcpy_callee(a,b,c) #define memmove(a,b,c) memmove_callee(a,b,c) #define memchr(a,b,c) memchr_callee(a,b,c) #define memcmp(a,b,c) memcmp_callee(a,b,c) #define memswap(a,b,c) memswap_callee(a,b,c) #define memopi(a,b,c,d) memopi_callee(a,b,c,d) #define memopd(a,b,c,d) memopd_callee(a,b,c,d) /* * Now handle far stuff */ #ifdef FARDATA #define strlen(s) strlen_far(s) extern int __LIB__ strlen_far(far char *); #undef strcat #define strcat(s1,s2) strcat_far(s1,s2) extern far char __LIB__ *strcat_far(far char *, far char *); #undef strcpy #define strcpy(s1,s2) strcpy_far(s1,s2) extern far char __LIB__ *strcpy_far(far char *, far char *); #undef strncat #define strncat(s1,s2) strncat_far(s1,s2,n) extern far char __LIB__ *strncat_far(far char *, far char *, int); #undef strncpy #define strncpy(s1,s2) strncpy_far(s1,s2,n) extern far char __LIB__ *strncpy_far(far char *, far char *, int); #define strlwr(s) strlwr_far(s) extern far char __LIB__ *strlwr_far(far char *); #define strupr(s) strupr_far(s) extern far char __LIB__ *strupr_far(far char *); #undef strchr #define strchr(s,c) strchr_far(s1,c) extern far char __LIB__ *strchr_far(far unsigned char *, unsigned char); #undef strrchr #define strrchr(s,c) strrchr_far(s1,c) extern far char __LIB__ *strrchr_far(far unsigned char *, unsigned char); #define strdup(s) strdup_far(s) extern far char __LIB__ *strdup_far(far char *); #endif /* * Okay..some nice BSD-isms now.. */ extern void __LIB__ *bzero(void *, uint); extern int __LIB__ bcmp(void *, void *, uint); extern void __LIB__ *bcopy(void *, void *,uint); extern char __LIB__ *index(unsigned char *, unsigned char); extern char __LIB__ *rindex(unsigned char *, unsigned char); #define bzero(s,n) memset_callee(s,0,n) #define bcmp(s1,s2,n) memcmp_callee(s1,s2,n) #define bcopy(s,d,l) memcpy_callee(d,s,l) #define index(s,b) strchr_callee(s,b) #define rindex(s,b) strrchr_callee(s,b) #endif z88dk-1.8.ds1/include/strings.h0000644000175000017500000000002607130401715015765 0ustar tygrystygrys #include z88dk-1.8.ds1/include/sys/0000755000175000017500000000000010765202715014752 5ustar tygrystygrysz88dk-1.8.ds1/include/sys/stat.h0000644000175000017500000000463107363076310016102 0ustar tygrystygrys#ifndef __SYS_STAT_H__ #define __SYS_STAT_H__ /* We need some time stuff */ #include /* * Defines and stuff for the stat functions. * We try to be good and emulate as much a possible * Hence all these silly defs! * * $Id: stat.h,v 1.3 2001/10/16 18:30:32 dom Exp $ */ struct stat { int st_mode; /* Mode */ time_t st_atime; /* Last access */ time_t st_mtime; /* Last modification */ time_t st_ctime; /* Last change?!?! */ long st_size; /* Size */ /* These two based on real values */ int st_blksize; /* Blocksize */ int st_blocks; /* # of blocks */ /* Below here is fake */ int st_ino; /* Inode */ int st_uid; /* UID (not supported) */ int st_gid; /* GID (not supported) */ int st_dev; /* Device number */ int st_nlink; /* number of links */ int st_rdev; /* ? */ }; extern int __LIB__ stat(char *filename, struct stat *buf); #define S_IFMT 0170000 /* file type mask */ #define S_IFLNK 0110000 /* symbolic link */ #define S_IFREG 0100000 /* or just 000000, regular */ #define S_IFBLK 0060000 /* block special */ #define S_IFDIR 0040000 /* directory */ #define S_IFCHR 0020000 /* character special */ #define S_IFPIPE 0010000 /* pipe */ #define S_UMASK 07777 /* bits modifiable by chmod */ #define S_ISUID 04000 /* set euid to file uid */ #define S_ISGID 02000 /* set egid to file gid */ #define S_ISVTX 01000 /* */ #define S_IREAD 0400 /* owner may read */ #define S_IWRITE 0200 /* owner may write */ #define S_IEXEC 0100 /* owner may execute */ #define S_IGREAD 0040 /* group may read */ #define S_IGWRITE 0020 /* group may write */ #define S_IGEXEC 0010 /* group may execute */ #define S_IOREAD 0004 /* other may read */ #define S_IOWRITE 0002 /* other may write */ #define S_IOEXEC 0001 /* other may execute */ #define S_IRWXU 00700 #define S_IRUSR 00400 #define S_IWUSR 00200 #define S_IXUSR 00100 #define S_IRWXG 00070 #define S_IRGRP 00040 #define S_IWGRP 00020 #define S_IXGRP 00010 #define S_IRWXO 00007 #define S_IROTH 00004 #define S_IWOTH 00002 #define S_IXOTH 00001 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) #define S_ISPIPE(m) (((m) & S_IFMT) == S_IFPIPE) #define S_ISDEV(m) (((m) & S_IFMT) & S_IFCHR) #endif z88dk-1.8.ds1/include/sys/types.h0000644000175000017500000000325710540744226016275 0ustar tygrystygrys/* The header contains important data type definitions. * It is considered good programming practice to use these definitions, * instead of the underlying base type. By convention, all type names end * with _t. * * $Id: types.h,v 1.5 2006/12/16 10:21:10 aralbrec Exp $ */ #ifndef __SYS_TYPES_H__ #define __SYS_TYPES_H__ #ifndef _SIZE_T #define _SIZE_T typedef unsigned int size_t; #endif #ifndef _SSIZE_T #define _SSIZE_T typedef signed int ssize_t; #endif #ifndef _CLOCK_T #define _CLOCK_T typedef unsigned long clock_t; #endif #ifndef _PID_T #define _PID_T typedef signed int pid_t; #endif #ifndef _BOOL_T #define _BOOT_T typedef unsigned char bool_t; #endif #ifndef _TIME_T #define _TIME_T typedef long time_t; #endif #ifndef _WILD_T #define _WILD_T typedef short wild_t; #endif #ifndef _FPOS_T #define _FPOS_T typedef unsigned long fpos_t; #endif typedef unsigned char u8_t; /* 8 bit type */ typedef unsigned short u16_t; /* 16 bit type */ typedef unsigned long u32_t; /* 32 bit type */ typedef char i8_t; /* 8 bit signed type */ typedef short i16_t; /* 16 bit signed type */ typedef long i32_t; /* 32 bit signed type */ /* use of following is deprecated, a stopgap because some libraries use it */ #ifndef _T_UCHAR #define _T_UCHAR typedef unsigned char uchar; /* 8 bit unsigned char */ #endif #ifndef _T_UINT #define _T_UINT /* this is especially wrong, don't use */ typedef unsigned int uint; /* 16 bit unsigned int */ #endif /* this makes converting MINIX sources a little bit easier */ #ifndef _PROTOTYPE #define _PROTOTYPE(x,y) x y #endif #endif /* _TYPES_H */ z88dk-1.8.ds1/include/ti/0000755000175000017500000000000010765202715014550 5ustar tygrystygrysz88dk-1.8.ds1/include/ti/ti82.h0000644000175000017500000000025110717327275015513 0ustar tygrystygrys/* Control file for include Ti82 related things */ /* $Id: ti82.h,v 1.1 2007/11/16 14:52:45 stefano Exp $ */ #ifndef __TICALC_H__ #define __TICALC_H__ #endif z88dk-1.8.ds1/include/ti/ti83.h0000644000175000017500000000025110717327275015514 0ustar tygrystygrys/* Control file for include Ti83 related things */ /* $Id: ti83.h,v 1.1 2007/11/16 14:52:45 stefano Exp $ */ #ifndef __TICALC_H__ #define __TICALC_H__ #endif z88dk-1.8.ds1/include/ti/ti85.h0000644000175000017500000000025110717327275015516 0ustar tygrystygrys/* Control file for include Ti85 related things */ /* $Id: ti85.h,v 1.1 2007/11/16 14:52:45 stefano Exp $ */ #ifndef __TICALC_H__ #define __TICALC_H__ #endif z88dk-1.8.ds1/include/ti/ti86.h0000644000175000017500000000025110717327275015517 0ustar tygrystygrys/* Control file for include Ti86 related things */ /* $Id: ti86.h,v 1.1 2007/11/16 14:52:45 stefano Exp $ */ #ifndef __TICALC_H__ #define __TICALC_H__ #endif z88dk-1.8.ds1/include/ti/ti8x.h0000644000175000017500000000025610717327275015626 0ustar tygrystygrys/* Control file for include Ti83 Plus related things */ /* $Id: ti8x.h,v 1.1 2007/11/16 14:52:45 stefano Exp $ */ #ifndef __TICALC_H__ #define __TICALC_H__ #endif z88dk-1.8.ds1/include/ti.h0000644000175000017500000000541310717327275014732 0ustar tygrystygrys/* Control file for include relevent TIXX stuff */ /* $Id: ti.h,v 1.4 2007/11/16 14:52:45 stefano Exp $ */ #ifndef __TICALC_H__ #define __TICALC_H__ #include #ifdef __TI82__ #include #endif #ifdef __TI83__ #include #endif #ifdef __TI8x__ #include #endif #ifdef __TI83p__ #include #endif #ifdef __TI85__ #include #endif #ifdef __TI86__ #include #endif /* Variable types */ #if defined __TI85__ || defined __TI86__ #define RealObj 0x00 /* Real number */ #define CplxObj 0x01 /* Complex number */ #define RealVect 0x02 /* Real Vector */ #define CplxVect 0x03 /* Complex Vector */ #define ListObj 0x04 /* List of Real Nums */ #define CListObj 0x05 /* List of Complex N */ #define MatObj 0x06 /* Matrix of Real N */ #define CplxMatObj 0x07 /* Matrix of Cplx N */ #define ConstObj 0x08 /* Constant Real */ #define CConstObj 0x09 /* Constant Complex */ #define EquObj 0x0A /* Equation */ #define RangeObj 0x0A /* Range */ #define StrngObj 0x0C /* String */ #define GDBObj 0x0D /* Graph DB standard */ #define PolGDBObj 0x0E /* Graph DB polar */ #define PolGDBParm 0x0F /* Graph DB parametric */ #define PolGDBDiff 0x10 /* Graph DB differential equation */ #define PictObj 0x11 /* Picture */ #define ProgObj 0x12 /* Program */ #define ConvObj 0x13 /* Conversion/Range */ #else #define RealObj 0x00 /* Real number */ #define ListObj 0x01 /* List */ #define MatObj 0x02 /* Matrix */ #define EquObj 0x03 /* Equation */ #define StrngObj 0x04 /* String */ #define ProgObj 0x05 /* Program */ #define ProtProgObj 0x06 /* Protected program */ #define PictObj 0x07 /* Picture */ #define GDBObj 0x08 /* Graph Database */ #define NewEquObj 0x0B /* New Equation */ #define CplxObj 0x0C /* Complex number */ #define CListObj 0x0D /* Complex list */ #define AppVarObj 0x15 /* AppVar */ #define TempProgObj 0x16 /* Temporary program */ #endif struct TI_FILE { u16_t first; /* first byte in file */ long size; /* file size */ long ptr; /* current location */ u16_t blsize; /* block (single variable) size */ }; /* Find a variable */ extern long __LIB__ ti_findvar (char objtype, char *filename); /* Delete a variable (file) */ extern int __LIB__ ti_removevar (char objtype, char *filename); #endif z88dk-1.8.ds1/include/time.h0000644000175000017500000000226210763607557015260 0ustar tygrystygrys/* * Small C+ Library * * time.h - Time related functions * * djm 9/1/2000 * * $Id: time.h,v 1.10 2008/03/05 21:08:37 dom Exp $ */ #ifndef __TIME_H__ #define __TIME_H__ #include #ifdef __NEWBRAIN__ #define CLOCKS_PER_SEC 50 #endif #ifdef __SPECTRUM__ #define CLOCKS_PER_SEC 50 #endif #ifdef __SAM__ #define CLOCKS_PER_SEC 50 #endif #ifdef __ZX81__ #define CLOCKS_PER_SEC 50 #endif #ifdef __Z88__ #define CLOCKS_PER_SEC 100 #endif #ifndef CLOCKS_PER_SEC #define CLOCKS_PER_SEC 50 #endif extern time_t __LIB__ time(time_t *); struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; /* * These routines fill in the structure above using the value * supplied in t (usu obtained from time() * * These two really do the same since the z88 has no concept * of timezones */ extern struct tm __LIB__ *gmtime(time_t *t); extern struct tm __LIB__ *localtime(time_t *t); extern time_t __LIB__ mktime(struct tm *tp); /* This is a really simple fn which will barf over midnight,.. */ #ifndef FAKECLOCK extern clock_t __LIB__ clock(void); #endif #endif /* _TIME_H */ z88dk-1.8.ds1/include/ts2068.h0000644000175000017500000000070110757251317015254 0ustar tygrystygrys #ifndef __TS2068_H__ #define __TS2068_H__ #include #include // for now anyway /////////////////// // SET VIDEO MODE /////////////////// #define VMOD_SPEC 0 // 256x192 pix, 32x24 attr #define VMOD_HICLR 2 // 256x192 pix, 32x192 attr #define VMOD_HIRES 6 // 512x192 pix #define VMOD_DFILE0 0 #define VMOD_DFILE1 1 extern void __LIB__ __FASTCALL__ ts_vmod(uchar mode); #endif z88dk-1.8.ds1/include/vz.h0000644000175000017500000000505010552124766014747 0ustar tygrystygrys#ifndef _VZ #define _VZ // VZ Specific Library // 01.2007 aralbrec /***************************************************** Video Technology library for small C compiler Juergen Buchmueller *****************************************************/ // first CALLER and FASTCALL linkage extern void __LIB__ __FASTCALL__ vz_bgrd(int n); extern void __LIB__ vz_brick(void *addr, char byte); extern void __LIB__ vz_char_draw(int x, int y, int c, char ch); extern void __LIB__ vz_clrscr(void); extern void __LIB__ __FASTCALL__ vz_color(int n); extern int __LIB__ vz_getch(void); extern void __LIB__ vz_gotoxy(int x, int y); extern void __LIB__ vz_inch(void); extern void __LIB__ vz_line(int x1, int y1, int x2, int y2, int c); extern char __LIB__ *vz_midstr(char *str, int pos); extern void __LIB__ __FASTCALL__ vz_mode(int n); extern void __LIB__ vz_plot(int x, int y, int c); extern void __LIB__ vz_score(void *addr, char byte); extern void __LIB__ __FASTCALL__ vz_setbase(void *start); extern void __LIB__ vz_shape(int x, int y, int w, int h, int c, char *data); extern void __LIB__ vz_sound(int freq, int cycles); extern void __LIB__ vz_soundcopy(char *dst, char *src, int size, int sound1, int sound2); // CALLEE linkage for functions with at least two parameters extern void __LIB__ __CALLEE__ vz_brick_callee(void *addr, char byte); extern void __LIB__ __CALLEE__ vz_gotoxy_callee(int x, int y); extern void __LIB__ __CALLEE__ vz_line_callee(int x1, int y1, int x2, int y2, int c); extern char __LIB__ __CALLEE__ *vz_midstr_callee(char *str, int pos); extern void __LIB__ __CALLEE__ vz_plot_callee(int x, int y, int c); extern void __LIB__ __CALLEE__ vz_score_callee(void *addr, char byte); extern void __LIB__ __CALLEE__ vz_sound_callee(int freq, int cycles); extern void __LIB__ __CALLEE__ vz_soundcopy_callee(char *dst, char *src, int size, int sound1, int sound2); // make the CALLEE linkage default, function pointers will use CALLER linkage #define vz_brick(a,b) vz_brick_callee(a,b) #define vz_gotoxy(a,b) vz_gotoxy_callee(a,b) #define vz_line(a,b,c,d,e) vz_line_callee(a,b,c,d,e) #define vz_midstr(a,b) vz_midstr_callee(a,b) #define vz_plot(a,b,c) vz_plot_callee(a,b,c) #define vz_score(a,b) vz_score_callee(a,b) #define vz_sound(a,b) vz_sound_callee(a,b) #define vz_soundcopy(a,b,c,d,e) vz_soundcopy_callee(a,b,c,d,e) #endif z88dk-1.8.ds1/include/x11/0000755000175000017500000000000010765202715014545 5ustar tygrystygrysz88dk-1.8.ds1/include/x11/X.h0000755000175000017500000004652010732671607015143 0ustar tygrystygrys /* Definitions for the Z88DK X window system subset */ /* $Id: X.h,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #ifndef X_H #define X_H /*********************************************************** Modified for the Z88 Developement Kit by Stefano Bodrato - December, 2007 Copyright 1987, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ //typedef unsigned long XID; typedef int XID; //typedef unsigned long Time; typedef unsigned int Time; //typedef unsigned long Atom; /* Also in Xdefs.h */ typedef unsigned int Atom; typedef XID Window; typedef XID Drawable; typedef int Font; typedef XID Pixmap; typedef XID Cursor; typedef XID Colormap; typedef XID GContext; typedef XID KeySym; typedef unsigned char KeyCode; /***************************************************************** * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ #ifndef None #define None 0 /* universal null resource or null atom */ #endif #define ParentRelative 1 /* background pixmap in CreateWindow and ChangeWindowAttributes */ #define CopyFromParent 0 /* border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and special window class passed to CreateWindow */ #define PointerWindow 0 /* destination window in SendEvent */ #define InputFocus 1 /* destination window in SendEvent */ #define PointerRoot 1 /* focus window in SetInputFocus */ #define AnyPropertyType 0 /* special Atom, passed to GetProperty */ #define AnyKey 0 /* special Key Code, passed to GrabKey */ #define AnyButton 0 /* special Button Code, passed to GrabButton */ #define AllTemporary 0 /* special Resource ID passed to KillClient */ #define CurrentTime 0 /* special Time */ #define NoSymbol 0 /* special KeySym */ /***************************************************************** * EVENT DEFINITIONS *****************************************************************/ /* Input Event Masks. Used as event-mask window attribute and as arguments to Grab requests. Not to be confused with event names. */ #define NoEventMask 0L #define KeyPressMask 1L #define KeyReleaseMask 2L #define ButtonPressMask 4L #define ButtonReleaseMask 8L #define EnterWindowMask 16L #define LeaveWindowMask 32L #define PointerMotionMask 64L #define PointerMotionHintMask 128L #define Button1MotionMask 256L #define Button2MotionMask 512L #define Button3MotionMask 1024L #define Button4MotionMask 2048L #define Button5MotionMask 4096L #define ButtonMotionMask 8192L #define KeymapStateMask 16384L #define ExposureMask 32768L #define VisibilityChangeMask 65536L #define StructureNotifyMask 131072L #define ResizeRedirectMask 262144L #define SubstructureNotifyMask 524288L #define SubstructureRedirectMask 1048576L #define FocusChangeMask 2097152L #define PropertyChangeMask 4194304L #define ColormapChangeMask 8388608L #define OwnerGrabButtonMask 16777216L /* Event names. Used in "type" field in XEvent structures. Not to be confused with event masks above. They start from 2 because 0 and 1 are reserved in the protocol for errors and replies. */ #define KeyPress 2 #define KeyRelease 3 #define ButtonPress 4 #define ButtonRelease 5 #define MotionNotify 6 #define EnterNotify 7 #define LeaveNotify 8 #define FocusIn 9 #define FocusOut 10 #define KeymapNotify 11 #define Expose 12 #define GraphicsExpose 13 #define NoExpose 14 #define VisibilityNotify 15 #define CreateNotify 16 #define DestroyNotify 17 #define UnmapNotify 18 #define MapNotify 19 #define MapRequest 20 #define ReparentNotify 21 #define ConfigureNotify 22 #define ConfigureRequest 23 #define GravityNotify 24 #define ResizeRequest 25 #define CirculateNotify 26 #define CirculateRequest 27 #define PropertyNotify 28 #define SelectionClear 29 #define SelectionRequest 30 #define SelectionNotify 31 #define ColormapNotify 32 #define ClientMessage 33 #define MappingNotify 34 #define LASTEvent 35 /* must be bigger than any event # */ /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, state in various key-, mouse-, and button-related events. */ #define ShiftMask 1 #define LockMask 2 #define ControlMask 4 #define Mod1Mask 8 #define Mod2Mask 16 #define Mod3Mask 32 #define Mod4Mask 64 #define Mod5Mask 128 /* modifier names. Used to build a SetModifierMapping request or to read a GetModifierMapping request. These correspond to the masks defined above. */ #define ShiftMapIndex 0 #define LockMapIndex 1 #define ControlMapIndex 2 #define Mod1MapIndex 3 #define Mod2MapIndex 4 #define Mod3MapIndex 5 #define Mod4MapIndex 6 #define Mod5MapIndex 7 /* button masks. Used in same manner as Key masks above. Not to be confused with button names below. */ #define Button1Mask 256 #define Button2Mask 512 #define Button3Mask 1024 #define Button4Mask 2048 #define Button5Mask 4096 #define AnyModifier 32768 /* used in GrabButton, GrabKey */ /* button names. Used as arguments to GrabButton and as detail in ButtonPress and ButtonRelease events. Not to be confused with button masks above. Note that 0 is already defined above as "AnyButton". */ #define Button1 1 #define Button2 2 #define Button3 3 #define Button4 4 #define Button5 5 /* Notify modes */ #define NotifyNormal 0 #define NotifyGrab 1 #define NotifyUngrab 2 #define NotifyWhileGrabbed 3 #define NotifyHint 1 /* for MotionNotify events */ /* Notify detail */ #define NotifyAncestor 0 #define NotifyVirtual 1 #define NotifyInferior 2 #define NotifyNonlinear 3 #define NotifyNonlinearVirtual 4 #define NotifyPointer 5 #define NotifyPointerRoot 6 #define NotifyDetailNone 7 /* Visibility notify */ #define VisibilityUnobscured 0 #define VisibilityPartiallyObscured 1 #define VisibilityFullyObscured 2 /* Circulation request */ #define PlaceOnTop 0 #define PlaceOnBottom 1 /* protocol families */ #define FamilyInternet 0 /* IPv4 */ #define FamilyDECnet 1 #define FamilyChaos 2 #define FamilyInternet6 6 /* IPv6 */ /* authentication families not tied to a specific protocol */ #define FamilyServerInterpreted 5 /* Property notification */ #define PropertyNewValue 0 #define PropertyDelete 1 /* Color Map notification */ #define ColormapUninstalled 0 #define ColormapInstalled 1 /* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */ #define GrabModeSync 0 #define GrabModeAsync 1 /* GrabPointer, GrabKeyboard reply status */ #define GrabSuccess 0 #define AlreadyGrabbed 1 #define GrabInvalidTime 2 #define GrabNotViewable 3 #define GrabFrozen 4 /* AllowEvents modes */ #define AsyncPointer 0 #define SyncPointer 1 #define ReplayPointer 2 #define AsyncKeyboard 3 #define SyncKeyboard 4 #define ReplayKeyboard 5 #define AsyncBoth 6 #define SyncBoth 7 /* Used in SetInputFocus, GetInputFocus */ #define RevertToNone (int)None #define RevertToPointerRoot (int)PointerRoot #define RevertToParent 2 /***************************************************************** * ERROR CODES *****************************************************************/ #define Success 0 /* everything's okay */ #define BadRequest 1 /* bad request code */ #define BadValue 2 /* int parameter out of range */ #define BadWindow 3 /* parameter not a Window */ #define BadPixmap 4 /* parameter not a Pixmap */ #define BadAtom 5 /* parameter not an Atom */ #define BadCursor 6 /* parameter not a Cursor */ #define BadFont 7 /* parameter not a Font */ #define BadMatch 8 /* parameter mismatch */ #define BadDrawable 9 /* parameter not a Pixmap or Window */ #define BadAccess 10 /* depending on context: - key/button already grabbed - attempt to free an illegal cmap entry - attempt to store into a read-only color map entry. - attempt to modify the access control list from other than the local host. */ #define BadAlloc 11 /* insufficient resources */ #define BadColor 12 /* no such colormap */ #define BadGC 13 /* parameter not a GC */ #define BadIDChoice 14 /* choice not in range or already used */ #define BadName 15 /* font or color name doesn't exist */ #define BadLength 16 /* Request length incorrect */ #define BadImplementation 17 /* server is defective */ #define FirstExtensionError 128 #define LastExtensionError 255 /***************************************************************** * WINDOW DEFINITIONS *****************************************************************/ /* Window classes used by CreateWindow */ /* Note that CopyFromParent is already defined as 0 above */ #define InputOutput 1 #define InputOnly 2 /* Window attributes for CreateWindow and ChangeWindowAttributes */ #define CWBackPixmap 1 #define CWBackPixel 2 #define CWBorderPixmap 4 #define CWBorderPixel 8 #define CWBitGravity 16 #define CWWinGravity 32 #define CWBackingStore 64 #define CWBackingPlanes 128 #define CWBackingPixel 256 #define CWOverrideRedirect 512 #define CWSaveUnder 1024 #define CWEventMask 2048 #define CWDontPropagate 4096 #define CWColormap 8192 #define CWCursor 16384 /* ConfigureWindow structure */ #define CWX 1 #define CWY 2 #define CWWidth 4 #define CWHeight 8 #define CWBorderWidth 16 #define CWSibling 32 #define CWStackMode 64 /* Bit Gravity */ #define ForgetGravity 0 #define NorthWestGravity 1 #define NorthGravity 2 #define NorthEastGravity 3 #define WestGravity 4 #define CenterGravity 5 #define EastGravity 6 #define SouthWestGravity 7 #define SouthGravity 8 #define SouthEastGravity 9 #define StaticGravity 10 /* Window gravity + bit gravity above */ #define UnmapGravity 0 /* Used in CreateWindow for backing-store hint */ #define NotUseful 0 #define WhenMapped 1 #define Always 2 /* Used in GetWindowAttributes reply */ #define IsUnmapped 0 #define IsUnviewable 1 #define IsViewable 2 /* Used in ChangeSaveSet */ #define SetModeInsert 0 #define SetModeDelete 1 /* Used in ChangeCloseDownMode */ #define DestroyAll 0 #define RetainPermanent 1 #define RetainTemporary 2 /* Window stacking method (in configureWindow) */ #define Above 0 #define Below 1 #define TopIf 2 #define BottomIf 3 #define Opposite 4 /* Circulation direction */ #define RaiseLowest 0 #define LowerHighest 1 /* Property modes */ #define PropModeReplace 0 #define PropModePrepend 1 #define PropModeAppend 2 /***************************************************************** * GRAPHICS DEFINITIONS *****************************************************************/ /* graphics functions, as in GC.alu */ #define GXclear 0x0 /* 0 */ #define GXand 0x1 /* src AND dst */ #define GXandReverse 0x2 /* src AND NOT dst */ #define GXcopy 0x3 /* src */ #define GXandInverted 0x4 /* NOT src AND dst */ #define GXnoop 0x5 /* dst */ #define GXxor 0x6 /* src XOR dst */ #define GXor 0x7 /* src OR dst */ #define GXnor 0x8 /* NOT src AND NOT dst */ #define GXequiv 0x9 /* NOT src XOR dst */ #define GXinvert 0xa /* NOT dst */ #define GXorReverse 0xb /* src OR NOT dst */ #define GXcopyInverted 0xc /* NOT src */ #define GXorInverted 0xd /* NOT src OR dst */ #define GXnand 0xe /* NOT src OR NOT dst */ #define GXset 0xf /* 1 */ /* LineStyle */ #define LineSolid 0 #define LineOnOffDash 1 #define LineDoubleDash 2 /* capStyle */ #define CapNotLast 0 #define CapButt 1 #define CapRound 2 #define CapProjecting 3 /* joinStyle */ #define JoinMiter 0 #define JoinRound 1 #define JoinBevel 2 /* fillStyle */ #define FillSolid 0 #define FillTiled 1 #define FillStippled 2 #define FillOpaqueStippled 3 /* fillRule */ #define EvenOddRule 0 #define WindingRule 1 /* subwindow mode */ #define ClipByChildren 0 #define IncludeInferiors 1 /* SetClipRectangles ordering */ #define Unsorted 0 #define YSorted 1 #define YXSorted 2 #define YXBanded 3 /* CoordinateMode for drawing routines */ #define CoordModeOrigin 0 /* relative to the origin */ #define CoordModePrevious 1 /* relative to previous point */ /* Polygon shapes */ #define Complex 0 /* paths may intersect */ #define Nonconvex 1 /* no paths intersect, but not convex */ #define Convex 2 /* wholly convex */ /* Arc modes for PolyFillArc */ #define ArcChord 0 /* join endpoints of arc */ #define ArcPieSlice 1 /* join endpoints to center of arc */ /* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into GC.stateChanges */ #define GCFunction 1 #define GCPlaneMask 2 #define GCForeground 4 #define GCBackground 8 #define GCLineWidth 16 #define GCLineStyle 32 #define GCCapStyle 64 #define GCJoinStyle 128 #define GCFillStyle 256 #define GCFillRule 512 #define GCTile 1024 #define GCStipple 2048 #define GCTileStipXOrigin 4096 #define GCTileStipYOrigin 8192 #define GCFont 16384 #define GCSubwindowMode 32768 /* #define GCGraphicsExposures 65536L #define GCClipXOrigin 131072L #define GCClipYOrigin 262144L #define GCClipMask 524288L #define GCDashOffset 1048576L #define GCDashList 2097152L #define GCArcMode 4194304L */ #define GCLastBit 22 /***************************************************************** * FONTS *****************************************************************/ /* used in QueryFont -- draw direction */ #define FontLeftToRight 0 #define FontRightToLeft 1 #define FontChange 255 /***************************************************************** * IMAGING *****************************************************************/ /* ImageFormat -- PutImage, GetImage */ #define XYBitmap 0 /* depth 1, XYFormat */ #define XYPixmap 1 /* depth == drawable depth */ #define ZPixmap 2 /* depth == drawable depth */ /***************************************************************** * COLOR MAP STUFF *****************************************************************/ /* For CreateColormap */ #define AllocNone 0 /* create map with no entries */ #define AllocAll 1 /* allocate entire map writeable */ /* Flags used in StoreNamedColor, StoreColors */ #define DoRed 1 #define DoGreen 2 #define DoBlue 4 /***************************************************************** * CURSOR STUFF *****************************************************************/ /* QueryBestSize Class */ #define CursorShape 0 /* largest size that can be displayed */ #define TileShape 1 /* size tiled fastest */ #define StippleShape 2 /* size stippled fastest */ /***************************************************************** * KEYBOARD/POINTER STUFF *****************************************************************/ #define AutoRepeatModeOff 0 #define AutoRepeatModeOn 1 #define AutoRepeatModeDefault 2 #define LedModeOff 0 #define LedModeOn 1 /* masks for ChangeKeyboardControl */ #define KBKeyClickPercent 1 #define KBBellPercent 2 #define KBBellPitch 4 #define KBBellDuration 8 #define KBLed 16 #define KBLedMode 32 #define KBKey 64 #define KBAutoRepeatMode 128 #define MappingSuccess 0 #define MappingBusy 1 #define MappingFailed 2 #define MappingModifier 0 #define MappingKeyboard 1 #define MappingPointer 2 /***************************************************************** * SCREEN SAVER STUFF *****************************************************************/ #define DontPreferBlanking 0 #define PreferBlanking 1 #define DefaultBlanking 2 #define DisableScreenSaver 0 #define DisableScreenInterval 0 #define DontAllowExposures 0 #define AllowExposures 1 #define DefaultExposures 2 /* for ForceScreenSaver */ #define ScreenSaverReset 0 #define ScreenSaverActive 1 /***************************************************************** * HOSTS AND CONNECTIONS *****************************************************************/ /* for ChangeHosts */ #define HostInsert 0 #define HostDelete 1 /* for ChangeAccessControl */ #define EnableAccess 1 #define DisableAccess 0 /* Display classes used in opening the connection * Note that the statically allocated ones are even numbered and the * dynamically changeable ones are odd numbered */ #define StaticGray 0 #define GrayScale 1 #define StaticColor 2 #define PseudoColor 3 #define TrueColor 4 #define DirectColor 5 /* Byte order used in imageByteOrder and bitmapBitOrder */ #define LSBFirst 0 #define MSBFirst 1 #endif /* X_H */ z88dk-1.8.ds1/include/x11/Xlib.h0000755000175000017500000005647310732671607015642 0ustar tygrystygrys/* * Xlib.h - Header definition and support file for the C subroutine * interface library (Xlib) to the X Window System Protocol (V11). * Structures and symbols starting with "_" are private to the library. */ /* $Id: Xlib.h,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #ifndef _XLIB_H_ #define _XLIB_H_ /* Modified for the Z88 Developement Kit by Stefano Bodrato - December, 2007 Copyright 1985, 1986, 1987, 1991, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ #define Bool int #define Status int #define True 1 #define False 0 //#define XlibSpecificationRelease 6 #define XlibSpecificationRelease 1 #ifndef _BUILDING_X #include #define __HAVESEED // foo thing to avoid errors #include #include // #include // #ifndef HPSIZE // #define HPSIZE 512 // HEAPSIZE(HPSIZE) // #endif #else #define GAME_DEVICES 1 // foo thing to avoid errors #include #endif #include #include // =============== DISPLAY ================ typedef struct _XDisplay { //XExtData *ext_data; // hook for extension to hang data //struct _XFreeFuncs *free_funcs; // internal free functions //int fd; // Network socket. //int conn_checker; // ugly thing used by _XEventsQueued int proto_major_version;// maj. version of server's X protocol int proto_minor_version;// minor version of server's X protocol char *vendor; // vendor of the server hardware XID resource_base; // resource ID base XID resource_mask; // resource ID mask bits XID resource_id; // allocator current ID int resource_shift; // allocator shift to correct bits int byte_order; // screen byte order, LSBFirst, MSBFirst int bitmap_unit; // padding and data requirements int bitmap_pad; // padding requirements on bitmaps int bitmap_bit_order; // LeastSignificant or MostSignificant int vnumber; // Xlib's X protocol version number. int release; // release of the server char *display_name; // "host:display" string used on this connect int default_screen; // default screen for operations unsigned long motion_buffer; // size of motion buffer unsigned long flags; // internal connection flags }; typedef struct _XDisplay Display; // =============== GRAPHICS CONTEXT ================ typedef struct { int function; /* logical operation */ //unsigned long plane_mask;/* plane mask */ int foreground; //unsigned long foreground;/* foreground pixel */ int background; //unsigned long background;/* background pixel */ int line_width; /* line width */ int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ int cap_style; /* CapNotLast, CapButt, CapRound, CapProjecting */ int join_style; /* JoinMiter, JoinRound, JoinBevel */ int fill_style; /* FillSolid, FillTiled, FillStippled, FillOpaeueStippled */ int fill_rule; /* EvenOddRule, WindingRule */ int arc_mode; /* ArcChord, ArcPieSlice */ Pixmap tile; /* tile pixmap for tiling operations */ Pixmap stipple; /* stipple 1 plane pixmap for stipping */ int ts_x_origin; /* offset for tile or stipple operations */ int ts_y_origin; Font font; /* default text font for text operations */ int subwindow_mode; /* ClipByChildren, IncludeInferiors */ Bool graphics_exposures;/* boolean, should exposures be generated */ int clip_x_origin; /* origin for clipping */ int clip_y_origin; Pixmap clip_mask; /* bitmap clipping; other calls for rects */ int dash_offset; /* patterned/dashed line information */ char dashes; } XGCValues; struct _XGC { //XExtData *ext_data; /* hook for extension to hang data */ GContext gid; /* protocol ID for graphics context */ Bool rects; /* boolean: TRUE if clipmask is list of rectangles */ Bool dashes; /* boolean: TRUE if dash-list is really a list */ //unsigned long dirty;/* cache dirty bits */ XGCValues values; /* shadow structure of values */ }; typedef struct _XGC GC; // =============== FONTS ================ /* * per character font metric information. */ typedef struct { //short lbearing; // origin to left edge of raster //short rbearing; // origin to right edge of raster short width; // advance to next char's origin short ascent; // baseline to top edge of raster short descent; // baseline to bottom edge of raster //unsigned short attributes; // per char flags (not predefined) } XCharStruct; struct _XFontStruct{ //typedef struct XFontStruct{ //XExtData *ext_data; // hook for extension to hang data Font fid; // Font id for this font /* unsigned direction; // hint about direction the font is painted unsigned min_char_or_byte2;// first character unsigned max_char_or_byte2;// last character unsigned min_byte1; // first row that exists unsigned max_byte1; // last row that exists Bool all_chars_exist;// flag if all characters have non-zero size unsigned default_char; // char to print for undefined character int n_properties; // how many properties there are //XFontProp *properties; // pointer to array of additional properties //XCharStruct min_bounds; // minimum bounds over all existing char //XCharStruct max_bounds; // maximum bounds over all existing char //XCharStruct *per_char; // first_char to last_char information //XFontProp *properties; // pointer to array of additional properties */ XCharStruct min_bounds; // minimum bounds over all existing char XCharStruct max_bounds; // maximum bounds over all existing char //XCharStruct *per_char; // first_char to last_char information /* int ascent; // log. extent above baseline for spacing int descent; // log. descent below baseline for spacing */ }; typedef struct _XFontStruct XFontStruct; // =============== EVENTS ================ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window it is reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ unsigned int keycode; /* detail */ Bool same_screen; /* same screen flag */ } XKeyEvent; typedef XKeyEvent XKeyPressedEvent; typedef XKeyEvent XKeyReleasedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window it is reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ unsigned int button; /* detail */ Bool same_screen; /* same screen flag */ } XButtonEvent; typedef XButtonEvent XButtonPressedEvent; typedef XButtonEvent XButtonReleasedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ char is_hint; /* detail */ Bool same_screen; /* same screen flag */ } XMotionEvent; typedef XMotionEvent XPointerMovedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ int detail; /* * NotifyAncestor, NotifyVirtual, NotifyInferior, * NotifyNonlinear,NotifyNonlinearVirtual */ Bool same_screen; /* same screen flag */ Bool focus; /* boolean focus */ unsigned int state; /* key or button mask */ } XCrossingEvent; typedef XCrossingEvent XEnterWindowEvent; typedef XCrossingEvent XLeaveWindowEvent; typedef struct { int type; /* FocusIn or FocusOut */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* window of event */ int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ int detail; /* * NotifyAncestor, NotifyVirtual, NotifyInferior, * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer, * NotifyPointerRoot, NotifyDetailNone */ } XFocusChangeEvent; typedef XFocusChangeEvent XFocusInEvent; typedef XFocusChangeEvent XFocusOutEvent; /* generated on EnterWindow and FocusIn when KeyMapState selected */ typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; char key_vector[32]; } XKeymapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; int x, y; int width, height; int count; /* if non-zero, at least this many more */ } XExposeEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Drawable drawable; int x, y; int width, height; int count; /* if non-zero, at least this many more */ int major_code; /* core is CopyArea or CopyPlane */ int minor_code; /* not defined in the core */ } XGraphicsExposeEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Drawable drawable; int major_code; /* core is CopyArea or CopyPlane */ int minor_code; /* not defined in the core */ } XNoExposeEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; int state; /* Visibility state */ } XVisibilityEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; /* parent of the window */ Window window; /* window id of window created */ int x, y; /* window location */ int width, height; /* size of window */ int border_width; /* border width */ Bool override_redirect; /* creation should be overridden */ } XCreateWindowEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; } XDestroyWindowEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; Bool from_configure; } XUnmapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; Bool override_redirect; /* boolean, is override set... */ } XMapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; Window window; } XMapRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; Window parent; int x, y; Bool override_redirect; } XReparentEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; int x, y; int width, height; int border_width; Window above; Bool override_redirect; } XConfigureEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; int x, y; } XGravityEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; int width, height; } XResizeRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; Window window; int x, y; int width, height; int border_width; Window above; int detail; /* Above, Below, TopIf, BottomIf, Opposite */ unsigned long value_mask; } XConfigureRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window event; Window window; int place; /* PlaceOnTop, PlaceOnBottom */ } XCirculateEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window parent; Window window; int place; /* PlaceOnTop, PlaceOnBottom */ } XCirculateRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Atom atom; Time time; int state; /* NewValue, Deleted */ } XPropertyEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Atom selection; Time time; } XSelectionClearEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window owner; Window requestor; Atom selection; Atom target; Atom property; Time time; } XSelectionRequestEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window requestor; Atom selection; Atom target; Atom property; /* ATOM or None */ Time time; } XSelectionEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Colormap colormap; /* COLORMAP or None */ Bool new; //#endif int state; /* ColormapInstalled, ColormapUninstalled */ } XColormapEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; Atom message_type; int format; union { char b[20]; short s[10]; long l[5]; } data; } XClientMessageEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* unused */ int request; /* one of MappingModifier, MappingKeyboard, MappingPointer */ int first_keycode; /* first keycode */ int count; /* defines range of change w. first_keycode*/ } XMappingEvent; typedef struct { int type; Display *display; /* Display the event was read from */ XID resourceid; /* resource id */ unsigned long serial; /* serial number of failed request */ unsigned char error_code; /* error code of failed request */ unsigned char request_code; /* Major op-code of failed request */ unsigned char minor_code; /* Minor op-code of failed request */ } XErrorEvent; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display;/* Display the event was read from */ Window window; /* window on which event was requested in event mask */ } XAnyEvent; /* * this union is defined so Xlib can always use the same sized * event structure internally, to avoid memory fragmentation. */ typedef union _XEvent { int type; // must not be changed; first element XAnyEvent xany; XKeyEvent xkey; XButtonEvent xbutton; XMotionEvent xmotion; XCrossingEvent xcrossing; XFocusChangeEvent xfocus; XExposeEvent xexpose; XGraphicsExposeEvent xgraphicsexpose; XNoExposeEvent xnoexpose; XVisibilityEvent xvisibility; XCreateWindowEvent xcreatewindow; XDestroyWindowEvent xdestroywindow; XUnmapEvent xunmap; XMapEvent xmap; XMapRequestEvent xmaprequest; XReparentEvent xreparent; XConfigureEvent xconfigure; XGravityEvent xgravity; XResizeRequestEvent xresizerequest; XConfigureRequestEvent xconfigurerequest; XCirculateEvent xcirculate; XCirculateRequestEvent xcirculaterequest; XPropertyEvent xproperty; XSelectionClearEvent xselectionclear; XSelectionRequestEvent xselectionrequest; XSelectionEvent xselection; XColormapEvent xcolormap; XClientMessageEvent xclient; XMappingEvent xmapping; XErrorEvent xerror; XKeymapEvent xkeymap; long pad[24]; } XEvent; typedef struct { Pixmap background_pixmap; /* background or None or ParentRelative */ // unsigned long background_pixel; /* background pixel */ int background_pixel; /* background pixel */ Pixmap border_pixmap; /* border of the window */ //unsigned long border_pixel; /* border pixel value */ int border_pixel; /* border pixel value */ int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ //unsigned long backing_planes;/* planes to be preseved if possible */ int backing_planes; /* planes to be preseved if possible */ //unsigned long backing_pixel;/* value to use in restoring planes */ int backing_pixel; /* value to use in restoring planes */ Bool save_under; /* should bits under be saved? (popups) */ //long event_mask; /* set of events that should be saved */ int event_mask; /* set of events that should be saved */ //long do_not_propagate_mask; /* set of events that should not propagate */ int do_not_propagate_mask; /* set of events that should not propagate */ Bool override_redirect; /* boolean value for override-redirect */ Colormap colormap; /* color map to be associated with window */ Cursor cursor; /* cursor to be displayed (or None) */ } XSetWindowAttributes; typedef struct { int x; int y; /* location of window */ int width; int height; /* width and height of window */ int border_width; /* border width of window */ int depth; /* depth of window */ //Visual *visual; /* the associated visual structure */ Window root; /* root of screen containing window */ //#if defined(__cplusplus) || defined(c_plusplus) // int c_class; /* C++ InputOutput, InputOnly*/ //#else int class; /* InputOutput, InputOnly*/ //#endif int bit_gravity; /* one of bit gravity values */ int win_gravity; /* one of the window gravity values */ int backing_store; /* NotUseful, WhenMapped, Always */ //unsigned long backing_planes;/* planes to be preserved if possible */ //unsigned long backing_pixel;/* value to be used when restoring planes */ int backing_pixel; Bool save_under; /* boolean, should bits under be saved? */ Colormap colormap; /* color map to be associated with window */ Bool map_installed; /* boolean, is color map currently installed*/ int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ //long all_event_masks; /* set of events all people have interest in*/ //long your_event_mask; /* my event mask */ //long do_not_propagate_mask; /* set of events that should not propagate */ int all_event_masks; int your_event_masks; int do_not_propagate_mask; Bool override_redirect; /* boolean value for override-redirect */ //Screen *screen; /* back pointer to correct screen */ } XWindowAttributes; #endif /* _XLIB_H_ */ z88dk-1.8.ds1/include/x11/Xos.h0000755000175000017500000000016110732671607015474 0ustar tygrystygrys/* $Id: Xos.h,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #ifndef _XOS_H_ #define _XOS_H_ #endif /* _XOS_H_ */ z88dk-1.8.ds1/include/x11/Xutil.h0000755000175000017500000000275210732671607016040 0ustar tygrystygrys/* $Id: Xutil.h,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #ifndef _XUTIL_H_ #define _XUTIL_H_ /* You must include before including this file */ #include typedef struct { long flags; /* marks which fields in this structure are defined */ int x, y; /* obsolete for new window mgrs, but clients */ int width, height; /* should set so old wm's don't mess up */ int min_width, min_height; int max_width, max_height; int width_inc, height_inc; struct { int x; /* numerator */ int y; /* denominator */ } min_aspect, max_aspect; int base_width, base_height; /* added by ICCCM version 1 */ int win_gravity; /* added by ICCCM version 1 */ } XSizeHints; /* * The next block of definitions are for window manager properties that * clients and applications use for communication. */ /* flags argument in size hints */ #define USPosition 1 /* user specified x, y */ #define USSize 2 /* user specified width, height */ #define PPosition 4 /* program specified position */ #define PSize 8 /* program specified size */ #define PMinSize 16 /* program specified minimum size */ #define PMaxSize 32 /* program specified maximum size */ #define PResizeInc 64 /* program specified resize increments */ #define PAspect 128 /* program specified min and max aspect ratios */ #define PBaseSize 256 /* program specified base for incrementing */ #define PWinGravity 512 /* program specified window gravity */ #endif /* XUTIL_H */ z88dk-1.8.ds1/include/x11/Xz88dk.h0000755000175000017500000001056110732671607016030 0ustar tygrystygrys/* $Id: Xz88dk.h,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #ifndef _XZ88DK_H_ #define _XZ88DK_H_ #include //#include //#include //#include #ifdef _BUILDING_X extern int _x_proportional; extern int _y_proportional; extern char *_xchar_proportional; extern int _X_int1; extern int _X_int2; extern int _X_int3; extern int _x_must_expose; #else int _x_proportional; int _y_proportional; char *_xchar_proportional; int _X_int1; int _X_int2; int _X_int3; int _x_must_expose=1; #endif /* Base X objects */ extern struct _XDisplay __LIB__ *XOpenDisplay(char *display_name); extern void __LIB__ XCloseDisplay(struct _XDisplay *display); extern int __LIB__ DefaultScreen(struct _XDisplay *display); extern int __LIB__ RootWindow(struct _XDisplay *display,int screen); extern Window __LIB__ XCreateSimpleWindow(struct _XDisplay *display, Window rootwindow, int x, int y, int width, int height, int border_width, int forecolor, int backcolor); extern int __LIB__ XDestroyWindow(struct _XDisplay *display, Window win); extern struct GC __LIB__ *XCreateGC(struct _XDisplay *display, Window win, int valuemask, int values); extern void __LIB__ XFreeGC(struct _XDisplay *display, struct _XGC gc); /* Base X objects properties */ extern char __LIB__ *XDisplayName(char *display_name); extern int __LIB__ DisplayWidth(struct _XDisplay *display,int screen); extern int __LIB__ DisplayHeight(struct _XDisplay *display,int screen); extern int __LIB__ DefaultDepth(struct _XDisplay *display,int screen); extern int __LIB__ BlackPixel(struct _XDisplay *display, int screen); extern int __LIB__ WhitePixel(struct _XDisplay *display, int screen); extern void __LIB__ XMapWindow(struct _XDisplay *display, Window win); extern void __LIB__ XSetForeground(struct _XDisplay *display, struct _XGC gc, int color); extern void __LIB__ XSetLineAttributes(struct _XDisplay *display, struct _XGC gc, int line_width, int line_style, int cap_style, int join_style); extern void __LIB__ XSetDashes(struct _XDisplay *display, struct _XGC gc, int dash_offset, int dash_list, int list_length); extern void __LIB__ XSetStandardProperties(struct _XDisplay *display, Window win, char *window_name, char *icon_name, char *icon_pixmap, char *argv, int argc, int size_hints); /* Events */ extern void __LIB__ XSelectInput(struct _XDisplay *display, Window win, int event_mask); extern void __LIB__ XNextEvent(struct _XDisplay *display, int *event); extern Bool __LIB__ XCheckWindowEvent(struct _XDisplay *display, Window win, int event_mask, int event); extern int __LIB__ XCheckTypedEvent(struct _XDisplay *display, int type, int event); extern int __LIB__ XFlush(struct _XDisplay *display); /* Text handling */ extern int __LIB__ XTextWidth(struct _XFontStruct *font_struct, char *string, int count); extern struct _XFontStruct __LIB__ XLoadQueryFont(struct _XDisplay *display, char *fontname); extern void __LIB__ XDrawString(struct _XDisplay *display, Window win, struct _XGC gc, int x, int y, char *text, int textlen); extern void __LIB__ XUnloadFont(struct _XDisplay *display, Font font); extern void __LIB__ XSetFont(struct _XDisplay *display, struct _XGC gc, Font font); /* Pictures handling */ extern Pixmap __LIB__ XCreateBitmapFromData(struct _XDisplay *display, Window win, char *bits, int width, int height); /* Graphics drawing functions */ // It could even work, but the window positioning offset ! //#define XDrawRectangle drawb extern void __LIB__ XDrawRectangle(struct _XDisplay *display, Window win, struct _XGC gc, int x, int y, int width, int height); extern void __LIB__ XDrawPoint(struct _XDisplay *display, Window win, struct _XGC gc, int x, int y); extern void __LIB__ XDrawLine(struct _XDisplay *display, Window win, struct _XGC gc, int x1, int y1, int x2, int y2); extern void __LIB__ XClearWindow(struct _XDisplay *display, Window win, struct _XGC gc, int x, int y, int width, int height, Bool Exposures); /* Internal declarations */ extern char __LIB__ *_xfindchar(char c, char *font); extern void __LIB__ _xfputc (char c, char *font, Bool bold); /* Internal structures */ struct _XWIN { int x; int y; int width; // Drawable area width int height; // Drawable area height int a_x; // area x pos int a_y; // area y pos int full_width; int full_height; char *title; char *icon; char *background; }; #endif /* _XZ88DK_H_ */ z88dk-1.8.ds1/include/z88.h0000644000175000017500000001200507460223666014742 0ustar tygrystygrys/* * This file contains pretty well all the z88 specific routines * Most of these will probably have no equivalent on any other * machine.. * * Link using -lz88 * * $Id: z88.h,v 1.5 2002/04/20 08:32:54 dom Exp $ */ #ifndef __Z88_H__ #define __Z88_H__ #include /* * Read and send mail */ extern int __LIB__ readmail(char *type, char *info, int length); extern int __LIB__ sendmail(char *type, char *info, int length); /* * Two defines for the system supported mail types */ #define FILEMAIL "NAME" #define DATEMAIL "DATE" /* * Look at dev notes for the significence of these */ extern int __LIB__ savescr(void); extern int __LIB__ restscr(int); extern int __LIB__ freescr(int); extern int __LIB__ pagewait(void); /* Do not use, causes error! */ /* * Next two calls aren't recommended! */ extern int __LIB__ di(void); extern void __LIB__ ei(int); /* * Name an application */ extern void __LIB__ nameapp(char *); /* * Some calls provided for by the packages system * * First of all types for the type in RegisterInt() * * All these return 0 on failure */ #define INT_TICK 1 #define INT_SEC 2 #define INT_MIN 4 #define INT_UART 8 extern int __LIB__ RegisterInt(void (*fn)(),char type , char tick); extern int __LIB__ DeRegisterInt(void); /* * Open a library/package, returns 0 on failure * Supply 0 to check if package handling is available * Specify major=minor=0 to disable version checking * */ extern bool_t __LIB__ QueryPackage(char which, char major, char minor); /* * Get the PID of a process */ extern pid_t __LIB__ getpid(void); /* * Macro for package calls directly in C code * (probably not useful..) */ #define CALL_PKG(b) asm("call_pkg ("#b")\n") /* * Some package names */ #define LIB_NONE 0x00 #define LIB_PACKAGE 0x0f #define LIB_XFS 0x12 #define LIB_TCP 0x15 #define LIB_TFTPD 0x18 #define LIB_EXAMPLE 0x45 /* * These routines are located in z88_crt0.lib cos stat() uses * them, but this seems a good place to define them */ extern int __LIB__ opendor(char *filename); extern void __LIB__ readdor(int dor, char type, char len, void *buf); extern void __LIB__ closedor(int dor); /* These are still in z88_crt0.lib though they're not referenced */ extern void __LIB__ writedor(int dor, char type, char len, void *buf); extern void __LIB__ deletedor(int dor); /* Return the son/brother of the dor, supply pointer to store minor type */ extern int __LIB__ sondor(int dor, char *store); extern int __LIB__ brotherdor(int dor, char *store); /* * Wildcard handler routines */ typedef struct wildcard_st { void *endptr; u8_t segments; u8_t length; u8_t dortype; } wildcard_t; /* Open a wildcard handler, * Returns handle * mode is the logical OR ( | ) of the defines below * Returns NULL if unable to comply */ #define WILD_SCANDIR 1 #define WILD_PARENTS 2 extern wild_t __LIB__ wcopen(far char *, int mode); /* Read the next entry from the wildcard handler /hand/ * Store it in /buf/ which has length /len/ * Put information about this entry in /st/ (supply NULL if not reqd * * Returns EOF if no more entries, NULL otherwise */ extern int __LIB__ wcnext(wild_t hand,void *buf, size_t len, wildcard_t *st); /* Close wildcard handler /hand/ * Returns NULL if closed okay EOF otherwise */ extern int __LIB__ wcclose(wild_t hand); /* Expand a filename */ extern char __LIB__ *fnexpand(far char *filename, char *buf, size_t buflen); #ifdef IFIXEDTHEMBUTWHY /* * Parsing of filename/segment * I've never used these (in either asm/C) but they're here * for completeness (I'm gleaning the devnotes ATM!) * * These routines return EOF on error */ /* Defines which the routines return (OR'd together) */ #define PRS_EXTN 1 #define PRS_FILE 2 #define PRS_XDIR 4 #define PRS_CDIR 8 #define PRS_PDIR 16 #define PRS_WDIR 32 #define PRS_DEV 64 #define PRS_WILD 128 /* Parse an extension return flags as per defines for the filename * segment /seg/ puts ptr to terminating char in buf */ extern int __LIB__ parseseg(far char *seg, far char **buf); /* Parse a filename return flags as per defines above for the * filename /file/ puts number of segments and length of filename * (including \0 in the wildcard structure /wild/ */ extern int __LIB__ parsefile(far char *seg, wildcard_t *wild); #endif /* * The call that you've all been waiting for! * * Execute a CLI string (NULL terminated of course!) * * Returns NULL on success */ extern int __LIB__ exec_cli(char *str); /* * Some routines from GWL now */ /* Returns a pointer to after the device */ extern char __LIB__ *stripdev(char *explicitname); /* Returns a pointer to the filename segment */ extern char __LIB__ *strippath(char *explicitname); /* Open a popup window */ extern void __LIB__ openpopup(int wid, int tlx, int tly, int width, int height, char *name); /* Open a window */ extern void __LIB__ openwindow(int wid, int tlx, int tly, int width, int height); /* Open a titled window */ extern void __LIB__ opentitled(int wid, int tlx, int tly, int width, int height, char *name); #endif /* Z88_H */ z88dk-1.8.ds1/include/z88stdio.h0000644000175000017500000000710207363076310016001 0ustar tygrystygrys#ifndef __Z88STDIO_H__ #define __Z88STDIO_H__ /* * This file contains a few useful functions from the original * z88dk stdio library * * All these operate on a file handle fd (as supplied by open) * (or by the fopen in this file * * If porting, don't bother with these - more hassle than they're * worth! * * Use these routines by #define FDSTDIO and linking with -lz88 * * Most of these return non-ANSI return values or are just very * slightly messed up! * * These routines are not supported!!! * * djm 4/4/2000 * * $Id: z88stdio.h,v 1.4 2001/10/16 18:30:32 dom Exp $ */ #include #include #ifndef NULL #define NULL ((void *)0) #endif #ifndef EOF #define EOF (-1) #endif #define FILE int extern FILE *_sgoioblk[3]; /* * Is 128 characters enough for a filename + path? * Comments please */ #define FILENAME_MAX 128 /* * Now stuff for stdin/out/err this block is in z88_crt0.asm */ #define stdin (_sgoioblk[0]) #define stdout (_sgoioblk[1]) #define stderr (_sgoioblk[2]) #define fopen(a,b) zfdopen(a,b) #define fopen_z88(a,b,c,d) zfdopen_z88(a,b,c,d) extern FILE __LIB__ *zfdopen(far char *name, char *mode); /* Open a file returning the explicit filename as well */ extern FILE __LIB__ *zfdopen_z88(far char *name, char *mode, char *explicit, size_t len); /* fclose() here is the same as close() in fcntl */ #define fclose(f) close((int)f) #define fgets(a,b,c) fdfgets(a,b,c) extern char __LIB__ *fdfgets(char *, int, FILE *); #define fputc(a,b) fdfputc(a,b) extern __LIB__ fdfputc(int , FILE *); #define fgetc(a,b) fdfgetc(a,b) extern int __LIB__ fdfgetc(FILE *); #define fputs(a,b) fdfputs(a,b) extern __LIB__ fdfputs(unsigned char *, FILE *); #define feof(a) fdfeof(a) extern __LIB__ fdfeof(FILE *); #define ftell(a) fdtell(a) extern long __LIB__ fdtell(FILE *); #define fgetpos(a,b) fdgetpos(a,b) extern int __LIB__ fdgetpos(FILE *,fpos_t *); /* These two returns are non-standard and return # of bytes read/written*/ #define fread(a,b,c,d) fdfread(a,b,c,d) extern int __LIB__ fdfread(void *, int, int, FILE *); #define fwrite(a,b,c,d) fdfwrite(a,b,c,d) extern int __LIB__ fdfwrite(void *, int, int, FILE *); /* Non-standard return values */ #define fsetpos(fp,pos) lseek(fp,pos,SEEK_SET) #define fseek(fp,pos,whence) lseek(fp,pos,whence) /* Our streams are unbuffered ATM */ #define fflush(a) /* gets is a macro, this may change in the future!! */ /* This is non-standard once more! Takes length, but ANSI says it * shouldn't */ #ifdef SPECTRUM extern int __LIB__ gets(unsigned char *, int); #else #define gets(s,n) fgets(s,n,stdin) #endif /* slightly more streamline putc now! */ #define putc(c) putc_cons(c) #define printn(a,b,c) fdprintn(a,b,c) extern __LIB__ fdprintn(int number, int radix,FILE *file); /* Same as for other library */ extern int __LIB__ remove(far char *); extern int __LIB__ rename(char *, char *); #define printf printk extern void __LIB__ printk(char *fmt,...); /* Keyboard operations */ extern char __LIB__ getk(void); #define getchar() fgetc_cons() #define getkey() fgetc_cons() #define getc() fgetc_cons() extern char __LIB__ fgetc_cons(void); /* Screen operations */ #define putchar(x) fputc_cons(x) extern __LIB__ fputc_cons(char); extern __LIB__ putn(int); #define puts(a) fdputs(a) extern __LIB__ fdputs(char *); extern __LIB__ settxy(int, int); /* * These functions are used for printf etc - don't use them yourself! */ #ifndef DEF_GETARG #define DEF_GETARG extern int __LIB__ getarg(void); #endif /* * Used by fread() and fwrite() to check the handle */ extern int __LIB__ fchkhdl(FILE *); #endif /* Z88STDIO_H */ z88dk-1.8.ds1/include/zx81.h0000644000175000017500000001123110727277402015120 0ustar tygrystygrys/* * Headerfile for ZX81 specific stuff * * $Id: zx81.h,v 1.9 2007/12/10 18:01:38 stefano Exp $ */ #ifndef __ZX81_H__ #define __ZX81_H__ #include ///////////// // CONSTANTS ///////////// // Basic Tokens #define TK_RND 64 #define TK_INKEYS 65 #define TK_PI 66 #define TK_DLBQUOTE 192 ; Strange behaviour for '""' #define TK_AT 193 #define TK_TAB 194 #define TK_CODE 196 #define TK_VAL 197 #define TK_LEN 198 #define TK_SIN 199 #define TK_COS 200 #define TK_TAN 201 #define TK_ASN 202 #define TK_ACS 203 #define TK_ATN 204 #define TK_LN 205 #define TK_EXP 206 #define TK_INT 207 #define TK_SQR 208 #define TK_SGN 209 #define TK_ABS 210 #define TK_PEEK 211 #define TK_USR 212 #define TK_STRS 213 #define TK_CHRS 214 #define TK_NOT 215 #define TK_STAR_STAR 216 #define TK_OR 217 #define TK_AND 218 #define TK_LEQ 219 #define TK_GEQ 220 #define TK_NEQ 221 #define TK_THEN 222 #define TK_TO 223 #define TK_STEP 224 #define TK_LPRINT 225 #define TK_LLIST 226 #define TK_STOP 227 #define TK_SLOW 228 #define TK_FAST 229 #define TK_NEW 230 #define TK_SCROLL 231 #define TK_CONTINUE 232 #define TK_CONT 232 #define TK_DIM 233 #define TK_REM 234 #define TK_FOR 235 #define TK_GO_TO 236 #define TK_GO_SUB 237 #define TK_INPUT 238 #define TK_LOAD 239 #define TK_LIST 240 #define TK_LET 241 #define TK_PAUSE 242 #define TK_NEXT 243 #define TK_POKE 244 #define TK_PRINT 245 #define TK_PLOT 246 #define TK_RUN 247 #define TK_SAVE 248 #define TK_RANDOMIZE 249 #define TK_RAND 249 #define TK_IF 250 #define TK_CLS 251 #define TK_UNPLOT 252 #define TK_CLEAR 253 #define TK_RETURN 254 #define TK_COPY 255 ///////////////////////////////// // HIGH RESOLUTION RELATED STUFF ///////////////////////////////// // graphics page extern int base_graphics; // direct call for "clear graphics page" extern void __LIB__ _clg_hr(); // Enable/disable High Resolution Graphics mode extern void __LIB__ hrg_off(); extern void __LIB__ hrg_on(); // Copies text to HRG screen extern void __LIB__ __FASTCALL__ copytxt(int ovmode); // modes for copytxt #define txt_and 47 // AND (HL) #define txt_and_cpl 47+166*256 // AND (HL) - CPL #define txt_or 182 // OR (HL) #define txt_xor 174 // XOR (HL) #define txt_or_r 31+182*256 // RRA - OR (HL) #define txt_or_l 23+182*256 // RLA - OR (HL) #define txt_and_r 31+47*256 // RRA - AND (HL) #define txt_and_l 23+47*256 // RLA - AND (HL) ////////////////// // MISC FUNCTIONS ////////////////// // Invert screen in text mode extern void __LIB__ invtxt(); // Mirror screen in text mode extern void __LIB__ mirrortxt(); // Activates / Deactivates the ZX81 <-> ASCII converter, // used in some output routine and interfacing to the BASIC strings extern void __LIB__ __FASTCALL__ zx_asciimode(); // ZX81 <-> ASCII char conversion extern char __LIB__ zx_ascii(char character); // ASCII <-> ZX81 char conversion extern char __LIB__ ascii_zx(char character); // FAST / SLOW mode switching, available only if startup >= 2 extern void __LIB__ zx_fast(); extern void __LIB__ zx_slow(); /////////////////////////////////////////// // DIAGNOSTICS AND HARDWARE IDENTIFICATION /////////////////////////////////////////// extern int __LIB__ zx_basic_length(void); extern int __LIB__ zx_var_length(void); /////////////////////////////// // INTERFACE FOR CALLING BASIC /////////////////////////////// // extern int __LIB__ __FASTCALL__ zx_goto(int line); // calls the BASIC interpreter at a single line extern int __LIB__ __FASTCALL__ zx_line(int line); // executes a single BASIC line extern int __LIB__ zx_getstr(char variable, char *value); extern void __LIB__ zx_setstr(char variable, char *value); // extern int __LIB__ __FASTCALL__ zx_getint(char *variable); // extern void __LIB__ zx_setint(char *variable, int value); extern int __LIB__ __CALLEE__ zx_getstr_callee(char variable, char *value); extern void __LIB__ __CALLEE__ zx_setstr_callee(char variable, char *value); // extern void __LIB__ __CALLEE__ zx_setint_callee(char *variable, int value); #define zx_getstr(a,b) zx_getstr_callee(a,b) #define zx_setstr(a,b) zx_setstr_callee(a,b) // #define zx_setint(a,b) zx_setint_callee(a,b) #endif z88dk-1.8.ds1/include/zxbeta.h0000755000175000017500000000144410750573067015615 0ustar tygrystygrys/* * Small C+ Library * * TRDOS/Beta low level support * * Stefano Bodrato - 31/01/2008 * * $Id: zxbeta.h,v 1.1 2008/02/01 10:36:39 stefano Exp $ */ #ifndef __ZXBETA_H__ #define __ZXBETA_H__ #include #include #ifndef __ZX_CHANNELS__ #define __ZX_CHANNELS__ struct BASE_CHAN { // base channel descriptor u16_t out; /* pointer to the output routine */ u16_t in; /* pointer to the input routine */ u8_t id_char; /* upper (if permanent) or lower "M".. char */ u16_t len; /* length of channel */ }; #endif /*__ZX_CHANNELS__*/ // Returns true if the Beta disk interface is present extern int __LIB__ zx_betadisk(); // Returns true if the TRDOS is active extern int __LIB__ trdos_installed(); #endif /* _ZXBETA_H */ z88dk-1.8.ds1/include/zxcurrah.h0000755000175000017500000000411010452231156016144 0ustar tygrystygrys/* * Currah uSpeech interface for the ZX Spectrum library * * Stefano Bodrato - 3/7/2006 * * $Id: zxcurrah.h,v 1.1 2006/07/03 15:06:22 stefano Exp $ */ #ifndef __ZXCURRAH_H__ #define __ZXCURRAH_H__ #include #include /* CURRAH uSpeech interface */ /* TRUE if the interface is present */ extern int __LIB__ currah_detect(); /* Talk using the high level BASIC interface */ extern void __LIB__ currah_speech(char *text); /* Talk using the allophone codes */ extern void __LIB__ currah_direct(char *allophones); /* Message terminator */ #define PH_END 0 /* Pitch (to be ORed with the following codes to increase intonation */ #define PH_HIGH 64 #define PH_PITCH 64 #define PH_UPPER 64 /* Allophone codes */ #define PH_A 24 #define PH_B 28 #define PH_C 8 #define PH_D 21 #define PH_E 7 #define PH_F 40 #define PH_G 36 #define PH_H 27 #define PH_I 12 #define PH_J 10 #define PH_K 42 #define PH_L 45 #define PH_M 16 #define PH_N 11 #define PH_O 23 #define PH_P 9 #define PH_R 39 #define PH_S 55 #define PH_T 17 #define PH_U 15 #define PH_V 35 #define PH_W 46 #define PH_Y 49 #define PH_Z 43 #define PH_AY 20 #define PH_AA 20 #define PH_EE 19 #define PH_II 6 #define PH_OO 53 #define PH_EAU 53 #define PH_BB 63 #define PH_DD 33 #define PH_GG 61 #define PH_GGG 36 #define PH_HH 57 #define PH_LL 62 #define PH_NN 56 #define PH_RR 14 #define PH_TT 13 #define PH_YY 25 #define PH_AR 59 #define PH_AER 47 #define PH_CH 50 #define PH_CK 41 #define PH_EAR 60 #define PH_EH 26 #define PH_ER 51 #define PH_ERR 52 #define PH_NG 44 #define PH_OR 58 #define PH_OU 22 #define PH_OUU 31 #define PH_OW 32 #define PH_OY 5 #define PH_SH 37 #define PH_TH 29 #define PH_DTH 18 #define PH_UH 30 #define PH_WH 48 #define PH_ZH 33 #define PH_ 1 #define PH__ 3 #define PH___ 4 #endif /* __ZXCURRAH_H__ */ z88dk-1.8.ds1/include/zxinterface1.h0000755000175000017500000001055410752564353016725 0ustar tygrystygrys/* * ZX Interface 1 and Microdrive low level support * * Stefano Bodrato - 6/9/2004 * * $Id: zxinterface1.h,v 1.8 2008/02/07 11:18:03 stefano Exp $ */ #ifndef __ZXINTERFACE1_H__ #define __ZXINTERFACE1_H__ #include #include #ifndef __ZX_CHANNELS__ #define __ZX_CHANNELS__ struct BASE_CHAN { // base channel descriptor u16_t errptr1; /* first pointer to main ERROR-1 */ u16_t errptr2; /* second pointer to main ERROR-1 */ u8_t id_char; /* inverted or regular "M"/"N" char */ u16_t out; /* pointer to the output routine */ u16_t in; /* pointer to the input routine */ u16_t len; /* length of channel */ }; // M_CHAN is 603 bytes long struct M_CHAN { // base channel descriptor struct BASE_CHAN base; // "M" channel specific stuff u16_t bytecount; /* (IX+$0B) Count bytes in record */ u8_t record; char name[10]; /* file name */ u8_t flag; u8_t drive; /* drive number (0-7)*/ u16_t map; /* Address of MAP for this microdrive.*/ char hdpreamble[12]; /* 12 bytes of header preamble */ u8_t hdflag; u8_t sector; /* sector number */ u16_t unused; char hdname[10]; /* cartridge name */ u8_t hdchk; /* Header checksum */ char dpreamble[12]; /* 12 bytes of data block preamble */ u8_t recflg; /* bit 1 set for EOF, bit 2 set for PRINT file type */ u8_t recnum; /* Record number in the range 0-255 */ u16_t reclen; /* (IX+$45) Number of databytes in record 0-512 */ char recname[10]; /* file name */ u8_t recchk; /* Record description checksum */ char data[512]; /* the 512 bytes of data. */ //char datahd[10]; /* first 9 bytes of the 512 bytes of data. */ //char data[502] /* real program */ u8_t datachk; /* Checksum of preceding 512 bytes */ /* These values are added for the file handling the ROM shouldn't overwrite those fileds */ long position; /** NEW** - current position in file */ int flags; mode_t mode; }; struct M_SECT { char foo[3072]; }; struct M_MAP { char map[32]; /* 32 bytes = 256 bits for a microdrive map */ }; struct N_CHAN { // base channel descriptor struct BASE_CHAN base; // "N" channel specific stuff u8_t remote; /* The destination station number */ u8_t local; /* This Spectrum's station number */ u16_t nc_number; /* The block number */ u8_t nc_type; /* The packet type code . 0 data, 1 EOF */ u8_t nc_obl; /* Number of bytes in data block */ u8_t datachk; /* The data checksum */ u8_t hdachk; /* The header checksum */ u8_t nc_cur; /* The position of last buffer char taken */ u8_t nc_ibl; /* Number of bytes in the input buffer */ char data[255]; /* 255 byte data buffer */ }; #endif /*__ZX_CHANNELS__*/ // Load a sector identified by file name and record number extern int __LIB__ if1_load_record (int drive, char *filename, int record, struct M_CHAN buffer); // Load a sector identified by the sector number extern int __LIB__ if1_load_sector (int drive, int sector, struct M_CHAN buffer); // Write the sector in "buffer" extern int __LIB__ if1_write_sector (int drive, int sector, struct M_CHAN buffer); // Add a record containing the data in "buffer" extern int __LIB__ if1_write_record (int drive, struct M_CHAN buffer); // Put a 10 characters file name at the specified location; return with the file name length extern int __LIB__ if1_setname(char* name, char *location); extern char __LIB__ *if1_getname(char *location); // Delete a file extern int __LIB__ if1_remove_file(int drive, char *filename); // Create a file if it doesn't exist extern int __LIB__ if1_touch_file(int drive, char *filename); // Create a file and return handle extern int __LIB__ if1_init_file (int drive, char *filename, struct M_CHAN buffer); // Load the map values for the specified drive extern void __LIB__ if1_update_map (int drive, char *mdvmap); // Find a free sector extern int __LIB__ if1_find_sector (int drive); // Find a free sector in the specified map extern int __LIB__ if1_find_sector_map (char *mdvmap); // Returns true if the current program has been loaded from microdrive extern int __LIB__ if1_from_mdv(); // Returns true if the system variables are already present extern int __LIB__ if1_installed(); // Returns true if the Interface 1 is present extern int __LIB__ zx_interface1(); // Returns the microdrive status 0=ok, 1=wr protect, 2=not present extern int __LIB__ if1_mdv_status(int drive); #endif /* _ZXINTERFACE1_H */ z88dk-1.8.ds1/include/zxlowgfx.h0000755000175000017500000001221210553474742016204 0ustar tygrystygrys/* * LO REZ graphics functions for the ZX Spectrum * * 32x48 or (defining the "ALTLOWGFX" variable) 64x24 pixels. * * $Id: zxlowgfx.h,v 1.2 2007/01/17 19:32:50 stefano Exp $ */ #ifndef __ZXLOGFX_H__ #define __ZXLOGFX_H__ /* Clear and init pseudo-graph screen */ void cclg(int color); /* Plot a pixel to screen */ void cplot(int x, int y, int color); /* Get the pixel color */ int cpoint(int x, int y); /* Draw a line */ void cdraw(int x1, int y1, int x2, int y2, int color); /* Relative draw */ void cdrawr(int x, int y, int color); /* Put a sprite on screen */ void cputsprite(int x, int y, int color, void *sprite); /* Clear and init pseudo-graph buffer */ void cclgbuffer(int color); /* copy the gfx buffer, if used */ void ccopybuffer(void); /* Clear and init pseudo-graph screen */ void cclg(int color) { #asm ld hl,2 add hl,sp ld a,(hl) and 7 out (254),a ld e,a rla rla rla or e ld hl,16384 ld d,h ld e,l inc de #if ALTLOWGFX ld (hl),@11110000 ld bc,6144 ldir #else ld b,3 bandloop: push bc ld (hl),255 ld bc,1024 ldir ld (hl),0 ld bc,1024 ldir pop bc djnz bandloop #endif ld (hl),a ; color ld bc,767 ldir #if bufferedgfx ld hl,64600 ld d,h ld e,l inc de ld (hl),a ; color ld bc,767 ldir #endif #endasm } /* Plot a pixel to screen */ void cplot(int x, int y, int color) { #asm ld ix,0 add ix,sp ld a,(ix+2) and 7 ld c,a ld l,(ix+4) ld h,(ix+6) cplotpixel: #if ALTLOWGFX ld a,h cp 64 ret nc ld a,l cp 24 ret nc #else ld a,h cp 32 ret nc ld a,l cp 48 ret nc #endif #if ALTLOWGFX ld b,a ld a,h srl a ld h,a #else srl a ; every "row" has two pixels ld b,a ; row count #endif push af ; save the even/odd bit in carry ld d,0 ld e,h ; column #if bufferedgfx ld hl,64600 #else ld hl,22528 #endif add hl,de ld e,b rl e ;2 rl e ;4 rl e rl d ;8 rl e rl d ;16 rl e rl d ;32 add hl,de pop af ld a,(hl) jr nc,cevenrow and 7 rl c rl c rl c or c ld (hl),a ret cevenrow: and @111000 or c ld (hl),a ret #endasm } /* Get the pixel color */ int cpoint(int x, int y) { #asm ld ix,0 add ix,sp ld l,(ix+2) ld h,(ix+4) getpixel: #if ALTLOWGFX ld a,h cp 64 ret nc ld a,l cp 24 ret nc #else ld a,h cp 32 ret nc ld a,l cp 48 ret nc #endif #if ALTLOWGFX ld b,a ld a,h srl a ld h,a #else srl a ; every "row" has two pixels ld b,a ; row count #endif push af ; save the even/odd bit in carry ld d,0 ld e,h ; column ;#if bufferedgfx ; ld hl,64600 ;#else ld hl,22528 ;#endif add hl,de ld e,b rl e ;2 rl e ;4 rl e rl d ;8 rl e rl d ;16 rl e rl d ;32 add hl,de pop af ld a,(hl) jr nc,gcevenrow rra rra rra gcevenrow: and 7 ld h,0 ld l,a ret #endasm } /* Relative draw */ void cdrawr(int x, int y, int color) { #asm LIB line_r ld ix,0 add ix,sp ld e,(ix+4) ;py ld d,(ix+5) ld l,(ix+6) ;px ld h,(ix+7) ld a,(ix+2) and 7 ld (color+1),a ld ix,csplot jp line_r #endasm } /* Draw a line */ void cdraw(int x0, int y0, int x1, int y1, int color) { #asm LIB line XREF COORDS ld ix,0 add ix,sp xor a ld l,(ix+8) ;y0 ld h,(ix+10) ;x0 ld e,(ix+4) ;y1 ld d,(ix+6) ;x1 ld a,(ix+2) and 7 ld (color+1),a push hl push de call csplot pop de pop hl ld ix,csplot call line ret csplot: ld (COORDS),hl push bc color: ld c,0 call cplotpixel pop bc ret #endasm } /* Put a sprite on screen */ void cputsprite(int color, int x, int y, void *sprite) { #asm ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl inc hl ld a,(hl) ; color and 7 ld (colr+1),a ld h,d ld l,e .door ld a,(ix+0) ; Width ld b,(ix+1) ; Height .oloopo push bc ;Save # of rows push af ;ld b,a ;Load width (not anymore) ld b,0 ; Better, start from zero !! ld c,(ix+2) ;Load one line of image .iloopo sla c ;Test leftmost pixel jr nc,noploto ;See if a plot is needed pop af push af push hl push bc ; this should be done by the called routine push de ld a,h add a,b ld h,a .colr ld c,0 call cplotpixel pop de pop bc pop hl .noploto inc b ; witdh counter pop af push af cp b ; end of row ? jr nz,noblk inc ix ld c,(ix+2) ;Load next byte of image jr noblocko .noblk ld a,b ; next byte in row ? ;dec a and a jr z,iloopo and 7 jr nz,iloopo .blocko inc ix ld c,(ix+2) ;Load next byte of image jr iloopo .noblocko ;djnz iloopo inc l pop af pop bc ;Restore data djnz oloopo ret #endasm } /* copy the gfx buffer, if used */ void ccopybuffer(void) { #asm #if bufferedgfx ; Sync to avoid screen flickering xor a ld ($5C78),a wsync: ld a,($5C78) and a jr z,wsync ; copy the buffer ld hl,64600 ld de,22528 ld bc,768 ldir #endif #endasm } /* Clear and init pseudo-graph buffer */ void cclgbuffer(int color) { #asm #if bufferedgfx ld hl,2 add hl,sp ld a,(hl) and 7 out (254),a ld hl,64600 ld d,h ld e,l inc de ld (hl),a ; color ld bc,767 ldir #endif #endasm } #endif z88dk-1.8.ds1/include/zxopus.h0000755000175000017500000000667010753010310015652 0ustar tygrystygrys/* * Small C+ Library * * Opus Discovery low level support * * Stefano Bodrato - 7/6/2006 * * $Id: zxopus.h,v 1.4 2008/02/08 08:20:24 stefano Exp $ */ #ifndef __ZXOPUS_H__ #define __ZXOPUS_H__ #include #include #ifndef __ZX_CHANNELS__ #define __ZX_CHANNELS__ struct BASE_CHAN { // base channel descriptor u16_t out; /* pointer to the output routine */ u16_t in; /* pointer to the input routine */ u8_t id_char; /* upper (if permanent) or lower "M".. char */ u16_t len; /* length of channel */ }; // M_CHAN is 33 bytes long (including BASE_CHAN), + the block size // (the block-size can be 128, 256, 512 or 1024 bytes) struct M_CHAN { // base channel descriptor struct BASE_CHAN base; // "M" channel specific stuff u8_t drive; /* drive number */ char name[10]; /* file name */ u16_t blklen; /* Block size */ u16_t reclen; /* Number of databytes in record */ u16_t lastblkbyt; /* Number of bytes in the last block */ u16_t firstblk; /* Location of the first block */ u16_t lastblk; /* Location of the last block */ u16_t block; /* Location of the current block */ u16_t bytecount; /* Position in the current block */ u8_t flag; /* bit 0 : SET if changes were made to the buffer */ //char data[512] /* the buffer */ }; // The 'd' channel is only used by the MOVE command, // however it should act as a normal channel; // you should be able to read and write to it. struct D_CHAN { // base channel descriptor struct BASE_CHAN base; // '#' channel specific stuff u8_t outdrive; /* output drive number */ u8_t indrive; /* input drive number */ }; struct CODE_CHAN { // base channel descriptor struct BASE_CHAN base; // '#' channel specific stuff u16_t address; /* pointed address */ }; struct T_CHAN { // base channel descriptor struct BASE_CHAN base; u8_t tflags; u8_t lastcol; u8_t currcol; }; // these are the single bits for 'tflags' in T_CHAN #define TCHAN_ZXPRTEMU 1 /* ZX printer emulation */ #define TCHAN_SEQ 2 #define TCHAN_BACKSP 4 /* set for true backspacing */ #define TCHAN_AT 32 /* set for AT character */ #define TCHAN_TAB 64 /* set for TAB character */ #define TCHAN_AT_TAB 128 struct B_CHAN { // base channel descriptor struct BASE_CHAN base; // that's all !! }; struct STRM_CHAN { // base channel descriptor struct BASE_CHAN base; // '#' channel specific stuff u8_t stream; /* stream address */ }; // Joystick !! // Note that it works in this way only if the kempston emulation is off // WARNING: all the joystick stuff could not work with the Spectrum emulators struct J_CHAN { // base channel descriptor struct BASE_CHAN base; // '#' channel specific stuff u8_t joystick; /* 1 for QWERT and 67890 */ /* 2 for QWERT and 12345 */ }; #endif /*__ZX_CHANNELS__*/ // set the kempston emulation (1=on, 0=off) extern void __LIB__ set_kempston (int mode); // get the kempston emulation status (1=on, 0=off) extern int __LIB__ get_kempston (); // get the number of sectors extern int __LIB__ opus_getblocks (int drive); // get the sector size extern int __LIB__ opus_getblocksize (int drive); // parallel port put/get byte extern void __LIB__ opus_lptwrite (unsigned char databyte); extern unsigned char __LIB__ opus_lptread (); // Returns true if the Opus Discovery interface is present extern int __LIB__ zx_opus(); // Get the Opus firmware version extern float __LIB__ opus_version (); #endif /* _ZXOPUS_H */ z88dk-1.8.ds1/include/zxvgs.h0000755000175000017500000000127207637071514015500 0ustar tygrystygrys/* ZXVGS specific functions Created on 2002-01-21 by Yarek 030307 added #pragma output ZXVGS and #pragma -create-app 020128 added #ifndef; added bnkinfo and opensound $Id: zxvgs.h,v 1.1 2003/03/22 14:29:32 dom Exp $ */ #ifndef _ZXVGS_H #define _ZXVGS_H #pragma output ZXVGS /* reading the joysticks */ extern int __LIB__ j0(); extern int __LIB__ j1(); extern int __LIB__ j2(); extern int __LIB__ j3(); /* sound devices */ extern int __LIB__ opensound(int device, int mode); /* memory banks */ extern int __LIB__ bnkfree(); /* direct loading and saving files */ extern int __LIB__ loadany(char *name, int adr, int len); extern int __LIB__ saveany(char *name, int adr, int len); #endif z88dk-1.8.ds1/lib/0000755000175000017500000000000010765235714013264 5ustar tygrystygrysz88dk-1.8.ds1/lib/81fp.def0000644000175000017500000000672407640542677014542 0ustar tygrystygryslstoff ; ZX 81 stack calculator functions (ZX81 version of ZXFP) ; $Id: 81fp.def,v 1.5 2003/03/27 09:34:55 stefano Exp $ ; function codes: ; RST 28h activates the FP calculator DEFC ZXFP_BEGIN_CALC = $28 DEFC ZXFP_STK_PTR = $401C DEFC ZXFP_STK_STORE = $12C3 DEFC ZXFP_TEST_5_FP = $19EB DEFC ZXFP_STK_STR = $12C3 DEFC ZXFP_STK_FETCH = $13F8 DEFC ZXFP_STACK_A = $151D DEFC ZXFP_STACK_BC = $1520 DEFC ZXFP_FP_TO_BC = $0BF5 DEFC ZXFP_FP_TO_A = $0C02 DEFC ZXFP_INT_TO_FP = $1548 DEFC ZXFP_DEC_TO_FP = $14D9 DEFC ZXFP_JUMP_TRUE = $00 DEFC ZXFP_EXCHANGE = $01 DEFC ZXFP_DELETE = $02 DEFC ZXFP_SUBTRACT = $03 DEFC ZXFP_MULTIPLY = $04 DEFC ZXFP_DIVISION = $05 DEFC ZXFP_TO_POWER = $06 DEFC ZXFP_OR = $07 DEFC ZXFP_NO_AND_NO = $08 DEFC ZXFP_NO_L_EQL = $09 DEFC ZXFP_NO_GR_EQL = $0A DEFC ZXFP_NOS_NEQL = $0B DEFC ZXFP_NO_GRTR = $0C DEFC ZXFP_NO_LESS = $0D DEFC ZXFP_NOS_EQL = $0E DEFC ZXFP_ADDITION = $0F DEFC ZXFP_STR_AND_NO = $10 ; String and Number DEFC ZXFP_STR_L_EQL = $11 ; String <= DEFC ZXFP_STR_GR_EQL = $12 ; String >= DEFC ZXFP_STRS_NEQL = $13 ; String <> DEFC ZXFP_STRS_GRTR = $14 ; String > DEFC ZXFP_STRS_LESS = $15 ; String < DEFC ZXFP_STRS_EQL = $16 ; String = DEFC ZXFP_STRS_ADD = $17 ; String addition DEFC ZXFP_NEGATE = $18 DEFC ZXFP_CODE = $19 DEFC ZXFP_VAL = $1A DEFC ZXFP_LEN = $1B DEFC ZXFP_SIN = $1C DEFC ZXFP_COS = $1D DEFC ZXFP_TAN = $1E DEFC ZXFP_ASN = $1F DEFC ZXFP_ACS = $20 DEFC ZXFP_ATN = $21 DEFC ZXFP_LN = $22 DEFC ZXFP_EXP = $23 DEFC ZXFP_INT = $24 DEFC ZXFP_SQR = $25 DEFC ZXFP_SGN = $26 DEFC ZXFP_ABS = $27 DEFC ZXFP_PEEK = $28 DEFC ZXFP_USR_NO = $29 DEFC ZXFP_STRS = $2A DEFC ZXFP_CHRS = $2B DEFC ZXFP_NOT = $2C DEFC ZXFP_DUPLICATE = $2D DEFC ZXFP_N_MOD_M = $2E DEFC ZXFP_JUMP = $2F DEFC ZXFP_STK_DATA = $30 DEFC ZXFP_DEC_JR_NZ = $31 DEFC ZXFP_LESS_0 = $32 DEFC ZXFP_GREATER_0 = $33 DEFC ZXFP_END_CALC = $34 ; END DEFC ZXFP_GET_ARGT = $35 DEFC ZXFP_TRUNCATE = $36 DEFC ZXFP_FP_CALC_2 = $37 DEFC ZXFP_E_TO_FP = $38 DEFC ZXFP_SERIES_00 = $80 DEFC ZXFP_SERIES_01 = $81 DEFC ZXFP_SERIES_02 = $82 DEFC ZXFP_SERIES_03 = $83 DEFC ZXFP_SERIES_04 = $84 DEFC ZXFP_SERIES_05 = $85 DEFC ZXFP_SERIES_06 = $86 DEFC ZXFP_SERIES_07 = $87 DEFC ZXFP_SERIES_08 = $88 DEFC ZXFP_SERIES_09 = $89 DEFC ZXFP_SERIES_0A = $8A DEFC ZXFP_SERIES_0B = $8B DEFC ZXFP_SERIES_0C = $8C DEFC ZXFP_SERIES_0D = $8D DEFC ZXFP_SERIES_0E = $8E DEFC ZXFP_SERIES_0F = $8F DEFC ZXFP_SERIES_10 = $90 DEFC ZXFP_SERIES_11 = $91 DEFC ZXFP_SERIES_12 = $92 DEFC ZXFP_SERIES_13 = $93 DEFC ZXFP_SERIES_14 = $94 DEFC ZXFP_SERIES_15 = $95 DEFC ZXFP_SERIES_16 = $96 DEFC ZXFP_SERIES_17 = $97 DEFC ZXFP_SERIES_18 = $98 DEFC ZXFP_SERIES_19 = $99 DEFC ZXFP_SERIES_1A = $9A DEFC ZXFP_SERIES_1B = $9B DEFC ZXFP_SERIES_1C = $9C DEFC ZXFP_SERIES_1D = $9D DEFC ZXFP_SERIES_1E = $9E DEFC ZXFP_SERIES_1F = $9F DEFC ZXFP_STK_ZERO = $A0 DEFC ZXFP_STK_ONE = $A1 DEFC ZXFP_STK_HALF = $A2 DEFC ZXFP_STK_PI_D_2 = $A3 DEFC ZXFP_STK_TEN = $A4 DEFC ZXFP_ST_MEM_0 = $C0 DEFC ZXFP_ST_MEM_1 = $C1 DEFC ZXFP_ST_MEM_2 = $C2 DEFC ZXFP_ST_MEM_3 = $C3 DEFC ZXFP_ST_MEM_4 = $C4 DEFC ZXFP_ST_MEM_5 = $C5 DEFC ZXFP_GET_MEM_0 = $E0 DEFC ZXFP_GET_MEM_1 = $E1 DEFC ZXFP_GET_MEM_2 = $E2 DEFC ZXFP_GET_MEM_3 = $E3 DEFC ZXFP_GET_MEM_4 = $E4 DEFC ZXFP_GET_MEM_5 = $E5 ; System variables DEFC ZXFP_CH_ADD = $4016 lston z88dk-1.8.ds1/lib/abc80_crt0.asm0000644000175000017500000000654110713546115015612 0ustar tygrystygrys; CRT0 for the ABC80 Family ; ; Stefano Bodrato May 2000 ; ; $Id: abc80_crt0.asm,v 1.7 2007/11/05 07:54:53 stefano Exp $ ; MODULE abc80_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ; No matter what set up we have, main is always, always external to ; this file XREF _main ; ; Some variables which are needed for both app and basic startup ; XDEF cleanup XDEF l_dcal ; Integer rnd seed XDEF _std_seed ; vprintf is internal to this file so we only ever include one of the set ; of routines XDEF _vfprintf ;Exit variables XDEF exitsp XDEF exitcount ;For stdin, stdout, stder XDEF __sgoioblk XDEF heaplast ;Near malloc heap variables XDEF heapblocks ; Graphics stuff XDEF base_graphics XDEF coords ; Now, getting to the real stuff now! IF !myzorg defc myzorg = 50000 ENDIF org myzorg .start ld hl,0 add hl,sp ld (start1+1),hl ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF pop bc .start1 ld sp,0 ret .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; mem stuff .base_graphics defw 0 .coords defw 0 defm "Small C+ ABC80" defb 0 ;All the float stuff is kept in a different file...for ease of altering! ;It will eventually be integrated into the library ; ;Here we have a minor (minor!) problem, we've no idea if we need the ;float package if this is separated from main (we had this problem before ;but it wasn't critical..so, now we will have to read in a file from ;the directory (this will be produced by zcc) which tells us if we need ;the floatpackage, and if so what it is..kludgey, but it might just work! ; ;Brainwave time! The zcc_opt file could actually be written by the ;compiler as it goes through the modules, appending as necessary - this ;way we only include the package if we *really* need it! IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/abc80_crt0.opt0000644000175000017500000000003407130401717015620 0ustar tygrystygrys INCLUDE "#abc80_crt0.asm" z88dk-1.8.ds1/lib/ace_crt0.asm0000644000175000017500000000653410640546527015455 0ustar tygrystygrys; CRT0 stub for the Jupiter ACE ; ; Stefano Bodrato - Feb 2001 ; ; $Id: ace_crt0.asm,v 1.7 2007/06/27 20:49:27 dom Exp $ ; MODULE ace_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ; No matter what set up we have, main is always, always external to ; this file XREF _main XDEF snd_tick ; ; Some variables which are needed for both app and basic startup ; XDEF cleanup XDEF l_dcal ; Integer rnd seed XDEF _std_seed ; vprintf is internal to this file so we only ever include one of the set ; of routines XDEF _vfprintf ;Exit variables XDEF exitsp XDEF exitcount ;For stdin, stdout, stder XDEF __sgoioblk XDEF heaplast ;Near malloc heap variables XDEF heapblocks ; Graphics stuff XDEF base_graphics XDEF coords ; Now, getting to the real stuff now! org 16384 .start ld hl,0 add hl,sp ld (start1+1),hl ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF pop bc .start1 ld sp,0 jp (iy) ; To the Jupiter ACE FORTH system .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; mem stuff .base_graphics defw $2400 .coords defw 0 .snd_tick defb 0 defm "Small C+ J.ACE" defb 0 ;All the float stuff is kept in a different file...for ease of altering! ;It will eventually be integrated into the library ; ;Here we have a minor (minor!) problem, we've no idea if we need the ;float package if this is separated from main (we had this problem before ;but it wasn't critical..so, now we will have to read in a file from ;the directory (this will be produced by zcc) which tells us if we need ;the floatpackage, and if so what it is..kludgey, but it might just work! ; ;Brainwave time! The zcc_opt file could actually be written by the ;compiler as it goes through the modules, appending as necessary - this ;way we only include the package if we *really* need it! IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/ace_crt0.opt0000644000175000017500000000003207240553473015462 0ustar tygrystygrys INCLUDE "#ace_crt0.asm" z88dk-1.8.ds1/lib/alarm.def0000644000175000017500000000211207455120417015027 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; Alarm manipulation: DEFC Gn_Aab = $6809 ; Allocate alarm block DEFC Gn_Fab = $6A09 ; Free alarm block DEFC Gn_Lab = $6C09 ; Link alarm block in chain DEFC Gn_Uab = $6E09 ; Unlink alarm block DEFC Gn_Alp = $7009 ; Process an expired alarm (OZ usage) ; Low level alarm call definitions: DEFC Os_Alm = $81 ; Alarm manipulation (OZ usage) ; arguments: DEFC AH_SUSP = $01 ; suspend alarm DEFC AH_REV = $02 ; revive alarms DEFC AH_RES = $03 ; reset alarm enable state DEFC AH_SINC = $04 ; display symbol DEFC AH_SDEC = $05 ; remove symbol (subject to use count) DEFC AH_SRES = $06 ; reset symbol DEFC AH_SET = $07 ; Set a new alarm: DEFC AH_CNC = $08 ; Cancel an alarm: DEFC AH_DG1 = $09 ; Ding-dong type 1 DEFC AH_DG2 = $0A ; Ding-dong type 2 DEFC AH_AINC = $0B ; action count increment DEFC AH_ADEC = $0C ; action count decrement DEFC AH_ARES = $0D ; action count reset lston z88dk-1.8.ds1/lib/app_crt0.as10000644000175000017500000000042307317334302015371 0ustar tygrystygrys; z80asm is getting a bit crusty! IF !DEFINED_defvarsaddr defc defvarsaddr = 8192 ENDIF DEFVARS defvarsaddr { pool_table ds.b 224 malloc_table ds.w 1 farpages ds.w 1 farmemspec ds.b 1 copybuff ds.b 258 actual_malloc_table ds.b ((farheapsz/256)+1)*2 } z88dk-1.8.ds1/lib/app_crt0.asm0000644000175000017500000002461610640546527015506 0ustar tygrystygrys; ; Startup Code for Z88 applications ; ; The entry point is a dummy function in the DOR which then ; jumps to routine in this file ; ; 1/4/99 djm ; ; 7/4/99 djm Added function to handle commands - this requires ; the user to do something for it! ; ; 4/5/99 djm Added in functionality to remove check for expanded ; machine, not to give those people reluctant to ug something to ; use, but to save memory in very small apps ; ; 1/4/2000 djm Added in conditionals for: ; - far heap stuff (Ask GWL for details!) ; - "ANSI" stdio - i.e. flagged and ungetc'able ; ; 6/10/2001 djm Clean up (after Henk) ; ; $Id: app_crt0.asm,v 1.7 2007/06/27 20:49:27 dom Exp $ ;-------- ; Call up some header files (probably too many but...) ;-------- INCLUDE "#stdio.def" INCLUDE "#fileio.def" INCLUDE "#memory.def" INCLUDE "#error.def" INCLUDE "#time.def" INCLUDE "#syspar.def" INCLUDE "#director.def" ;-------- ; Set some scope variables ;-------- XDEF app_entrypoint ;Start of execution in this file XREF applname ;Application name (in DOR) XREF in_dor ;DOR address ;-------- ; Set an origin for the application (-zorg=) default to 49152 ;-------- IF !myzorg defc myzorg = 49152 ENDIF org myzorg ;-------- ; Calculate the required bad memory. If we're using a near heap then the ; compiler sets it to $20+(HEAPSIZE%256)+1 ; If we reqpag == 0 or reqpag <> 0 then we don't want to define it else ; default to $20 (8k) ;-------- IF (reqpag=0) | (reqpag) ELSE defc reqpag = $20 ENDIF ;-------- ; We need a safedata def. So if not defined set to 0 ;-------- IF !safedata defc safedata = 0 ENDIF ;-------- ; Start of execution. We enter with ix pointing to info table about ; memory allocated to us by OZ. ;-------- .app_entrypoint ;------- ; If we want to debug, then intuition is set, so call $2000 ; This assumes several things...no bad memory required, and we've ; been blown onto an EPROM along with Intuition and our app DOR ; has been set appropriately to page in Intuition in segment 0 ; Call intuition if that set (assumes no bad memory and DOR is setup) ;------- IF (intuition <> 0 ) ~ (reqpag=0) call $2000 ENDIF IF (reqpag <> 0) ld a,(ix+2) ;Check allocated bad memory if needed cp $20+reqpag ld hl,nomemory ; Bit of trickery with conditional assembly here, if we don't need an ; expanded machine, jump on success to init_continue or if failure ; flow into init_error. ; If we need expanded, jump on failure to init_error and flow onto ; check for expanded IF (NEED_expanded=0) jr nc,init_continue ELSE jr c,init_error ENDIF ENDIF IF NEED_expanded <> 0 ld ix,-1 ;Check for an expanded machine ld a,FA_EOF call_oz(os_frm) jr z,init_continue ld hl,need_expanded_text ENDIF IF (reqpag<>0) | (NEED_expanded<>0) .init_error ;Code to deal with an initialisation error push hl ;The text that we are printing ld hl,clrscr ;Clear the screen call_oz(gn_sop) ld hl,windini ;Define a small window call_oz(gn_sop) pop hl call_oz(gn_sop) ;Print text ld bc,500 call_oz(os_dly) ;Pause xor a call_oz(os_bye) ;Exit ENDIF .init_continue ;We had enough memory ld a,sc_dis ;Disable escape call_oz(os_esc) xor a ;Setup our error handler ld b,a ld hl,errhan call_oz(os_erh) ld (l_errlevel),a ;Save previous values ld (l_erraddr),hl ld hl,applname ;Name application call_oz(dc_nam) ld hl,clrscr ;Setup a BASIC sized window call_oz(gn_sop) ld hl,clrscr2 call_oz(gn_sop) ;-------- ; Now, set up some very nice variables - stream ids for std* ;-------- IF DEFINED_ANSIstdio ld hl,sgoprotos ld de,__sgoioblk ld bc,4*10 ;4*10 FILES ldir ELSE ld hl,-10 ld (__sgoioblk+4),hl dec hl ld (__sgoioblk),hl dec hl ld (__sgoioblk+2),hl ENDIF ld hl,$8080 ;Initialise floating point seed ld (fp_seed),hl xor a ;Reset atexit() count ld (exitcount),a ld hl,-64 ;Setup atexit() stack add hl,sp ld sp,hl ld (exitsp),sp IF DEFINED_farheapsz call init_far ;Initialise far memory if required ENDIF call _main ;Call the users code xor a ;Exit with zero .cleanup ;Jump back to here from exit() IF DEFINED_ANSIstdio push af ;Save exit value LIB closeall call closeall ;Close all files IF DEFINED_farheapsz call freeall_far ;Deallocate far memory ENDIF pop af ;Get exit value back ELSE ;!ANSIstdio IF DEFINED_farheapsz push af ;Deallocate far memory call freeall_far pop af ENDIF ENDIF ;ANSIstdio call_oz(os_bye) ;Exit back to OZ .l_dcal jp (hl) ;Used by various things ;------- ; Process a <> command, we call the users handlecmds APPFUNC ;------- .processcmd IF DEFINED_handlecmds XREF _handlecmds ld l,a ld h,0 push hl call _handlecmds pop bc ENDIF ld hl,0 ;dummy return value ret ;-------- ; Fairly simple error handler ;-------- .errhan ret z ;Fatal error - far mem probs? IF DEFINED_redrawscreen XREF _redrawscreen cp rc_draw ;(Rc_susp for BASIC!) jr nz,errhan2 push af ;Call users screen redraw fn if defined call _redrawscreen pop af ENDIF .errhan2 cp rc_quit ;they don't like us! jr nz,keine_error IF DEFINED_applicationquit XREF _applicationquit ;Call users routine if defined call _applicationquit ENDIF xor a ;Standard cleanup jr cleanup .keine_error xor a ret ;-------- ; Far memory setup ;-------- IF DEFINED_farheapsz LIB freeall_far XDEF farpages XDEF malloc_table XDEF farmemspec XDEF pool_table ; All far memory variables now in init_far.asm INCLUDE "#init_far.asm" ENDIF ;-------- ; This bit of code allows us to use OZ ptrs transparently ; We copy any data from up far to a near buffer so that OZ ; is happy about it ; Prototype is extern void __FASTCALL__ *cpfar2near(far void *) ;-------- IF DEFINED_farheapsz LIB strcpy_far ._cpfar2near pop bc ;ret address pop hl pop de ;far ptr push bc ;keep ret address ld a,e and a ret z ;already local push ix ;keep ix safe ld bc,0 ;local push bc ld bc,copybuff push bc ;dest push de ;source push hl call strcpy_far pop bc ;dump args pop bc pop bc pop bc pop ix ;get ix back ld hl,copybuff ret ELSE ; We have no far code installed so all we have to do is fix the stack ._cpfar2near pop bc pop hl pop de push bc ret ENDIF ;-------- ; Which printf core routine do we need? ;-------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;------- ; Text to define the BASIC style window ;------- .clrscr defb 1,'7','#','1',32,32,32+94,32+8,128,1,'2','C','1',0 .clrscr2 defb 1,'2','+','S',1,'2','+','C',0 IF (NEED_expanded <> 0 ) | (reqpag <>0) .windini defb 1,'7','#','3',32+7,32+1,32+34,32+7,131 ;dialogue box defb 1,'2','C','3',1,'4','+','T','U','R',1,'2','J','C' defb 1,'3','@',32,32 ;reset to (0,0) defm "Small C+ Application" defb 1,'3','@',32,32 ,1,'2','A',32+34 ;keep settings for 10 defb 1,'7','#','3',32+8,32+3,32+32,32+5,128 ;dialogue box defb 1,'2','C','3' defb 1,'3','@',32,32,1,'2','+','B' defb 0 ENDIF IF reqpag <> 0 .nomemory defb 1,'3','@',32,32,1,'2','J','C' defm "Not enough memory allocated to run application" defb 13,10,13,10 defm "Sorry, please try again later!" defb 0 ENDIF IF (NEED_expanded <> 0 ) .need_expanded_text defb 1,'3','@',32,32,1,'2','J','C' defm "Sorry, application needs an expanded machine" defb 13,10,13,10 defm "Try again when you have expanded your machine" defb 0 ENDIF ;-------- ; Include the stdio handle defaults if we need them ;-------- IF DEFINED_ANSIstdio .sgoprotos INCLUDE "#stdio_fp.asm" ENDIF ;-------- ; Variables need by crt0 code and some lib routines are kept in safe workspace ;-------- IF !DEFINED_sysdefvarsaddr defc sysdefvarsaddr = $1ffD-100-safedata ENDIF DEFVARS sysdefvarsaddr { __sgoioblk ds.b 40 ;stdio control block l_erraddr ds.w 1 ;Not sure if these are used... l_errlevel ds.b 1 coords ds.w 1 ;Graphics xy coordinates base_graphics ds.w 1 ;Address of graphics map gfx_bank ds.b 1 ;Bank that this is in _std_seed ds.w 1 ;Integer seed exitsp ds.w 1 ;atexit() stack exitcount ds.b 1 ;Number of atexit() routines fp_seed ds.w 3 ;Floating point seed (not used ATM) extra ds.w 3 ;Floating point spare register fa ds.w 3 ;Floating point accumulator fasign ds.b 1 ;Floating point variable packintrout ds.w 1 ;User interrupt handler snd_asave ds.b 1 ;Sound snd_tick ds.b 1 ;Sound } ;-------- ; If the user doesn't care where the heap variables go, dump them in safe space ;-------- IF !userheapvar defc userheapvar = 0 ENDIF IF userheapvar = 0 DEFVARS -1 { heapblocks ds.w 1 ;Number of free blocks heaplast ds.w 1 ;Pointer to linked blocks } ENDIF ;-------- ; Now, include the math routines if needed.. ;-------- IF NEED_floatpack INCLUDE "#float.asm" ENDIF ;------- ; If we have no safedata then set up defvars addr to point to bad memory ; If we use safedata then we can't have far memory ; We try to follow on from whereever the system data has been placed ;------- IF !safedata IF !DEFINED_defvarsaddr DEFINE DEFINED_defvarsaddr defc defvarsaddr = 8192 ENDIF DEFVARS defvarsaddr { dummydummy ds.b 1 } IF DEFINED_farheapsz INCLUDE "#app_crt0.as1" ENDIF ENDIF IF userheapvar = 1 DEFVARS -1 { heapblocks ds.w 1 ;Number of free blocks heaplast ds.w 1 ;Pointer to linked blocks } ENDIF z88dk-1.8.ds1/lib/aquarius_crt0.asm0000644000175000017500000000637010640546527016555 0ustar tygrystygrys; CRT0 for the Mattel Aquarius ; ; Stefano Bodrato Dec. 2000 ; ; If an error occurs eg break we just drop back to BASIC ; ; $Id: aquarius_crt0.asm,v 1.6 2007/06/27 20:49:27 dom Exp $ ; MODULE aquarius_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF __sgoioblk ;stdio info block XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF base_graphics ;Graphical variables XDEF coords ;Current xy position XDEF snd_tick ;Sound variable ;;org 14768 ; Mattel relocating loader org 14712 ; Simpler loader .start ld (start1+1),sp ;Save entry stack ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main ;Call user program .cleanup ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF .start1 ld sp,0 ;Restore stack to entry value ret .l_dcal jp (hl) ;Used for function pointer calls ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------- ; Now some variables ;----------- .coords defw 0 ; Current graphics xy coordinates .base_graphics defw $3028 ; Address of the Graphics map ; (text area-second line) ._std_seed defw 0 ; Seed for integer rand() routines .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF defm "Small C+ Aquarius" ;Unnecessary file signature defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/aquarius_crt0.opt0000644000175000017500000000003707411625244016565 0ustar tygrystygrys INCLUDE "#aquarius_crt0.asm" z88dk-1.8.ds1/lib/bas_crt0.asm0000644000175000017500000001110210640546527015455 0ustar tygrystygrys; Startup stub for z88 BBC BASIC programs ; ; Created 1/4/99 djm ; ; $Id: bas_crt0.asm,v 1.5 2007/06/27 20:49:27 dom Exp $ ;----------- ; The .def files that we need here ;----------- INCLUDE "#bastoken.def" INCLUDE "#ctrlchar.def" INCLUDE "#error.def" INCLUDE "#stdio.def" org $2300 ;----------- ; Dennis Groning's BASIC file header ;----------- .bas_first DEFB bas_last - bas_first ;Line Length ; DEFW 0 ;Row Number 0 can not be listed DEFW 1 DEFM BAS_IF & BAS_PAGE_G & "<>&2300" & BAS_THEN & BAS_NEW DEFM BAS_ELSE & BAS_LOMEM_P & "=&AFFF" & BAS_CALL & BAS_TO & "P" & CR .bas_last DEFB 0 DEFW $FFFF ;End of BASIC program. Next address is TOP. ;----------- ; Code starts executing from here ;----------- .start ld (start1+1),sp ;Save starting stack ld sp,($1ffe) ;Pick up stack from OZ safe place ld hl,-64 ;Make room for the atexit() table add hl,sp ld sp,hl ld (exitsp),sp call doerrhan ;Initialise a laughable error handler ;----------- ; Initialise the (ANSI) stdio descriptors so we can be called agin ;----------- IF DEFINED_ANSIstdio ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF call _main ;Run the program .cleanup ;Jump back here from exit() if needed IF DEFINED_ANSIstdio LIB closeall call closeall ;Close any open files (fopen) ENDIF call_oz(gn_nln) ;Print a new line call resterrhan ;Restore the original error handler .start1 ld sp,0 ;Restore stack to entry value ret ;Out we go ;----------- ; Install the error handler ;----------- .doerrhan xor a ld (exitcount),a ld b,0 ld hl,errhand call_oz(os_erh) ld (l_erraddr),hl ld (l_errlevel),a ret ;----------- ; Restore BASICs error handler ;----------- .resterrhan ld hl,(l_erraddr) ld a,(l_errlevel) ld b,0 call_oz(os_erh) .processcmd ;processcmd is called after os_tin ld hl,0 ret ;----------- ; The error handler ;----------- .errhand ret z ;Fatal error cp rc_esc jr z,errescpressed ld hl,(l_erraddr) ;Pass everything to BASIC's handler scf .l_dcal jp (hl) ;Used for function pointer calls also .errescpressed call_oz(os_esc) ;Acknowledge escape pressed jr cleanup ;Exit the program ;----------- ; Select which vfprintf routine is needed ;----------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ; We can't use far stuff with BASIC cos of paging issues so ; We assume all data is in fact near, so this is a dummy fn ; really ;----------- ; Far stuff can't be used with BASIC because of paging issues, so we assume ; that all data is near - this function is in fact a dummy and just adjusts ; the stack as required ;----------- ._cpfar2near pop bc pop hl pop de push bc ret ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;----------- ; Now some variables ;----------- .l_erraddr defw 0 ; BASIC error handler address .l_errlevel defb 0 ; And error level .coords defw 0 ; Current graphics xy coordinates .base_graphics defw 0 ; Address of the Graphics map .gfx_bank defb 0 ; And the bank ._std_seed defw 0 ; Seed for integer rand() routines .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack IF DEFINED_NEED1bitsound .snd_asave defb 0 ; Sound variable .snd_tick defb 0 ; " " ENDIF .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks .packintrout defw 0 ; Address of user interrupt routine ;----------- ; Unnecessary file signature ;----------- defm "Small C+ z88" defb 0 ;----------- ; Floating point ;----------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ; FP seed (unused ATM) .extra defs 6 ; Extra register temp store .fa defs 6 ; "" .fasign defb 0 ; "" ENDIF z88dk-1.8.ds1/lib/bastoken.def0000644000175000017500000000650607455120417015554 0ustar tygrystygryslstoff ; Dennis Groning 14 September 1998 ; BBC BASIC Z88 Tokens DEFC BAS_AND = 128 DEFC BAS_DIV = 129 DEFC BAS_EOR = 130 DEFC BAS_MOD = 131 DEFC BAS_OR = 132 DEFC BAS_ERROR = 133 DEFC BAS_LINE = 134 DEFC BAS_OFF = 135 DEFC BAS_STEP = 136 DEFC BAS_SPC = 137 DEFC BAS_TAB = 138 ;TAB( DEFC BAS_ELSE = 139 DEFC BAS_THEN = 140 DEFC BAS_OPENIN = 142 DEFC BAS_PTR_G = 143 ;Used to Get pseudo variable value DEFC BAS_PAGE_G = 144 ;Used to Get pseudo variable value DEFC BAS_TIME_G = 145 ;Used to Get pseudo variable value DEFC BAS_LOMEM_G = 146 ;Used to Get pseudo variable value DEFC BAS_HIMEM_G = 147 ;Used to Get pseudo variable value DEFC BAS_ABS = 148 DEFC BAS_ACS = 149 DEFC BAS_ADVAL = 150 DEFC BAS_ASC = 151 DEFC BAS_ASN = 152 DEFC BAS_ATN = 153 DEFC BAS_BGET = 154 DEFC BAS_COS = 155 DEFC BAS_COUNT = 156 DEFC BAS_DEG = 157 DEFC BAS_ERL = 158 DEFC BAS_ERR = 159 DEFC BAS_EVAL = 160 DEFC BAS_EXP = 161 DEFC BAS_EXT = 162 DEFC BAS_FALSE = 163 DEFC BAS_FN = 164 DEFC BAS_GET = 165 DEFC BAS_INKEY = 166 DEFC BAS_INSTR = 167 ;INSTR( DEFC BAS_INT = 168 DEFC BAS_LEN = 169 DEFC BAS_LN = 170 DEFC BAS_LOG = 171 DEFC BAS_NOT = 172 DEFC BAS_OPENUP = 173 DEFC BAS_OPENOUT = 174 DEFC BAS_PI = 175 DEFC BAS_POINT = 176 ;POINT( DEFC BAS_POS = 177 DEFC BAS_RAD = 178 DEFC BAS_RND = 179 DEFC BAS_SNG = 180 DEFC BAS_SIN = 181 DEFC BAS_SQR = 182 DEFC BAS_TAN = 183 DEFC BAS_TO = 184 DEFC BAS_TRUE = 185 DEFC BAS_USR = 186 DEFC BAS_VAL = 187 DEFC BAS_VPOS = 188 DEFC BAS_CHR = 189 ;CHR$ DEFC BAS_GET_STR = 190 ;GET$ DEFC BAS_INKEY_STR= 191 ;INKEY$ DEFC BAS_LEFT = 192 ;LEFT$( DEFC BAS_MID = 193 ;MID$( DEFC BAS_RIGHT = 194 ;RIGHT$( DEFC BAS_STR = 195 ;STR$ DEFC BAS_STRING = 196 ;STRING$( DEFC BAS_EOF = 197 DEFC BAS_AUTO = 198 DEFC BAS_DELETE = 199 DEFC BAS_LOAD = 200 DEFC BAS_LIST = 201 DEFC BAS_NEW = 202 DEFC BAS_OLD = 203 DEFC BAS_RENUMBER = 204 DEFC BAS_SAVE = 205 DEFC BAS_PUT = 206 DEFC BAS_PTR_P = 207 ;Used to Put pseudo variable value DEFC BAS_PAGE_P = 208 ;Used to Put pseudo variable value DEFC BAS_TIME_P = 209 ;Used to Put pseudo variable value DEFC BAS_LOMEM_P = 210 ;Used to Put pseudo variable value DEFC BAS_HIMEM_P = 211 ;Used to Put pseudo variable value DEFC BAS_SOUND = 212 DEFC BAS_BPUT = 213 DEFC BAS_CALL = 214 DEFC BAS_CHAIN = 215 DEFC BAS_CLEAR = 216 DEFC BAS_CLOSE = 217 DEFC BAS_CLG = 218 DEFC BAS_CLS = 219 DEFC BAS_DATA = 220 DEFC BAS_DEF = 221 DEFC BAS_DIM = 222 DEFC BAS_DRAW = 223 DEFC BAS_END = 224 DEFC BAS_ENDPROC = 225 DEFC BAS_ENVELOPE = 226 DEFC BAS_FOR = 227 DEFC BAS_GOSUB = 228 DEFC BAS_GOTO = 229 DEFC BAS_GCOL = 230 DEFC BAS_IF = 231 DEFC BAS_INPUT = 232 DEFC BAS_LET = 233 DEFC BAS_LOCAL = 234 DEFC BAS_MODE = 235 DEFC BAS_MOVE = 236 DEFC BAS_NEXT = 237 DEFC BAS_ON = 238 DEFC BAS_VDU = 239 DEFC BAS_PLOT = 240 DEFC BAS_PRINT = 241 DEFC BAS_PROC = 242 DEFC BAS_READ = 243 DEFC BAS_REM = 244 DEFC BAS_REPEAT = 245 DEFC BAS_REPORT = 246 DEFC BAS_RESTORE = 247 DEFC BAS_RETURN = 248 DEFC BAS_RUN = 249 DEFC BAS_STOP = 250 DEFC BAS_COLOUR = 251 DEFC BAS_TRACE = 252 DEFC BAS_UNTIL = 253 DEFC BAS_WIDTH = 254 DEFC BAS_OSCLI = 255 lston z88dk-1.8.ds1/lib/c128_crt0.asm0000644000175000017500000001034610640546527015376 0ustar tygrystygrys; Commodore 128 (Z80 mode) CRT0 stub ; ; Stefano Bodrato - 22/08/2001 ; ; $Id: c128_crt0.asm,v 1.9 2007/06/27 20:49:27 dom Exp $ ; MODULE c128_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ; No matter what set up we have, main is always, always external to ; this file XREF _main ; ; Some variables which are needed for both app and basic startup ; XDEF cleanup XDEF l_dcal ; Integer rnd seed XDEF _std_seed ; vprintf is internal to this file so we only ever include one of the set ; of routines XDEF _vfprintf ;Exit variables XDEF exitsp XDEF exitcount ; Graphics (pseudo) XDEF base_graphics ;Graphical variables XDEF coords ;Current xy position ;For stdin, stdout, stder XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ; Now, getting to the real stuff now! org $3000 .start di ;ld bc,$d018 ;ld a,$45 ;out (c),a ; 40 columns text at $2000 ld bc,$d018 ;ld a,$17 ; Standard display address ($400).. ld a,$87 ; Display addres at $2000... out (c),a ; ...and alternate (upper+lower) char set ld a,11 ;dark grey ld bc,$d020 out (c),a ;border inc c out (c),a ;& background ld hl,0 add hl,sp ld (start1+1),hl ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main ; Loop border color and wait for the RUNSTOP key ;.brdloop ld bc,$d020 ;border colour ; in a,(c) ; inc a ; out (c),a ; ld bc,$dc01 ;key in ; in a,(c) ; ??? inc bc ? ; in b,(c) ; cp b ; jr z,brdloop ;no key pressed .cleanup ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF .start1 ld sp,0 jp $FFE0 .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;Seed for integer rand() routines .defltdsk defb 0 ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; Graph .coords defw 0 ; Current graphics xy coordinates .base_graphics defw $2000 ; Address of the Graphics map ; mem stuff defm "Small C+ C128" defb 0 ;All the float stuff is kept in a different file...for ease of altering! ;It will eventually be integrated into the library ; ;Here we have a minor (minor!) problem, we've no idea if we need the ;float package if this is separated from main (we had this problem before ;but it wasn't critical..so, now we will have to read in a file from ;the directory (this will be produced by zcc) which tells us if we need ;the floatpackage, and if so what it is..kludgey, but it might just work! ; ;Brainwave time! The zcc_opt file could actually be written by the ;compiler as it goes through the modules, appending as necessary - this ;way we only include the package if we *really* need it! IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/c128ansi_crt0.opt0000644000175000017500000000003307455120417016257 0ustar tygrystygrys INCLUDE "#c128_crt0.asm" z88dk-1.8.ds1/lib/char.def0000644000175000017500000000063007455120417014653 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; Character management: DEFC Gn_Cls = $3009 ; Classify a character DEFC Gn_Skc = $3209 ; Bypass a character in a sequense DEFC Gn_Skd = $3409 ; Bypass delimiters in a sequense DEFC Gn_Skt = $3609 ; Search for character in a sequense lston z88dk-1.8.ds1/lib/clibs/0000755000175000017500000000000010765202715014353 5ustar tygrystygrysz88dk-1.8.ds1/lib/clibs/README0000644000175000017500000000206510762612624015237 0ustar tygrystygrysAll the libraries are in here, to keep them separate from the header files i (just makes my life easier, here's what they all are!) Z88 Libraries: farz88.lib Far access library for the z88 gfx.lib Graphics lib for BASIC compiles gfxapp.lib Graphics lib for Z88 application compiles z88_math.lib Z88 Maths Routines net.lib Stubs for the ZSock package (forthcoming) z88.lib z88 specific functions (mailboxing etc) z88_clib.lib The important one, contains all the other lib functions Generic Libraries: adt.lib Abstract Data Types (linked list, heap, etc) balloc.lib Block Memory Allocator gen_math.lib Generic Maths Library (suitable for all z80 machines) im2.lib Interrupt Mode 2 Library malloc.lib Near Malloc Routines z80_crt0.lib Startup routines common to all z80 machines Other machine libraries: zx_clib.lib Spectrum C library (64/32 column printing) zxan_clib.lib Spectrum C library (vt100/ANSI printing) nc_clib.lib Amstrad NC100 C library vz_clib.lib VZ200/300 library etc etc z88dk-1.8.ds1/lib/config/0000755000175000017500000000000010765202715014524 5ustar tygrystygrysz88dk-1.8.ds1/lib/config/abc80.lnx0000644000175000017500000000554310445313523016146 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/abc80_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -labc80_clib -lndos -DZ80 -DSMALL_C -DABC80 -D__ABC80__ -M -DSCCZ80 -Cz+abc80 z88dk-1.8.ds1/lib/config/abc800.lnx0000755000175000017500000000554610714614445016242 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/abc80_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -labc800_clib -lndos -DZ80 -DSMALL_C -DABC800 -D__ABC800__ -M -DSCCZ80 -Cz+abc80 z88dk-1.8.ds1/lib/config/aceansi.lnx0000644000175000017500000000553510445313523016655 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ace_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -laceansi_clib -lndos -DZ80 -DSMALL_C -DACE -D__ACE__ -M -DSCCZ80 -Cz+ace z88dk-1.8.ds1/lib/config/aquansi.lnx0000644000175000017500000000556510445313523016716 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/aquarius_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -laquansi_clib -lndos -DZ80 -DSMALL_C -DAQUARIUS -D__AQUARIUS__ -M -DSCCZ80 -Cz+aquarius z88dk-1.8.ds1/lib/config/aquarius.lnx0000644000175000017500000000556610445313523017110 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/aquarius_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -laquarius_clib -lndos -DZ80 -DSMALL_C -DAQUARIUS -D__AQUARIUS__ -M -DSCCZ80 -Cz+aquarius z88dk-1.8.ds1/lib/config/c128ansi.lnx0000644000175000017500000000554110445313523016577 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/c128ansi_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lc128ansi_clib -lndos -DZ80 -DSMALL_C -DC128 -D__C128__ -M -DSCCZ80 z88dk-1.8.ds1/lib/config/cpc.lnx0000644000175000017500000000553310445313523016015 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/cpc_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB cpc_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lcpc_clib -DZ80 -DSMALL_C -DCPC -D__CPC__ -M -DSCCZ80 -Cz+cpc z88dk-1.8.ds1/lib/config/cpcansi.lnx0000755000175000017500000000553710445313523016677 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/cpc_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB cpc_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lcpcansi_clib -DZ80 -DSMALL_C -DCPC -D__CPC__ -M -DSCCZ80 -Cz+cpc z88dk-1.8.ds1/lib/config/cpm.lnx0000644000175000017500000000552310445313523016026 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/cpm_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -oa.com -lcpm_clib -DZ80 -DSMALL_C -DCPM -D__CPM__ -M -DSCCZ80 z88dk-1.8.ds1/lib/config/embedded.lnx0000644000175000017500000000556710445313523017010 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/embedded_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo -iembedded_clib2 # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lembedded_clib -lndos -DZ80 -DSMALL_C -DEMBEDDED -D__EMBEDDED__ -DSCCZ80 -M z88dk-1.8.ds1/lib/config/m5.lnx0000644000175000017500000000551510445313523015571 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/m5_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lm5_clib -lndos -DZ80 -DSMALL_C -DM5 -D__M5__ -M -DSCCZ80 z88dk-1.8.ds1/lib/config/msx.lnx0000644000175000017500000000553110445313523016055 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/msx_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lmsx_clib -lndos -DZ80 -DSMALL_C -DMSX -D__MSX__ -M -DSCCZ80 -Cz+msx z88dk-1.8.ds1/lib/config/mz.lnx0000644000175000017500000000553610445313523015701 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/mz_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lmz_clib -lndos -DZ80 -DSMALL_C -DSHARPMZ -D__SHARPMZ__ -M -DSCCZ80 -Cz+mz z88dk-1.8.ds1/lib/config/mzansi.lnx0000644000175000017500000000554210445313523016551 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/mz_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lmzansi_clib -lndos -DZ80 -DSMALL_C -DSHARPMZ -D__SHARPMZ__ -M -DSCCZ80 -Cz+mz z88dk-1.8.ds1/lib/config/nasansi.lnx0000755000175000017500000000553710545004044016707 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/cpc_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB cpc_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lnasansi_clib -lndos -DZ80 -DSMALL_C -DNASCOM -D__NASCOM__ -M -DSCCZ80 -Cz+nas z88dk-1.8.ds1/lib/config/nascom.lnx0000755000175000017500000000553610545004044016532 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/cpc_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB cpc_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lnascom_clib -lndos -DZ80 -DSMALL_C -DNASCOM -D__NASCOM__ -M -DSCCZ80 -Cz+nas z88dk-1.8.ds1/lib/config/nc.lnx0000644000175000017500000000552610551446567015667 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/nc100_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lnc_clib -lndos -DZ80 -DSMALL_C -DNC100 -D__NC100__ -M -DSCCZ80 z88dk-1.8.ds1/lib/config/newbrain.lnx0000755000175000017500000000555310630555201017057 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/newbrain_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lnewbrain_clib -DZ80 -DSMALL_C -DNEWBRAIN -D__NEWBRAIN__ -M -DSCCZ80 -Cz+newbrain z88dk-1.8.ds1/lib/config/ozansi.lnx0000644000175000017500000000552110445313523016550 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/oz_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lozansi_clib -lndos -DZ80 -DSMALL_C -DOZ -D__OZ__ -M -DSCCZ80 z88dk-1.8.ds1/lib/config/pps.lnx0000644000175000017500000000552410445313523016052 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/pps_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lpps_clib -DZ80 -DSMALL_C -DSPRINTER -D__SPRINTER__ -M -DSCCZ80 z88dk-1.8.ds1/lib/config/ppsansi.lnx0000644000175000017500000000553010445313523016722 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/pps_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lppsansi_clib -DZ80 -DSMALL_C -DSPRINTER -D__SPRINTER__ -M -DSCCZ80 z88dk-1.8.ds1/lib/config/rcmx000.lnx0000755000175000017500000000555510647203164016453 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/rcmx000_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lrcmx000_clib -lndos -DZ80 -DSMALL_C -DRCMX000 -D__RCMX000__ -M -DSCCZ80 -Cz+rcmx000 -Ca-RCMX000 z88dk-1.8.ds1/lib/config/rex.lnx0000644000175000017500000000553710445313523016052 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/rex_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -IDESTDIR/include/rex -lrex_clib -make-app -DZ80 -DSMALL_C -DREX -D__REX__ -M -Wn39 -Wn40 -DSCCZ80 -Cz+rex z88dk-1.8.ds1/lib/config/rexlib.lnx0000644000175000017500000000553710445313523016541 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER mkaddin # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/rxl_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -IDESTDIR/include/rex -lrex_clib -make-app -DZ80 -DSMALL_C -DREX -D__REX__ -M -Wn39 -Wn40 -DSCCZ80 -Cz+rex z88dk-1.8.ds1/lib/config/sam.lnx0000644000175000017500000000552110445313523016025 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/sam_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lsam_clib -lndos -DZ80 -DSMALL_C -DSAM -D__SAM__ -M -DSCCZ80 z88dk-1.8.ds1/lib/config/samansi.lnx0000755000175000017500000000551410445313523016705 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/sam_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lsamansi_clib -lndos -DZ80 -DSMALL_C -DSAM -D__SAM__ -M z88dk-1.8.ds1/lib/config/sms.lnx0000644000175000017500000000557010630373257016061 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/sms_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lsms_clib -lndos -DZ80 -DSMALL_C -DSMS -D__SMS__ -DSCCZ80 -M -make-app -D__HAVESEED -Cz+sms -Cz-n z88dk-1.8.ds1/lib/config/svi.lnx0000644000175000017500000000553110445313523016047 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/svi_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lsvi_clib -lndos -DZ80 -DSMALL_C -DSVI -D__SVI__ -M -DSCCZ80 -Cz+svi z88dk-1.8.ds1/lib/config/test.lnx0000644000175000017500000000552110702216057016224 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Test Machine, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/test_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB zx_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # test_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -ltest_clib -DZ80 -DSMALL_C -M -DSCCZ80 -Cz+test z88dk-1.8.ds1/lib/config/ti82.lnx0000644000175000017500000000553610445313523016041 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ti82_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti82_clib -lndos -DZ80 -DSMALL_C -DTI82 -D__TI82__ -M -DSCCZ80 -Cz+ti82 z88dk-1.8.ds1/lib/config/ti82ansi.lnx0000644000175000017500000000554210445313523016711 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ti82_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti82ansi_clib -lndos -DZ80 -DSMALL_C -DTI82 -D__TI82__ -M -DSCCZ80 -Cz+ti82 z88dk-1.8.ds1/lib/config/ti83.lnx0000644000175000017500000000553610445313523016042 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ti83_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti83_clib -lndos -DZ80 -DSMALL_C -DTI83 -D__TI83__ -M -DSCCZ80 -Cz+ti83 z88dk-1.8.ds1/lib/config/ti83ansi.lnx0000644000175000017500000000554210445313523016712 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ti83_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti83ansi_clib -lndos -DZ80 -DSMALL_C -DTI83 -D__TI83__ -M -DSCCZ80 -Cz+ti83 z88dk-1.8.ds1/lib/config/ti85.lnx0000644000175000017500000000553610445313523016044 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ti85_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti85_clib -lndos -DZ80 -DSMALL_C -DTI85 -D__TI85__ -M -DSCCZ80 -Cz+ti85 z88dk-1.8.ds1/lib/config/ti85ansi.lnx0000644000175000017500000000554210445313523016714 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ti85_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti85ansi_clib -lndos -DZ80 -DSMALL_C -DTI85 -D__TI85__ -M -DSCCZ80 -Cz+ti85 z88dk-1.8.ds1/lib/config/ti86.lnx0000644000175000017500000000553610445313523016045 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ti86_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti86_clib -lndos -DZ80 -DSMALL_C -DTI86 -D__TI86__ -M -DSCCZ80 -Cz+ti86 z88dk-1.8.ds1/lib/config/ti86ansi.lnx0000644000175000017500000000554210445313523016715 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ti86_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti86ansi_clib -lndos -DZ80 -DSMALL_C -DTI86 -D__TI86__ -M -DSCCZ80 -Cz+ti86 z88dk-1.8.ds1/lib/config/ti8x.lnx0000644000175000017500000000554010445313523016142 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ti83p_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti83p_clib -lndos -DZ80 -DSMALL_C -DTI8x -D__TI8x__ -M -DSCCZ80 -Cz+ti8x z88dk-1.8.ds1/lib/config/ti8xansi.lnx0000644000175000017500000000554410445313523017021 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ti83p_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti83pansi_clib -lndos -DZ80 -DSMALL_C -DTI8x -D__TI8x__ -M -DSCCZ80 -Cz+ti8x z88dk-1.8.ds1/lib/config/ts2068.lnx0000755000175000017500000000555110603615667016233 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ts2068_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB zx_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lts2068_clib -DZ80 -DSMALL_C -DSPECTRUM -D__SPECTRUM__ -M -DSCCZ80 -Cz+zx z88dk-1.8.ds1/lib/config/ts2068ansi.lnx0000755000175000017500000000555510603615667017112 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/ts2068an_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB zx_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lts2068an_clib -DZ80 -DSMALL_C -DSPECTRUM -D__SPECTRUM__ -M -DSCCZ80 -Cz+zx z88dk-1.8.ds1/lib/config/vz.lnx0000644000175000017500000000552310445313523015706 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/vz_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lvz_clib -lndos -DZ80 -DSMALL_C -DVZ200 -D__VZ200__ -M -DSCCZ80 z88dk-1.8.ds1/lib/config/vzansi.lnx0000644000175000017500000000552710445313524016566 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/vz_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lvzansi_clib -lndos -DZ80 -DSMALL_C -DVZ200 -D__VZ200__ -M -DSCCZ80 z88dk-1.8.ds1/lib/config/z88.lnx0000644000175000017500000000551410445313524015701 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/z88_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lz88_clib -DZ80 -DSMALL_C -DZ88 -D__Z88__ -M -oa.bas -DSCCZ80 -Cz+z88 z88dk-1.8.ds1/lib/config/z88ansi.lnx0000644000175000017500000000551010445313524016550 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/z88_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lz88ansi_clib -DZ80 -DSMALL_C -DZ88 -D__Z88__ -M -DSCCZ80 -Cz+z88 z88dk-1.8.ds1/lib/config/z88net.lnx0000644000175000017500000000553110445313524016407 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/z88_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lz88net_clib -lnet -DNET_STDIO -DZ80 -DSMALL_C -DZ88 -D__Z88__ -M -DSCCZ80 -Cz+z88 z88dk-1.8.ds1/lib/config/zx.lnx0000644000175000017500000000554310445313524015713 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/spec_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB zx_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lzx_clib -DZ80 -DSMALL_C -DSPECTRUM -D__SPECTRUM__ -M -DSCCZ80 -Cz+zx z88dk-1.8.ds1/lib/config/zx81.lnx0000644000175000017500000000563410701251515016061 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # $Id: zx81.lnx,v 1.9 2007/10/04 20:55:41 stefano Exp $ # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/zx81_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80iy_crt0 GENMATHLIB m81 # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -Ca-IXIY -lzx81_clib -lndos -DZ80 -DSMALL_C -DZX81 -D__ZX81__ -M -DSCCZ80 -Cz+zx81 z88dk-1.8.ds1/lib/config/zx81ansi.lnx0000644000175000017500000000564410701251515016735 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # $Id: zx81ansi.lnx,v 1.9 2007/10/04 20:55:41 stefano Exp $ # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/zx81_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80iy_crt0 GENMATHLIB m81 # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -Ca-IXIY -lzx81ansi_clib -lndos -DZ80 -DSMALL_C -DZX81 -D__ZX81__ -M -DSCCZ80 -Cz+zx81 z88dk-1.8.ds1/lib/config/zxansi.lnx0000644000175000017500000000554410445313524016567 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm MPMEXE mpm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD cp APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg DESTDIR/include # INCPATH -IDESTDIR/include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg DESTDIR/lib/z80rules.1 # COPTRULES1 DESTDIR/lib/z80rules.1 COPTRULES2 DESTDIR/lib/z80rules.2 COPTRULES3 DESTDIR/lib/z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 DESTDIR/lib/spec_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -iDESTDIR/lib/clibs/ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB zx_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lzxan_clib -DZ80 -DSMALL_C -DSPECTRUM -D__SPECTRUM__ -M -DSCCZ80 -Cz+zx z88dk-1.8.ds1/lib/cpc_crt0.asm0000644000175000017500000000635510650475073015471 0ustar tygrystygrys; CRT0 for the Amstrad CPC family ; ; Stefano Bodrato 8/6/2000 ; ; $Id: cpc_crt0.asm,v 1.9 2007/07/21 21:27:23 dom Exp $ ; MODULE cpc_crt0 INCLUDE "zcc_opt.def" XREF _main XDEF cleanup XDEF l_dcal XDEF firmware XDEF _vfprintf XDEF _std_seed XDEF exitsp XDEF exitcount ;For stdin, stdout, stder XDEF __sgoioblk ; Graphics stuff XDEF base_graphics XDEF coords ; Now, getting to the real stuff now! IF !myzorg defc myzorg = $6000 ENDIF org myzorg org myzorg .start di ld (start1+1),sp ld hl,-6530 add hl,sp ld sp,hl ld (exitsp),sp exx ld (firmware_bc),bc push af pop hl ld (firmware_af),hl exx IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF ; INIT math identify platform IF NEED_floatpack LIB init_floatpack call init_floatpack ENDIF call _main .cleanup ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF .start1 ld sp,0 ei ret .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ; Function to call firmware function ; ix = firmware routine to call ; .firmware exx ; Use alternate registers ex (sp),hl ; get return address ld c,(hl) inc hl ld b,(hl) ; BC=BASIC address inc hl ex (sp),hl ; restore return address push bc ld bc,(firmware_bc) ld hl,(firmware_af) push hl pop af exx ; Back to the regular set ret ; And call the firmware routine ._std_seed defw 0 ; Default seed .exitsp defw 0 ; atexit .exitcount defb 0 .base_graphics defw $C000 .coords defw 0 .firmware_bc defw 0 .firmware_af defw 0 defm "Small C+ CPC" defb 0 IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/cpc_crt0.opt0000644000175000017500000000003207315223700015465 0ustar tygrystygrys INCLUDE "#cpc_crt0.asm" z88dk-1.8.ds1/lib/cpcfirm.def0000644000175000017500000001734010650475073015371 0ustar tygrystygryslstoff ; CPC Firmware Calculations ; ; September 2003 ; $Id: cpcfirm.def,v 1.3 2007/07/21 21:27:23 dom Exp $ ; XREF firmware ; Interposer for firmware routines defc kl_choke_off = $bcc8 defc kl_rom_walk = $bccb defc kl_init_back = $bcce defc kl_log_ext = $bcd1 defc kl_find_command = $bcd4 defc kl_new_framefly = $bcd7 defc kl_add_framefly = $bcda defc kl_del_framefly = $bcdd defc kl_new_fast_ticker = $bce0 defc kl_add_fast_ticker = $bce3 defc kl_del_fast_ticker = $bce6 defc kl_add_ticker = $bce9 defc kl_del_ticker = $bcec defc kl_init_event = $bcef defc kl_event = $bcf2 defc kl_sync_reset = $bcf5 defc kl_del_synchronous = $bcf8 defc kl_next_sync = $bcfb defc kl_do_sync = $bcfe defc kl_done_sync = $bd01 defc kl_event_disable = $bd04 defc kl_event_enable = $bd07 defc kl_disarm_event = $bd0a defc kl_time_please = $bd0d defc kl_time_set = $bd10 defc km_initialise = $bb00 defc km_reset = $bb03 defc km_wait_char = $bb06 defc km_read_char = $bb09 defc km_char_return = $bb0c defc km_set_expand = $bb0f defc km_get_expand = $bb12 defc km_exp_buffer = $bb15 defc km_wait_key = $bb18 defc km_read_key = $bb1b defc km_test_key = $bb1e defc km_get_state = $bb21 defc km_get_joystick = $bb24 defc km_set_translate = $bb27 defc km_get_translate = $bb2a defc km_set_shift = $bb2d defc km_get_shift = $bb30 defc km_set_control = $bb33 defc km_get_control = $bb36 defc km_set_repeat = $bb39 defc km_get_repeat = $bb3c defc km_set_delay = $bb3f defc km_get_delay = $bb42 defc km_arm_break = $bb45 defc km_disarm_break = $bb48 defc km_break_event = $bb4b defc txt_initialise = $bb4e defc txt_reset = $bb51 defc txt_vdu_enable = $bb54 defc txt_vdu_disable = $bb57 defc txt_output = $bb5a defc txt_wr_char = $bb5d defc txt_rd_char = $bb60 defc txt_set_graphic = $bb63 defc txt_win_enable = $bb66 defc txt_get_window = $bb69 defc txt_clear_window = $bb6c defc txt_set_column = $bb6f defc txt_set_row = $bb72 defc txt_set_cursor = $bb75 defc txt_get_cursor = $bb78 defc txt_cur_enable = $bb7b defc txt_cur_disable = $bb7e defc txt_cur_on = $bb81 defc txt_cur_off = $bb84 defc txt_validate = $bb87 defc txt_place_cursor = $bb8a defc txt_remove_cursor = $bb8d defc txt_set_pen = $bb90 defc txt_get_pen = $bb93 defc txt_set_paper = $bb96 defc txt_get_paper = $bb99 defc txt_inverse = $bb9c defc txt_set_back = $bb9f defc txt_get_back = $bba2 defc txt_get_matrix = $bba5 defc txt_set_matrix = $bba8 defc txt_set_m_table = $bbab defc txt_get_m_table = $bbae defc txt_get_controls = $bbb1 defc txt_str_select = $bbb4 defc txt_swap_streams = $bbb7 defc gra_initialise = $bbba defc gra_reset = $bbbd defc gra_move_absolute = $bbc0 defc gra_move_relative = $bbc3 defc gra_ask_cursor = $bbc6 defc gra_set_origin = $bbc9 defc gra_get_origin = $bbcc defc gra_win_width = $bbcf defc gra_win_height = $bbd2 defc gra_get_w_width = $bbd5 defc gra_get_w_height = $bbd8 defc gra_clear_window = $bbdb defc gra_set_pen = $bbde defc gra_get_pen = $bbe1 defc gra_set_paper = $bbe4 defc gra_get_paper = $bbe7 defc gra_plot_absolute = $bbea defc gra_plot_relative = $bbed defc gra_test_absolute = $bbf0 defc gra_test_relative = $bbf3 defc gra_line_absolute = $bbf6 defc gra_line_relative = $bbf9 defc gra_wr_char = $bbfc defc scr_initialise = $bbff defc scr_reset = $bc02 defc scr_set_offset = $bc05 defc scr_set_base = $bc08 defc scr_get_location = $bc0b defc scr_set_mode = $bc0e defc scr_get_mode = $bc11 defc scr_clear = $bc14 defc scr_char_limits = $bc17 defc scr_char_position = $bc1a defc scr_dot_position = $bc1d defc scr_next_byte = $bc20 defc scr_prev_byte = $bc23 defc scr_next_line = $bc26 defc scr_prev_line = $bc29 defc scr_ink_encode = $bc2c defc scr_ink_decode = $bc2f defc scr_set_ink = $bc32 defc scr_get_ink = $bc35 defc scr_set_border = $bc38 defc scr_get_border = $bc3b defc scr_set_flashing = $bc3e defc scr_get_flashing = $bc41 defc scr_fill_box = $bc44 defc scr_flood_box = $bc17 defc scr_char_invert = $bc4a defc scr_hw_roll = $bc4d defc scr_sw_roll = $bc50 defc scr_unpack = $bc53 defc scr_repack = $bc56 defc scr_access = $bc59 defc scr_pixels = $bc5c defc scr_horizontal = $bc5f defc scr_vertical = $bc62 defc cas_initialise = $bc65 defc cas_set_speed = $bc68 defc cas_noisy = $bc6b defc cas_start_motor = $bc6e defc cas_stop_motor = $bc71 defc cas_restore_motor = $bc74 defc cas_in_open = $bc77 defc cas_in_close = $bc7a defc cas_in_abandon = $bc7d defc cas_in_char = $bc80 defc cas_in_direct = $bc83 defc cas_return = $bc86 defc cas_test_eof = $bc89 defc cas_out_open = $bc8c defc cas_out_close = $bc8f defc cas_out_abandon = $bc92 defc cas_out_char = $bc95 defc cas_out_direct = $bc98 defc cas_catalog = $bc9b defc cas_write = $bc9e defc cas_read = $bca1 defc cas_check = $bca4 defc sound_reset = $bca7 defc sound_queue = $bcaa defc sound_check = $bcad defc sound_arm_event = $bcb0 defc sound_release = $bcb3 defc sound_hold = $bcb6 defc sound_continue = $bcb9 defc sound_ampl_envelope = $bcbc defc sound_tone_envelope = $bcbf defc sound_a_address = $bcc2 defc sound_t_address = $bcc5 defc mc_boot_program = $bd13 defc mc_start_program = $bd16 defc mc_wait_flyback = $bd19 defc mc_set_mode = $bd1c defc mc_screen_offset = $bd1f defc mc_clear_inks = $bd22 defc mc_set_inks = $bd25 defc mc_reset_printer = $bd28 defc mc_print_char = $bd2b defc mc_busy_printer = $bd2e defc mc_send_printer = $bd31 defc mc_sound_register = $bd34 defc mc_jump_restore = $bd37 defc bios_set_message = $c033 defc bios_setup_disc = $c036 defc bios_select_format = $c039 defc bios_read_sector = $c03c defc bios_write_sector = $c03f defc bios_format_track = $c042 defc bios_move_track = $c045 defc bios_get_status = $c048 defc bios_set_retry_count = $c04b defc bios_get_sector_data = $c56c ; 664 + 6128 only defc km_set_locks = $bd3a defc km_flush = $bd3d defc txt_ask_state = $bd40 defc gra_default = $bd43 defc gra_set_back = $bd46 defc gra_set_first = $bd49 defc gra_set_line_mask = $bd4c defc gra_from_user = $bd4f defc gra_fill = $bd52 defc scr_set_position = $bd55 defc mc_print_translation = $bd58 defc kl_bank_switch = $bd5b ; 6128 only lston z88dk-1.8.ds1/lib/cpcfp.def0000644000175000017500000000774207724157277015061 0ustar tygrystygryslstoff ; CPC Calculator Functions ; ; August 2003 **_|warp6|_** ; $Id: cpcfp.def,v 1.2 2003/08/30 17:28:31 dom Exp $ ; ; We define constants for 464 and 664 and also a default set ; The default set is normally for the 6128, but with the ; appropriate "for" define we can switch to a different target ; this is used to generate the individual libraries for each ; target ; Definitions for CPC464 defc CPCFP464_INT_2_FLO = $40 defc CPCFP464_BIN_2_FLO = $43 defc CPCFP464_FLO_BINFIX = $4C defc CPCFP464_FLO_2_INT = $46 defc CPCFP464_FLO_ADD = $58 defc CPCFP464_FLO_REV_SUB = $5E defc CPCFP464_FLO_MUL = $61 defc CPCFP464_FLO_DIV = $64 defc CPCFP464_FLO_INV_SGN = $6D defc CPCFP464_FLO_CMP = $6A defc CPCFP464_FLO_DEG_RAD = $73 defc CPCFP464_FLO_PI = $76 defc CPCFP464_FLO_SQRT = $79 defc CPCFP464_FLO_POW = $7C defc CPCFP464_FLO_POW10 = $55 defc CPCFP464_FLO_LOG = $7F defc CPCFP464_FLO_LOG10 = $82 defc CPCFP464_FLO_EXP = $85 defc CPCFP464_FLO_SIN = $88 defc CPCFP464_FLO_COS = $8B defc CPCFP464_FLO_TAN = $8E defc CPCFP464_FLO_ATAN = $91 defc CPCFP464_FLO_RND = $9D ; Definitions for CPC664 defc CPCFP664_INT_2_FLO = $61 defc CPCFP664_BIN_2_FLO = $64 defc CPCFP664_FLO_BINFIX = $6D defc CPCFP664_FLO_2_INT = $67 defc CPCFP664_FLO_ADD = $79 defc CPCFP664_FLO_REV_SUB = $7F defc CPCFP664_FLO_MUL = $82 defc CPCFP664_FLO_DIV = $85 defc CPCFP664_FLO_INV_SGN = $8E defc CPCFP664_FLO_CMP = $91 defc CPCFP664_FLO_DEG_RAD = $94 defc CPCFP664_FLO_PI = $97 defc CPCFP664_FLO_SQRT = $9A defc CPCFP664_FLO_POW = $9D defc CPCFP664_FLO_POW10 = $76 defc CPCFP664_FLO_LOG = $A0 defc CPCFP664_FLO_LOG10 = $A3 defc CPCFP664_FLO_EXP = $A6 defc CPCFP664_FLO_SIN = $A9 defc CPCFP664_FLO_COS = $AC defc CPCFP664_FLO_TAN = $AF defc CPCFP664_FLO_ATAN = $B2 defc CPCFP664_FLO_RND = $7C IF forCPC464 defc CPCFP_INT_2_FLO = $40 defc CPCFP_BIN_2_FLO = $43 defc CPCFP_FLO_BINFIX = $4C defc CPCFP_FLO_2_INT = $46 defc CPCFP_FLO_ADD = $58 defc CPCFP_FLO_REV_SUB = $5E defc CPCFP_FLO_MUL = $61 defc CPCFP_FLO_DIV = $64 defc CPCFP_FLO_INV_SGN = $6D defc CPCFP_FLO_CMP = $6A defc CPCFP_FLO_DEG_RAD = $73 defc CPCFP_FLO_PI = $76 defc CPCFP_FLO_SQRT = $79 defc CPCFP_FLO_POW = $7C defc CPCFP_FLO_POW10 = $55 defc CPCFP_FLO_LOG = $7F defc CPCFP_FLO_LOG10 = $82 defc CPCFP_FLO_EXP = $85 defc CPCFP_FLO_SIN = $88 defc CPCFP_FLO_COS = $8B defc CPCFP_FLO_TAN = $8E defc CPCFP_FLO_ATAN = $91 defc CPCFP_FLO_RND = $9D ELSE IF forCPC664 defc CPCFP_INT_2_FLO = $61 defc CPCFP_BIN_2_FLO = $64 defc CPCFP_FLO_BINFIX = $6D defc CPCFP_FLO_2_INT = $67 defc CPCFP_FLO_ADD = $79 defc CPCFP_FLO_REV_SUB = $7F defc CPCFP_FLO_MUL = $82 defc CPCFP_FLO_DIV = $85 defc CPCFP_FLO_INV_SGN = $8E defc CPCFP_FLO_CMP = $91 defc CPCFP_FLO_DEG_RAD = $94 defc CPCFP_FLO_PI = $97 defc CPCFP_FLO_SQRT = $9A defc CPCFP_FLO_POW = $9D defc CPCFP_FLO_POW10 = $76 defc CPCFP_FLO_LOG = $A0 defc CPCFP_FLO_LOG10 = $A3 defc CPCFP_FLO_EXP = $A6 defc CPCFP_FLO_SIN = $A9 defc CPCFP_FLO_COS = $AC defc CPCFP_FLO_TAN = $AF defc CPCFP_FLO_ATAN = $B2 defc CPCFP_FLO_RND = $7C ELSE defc CPCFP_INT_2_FLO = $BD64 defc CPCFP_BIN_2_FLO = $BD67 defc CPCFP_FLO_BINFIX = $BD70 defc CPCFP_FLO_2_INT = $BD6A defc CPCFP_FLO_ADD = $BD7C defc CPCFP_FLO_REV_SUB = $BD82 defc CPCFP_FLO_MUL = $BD85 defc CPCFP_FLO_DIV = $BD88 defc CPCFP_FLO_INV_SGN = $BD91 defc CPCFP_FLO_CMP = $BD8E defc CPCFP_FLO_DEG_RAD = $BD97 defc CPCFP_FLO_PI = $BD9A defc CPCFP_FLO_SQRT = $BD9D defc CPCFP_FLO_POW = $BDA0 defc CPCFP_FLO_POW10 = $BD79 defc CPCFP_FLO_LOG = $BDA3 defc CPCFP_FLO_LOG10 = $BDA6 defc CPCFP_FLO_EXP = $BDA9 defc CPCFP_FLO_SIN = $BDAC defc CPCFP_FLO_COS = $BDAF defc CPCFP_FLO_TAN = $BDB2 defc CPCFP_FLO_ATAN = $BDB5 defc CPCFP_FLO_RND = $BD7F ENDIF lston z88dk-1.8.ds1/lib/cpm_crt0.asm0000644000175000017500000001172410730213552015466 0ustar tygrystygrys; ; Startup for CP/M ; ; Stefano Bodrato - Apr. 2000 ; Apr. 2001: Added MS-DOS protection ; ; Dominic Morris - Jan. 2001: Added argc/argv support ; - Jan. 2001: Added in malloc routines ; - Jan. 2001: File support added ; ; $Id: cpm_crt0.asm,v 1.9 2007/12/13 11:28:42 stefano Exp $ ; ; There are a couple of #pragma commands which affect ; this file: ; ; #pragma no-streams - No stdio disc files ; #pragma no-fileio - No fileio at all ; #pragma no-protectmsdos - strip the MS-DOS protection header ; ; These can cut down the size of the resultant executable MODULE cpm_crt0 ;------------------------------------------------- ; Include zcc_opt.def to find out some information ;------------------------------------------------- INCLUDE "zcc_opt.def" ;----------------------- ; Some scope definitions ;----------------------- XREF _main ;main() is always external to crt0 XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF _vfprintf ;jp to printf core routine XDEF exitsp ;atexit() variables XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks ; XDEF __sgoioblk ;std* control block XDEF __fcb ;file control block org $100 ;---------------------- ; Execution starts here ;---------------------- .start IF !DEFINED_noprotectmsdos defb $eb,$04 ;DOS protection... JMPS LABE ex de,hl jp begin defb $b4,$09 ;DOS protection... MOV AH,9 defb $ba defw dosmessage ;DOS protection... MOV DX,OFFSET dosmessage defb $cd,$21 ;DOS protection... INT 21h. defb $cd,$20 ;DOS protection... INT 20h. .dosmessage defm "This program is for a CP/M system." defb 13,10,'$' .begin ENDIF ld (start1+1),sp ;Save entry stack ld a,($80) ;byte count of length of args inc a ;we can use this since args are space separated neg ld l,a ld h,-1 ;negative number ld de,-64 ;Add on space for atexit() stack add hl,de add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF ld c,25 ;Set the default disc call 5 ld (defltdsk),a ; Push pointers to argv[n] onto the stack now ; We must start from the end ld hl,0 ;NULL pointer at end, just in case push hl ld hl,$80 ld a,(hl) ld b,0 and a jr z,argv_done ld c,a add hl,bc ;now points to the end ; Try to find the end of the arguments .argv_loop_1 ld a,(hl) cp ' ' jr nz,argv_loop_2 ld (hl),0 dec hl dec c jr nz,argv_loop_1 ; We've located the end of the last argument, try to find the start .argv_loop_2 ld a,(hl) cp ' ' jr nz,argv_loop_3 ld (hl),0 inc hl push hl inc b dec hl .argv_loop_3 dec hl dec c jr nz,argv_loop_2 .argv_done ld hl,end ;name of program (NULL) push hl inc b ld hl,0 add hl,sp ;address of argv ld c,b ld b,0 push bc ;argc push hl ;argv call _main ;Call user code pop bc ;kill argv pop bc ;kill argc ld a,(defltdsk) ;Restore default disc ld e,a ld c,14 call 5 .cleanup push hl ;Save return value IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall ;Close any opened files call closeall ENDIF ENDIF pop bc ;Get exit() value into bc .start1 ld sp,0 ;Pick up entry sp jp 0 .l_dcal jp (hl) ;Used for call by function ptr ;------------------------ ; The stdio control block ;------------------------ .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ;Dummy values (unused by CPM port?) ENDIF ;---------------------------------------- ; Work out which vfprintf routine we need ;---------------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------------------- ; Some startup variables ;----------------------- .defltdsk defb 0 ;Default disc ._std_seed defw 0 ;Integer seed .exitsp defw 0 ;Address of atexit() stack .exitcount defb 0 ;Number of atexit() routinens .heaplast defw 0 ;Pointer to last free heap block .heapblocks defw 0 ;Number of heap blocks available IF !DEFINED_nofileio .__fcb defs 420,0 ;file control block (10 files) (MAXFILE) ENDIF ;---------------------------- ; Unneccessary file signature ;---------------------------- defm "Small C+ CP/M" .end defb 0 ;---------------------------------------------- ; Floating point support routines and variables ;---------------------------------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ; FP seed (unused ATM) .extra defs 6 ; FP spare register .fa defs 6 ; FP accumulator .fasign defb 0 ; FP variable ENDIF z88dk-1.8.ds1/lib/cpm_crt0.opt0000644000175000017500000000003207130401717015500 0ustar tygrystygrys INCLUDE "#cpm_crt0.asm" z88dk-1.8.ds1/lib/ctrlchar.def0000644000175000017500000000154607455120417015547 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989 ; Dennis Groning 14 September 1998 ;ASCII Control characters DEFC NUL = 0 DEFC SOH = 1 DEFC STX = 2 DEFC ETX = 3 DEFC EOT = 4 DEFC ENQ = 5 DEFC ACK = 6 DEFC BEL = 7 DEFC BS = 8 DEFC HT = 9 ; DEFC LF = 10 DEFC VT = 11 DEFC FF = 12 ; DEFC CR = 13 DEFC SO = 14 DEFC SI = 15 DEFC DLE = 16 DEFC DC1 = 17 DEFC DC2 = 18 DEFC DC3 = 19 DEFC DC4 = 20 DEFC NAK = 21 DEFC SYN = 22 DEFC ETB = 23 DEFC CAN = 24 DEFC EM = 25 DEFC SUB = 26 ; DEFC ESC = 27 DEFC FS = 28 DEFC GS = 29 DEFC RS = 30 DEFC US = 31 DEFC DEL = 127 DEFC XON = 17 DEFC XOFF = 19 lston z88dk-1.8.ds1/lib/dev_crt0.asm0000644000175000017500000000030407130401717015457 0ustar tygrystygrys; ; Startup code for ZSock devices.. ; ; 25/1/2000 ; ; Errm, there is none!!! ; ; Device is loaded to 8192 ; ; Devices can't use any stdio routines ; (ZSock Kernel doesn't either) org 8192 z88dk-1.8.ds1/lib/director.def0000644000175000017500000000715507455120417015562 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; Director/CLI low level access: DEFC Dc_Alt = $1A0C ; Pass an alternative character DEFC Dc_Bye = $080C ; Exiting current application (internal) DEFC Dc_Ent = $0A0C ; Enter new application (internal) DEFC Dc_Gen = $200C ; Screen driver call (internal) DEFC Dc_Icl = $140C ; Invoke new CLI DEFC Dc_In = $0E0C ; Read from CLI (internal) DEFC Dc_Ini = $060C ; Initialize the Director (internal) DEFC Dc_Nam = $0C0C ; Name current application DEFC Dc_Nq = $160C ; Handle Director/CLI enquiries (internal) DEFC Dc_Out = $100C ; Write to CLI (internal) DEFC Dc_Pol = $220C ; Poll for card usage (internal) DEFC Dc_Prt = $120C ; Print to CLI (internal) DEFC Dc_Rbd = $1C0C ; Rebind streams ; arguments: DEFC RB_IN = $00 ; input stream - new source of input DEFC RB_OUT = $01 ; output stream - new destination for output DEFC RB_PRT = $02 ; printer stream - new destination for output DEFC RB_INT = $03 ; input stream T - copy of input DEFC RB_OPT = $04 ; output stream T - copy of output DEFC RB_PTT = $05 ; printer stream T - copy of output DEFC Dc_Scn = $240C ; Scan for card usage (internal) DEFC Dc_Sp = $180C ; Handle Director/CLI settings (internal) DEFC Dc_Xin = $1E0C ; Examine CLI input (internal) DEFC Os_Use = $EE06 ; Fetch information about process card usage (internal) DEFC Os_Bye = $21 ; Application exit. DEFC Os_Exit= $F606 ; Quit process (internal) DEFC Os_Ent = $FA06 ; Enter an application (internal) DEFC Os_Cli = $84 ; CLI interface (internal) ; arguments: DEFC CL_RIM = $01 ; get raw input DEFC CL_MBC = $02 ; meta/base to character conversion DEFC CL_CMB = $03 ; character to meta/base conversion DEFC CL_INC = $04 ; increment CLI use count DEFC CL_DEC = $05 ; decrement CLI use count DEFC CL_RES = $06 ; reset CLI use count DEFC CL_ACK = $07 ; acknowledge CLI/Escape DEFC CLM_SH = $01 ; SHIFT key (bit) mask DEFC CLM_CT = $02 ; DIAMOND (bit) mask DEFC Os_Dom = $FE06 ; Open director memory (internal) DEFC Os_Poll= $FC06 ; Poll for an application (internal) DEFC Os_Stk = $F806 ; Stack file current process (internal) DEFC Os_Wait= $7E ; Wait for event (internal) ; arguments: DEFC WT_ANY = $FF ; infinite DEFC Os_Fth = $DE06 ; Free tri-handle (internal) DEFC Os_Gth = $E206 ; Allocate tri-handle (internal) DEFC Os_Vth = $E006 ; Verify tri-handle (internal) ; arguments for all three handle calls: DEFC TH_FILT = $F0 ; verify filter handle DEFC TH_WMG = $F1 ; verify wildcard manager handle DEFC TH_ALM = $F2 ; verify alarm handle ; Application Type manifests 1 (type byte1 in Application DOR): DEFC AT_Good = 1 ; (BIT 0) well behaved DEFC AT_Bad = 2 ; (BIT 1) not well behaved, not killed on pre-emption DEFC AT_Ugly = 4 ; (BIT 2) not well behaved, killed on pre-emption DEFC AT_Popd = 8 ; (BIT 3) popdown (if not set then an application) DEFC AT_Ones = 16 ; (BIT 4) only one application instance allowed DEFC AT_Draw = 32 ; (BIT 5) OZ to redraw screen is possible (2K file) DEFC AT_Film = 64 ; (BIT 6) File Manager Application (internal usage) DEFC AT_Boot = 128 ; (BIT 7) Application Auto Boot (after soft reset) ; Application Type manifests 2 (type byte2 in Application DOR): ; (Bits 3 - 6 are ignored - should be reset) DEFC AT2_Cl = 1 ; (BIT 0) Set Caps Lock on creation entry DEFC AT2_Icl = 2 ; (BIT 1) Set 'inverted' Caps Lock on creation entry DEFC AT2_Ie = 128 ; (BIT 7) Ignore error returns (should be avoided). lston z88dk-1.8.ds1/lib/dor.def0000644000175000017500000000234307455120417014525 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; DOR interface: DEFC OS_Dor = $87 ; DOR interface ; DOR codes when using OS_Dor : DEFC DR_Get = $01 ; Get handle for a DOR name (internal use) DEFC DR_Dup = $02 ; Duplicate DOR DEFC DR_Sib = $03 ; Return brother DOR DEFC DR_Son = $04 ; Return child DOR DEFC DR_Fre = $05 ; Free (release) DOR handle DEFC DR_Cre = $06 ; Create blank DOR DEFC DR_Del = $07 ; Delete DOR DEFC DR_Ins = $08 ; Insert DOR DEFC DR_Rd = $09 ; Read DOR record DEFC DR_Wr = $0A ; Write DOR record ; Major DOR types: DEFC Dm_Dev = $81 ; File Device DEFC Dm_Chd = $82 ; Character Device DEFC Dm_Rom = $83 ; ROM information ; Minor DOR types: DEFC Dn_Fil = $11 ; File type DEFC Dn_Dir = $12 ; Directory type DEFC Dn_Apl = $13 ; Application front DOR type, DEFC Dn_Del = $7F ; Deleted Entry type. ; Record DOR types: DEFC Dt_Nam = $4E ; filename DEFC Dt_Cre = $43 ; creation time DEFC Dt_Upd = $55 ; update time DEFC Dt_Ext = $58 ; Extent (length of file) DEFC Dt_Atr = $41 ; Not currently used DEFC Dt_Hlp = $48 ; Help type DEFC Dt_Inf = $40 ; Information lston z88dk-1.8.ds1/lib/embedded_crt0.asm0000644000175000017500000000553610640546527016457 0ustar tygrystygrys; Startup Code for Embedded Targets ; ; Daniel Wallner March 2002 ; ; $Id: embedded_crt0.asm,v 1.3 2007/06/27 20:49:27 dom Exp $ ; ; (DM) Could this do with a cleanup to ensure rstXX functions are ; available? DEFC ROM_Start = $0000 DEFC RAM_Start = $8000 DEFC RAM_Length = $100 DEFC Stack_Top = $ffff MODULE embedded_crt0 ;------- ; Include zcc_opt.def to find out information about us ;------- INCLUDE "zcc_opt.def" ;------- ; Some general scope declarations ;------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF exitsp ;Pointer to atexit() stack XDEF exitcount ;Number of atexit() functions registered XDEF __sgoioblk ;std* control block XDEF heaplast ;Near malloc heap variables XDEF heapblocks ; XDEF _vfprintf ;jp to printf() core routine org ROM_Start jp start .start ; Make room for the atexit() stack ld hl,Stack_Top-64 ld sp,hl ; Clear static memory ld hl,RAM_Start ld de,RAM_Start+1 ld bc,RAM_Length-1 ld (hl),0 ldir ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF ld hl,$8080 ld (fp_seed),hl xor a ld (exitcount),a ; Entry to the user code call _main .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF .endloop jr endloop .l_dcal jp (hl) ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ; Static variables kept in safe workspace DEFVARS RAM_Start { __sgoioblk ds.b 40 ;stdio control block _std_seed ds.w 1 ;Integer seed exitsp ds.w 1 ;atexit() stack exitcount ds.b 1 ;Number of atexit() routines fp_seed ds.w 3 ;Floating point seed (not used ATM) extra ds.w 3 ;Floating point spare register fa ds.w 3 ;Floating point accumulator fasign ds.b 1 ;Floating point variable heapblocks ds.w 1 ;Number of free blocks heaplast ds.w 1 ;Pointer to linked blocks } ;-------- ; Now, include the math routines if needed.. ;-------- IF NEED_floatpack INCLUDE "#float.asm" ENDIF z88dk-1.8.ds1/lib/embedded_crt0.opt0000644000175000017500000000003707553524053016467 0ustar tygrystygrys INCLUDE "#embedded_crt0.asm" z88dk-1.8.ds1/lib/error.def0000644000175000017500000000510507455120417015071 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 2.00 ; (C) Cambridge Computer 1989 ; Error return codes: ; Codes marked with * are fatal errors DEFC RC_OK = $00 DEFC RC_Esc = $01 ; Escape condition (e.g. ESC pressed) DEFC RC_Time = $02 ; Timeout DEFC RC_Unk = $03 ; Unknown request (parameter in register) * DEFC RC_Bad = $04 ; Bad arguments * DEFC RC_Ms = $05 ; Bad memory segment specifier * DEFC RC_Na = $06 ; Not available * DEFC RC_Room = $07 ; No room DEFC RC_Hand = $08 ; Bad handle * DEFC RC_Eof = $09 ; End Of File (also returned by DOR calls) DEFC RC_Flf = $0A ; Filter Full DEFC RC_Ovf = $0B ; Overflow DEFC RC_Sntx = $0C ; Syntax Error DEFC RC_Wrap = $0D ; Wrap condition met DEFC RC_Push = $0E ; Pushback error, cannot satisfy request DEFC RC_Err = $0F ; Internal Error * DEFC RC_Type = $10 ; Unexpected type * DEFC RC_Pre = $11 ; Cannot pre-empt, or No Room DEFC RC_Onf = $12 ; Object (file or directory) not found DEFC RC_Rp = $13 ; Read protected DEFC RC_Wp = $14 ; Write protected DEFC RC_Use = $15 ; In Use DEFC RC_Fail = $16 ; General Failure, cannot satisfy request DEFC RC_Ivf = $17 ; Invalid filename DEFC RC_Ftm = $18 ; File Type Mismatch DEFC RC_Exis = $19 ; File already exist DEFC RC_Addr = $32 ; Bad address * DEFC RC_Size = $33 ; Bad size * DEFC RC_Bank = $34 ; Bad bank * DEFC RC_Frm = $35 ; Frame error * DEFC RC_Par = $36 ; Parity error DEFC RC_Dvz = $46 ; Division by zero DEFC RC_Tbg = $47 ; Too big DEFC RC_Nvr = $48 ; Negative root DEFC RC_Lgr = $49 ; Log range DEFC RC_Acl = $4A ; Accuracy lost DEFC RC_Exr = $4B ; Exponent function range DEFC RC_Bdn = $4C ; Bad number DEFC RC_Draw = $66 ; Application pre-empted and screen corrupted DEFC RC_Quit = $67 ; Request application to quit * DEFC RC_Susp = $69 ; Suspicion of pre-emption ; Related operating system calls and parameters: DEFC Os_Esc = $6F ; Examine special condition ; parameters in A: DEFC SC_BIT = $00 ; Test for Escape DEFC SC_ACK = $01 ; Acknowledge escape and flush input buffer DEFC SC_SET = $02 ; Set Escape (simulate an Escape condition) DEFC SC_RES = $03 ; Reset Escape without flushing input buffer DEFC SC_TST = $04 ; Test if Escape Detection is Enabled or Disabled DEFC SC_ENA = $05 ; Enable Escape Detection DEFC SC_DIS = $06 ; Disable Escape Detection DEFC Os_Erh = $75 ; Set (install) Error Handler DEFC Os_Erc = $72 ; Get error context DEFC Gn_Err = $4A09 ; Display an interactive error box DEFC Gn_Esp = $4C09 ; Return pointer to a system error message lston z88dk-1.8.ds1/lib/fileio.def0000644000175000017500000000502007455120417015203 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; File open system call: DEFC GN_Opf = $6009 ; open file/stream (or device) DEFC OS_Op = $EA06 ; internal open ; Parameters used with GN_Opf (in A register) DEFC OP_IN = $01 ; read only (shared) DEFC OP_OUT = $02 ; write only DEFC OP_UP = $03 ; open read/write DEFC OP_MEM = $04 ; Open memory pool DEFC OP_DIR = $05 ; Create directory name (returns DOR handle) DEFC OP_DOR = $06 ; Fetch DOR handle ; Various file/stream manipulation calls: DEFC Gn_Ren = $6609 ; rename filename DEFC Os_Ren = $E406 ; file rename (internal) DEFC Gn_Del = $6409 ; delete file DEFC Os_Del = $E606 ; delete file (internal) DEFC Gn_Cl = $6209 ; close file/stream DEFC Os_Cl = $E806 ; close file/stream (internal) DEFC Os_Gb = $39 ; get byte from file or device DEFC Os_Gbt = $3F ; - with timeout DEFC Os_Pb = $3C ; put byte to file or device DEFC Os_Pbt = $42 ; - with timeout DEFC Os_Ugb = $36 ; unget byte (not implemented). DEFC Os_Mv = $45 ; move bytes between stream and memory DEFC Os_Frm = $48 ; File read miscellaneous DEFC Os_Fwm = $4B ; File write miscellaneous ; File status codes, when using OS_Frm or OS_Fwm: DEFC FA_PTR = $01 ; Get sequential file pointer DEFC FA_EXT = $02 ; Get length (Extent) of sequential file DEFC FA_EOF = $03 ; End Of File enquiry DEFC FA_BST = $04 ; Buffer status (system use only) ; Various calls to process filenames: DEFC GN_Pfs = $5A09 ; parse filename segment DEFC GN_Prs = $5809 ; parse filename DEFC GN_Fcm = $4E09 ; compress a filename DEFC GN_Fex = $5009 ; expand a filename DEFC GN_Esa = $5E09 ; read/write filename segments ; Calls on wildcards, searching for files, parsing filenames: DEFC GN_Opw = $5209 ; open wildcard handler DEFC GN_Wcl = $5409 ; close wildcard handler DEFC GN_Wfn = $5609 ; get next filename match from wc.handler DEFC GN_Wsm = $5C09 ; match filename segment to wildcard string ; File Eprom Interface: ; (deleted/old files are ignored, they can only be fetched by using ; EPROM file format information) DEFC OS_Epr = $F006 ; File Eprom Manipulation Interface ; arguments: DEFC EP_Save = $00 ; blow RAM file to EPROM DEFC EP_Load = $03 ; load file from EPROM (save to RAM file) DEFC EP_Dir = $15 ; return next filename (starting with first) ; (all files must be read until RC_EOF) lston z88dk-1.8.ds1/lib/filter.def0000644000175000017500000000072107455120417015224 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; Filter manipulation: DEFC Gn_Flo = $2209 ; Open a filter DEFC Gn_Flc = $2409 ; Close a filter DEFC Gn_Flw = $2609 ; Push character into filter DEFC Gn_Flr = $2809 ; Read character from filter DEFC Gn_Flf = $2A09 ; Flush filter DEFC Gn_Fpb = $2C09 ; Push back character into filter lston z88dk-1.8.ds1/lib/flashepr.def0000644000175000017500000000320007455120417015536 0ustar tygrystygryslstoff ;*** FLASHEP.DEF ;*** Flash Eprom system constant definitions ; ;*** (C) Zlab 1995-97. ;*** Original concept from Thierry Peycru ; ;*** Update of the 08.19.97 ; ;*** Only working on Zlab 1M Flash Eprom Cards ;*** Only for Intel i28F008 chips (ETOX III technologies) ;*** Learn first, INTEL QuickPulse and QuickErase algorithms ;*** Available in the 28F008 datasheet. ; ;*** PLEASE, DO RESPECT these new standard notations. ; ;*** Description : ;(1) Flash Eprom Command codes ; ; fe_rst = reset chip in read array mode ; fe_iid = get INTELligent identification code (manufacturer and device) ; fe_int = INTEL manufacturer code ; fe_i008= i28F008SA device code (1024K) ; fe_i004= i28F004S5 device code (512K) ; fe_i8s5= i28F008S5 device code (1024K) ; fe_i016= i28F016S5 device code (2048K) ; fe_i020= i28F020 device code (256K) ; fe_rsr = read status register ; fe_csr = clear status register ; fe_era = erase block command ; fe_con = confirm erasure ; fe_sus = suspend erasure ; fe_res = resume erasure ; fe_wri = byte write command ; fe_alw = alternate byte write command ; ;(2) Flash Eprom Error Return codes ; rc_vpl = Vpp Low error ; rc_bwr = byte write error ; rc_ber = block erasure error ; rc_bes = block erasure suspended ; rc_nfe = not a flash eprom ; rc_noz = not an oz formatted eprom ; DEFC FE_RST = $FF, FE_IID = $90, FE_RSR = $70, FE_CSR = $50 DEFC FE_ERA = $20, FE_CON = $D0, FE_SUS = $B0, FE_RES = $D0 DEFC FE_WRI = $40, FE_ALW = $10 DEFC FE_INT = $89, FE_I004= $A7, FE_I008= $A2, FE_I020= $BD, FE_I8S5= $A6 DEFC FE_I016 = $AA DEFC RC_VPL = $70, RC_BWR = $71, RC_BER = $72, RC_BES = $73 DEFC RC_NFE = $80, RC_NOZ = $81 ; lston z88dk-1.8.ds1/lib/float.asm0000644000175000017500000000512507530445360015072 0ustar tygrystygrys; ; Small C+ Compiler ; ; The Maths Routines (essential ones!) ; ; All maths routines are now in a library except for these ; small ones (which will always be used) ; ; If -doublestr is defined then we can link with whatever ; library we feel like ; ; djm 7/12/98 ; ; $Id: float.asm,v 1.8 2002/08/20 13:58:08 dom Exp $ ;------------------------------------------------- ; Some scope defintionons for the crt0 float stuff ;------------------------------------------------- XDEF fp_seed XDEF extra XDEF fa XDEF fasign XDEF dstore XDEF dload XDEF dldpsh XDEF dpush XDEF dpush2 XDEF __atof2 LIB atof ;needed for __atof2 ;------------------------------------------- ; Unused code from the generic z80 maths lib ;------------------------------------------- ; ;DIVZERO CALL GRIPE ; DEFB 'can''t /0',0 ;OFLOW CALL GRIPE ; DEFB 'Arithmetic overflow',0 ;GRIPE CALL QERR ;top word on stack points to message ; JP 0 ;error was fatal ; ; FA = (hl) ; ;-------------- ; Copy FA to de ;-------------- .dstore ld de,fa ld bc,6 ex de,hl ldir ex de,hl ret ;---------------- ; Load FA from hl ;---------------- .dload ld de,fa ld bc,6 ldir ret ;----------------------------------------- ; Load FA from (hl) and push FA onto stack ;----------------------------------------- .dldpsh ld de,fa ld bc,6 ldir ;------------------------------------------ ; Push FA onto stack (under return address) ;------------------------------------------ .dpush pop de ld hl,(fa+4) push hl ld hl,(fa+2) push hl ld hl,(fa) push hl ex de,hl jp (hl) ;------------------------------------------------------ ; Push FA onto stack under ret address and stacked word ;------------------------------------------------------ .dpush2 pop de ;save return address pop bc ;save next word ld hl,(fa+4) push hl ld hl,(fa+2) push hl ld hl,(fa) push hl ex de,hL push bc ;restore next word jp (hl) ;return IF DEFINED_math_atof ;--------------------------------------------------------- ; Convert string to FP number in FA calls the library atof ;--------------------------------------------------------- .__atof2 push hl call atof pop bc ret ENDIF z88dk-1.8.ds1/lib/fpp.def0000644000175000017500000000360007455120417014523 0ustar tygrystygryslstoff ; Standard Z88 Operating System ('OZ') manifests: ; The information below is copied from Developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; Floating point package (FPP): DEFC FP_BAS = $A2 ; call Floating point package function ; (doesn't work properly) ; function codes: DEFC FP_AND = $21 ; bitwise AND DEFC FP_IDV = $24 ; integer division DEFC FP_EOR = $27 ; bitwise XOR DEFC FP_MOD = $2A ; integer remainder DEFC FP_OR = $2D ; bitwise OR DEFC FP_LEQ = $30 ; less than or equal to DEFC FP_NEQ = $33 ; not equal to DEFC FP_GEQ = $36 ; greater than or equal to DEFC FP_LT = $39 ; less than DEFC FP_EQ = $3C ; equal DEFC FP_MUL = $3F ; multiply DEFC FP_ADD = $42 ; add DEFC FP_GT = $45 ; greater than DEFC FP_SUB = $48 ; subtract DEFC FP_PWR = $4B ; raise to the power DEFC FP_DIV = $4E ; divide DEFC FP_ABS = $51 ; absolute value DEFC FP_ACS = $54 ; arc cosine DEFC FP_ASN = $57 ; arc sine DEFC FP_ATN = $5A ; arc tangent DEFC FP_COS = $5D ; cosine DEFC FP_DEG = $60 ; radians to degrees DEFC FP_EXP = $63 ; exponential DEFC FP_INT = $66 ; integer value DEFC FP_LN = $69 ; base e (natural) logarithm DEFC FP_LOG = $6C ; base 10 (common) logarithmn DEFC FP_NOT = $6F ; bitwise NOT DEFC FP_RAD = $72 ; degrees to radians DEFC FP_SGN = $75 ; sign DEFC FP_SIN = $78 ; sinus DEFC FP_SQR = $7B ; square root DEFC FP_TAN = $7E ; tangent DEFC FP_ZER = $81 ; zero DEFC FP_ONE = $84 ; one DEFC FP_TRU = $87 ; true (-1) DEFC FP_PI = $8A ; PI DEFC FP_VAL = $8D ; numeric value of string DEFC FP_STR = $90 ; string value of a number DEFC FP_FIX = $93 ; truncate a float to an integer DEFC FP_FLT = $96 ; integer to float conversion DEFC FP_TST = $99 ; test number for zero and sign DEFC FP_CMP = $9C ; compare two numbers DEFC FP_NEG = $9F ; negate number lston z88dk-1.8.ds1/lib/gray82.asm0000644000175000017500000000646207455120416015104 0ustar tygrystygrys; Ti82 Graylib interrupt ;--------------------------------------------------------------------------- ; ; Ported by Stefano Bodrato - Mar 2000 ; ; Recoded -because of strange problems- by Henk Poley - July 2001 ; Based upon vnGrey, a Venus greyscale library (Ti83). ; ; $Id: gray82.asm,v 1.3 2002/04/10 20:31:10 dom Exp $ ; defc intcount = $8501 ; 1 byte - interrupt variable INCLUDE "#int82.asm" ; Put interrupt loader here ; xor a ; We need to intialize variables ld (intcount),a ; by ourself. ; jp jump_over ; Jump over the interrupt code ;----------------- ; Actual interrupt ;----------------- .IntProcStart push af ; ld a,(intcount) ; Check if own interrupt has quited bit 7,a ; correctly, then bit 7 is zero jr nz,int_fix ; If not zero, fix stack... push hl ; push de ; push bc ; push iy ; ld iy,_IY_TABLE ; ; .exit_interrupt ; in a,(3) ; check vbl int and @00000010 ; jr z,exit_interrupt2 ; ld hl,intcount ; int counter res 7,(hl) ; inc (hl) ; ld a,(hl) ; dec a ; 1 jr z,Display_pic1 ; dec a ; 2 jr z,Display_pic2 ; ld (hl),0 ; reset counter .exit_interrupt2 ; ld hl,intcount ; If a 'direct interrupt' occures set 7,(hl) ; right after the TIOS-int, then ; we want bit 7 to be set... exx ; Swap to shadow registers. ex af,af ; So the TIOS swaps back to the ; normal ones... (the ones we saved ; with push/pops) rst $38 ; di ; 'BIG' HOLE HERE... (TIOS does ei...) ex af,af ; exx ; ; ld hl,intcount ; Interrupt returned correctly, so res 7,(hl) ; we reset our error-condition... ; in a,(3) ; check on interrupt status rra ; ld a,0 ; adc a,9 ; out (3),a ; ld a,$0B ; out (3),a ; ; pop iy ; pop bc ; pop de ; pop hl ; pop af ; ei ; ret ; .int_fix ; pop af ; Pop AF back ex af,af ; Fix shadowregs back exx ; pop bc ; Pop the returnpoint of RST $38 ; from the stack jr exit_interrupt ; Continue with interrupt .Display_pic1 ; ld hl,(graybit1) ; jr DisplayPicture ; .Display_pic2 ; ld hl,(graybit2) ; .DisplayPicture ; ld a,$80 ; fastCopy routine out ($10),a ; (Joe Wingbermuehle) ld a,$20 ; ld c,a ; ld de,755 ; add hl,de ; .fastCopyAgain ; ld b,64 ; inc c ; ld de,-(12*64)+1 ; out ($10),a ; add hl,de ; ld de,10 ; .fastCopyLoop ; add hl,de ; inc hl ; inc hl ; inc de ; ld a,(hl) ; out ($11),a ; dec de ; push ix ; Little slowdown... pop ix ; ...Needed (?) djnz fastCopyLoop ; ld a,c ; cp $2B+1 ; jr nz,fastCopyAgain ; jr exit_interrupt2 ; .IntProcEnd XDEF graybit1 XDEF graybit2 .graybit1 defw GRAPH_MEM .graybit2 defw gbuf2 ; use in-program buffer .gbuf2 DEFS 768 ; allocate space here ;NOTE: APD_BUF can't be used for the buffer, the interrupt table and ; routine reside there, overwriting that space will cause a crash. .jump_over ; Memory usage in APD_BUF: ; ------------------------------------------------------ ; $8228 / $8281 - 90 bytes - free ; $8282 / $83FF - 382 bytes - partialy used by interrupt ; $8400 / $8500 - 256 bytes - IV table ; $8501 - 1 byte - intcount <-- ; $8502 / $8528 - 39 bytes - free ; ------------------------------------------------------ z88dk-1.8.ds1/lib/gray83.asm0000644000175000017500000000615307455120416015102 0ustar tygrystygrys; Ti83 Graylib interrupt ;--------------------------------------------------------------------------- ; ; Ported by Stefano Bodrato - Mar 2000 ; ; Recoded -because of strange problems- by Henk Poley - July 2001 ; Based upon vnGrey, a Venus greyscale library (Ti83). ; ; $Id: gray83.asm,v 1.3 2002/04/10 20:31:10 dom Exp $ ; defc intcount = $878A ; 1 byte needed INCLUDE "#int83.asm" ; Put interrupt loader here ; HL = $8789 inc hl ; We need to intialize variables ld (hl),0 ; by ourself. ; jp jump_over ; Jump over the interrupt code ;----------------- ; Actual interrupt ;----------------- .IntProcStart push af ; ld a,(intcount) ; Check if own interrupt has quited bit 7,a ; correctly, then bit 7 is zero jr nz,int_fix ; If not zero, fix stack... push hl ; push de ; push bc ; push iy ; ld iy,_IY_TABLE ; ; .exit_interrupt ; in a,(3) ; check vbl int and @00000010 ; jr z,exit_interrupt2 ; ld hl,intcount ; int counter res 7,(hl) ; inc (hl) ; ld a,(hl) ; dec a ; 1 jr z,Display_pic1 ; dec a ; 2 jr z,Display_pic2 ; ld (hl),0 ; reset counter .exit_interrupt2 ; ld hl,intcount ; If a 'direct interrupt' occures set 7,(hl) ; right after the TIOS-int, then ; we want bit 7 to be set... exx ; Swap to shadow registers. ex af,af ; So the TIOS swaps back to the ; normal ones... (the ones we saved ; with push/pops) rst $38 ; di ; 'BIG' HOLE HERE... (TIOS does ei...) ex af,af ; exx ; ; ld hl,intcount ; Interrupt returned correctly, so res 7,(hl) ; we reset our error-condition... ; in a,(3) ; check on interrupt status rra ; ld a,0 ; adc a,9 ; out (3),a ; ld a,$0B ; out (3),a ; ; pop iy ; pop bc ; pop de ; pop hl ; pop af ; ei ; ret ; .int_fix ; pop af ; Pop AF back ex af,af ; Fix shadowregs back exx ; pop bc ; Pop the returnpoint of RST $38 ; from the stack jr exit_interrupt ; Continue with interrupt .Display_pic1 ; ld hl,(graybit1) ; jr DisplayPicture ; .Display_pic2 ; ld hl,(graybit2) ; .DisplayPicture ; ld a,$80 ; fastCopy routine out ($10),a ; (Joe Wingbermuehle) ld a,$20 ; ld c,a ; ld de,755 ; add hl,de ; .fastCopyAgain ; ld b,64 ; inc c ; ld de,-(12*64)+1 ; out ($10),a ; add hl,de ; ld de,10 ; .fastCopyLoop ; add hl,de ; inc hl ; inc hl ; inc de ; ld a,(hl) ; out ($11),a ; dec de ; djnz fastCopyLoop ; ld a,c ; cp $2B+1 ; jr nz,fastCopyAgain ; jr exit_interrupt2 ; .IntProcEnd XDEF graybit1 XDEF graybit2 .graybit1 defw plotSScreen IF DEFINED_DontUseApdRam .graybit2 defw gbuf2 .gbuf2 DEFS 768 ELSE .graybit2 defw saveSScreen ENDIF .jump_over ; Memory usage in statvars: ; ------------------------------------------- ; $858F / $85FF - 113 bytes - free ; $8600 / $8700 - 256 bytes - IV table ; $8701 / $8786 - 134 bytes - free ; $8787 / $8789 - 3 bytes - JP IntProcStart ; $878A - 1 byte - intcount <-- ; $878B / $87A2 - 24 bytes - free ; ------------------------------------------- z88dk-1.8.ds1/lib/gray83p.asm0000644000175000017500000000633507455120416015264 0ustar tygrystygrys; TI83+ Graylib interrupt ;--------------------------------------------------------------------------- ; ; Ported by Stefano Bodrato - Mar 2000 ; ; Recoded -because of strange problems- by Henk Poley - July 2001 ; Based upon vnGrey, a Venus greyscale library (Ti83). ; ; $Id: gray83p.asm,v 1.3 2002/04/10 20:31:10 dom Exp $ ; INCLUDE "#int83p.asm" ; Put interrupt loader here IF TI83PLUSAPP ; Statvars is already zeroed ELSE ; HL = $8A8C inc hl ; We need to intialize variables ld (hl),0 ; by ourself. ENDIF jp jump_over ; Jump over the interrupt code ;----------------- ; Actual interrupt ;----------------- .IntProcStart push af ; ld a,(intcount) ; Check if own interrupt has quited bit 7,a ; correctly, then bit 7 is zero jr nz,int_fix ; If not zero, fix stack... push hl ; push de ; push bc ; push iy ; ld iy,_IY_TABLE ; ; .exit_interrupt ; in a,(3) ; check vbl int and @00000010 ; jr z,exit_interrupt2 ; ld hl,intcount ; int counter res 7,(hl) ; inc (hl) ; ld a,(hl) ; dec a ; 1 jr z,Display_pic1 ; dec a ; 2 jr z,Display_pic2 ; ld (hl),0 ; reset counter .exit_interrupt2 ; ld hl,intcount ; If a 'direct interrupt' occures set 7,(hl) ; right after the TIOS-int, then ; we want bit 7 to be set... exx ; Swap to shadow registers. ex af,af ; So the TIOS swaps back to the ; normal ones... (the ones we saved ; with push/pops) rst $38 ; di ; 'BIG' HOLE HERE... (TIOS does ei...) ex af,af ; exx ; ; ld hl,intcount ; Interrupt returned correctly, so res 7,(hl) ; we reset our error-condition... ; in a,(3) ; check on interrupt status rra ; ld a,0 ; adc a,9 ; out (3),a ; ld a,$0B ; out (3),a ; ; pop iy ; pop bc ; pop de ; pop hl ; pop af ; ei ; ret ; .int_fix ; pop af ; Pop AF back ex af,af ; Fix shadowregs back exx ; pop bc ; Pop the returnpoint of RST $38 ; from the stack jr exit_interrupt ; Continue with interrupt .Display_pic1 ; ld hl,(graybit1) ; jr DisplayPicture ; .Display_pic2 ; ld hl,(graybit2) ; .DisplayPicture ; ld a,$80 ; fastCopy routine out ($10),a ; (Joe Wingbermuehle) ld a,$20 ; ld c,a ; ld de,755 ; add hl,de ; .fastCopyAgain ; ld b,64 ; inc c ; ld de,-(12*64)+1 ; out ($10),a ; add hl,de ; ld de,10 ; .fastCopyLoop ; add hl,de ; inc hl ; inc hl ; inc de ; ld a,(hl) ; out ($11),a ; dec de ; djnz fastCopyLoop ; ld a,c ; cp $2B+1 ; jr nz,fastCopyAgain ; jr exit_interrupt2 ; .IntProcEnd IF !TI83PLUSAPP XDEF graybit1 XDEF graybit2 defc intcount = $8A8D ; 1 byte needed .graybit1 defw plotSScreen .graybit2 defw appBackUpScreen ENDIF .jump_over ; Memory usage in statvars: ; --------------------------------------------------------------- ; $8A3A / $8A89 - 80 bytes - free (or used by z88dk app) ; $8A8A / $8A8C - 3 bytes - JP IntProcStart ; $8A8D - 1 byte - intcount <-- ; $8A8E / $8AFF - 114 bytes - free (some bytes used by z88dk app) ; $8B00 / $8C00 - 256 bytes - IV table ; $8C01 / $8C4D - 77 bytes - free ; --------------------------------------------------------------- z88dk-1.8.ds1/lib/gray83pSE.asm0000644000175000017500000000626107455120416015512 0ustar tygrystygrys; TI83+SE Graylib interrupt ;--------------------------------------------------------------------------- ; ; Ported by Stefano Bodrato - Mar 2000 ; ; original code (portions of gray82.inc and greylib.asm) by: ; ;---------------= Gray82 =-------------- ; Author: Ian Graf ; (ian_graf@geocities.com) ; Port: Sam Heacp ; (void.calc.org) ;--------------------------------------------------------------------------- ;***** GreyLib version 1.0 (C) 1997 by Bill Nagel & Dines Justesen ********* ;--------------------------------------------------------------------------- ; ; $Id: gray83pSE.asm,v 1.3 2002/04/10 20:31:10 dom Exp $ ; defc LCD_BUSY_QUICK = $000B ; Faster entry then BCALLing defc LCDBusy = LCD_BUSY_QUICK ; INCLUDE "#int83p.asm" ; Put interrupt loader here IF TI83PLUSAPP ; Statvars is already zeroed ELSE ; HL = $8A8C inc hl ; We need to intialize variables ld (hl),0 ; by ourself. ENDIF jp jump_over ; Jump over the interrupt code ;----------------- ; Actual interrupt ;----------------- .IntProcStart push af ; ld a,(intcount) ; Check if own interrupt has quited bit 7,a ; correctly, then bit 7 is zero jr nz,int_fix ; If not zero, fix stack... push hl ; push de ; push bc ; push iy ; ld iy,_IY_TABLE ; ; .exit_interrupt ; in a,(3) ; check vbl int and @00000010 ; jr z,exit_interrupt2 ; ld hl,intcount ; int counter res 7,(hl) ; inc (hl) ; ld a,(hl) ; dec a ; 1 jr z,Display_pic1 ; dec a ; 2 jr z,Display_pic2 ; ld (hl),0 ; reset counter .exit_interrupt2 ; ld hl,intcount ; If a 'direct interrupt' occures set 7,(hl) ; right after the TIOS-int, then ; we want bit 7 to be set... exx ; Swap to shadow registers. ex af,af ; So the TIOS swaps back to the ; normal ones... (the ones we saved ; with push/pops) rst $38 ; di ; 'BIG' HOLE HERE... (TIOS does ei...) ex af,af ; exx ; ; ld hl,intcount ; Interrupt returned correctly, so res 7,(hl) ; we reset our error-condition... ; in a,(3) ; check on interrupt status rra ; ld a,0 ; adc a,9 ; out (3),a ; ld a,$0B ; out (3),a ; ; pop iy ; pop bc ; pop de ; pop hl ; pop af ; ei ; ret ; ; .int_fix ; pop af ; Pop AF back ex af,af ; Fix shadowregs back exx ; pop bc ; Pop the returnpoint of RST $38 ; from the stack jr exit_interrupt ; Continue with interrupt ; .Display_pic1 ; ld hl,(graybit1) ; jr DisplayPicture ; .Display_pic2 ; ld hl,(graybit2) ; .DisplayPicture ; ld a,7 ; call LCDBusy ; out ($10),a ; Select row number ; ld a,$80 ; Goto the left .LineLoop ; ld d,a ; Save currect coloum call LCDBusy ; out ($10),a ; ld a,$20 ; Goto top call LCDBusy ; out ($10),a ; ld bc,$0C11 ; 40 bytes to port 10 .WriteLoop ; Write them neg ; neg ; neg ; neg ; outi ; jr nz,WriteLoop ; ld a,d ; inc a ; cp $C0 ; jr nz,LineLoop ; jr exit_interrupt ; .IntProcEnd IF !TI83PLUSAPP XDEF graybit1 XDEF graybit2 defc intcount = $8A8D ; 1 byte needed .graybit1 defw plotSScreen .graybit2 defw appBackUpScreen ENDIF .jump_over z88dk-1.8.ds1/lib/gray85.asm0000644000175000017500000001003507455120416015076 0ustar tygrystygrys; Graylib interrupt installer ; Ported and heavily modified by Stefano Bodrato - Mar 2000 ; Lateron more modified by Henk Poley - Sep 2001 ; ; original code (graydraw.asm) by: ; ;------------------------------------------------------------ ; Date: Sun, 5 May 1996 12:44:17 -0400 (EDT) ; From: Jingyang Xu [br00416@bingsuns.cc.binghamton.edu] ; Subject: LZ: Graydraw source! ;------------------------------------------------------------ ; ; $Id: gray85.asm,v 1.4 2002/04/10 20:31:10 dom Exp $ ; XDEF graybit1 XDEF graybit2 defc intcount = $8980 ld hl,($8be5) ; Get end of VAT dec hl ; Make sure we're clear it.. dec hl ; ld a,h ; Now we need to get the position of sub 4 ; the nearest screen boundary ld h,a ; ld l,0 ; push hl ; ld de,($8be1) ; Tests if there is a space for the 1K or a ; needed for the 2nd screen sbc hl,de ; pop hl ; jr c,cleanup ; If not, stop the program... and @11000000 ; Test if our block of memory is cp @11000000 ; within the range addressable jr nz,cleanup ; by the LCD hardware ld (graybit2),hl ; Save the address of our 2nd Screen ld a,h ; If in range, set up the signal to and @00111111 ; send thrue port 0 to switch to our ld (page2),a ; 2nd screen ;---- ;dec h ; Set the IV for IM2 mode ;ld a,h ; ;ld i,a ; ;ld (hl),IntProcStart&$FF ; Set the IV table ;inc hl ; ;ld (hl),IntProcStart/256 ; ;ld d,h ; ;ld e,l ; ;dec hl ; ;inc de ; ;ld bc,$0100 ; ;ldir ; ;---- im 1 ; ld a,$87 ; locate vector table at $8700-$8800 ld i,a ; ld bc,$0100 ; vector table is 256 bytes ld h,a ; ld l,c ; HL = $8700 ld d,a ; ld e,b ; DE = $8801 inc a ; A = $88 ld (hl),a ; interrupt "program" located at 8888h ldir ; ; ld l,a ; HL = $8787 ld (hl),$C3 ; Put a JP IntProcStart at $8787 ld de,IntProcStart ; (Done this way for relocatable code...) inc hl ; ld (hl),e ; inc hl ; ld (hl),d ; ;---- xor a ; Init counter ld (intcount),a ; im 2 ; Enable int jp jump_over ; Jump over the interrupt code ;.IntProcStart ; push af ; ; ld a,(intcount) ; Check if own interrupt has quited ; bit 7,a ; correctly, then bit 7 is zero ; jr nz,int_fix ; If not zero, fix stack... ; push hl ; ; push de ; ; push bc ; ; push iy ; ; ld iy,_IY_TABLE ; ; ; ;.cont_interrupt ; ; in a,(3) ; ; bit 1,a ; check that it is a vbl interrupt ; jr z,EndInt ; ; ; ; ld a,(intcount) ; ; res 7,(hl) ; ; cp 2 ; ; jr z,Disp_2 ; ; ; ;.Disp_1 ; ; inc a ; ; ld (intcount),a ; ; ld a,(page2) ; ; out (0),a ; ; jr EndInt ; ;.Disp_2 ; ; ld a,$3c ; ; out (0),a ; ; sub a ; ; ld (intcount),a ; ;.EndInt ; ; ld hl,intcount ; If a 'direct interrupt' occures ; set 7,(hl) ; right after the TIOS-int, then ; ; we want bit 7 to be set... ; exx ; Swap to shadow registers. ; ex af,af ; So the TIOS swaps back to the ; ; normal ones... (the ones we saved ; ; with push/pops) ; rst $38 ; ; di ; 'BIG' HOLE HERE... (TIOS does ei...) ; ex af,af ; ; exx ; ; ; ; ld hl,intcount ; Interrupt returned correctly, so ; res 7,(hl) ; we reset our error-condition... ; pop iy ; ; pop bc ; ; pop de ; ; pop hl ; ; pop af ; ; ei ; ; ret ; Return to program ; ; ;.int_fix ; ; pop af ; Pop AF back ; ex af,af ; Fix shadowregs back ; exx ; ; pop bc ; Pop the returnpoint of RST $38 ; ; from the stack ; jr cont_interrupt ; Continue with interrupt ;.IntProcEnd .IntProcStart push af ; in a,(3) ; bit 1,a ; check that it is a vbl interrupt jr z,EndInt ; ; ld a,(intcount) ; cp 2 ; jr z,Disp_2 ; ; .Disp_1 ; inc a ; ld (intcount),a ; ld a,(page2) ; out (0),a ; jr EndInt ; .Disp_2 ld a,$3c ; out (0),a ; sub a ; ld (intcount),a ; .EndInt ; pop af ; ei ; ret ; Skip standard interrupt .IntProcEnd .graybit1 defw VIDEO_MEM .graybit2 defw 0 .page2 defb 0 .jump_over ; ld hl,(graybit2) ; Whipe the 2nd screen clean ; ld d,h ; ld e,l ; inc de ; ld (hl),0 ; ld bc,1023 ; ldir z88dk-1.8.ds1/lib/gray86.asm0000644000175000017500000000320407455120416015077 0ustar tygrystygrys ; Graylib interrupt installer ; Ported for the Z88DK and modified for the TI86 by Stefano Bodrato - May 2000 ; ; original code (graydraw.asm) by: ; ;------------------------------------------------------------ ; Date: Sun, 5 May 1996 12:44:17 -0400 (EDT) ; From: Jingyang Xu [br00416@bingsuns.cc.binghamton.edu] ; Subject: LZ: Graydraw source! ;------------------------------------------------------------ ; ; $Id: gray86.asm,v 1.3 2002/04/10 20:31:10 dom Exp $ ; XDEF graybit1 XDEF graybit2 XDEF page2 ld hl,$f500 ; ld hl,($d297) ;get end of VAT ;dec hl ;dec hl ; make sure we're clear it.. ld a,h ; now we need to get the position of sub 5 ; the nearest screen boundary ld h,a ld l,0 ld (graybit2),hl ; Save the address of our 2nd Screen ld a,h ; save the byte to send to port 0 and @00111111 ; to switch to our 2nd screen ld (page2),a dec h ; Set the IV for IM2 mode ld a,h ld i,a ld (hl),IntProcStart&$FF ; Set the IV table inc hl ld (hl),IntProcStart/256 ld d,h ld e,l dec hl inc de ld bc,255 ldir xor a ; Init counter ld (intcount),a jp jump_over .IntProcStart push af in a,(3) bit 1,a ; check that it is a vbl interrupt jr z,EndInt ld a,(intcount) cp 2 jr z,Disp_2 .Disp_1 inc a ld (intcount),a ld a,(page2) out (0),a jr EndInt .Disp_2 ld a,$3c out (0),a xor a ld (intcount),a .EndInt ;in a,(3) ;this stuff must be done or calc crashes ;rra ;mysterious stuff from the ROM ;ld a,0 ;adc a,9 ;out (3),a ;ld a,$0B ;out (3),a pop af ei reti ;jp $38 .IntProcEnd .graybit1 defw $fc00 ;GRAPH_MEM .graybit2 defw 0 .page2 defb 0 .intcount defb 0 .jump_over z88dk-1.8.ds1/lib/idedos.def0000644000175000017500000000647507741511016015217 0ustar tygrystygryslstoff ; IDEDOS Definitions - for external applications ; Defines for calling ResiDOS from BASIC ; ; Combined .def file for IDEDOS and ResiDOS ; ; $Id: idedos.def,v 1.1 2003/10/10 11:03:42 dom Exp $ defc RST_HOOK=$08 defc HOOK_VERSION=$fc defc HOOK_PACKAGE=$fb ; Package IDs defgroup { PKG_RESIDOS=0, PKG_IDEDOS } ; ResiDOS Package Calls defc resi_report=$0310 ; Important package entry/exit points defc PACKAGE_SIZE=$0000 defc PACKAGE_ENTRY=$0008 defc PACKAGE_EXIT=$0014 defc PACKAGE_HANDLECALL=$0020 defc PACKAGE_LEAVE_RESIDOS=$0006 defc PACKAGE_REENTER_RESIDOS=$001d ; Partition entry structure defvars 0 { part_name ds.b 16 part_sysinfo ds.b 16 part_info ds.b 32 } ; Partition handle structure defvars 0 { ph_type ds.b 1 ph_scyl ds.w 1 ph_shd ds.b 1 ph_ecyl ds.w 1 ph_ehd ds.b 1 ph_secs ds.l 1 ; highest logical sector number ph_rsvd ds.b 5 ph_unit ds.b 1 ph_num ds.w 1 } ; Swap handle additional structure defvars ph_rsvd { sh_size ds.b 1 sh_curb ds.w 1 sh_maxb ds.w 1 } ; System partition info section structure defvars 0 { sinf_unit ds.b 8 sinf_edcols ds.b 1 sinf_bascols ds.b 1 sinf_physunmap ds.b 3 sinf_physmap ds.b 3 sinf_defdrv ds.b 1 ; IDEDOS v1.02 onwards below here sinf_defusr ds.b 1 sinf_bootfile ds.b 14 ; $ff-terminated } ; +3DOS partition info section structure defvars 0 { p3inf_xdpb ds.b 28 p3inf_map ds.b 1 } ; Partition types defgroup { ptype_unused, ptype_system, ptype_swap, ptype_p3dos, ptype_bad=254, ptype_free } ; Calls defvars $0056 { ide_stream_open ds.p 1 ide_stream_close ds.p 1 ide_stream_in ds.p 1 ide_stream_out ds.p 1 ide_stream_ptr ds.p 1 } defvars $00a0 { ide_version ds.p 1 ide_interface ds.p 1 ide_init ds.p 1 ide_drive ds.p 1 ide_sector_read ds.p 1 ide_sector_write ds.p 1 ide_format ds.p 1 ide_partition_find ds.p 1 ide_partition_new ds.p 1 ide_partition_init ds.p 1 ide_partition_erase ds.p 1 ide_partition_rename ds.p 1 ide_partition_read ds.p 1 ide_partition_write ds.p 1 ide_partition_winfo ds.p 1 ide_partition_open ds.p 1 ide_partition_close ds.p 1 ide_partition_getinfo ds.p 1 ide_partition_setinfo ds.p 1 ide_swap_open ds.p 1 ide_swap_close ds.p 1 ide_swap_out ds.p 1 ide_swap_in ds.p 1 ide_swap_ex ds.p 1 ide_swap_pos ds.p 1 ide_swap_move ds.p 1 ide_swap_resize ds.p 1 ide_dos_map ds.p 1 ide_dos_unmap ds.p 1 ide_dos_mapping ds.p 1 ide_dos_unpermanent ds.p 1 ide_snapload ds.p 1 } defvars $019f { ide_access_data ds.p 1 ; Implemented for ResiDOS only - IDEDOS v1.01 ide_identify ds.p 1 ; Implemented for ResiDOS only - IDEDOS v1.01 ide_partitions ds.p 1 ; Implemented for ResiDOS only - IDEDOS v1.01 } ; Error codes defgroup { rc_invpartition=56, rc_partexist, rc_notimp, rc_partopen, rc_nohandle, rc_notswap, rc_mapped, rc_noxdpb, rc_noswap, rc_invdevice, rc_cmdphase, rc_dataphase } lston z88dk-1.8.ds1/lib/init_far.asm0000644000175000017500000000136707455120416015562 0ustar tygrystygrys; Startup code for far memory model ; 31/3/00 GWL ; 21/5/00 Modified for more flexible CF-compatible structure arrangement ; .init_far IF DEFINED_far_mmset ld a,MM_S1+MM_FIX ELSE ld a,MM_S1 ENDIF ld (farmemspec),a ; initialise farmemspec ld hl,1+(farheapsz/256) ld (farpages),hl ; initialise farpages add hl,hl ld b,h ld c,l ld hl,actual_malloc_table ld (malloc_table),hl ; initialise malloc_table ld d,h ld e,l inc de ld (hl),0 dec bc ldir ; clear malloc_table ld hl,pool_table ld de,pool_table+1 ld bc,223 ld (hl),0 ldir ; clear pool_table ret z88dk-1.8.ds1/lib/int82.asm0000644000175000017500000000505310445322021014714 0ustar tygrystygrys; Ti82 interrupt loader - by Henk Poley ; Based upon several sources, uses APD_BUF to put the IV-table and interrupt ;----------------------------------------------------------------------------- ; You only need to have an interrupt marked with IntProcStart ; at the beginning, and IntProcEnd at the end of your interrupt. ; Since CrASH moves your program when executing the TIOS keyhandler, ; we need to put the interrupt into a safe RAM area, here we use ; the APD_BUF for that. (you need to enable IM2 yourself) ; ; NEW: ; - Interrupt won't go 'boom' because of CR_KHAND relocation. ; - Uses the CrASH protocol for installing interrupts. ;----------------------------------------------------------------------------- ;defc INT_STATE = $8D72 ; 1 byte - Interrupt status (0 = no running interrupt) ;defc CURSOR_POS = $800C ; 2 bytes - Cursor Position ld a,(INT_STATE) ; Find the Interrupt State or a ; jr z,OK ; If clear, install interrupt ; ld hl,$0002 ; Display starting second row ld (CURSOR_POS),hl ; ld hl,UnloadStr ; Display the UnloadStr call $8D74 ; ROM_CALL(D_ZT_STR) defw $38FA ; call $8D91 ; CALL CR_KHAND (Wait for a key) jp cleanup ; -> quit ; .UnloadStr ; defm "Please disable " ; defm "the interrupt " ; defm "that is running." ; defb 0 ; .OK ; im 1 ; For safety reasons... ld a,$84 ; ld i,a ; IV table will be at $8400-$8500 ld bc,$0100 ; IV table is 256 bytes long ld h,a ; ld l,c ; HL = $8400 ld d,a ; ld e,b ; DE = $8401 dec a ; dec a ; A = $82 ld (hl),a ; Set first number of IV table ldir ; Copy from HL to DE, BC bytes ; Now, we DON'T setup a JP IntProcStart, because when CR_KHAND ; relocates this code, things will go horribly wrong. So we ; just put the whole interrupt (about 92 bytes) into APD_RAM ld hl,IntProcStart ; ld d,a ; ld e,a ; DE = $8282 ld bc,IntProcEnd-IntProcStart ldir ; ; Registers by now: ; ------------------------------------------------------ ; A = $82 ; HL = IntProcStart + (IntProcEnd-IntProcStart) ; DE = $8282 + (IntProcEnd-IntProcStart) ; BC = $0000 ; F = destroyed ; ------------------------------------------------------ ; Memory usage in APD_BUF: ; ------------------------------------------------------ ; $8228 / $8281 - 90 bytes - free ; $8282 / $83FF - 382 bytes - partialy used by interrupt ; $8400 / $8500 - 256 bytes - IV table ; $8501 / $8528 - 40 bytes - free ; ------------------------------------------------------ ; See the interrupt routines themselves for ; further info of memory useage. z88dk-1.8.ds1/lib/int83.asm0000644000175000017500000000273207455120416014731 0ustar tygrystygrys; Ti83 interrupt loader - by Henk Poley ; Based upon several sources, uses statvars to put the IV-table and JP ;----------------------------------------------------------------------------- ; You only need to have an interrupt marked with IntProcStart ; at the beginning, since the on the Ti83 programs stay where ; they are untill you quit. (you need to enable IM2 yourself) ;----------------------------------------------------------------------------- im 1 ; res 6,(iy+9) ; stats not valid ld a,$86 ; locate vector table at $8600-$8700 ld i,a ; ld bc,$0100 ; vector table is 256 bytes ld h,a ; ld l,c ; HL = $8600 ld d,a ; ld e,b ; DE = $8601 inc a ; A = $87 ld (hl),a ; interrupt "program" located at 8787h ldir ; ; ld l,a ; HL = $8787 ld (hl),$C3 ; Put a JP IntProcStart at $8787 inc hl ; ld (hl),IntProcStart&$FF ; inc hl ; ld (hl),IntProcStart/256 ; ; Registers by now: ; ------------------------------------------- ; A = $87 ; HL = $8789 ; DE = $8701 ; BC = $0000 ; F = carry flag is preserved ; ------------------------------------------- ; Memory usage in statvars: ; ------------------------------------------- ; $858F / $85FF - 113 bytes - free ; $8600 / $8700 - 256 bytes - IV table ; $8701 / $8786 - 134 bytes - free ; $8787 / $8789 - 3 bytes - JP IntProcStart ; $878A / $87A2 - 25 bytes - free ; ------------------------------------------- ; See the interrupt routines themselves for ; further info of memory useage. z88dk-1.8.ds1/lib/int83p.asm0000644000175000017500000000471107455120416015110 0ustar tygrystygrys; Ti83+ interrupt loader - by Henk Poley ; Based upon several sources, uses statvars to put the IV-table and JP ;----------------------------------------------------------------------------- ; Ti83+ programs ; You only need to have an interrupt marked with IntProcStart ; at the beginning, since the on the Ti83+ programs stay where ; they are untill you quit. (you need to enable IM2 yourself) ; Ti83+ Apps: ; You only need to have an interrupt marked with IntProcStart ; at the beginning, and IntProcEnd at the end of your interrupt. ; Since the TIOS could swap out your page when your you execute ; a BCALL. (you need to enable IM2 yourself) ;----------------------------------------------------------------------------- IF !MirageOS ; If MirageOS, already in IM1 im 1 ; ENDIF ; res 6,(iy+9) ; stats not valid ld a,$8B ; locate vector table at $8B00-$8C00 ld i,a ; ld bc,$0100 ; vector table is 256 bytes ld h,a ; ld l,c ; HL = $8B00 ld d,a ; ld e,b ; DE = $8B01 dec a ; A = $8A ld (hl),a ; interrupt program located at $8A8A ldir ; ; IF TI83PLUSAPP ; If Ti83+ App we need to place the ; interrupt in RAM, so it doesn't ; get paged out with BCALLs ld hl,IntProcStart ; ld d,a ; ld e,a ; DE = $8A8A ld bc,IntProcEnd-IntProcStart ldir ; ELSE ; With normal Ti83+ assembly programs ; things are already in RAM ld h,a ; HL = $8A8A ld l,a ; ld (hl),$C3 ; Put a JP IntProcStart at $8A8A inc hl ; ld (hl),IntProcStart&$FF ; inc hl ; ld (hl),IntProcStart/256 ; ENDIF ; ; Registers by now: ; ------------+-------------------------------------------------- ; prog | App ; ------------+-------------------------------------------------- ; A = $8A | A = $8A ; HL = $8A8C | HL = IntProcStart + (IntProcEnd-IntProcStart) ; DE = $8C01 | DE = $8A8A + (IntProcEnd-IntProcStart) ; BC = $0000 | BC = $0000 ; F = carry flag is preserved ; --------------------------------------------------------------- ; Memory usage in statvars: ; --------------------------------------------------------------- ; $8A3A / $8A89 - 80 bytes - free (or used by z88dk app) ; $8A8A / $8A8C - 3 bytes - JP IntProcStart ; $8A8D / $8AFF - 115 bytes - free (some bytes used by z88dk app) ; $8B00 / $8C00 - 256 bytes - IV table ; $8C01 / $8C4D - 77 bytes - free ; --------------------------------------------------------------- ; See the interrupt routines themselves for ; further info of memory useage. z88dk-1.8.ds1/lib/integer.def0000644000175000017500000000104107455120417015370 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; Integer manipulation: DEFC Gn_M16 = $7209 ; Unsigned 16bit multiplication DEFC Gn_D16 = $7409 ; Unsigned 16bit division DEFC Gn_M24 = $7609 ; Unsigned 24bit multiplication DEFC Gn_D24 = $7809 ; Unsigned 24bit division DEFC Gn_Gdn = $1009 ; ASCII (decimal) to integer (binary) conversion DEFC Gn_Pdn = $1209 ; Integer (binary) to ASCII (decimal) conversion lston z88dk-1.8.ds1/lib/interrpt.def0000644000175000017500000000047507455120417015614 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; Interrupt calls: ; (performed as CALL OZ_DI or CALL OZ_EI) DEFC OZ_DI = $0051 ; Disable IM 2 interrupts DEFC OZ_EI = $0054 ; Enable IM 2 interrupts lston z88dk-1.8.ds1/lib/intwrap82.asm0000644000175000017500000000457507455120416015631 0ustar tygrystygrys; Ti82 interrupt 'wrapper' - by Henk Poley ;----------------------------------------------------------------------------- ; The z88dk makes extensively use of the shadow registers (EXX and EX AF,AF) ; The Ti82 system interrupt doesn't preserve (any of) these regs and ; could thus crash your program. The workaround is to use this interrupt ; all the time, it saves and restores the (shadow-)registers for the ; system interrupt. ; We need the system interrupt when scanning keys (in an easy way), also ; some (other) ROM calls make use of the system interrupt. if the interrupt ; is then not running, the calculator would crash. ;----------------------------------------------------------------------------- defc intcount = $8501 ; 1 byte - interrupt variable INCLUDE "#int82.asm" ; Put interrupt loader here ; xor a ; We need to intialize variables ld (intcount),a ; by ourself. ; jr jump_over ; Jump over the interrupt code ;----------------- ; Actual interrupt ;----------------- .IntProcStart push af ; ld a,(intcount) ; Check if own interrupt has quited bit 7,a ; correctly, then bit 7 is zero jr nz,int_fix ; If not zero, fix stack... push hl ; push de ; push bc ; push iy ; ld iy,_IY_TABLE ; ld hl,intcount ; If a 'direct interrupt' occures set 7,(hl) ; right after the TIOS-int, then ; we want bit 7 to be set... .exit_interrupt ; exx ; Swap to shadow registers. ex af,af ; So the TIOS swaps back to the ; normal ones... (the ones we saved ; with push/pops) rst $38 ; di ; 'BIG' HOLE HERE... (TIOS does ei...) di ; ex af,af ; exx ; ; ld hl,intcount ; Interrupt returned correctly, so res 7,(hl) ; we reset our error-condition... ; pop iy ; pop bc ; pop de ; pop hl ; pop af ; ei ; ret ; .int_fix ; pop af ; Pop AF back ex af,af ; Fix shadowregs back exx ; pop bc ; Pop the returnpoint of RST $38 ; from the stack jr exit_interrupt ; Continue with interrupt .IntProcEnd .jump_over ; Memory usage in statvars: ; ------------------------------------------- ; $858F / $85FF - 113 bytes - free ; $8600 / $8700 - 256 bytes - IV table ; $8701 / $8786 - 134 bytes - free ; $8787 / $8789 - 3 bytes - JP IntProcStart ; $878A - 1 byte - intcount <-- ; $878B / $87A2 - 24 bytes - free ; ------------------------------------------- z88dk-1.8.ds1/lib/intwrap83.asm0000644000175000017500000000562507455120416015627 0ustar tygrystygrys; Ti83 interrupt 'wrapper' - by Henk Poley ;----------------------------------------------------------------------------- ; The z88dk makes extensively use of the shadow registers (EXX and EX AF,AF) ; The Ti83 system interrupt doesn't preserve (any of) these regs and ; could thus crash your program. The workaround is to use this interrupt ; all the time, it saves and restores the (shadow-)registers for the ; system interrupt. ; We need the system interrupt when scanning keys (in an easy way), also ; some (other) ROM calls make use of the system interrupt. if the interrupt ; is then not running, the calculator would crash. ;----------------------------------------------------------------------------- ; Do work: ; ticalc\smile.c ; ticalc\dstar.c ; ticalc\spritest.c ; ticalc\world.c ; ticalc2\fib.c ; ; Don't work: ; ticalc\smallgfx.c (83 lib uses dcircle.asm instead of dcircle2.asm) ; - Displays circles, but doesn't return to prompt... ; (Runs correctly now we safe IY and restore it at the end of the program) ; ticalc2\enigma.c ; - Just crashes... ; ticalc2\rpn.c ; - Displays text, but crashes before you can press a key, doesn't respond ; to anything ;----------------------------------------------------------------------------- defc intcount = $878A ; 1 byte needed INCLUDE "#int83.asm" ; Put interrupt loader here ; HL = $8789 inc hl ; We need to intialize variables ld (hl),0 ; by ourself. ; jr jump_over ; Jump over the interrupt code ;----------------- ; Actual interrupt ;----------------- .IntProcStart push af ; ld a,(intcount) ; Check if own interrupt has quited bit 7,a ; correctly, then bit 7 is zero jr nz,int_fix ; If not zero, fix stack... push hl ; push de ; push bc ; push iy ; ld iy,_IY_TABLE ; ld hl,intcount ; If a 'direct interrupt' occures set 7,(hl) ; right after the TIOS-int, then ; we want bit 7 to be set... .exit_interrupt ; exx ; Swap to shadow registers. ex af,af ; So the TIOS swaps back to the ; normal ones... (the ones we saved ; with push/pops) rst $38 ; di ; 'BIG' HOLE HERE... (TIOS does ei...) di ; ex af,af ; exx ; ; ld hl,intcount ; Interrupt returned correctly, so res 7,(hl) ; we reset our error-condition... ; pop iy ; pop bc ; pop de ; pop hl ; pop af ; ei ; ret ; .int_fix ; pop af ; Pop AF back ex af,af ; Fix shadowregs back exx ; pop bc ; Pop the returnpoint of RST $38 ; from the stack jr exit_interrupt ; Continue with interrupt .IntProcEnd .jump_over ; Memory usage in statvars: ; ------------------------------------------- ; $858F / $85FF - 113 bytes - free ; $8600 / $8700 - 256 bytes - IV table ; $8701 / $8786 - 134 bytes - free ; $8787 / $8789 - 3 bytes - JP IntProcStart ; $878A - 1 byte - intcount <-- ; $878B / $87A2 - 24 bytes - free ; ------------------------------------------- z88dk-1.8.ds1/lib/intwrap83p.asm0000644000175000017500000000464307455120416016006 0ustar tygrystygrys; Ti82 interrupt 'wrapper' - by Henk Poley ;----------------------------------------------------------------------------- ; The z88dk makes extensively use of the shadow registers (EXX and EX AF,AF) ; The Ti82 system interrupt doesn't preserve (any of) these regs and ; could thus crash your program. The workaround is to use this interrupt ; all the time, it saves and restores the (shadow-)registers for the ; system interrupt. ; We need the system interrupt when scanning keys (in an easy way), also ; some (other) ROM calls make use of the system interrupt. if the interrupt ; is then not running, the calculator would crash. ;----------------------------------------------------------------------------- IF !TI83PLUSAPP ; Else already in DEFVAR block defc intcount = $8A8D ; 1 byte needed ENDIF INCLUDE "#int83p.asm" ; Put interrupt loader here ; xor a ; We need to intialize variables ld (intcount),a ; by ourself. ; jr jump_over ; Jump over the interrupt code ;----------------- ; Actual interrupt ;----------------- .IntProcStart push af ; ld a,(intcount) ; Check if own interrupt has quited bit 7,a ; correctly, then bit 7 is zero jr nz,int_fix ; If not zero, fix stack... push hl ; push de ; push bc ; push iy ; ld iy,_IY_TABLE ; ld hl,intcount ; If a 'direct interrupt' occures set 7,(hl) ; right after the TIOS-int, then ; we want bit 7 to be set... .exit_interrupt ; exx ; Swap to shadow registers. ex af,af ; So the TIOS swaps back to the ; normal ones... (the ones we saved ; with push/pops) rst $38 ; di ; 'BIG' HOLE HERE... (TIOS does ei...) di ; ex af,af ; exx ; ; ld hl,intcount ; Interrupt returned correctly, so res 7,(hl) ; we reset our error-condition... ; pop iy ; pop bc ; pop de ; pop hl ; pop af ; ei ; ret ; .int_fix ; pop af ; Pop AF back ex af,af ; Fix shadowregs back exx ; pop bc ; Pop the returnpoint of RST $38 ; from the stack jr exit_interrupt ; Continue with interrupt .IntProcEnd .jump_over ; Memory usage in statvars: ; ------------------------------------------- ; $858F / $85FF - 113 bytes - free ; $8600 / $8700 - 256 bytes - IV table ; $8701 / $8786 - 134 bytes - free ; $8787 / $8789 - 3 bytes - JP IntProcStart ; $878A - 1 byte - intcount <-- ; $878B / $87A2 - 24 bytes - free ; ------------------------------------------- z88dk-1.8.ds1/lib/m5_crt0.asm0000644000175000017500000000713310640546527015242 0ustar tygrystygrys; CRT0 for the SORD M5 ; ; Stefano Bodrato Maj. 2000 ; ; If an error occurs eg break we just drop back to BASIC ; ; $Id: m5_crt0.asm,v 1.6 2007/06/27 20:49:27 dom Exp $ ; MODULE m5_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ; No matter what set up we have, main is always, always external to ; this file XREF _main ; ; Some variables which are needed for both app and basic startup ; XDEF cleanup XDEF l_dcal ; Integer rnd seed XDEF _std_seed ; vprintf is internal to this file so we only ever include one of the set ; of routines XDEF _vfprintf ;Exit variables XDEF exitsp XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks ;For stdin, stdout, stder XDEF __sgoioblk ; Graphics stuff XDEF base_graphics XDEF coords ; Now, getting to the real stuff now! org $7400 .start ld hl,0 add hl,sp ld (start1+1),hl ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp exx push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF pop bc exx pop hl exx .start1 ld sp,0 ret .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; mem stuff .base_graphics defw 0 .coords defw 0 defm "Small C+ SORD M5" defb 0 ;All the float stuff is kept in a different file...for ease of altering! ;It will eventually be integrated into the library ; ;Here we have a minor (minor!) problem, we've no idea if we need the ;float package if this is separated from main (we had this problem before ;but it wasn't critical..so, now we will have to read in a file from ;the directory (this will be produced by zcc) which tells us if we need ;the floatpackage, and if so what it is..kludgey, but it might just work! ; ;Brainwave time! The zcc_opt file could actually be written by the ;compiler as it goes through the modules, appending as necessary - this ;way we only include the package if we *really* need it! IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/map.def0000644000175000017500000000064407455120417014520 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; Graphic area (map) control DEFC Os_Map = $F406 ; Map control DEFC MP_WR = $01 ; write a line to the map DEFC MP_DEF = $02 ; define a map using Panel width DEFC MP_GRA = $03 ; define a map of specific width DEFC MP_DEL = $04 ; delete a map lston z88dk-1.8.ds1/lib/memory.def0000644000175000017500000000471307455120417015254 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989-95 ; Memory allocation, deallocation: DEFC Os_Mop = $4E ; Open memory (allocate memory pool) DEFC Os_Mal = $54 ; Allocate memory DEFC Os_Axp = $D206 ; Allocate explicit page (internal OZ usage) DEFC Os_Mfr = $57 ; Free memory DEFC Os_Mcl = $51 ; Close memory (free memory pool) ; Memory information movement: DEFC Os_Bde = $DA06 ; Copy bytes to extended address DEFC Os_Bhl = $DC06 ; Copy bytes from extended address DEFC Gn_Rbe = $3E09 ; Read byte at extended address DEFC Gn_Wbe = $4009 ; Write byte to extended address ; Memory comparison: DEFC Gn_Cme = $4209 ; compare null-terminated strings ; Memory/bank binding: DEFC Os_Mgb = $5A ; Get current binding DEFC Os_Mpb = $5D ; Set (Put) new binding DEFC Os_Bix = $60 ; Bind in extended address (internal) DEFC Os_Box = $63 ; Restore bindings after OS_BIX (internal) ; Fast code interface for bank switching (A=1) DEFC Os_Fc = $8A ; Linked list manipulation calls (often used in combination with Os_Mal): DEFC Gn_Xin = $4609 DEFC Gn_Xnx = $4409 DEFC Gn_Xdl = $4809 ; Memory Masks used by Os_Mop: DEFC MM_S0 = $00 ; Segment 0 mask DEFC MM_S1 = $40 ; Segment 1 mask DEFC MM_S2 = $80 ; Segment 2 mask DEFC MM_S3 = $C0 ; Segment 3 mask ; additional allocation directives for Os_Mop: ; Source of memory (to be allocated): DEFC MM_FIX = $02 ; fixed workspace (not subject to swapping) DEFC MM_SLT = $04 ; explicit slot usage, masked with: DEFC MC_CI = $10 ; internal memory DEFC MC_C1 = $01 ; card 1 DEFC MC_C2 = $02 ; card 2 DEFC MC_C3 = $03 ; card 3 ; Allocation variations: DEFC MM_EXC = $10 ; exclusive use of bank DEFC MM_MUL = $20 ; use multiple banks ; Segment specifiers used by Os_Mgb, Os_Mpb: DEFC MS_S0 = $00 ; Segment 0 specifier DEFC MS_S1 = $01 ; Segment 1 specifier DEFC MS_S2 = $02 ; Segment 2 specifier DEFC MS_S3 = $03 ; Segment 3 specifier ; Low level OZ memory organisation definitions: ; (these manifests represents bit identifiers in a configuration byte that ; is (returned by OS_NQ, NQ_SLT): DEFC BU_EPR = 1 ; bank is EPROM DEFC BU_ROM = 2 ; bank is ROM DEFC BU_WRK = 4 ; work memory DEFC BU_FIX = 8 ; fixed memory DEFC BU_RES = 16 ; reserved memory DEFC BU_APL = 32 ; bank is application RAM DEFC BU_FRE = 128 ; bank is available RAM lston z88dk-1.8.ds1/lib/misc.def0000644000175000017500000000113107455120417014666 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989 ; Miscellaneous OZ call definitions: DEFC Os_Blp = $D806 ; Bleep DEFC Os_Prt = $24 ; Send character directly to printer filter (low level) DEFC Os_Isq = $D006 ; Initialize prefix sequense (internal) DEFC Os_Wsq = $CE06 ; Write to prefix sequense (internal) DEFC Os_Fn = $7B ; Miscellaneous OS functions (internal) DEFC FN_AH = $01 ; allocate handle DEFC FN_VH = $02 ; verify handle DEFC FN_FH = $03 ; free handle lston z88dk-1.8.ds1/lib/msx2bios.def0000755000175000017500000000226210726227172015513 0ustar tygrystygryslstoff ; MSX 2 BIOS functions definition ; ; December 2007 ; $Id: msx2bios.def,v 1.1 2007/12/07 11:28:58 stefano Exp $ ; ; MSX 2 BIOS Entries defc SUBROM = $015C ; Calls a routine in SUB-ROM defc EXTROM = $015F ; Calls a routine in SUB-ROM. Most common way defc CHKSLZ = $0162 ; Search slots for SUB-ROM defc CHKNEW = $0165 ; Tests screen mode defc EOL = $0168 ; Deletes to the end of the line defc BIGFIL = $016B ; Same function as FILVRM (total VRAM can be reached). defc NSETRD = $016E ; Same function as SETRD.(with full 16 bits VRAM-address) defc NSTWRT = $0171 ; Same function as SETWRT.(with full 16 bits VRAM-address) defc NRDVRM = $0174 ; Reads VRAM like in RDVRM.(with full 16 bits VRAM-address) defc NWRVRM = $0177 ; Writes to VRAM like in WRTVRM.(with full 16 bits VRAM-address) ; MSX 2+ BIOS Entries defc RDBTST = $017A ; Read value of I/O poort #F4 defc WRBTST = $017D ; Write value to I/O poort #F4 ; MSX turbo R BIOS Entries defc CHGCPU = $0180 ; Changes CPU mode defc GETCPU = $0183 ; Returns current CPU mode defc PCMPLY = $0186 ; Plays specified memory area through the PCM chip defc PCMREC = $0189 ; Records audio using the PCM chip into the specified memory area lston z88dk-1.8.ds1/lib/msx2subrom.def0000755000175000017500000001207510730213552016061 0ustar tygrystygryslstoff ; MSX 2 SUBROM functions definition ; to be activated via the "msx2subrom" call. ; ; December 2007 ; $Id: msx2subrom.def,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; ; NOTE: due to function name overlaps, ; this file conflicts with the MSX BIOS definitions ; These functions need a BASIC text part for parameters defc PAINT = $0069 ; Paints graphical screen defc PSET = $006D ; Sets a point defc ATRSCN = $0071 ; Scans color attribute defc GLINE = $0075 ; Draws a line defc DOBOXF = $0079 ; Draws a filled box defc DOLINE = $007D ; Draws a line defc BOXLIN = $0081 ; Draws a box ; Other graphics functions defc DOGRPH = $0085 ; Draws a line defc GRPPRT = $0089 ; Places a character on graphic screen defc SCALXY = $008D ; Clip coordinates (till border of screen) defc MAPXYC = $0091 ; Converts an X,Y position to an address: and mask in CLOC and CMASK defc READC = $0095 ; Reads attribute of pixel defc SETATR = $0099 ; Set attribute in ATRBYT defc SETC = $009D ; Set attribute of pixel ; SCREEN 3 only functions defc TRIGHT = $00A1 ; Moves pixel to the right (C-flag set if border of screen is reached) defc RIGHTC = $00A5 ; Moves pixel to the right defc TLEFTC = $00A9 ; Moves pixel to the left (C-flag set if border of screen is reached) defc LEFTC = $00AD ; Moves pixel to the left defc TDOWNC = $00B1 ; Moves pixel down (C-flag set if border of screen is reached) defc DOWNC = $00B5 ; Moves pixel down defc TUPC = $00B9 ; Moves pixel up (C-flag set if border of screen is reached) defc UPC = $00BD ; Moves pixel up ; More graph functions defc SCANR = $00C1 ; Scans pixels to the right defc SCANL = $00C5 ; Scans pixels to the left defc NVBXLN = $00C9 ; Draws a box defc NVBXFL = $00CD ; Draws a filled box ; Double BIOS calls ; The following routines are called from the equally named calls in the MAIN ROM defc CHGMOD = $00D1 ; Switches to given screenmode defc INITXT = $00D5 ; Switches to SCREEN 0 defc INIT32 = $00D9 ; Switches to SCREEN 1 defc INIGRP = $00DD ; Switches to SCREEN 2 defc INIMLT = $00E1 ; Switches to SCREEN 3 defc SETTXT = $00E5 ; Switches VDP in SCREEN 0 defc SETT32 = $00E9 ; Switches VDP in SCREEN 1 defc SETGRP = $00ED ; Switches VDP in SCREEN 2 defc SETMLT = $00F1 ; Switches VDP in SCREEN 3 defc CLRSPR = $00F5 ; Initialises sprite tables defc CALPAT = $00F9 ; Returns address of sprite pattern-table defc CALATR = $00FD ; Returns address of sprite attribute-table defc GSPSIZ = $0101 ; Returns current sprite-size ; MSX 2 specific calls defc GETPAT = $0105 ; Returns current pattern of a character defc WTRVRM = $0109 ; Writes data in VRAM (#0000 - #ffff) defc RDVRM = $010D ; Reads content in VRAM (#0000 - #ffff) defc CHGCLR = $0111 ; Changes screen colors defc CLS = $0115 defc CLRTXT = $0119 ; Clear Text-screen defc DSPFNK = $011D ; Display the function keys defc DELLNO = $0121 ; Remove line in text screen defc INSLNO = $0125 ; Add line to text screen defc PUTVRM = $0129 ; Put character on text screen defc WRTVDP = $012D ; Write to VDP-register defc VDPSTA = $0131 ; Read VDP-status defc KYKLOK = $0135 ; Control KANA-key and KANA-lamp (Japan) defc PUTCHR = $0139 ; Gets a key-code of keyboard, conversion to KANA and in buffer (Japan) defc SETPAG = $013D ; Switches the page ; Palette-functions defc INIPLT = $0141 ; Initialises the palette (current palet is save in VRAM) defc RSTPLT = $0145 ; Restores palette from VRAM defc GETPLT = $0149 ; Obtains the colorcodes from the palette defc SETPLT = $014D ; Sets the color code to the palette ; These functions need a BASIC text part for parameters defc PUTSPRT = $0151 ; Set sprites defc COLOR = $0155 ; Changes Screen- or spritecolor, or palettevalues defc SCREEN = $0159 ; Changes screenmode defc WIDTHS = $015D ; Changes textscreen-width defc VDP = $0161 ; Sets VDP-register defc VDPF = $0165 ; Reads VDP-register defc BASE = $0169 ; Sets VDP base-register defc BASEF = $016D ; Reads VDP base-register defc VPOKE = $0171 ; Writes a byte to VRAM defc VPEEK = $0175 ; Reads a byte from VRAM defc SETS = $0179 ; Sets BEEP, ADJUST, TIME and DATE ; Misc functions defc BEEP = $017D ; Generates beep defc PROMPT = $0181 ; Shows prompt defc SDFSCR = $0185 ; Recovers screen-parameters of clock-chip. ; When C-flag is set function-key text will be displayd defc SETSCR = $0189 ; Recovers screen-parameter and prints Welcome message defc SCOPY = $018D ; Copy's VRAM, array and disk-file (BASIC string needed) ; BIT-BLIT routines defc BLTVV = $0191 ; Copy VRAM to VRAM defc BLTVM = $0195 ; Copy Main-RAM to VRAM defc BLTMV = $0199 ; Copy VRAM to Main-RAM defc BLTVD = $019D ; Copy Diskfile to VRAM defc BLTDV = $01A1 ; Copy VRAM to Diskfile defc BLTMD = $01A5 ; Copy Diskfile to Main-RAM defc BLTDM = $01A9 ; Copy Main-RAM to Diskfile defc NEWPAD = $01AD ; Read lightpen, mouse and trackball defc GETPUT = $01B1 ; GET TIME, GET DATE and PUT KANJI (BASIC string needed) defc CHGMDP = $01B5 ; sets SCREEN-mode defc RESVI = $01B9 ; Not used... Reserve entry defc KNJPRT = $01BD ; Puts Kanji-character on graphical screen (5-8) defc REDCLK = $01F5 ; Read clock-RAM defc WRTCLK = $01F9 ; Write clock-RAM lston z88dk-1.8.ds1/lib/msx_crt0.asm0000644000175000017500000001103110731744165015517 0ustar tygrystygrys; MSX C stub ; ; Stefano Bodrato - Apr. 2001 ; ; $Id: msx_crt0.asm,v 1.10 2007/12/18 13:17:41 stefano Exp $ ; ; There are a couple of #pragma commands which affect ; this file: ; ; #pragma no-streams - No stdio disc files ; #pragma no-protectmsdos - strip the MS-DOS protection header ; ; These can cut down the size of the resultant executable MODULE msx_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- XREF _main XDEF cleanup XDEF l_dcal XDEF _std_seed XDEF snd_tick ;Sound variable XDEF _vfprintf XDEF exitsp XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk XDEF coords ;Current xy position ; ; MSX platform specific stuff ; XDEF msxbios XDEF brksave ; Now, getting to the real stuff now! IF (!DEFINED_startup | (startup=1)) IF !myzorg defc myzorg = 40000 ENDIF org myzorg ELSE org $100 ; MSXDOS ENDIF ;---------------------- ; Execution starts here ;---------------------- .start IF (startup=2) IF !DEFINED_noprotectmsdos ; This protection takes little less than 50 bytes defb $eb,$04 ;MS DOS protection... JMPS to MS-DOS message if Intel ex de,hl jp begin ;First decent instruction for Z80, it survived up to here ! defb $b4,$09 ;DOS protection... MOV AH,9 (Err msg for MS-DOS) defb $ba defw dosmessage ;DOS protection... MOV DX,OFFSET dosmessage defb $cd,$21 ;DOS protection... INT 21h. defb $cd,$20 ;DOS protection... INT 20h. .dosmessage defm "This program is for MSXDOS." defb 13,10,'$' .begin ENDIF ENDIF ld hl,0 add hl,sp ld (start1+1),hl ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF ld ix,$CC ; Hide function key strings call msxbios call _main .cleanup ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF .start1 ld sp,0 ret .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ; --------------- ; MSX specific stuff ; --------------- ; Safe BIOS call .msxbios ld iy,($FCC0) ; slot address of BIOS ROM call 001Ch ; CALSLT ei ; make sure interrupts are enabled ret ; Keeping the BREAK status .brksave defb 1 ; --------------- ; Misc Variables ; --------------- .coords defw 0 ; Current graphics xy coordinates IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; mem stuff defm "Small C+ MSX" defb 0 ;All the float stuff is kept in a different file...for ease of altering! ;It will eventually be integrated into the library ; ;Here we have a minor (minor!) problem, we've no idea if we need the ;float package if this is separated from main (we had this problem before ;but it wasn't critical..so, now we will have to read in a file from ;the directory (this will be produced by zcc) which tells us if we need ;the floatpackage, and if so what it is..kludgey, but it might just work! ; ;Brainwave time! The zcc_opt file could actually be written by the ;compiler as it goes through the modules, appending as necessary - this ;way we only include the package if we *really* need it! IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/msx_crt0.opt0000644000175000017500000000003207265042673015543 0ustar tygrystygrys INCLUDE "#msx_crt0.asm" z88dk-1.8.ds1/lib/msxbasic.def0000755000175000017500000001615710732165673015572 0ustar tygrystygryslstoff ; MSX BASIC and SYSTEM VARIABLES definitions ; ; December 2007 ; $Id: msxbasic.def,v 1.2 2007/12/19 10:00:27 stefano Exp $ ; ; System variables defc VDP_RP = $0006 ; address of vdp READ port defc VDP_WP = $0007 ; address of vdp WRITE port defc MSX_VER = $002D ; MSX version (0 = MSX1, 1 = MSX2) defc RDPRIM = $F380 ;5 Routine that reads from a primary slot defc WRPRIM = $F385 ;7 Routine that writes to a primary slot defc CLPRIM = $F38C ;14 Routine that calls a routine in a primary slot defc USRTAB = $F39A ;2 Address to call with Basic USR0 defc USR0 = $F39A ;2 Address to call with Basic USR0 defc USR1 = $F39C ;2 Address to call with Basic USR1 defc USR2 = $F39E ;2 Address to call with Basic USR2 defc USR3 = $F3A0 ;2 Address to call with Basic USR3 defc USR4 = $F3A2 ;2 Address to call with Basic USR4 defc USR5 = $F3A4 ;2 Address to call with Basic USR5 defc USR6 = $F3A6 ;2 Address to call with Basic USR6 defc USR7 = $F3A8 ;2 Address to call with Basic USR7 defc USR8 = $F3AA ;2 Address to call with Basic USR8 defc USR9 = $F3AC ;2 Address to call with Basic USR9 defc LINL40 = $F3AE ;1 Width for SCREEN 0 (default 37) defc LINL32 = $F3AF ;1 Width for SCREEN 1 (default 29) defc LINLEN = $F3B0 ;1 Width for the current text mode defc CRTCNT = $F3B1 ;1 Number of lines on screen defc CLMLST = $F3B2 ;1 Column space. Its uncertain what this address actually stores defc TXTNAM = $F3B3 ;2 BASE(0) - SCREEN 0 name table defc TXTCOL = $F3B5 ;2 BASE(1) - SCREEN 0 color table defc TXTCGP = $F3B7 ;2 BASE(2) - SCREEN 0 character pattern table defc TXTATR = $F3B9 ;2 BASE(3) - SCREEN 0 Sprite Attribute Table defc TXTPAT = $F3BB ;2 BASE(4) - SCREEN 0 Sprite Pattern Table defc T32NAM = $F3B3 ;2 BASE(5) - SCREEN 1 name table defc T32COL = $F3B5 ;2 BASE(6) - SCREEN 1 color table defc T32CGP = $F3B7 ;2 BASE(7) - SCREEN 1 character pattern table defc T32ATR = $F3B9 ;2 BASE(8) - SCREEN 1 sprite attribute table defc T32PAT = $F3BB ;2 BASE(9) - SCREEN 1 sprite pattern table defc GRPNAM = $F3B3 ;2 BASE(10) - SCREEN 2 name table defc GRPCOL = $F3B5 ;2 BASE(11) - SCREEN 2 color table defc GRPCGP = $F3B7 ;2 BASE(12) - SCREEN 2 character pattern table defc GRPATR = $F3B9 ;2 BASE(13) - SCREEN 2 sprite attribute table defc GRPPAT = $F3BB ;2 BASE(14) - SCREEN 2 sprite pattern table defc MLTNAM = $F3B3 ;2 BASE(15) - SCREEN 3 name table defc MLTCOL = $F3B5 ;2 BASE(16) - SCREEN 3 color table defc MLTCGP = $F3B7 ;2 BASE(17) - SCREEN 3 character pattern table defc MLTATR = $F3B9 ;2 BASE(18) - SCREEN 3 sprite attribute table defc MLTPAT = $F3BB ;2 BASE(19) - SCREEN 3 sprite pattern table defc CLIKSW = $F3DB ;press click status defc CSRY = $F3DC ;1 Current row-position of the cursor defc CSRX = $F3DD ;1 Current column-position of the cursor defc CNSDFG = $F3DE ;function keys status defc RG0SAV = $F3DF ;1 Content of VDP(0) register (R#0) defc RG1SAV = $F3E0 ;1 Content of VDP(1) register (R#1) defc RG2SAV = $F3E1 ;1 Content of VDP(2) register (R#2) defc RG3SAV = $F3E2 ;1 Content of VDP(3) register (R#3) defc RG4SAV = $F3E3 ;1 Content of VDP(4) register (R#4) defc RG5SAV = $F3E4 ;1 Content of VDP(5) register (R#5) defc RG6SAV = $F3E5 ;1 Content of VDP(6) register (R#6) defc RG7SAV = $F3E6 ;1 Content of VDP(7) register (R#7) defc STATFL = $F3E7 ;1 Content of VDP(8) status register (S#0) defc TRGFLG = $F3E8 ;1 Information about trigger buttons and space bar state defc FORCLR = $F3E9 ;1 Foreground color defc BAKCLR = $F3EA ;1 Background color defc BDRCLR = $F3EB ;1 Border color defc MAXUPD = $F3EC ;3 Jump instruction used by Basic LINE command. The routines used are: RIGHTC, LEFTC, UPC and DOWNC defc MINUPD = $F3EF ;3 Jump instruction used by Basic LINE command. The routines used are: RIGHTC, LEFTC, UPC and DOWNC defc ATRBYT = $F3F2 ;1 Attribute byte (for graphical routines its used to read the color) defc QUEUES = $F3F3 ;2 Address of the queue table defc FRCNEW = $F3F5 ;1 CLOAD flag defc SCNCNT = $F3F6 ;1 Key scan timing defc REPCNT = $F3F7 ;1 This is the key repeat delay counter defc PUTPNT = $F3F8 ;2 Address in the keyboard buffer where a character will be written defc GETPNT = $F3FA ;2 Address in the keyboard buffer where the next character is read defc CS120 = $F3FC ;5 Cassette I/O parameters to use for 1200 baud defc CS240 = $F401 ;5 Cassette I/O parameters to use for 2400 baud defc LOW = $F406 ;2 Signal delay when writing a 0 to tape defc HIGH = $F408 ;2 Signal delay when writing a 1 to tape defc HEADER = $F40A ;1 Delay of tape header (sync.) block defc ASPCT1 = $F40B ;2 Horizontal / Vertical aspect for CIRCLE command defc ASPCT2 = $F40D ;2 Horizontal / Vertical aspect for CIRCLE command defc ENDPRG = $F40F ;5 Pointer for the RESUME NEXT command defc ERRFLG = $F414 ;1 Basic Error code defc LPTPOS = $F415 ;1 Position of the printer head defc PRTFLG = $F416 ;1 Printer output flag is read by OUTDO defc NTMSXP = $F417 ;1 Printer type is read by OUTDO. SCREEN ,,,n writes to this address defc RAWPRT = $F418 ;1 Raw printer output is read by OUTDO defc VLZADR = $F419 ;2 Address of data that is temporarilly replaced by O when Basic function VAL("") is running defc VLZDAT = $F41B ;1 Original value that was in the address pointed to with VLZADR defc CURLIN = $F41C ;2 Line number the Basic interpreter is working on, in direct mode it will be filled with #FFFF defc KBUF = $F41F defc STREND = $F6C6 defc SLOTID = $F91F ;1 Character set SlotID defc CHFONT = $F920 ;2 Character set address defc ACPAGE = $FAF6 defc EXBRSA = $FAF8 ;1 Slot address of the SUBROM (EXtended Bios-Rom Slot Address) defc DRVINF = $FB21 ;1 Nr. of drives connected to disk interface 1 defc DRVINF1 = $FB21 ;1 Nr. of drives connected to disk interface 1 defc DISKIF1 = $FB22 ;1 Slot address of disk interface 1 defc DRVINF2 = $FB23 ;1 Nr. of drives connected to disk interface 2 defc DISKIF2 = $FB24 ;1 Slot address of disk interface 2 defc DRVINF3 = $FB25 ;1 Nr. of drives connected to disk interface 3 defc DISKIF3 = $FB26 ;1 Slot address of disk interface 3 defc DRVINF4 = $FB27 ;1 Nr. of drives connected to disk interface 4 defc DISKIF4 = $FB28 ;1 Slot address of disk interface 4 defc BASROM = $FBB1 defc SYSMEM = $FC4A ;start address of system memory defc SCRMOD = $FCAF defc BRDATR = $FCB2 defc GRPACX = $FCB7 defc GRPACY = $FCB9 ; FCC1H -- slot-address of main-ROM defc EXPTBL = $FCC1 ;1 Slot 0: #80 = expanded, 0 = not expanded. Also slot address of the main BIOS-ROM. defc EXP0 = $FCC1 ;1 Expansion Slot 0 defc EXP1 = $FCC2 ;1 Expansion Slot 1 defc EXP2 = $FCC3 ;1 Expansion Slot 2 defc EXP3 = $FCC4 ;1 Expansion Slot 3 defc SLTTBL = $FCC5 ;1 Mirror of slot 0 secondary slot selection register. defc SLT0 = $FCC5 ;1 Mirror of slot 0... defc SLT1 = $FCC6 ;1 Mirror of slot 1... defc SLT2 = $FCC7 ;1 Mirror of slot 2... defc SLT3 = $FCC8 ;1 Mirror of slot 3... ; BASIC locations defc WARM_BT = $409B ; address of "warm boot" BASIC interpreter defc DOTLINE = $58FC defc DOBOXF = $58C1 defc BOXLIN = $5912 defc DO_CIRC = $5B19 defc PSET = $57F5 ; (X = (BC), Y = (DE)) defc DOPSET = $57F5 defc N_PAINT = $266E ; (color = (A), X = (BC), Y = (DE)) - defc O_PAINT = $59E3 ; - init: CALL 0129H (PNTINI in msxbios), then CALL PAINT lston z88dk-1.8.ds1/lib/msxbios.def0000755000175000017500000001571610726227173015442 0ustar tygrystygryslstoff ; MSX BIOS functions definition ; ; December 2007 ; $Id: msxbios.def,v 1.1 2007/12/07 11:28:59 stefano Exp $ ; defc CHKRAM = $0000 ; Check RAM and sets slot for command area. defc RESET = $0000 defc BOOT = $0000 defc STARTUP = $0000 defc SYNCHR = $0008 ; Checks if then current character pointed by ; HL is one desired.If not,generates ; 'Syntax error',otherwise falls into CHRGTB. defc RDSLT = $000C ; Reads the value of an address in another slot defc CHRGTB = $0010 ; Gets next character (or token) from BASIC text. defc WRTSLT = $0014 ; Writes a value to an address in another slot. defc OUTDO = $0018 ; Output to the current device. defc CALSLT = $001C ; Performs inter-slot call to specified address. defc DCOMPR = $0020 ; Compare HL with DE. defc ENASLT = $0024 ; Switches indicated slot at indicated page on perpetual defc GETYPR = $0028 ; Return the type FAC. defc CALLF = $0030 ; Performs far_call (i.e. inter-slots call) defc KEYINT = $0038 ; Performs hardware interrupt procedures. ; I/O initialization. defc INITIO = $003B ; Dev. initialization. defc INIFNK = $003E ; Initializes function key strings. ; Accessing to the VDP (T19918) defc DISSCR = $0041 ; Disables screen display. defc ENASCR = $0044 ; Enables screen display. defc WRTVDP = $0047 ; Writes to the VDP register. defc RDVRM = $004A ; Reads the VRAM address by [HL]. defc WRTVRM = $004D ; Write to the VRAM address by [HL]. defc SETRD = $0050 ; Sets up the VDP for read. defc SETWRT = $0053 ; Sets up the VDP for write. defc FILVRM = $0056 ; Fill the vram with specified data defc LDIRMV = $0059 ; Block transfer to memory from VRAM defc LDIRVM = $005C ; Block transfer to VRAM from memory defc CHGMOD = $005F ; Sets the VDP mode according to SCRMOD. defc CHGCLR = $0062 ; Changes the color of the screen. defc NMI = $0066 ; Performs non-maskable interrupt procedures. defc CLRSPR = $0069 ; Initializes all sprites. defc INITXT = $006C ; Initializes screen for text mode (40*24) and sets the VDP. defc INIT32 = $006F ; Initializes screen for text mode (32*24) and sets the VDP. defc INIGRP = $0072 ; Initializes screen for high-resolution mode and sets the VDP. defc INIMLT = $0075 ; Initializes screen for multi-color mode and sets the VDP. defc SETTXT = $0078 ; Sets the VDP for text (40*24) mode. defc SETT32 = $007B ; Sets the VDP for text (32*24) mode. defc SETGRP = $007E ; Sets the VDP for high-resolution mode. defc SETMLT = $0081 ; Sets the VDP for multicolor mode. defc CALPAT = $0084 ; Returns address of sprite pattern table. defc CALATR = $0087 ; Returns address of sprite atribute table. defc GSPSIZ = $008A ; Returns the current sprite size. defc GRPPRT = $008D ; Prints a character on the graphic screen. ; Accessing to the PSG. defc GICINI = $0090 ; Initializes PSG,and static data for PLAY defc WRTPSG = $0093 ; Writes data to the PSG register. defc RDPSG = $0096 ; Reads data from PSG register. defc STRTMS = $0099 ; Checks/starts background tasks for PLAY. ; Console (i.e. the keyboard and the CRT) defc CHSNS = $009C ; Check the status of keyboard buffer. defc CHGET = $009F ; Waits for character being input and returns the character codes. defc CHPUT = $00A2 ; Outputs a character to the console. defc LPTOUT = $00A5 ; Output a character to the line printer. defc LPTSTT = $00A8 ; Check the line priter status. defc SNVCHR = $00AB ; Check graphic header byte and converts codes. defc PINLIN = $00AE ; Accepts a line from console until a CR or STOP ; is typed,and stores the line in a buffer. defc INLIN = $00B1 ; Same as PINLIN,exept if AUTFLO if set. defc QINLIN = $00B4 ; Output a '?' mark and a space then falls into the INLIN routine. defc BREAKX = $00B7 ; Check the status of the Control-STOP key. defc ISCNTC = $00BA ; Check the status of the SHIFT-STOP key. defc CKCNTC = $00BD ; Same as ISCNTC,used by BASIC defc BEEP = $00C0 ; Sounds the buffer defc CLS = $00C3 ; Clear the screen. defc POSIT = $00C6 ; Locate cursor at the specified position. defc FNKSB = $00C9 ; Check if function key display is active. If ; it is,it display it,otherwise does nothing. defc ERAFNK = $00CC ; Hide the function key diplay. defc DSPFNK = $00CF ; Show the function key display. defc TOTEXT = $00D2 ; Forcidly places the screen in text mode. ; Game I/O devices defc GTSTCK = $00D5 ; Return the current joystick status. defc GTTRIG = $00D8 ; Return the current trigger button status. defc GTPAD = $00DB ; Check the current touch PAD status. defc GTPDL = $00DE ; Return the value of the paddle. ; Tape device routines defc TAPION = $00E1 ; Reads the header block after turning the cassette motor on defc TAPIN = $00E4 ; Read data from the tape defc TAPIOF = $00E7 ; Stops reading from the tape defc TAPOON = $00EA ; Turns on the cassette motor and writes the header defc TAPOUT = $00ED ; Writes data on the tape defc TAPOOF = $00F0 ; Stops writing on the tape defc STMOTR = $00F3 ; Sets the cassette motor action ; Queue routines defc LFTQ = $00F6 ; Gives number of bytes in queue defc PUTQ = $00F9 ; Put byte in queue ; Graphic routines defc RIGHTC = $00FC ; Shifts screenpixel to the right defc LEFTC = $00FF ; Shifts screenpixel to the left defc UPC = $0102 ; Shifts screenpixel up defc TUPC = $0105 ; Tests whether UPC is possible, if possible, execute UPC defc DOWNC = $0108 ; Shifts screenpixel down defc TDOWNC = $010B ; Tests whether DOWNC is possible, if possible, execute DOWNC defc SCALXY = $010E ; Scales X and Y coordinates defc MAPXY = $0111 ; Places cursor at current cursor address defc FETCHC = $0114 ; Gets current cursor addresses mask pattern defc STOREC = $0117 ; Record current cursor addresses mask pattern defc SETATR = $011A ; Set attribute byte defc READC = $011D ; Reads attribute byte of current screenpixel defc SETC = $0120 ; Returns currenct screenpixel of specificed attribute byte defc NSETCX = $0123 ; Set horizontal screenpixels defc GTASPC = $0126 ; Gets screen relations defc PNTINI = $0129 ; Initalises the PAINT instruction defc SCANR = $012C ; Scans screenpixels to the right defc SCANL = $012F ; Scans screenpixels to the left ; Misc routines defc CHGCAP = $0132 ; Alternates the CAP lamp status defc CHGSND = $0135 ; Alternates the 1-bit sound port status defc RSLREG = $0138 ; Reads the primary slot register defc WSLREG = $013B ; Writes value to the primary slot register defc RDVDP = $013E ; Reads VDP status register defc SNSMAT = $0141 ; Returns the value of the specified line from the keyboard matrix defc PHYDIO = $0144 ; Executes I/O for mass-storage media like diskettes defc FORMAT = $0147 ; Initialises mass-storage media like formatting of diskettes defc ISFLIO = $014A ; Tests if I/O to device is taking place defc OUTDLP = $014D ; Printer output defc GETVCP = $0150 ; Returns pointer to play queue defc GETVC2 = $0153 ; Returns pointer to variable in queue number VOICEN (byte op #FB38) defc KILBUF = $0156 ; Clear keyboard buffer defc CALBAS = $0159 ; Executes inter-slot call to the routine in BASIC interpreter lston z88dk-1.8.ds1/lib/msxdos.def0000755000175000017500000000601310732165673015264 0ustar tygrystygryslstoff ; MSX-DOS and DiskROM definitions ; ; December 2007 ; $Id: msxdos.def,v 1.1 2007/12/19 10:00:27 stefano Exp $ ; ; System Variables located in RAM defc A_DRIVE = $F197 ;00 DPB drive A: +00 (0=A, 1=B, etc) defc A_ID = $F198 ;F9 +01 Media ID byte (0F8h/0F9h) defc A_SECSIZ = $F199 ;0200h +02 Sector size (200h = 512 byte) defc A_DIRMSK = $F19B ;0F (SECSIZ/32)-1 +04 (Directory registrations in 1 sector)-1 defc A_DIRSHFT = $F19C ;04 +05 Number of bits in DIRMSK defc A_CLUSMSK = $F19D ;01 +06 (Number of sectors per cluster)-1 defc A_CLUSSHFT = $F19E ;02 +07 (Number of bits in CLUSMSK)+1 defc A_FIRFAT = $F19F ;0001h +08 First sector of the FAT defc A_FATCNT = $F1A1 ;02 +0A FATs number defc A_MAXENT = $F1A2 ;70 +0B max. directory registrations defc A_FIRREC = $F1A3 ;000Eh +0C First sector of the DATA field defc A_MAXCLUS = $F1A5 ;02CAh +0E Maximum number of clusters defc A_FATSIZ = $F1A7 ;03 +10 Number of sectors per FAT defc A_FIRDIR = $F1A8 ;0007 +11 First sector of the DIRectory defc A_FATADR = $F1AA ;E597h +13 Address of the FAT storage in RAM defc B_DRIVE = $F1AC ;00 DPB drive B +00 (0=A, 1=B, etc) defc B_ID = $F1AD ;F9 +01 Media ID byte (0F8h/0F9h) defc B_SECSIZ = $F1AE ;0200h +02 Sector size (200h = 512 byte) defc B_DIRMSK = $F1B0 ;0F (SECSIZ/32)-1 +04 (Directory registrations in 1 sector)-1 defc B_DIRSHFT = $F1B1 ;04 +05 Number of bits in DIRMSK defc B_CLUSMSK = $F1B2 ;01 +06 (Number of sectors per cluster)-1 defc B_CLUSSHFT = $F1B3 ;02 +07 (Number of bits in CLUSMSK)+1 defc B_FIRFAT = $F1B4 ;0001h +08 First sector of the FAT defc B_FATCNT = $F1B6 ;02 +0A FATs number defc B_MAXENT = $F1B7 ;70 +0B max. directory registrations defc B_FIRREC = $F1B8 ;000Eh +0C First sector of the DATA field defc B_MAXCLUS = $F1BA ;02CAh +0E Maximum number of clusters defc B_FATSIZ = $F1BC ;03 +10 Number of sectors per FAT defc B_FIRDIR = $F1BD ;0007h +11 First sector of the DIRectory defc B_FATADR = $F1BF ;E597 +13 Address of the FAT storage in RAM defc DEFAULTDRV = $F306 ;00 Default drive of MSXDOS defc ERRADR = $F323 ; pointer to a disk error routine defc CTRLCAD = $F325 ; Like ERRADR, but now ^C is eventually printed defc RAMAD0 = $F341 ;1 Slot address of RAM in page 0 (DOS) defc RAMAD1 = $F342 ;1 Slot address of RAM in page 1 (DOS) defc RAMAD2 = $F343 ;1 Slot address of RAM in page 2 (DOS/BASIC) defc RAMAD3 = $F344 ;1 Slot address of RAM in page 3 (DOS/BASIC) defc EXDRSA = $F348 ;1 Slot address of the main DiskROM defc DSK_CONN = $FFA7 ; info on diskdrive connections: anything different ; from C9H means a connection is made lston z88dk-1.8.ds1/lib/mz_crt0.asm0000644000175000017500000000635310640546527015352 0ustar tygrystygrys; Stub for the SHARP MZ family ; ; Stefano Bodrato - 5/5/2000 ; ; $Id: mz_crt0.asm,v 1.8 2007/06/27 20:49:27 dom Exp $ ; MODULE mz_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ;-------- ; Include zcc_opt.def to find out some info ;-------- INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ;stdio info block XDEF base_graphics ;Graphical variables XDEF coords ;Current xy position XDEF snd_tick ;Sound variable ; Now, getting to the real stuff now! org 4608 .start ld (start1+1),sp ;Save entry stack ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main .cleanup ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF .start1 ld sp,0 jp $AD ; Go back to monitor .l_dcal jp (hl) ;Used for function pointer calls ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------- ; Now some variables ;----------- .coords defw 0 ; Current graphics xy coordinates .base_graphics defw $D000 ; Address of the Graphics map ._std_seed defw 0 ; Seed for integer rand() routines .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF defm "Small C+ SHARP MZ" defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/mz_crt0.opt0000644000175000017500000000003107130401717015346 0ustar tygrystygrys INCLUDE "#mz_crt0.asm" z88dk-1.8.ds1/lib/nascom_crt0.asm0000755000175000017500000000676110640546527016212 0ustar tygrystygrys; CRT0 for the NASCOM1/2 ; ; Stefano Bodrato May 2003 ; ; ; - - - - - - - ; ; $Id: nascom_crt0.asm,v 1.5 2007/06/27 20:49:27 dom Exp $ ; ; - - - - - - - MODULE nascom_crt0 ;------- ; Include zcc_opt.def to find out information about us ;------- INCLUDE "zcc_opt.def" ;------- ; Some general scope declarations ;------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF __sgoioblk ;stdio info block XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF base_graphics ;Graphical variables (useless with NASCOM) XDEF coords ;Current xy position XDEF montest ;NASCOM: check the monitor type org C80h ;org E000h ; NASSYS1..NASSYS3 ; IF (startup=1) | (startup=2) | (startup=3) ; ; ; ENDIF .start ld (start1+1),sp ;Save entry stack ; search for the top of writeble memory and set the stack pointer ld hl,ffffh ld a,55 .stackloop ld (hl),a cp (hl) dec hl jr nz,stackloop ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main ;Call user program .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF pop bc .start1 ld sp,0 ;Restore stack to entry value rst 18h defb 5bh ;ret .l_dcal jp (hl) ;Used for function pointer calls jp (hl) ;------------------------------------ ; Check which monitor we have in ROM ;------------------------------------ montest: ld a,(1) ; "T" monitor or NAS-SYS? cp 33h ; 31 00 10 / 31 33 0C ret ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------- ; Now some variables ;----------- .coords defw 0 ; Current graphics xy coordinates .base_graphics defw 0 ; Address of the Graphics map ._std_seed defw 0 ; Seed for integer rand() routines .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks defm "Small C+ NASCOM" ;Unnecessary file signature defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/nascom_crt0.opt0000755000175000017500000000003507662450563016224 0ustar tygrystygrys INCLUDE "#nascom_crt0.asm" z88dk-1.8.ds1/lib/nc100_crt0.asm0000644000175000017500000000565210640546527015546 0ustar tygrystygrys; Kludgey startup for nc100 ; ; djm 17/4/2000 ; ; I've never used one of these brutes so I dunno if it's ; correct at all, this is all taken from the file nciospec.doc ; on nvg.unit.no, I assume that the PCMCIA RAM card is an ; actual fact addressable RAM and we can overwrite variables ; etc NB. Values of static variables are not reinitialised on ; future entry. ; ; $Id: nc100_crt0.asm,v 1.6 2007/06/27 20:49:27 dom Exp $ ; MODULE nc100_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ;stdio info block XDEF base_graphics ;Graphical variables XDEF coords org $C000 jp start defs 509 ;Waste 509 bytes of space ;-------- ; Card header ;-------- defm "NC100PRG" defb 0,0,0,0,0,0,0,0 jp start ;c210 defm "z88dk NC100" defb 0,0 .start ;Entry point at $c2220 ld (start+1),sp ;Save entry sp ld hl,-64 ;Create the atexit stack add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main ;Call user code .cleanup push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall ;Close all opened files call closeall ENDIF ENDIF exx ;???? Hangover from ZX code? ld hl,10072 exx pop bc .start1 ld sp,0 ret .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ENDIF ;------- ; Now, which of the vfprintf routines do we need? ;------- ._vfprintf IF DEFINFED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;------- ; Some variables ;------- ._std_seed defw 0 ;Integer rand() seed ;Atexit routine .exitsp defw 0 ;atexit() stack address .exitcount defb 0 ;Number of atexit() routines .heaplast defw 0 ;heap variables .heapblocks defw 0 .base_graphics defw 0 ;Graphics variables .coords defw 0 defm "Small C+ nc100" defb 0 ;------- ; Floating point ;------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP spare register .fa defs 6 ;FP accumulator .fasign defb 0 ;FP variable ENDIF z88dk-1.8.ds1/lib/nc100_crt0.opt0000644000175000017500000000003410551450455015550 0ustar tygrystygrys INCLUDE "#nc100_crt0.asm" z88dk-1.8.ds1/lib/newbrain_crt0.asm0000644000175000017500000001004610640546527016523 0ustar tygrystygrys; ; Grundy NewBrain startup code ; ; ; $Id: newbrain_crt0.asm,v 1.5 2007/06/27 20:49:27 dom Exp $ ; MODULE newbrain_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ;stdio info block XDEF base_graphics ;Graphical variables XDEF coords ;Current xy position XDEF snd_tick ;Sound variable XDEF nbclockptr ;ptr to clock counter location IF (startup=2) XDEF oldintaddr ;made available to chain an interrupt handler ENDIF IF !myzorg defc myzorg = 10000 ENDIF org myzorg .start ld (start1+1),sp ;Save entry stack ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF (startup=2) ld hl,(57) ld (oldintaddr),hl ld hl,nbckcount ld (57),hl ENDIF IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main ;Call user program .cleanup ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF IF (startup=2) ld hl,(oldintaddr) ld (57),hl ENDIF .cleanup_exit .start1 ld sp,0 ;Restore stack to entry value ret .l_dcal jp (hl) ;Used for function pointer calls ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------- ; Grundy NewBrain clock handler. ; an interrupt handler could chain the "oldintaddr" value. ;----------- IF (startup=2) .nbclockptr defw $52 ; ROM routine ; Useless custom clock counter (we have the ROM one). ; ;.nbclockptr defw nbclock ; .nbckcount ; push af ; push hl ; ld hl,(nbclock) ; inc hl ; ld (nbclock),hl ; ld a,h ; or l ; jr nz,nomsb ; ld hl,(nbclock_m) ; inc hl ; ld (nbclock_m),hl ;.nomsb pop hl ; pop af defb 195 ; JP .oldintaddr defw 0 .nbclock defw 0 ; NewBrain Clock .nbclock_m defw 0 ELSE .nbclockptr defb $52 ; paged system clock counter ENDIF ;----------- ; Now some variables ;----------- .coords defw 0 ; Current graphics xy coordinates .base_graphics defw 0 ; Address of the Graphics map ._std_seed defw 0 ; Seed for integer rand() routines .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF defm "Small C+ NewBrain" ;Unnecessary file signature defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/oz_crt0.asm0000644000175000017500000002732110640546527015352 0ustar tygrystygrys; CRT0 for the Sharp OZ family ; ; Stefano Bodrato 13 Aug. 2002 ; ; Mix of the Dominic's work and the Hi-Tech C modifications ; by the OZDEV team (Alexander R. Pruss, Green, etc..) ; ; all the "$" prefixes have been changed to "s_"; ; the "$sp$" label is been changed to "s_sp". ; ; the "-DOZDK" enables the OZ7xx DK compatibility mode ; with extra functions and interrupt handling ; (this causes the DEFINED_ozgetch2 flag to be activated) ; ; - - - - - - - ; ; $Id: oz_crt0.asm,v 1.6 2007/06/27 20:49:27 dom Exp $ ; ; - - - - - - - MODULE oz_crt0 ;------- ; Include zcc_opt.def to find out information about us ;------- INCLUDE "zcc_opt.def" ;------- ; Some general scope declarations ;------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF __sgoioblk ;stdio info block XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF base_graphics ;Graphical variables XDEF coords ;Current xy position XDEF s_filetypetable XDEF saved_hl ;Temporary store used by compiler XDEF saved_de ;for hl and de ; --- OZ related stuff--- XDEF ozactivepage ;current mem page XDEF ozmodel ;detected model (call "detect" first) XDEF ozbacklight ;display light status XDEF ozcontrast ;display contrast XDEF ozbacklight_save XDEF s_ozlcdstatus XDEF s_init_unblank ;service entry point to go back from "ozfast" or "ozblankscreen" XDEF ScrCharSet IF DEFINED_ozgetch2 XDEF KeyBufGetPos ; XDEF KeyBufPutPos ; don't XDEF EnableKeyboard XDEF KeyboardBuffer ENDIF ; --- settings --- XDEF ozkeyrepeatspeed XDEF ozkeyrepeatdelay XDEF ozclick_setting XDEF ozautoofftime XDEF ozautoblanktime XDEF ozautolightofftime XDEF ozprogoptions ; --- -------- --- defc contrast = 0c026h defc lcdstatus = 0c024h org $8000 DEFB 00h, 64h, 09h, 0FEh, 31h, 26h, 48h, 41h DEFB 30h, 31h, 32h, 0Dh, 75h, 31h, 03h, 0FEh, 5Ah, 0Fh start: jr skipname ozfilename: defm "BFILNAMEBAS" defb 00 ozfileowner: defw 65535 ; __ozspare1start: skipname: in a,(1) push af in a,(2) push af ; save starting 8000 page ld a,2 out (1),a ld a,4 out (2),a ; page first code page into 8000h jp continue continue: ld a,(0c068h) ; backlight state ld (ozbacklight),a ld (ozbacklight_save),a ld hl,(lcdstatus) ld (s_ozlcdstatus),hl ld a,(contrast) ld (ozcontrast),a di in a,(7) ;ld (intset),a ld (intset+1),a ld a,0ffh-(16+128+1) ;; ARP: was 4+32 !! out (7),a call s_swapupperpages ;; now our code is paged in as follows: ;; 8000h: first code page, originally in page 406h ;; a000h: second code page, originally in page 407h ;; c000h: third code page, originally in page 408h ;; e000h: fourth code page, originally in page 409h ;; pages 408h and 409h store the initial contents of c000h-ffffh ;; sp points to 0fe00h ; clear BSS segment (lifted from Hi-Tech C init code, but modified) ;ld de,__Lbss ;Start of BSS segment ;or a ;clear carry ;ld hl,__Hbss ;sbc hl,de ;size of uninitialized data area ;jr z,EmptyBSS ;ld c,l ;ld b,h ;dec bc ;ld l,e ;ld h,d ;inc de ;ld (hl),0 ;ldir ;clear memory ;EmptyBSS: IF DEFINED_ozgetch2 ld hl,KeyBufGetPos ld (hl),0 ld de,KeyBufGetPos+1 ld bc,26-1 ldir ; ld a,1 ; out (19h),a ; ld a,10 ; out (17h),a ; xor a ; out (18h),a ; ld a,2 ; out (16h),a ;; enable key click LIB ozcustomisr LIB ozsetisr ld hl,ozcustomisr push hl call ozsetisr ;; install our ISR pop bc ld a,l or h jr nz,__exit ENDIF ;ld hl,1 ;push hl ;call _ozclick ;pop hl ;ld hl,argv ;push hl ;ld hl,1 ;push hl ;------- Z88DK specific code (begin) ------- ld (start1+1),sp ;Save entry stack ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF ;-------- Z88DK specific code (end) ------- call _main ;call main program ; __ozspare1end: ;------- Z88DK specific code (begin) ------- .cleanup ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF .start1 ld sp,0 ;Restore stack to entry value ;ret ;-------- Z88DK specific code (end) ------- ;pop hl ;pop hl ; argv (??) _ozexitrestoreint: _exit: ld a,7 out (3),a ld a,4 out (4),a ;; page in proper second page ;call __ozcallexitfunctions __exit: s_init_unblank: ; ozblankscreen or ozfast might have hidden everything; call ret_only ; if so, ret_only is changed into "ozunblankscreen" to make it back visible. di ;intset equ $+1 .intset ld a,0ffh out (7),a im 1 call s_swapupperpages call s_clearbacklighttimer ;; restore a bunch of stuff ld a,(ozbacklight_save) ld (0c068h),a ld hl,(s_ozlcdstatus) ld (lcdstatus),hl ;; restore right LCD Status ld a,(ozcontrast) ld (contrast),a IF DEFINED_ozgetch2 ld hl,KeyBufGetPos ;; put keyboard buffer in standard buffer ld de,0c031h ld bc,24 ldir ENDIF s_wipe_hook: nop nop nop ; ld hl,0406h ; ld c,4 ; out (c),h ; dec c ; out (c),l ; dec c ld a,6 out (3),a ld a,4 out (4),a jp continue2+2000h continue2: ; pop hl ; out (c),h ; dec c ; out (c),l ; restore starting page pop af out (2),a pop af out (1),a xor a out (22h),a ; restore default display page ei _bdos: ;; dummy routines ret s_sp: defw 0fe00h swapret: defw 0 s_swapupperpages: ;; must be called with interrupts disabled pop bc ld (s_swapupperpages_ret+1),bc ld a,8 out (3),a ld a,4 ; page in page 408 at 0a000h out (4),a ld d,0c0h call s_swappage ; swap 0a000h page with 0c000h page ld a,9 out (3),a ; ld a,4 ; out (4),a ; page in page 409 at 0a000h ld d,0e0h call s_swappage ; swap 0a000h page with 0e000h page ld hl,0 add hl,sp ld de,(s_sp) ld (s_sp),hl ex de,hl ld sp,hl .s_swapupperpages_ret jp 0 ;s_swapupperpages_ret equ $-2 s_swappage: ;; must be called with interrupts disabled! ;; swaps pages at a000 and at d*256 pop bc ld (s_swappage_ret+1),bc ld hl,0 add hl,sp ld (s_saved_sp+1),hl ld hl,0a000h ld sp,hl ld e,l ex de,hl ld a,h add a,20h ; end marker top: pop bc ;10 ld e,(hl) ;7 ld (hl),c ;7 inc l ;4 ld d,(hl) ;7 ld (hl),b ;7 inc l ;4 push de ;11 pop de ;10 ;SP=SP+2 pop bc ;10 ld e,(hl) ld (hl),c inc l ld d,(hl) ld (hl),b inc l push de pop de jp nz,top ;10 inc h cp h jp nz,top .s_saved_sp ld hl,0000 ;; ;s_saved_sp equ $-2 ;; self-mod ld sp,hl ld a,7 out (3),a ;; ld a,4 ;; out (4),a ; page in second code page .s_swappage_ret jp 0 ;$swappage_ret equ $-2 s_32kintoff: di im 1 ret_only: ret s_32kinton: ld a,0feh ld i,a im 2 ei ret s_clearbacklighttimer: ld hl,0 ld (0c00dh),hl ld hl,(s_ozlcdstatus) ld (lcdstatus),hl ret ozbacklight: defb 0 ozbacklight_save: defb 0 ozcontrast: defb 0 s_ozlcdstatus: defw 0 IF DEFINED_ozgetch2 KeyBufGetPos: defb 0 KeyBufPutPos: defb 0 KeyboardBuffer: ; 123456789012345678901234 defm "(c)Pruss,Green,&c vZ88DK" ENDIF ScrCharSet: defb 1 ;argv: defw __ozfilename EnableKeyboard: defs 1 ;HeapTop EQU 0f980h ;Model32k EQU 1 ; --- settings - leave untouched --- ozkeyrepeatspeed: defb 5 ozkeyrepeatdelay: defb 32 ozclick_setting: defb 1 ozautoofftime: defw 60*180 ;; 3 hours ozautoblanktime: defw 240 ;; 4 minutes ozautolightofftime: defw 120 ;; 2 minutes ozprogoptions: defb 0 ;; padding (for future expansion) defb 0,0,0,0 ;------------------------------------------ ;------------------------------------------ ; End of startup part, routines following ;------------------------------------------ ;------------------------------------------ .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND .__sgoioblk INCLUDE "#stdio_fp.asm" ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------- ; Now some variables ;----------- .coords defw 0 ; Current graphics xy coordinates base_graphics: defw A000h ; Address of the Graphics map ozactivepage: defw 0400h ; Page number for the graph map (0400h for A000h) ozmodel: defb -1 ; Set with "ozdetectmodel" (see libraries) s_filetypetable: defw 0c089h ._std_seed defw 0 ; Seed for integer rand() routines .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks .saved_hl defw 0 ; Temp store for hl .saved_de defw 0 ; Temp store for de defm "Small C+ OZ" ;Unnecessary file signature defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/oz_crt0.opt0000644000175000017500000000003107566714366015374 0ustar tygrystygrys INCLUDE "#oz_crt0.asm" z88dk-1.8.ds1/lib/p3dos.def0000644000175000017500000000455107741511015014770 0ustar tygrystygryslstoff ; +3DOS routine addresses ; ; $Id: p3dos.def,v 1.1 2003/10/10 11:03:41 dom Exp $ ; ; Stolen from Residos - thanks Garry! defc STD_ALERT=$0002 defc STD_CHANGEDISK=$0005 defc DOS_INITIALISE=$0100 defc DOS_VERSION=$0103 defc DOS_OPEN=$0106 defc DOS_CLOSE=$0109 defc DOS_ABANDON=$010c defc DOS_REF_HEAD=$010f defc DOS_READ=$0112 defc DOS_WRITE=$0115 defc DOS_BYTE_READ=$0118 defc DOS_BYTE_WRITE=$011b defc DOS_CATALOG=$011e defc DOS_FREE_SPACE=$0121 defc DOS_DELETE=$0124 defc DOS_RENAME=$0127 defc DOS_BOOT=$012a defc DOS_SET_DRIVE=$012d defc DOS_SET_USER=$0130 defc DOS_GET_POSITION=$0133 defc DOS_SET_POSITION=$0136 defc DOS_GET_EOF=$0139 defc DOS_GET_1346=$013c defc DOS_SET_1346=$013f defc DOS_FLUSH=$0142 defc DOS_SET_ACCESS=$0145 defc DOS_SET_ATTRIBUTES=$0148 defc DOS_OPEN_DRIVE=$014b defc DOS_SET_MESSAGE=$014e defc DOS_REF_XDPB=$0151 defc DOS_MAP_B=$0154 defc DD_INTERFACE=$0157 defc DD_INIT=$015a defc DD_SETUP=$015d defc DD_SET_RETRY=$0160 defc DD_READ_SECTOR=$0163 defc DD_WRITE_SECTOR=$0166 defc DD_CHECK_SECTOR=$0169 defc DD_FORMAT=$016c defc DD_READ_ID=$016f defc DD_TEST_UNSUITABLE=$0172 defc DD_LOGIN=$0175 defc DD_SEL_FORMAT=$0178 defc DD_ASK_1=$017b defc DD_DRIVE_STATUS=$017e defc DD_EQUIPMENT=$0181 defc DD_ENCODE=$0184 defc DD_L_XDPB=$0187 defc DD_L_DPB=$018a defc DD_L_SEEK=$018d defc DD_L_READ=$0190 defc DD_L_WRITE=$0193 defc DD_L_ON_MOTOR=$0196 defc DD_L_T_OFF_MOTOR=$0199 defc DD_L_OFF_MOTOR=$019c ; +3DOS Error codes defgroup { rc_ready, rc_wp, rc_seek, rc_crc, rc_nodata, rc_mark, rc_unrecog, rc_unknown, rc_diskchg, rc_unsuit, rc_badname=20, rc_badparam, rc_nodrive, rc_nofile, rc_exists, rc_eof, rc_diskfull, rc_dirfull, rc_ro, rc_number, rc_denied, rc_norename, rc_extent, rc_uncached, rc_toobig, rc_notboot, rc_inuse } lston z88dk-1.8.ds1/lib/packages.def0000644000175000017500000000245207130401717015513 0ustar tygrystygrys; Package handling package definitions defc pkg_ayt=$0000 ; Are you there; package-handling defc rc_pnf=$11 ; package not found error code ; (same as RC_PRE) defc pkg_inf=$000f ; static information (Packages) defc pkg_ayt_x=$020f ; are you there? (Packages) defc pkg_bye=$040f ; terminate (Packages) defc pkg_dat=$060f ; dynamic data (Packages) defc pkg_exp=$080f ; expansion call (Packages) defc pkg_reg=$0a0f ; register a package defc pkg_drg=$0c0f ; deregister a package defc pkg_nxt=$0e0f ; get next installed package ID defc pkg_get=$100f ; get information on a package defc pkg_feat=$120f ; packages feature control defc pkg_rst20=$140f ; CALL_OZ handler defc pkg_intm1=$160f ; M1 interrupt chain handler defc pkg_intr=$180f ; register interrupt handler defc pkg_intd=$1a0f ; deregister interrupt handler defc pkg_pid=$1c0f ; get current process ID defc pkg_ozcr=$1e0f ; register OZ call substitution defc pkg_ozcd=$200f ; deregister OZ call substitution defc pkg_slow=$220f ; SlowMo interrupt call defc pkg_bal=$240f ; allocate bank defc pkg_bfr=$260f ; free bank defc pkg_boot=$280f ; package autoboot facility ; Reason codes defc int_pkg=$00 defc int_prc=$01 defc bnk_any=$00 defc bnk_even=$01 defc exp_boot=$01 z88dk-1.8.ds1/lib/pps_crt0.asm0000644000175000017500000001132610640546527015522 0ustar tygrystygrys; Kludgey startup for Peters Plus Sprinter ; ; djm 18/5/99 ; ; $Id: pps_crt0.asm,v 1.4 2007/06/27 20:49:27 dom Exp $ ; MODULE pps_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ;stdio info block XDEF base_graphics ;Graphical variables XDEF coords ;Current xy position XDEF snd_tick ;Sound variable org $8100 - 512 defw $5845 ;EXE signature defb $45 ;Reserved (EXE type) defb $00 ;Version of EXE file defl 512 ;Offset to code defw 0 ;Primary loader size or 0 (no primary loader) defl 0 ;Reserved defw 0 ;Reserved defw start ;Loading address defw start ;Starting address defw $bfff ;Stack defs 490 ;Reserved space .start ld (start1+1),sp ;Save entry stack ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp ld (start_prefix),ix IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF ld de,0 ld hl,$2350 ld b,7 ld a,' ' ld c,$56 ;CLEAR rst $10 ; Work out argc/argv - same as the CPM version ld hl,0 ; NULL pointer at the end push hl ld b,0 ;arguments ld hl,(start_prefix) ld a,(hl) ;length of arguments and a jr z,argv_done ld c,a add hl,bc ;now points to end of arguments ; Try to find the end of the arguments .argv_loop_1 ld a,(hl) cp ' ' jr nz,argv_loop_2 ld (hl),0 dec hl dec c jr nz,argv_loop_1 ; We've located the end of the last argument, try to find the start .argv_loop_2 ld a,(hl) cp ' ' jr nz,argv_loop_3 ld (hl),0 inc hl push hl inc b dec hl .argv_loop_3 dec hl dec c jr nz,argv_loop_2 .argv_done ld hl,end ;name of program (NULL) push hl inc b ld hl,0 add hl,sp ;address of argv ld c,b ld b,0 push bc ;argc push hl ;argv call _main ;Call user code pop bc ;kill argv pop bc ;kill argc .cleanup ; ; Deallocate memory which has been allocated here! ; push hl ;save return code IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF pop bc .start1 ld sp,0 ;Restore stack to entry value ld bc,$41 ;exit with - error code rst $10 ret .l_dcal jp (hl) ;Used for function pointer calls ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------- ; Now some variables ;----------- .coords defw 0 ; Current graphics xy coordinates .base_graphics defw 0 ; Address of the Graphics map ._std_seed defw 0 ; Seed for integer rand() routines .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks .start_prefix defw 0 ; Entry handle from OS IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF defm "Small C+ PPS" ;Unnecessary file signature .end defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/pps_crt0.opt0000644000175000017500000000003107546324513015533 0ustar tygrystygrys INCLUDE "#pps_crt0.asm" z88dk-1.8.ds1/lib/rcmx000_boot.asm0000755000175000017500000001107510623244602016176 0ustar tygrystygrys; ; Rabbit Control Module bootstrap program ; ; This module is included by rcmx000_crt0.asm ; ; $Id: rcmx000_boot.asm,v 1.2 2007/05/18 06:36:50 stefano Exp $ ; ; PLEASE NOTE: If you ever change this file, please also review ; the boot.c utility in the support/rcmx000 section cause it makes ; assumptions on where the code lies in memory... org 0 .__start_prog ld sp,8000h ; If boot uses raw (-r) option we will patch this into ; jp _end_prog. ; If we are not in raw option, this will not do anything useful ld hl, __end_prog ; N.B: The "end_prog" is the end of this file's program but the ; beginning of the users stuff ; Tell host we have loaded!! Send the 'babe' magic pattern ld a,0bah call __sendchar nop ld a,0beh call __sendchar nop ; Here we receive the baudrate divisor from host call __recvchar nop ; Save the divisor for later echoing back to host ld b,a ; This character is used for the baudrate divisor, ; the host must know this in some way, the best is to use ; the meassurebaud.asm utility for each new target connected ; An example: for a CPU @ 14.7456 MHz ; a divisor of 192 should be used, i.e. the register should ; be loaded with 192-1 = 191 ; ; The base frequency is thus 14745600/32 = 460800 ; To be further divided into (460800/2400) = 192 = 8*3*2*2*2 ; To reach 2400 baud ; ; N.B. This example may only be true to a factor or divisor of ; two, since there is some talk in the manuals about internal ; clockdoublers etc, which might complicate this further!!! ; ; defb 0d3h ; ioi ld (0a9h),a ; TAT4R baud divisor ; Receive a character at the new baudrate... call __recvchar nop call __sendchar ; Just echo back same char... nop ld a,b call __sendchar ; Here we echo the baudrate number for the ; host to check that we are still in sync nop xor 0ffh call __sendchar ; Complement just to show signs of intelligence nop ; From this point the target first accepts two characters ; to represent the length of the rest of the download, then the ; download itself and finally a 16 bit checksum of all numbers ; added together 8-bit wise call __recvchar nop ld c,a call __recvchar nop ld b,a ld ix,0 ; We will reload whole program and ; even pass over this code on the way ; Checksum is stored here ld iy,0 ld d,0 ld e,c ; Add length bytes to checksum add iy,de ld e,b add iy,de .again call __recvchar nop ld e,a add iy,de ld (ix+0),e dec bc ld a,b or c inc ix jr nz,again push iy pop bc ld a,c call __sendchar nop ld a,b call __sendchar nop call __end_prog ; This will jump to main jp 0 .__recvchar defb 0d3h ; ioi ld a,(0c3h) ; SASR Serial status bit 7,a jr z,__recvchar defb 0d3h ; ioi ld a,(0c0h) ; SADR Serial data read ret .__sendchar push hl ld hl,0c3h .__waitready defb 0d3h ; ioi bit 3,(hl) ; SASR, Serial status, bit 3 jr nz,__waitready defb 0d3h ; ioi ld (0c0h),a ; SADR Serial data write (checksum) pop hl ret ; This is the I/O operations necessary to set the system in a decent mode, such ; as asserting that there is RAM at address zero before downloading the code at ; org 0h mk_boot_code actually uses assembler symbol table to locate "prefix" ; and "postfix" ; ; The coldboot utility need to transfer the binary file ; up until this point, from address 0 and on ; Remember, a program starts with the crt0 file, ; which then includes this file!! .__endbootstrap .__prefix defb 080h, 000h, 008h ; GCSR Clock select, bit 4-2: 010 (osc) defb 080h, 009h, 051h ; Watchdog defb 080h, 009h, 054h defb 080h, 010h, 000h ; MMU defb 080h, 014h, 045h ; Memory bank defb 080h, 015h, 045h ; Memory bank defb 080h, 016h, 040h ; Memory bank defb 080h, 017h, 040h ; Memory bank defb 080h, 013h, 0c6h ; MMU defb 080h, 011h, 074h ; MMU defb 080h, 012h, 03ah ; MMU defb 080h defb 0a9h ; Below the bootstrap utility should patch the correct divisor for ; a 2400 Baud operation in non-cold boot mode, ; If the host hardware supports on-the-fly baudrate changes ; we set them at a later point in the bootstrap code ; obtained via meassurebaud.c, we have it set here to an insane value ; so this it not forgotten... .__patch_baudrate defb 42 ; TAT4R <= baud divisor defb 080h, 0a0h, 001h ; TACSR <= 1 defb 080h, 0c4h, 000h ; SACR <= 0 defb 080h, 009h, 051h ; WDTTR <= 51h defb 080h, 009h, 054h ; WDTTR <= 54h defb 080h, 055h, 040h ; PCFR <= 40h ;; This is the standard final I/O operation that kick starts the Rabbit from address zero in RAM .__postfix defb 080h, 024h, 080h ; SPCR <= 80h .__end_prog z88dk-1.8.ds1/lib/rcmx000_crt0.asm0000755000175000017500000000612510640546527016115 0ustar tygrystygrys; CRT0 for the Rabbit Control Module ; ; If an error occurs (eg. out if screen) we just drop back to BASIC ; ; - - - - - - - ; ; $Id: rcmx000_crt0.asm,v 1.4 2007/06/27 20:49:27 dom Exp $ ; ; - - - - - - - ; TODO_KANIN Fix this!!! MODULE rcmx000_crt0 ;------- ; Include zcc_opt.def to find out information about us ;------- INCLUDE "zcc_opt.def" ;------- ; Simulate unsupported z80 instructions ;------- LIB rcmx_cpd LIB rcmx_cpdr LIB rcmx_cpi LIB rcmx_cpir LIB rcmx_rld LIB rcmx_rrd ;------- ; Some general scope declarations ;------- XREF _main ;main() is always external to crt0 code XDEF __sendchar ; Used by stdio XDEF __recvchar XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF __sgoioblk ;stdio info block XDEF heaplast ;Near malloc heap variables XDEF heapblocks org 0 .start ; On this platform we are king of the road and may use ; any register for any purpose Wheee!! include "#rcmx000_boot.asm" jp _main IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main ;Call user program .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF pop bc .start1 ld sp,0 ;Restore stack to some sane value ; Puts us back into the monitor call 8 .l_dcal jp (hl) ;Used for function pointer calls jp (hl) ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------- ; Now some variables ;----------- ; Here is a great place to store temp variables and stuff!! .acme defw 4711 ; useless arbitrarily choosen number defm "Small C+ RCM2/3000"&0 ;Unnecessary file signature ._std_seed defw 0 ; Needed for rand and srand ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/rcmx000_crt0.opt0000755000175000017500000000003610571263045016124 0ustar tygrystygrys INCLUDE "#rcmx000_crt0.asm" z88dk-1.8.ds1/lib/README0000644000175000017500000000120007240030562014121 0ustar tygrystygrysIncludes for the Ti-83 and the TI-83 Plus (main.h ti83.h ti83p.h) ----------------------------------------- Just a quick readme to explain things. The files included have been changed to compile with z80asm, a linux z80 compiler included with the project z88dk which can be found at sourceforge. The main.h file assumes that your .asm files are in src/ and the includes in lib/ also, you'll have to define Plus either with the line: Define Plus or the option -DPlus on the command line. Thats all, if you need to convert anything else, either learn how to use regexps (man 7 regex) or contact me -- Solignac Julien z88dk-1.8.ds1/lib/rel_crt0.asm0000644000175000017500000001054210640546530015473 0ustar tygrystygrys; Startup stub for relocating (z88) programs ; ; This is untested, but should be okay ; ; Created 18/5/99 djm ; ; $Id: rel_crt0.asm,v 1.5 2007/06/27 20:49:28 dom Exp $ ;----------- ; The .def files that we need here ;----------- INCLUDE "#error.def" INCLUDE "#stdio.def" ;----------- ; If we have an org then use it. But since we're relocating it's ignored ; failing that, default to 16384 ;----------- IF DEFINED_myzorg org myzorg ELSE org 16384 ENDIF org $2300 ;----------- ; Code starts executing from here ;----------- .start ld (start+1),sp ;Save starting stack ld sp,($1ffe) ;Pick up stack from OZ safe place ld hl,-64 ;Make room for the atexit() table add hl,sp ld sp,hl ld (exitsp),sp call doerrhan ;Initialise a laughable error handler ;----------- ; Initialise the (ANSI) stdio descriptors so we can be called agin ;----------- IF DEFINED_ANSIstdio ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF call _main ;Run the program .cleanup ;Jump back here from exit() if needed IF DEFINED_ANSIstdio LIB closeall call closeall ;Close any open files (fopen) ENDIF call_oz(gn_nln) ;Print a new line call resterrhan ;Restore the original error handler .start1 ld sp,0 ;Restore stack to entry value ret ;Out we go ;----------- ; Install the error handler ;----------- .doerrhan xor a ld (exitcount),a ld b,0 ld hl,errhand call_oz(os_erh) ld (l_erraddr),hl ld (l_errlevel),a ret ;----------- ; Restore BASICs error handler ;----------- .resterrhan ld hl,(l_erraddr) ld a,(l_errlevel) ld b,0 call_oz(os_erh) .processcmd ;processcmd is called after os_tin ld hl,0 ret ;----------- ; The error handler ;----------- .errhand ret z ;Fatal error cp rc_esc jr z,errescpressed ld hl,(l_erraddr) ;Pass everything to BASIC's handler scf .l_dcal jp (hl) ;Used for function pointer calls also .errescpressed call_oz(os_esc) ;Acknowledge escape pressed jr cleanup ;Exit the program ;----------- ; Select which vfprintf routine is needed ;----------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ; We can't use far stuff with BASIC cos of paging issues so ; We assume all data is in fact near, so this is a dummy fn ; really ;----------- ; Far stuff can't be used with BASIC because of paging issues, so we assume ; that all data is near - this function is in fact a dummy and just adjusts ; the stack as required ;----------- ._cpfar2near pop bc pop hl pop de push bc ret ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;----------- ; Now some variables ;----------- .l_erraddr defw 0 ; BASIC error handler address .l_errlevel defb 0 ; And error level .coords defw 0 ; Current graphics xy coordinates .base_graphics defw 0 ; Address of the Graphics map .gfx_bank defb 0 ; And the bank ._std_seed defw 0 ; Seed for integer rand() routines .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks .packintrout defw 0 ; Address of user interrupt routine IF DEFINED_NEED1bitsound .snd_asave defb 0 ; Sound variable .snd_tick defb 0 ; " " ENDIF ;----------- ; Unnecessary file signature ;----------- defm "Small C+ z88" defb 0 ;----------- ; Floating point ;----------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ; FP seed (unused ATM) .extra defs 6 ; Extra register temp store .fa defs 6 ; "" .fasign defb 0 ; "" ENDIF z88dk-1.8.ds1/lib/rex_crt0.asm0000644000175000017500000000361110640546530015506 0ustar tygrystygrys; Startup Code for Xircom Rex 6000 ; ; djm 6/3/2001 ; ; $Id: rex_crt0.asm,v 1.14 2007/06/27 20:49:28 dom Exp $ ; MODULE rex_crt0 INCLUDE "zcc_opt.def" ;-------- ; Some scope declarations ;-------- XREF _main ;main() is always external to crt0 XDEF _std_seed ;integer rand() seed XDEF exitsp ;atexit() variables XDEF exitcount XDEF heapblocks ;malloc() variables XDEF heaplast XDEF l_dcal ;jp(hl) instruction XDEF cleanup ; defm "ApplicationName:Addin"&10&13 ; defm "[program name - 10 chars?]"&10&13 ; defb 0 ; defw endprof-begprog ; defb 0,0 ; Prior to $8000 we have a 40x32 icon ;-------- ; Main code starts here ;-------- org $8000 jp start ;addin signature jump .start ; Make room for the atexit() stack ld hl,65535-64 ;Initialise sp ld sp,hl ld hl,$f033 ;Clear static memory ld de,$f034 ld bc,$ffff-$f033 ld (hl),0 ldir ld (exitsp),sp ;Store atexit() stack xor a ld (exitcount),a ;Setup number of atexit() routines ld hl,$8080 ;Initialise fp seed ld (fp_seed),hl ; Entry to the user code call _main ;Call the users code .cleanup ld de,$42 ;DS_ADDIN_TERMINATE ld ($c000),de rst $10 ;Exit the addin .endloop jr endloop .l_dcal jp (hl) ;Used for call by function pointer ;-------- ; Static variables are kept in RAM in high memory ;-------- DEFVARS $f033 { _std_seed ds.w 1 ;Integer seed exitsp ds.w 1 ;Pointer to atexit() stack exitcount ds.b 1 ;Number of atexit() routines registered fp_seed ds.w 3 ;Floating point seed, unused ATM extra ds.w 3 ;Floating point temp variable fa ds.w 3 ;Floating point accumulator fasign ds.b 1 ;Floating point temp store heapblocks ds.w 1 ;Number of malloc blocks heaplast ds.w 1 ;Pointer to linked list of free malloc blocks } ;-------- ; Now, include the math routines if needed.. ;-------- IF NEED_floatpack INCLUDE "#float.asm" ENDIF z88dk-1.8.ds1/lib/rex_crt0.opt0000644000175000017500000000003207251214072015517 0ustar tygrystygrys INCLUDE "#rex_crt0.asm" z88dk-1.8.ds1/lib/rxl_crt0.asm0000644000175000017500000000402510640546530015515 0ustar tygrystygrys; Startup Code for Xircom Rex 6000 ; ; djm 6/3/2001 ; ; $Id: rxl_crt0.asm,v 1.3 2007/06/27 20:49:28 dom Exp $ ; MODULE rex_crt0 INCLUDE "zcc_opt.def" ;-------- ; Some scope declarations ;-------- XREF _main ;main() is always external to crt0 XREF _LibMain XDEF _std_seed ;integer rand() seed XDEF exitsp ;atexit() variables XDEF exitcount XDEF heapblocks ;malloc() variables XDEF heaplast XDEF l_dcal ;jp(hl) instruction XDEF cleanup ; defm "ApplicationName:Addin"&10&13 ; defm "[program name - 10 chars?]"&10&13 ; defb 0 ; defw endprof-begprog ; defb 0,0 ; Prior to $8000 we have a 40x32 icon ;-------- ; Main code starts here ;-------- org $8000 jp start ;addin signature jump .signature defm "XXX" .lib ld hl,farret push hl jp _LibMain .start ; Make room for the atexit() stack ld hl,65535-64 ;Initialise sp ld sp,hl ld hl,$f033 ;Clear static memory ld de,$f034 ld bc,$ffff-$f033 ld (hl),0 ldir ld (exitsp),sp ;Store atexit() stack xor a ld (exitcount),a ;Setup number of atexit() routines ld hl,$8080 ;Initialise fp seed ld (fp_seed),hl ; Entry to the user code call _main ;Call the users code .cleanup ld de,$42 ;DS_ADDIN_TERMINATE ld ($c000),de rst $10 ;Exit the addin .endloop jr endloop .l_dcal jp (hl) ;Used for call by function pointer .farret ;Used for farcall logic pop bc ld a,c jp $26ea ;-------- ; Static variables are kept in RAM in high memory ;-------- DEFVARS $f033 { _std_seed ds.w 1 ;Integer seed exitsp ds.w 1 ;Pointer to atexit() stack exitcount ds.b 1 ;Number of atexit() routines registered fp_seed ds.w 3 ;Floating point seed, unused ATM extra ds.w 3 ;Floating point temp variable fa ds.w 3 ;Floating point accumulator fasign ds.b 1 ;Floating point temp store heapblocks ds.w 1 ;Number of malloc blocks heaplast ds.w 1 ;Pointer to linked list of free malloc blocks } ;-------- ; Now, include the math routines if needed.. ;-------- IF NEED_floatpack INCLUDE "#float.asm" ENDIF z88dk-1.8.ds1/lib/rxl_crt0.opt0000644000175000017500000000003207455120417015533 0ustar tygrystygrys INCLUDE "#rxl_crt0.asm" z88dk-1.8.ds1/lib/sam_crt0.asm0000644000175000017500000000773210640546530015500 0ustar tygrystygrys; Startup fo SAM Coupe ; ; Stefano 26/3/2001 ; ; If an error occurs eg break we just drop back to BASIC ; ; $Id: sam_crt0.asm,v 1.8 2007/06/27 20:49:28 dom Exp $ ; MODULE sam_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ; No matter what set up we have, main is always, always external to ; this fileb XREF _main ; ; Some variables which are needed for both app and basic startup ; XDEF cleanup XDEF l_dcal ; Integer rnd seed XDEF _std_seed ; vprintf is internal to this file so we only ever include one of the set ; of routines XDEF _vfprintf ; Exit variables XDEF exitsp XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks ; For stdin, stdout, stder XDEF __sgoioblk ; Graphics stuff XDEF base_graphics XDEF coords ; Sound stuff XDEF snd_tick ; Now, getting to the real stuff now! org 32768 .start ld (start1+1),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF ; Special SAM stuff goes here ; Set screen to mode 0 ld a,0 call $15A ; JMODE ; set stream to channel 's' (upper screen) ld a,2 call $112 ; JSETSTRM ; End of SAM stuff call _main .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF pop bc ; Special SAM stuff goes here ; End of SAM stuff .start1 ld sp,0 ret .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; mem stuff .base_graphics defw 16384 .coords defw 0 defm "Small C+ SAM Coupe" defb 0 ;All the float stuff is kept in a different file...for ease of altering! ;It will eventually be integrated into the library ; ;Here we have a minor (minor!) problem, we've no idea if we need the ;float package if this is separated from main (we had this problem before ;but it wasn't critical..so, now we will have to read in a file from ;the directory (this will be produced by zcc) which tells us if we need ;the floatpackage, and if so what it is..kludgey, but it might just work! ; ;Brainwave time! The zcc_opt file could actually be written by the ;compiler as it goes through the modules, appending as necessary - this ;way we only include the package if we *really* need it! IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/sam_crt0.opt0000644000175000017500000000003207265041736015513 0ustar tygrystygrys INCLUDE "#sam_crt0.asm" z88dk-1.8.ds1/lib/saverst.def0000644000175000017500000000141107455120417015423 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989 ; Save / Restore manipulation: ; (screen, application mailbox, Page wait & Application card management) DEFC Os_Sr = $6C ; Save & Restore ; arguments: DEFC SR_SUS = $01 ; Save user screen DEFC SR_RUS = $02 ; Restore user screen DEFC SR_WPD = $03 ; Write parameter data (mailbox) DEFC SR_RPD = $04 ; Read parameter data (mailbox) DEFC SR_FUS = $05 ; Free user screen (released, not displayed) DEFC SR_CRM = $06 ; Remvove card (not implemented) DEFC SR_CIN = $07 ; Insert card (not implemented) DEFC SR_PWT = $08 ; Page wait DEFC SR_RND = $09 ; Occasionally a random number (system use) lston z88dk-1.8.ds1/lib/screen.def0000644000175000017500000000104107455120417015212 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989 ; Screen control: DEFC Os_Off = $EC06 ; switch machine (screen) off DEFC Os_Sci = $D406 ; alter screen info ; arguments: DEFC SC_LR0 = $01 ; LORES0 (512 byte granularity) DEFC SC_LR1 = $02 ; LORES1 (4K granularity) DEFC SC_HR0 = $03 ; HIRES0 (8K granularity) DEFC SC_HR1 = $04 ; HIRES1 (2K granularity) DEFC SC_SBR = $05 ; screen base (2K granularity) lston z88dk-1.8.ds1/lib/serintfc.def0000644000175000017500000000123707455120417015557 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989 ; Low level serial port interface: DEFC Os_Si = $8D ; serial interface (low level) DEFC SI_HRD = $00 ; Hard reset the serial port DEFC SI_SFT = $03 ; Soft reset the serial port DEFC SI_INT = $06 ; Interrupt entry point DEFC SI_GBT = $09 ; Get byte from serial port DEFC SI_PBT = $0C ; Put byte to serial port DEFC SI_ENQ = $0F ; Status enquiry DEFC SI_FTX = $12 ; Flush Tx (transmit) buffer DEFC SI_FRX = $15 ; Flush Rx (receive) buffer DEFC SI_TMO = $18 ; Set timeout lston z88dk-1.8.ds1/lib/shellapi.def0000644000175000017500000000101207555313201015526 0ustar tygrystygrys; Shell API Definitions ; Auto-generated for Shell v0.25 defc shell_verh=$0030 defc shell_verm=$0032 defc shell_verl=$0035 defc shell_loadaddr=$2FB1 defc shell_headerlen=$000C defc shell_next=$F886 defc shell_cmdaddr=$20F5 defc shell_cmdlen=$20F3 defc shell_cmdptr=$20F7 defc shell_ztos=$8EA4 defc shell_eval=$99BA defc shell_allocate=$D71B defc shell_free=$D864 defc shell_freeall=$D8E6 ; TEMPORARY - for v0.25 only! defc shell_also=$EB26 defc shell_internal=$94F0 defc shell_previous=$EB41 z88dk-1.8.ds1/lib/sms_crt0.asm0000755000175000017500000001465110630370127015517 0ustar tygrystygrys; Startup Code for Sega Master System ; ; Haroldo O. Pinheiro February 2006 ; ; $Id: sms_crt0.asm,v 1.2 2007/06/02 22:33:59 dom Exp $ ; DEFC ROM_Start = $0000 DEFC INT_Start = $0038 DEFC NMI_Start = $0066 DEFC CODE_Start = $0100 DEFC RAM_Start = $C000 DEFC RAM_Length = $2000 DEFC Stack_Top = $dff0 MODULE sms_crt0 ;------- ; Include zcc_opt.def to find out information about us ;------- INCLUDE "zcc_opt.def" ;------- ; Some general scope declarations ;------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _std_seed ;Integer rand() seed XDEF exitsp ;Pointer to atexit() stack XDEF exitcount ;Number of atexit() functions registered XDEF __sgoioblk ;std* control block XDEF heaplast ;Near malloc heap variables XDEF heapblocks ; XDEF _vfprintf ;jp to printf() core routine XDEF fputc_vdp_offs ;Current character pointer XDEF aPLibMemory_bits;apLib support variable XDEF aPLibMemory_byte;apLib support variable XDEF aPLibMemory_LWM ;apLib support variable XDEF aPLibMemory_R0 ;apLib support variable XDEF raster_procs ;Raster interrupt handlers XDEF pause_procs ;Pause interrupt handlers XDEF timer ;This is incremented every time a VBL/HBL interrupt happens XDEF _pause_flag ;This alternates between 0 and 1 every time pause is pressed org ROM_Start jp start defm "Sega Master System" ;------- ; Interrupt handlers ;------- .filler1 defs (INT_Start - filler1) .int_RASTER push hl ld a, ($BF) or a jp p, int_not_VBL ; Bit 7 not set jr int_VBL .int_not_VBL pop hl reti .int_VBL ld hl, timer ld a, (hl) inc a ld (hl), a inc hl ld a, (hl) adc a, 1 ld (hl), a ;Increments the timer ld hl, raster_procs jr int_handler .filler2 defs (NMI_Start - filler2) .int_PAUSE push hl ld hl, _pause_flag ld a, (hl) xor a, 1 ld (hl), a ld hl, pause_procs jr int_handler .int_handler push af push bc push de .int_loop ld a, (hl) inc hl or (hl) jr z, int_done push hl ld a, (hl) dec hl ld l, (hl) ld h, a call call_int_handler pop hl inc hl jr int_loop .int_done pop de pop bc pop af pop hl ei reti .call_int_handler jp (hl) ;------- ; Beginning of the actual code ;------- .filler3 defs (CODE_Start - filler3) .start ; Make room for the atexit() stack ld hl,Stack_Top-64 ld sp,hl ; Clear static memory ld hl,RAM_Start ld de,RAM_Start+1 ld bc,RAM_Length-1 ld (hl),0 ldir ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF ld hl,$8080 ld (fp_seed),hl xor a ld (exitcount),a call DefaultInitialiseVDP im 1 ei ; Entry to the user code call _main .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF .endloop jr endloop .l_dcal jp (hl) ;--------------------------------- ; VDP Initialization ;--------------------------------- .DefaultInitialiseVDP push hl push bc ld hl,_Data ld b,_End-_Data ld c,$bf otir pop bc pop hl ret DEFC SpriteSet = 0 ; 0 for sprites to use tiles 0-255, 1 for 256+ DEFC NameTableAddress = $3800 ; must be a multiple of $800; usually $3800; fills $700 bytes (unstretched) DEFC SpriteTableAddress = $3f00 ; must be a multiple of $100; usually $3f00; fills $100 bytes _Data: defb @00000100,$80 ; |||||||`- Disable synch ; ||||||`-- Enable extra height modes ; |||||`--- SMS mode instead of SG ; ||||`---- Shift sprites left 8 pixels ; |||`----- Enable line interrupts ; ||`------ Blank leftmost column for scrolling ; |`------- Fix top 2 rows during horizontal scrolling ; `-------- Fix right 8 columns during vertical scrolling defb @10000100,$81 ; |||| |`- Zoomed sprites -> 16x16 pixels ; |||| `-- Doubled sprites -> 2 tiles per sprite, 8x16 ; |||`---- 30 row/240 line mode ; ||`----- 28 row/224 line mode ; |`------ Enable VBlank interrupts ; `------- Enable display defb (NameTableAddress/2^10) |@11110001,$82 defb (SpriteTableAddress/2^7)|@10000001,$85 defb (SpriteSet/2^2) |@11111011,$86 defb $f|$f0,$87 ; `-------- Border palette colour (sprite palette) defb $00,$88 ; ``------- Horizontal scroll defb $00,$89 ; ``------- Vertical scroll defb $ff,$8a ; ``------- Line interrupt spacing ($ff to disable) _End: ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ; Static variables kept in safe workspace DEFVARS RAM_Start { __sgoioblk ds.b 40 ;stdio control block _std_seed ds.w 1 ;Integer seed exitsp ds.w 1 ;atexit() stack exitcount ds.b 1 ;Number of atexit() routines fp_seed ds.w 3 ;Floating point seed (not used ATM) extra ds.w 3 ;Floating point spare register fa ds.w 3 ;Floating point accumulator fasign ds.b 1 ;Floating point variable heapblocks ds.w 1 ;Number of free blocks heaplast ds.w 1 ;Pointer to linked blocks fputc_vdp_offs ds.w 1 ;Current character pointer aPLibMemory_bits ds.b 1 ;apLib support variable aPLibMemory_byte ds.b 1 ;apLib support variable aPLibMemory_LWM ds.b 1 ;apLib support variable aPLibMemory_R0 ds.w 1 ;apLib support variable raster_procs ds.w 8 ;Raster interrupt handlers pause_procs ds.w 8 ;Pause interrupt handlers timer ds.w 1 ;This is incremented every time a VBL/HBL interrupt happens _pause_flag ds.b 1 ;This alternates between 0 and 1 every time pause is pressed } ;-------- ; Now, include the math routines if needed.. ;-------- IF NEED_floatpack ; INCLUDE "#float.asm" ENDIF z88dk-1.8.ds1/lib/sms_crt0.opt0000755000175000017500000000003210630364750015532 0ustar tygrystygrys INCLUDE "#sms_crt0.asm" z88dk-1.8.ds1/lib/spec_crt0.asm0000644000175000017500000002052110640546403015640 0ustar tygrystygrys; Kludgey startup for Spectra ; ; djm 18/5/99 ; ; $Id: spec_crt0.asm,v 1.14 2007/06/27 20:48:03 dom Exp $ ; MODULE zx82_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ;stdio info block XDEF base_graphics ;Graphical variables XDEF coords ;Current xy position XDEF snd_tick ;Sound variable XDEF call_rom3 ;Interposer ;-------- ; Set an origin for the application (-zorg=) default to 32768 ;-------- IF DEFINED_ZXVGS IF !myzorg DEFC myzorg = $5CCB ;repleaces BASIC program ENDIF IF !STACKPTR DEFC STACKPTR = $FF57 ;below UDG, keep eye when using banks ENDIF ENDIF IF !myzorg defc myzorg = 32768 ENDIF org myzorg .start ld iy,23610 ; restore the right iy value, fixes the self-relocating trick IF !DEFINED_ZXVGS ld (start1+1),sp ;Save entry stack ENDIF IF STACKPTR ld sp,STACKPTR ENDIF ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF DEFINED_ZXVGS ;setting variables needed for proper keyboard reading LD (IY+1),$CD ;FLAGS #5C3B LD (IY+48),1 ;FLAGS2 #5C6A EI ;ZXVGS starts with disabled interrupts ENDIF ld a,2 ;open the upper display (uneeded?) call 5633 IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF IF DEFINED_NEEDresidos call residos_detect jp c,cleanup_exit ENDIF call _main ;Call user program .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF IF DEFINED_ZXVGS POP BC ;let's say exit code goes to BC RST 8 DEFB $FD ;Program finished ELSE .cleanup_exit ld hl,10072 ;Restore hl' to what basic wants exx pop bc .start1 ld sp,0 ;Restore stack to entry value ret ENDIF .l_dcal jp (hl) ;Used for function pointer calls ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;--------------------------------------------- ; Some +3 stuff - this needs to be below 49152 ;--------------------------------------------- IF DEFINED_NEEDresidos INCLUDE "#idedos.def" defc ERR_NR=$5c3a ; BASIC system variables defc ERR_SP=$5c3d XDEF dodos ; ; This is support for residos, we use the normal ; +3 -lplus3 library and rewrite the values so ; that they suit us somewhat .dodos exx push iy pop hl ld b,PKG_IDEDOS rst RST_HOOK defb HOOK_PACKAGE ld iy,23610 ret ; Detect an installed version of ResiDOS. ; ; This should be done before you attempt to call any other ResiDOS/+3DOS/IDEDOS ; routines, and ensures that the Spectrum is running with ResiDOS installed. ; Since +3DOS and IDEDOS are present only from v1.40, this version must ; be checked for before making any further calls. ; ; If you need to use calls that were only provided from a certain version of ; ResiDOS, you can check that here as well. ; ; The ResiDOS version call is made with a special hook-code after a RST 8, ; which will cause an error on Speccies without ResiDOS v1.20+ installed, ; or error 0 (OK) if ResiDOS v1.20+ is present. Therefore, we need ; to trap any errors here. .residos_detect ld hl,(ERR_SP) push hl ; save the existing ERR_SP ld hl,detect_error push hl ; stack error-handler return address ld hl,0 add hl,sp ld (ERR_SP),hl ; set the error-handler SP rst RST_HOOK ; invoke the version info hook code defb HOOK_VERSION pop hl ; ResiDOS doesn't return, so if we get jr noresidos ; here, some other hardware is present .detect_error pop hl ld (ERR_SP),hl ; restore the old ERR_SP ld a,(ERR_NR) inc a ; is the error code now "OK"? jr nz,noresidos ; if not, ResiDOS was not detected ex de,hl ; get HL=ResiDOS version push hl ; save the version ld de,$0140 ; DE=minimum version to run with and a sbc hl,de pop bc ; restore the version to BC ret nc ; and return with it if at least v1.40 .noresidos ld bc,0 ; no ResiDOS ld a,$ff ld (ERR_NR),a ; clear error ret ENDIF ;--------------------------------------------- ; Some +3 stuff - this needs to be below 49152 ;--------------------------------------------- IF DEFINED_NEEDplus3dodos ; Routine to call +3DOS Routines. Located in startup ; code to ensure we don't get paged out ; (These routines have to be below 49152) ; djm 17/3/2000 (after the manual!) XDEF dodos .dodos call dodos2 ;dummy routine to restore iy afterwards ld iy,23610 ret .dodos2 push af push bc ld a,7 ld bc,32765 di ld (23388),a out (c),a ei pop bc pop af call cjumpiy push af push bc ld a,16 ld bc,32765 di ld (23388),a out (c),a ei pop bc pop af ret .cjumpiy jp (iy) ENDIF IF 0 ; Short routine to set up a +3 DOS header so files ; Can be accessed from BASIC, we set to type code ; load address 0 and length supplied ; ; Entry: b = file handle ; hl = file length .setheader ld iy,setheader_r call dodos ret .setheader_r push hl call 271 ;DOS_RED_HEAD pop hl ld (ix+0),3 ;CODE ld (ix+1),l ;Length ld (ix+2),h ld (ix+3),0 ;Load address ld (ix+4),0 ret ENDIF ; Call a routine in the spectrum ROM ; The routine to call is stored in the two bytes following .call_rom3 exx ; Use alternate registers ex (sp),hl ; get return address ld c,(hl) inc hl ld b,(hl) ; BC=BASIC address inc hl ex (sp),hl ; restore return address push bc exx ; Back to the regular set ret ;----------- ; Now some variables ;----------- .coords defw 0 ; Current graphics xy coordinates .base_graphics defw 0 ; Address of the Graphics map IF !DEFINED_HAVESEED XDEF _std_seed ;Integer rand() seed ._std_seed defw 0 ; Seed for integer rand() routines ENDIF .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF defm "Small C+ ZX" ;Unnecessary file signature defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/spec_crt0.opt0000644000175000017500000000003307130401716015653 0ustar tygrystygrys INCLUDE "#spec_crt0.asm" z88dk-1.8.ds1/lib/stdio.def0000644000175000017500000000457307455120417015072 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989 DEFC OS_In = $2A ; read a byte from std. input (keyboard) DEFC OS_Tin = $2D ; read a byte from std. input, with timeout DEFC OS_Out = $27 ; write a byte to std. output DEFC OS_Xin = $30 ; examine input (e.g. check for pre-emption) DEFC GN_Nln = $2E09 ; send newline (CR/LF) to std. output DEFC GN_Sop = $3A09 ; write string to std. output DEFC GN_Soe = $3C09 ; write string from extended address DEFC GN_Sip = $3809 ; system input line routine DEFC OS_Pur = $33 ; purge keyboard buffer (and reset timeout) ; Standard input key definitions (Returned by OS_IN, OS_TIN, GN_SIP) ; ; The following codes are NOT zero prefixed: ; IN_ESC, IN_ENT, IN_TAB, IN_SPC & IN_DEL DEFC IN_ESC = $1B ; ENTER TAB DELETE DEFC IN_ENT = $0D, IN_TAB = $09, IN_DEL = $7F DEFC IN_SENT = $D1, IN_STAB = $D2, IN_SDEL = $D3 ; SHIFT DEFC IN_DENT = $C1, IN_DTAB = $C2, IN_DDEL = $C3 ; DIAMOND DEFC IN_AENT = $B1, IN_ATAB = $B2, IN_ADEL = $B3 ; SQUARE DEFC IN_SPC = 32 ; LEFT RIGHT DOWN UP DEFC IN_LFT = $FC, IN_RGT = $FD, IN_DWN = $FE, IN_UP = $FF DEFC IN_SLFT = $F8, IN_SRGT = $F9, IN_SDWN = $FA, IN_SUP = $FB ; SHIFT DEFC IN_DLFT = $F4, IN_DRGT = $F5, IN_DDWN = $F6, IN_DUP = $F7 ; DIAMOND DEFC IN_ALFT = $F0, IN_ARGT = $F1, IN_ADWN = $F2, IN_AUP = $F3 ; SQUARE ; various definitions: DEFC ESC = 27, LF = 10, CR = 13 ; Menu exception codes: DEFC MU_ENT = $E1, MU_TAB = $E2, MU_SPC = $E0, MU_DEL = $E3 ; OZ screen driver icons: DEFC SD_EXSP = $20 ; Exact space DEFC SD_BLL = $21 ; Bell DEFC SD_GRV = $27 ; Grave accent DEFC SD_SQUA = $2A ; Square DEFC SD_DIAM = $2B ; Diamond DEFC SD_SHFT = $2D ; Shift DEFC SD_VBAR = $7C ; Unbroken vertical bar DEFC SD_ENT = $E1, SD_TAB = $E2, SD_SPC = $E0, SD_DEL = $E3 DEFC SD_ESC = $E4, SD_MNU = $E5, SD_INX = $E6, SD_HLP = $E7 ; Outlined icons: DEFC SD_OLFT = $F0, SD_ORGT = $F1 DEFC SD_OUP = $F3, SD_ODWN = $F2 ; bullet icons: DEFC SD_BLFT = $F4, SD_BRGT = $F5 DEFC SD_BDWN = $F6, SD_BUP = $F7 ; pointer icons: DEFC SD_PLFT = $F8, SD_PRGT = $F9 DEFC SD_PDWN = $FA, SD_PUP = $FB ; Miscellaneous driver codes: DEFC SD_DTS = $7F ; Delete toggle settings DEFC SD_UP = $FE ; Scroll screen upwards DEFC SD_DWN = $FF ; Scroll screen downwards lston z88dk-1.8.ds1/lib/stdio_fp.asm0000644000175000017500000000032207130401716015557 0ustar tygrystygrys ; stdio control block - included into _crt0.asm ; when ANSIstdio is defined defw 0 ;stdin defb 19 defb 0 defw 0 ;stdout defb 21 defb 0 defw 0 ;stderr defb 21 defb 0 defs 7*4 ;remaining 7 streams z88dk-1.8.ds1/lib/svi_crt0.asm0000644000175000017500000000642310640546530015515 0ustar tygrystygrys; Spectravideo SVI CRT0 stub ; ; Stefano Bodrato - Apr. 2001 ; ; $Id: svi_crt0.asm,v 1.6 2007/06/27 20:49:28 dom Exp $ ; MODULE svi_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ; No matter what set up we have, main is always, always external to ; this file XREF _main ; ; Some variables which are needed for both app and basic startup ; XDEF cleanup XDEF l_dcal ; Integer rnd seed XDEF _std_seed ; vprintf is internal to this file so we only ever include one of the set ; of routines XDEF _vfprintf ;Exit variables XDEF exitsp XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks ;For stdin, stdout, stder XDEF __sgoioblk ; Now, getting to the real stuff now! org 34816 .start ld hl,0 add hl,sp ld (start1+1),hl ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call $53 ; Hide function key menu call _main .cleanup ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF .start1 ld sp,0 ret .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;Seed for integer rand() routines .defltdsk defb 0 ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; mem stuff defm "Small C+ MSX" defb 0 ;All the float stuff is kept in a different file...for ease of altering! ;It will eventually be integrated into the library ; ;Here we have a minor (minor!) problem, we've no idea if we need the ;float package if this is separated from main (we had this problem before ;but it wasn't critical..so, now we will have to read in a file from ;the directory (this will be produced by zcc) which tells us if we need ;the floatpackage, and if so what it is..kludgey, but it might just work! ; ;Brainwave time! The zcc_opt file could actually be written by the ;compiler as it goes through the modules, appending as necessary - this ;way we only include the package if we *really* need it! IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/svi_crt0.opt0000644000175000017500000000003207265042673015535 0ustar tygrystygrys INCLUDE "#svi_crt0.asm" z88dk-1.8.ds1/lib/syspar.def0000644000175000017500000001145407455120417015265 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989 DEFC OS_Nq = $66 ; enquire (fetch) parameter DEFC OS_Sp = $69 ; specify (set) parameter ; Enquiries, read by OS_Nq: ; DEFC NQ_Wbox = $8300 ; return window information DEFC NQ_Wcur = $8303 ; return cursor information DEFC NQ_Rds = $8306 ; read text from screen DEFC NQ_Ain = $8600 ; application enquiry DEFC NQ_Khn = $8603 ; read keyboard handle DEFC NQ_Shn = $8606 ; read screen handle DEFC NQ_Phn = $8609 ; read printer indirected handle DEFC NQ_Nhn = $860C ; read null handle DEFC NQ_Wai = $860F ; Who am I? DEFC NQ_Com = $8612 ; read comms handle DEFC NQ_Ihn = $8615 ; read IN handle DEFC NQ_Ohn = $8618 ; read OUT handle DEFC NQ_Rhn = $861B ; read direct printer handle DEFC NQ_Mfs = $8900 ; read free space information DEFC NQ_Slt = $8903 ; read slot type information DEFC NQ_Dev = $8C00 ; fetch current device DEFC NQ_Dir = $8C03 ; fetch current directory DEFC NQ_Fnm = $8C06 ; fetch current filename match string DEFC NQ_Dmh = $8C09 ; fetch Director special memory handle DEFC NQ_Inp = $8C0C ; read std. input handle DEFC NQ_Out = $8C0F ; read std. output handle DEFC NQ_Prt = $8C12 ; read printer stream handle DEFC NQ_Tin = $8C15 ; read input-T handle DEFC NQ_Tot = $8C18 ; read output-T handle DEFC NQ_Tpr = $8C1B ; read printer-T stream handle DEFC NQ_Chn = $8C1E ; read comms handle ; Specifies, set by OS_Sp: ; Panel definitions (serial port parameters, timeout, defaults, etc.) : ; DEFC PA_Gfi = $8000 ; Install changed settings DEFC PA_Mct = $8001 ; Timeout in minutes DEFC PA_Rep = $8002 ; Repeat rate DEFC PA_Kcl = $8003 ; Keyclick 'Y' or 'N' DEFC PA_Snd = $8004 ; Sound 'Y' or 'N' DEFC PA_Bad = $8005 ; Default bad process size in K DEFC PA_Iov = $8010 ; Insert/Overtype 'I' or 'O' DEFC PA_Dat = $8011 ; Date format 'E' or 'A' DEFC PA_Map = $8012 ; PipeDream map 'Y' or 'N' DEFC PA_Msz = $8013 ; Map size in pixels DEFC PA_Dir = $8014 ; Default directory DEFC PA_Dev = $8015 ; Default device DEFC PA_Txb = $8016 ; Transmit baud rate - binary DEFC PA_Rxb = $8017 ; Receive baud rate - binary DEFC PA_Xon = $8018 ; Xon/Xoff 'Y' or 'N' DEFC PA_Par = $8019 ; Parity 'O', 'E', 'M', 'S' or 'N' ; PrinterED definitions (highlights $ translation tables) : DEFC PA_Ptr = $8020 ; Printer name DEFC PA_Alf = $8021 ; Allow Linefeed, 'Y' or 'N' DEFC PA_Pon = $8022 ; Printer On sequense DEFC PA_Pof = $8023 ; Printer Off sequense DEFC PA_Eop = $8024 ; End of page sequense DEFC PA_Mip = $8025 ; HMI prefix sequense DEFC PA_Mis = $8026 ; HMI suffix sequense DEFC PA_Mio = $8027 ; HMI offset sequense ; The format of each highlight sequense is as follows: ; PA_On Highlight ON sequense ; PA_On+1 Highlight OFF sequense ; PA_On+2 OFF at CR 'Y' or 'N' ; PA_On+3 Highlight n special character DEFC PA_On1 = $8028 ; Underline DEFC PA_On2 = $802C ; Bold DEFC PA_On3 = $8030 ; Extended sequense DEFC PA_On4 = $8034 ; Italics DEFC PA_On5 = $8038 ; Subscript DEFC PA_On6 = $803C ; Superscript DEFC PA_On7 = $8040 ; Alternate font DEFC PA_On8 = $8044 ; User Defined ; The format of each translation code sequense is as follows: ; PA_Tr Translate from character ; PA_Tr+1 Translate to sequense DEFC PA_Tr1 = $8048 ; Row 1, Entry A DEFC PA_Tr2 = $804A ; B DEFC PA_Tr3 = $804C ; C DEFC PA_Tr4 = $804E ; Row 2, Entry A DEFC PA_Tr5 = $8050 ; B DEFC PA_Tr6 = $8052 ; C DEFC PA_Tr7 = $8054 ; Row 3, Entry A DEFC PA_Tr8 = $8056 ; B DEFC PA_Tr9 = $8058 ; C ; ISO translations 1 - 28: DEFC PA_Tr10 = $8080 ; Row 1, Entry 1 (ISO 1) DEFC PA_Tr11 = $8082 ; 2 (ISO 2) DEFC PA_Tr12 = $8084 ; 3 (ISO 3) DEFC PA_Tr13 = $8086 ; 4 ... DEFC PA_Tr14 = $8088 ; 5 DEFC PA_Tr15 = $808A ; 6 DEFC PA_Tr16 = $808C ; 7 DEFC PA_Tr17 = $808E ; Row 2, Entry 1 DEFC PA_Tr18 = $8090 ; 2 DEFC PA_Tr19 = $8092 ; 3 DEFC PA_Tr20 = $8094 ; 4 DEFC PA_Tr21 = $8096 ; 5 DEFC PA_Tr22 = $8098 ; 6 DEFC PA_Tr23 = $809A ; 7 DEFC PA_Tr24 = $809C ; Row 3, Entry 1 DEFC PA_Tr25 = $809E ; 2 DEFC PA_Tr26 = $80A0 ; 3 DEFC PA_Tr27 = $80A2 ; 4 DEFC PA_Tr28 = $80A4 ; 5 DEFC PA_Tr29 = $80A6 ; 6 DEFC PA_Tr30 = $80A8 ; 7 DEFC PA_Tr31 = $80AA ; Row 4, Entry 1 DEFC PA_Tr32 = $80AC ; 2 DEFC PA_Tr33 = $80AE ; 3 DEFC PA_Tr34 = $80B0 ; 4 DEFC PA_Tr35 = $80B2 ; 5 ... DEFC PA_Tr36 = $80B4 ; 6 ... DEFC PA_Tr37 = $80B6 ; 7 (ISO 28) ; File system parameters: DEFC SP_Dev = $8C00 ; Set current device DEFC SP_Dir = $8C03 ; Set current directory DEFC SP_Fnm = $8C06 ; Set current name match lston z88dk-1.8.ds1/lib/test_cmds.def0000644000175000017500000000012310702233416015711 0ustar tygrystygryslstoff defc CMD_EXIT = 0 defc CMD_PRINTCHAR = 1 defc CMD_READKEY = 2 lston z88dk-1.8.ds1/lib/test_crt0.asm0000644000175000017500000000710410702216056015664 0ustar tygrystygrys; ; Startup for test emulator ; ; $Id: test_crt0.asm,v 1.1 2007/10/07 17:49:34 dom Exp $ module test_crt0 org 0x0000 INCLUDE "#test_cmds.def" ;-------- ; Include zcc_opt.def to find out some info ;-------- INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ;stdio info block if (ASMPC<>$0000) defs CODE_ALIGNMENT_ERROR endif jp program defs $0008-ASMPC if (ASMPC<>$0008) defs CODE_ALIGNMENT_ERROR endif jp restart08 defs $0010-ASMPC if (ASMPC<>$0010) defs CODE_ALIGNMENT_ERROR endif jp restart10 defs $0018-ASMPC if (ASMPC<>$0018) defs CODE_ALIGNMENT_ERROR endif jp restart18 defs $0020-ASMPC if (ASMPC<>$0020) defs CODE_ALIGNMENT_ERROR endif jp restart20 defs $0028-ASMPC if (ASMPC<>$0028) defs CODE_ALIGNMENT_ERROR endif jp restart28 defs $0030-ASMPC if (ASMPC<>$0030) defs CODE_ALIGNMENT_ERROR endif jp restart30 defs $0038-ASMPC if (ASMPC<>$0038) defs CODE_ALIGNMENT_ERROR endif ; IM1 interrupt routine ei ret .restart08 ; a = command to execute defb $ED, $FE ;trap ret ; Restart routines, nothing sorted yet .restart10 .restart18 .restart20 .restart28 .restart30 ret .program ld sp,65535 ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp ei call _main .cleanup ld a,CMD_EXIT ;exit rst 8 .l_dcal jp (hl) ;Used for function pointer calls ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------- ; Now some variables ;----------- .coords defw 0 ; Current graphics xy coordinates .base_graphics defw 0 ; Address of the Graphics map IF !DEFINED_HAVESEED XDEF _std_seed ;Integer rand() seed ._std_seed defw 0 ; Seed for integer rand() routines ENDIF .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks defm "Small C+ TEST" ;Unnecessary file signature defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/test_crt0.opt0000644000175000017500000000003310702216056015700 0ustar tygrystygrys INCLUDE "#test_crt0.asm" z88dk-1.8.ds1/lib/Ti82.def0000644000175000017500000000517207455120417014472 0ustar tygrystygrys;------------------------------- ; Some DEFC's needed by the code ;------------------------------- ;ASH stuff (we don't use ASH...) defc OS_VER = $8D5D ; defc OS_BITS = $8D5E ; defc OS82_VER = $8D5F ; ;ASH ROM_CALL(*) stuff ;TX_CHARPUT = $0000 ;D_LT_STR = $0001 ;M_CHARPUT = $0002 ;D_ZM_STR = $0003 ;SCROLL_UP = $0006 ;TR_CHARPUT = $0007 ;CLEARLCD = $0008 ;D_HL_DECI = $0009 ;CLEARTEXT = $000A ;D_ZT_STR = $000B ;BUSY_OFF = $000C ;BUSY_ON = $000D ;_GETKEY = $000E ;_GRBUFCPY_V = $000F defc _Chkfindsym = $442A ; defc KEY_0 = $8000 ; defc KEY_1 = $8001 ; defc KEY_2 = $8002 ; defc KEY_STAT = $8004 ; defc LAST_KEY = $8006 ; defc CONTRAST = $8008 ; defc CURSOR_POS = $800C ; defc CURSOR_ROW = $800C ; defc CURSOR_COL = $800D ; defc BUSY_COUNTER = $8026 ; defc BUSY_BITMAP = $8027 ; defc OP1 = $8028 ; defc OP2 = $8033 ; defc OP3 = $803E ; defc OP4 = $8049 ; defc OP5 = $8054 ; defc OP6 = $805F ; defc TEXT_MEM = $808F ; defc GRAF_CURS = $8215 ; defc CURSOR_X = $8215 ; defc CURSOR_Y = $8216 ; defc TEXT_MEM2 = $8BDF ; defc WIN_START = $8C8F ; defc WIN_END = $8C90 ; defc CRASH_VER = $8D73 ; defc VAT_START = $FE6E ; defc APD_FREE = $8D70 ; defc INT_STATE = $8D72 ; defc EXIT_2_TIOS = $8D88 ; defc RAND = $8D8B ; defc CP_HL_BC = $8D8E ; defc CR_KHAND = $8D91 ; defc CR_GRBCopy = $8D94 ; defc LD_HL_MHL = $0033 ; defc CP_HL_DE = $0095 ; defc UNPACK_HL = $00A1 ; defc DIV_HL_A = $00A3 ; defc KEY_READ = $01B8 ; defc STORE_KEY = $01C7 ; defc GET_KEY = $01D4 ; defc DISP_DELAY = $07F3 ; defc FIND_PIXEL = $4166 ; defc PROGRAM_ADDR = $8D5B ; defc TR_CHARPUT = $3738 ; defc TX_CHARPUT = $39D2 ; defc D_ZT_STR = $38FA ; defc D_LT_STR = $373E ; defc D_HL_DECI = $387C ; defc LAST_LINE = $3774 ; defc NEXT_LINE = $377A ; defc SCROLL_UP = $3786 ; defc UP_TEXT = $37F2 ; defc M_CHARPUT = $37CE ; defc D_ZM_STR = $37D4 ; defc D_LM_STR = $37DA ; defc CLEARLCD = $389A ; defc CLEARTEXT_W = $37B0 ; defc CLEARTEXT_F = $37A4 ; defc CLEAR_DISP = $38CA ; defc BACKUP_DISP = $39C6 ; defc RESTOR_DISP = $38DC ; defc _GRBUFCPY_V = $38AC ; defc _GETKEY = $3924 ; defc STACK = $FFFF ; defc START_ADDR = $9104 ; Ti82 org-adress, same for ASH and CrASH defc GRAPH_MEM = $88B8 ; 768 bytes - $88B8 / $8BB8 defc APD_BUF = $8228 ; 768 bytes - $8228 / $8528 defc _IY_TABLE = $8528 ; N/A - Where IY usually points z88dk-1.8.ds1/lib/ti82_crt0.asm0000644000175000017500000000650410640546530015502 0ustar tygrystygrys; Stub for the TI 82 calculator ; ; Stefano Bodrato - Dec 2000 ; ; $Id: ti82_crt0.asm,v 1.19 2007/06/27 20:49:28 dom Exp $ ; ;----------------------------------------------------- ; Some general XDEFs and XREFs needed by the assembler ;----------------------------------------------------- MODULE Ti82_crt0 XREF _main ; No matter what set up we have, main is ; always, always external to this file. XDEF cleanup ; used by exit() XDEF l_dcal ; used by calculated calls = "call (hl)" XDEF _std_seed ; Integer rnd seed XDEF _vfprintf ; vprintf is internal to this file so we ; only ever include one of the set of ; routines XDEF exitsp ; Exit variables XDEF exitcount ; XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ; For stdin, stdout, stder XDEF base_graphics ; Graphics stuff XDEF coords ; XDEF cpygraph ; TI calc specific stuff XDEF tidi ; XDEF tiei ; ;------------------------- ; Begin of (shell) headers ;------------------------- INCLUDE "#Ti82.def" ; ROM / RAM adresses on Ti82 INCLUDE "zcc_opt.def" ; Receive all compiler-defines ;OS82Head: ; defb $FE,$82,$0F ; ;AshHead: ; defb $D9,$00,$20 ; ;CrASHhead: ; defb $D5,$00,$11 ;------------------- ;1 - CrASH (default) ;------------------- org START_ADDR-3 DEFB $D5,$00,$11 ; org START_ADDR DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ; Termination zero ;------------------------------------- ; End of header, begin of startup part ;------------------------------------- .start ld hl,0 add hl,sp ld (start1+1),hl IF !DEFINED_atexit ; Less stack use ld hl,-6 ; 3 pointers (more likely value) add hl,sp ld sp,hl ld (exitsp),sp ELSE ld hl,-64 ; 32 pointers (ANSI standard) add hl,sp ld sp,hl ld (exitsp),sp ENDIF LIB fputc_cons ld hl,12 push hl call fputc_cons pop hl IF DEFINED_GRAYlib INCLUDE "#gray82.asm" ELSE INCLUDE "#intwrap82.asm" ENDIF im 2 call _main .cleanup ; exit() jumps to this point .start1 ld sp,0 ; writeback ld iy,_IY_TABLE ; Restore flag-pointer im 1 .tiei ei IF DEFINED_GRAYlib .cpygraph ; little opt :) ENDIF .tidi ret ;---------------------------------------- ; End of startup part, routines following ;---------------------------------------- .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND .__sgoioblk INCLUDE "#stdio_fp.asm" ENDIF ; Now, which of the vfprintf routines do we need? IF !DEFINED_nostreams IF DEFINED_ANSIstdio IF DEFINED_floatstdio ._vfprintf LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio ._vfprintf LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio ._vfprintf LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ENDIF ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ;Heap stuff (already needed?) .heaplast defw 0 .heapblocks defw 0 ;mem stuff .base_graphics defw GRAPH_MEM .coords defw 0 IF !DEFINED_GRAYlib defc cpygraph = CR_GRBCopy ; CrASH FastCopy ENDIF IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/ti82_crt0.opt0000644000175000017500000000003307224335500015510 0ustar tygrystygrys INCLUDE "#ti82_crt0.asm" z88dk-1.8.ds1/lib/Ti83.def0000644000175000017500000003451507455120417014476 0ustar tygrystygrys;------------------------------- ; Some DEFC's needed by the code ;------------------------------- ;defc statvars = $858F ; 531 bytes free $858F / $87A2 defc plotSScreen = $8E29 ; 768 bytes free (normal screen buffer) defc saveSScreen = $8265 ; 768 bytes free (APD buffer) $8265 / $8566 defc _IY_TABLE = $8567 ; Where IY usually points ;#Define Invoke(xxxx) CALL xxxx ;#Define JMP(xxxx) JP xxxx ; Syntax Enhancers DEFC UserMem_Offset = $8565 DEFC NewProg = $448A DEFC _IO_EXEC = $51EF DEFC InsertMem = $4432 ; Amount In HL, Position In DE DEFC DeleteMem = $44B2 ; Amount In DE, Position In HL DEFC PushErx = $46A5 ;PushErr EQU $2C21 ; Place To Jump To In HL ;PopErr EQU $2C51 DEFC PopErx = $46A9 ; Gets Rid Of Error Routine ;#Define OnError(xxxx) LD HL, xxxx \ CALL PushErr ;#Define OffError CALL PopErr ; Syntax Enhancers DEFC _GetCsc = $4014 DEFC MemFree = $441A ; Returned In HL DEFC _CreatePic = $4482 DEFC Entry = $9327 DEFC _CLRLCDFULL = $4755 DEFC _clrScrnFull = $475D DEFC _CLRTXTSHD = $4765 DEFC _dispDone = $47F1 DEFC _dispHL = $4709 DEFC _DISPOP1A = $51D4 DEFC _eraseEOL = $476D DEFC _formDCplx = $4D2E DEFC _formReal = $4D32 DEFC _GDISPTOKEN = $4B20 DEFC _homeUp = $4775 DEFC _lcd_busy = $4066 DEFC _moveup = $474D DEFC _newline = $473D DEFC _outputExpr = $5106 DEFC _putc = $4705 DEFC _putmap = $4701 DEFC _putps = $4715 DEFC _puts = $470D DEFC _runIndicOff = $4795 DEFC _runIndicOn = $4791 DEFC _scrollDown = $4751 DEFC _scrollUp = $4745 DEFC _setPenT = $51B9 DEFC _setPenX = $51A7 DEFC _setPenY = $51B0 DEFC _SFONT_LEN = $4A6C DEFC _VPUTBLANK = $4C53 DEFC _vputmap = $477D DEFC _vputs = $4781 DEFC _vputsn = $4785 DEFC _Axes = $519E DEFC _CLine = $4A84 DEFC _CPointS = $4B00 DEFC ClearPlots = $515B DEFC BufCopy = $5164 DEFC _HORIZCMD = $4BEF DEFC _ILINE = $4AE4 DEFC _IPOINT = $4AE8 DEFC _moveDown = $4741 DEFC _PDspGrph = $4BEB DEFC _PUTXY = $4BE4 DEFC _REGRAPH = $4BCC DEFC _VERTCMD = $4BF3 DEFC _GetK = $4A18 DEFC _getkey = $4CFE DEFC _ADRLELE = $489D DEFC _GETLTOOP1 = $48A9 DEFC _PUTTOL = $48BD DEFC _ADRMELE = $486D DEFC _GETMTOOP1 = $487D DEFC _PUTTOMAT = $4889 DEFC _ACOS = $4122 DEFC _ACOSH = $413A DEFC _ANGLE = $4152 DEFC _ASIN = $412A DEFC _ASINH = $4136 DEFC _ATAN = $4126 DEFC _ATANH = $4132 DEFC _Ceiling = $4BE0 DEFC _COS = $40FA DEFC _COSH = $410A DEFC _CUBE = $409E DEFC _DTOR = $4096 DEFC _ETOX = $40EA DEFC _FACTORIAL = $50C6 DEFC _FPADD = $4092 DEFC _FPDIV = $40C6 DEFC _FPMULT = $40AA DEFC _FPRECIP = $40C2 DEFC _FPSQUARE = $40A6 DEFC _FPSUB = $408E DEFC _FRAC = $40BE DEFC _INT = $40D6 DEFC _INTGR = $4076 DEFC _INVOP1SC = $40B2 DEFC _INVSUB = $407E DEFC _LNX = $40DE DEFC _LOGX = $40E2 DEFC _MAX = $406E DEFC _MIN = $406A DEFC _MINUS1 = $408A DEFC _PLUS1 = $4086 DEFC _PTOR = $413E DEFC _RANDOM = $50B6 DEFC _RNDGUARD = $40CE DEFC _ROUND = $40DA DEFC _RTOD = $409A DEFC _RTOP = $4142 DEFC _SIN = $40F6 DEFC _SINH = $410E DEFC _SQROOT = $40CA DEFC _STORAND = $50BA DEFC _TAN = $40FE DEFC _TANH = $4106 DEFC _TENX = $40EE DEFC _TIMES2 = $4082 DEFC _TIMESPT5 = $40A2 DEFC _TRUNC = $407A DEFC _XROOTY = $4A8C DEFC _YTOX = $4A90 DEFC _CHKFINDSYM = $442A DEFC _DELVAR = $44AA DEFC _RCLSYSTOK = $4EF0 DEFC _RCLVARSYM = $4EEC DEFC _RCLX = $4EE8 DEFC _RCLY = $4EE0 DEFC _RSTRSHADOW = $47A1 DEFC _SAVESHADOW = $479D DEFC _STOOTHER = $4ED8 DEFC _STOSYSTOK = $4EB8 DEFC _STOX = $4ED4 DEFC _STOY = $4EC8 DEFC _CKINT = $4322 DEFC _CKODD = $4326 DEFC _CKOP1FP0 = $4312 DEFC _CKOP1POS = $435A DEFC _CKOP1REAL = $414E DEFC _CKOP2FP0 = $4316 DEFC _CKOP2POS = $4356 DEFC _CKOP2REAL = $4412 DEFC _CKPOSINT = $431E DEFC _CLROP1S = $4362 DEFC _CLROP2S = $435E DEFC _CONVOP1 = $4EFC DEFC _cphlde = $4004 DEFC _CPOP1OP2 = $4166 DEFC _divHLbyA = $400C DEFC _HTIMESL = $4382 DEFC _INVOP1S = $40B6 DEFC _INVOP2S = $40BA DEFC _ldHLind = $4000 DEFC _MOVFROP1 = $4212 DEFC _OP1EXOP2 = $4306 DEFC _OP1EXOP3 = $42FE DEFC _OP1EXOP4 = $4302 DEFC _OP1EXOP5 = $42EE DEFC _OP1EXOP6 = $42F2 DEFC _OP1SET0 = $4286 DEFC _OP1SET1 = $4232 DEFC _OP1SET2 = $4242 DEFC _OP1SET3 = $423A DEFC _OP1SET4 = $4236 DEFC _OP1TOOP2 = $418E DEFC _OP1TOOP3 = $417E DEFC _OP1TOOP4 = $416E DEFC _OP1TOOP5 = $41BE DEFC _OP1TOOP6 = $41BA DEFC _OP2EXOP4 = $42F6 DEFC _OP2EXOP5 = $42FA DEFC _OP2EXOP6 = $42E6 DEFC _OP2SET0 = $4282 DEFC _OP2SET1 = $4252 DEFC _OP2SET2 = $4246 DEFC _OP2SET3 = $422E DEFC _OP2SET4 = $422A DEFC _OP2SET5 = $4222 DEFC _OP2SET60 = $4EA8 DEFC _OP2SET8 = $421E DEFC _OP2SETA = $4226 DEFC _OP2TOOP1 = $41C2 DEFC _OP2TOOP3 = $41F6 DEFC _OP2TOOP4 = $4172 DEFC _OP2TOOP5 = $41B2 DEFC _OP2TOOP6 = $41B6 DEFC _OP3SET0 = $427E DEFC _OP3SET1 = $421A DEFC _OP3SET2 = $423E DEFC _OP3TOOP1 = $41A2 DEFC _OP3TOOP2 = $417A DEFC _OP3TOOP4 = $416A DEFC _OP3TOOP5 = $41AE DEFC _OP4SET0 = $427A DEFC _OP4SET1 = $4216 DEFC _OP4TOOP1 = $419A DEFC _OP4TOOP2 = $4176 DEFC _OP4TOOP3 = $41FA DEFC _OP4TOOP5 = $41AA DEFC _OP4TOOP6 = $4202 DEFC _OP5EXOP6 = $42EA DEFC _OP5SET0 = $4276 DEFC _OP5TOOP1 = $419E DEFC _OP5TOOP2 = $4182 DEFC _OP5TOOP3 = $41FE DEFC _OP5TOOP4 = $418A DEFC _OP5TOOP6 = $4186 DEFC _OP6TOOP1 = $4196 DEFC _OP6TOOP2 = $4192 DEFC _OP6TOOP5 = $41A6 DEFC _PUSHREALO1 = $4536 DEFC _SETXXOP1 = $4A74 DEFC _SETXXOP2 = $4A78 DEFC _SETXXXXOP2 = $4A7C DEFC _ZEROOOP1 = $428E ; ; OP1 TO OP6 RAM EQUATES ; DEFC OP2 = $8044 DEFC op2exp = $8045 DEFC op2m = $8046 DEFC OP1M = $803B DEFC OP1 = $8039 DEFC OP3 = $804F DEFC OP3EXP = $8050 DEFC OP3EXT = $8058 DEFC OP3M = $8051 DEFC OP4 = $805A DEFC OP4EXP = $805B DEFC OP4EXT = $8063 DEFC OP4M = $805C DEFC OP5 = $8065 DEFC OP5EXP = $8066 DEFC OP5EXT = $806E DEFC OP5M = $8067 DEFC OP6 = $8070 DEFC OP6EXP = $8071 DEFC OP6EXT = $8079 DEFC OP6M = $8072 ; ; POINTERS ; DEFC IMATHPTR1 = $8094 DEFC IMATHPTR2 = $8096 DEFC IMATHPTR3 = $8098 DEFC IMATHPTR4 = $809A DEFC IMATHPTR5 = $809C ; ; POIONTER TO START OF PROGRAM/LIST SYMBOL ENTRIES ; DEFC PROGPTR = $9319 ; ; ADDRESS OF LCD DRIVER INSTRUCTION PORT ; DEFC LCDINSTPORT = $10 ; ; SCREEN SHADOWS ; DEFC TEXTSHADOW = $80C9 DEFC CMDSHADOW = $9157 ; ; GRAPH BACKUP BUFFER ; DEFC PLOTSCREEN = $8E29 ; ; SAFE RAM LOCATIONS ; DEFC SAVESCREEN = $8265 DEFC STATVARS = $858F ; ; START OF SYMBOL TABLE ; DEFC SYMTABLE = $FE6E ; ; RAM EQUATES DEALING WITH DISPLAY ROUTINES ; DEFC CURROW = $800C DEFC CURCOL = $800D DEFC PENCOL = $8252 DEFC PENROW = $8253 DEFC CURGY = $886D DEFC CURGX = $886E ; ; INDIRECT CALL BYTE ; DEFC ASM_IND_CALL = $80C8 ; ; LINK PORT WRITE EQUATES ; DEFC D0LD1L = $D3 DEFC D0LD1H = $D1 DEFC D0HD1L = $D2 DEFC D0HD1H = $D0 DEFC BPORT = 0 ; ; SYSTEM EQUATES ; ALL OF THESE FLAGS CAN BE ACCESSED THROUGH THE 'IY' REGISTER ; DEFC trigflags = 0 ; IY OFFSET VALUE DEFC trigdeg = 2 ; DEFC plotflags = 2 ; IY OFFSET VALUE DEFC plotloc = 1 DEFC plotdisp = 2 ; DEFC grfmodeflags = 2 ; IY OFFSET VALUE DEFC grffuncm = 4 DEFC grfpolarm = 5 DEFC grfparamm = 6 DEFC grfrecurm = 7 ; DEFC graphflags = 3 ; IY OFFSET VALUE DEFC graphdraw = 0 DEFC graphcursor = 2 ; DEFC grfdbflags = 4 ; IY OFFSET VALUE DEFC grfdot = 0 DEFC grfsimul = 1 DEFC grfgrid = 2 DEFC grfpolar = 3 DEFC grfnocoord = 4 DEFC grfnoaxis = 5 DEFC grflabel = 6 ; DEFC textflags = 5 ; IY OFFSET VALUE DEFC textEraseBelow = 1 DEFC textScrolled = 2 DEFC textInverse = 3 ; DEFC onflags = 9 ; IY OFFSET VALUE DEFC onRunning = 3 DEFC onInterrupt = 4 ; DEFC statflags = 9 ; IY OFFSET VALUE DEFC statsvalid = 6 ; DEFC fmtflags = 10 ; IY OFFSET VALUE DEFC fmtExponent = 0 DEFC fmtEng = 1 ; DEFC nummode = 10 ; IY OFFSET VALUE DEFC FMTREAL = 5 DEFC FMTRECT = 6 DEFC FMTPOLAR = 7 ; DEFC curflags = 12 ; IY OFFSET VALUE DEFC curAble = 2 DEFC curOn = 3 DEFC curLock = 4 ; DEFC appflags = 13 ; IY OFFSET VALUE DEFC appTextSave = 1 DEFC appAutoScroll = 2 ; DEFC PLOTFLAG2 = 17 ; IY OFFSET VALUE DEFC EXPR_PARAM = 3 DEFC EXPR_WRITING = 4 ; DEFC indicflags = 18 ; IY OFFSET VALUE DEFC indicRun = 0 DEFC indicOnly = 2 ; DEFC shiftflags = 18 ; IY OFFSET VALUE DEFC shift2nd = 3 DEFC shiftAlpha = 4 DEFC shiftALock = 6 ; DEFC tblflags = 19 ; IY OFFSET VALUE DEFC AutoFill = 4 DEFC AutoCalc = 5 ; DEFC sgrflags = 20 ; IY OFFSET VALUE DEFC grfSplit = 0 DEFC VertSplit = 1 DEFC WRITE_ON_GRAPH = 4 DEFC textwrite = 7 ; DEFC asm_flag1 = 33 ; IY OFFSET VALUE DEFC asm_flag1_0 = 0 DEFC asm_flag1_1 = 1 DEFC asm_flag1_2 = 2 DEFC asm_flag1_3 = 3 DEFC asm_flag1_4 = 4 DEFC asm_flag1_5 = 5 DEFC asm_flag1_6 = 6 DEFC asm_flag1_7 = 7 ; DEFC asm_flag2 = 34 ; IY OFFSET VALUE DEFC asm_flag2_0 = 0 DEFC asm_flag2_1 = 1 DEFC asm_flag2_2 = 2 DEFC asm_flag2_3 = 3 DEFC asm_flag2_4 = 4 DEFC asm_flag2_5 = 5 DEFC asm_flag2_6 = 6 DEFC asm_flag2_7 = 7 ; DEFC asm_flag3 = 35 ; IY OFFSET VALUE DEFC asm_flag3_0 = 0 DEFC asm_flag3_1 = 1 DEFC asm_flag3_2 = 2 DEFC asm_flag3_3 = 3 DEFC asm_flag3_4 = 4 DEFC asm_flag3_5 = 5 DEFC asm_flag3_6 = 6 DEFC asm_flag3_7 = 7 ; ; SYSTEM VAR EQUATES, FOR STORING AND RECALLING THEM ; DEFC XSCLt = 2 ; XSCALE DEFC YSCLt = 3 ; YSCALE Define XMINt $0A ; XMIN Define XMAXt $0B ; XMAX Define YMINt $0C ; YMIN Define YMAXt $0D ; XMAX Define TMINt $0E ; TMIN Define TMAXt $0F ; TMAX Define THETMINt $10 ; THETA MIN Define THETMAXt $11 ; THETA MAX Define TBLMINt $1A ; TABLE MIN Define PLOTSTARTt $1B ; PLOT START Define NMAXt $1D ; NMAX Define nmint $1F ; NMIN Define TBLSTEPt $21 ; TABLE STEP Define TSTEPt $22 ; T STEP Define THETSTEPt $23 ; THETA STEP Define DELTAXt $26 ; DELTA X Define DELTAYt $27 ; DELTA Y Define XFACTt $28 ; X ZOOM FACTOR Define YFACTt $29 ; Y ZOOM FACTOR Define FINnT $2B ; TVM n Define FINiT $2C ; TVM i Define FINpvT $2D ; TVM pv Define FINpmtT $2E ; TVM pmt Define FINfvT $2F ; TVM fv Define FINpyT $30 ; TVM p/y Define FINcyT $31 ; TVM c/y Define PLOTSTEPT $34 ; PLOT STEP Define XREST $36 ; X RES ; ; CHARACTER FONT EQUATES ; DEFC LSEQ_N = $01 DEFC LSEQ_U = $02 DEFC LSEQ_V = $03 DEFC LSEQ_W = $04 DEFC Lconvert = $05 DEFC LsqUp = $06 DEFC LsqDown = $07 DEFC Lintegral = $08 DEFC Lcross = $09 DEFC LBOXICON = $0A DEFC LCROSSICON = $0B DEFC LDOTICON = $0C Define LsubT $0D ; small capital T for parametric mode. Define LcubeR $0E ;slightly different 3 for cubed root. DEFC LhexF = $0F DEFC Lroot = $10 DEFC Linverse = $11 DEFC Lsquare = $12 DEFC Langle = $13 DEFC Ldegree = $14 DEFC Lradian = $15 DEFC Ltranspose = $16 DEFC LLE = $17 DEFC LNE = $18 DEFC LGE = $19 DEFC Lneg = $1A DEFC Lexponent = $1B DEFC Lstore = $1C DEFC Lten = $1D DEFC LupArrow = $1E DEFC LdownArrow = $1F DEFC Lspace = $20 DEFC Lexclam = $21 DEFC Lquote = $22 DEFC Lpound = $23 DEFC LFOURTH = $24 DEFC Lpercent = $25 DEFC Lampersand = $26 DEFC Lapostrophe = $27 DEFC LlParen = $28 DEFC LrParen = $29 DEFC Lasterisk = $2A DEFC LplusSign = $2B DEFC Lcomma = $2C DEFC Ldash = $2D DEFC Lperiod = $2E DEFC Lslash = $2F DEFC L0 = $30 DEFC L1 = $31 DEFC L2 = $32 DEFC L3 = $33 DEFC L4 = $34 DEFC L5 = $35 DEFC L6 = $36 DEFC L7 = $37 DEFC L8 = $38 DEFC L9 = $39 DEFC Lcolon = $3A DEFC Lsemicolon = $3B DEFC LLT = $3C DEFC LEQ = $3D DEFC LGT = $3E DEFC Lquestion = $3F DEFC LatSign = $40 DEFC LcapA = $41 DEFC LcapB = $42 DEFC LcapC = $43 DEFC LcapD = $44 DEFC LcapE = $45 DEFC LcapF = $46 DEFC LcapG = $47 DEFC LcapH = $48 DEFC LcapI = $49 DEFC LcapJ = $4A DEFC LcapK = $4B DEFC LcapL = $4C DEFC LcapM = $4D DEFC LcapN = $4E DEFC LcapO = $4F DEFC LcapP = $50 DEFC LcapQ = $51 DEFC LcapR = $52 DEFC LcapS = $53 DEFC LcapT = $54 DEFC LcapU = $55 DEFC LcapV = $56 DEFC LcapW = $57 DEFC LcapX = $58 DEFC LcapY = $59 DEFC LcapZ = $5A DEFC Ltheta = $5B DEFC Lbackslash = $5C DEFC LrBrack = $5D DEFC Lcaret = $5E DEFC Lunderscore = $5F DEFC Lbackquote = $60 DEFC La = $61 DEFC Lb = $62 DEFC Lc = $63 DEFC Ld = $64 DEFC Le = $65 DEFC Lf = $66 DEFC Lg = $67 DEFC Lh = $68 DEFC Li = $69 DEFC Lj = $6A DEFC Lk = $6B DEFC Ll = $6C DEFC Lm = $6D DEFC Ln = $6E DEFC Lo = $6F DEFC Lp = $70 DEFC Lq = $71 DEFC Lr = $72 DEFC Ls = $73 DEFC Lt = $74 DEFC Lu = $75 DEFC Lv = $76 DEFC Lw = $77 DEFC Lx = $78 DEFC Ly = $79 DEFC Lz = $7A DEFC LlBrace = $7B DEFC Lbar = $7C DEFC LrBrace = $7D DEFC Ltilde = $7E DEFC LinvEQ = $7F DEFC Lsub0 = $80 DEFC Lsub1 = $81 DEFC Lsub2 = $82 DEFC Lsub3 = $83 DEFC Lsub4 = $84 DEFC Lsub5 = $85 DEFC Lsub6 = $86 DEFC Lsub7 = $87 DEFC Lsub8 = $88 DEFC Lsub9 = $89 DEFC LcapAAcute = $8A DEFC LcapAGrave = $8B DEFC LcapACaret = $8C DEFC LcapADier = $8D DEFC LaAcute = $8E DEFC LaGrave = $8F DEFC LaCaret = $90 DEFC LaDier = $91 DEFC LcapEAcute = $92 DEFC LcapEGrave = $93 DEFC LcapECaret = $94 DEFC LcapEDier = $95 DEFC LeAcute = $96 DEFC LeGrave = $97 DEFC LeCaret = $98 DEFC LeDier = $99 DEFC LcapIAcute = $9A DEFC LcapIGrave = $9B DEFC LcapICaret = $9C DEFC LcapIDier = $9D DEFC LiAcute = $9E DEFC LiGrave = $9F DEFC LiCaret = $A0 DEFC LiDier = $A1 DEFC LcapOAcute = $A2 DEFC LcapOGrave = $A3 DEFC LcapOCaret = $A4 DEFC LcapODier = $A5 DEFC LoAcute = $A6 DEFC LoGrave = $A7 DEFC LoCaret = $A8 DEFC LoDier = $A9 DEFC LcapUAcute = $AA DEFC LcapUGrave = $AB DEFC LcapUCaret = $AC DEFC LcapUDier = $AD DEFC LuAcute = $AE DEFC LuGrave = $AF DEFC LuCaret = $B0 DEFC LuDier = $B1 DEFC LcapCCed = $B2 DEFC LcCed = $B3 DEFC LcapNTilde = $B4 DEFC LnTilde = $B5 DEFC Laccent = $B6 DEFC Lgrave = $B7 DEFC Ldieresis = $B8 DEFC LquesDown = $B9 DEFC LexclamDown = $BA DEFC Lalpha = $BB DEFC Lbeta = $BC DEFC Lgamma = $BD DEFC LcapDelta = $BE DEFC Ldelta = $BF DEFC Lepsilon = $C0 DEFC LlBrack = $C1 DEFC Llambda = $C2 DEFC Lmu = $C3 DEFC Lpi = $C4 DEFC Lrho = $C5 DEFC LcapSigma = $C6 DEFC Lsigma = $C7 DEFC Ltau = $C8 DEFC Lphi = $C9 DEFC LcapOmega = $CA DEFC LxMean = $CB DEFC LyMean = $CC DEFC LsupX = $CD DEFC Lellipsis = $CE DEFC Lleft = $CF DEFC Lblock = $D0 DEFC Lper = $D1 DEFC Lhyphen = $D2 DEFC Larea = $D3 DEFC Ltemp = $D4 DEFC Lcube = $D5 DEFC Lenter = $D6 DEFC LimagI = $D7 DEFC Lphat = $D8 DEFC Lchi = $D9 DEFC LstatF = $DA DEFC Llne = $DB DEFC LlistL = $DC DEFC LfinanN = $DD z88dk-1.8.ds1/lib/ti83_crt0.asm0000644000175000017500000002250410640546530015501 0ustar tygrystygrys; Stub for the TI 83 calculator ; ; Stefano Bodrato - Dec 2000 ; Henk Poley - Apr 2001 Fixed and add some things ; ; $Id: ti83_crt0.asm,v 1.20 2007/06/27 20:49:28 dom Exp $ ; ; startup = ; n - Primary shell(s); compatible shell(s) ; (Primary shell merely means it's the smallest implementation ; for that shell, that uses full capabilities of the shell) ; ; 1 - Ion; Ti-Explorer (default) ; 2 - Venus; ; 3 - ZES; ; 4 - Anova; SOS ; 5 - Ti-Explorer, AShell; SOS, Anova (same as 6) ; 6 - AShell, Ti-Explorer; SOS, Anova (same as 5) ; 7 - SOS; Anova ; 8 - Venus Explorer; Venus ; 9 - Ion, Ti-Explorer; ZASMLOAD, plain TIOS ; 10 - Plain TIOS, ZASMLOAD ; ;----------------------------------------------------- ; Some general XDEFs and XREFs needed by the assembler ;----------------------------------------------------- MODULE Ti83_crt0 XREF _main ; No matter what set up we have, main is ; always, always external to this file. XDEF cleanup ; used by exit() XDEF l_dcal ; used by calculated calls = "call (hl)" XDEF _std_seed ; Integer rnd seed XDEF _vfprintf ; vprintf is internal to this file so we ; only ever include one of the set of ; routines XDEF exitsp ; Exit variables XDEF exitcount ; XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ; For stdin, stdout, stder XDEF base_graphics ; Graphics stuff XDEF coords ; XDEF cpygraph ; TI calc specific stuff XDEF tidi ; XDEF tiei ; ;------------------------- ; Begin of (shell) headers ;------------------------- LSTOFF ; Don't list these (huge) files INCLUDE "#Ti83.def" ; ROM / RAM adresses on Ti83 INCLUDE "zcc_opt.def" ; Receive all compiler-defines LSTON ; List again ;---------------------------------- ; 2-Venus and 8-Venus Explorer (VE) ;---------------------------------- IF (startup=2) | (startup=8) DEFINE Venus DEFINE NOT_DEFAULT_SHELL ; else we would use Ion org $932C defm "9_[?" ; send(9prgm0 (where 0 is theta) IF (startup=2) ; 2-Venus defb $0,$1,$1 ; No description nor icon ELSE ; 8-Venus Explorer DEFINE V_Explorer defb $1 defb enddesc-description+1 ; lengthOfDescription+1 .description DEFINE NEED_name ; The next time we'll include zcc_opt.def ; it will have the programs namestring. ; Usage in C file: ; #pragma string name xxxx INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name ; If no namestring provided, display full compiler ident defm "Z88DK Small C+ Program" ENDIF .enddesc defb endicon-icon+1 ; heightOfIcon+1 .icon DEFINE NEED_icon INCLUDE "zcc_opt.def" ; Get icon from zcc_opt.def UNDEFINE NEED_icon IF !DEFINED_NEED_icon defb @00000000 ; Icon (max. heightOfIcon = 7 bytes) defb @00110010 ; C with a small '+' defb @01000111 defb @01000010 defb @01000000 defb @00110000 defb @00000000 ENDIF .endicon .externals ENDIF IF DEFINED_GRAYlib defb $1 ; numberOfExternals+1 (maximum = 11d) ELSE ; No graylib, so we use FastCopy defc vnFastCopy = $FE6F defb $2 ; numberOfExternals+1 (maximum = 11d) defb $5 ; We use the FastCopy-lib defm "~FCPY" ; defb $ff ; ENDIF ENDIF ;------ ; 3-ZES ;------ IF (startup=3) DEFINE ZES DEFINE NOT_DEFAULT_SHELL org $931E defm "9_ZES" ; Send(9prgmZES defb $3F,$D5,$3F ; :Return ENDIF ;-------- ; 4-Anova ;-------- IF (startup=4) DEFINE Anova DEFINE NOT_DEFAULT_SHELL org Entry xor a ; One byte instruction, meaningless jr start ; Relative jump defw 0 ; pointer to libs, 0 if no libs used defw description ; pointer to a description defw icon ; pointer to an 8x5 icon .description DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 .icon DEFINE NEED_icon INCLUDE "zcc_opt.def" UNDEFINE NEED_icon IF !DEFINED_NEED_icon defb @00110010 ; icon (5 bytes, Anova icon) defb @01000111 ; C with a small '+' defb @01000010 defb @01000000 ; Bigger icons don't give problems defb @00110000 ; They are only truncated to 5 bytes ENDIF ENDIF ;------------------------------- ; 5,6 - Ti-Explorer, AShell, SOS ;------------------------------- IF (startup=5) | (startup=6) DEFINE Ti_Explorer DEFINE NOT_DEFAULT_SHELL org Entry nop ; makes it compatible with AShell jr start defw 0 ; pointer to libs, 0 if no libs used defw description ; pointer to a description defw icon ; pointer to an 8x8 icon.description .description DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 .icon DEFINE NEED_icon INCLUDE "zcc_opt.def" UNDEFINE NEED_icon IF !DEFINED_NEED_icon defb @00000000 ; 8x8 icon defb @00110010 ; C with a small '+' defb @01000111 defb @01000010 defb @01000000 defb @00110000 defb @00000000 ; Bigger icons don't give problems defb @00000000 ; They are only truncated to 8 bytes ENDIF ENDIF ;--------- ; 7 - SOS ;--------- IF (startup=7) DEFINE SOS DEFINE NOT_DEFAULT_SHELL org Entry ccf ; Makes program invisible to AShell jr start defw 0 ; pointer to libs, 0 if no libs used defw description ; pointer to a description .description DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ENDIF ;--------------------------- ; 9-Ion, ZASMLOAD compatible ;--------------------------- IF (startup=9) DEFINE ZASMLOAD DEFINE NOT_DEFAULT_SHELL org Entry xor a ; We don't use the Ionlibs jr nc,start ; Ion identifier DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ENDIF ;---------------------------------------------------------- ; 10-No shell, send(9 or ZASMLOAD version (NOT recommended) ;---------------------------------------------------------- ; ; for send(9 version, create .83p file with bin2var2.exe ; for ZASMLOAD version, create .83p file with bin2var.exe IF (startup=10) DEFINE ZASMLOAD DEFINE NOT_DEFAULT_SHELL org Entry ENDIF ;---------------- ; 1-Ion (default) ;---------------- IF !NOT_DEFAULT_SHELL DEFINE Ion org Entry IF DEFINED_GRAYlib xor a ; We don't use the Ionlibs (doesn't matter) ELSE ret ; We use the Ionlibs (doesn't matter) ENDIF jr nc,start ; Ion identifier .description DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ENDIF ;------------------------------------- ; End of header, begin of startup part ;------------------------------------- .start IF ZASMLOAD call _runindicoff ; stop anoing run-indicator ENDIF ld hl,0 ; Store current StackPointer add hl,sp ld (start1+1),hl IF !DEFINED_atexit ; Less stack use ld hl,-6 ; 3 pointers (more likely value) add hl,sp ld sp,hl ld (exitsp),sp ELSE ld hl,-64 ; 32 pointers (ANSI standard) add hl,sp ld sp,hl ld (exitsp),sp ENDIF LIB fputc_cons ld hl,12 push hl call fputc_cons pop hl IF ZASMLOAD IF NONANSI call _CLRTXTSHD ; Clear textbuffer call _homeup ; Set cursor to (0,0) ENDIF call _clrScrnFull ; Clear plotSScreen and LCD ENDIF IF DEFINED_GRAYlib INCLUDE "#gray83.asm" ELSE INCLUDE "#intwrap83.asm" ENDIF im 2 call _main .cleanup ; exit() jumps to this point .start1 ld sp,0 ; writeback ld iy,_IY_TABLE ; Restore flag-pointer IF !(Ion | SOS | Ti_Explorer | V_Explorer | Anova) IF NONANSI call _CLRTXTSHD ; Clear textbuffer call _homeup ; Set cursor to (0,0) ENDIF call _clrScrnFull ; Clear plotSScreen and LCD res oninterrupt,(iy+onflags) ; Reset [On]-flag (stops "ERR:Break") ENDIF im 1 .tiei ei IF DEFINED_GRAYlib .cpygraph ENDIF .tidi ret ;---------------------------------------- ; End of startup part, routines following ;---------------------------------------- defc l_dcal = $52E8 ; jp (hl) IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND .__sgoioblk INCLUDE "#stdio_fp.asm" ENDIF ; Now, which of the vfprintf routines do we need? IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND IF DEFINED_floatstdio ._vfprintf LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio ._vfprintf LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio ._vfprintf LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; mem stuff .base_graphics defw plotSScreen .coords defw 0 IF !DEFINED_GRAYlib IF Ion DEFINE Do_Not_Include_FastCopy defc cpygraph = $9157+80+15 ; ionFastCopy call ENDIF IF Venus DEFINE Do_Not_Include_FastCopy defc cpygraph = vnFastCopy ENDIF IF !Do_Not_Include_FastCopy .cpygraph ;(ion)FastCopy from Joe Wingbermuehle di ld a,$80 ; 7 out ($10),a ; 11 ld hl,plotSScreen-12-(-(12*64)+1) ; 10 ld a,$20 ; 7 ld c,a ; 4 inc hl ; 6 waste dec hl ; 6 waste fastCopyAgain: ld b,64 ; 7 inc c ; 4 ld de,-(12*64)+1 ; 10 out ($10),a ; 11 add hl,de ; 11 ld de,10 ; 10 fastCopyLoop: add hl,de ; 11 inc hl ; 6 waste inc hl ; 6 waste inc de ; 6 ld a,(hl) ; 7 out ($11),a ; 11 dec de ; 6 djnz fastCopyLoop ; 13/8 ld a,c ; 4 cp $2B+1 ; 7 jr nz,fastCopyAgain ; 10/1 ret ; 10 ENDIF ENDIF IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/ti83_crt0.opt0000644000175000017500000000003307224335500015511 0ustar tygrystygrys INCLUDE "#ti83_crt0.asm" z88dk-1.8.ds1/lib/Ti83p.def0000644000175000017500000034263607455120417014664 0ustar tygrystygrys;------------------------------- ; Some DEFC's needed by the code ;------------------------------- ; Ti83+ Silver Edition: defc SetExSpeed = $50BF ; BCALL entry to switch 6<->15MHz on Ti83+SE ;All Ti83+: ;defc statvars = $8A3A ; 531 bytes free $8A3A / $8C4D defc plotSScreen = $9340 ; 768 bytes free (normal screen buffer) ;defc appBackUpScreen = $9872 ; 768 bytes free (free space for apps) ;defc saveSScreen = $86EC ; 768 bytes free (APD buffer) defc _IY_TABLE = $89F0 ; ;TSE dfines defc krnlbase = $9872 defc _tseKrnlVer = krnlbase + 2 defc _tseChkProg = krnlbase + 5 defc _tseExitShell = krnlbase + 8 defc _tseSwitchTask = krnlbase + 11 defc _tseStartTask = krnlbase + 14 defc _tseEndTask = krnlbase + 17 defc _tseForceYield = krnlbase + 20 defc libsbase = $8A3A defc _tseLibsVer = libsbase + 0 defc _tseRandom = libsbase + 3 defc _tseSprite = libsbase + 6 defc _tseLargeSprite = libsbase + 9 defc _tseGetPixel = libsbase + 12 defc _tseDecompress = libsbase + 15 defc _tseFastcopy = libsbase + 18 defc _tseFindVar = libsbase + 21 ;defc ionRandom = _tseRandom ;defc ionPutSprite = _tseSprite ;defc ionLargeSprite = _tseLargeSprite ;defc ionGetPixel = _tseGetPixel ;defc ionFastCopy = _tseFastCopy ;defc ionDecompress = _tseDecompress ;defc ionDetect = $8508 ; Kernel Memory Structure defc pptr_code = $8C4C - 2 defc pptr_preserve = pptr_code - 2 defc progsize = pptr_preserve - 2 defc sysstack = progsize - 2 defc sysflags = sysstack - 60 defc cprogram = sysflags - 9 defc fptr_varsize = cprogram - 2 defc fptr_prgtitle = fptr_varsize - 2 defc fptr_memreq = fptr_prgtitle - 2 defc fptr_end = fptr_memreq - 2 ;====================================================================== ; Include File for the TI-83 Plus ; Last Updated 10/27/1999 ; ; Copyright (c) 1999 Texas Instruments: The Licensed Materials are ; copyrighted by TI. LICENSEE agrees that it will ; not delete the copyright notice, trademarks or ; protective notices from any copy made by LICENSEE. ; ; Warranty: TI does not warrant that the Licensed Materials will ; be free from errors or will meet your specific requirements. ; The Licensed Materials are made available "AS IS" to LICENSEE. ; ; Limitations: TI MAKES NO WARRANTY OR CONDITION, EITHER EXPRESS ; OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ; REGARDING THE LICENSED MATERIALS. IN NO EVENT SHALL ; TI OR ITS SUPPLIERS BE LIABLE FOR ANY INDIRECT, INCIDENTAL ; OR CONSEQUENTIAL DAMAGES, LOSS OF PROFITS, LOSS OF USE OR DATA, ; OR INTERRUPTION OF BUSINESS, WHETHER THE ALLEGED DAMAGES ARE ; LABELED IN TORT, CONTRACT OR INDEMNITY. ; ; DEFC Entry = $9D95 - $02 ; Syntax Enhancers ;====================================================================== ; System Variable Equates ;====================================================================== ; Entry Points : RclSysTok, StoSysTok ; DEFC XSCLt = 2 DEFC YSCLt = 3 DEFC XMINt = $0A DEFC XMAXt = $0B DEFC YMINt = $0C DEFC YMAXt = $0D DEFC TMINt = $0E DEFC TMAXt = $0F DEFC THETMINt = $10 DEFC THETMAXt = $11 DEFC TBLMINt = $1A DEFC PLOTSTARTt = $1B DEFC NMAXt = $1D DEFC NMINt = $1F DEFC TBLSTEPt = $21 DEFC TSTEPt = $22 DEFC THETSTEPt = $23 DEFC DELTAXt = $26 DEFC DELTAYt = $27 DEFC XFACTt = $28 DEFC YFACTt = $29 DEFC FINNt = $2B DEFC FINIt = $2C DEFC FINPVt = $2D DEFC FINPMTt = $2E DEFC FINFVt = $2F DEFC FINPYt = $30 DEFC FINCYt = $31 DEFC PLOTSTEPt = $34 DEFC XRESt = $36 ; ;====================================================================== ; Run indicators ;====================================================================== ; DEFC busyPause = @10101010 DEFC busyNormal = @11110000 ; ;====================================================================== ; Common subroutine RST numbers ;====================================================================== ; DEFC rOP1TOOP2 = $08 DEFC rFINDSYM = $10 DEFC rPUSHREALO1 = $18 DEFC rMOV9TOOP1 = $20 DEFC rFPADD = $30 ; ;SYMBOLIC_DEBUG_START ;====================================================================== ; Entry points ;====================================================================== ; DEFC _HomeUp = $4558 DEFC _AbsO1O2Cp = $410E DEFC _AbsO1PAbsO2 = $405A DEFC _ACos = $40DE DEFC _ACosH = $40F0 DEFC _ACosRad = $40D2 DEFC _AdrLEle = $462D DEFC _AdrMEle = $4609 DEFC _AdrMRow = $4606 DEFC _AllEq = $4876 DEFC _AllocFPS = $43A5 DEFC _AllocFPS1 = $43A8 DEFC _Angle = $4102 DEFC _AnsName = $4B52 DEFC _ApdSetup = $4C93 DEFC _AppGetCalc = $4C78 DEFC _AppGetCbl = $4C75 DEFC _Arc_Unarc = $4FD8 DEFC _ASin = $40E4 DEFC _ASinH = $40ED DEFC _ASinRad = $40DB DEFC _ATan = $40E1 DEFC _ATan2 = $40E7 DEFC _ATan2Rad = $40D8 DEFC _ATanH = $40EA DEFC _ATanRad = $40D5 DEFC _BinOPExec = $4663 DEFC _Bit_VertSplit = $4FA8 DEFC _BufClr = $5074 DEFC _BufCpy = $5071 DEFC _CAbs = $4E97 DEFC _CAdd = $4E88 DEFC _CanAlphIns = $4C69 DEFC _CDiv = $4E94 DEFC _CDivByReal = $4EBB DEFC _CEtoX = $4EA9 DEFC _CFrac = $4EC1 DEFC _CheckSplitFlag = $49F0 DEFC _ChkFindSym = $42F1 DEFC _CIntgr = $4EC4 DEFC _CircCmd = $47D4 DEFC _CkInt = $4234 DEFC _CkOdd = $4237 DEFC _CkOP1C0 = $4225 DEFC _CkOP1Cplx = $40FC DEFC _CkOP1FP0 = $4228 DEFC _CkOP1Pos = $4258 DEFC _CkOP1Real = $40FF DEFC _CkOP2FP0 = $422B DEFC _CkOP2Pos = $4255 DEFC _CkOP2Real = $42DF DEFC _CkPosInt = $4231 DEFC _CkValidNum = $4270 DEFC _CleanAll = $4A50 DEFC _ClearRect = $4D5C DEFC _ClearRow = $4CED DEFC _CLine = $4798 DEFC _CLineS = $479B DEFC _CLN = $4EA0 DEFC _CLog = $4EA3 DEFC _CloseEditBufNoR = $476E DEFC _CloseProg = $4A35 DEFC _ClrGraphRef = $4A38 DEFC _ClrLCD = $4543 DEFC _ClrLCDFull = $4540 DEFC _ClrLp = $41D1 DEFC _ClrOP1S = $425E DEFC _ClrOP2S = $425B DEFC _ClrScrn = $4549 DEFC _ClrScrnFull = $4546 DEFC _ClrTxtShd = $454C DEFC _CMltByReal = $4EB8 DEFC _CmpSyms = $4A4A DEFC _CMult = $4E8E DEFC _Conj = $4EB5 DEFC _ConvDim = $4B43 DEFC _ConvDim00 = $4B46 DEFC _ConvLcToLr = $4A23 DEFC _ConvLrToLc = $4A56 DEFC _ConvOP1 = $4AEF DEFC _COP1Set0 = $4105 DEFC _Cos = $40C0 DEFC _CosH = $40CC DEFC _CpHLDE = $400C DEFC _CPoint = $4DC8 DEFC _CPointS = $47F5 DEFC _CpOP1OP2 = $4111 DEFC _CpOP4OP3 = $4108 DEFC _CpyO1ToFPS1 = $445C DEFC _CpyO1ToFPS2 = $446B DEFC _CpyO1ToFPS3 = $4477 DEFC _CpyO1ToFPS4 = $4489 DEFC _CpyO1ToFPS5 = $4483 DEFC _CpyO1ToFPS6 = $447D DEFC _CpyO1ToFPS7 = $4480 DEFC _CpyO1ToFPST = $444A DEFC _CpyO2ToFPS1 = $4459 DEFC _CpyO2ToFPS2 = $4462 DEFC _CpyO2ToFPS3 = $4474 DEFC _CpyO2ToFPS4 = $4486 DEFC _CpyO2ToFPST = $4444 DEFC _CpyO3ToFPS1 = $4453 DEFC _CpyO3ToFPS2 = $4465 DEFC _CpyO3ToFPST = $4441 DEFC _CpyO5ToFPS1 = $4456 DEFC _CpyO5ToFPS3 = $4471 DEFC _CpyO6ToFPS2 = $4468 DEFC _CpyO6ToFPST = $4447 DEFC _CpyStack = $4429 DEFC _CpyTo1FPS1 = $4432 DEFC _CpyTo1FPS10 = $43F3 DEFC _CpyTo1FPS11 = $43D8 DEFC _CpyTo1FPS2 = $443B DEFC _CpyTo1FPS3 = $4408 DEFC _CpyTo1FPS4 = $440E DEFC _CpyTo1FPS5 = $43DE DEFC _CpyTo1FPS6 = $43E4 DEFC _CpyTo1FPS7 = $43EA DEFC _CpyTo1FPS8 = $43ED DEFC _CpyTo1FPS9 = $43F6 DEFC _CpyTo1FPST = $4423 DEFC _CpyTo2FPS1 = $442F DEFC _CpyTo2FPS2 = $4438 DEFC _CpyTo2FPS3 = $4402 DEFC _CpyTo2FPS4 = $43F9 DEFC _CpyTo2FPS5 = $43DB DEFC _CpyTo2FPS6 = $43E1 DEFC _CpyTo2FPS7 = $43E7 DEFC _CpyTo2FPS8 = $43F0 DEFC _CpyTo2FPST = $4420 DEFC _CpyTo3FPS1 = $442C DEFC _CpyTo3FPS2 = $4411 DEFC _CpyTo3FPST = $441D DEFC _CpyTo4FPST = $441A DEFC _CpyTo5FPST = $4414 DEFC _CpyTo6FPS2 = $43FF DEFC _CpyTo6FPS3 = $43FC DEFC _CpyTo6FPST = $4417 DEFC _CpyToFPS1 = $445F DEFC _CpyToFPS2 = $446E DEFC _CpyToFPS3 = $447A DEFC _CpyToFPST = $444D DEFC _CpyToStack = $4450 DEFC _Create0Equ = $432A DEFC _CreateAppVar = $4E6A DEFC _CreateCList = $431B DEFC _CreateCplx = $430C DEFC _CreateEqu = $4330 DEFC _CreatePair = $4B0D DEFC _CreatePict = $4333 DEFC _CreateProg = $4339 DEFC _CreateProtProg = $4E6D DEFC NewProg = $4E6D DEFC _CreateReal = $430F DEFC _CreateRList = $4315 DEFC _CreateRMat = $4321 DEFC _CreateStrng = $4327 DEFC _CRecip = $4E91 DEFC _CSqRoot = $4E9D DEFC _CSquare = $4E8B DEFC _CSub = $4E85 DEFC _CTenX = $4EA6 DEFC _CTrunc = $4EBE DEFC _Cube = $407B DEFC _CursorOff = $45BE DEFC _CursorOn = $45C4 DEFC _CXrootY = $4EAC DEFC _CYtoX = $4EB2 DEFC _DarkLine = $47DD DEFC _DarkPnt = $47F2 DEFC _DataSize = $436C DEFC _DataSizeA = $4369 DEFC _DeallocFPS = $439F DEFC _DeallocFPS1 = $43A2 DEFC _DecO1Exp = $4267 DEFC _DelListEl = $4A2F DEFC DeleteMem = $4357 DEFC _DelRes = $4A20 DEFC _DelVar = $4351 DEFC _DelVarArc = $4FC6 DEFC _DelVarNoArc = $4FC9 DEFC _DisableApd = $4C84 DEFC _Disp = $4F45 DEFC _DispDone = $45B5 DEFC _DispEOL = $45A6 DEFC _DispHL = $4507 DEFC _DisplayImage = $4D9B DEFC _DispOP1A = $4BF7 DEFC _DivHLBy10 = $400F DEFC _DivHLByA = $4012 DEFC _DrawCirc2 = $4C66 DEFC _DrawCmd = $48C1 DEFC _DrawRectBorder = $4D7D DEFC _DrawRectBorderClear = $4D8C DEFC _DToR = $4075 DEFC _EditProg = $4A32 DEFC _EnableApd = $4C87 DEFC _EnoughMem = $42FD DEFC _EOP1NotReal = $4279 DEFC _Equ_or_NewEqu = $42C4 DEFC _EraseEOL = $4552 DEFC _EraseRectBorder = $4D86 DEFC _ErrArgument = $44AD DEFC _ErrBadGuess = $44CB DEFC _ErrBreak = $44BF DEFC _ErrD_OP1_0 = $42D3 DEFC _ErrD_OP1_LE_0 = $42D0 DEFC _ErrD_OP1Not_R = $42CA DEFC _ErrD_OP1NotPos = $42C7 DEFC _ErrD_OP1NotPosInt = $42CD DEFC _ErrDataType = $44AA DEFC _ErrDimension = $44B3 DEFC _ErrDimMismatch = $44B0 DEFC _ErrDivBy0 = $4498 DEFC _ErrDomain = $449E DEFC _ErrIncrement = $44A1 DEFC _ErrInvalid = $44BC DEFC _ErrIterations = $44C8 DEFC _ErrLinkXmit = $44D4 DEFC _ErrMemory = $44B9 DEFC _ErrNon_Real = $44A4 DEFC _ErrNonReal = $4A8C DEFC _ErrNotEnoughMem = $448C DEFC _ErrOverflow = $4495 DEFC _ErrSignChange = $44C5 DEFC _ErrSingularMat = $449B DEFC _ErrStat = $44C2 DEFC _ErrStatPlot = $44D1 DEFC _ErrSyntax = $44A7 DEFC _ErrTolTooSmall = $44CE DEFC _ErrUndefined = $44B6 DEFC _EToX = $40B4 DEFC _Exch9 = $43D5 DEFC _ExLp = $4222 DEFC _ExpToHex = $424F DEFC _Factorial = $4B85 DEFC _FillRect = $4D62 DEFC _FillRectPattern = $4D89 DEFC _Find_Parse_Formula = $4AF2 DEFC _FindAlphaDn = $4A47 DEFC _FindAlphaUp = $4A44 DEFC _FindApp = $4C4E DEFC _FindAppDn = $4C4B DEFC _FindAppNumPages = $509B DEFC _FindAppUp = $4C48 DEFC _FindSym = $42F4 DEFC _FiveExec = $467E DEFC _FixTempCnt = $4A3B DEFC _FlashToRam = $5017 DEFC _ForceFullScreen = $508F DEFC _FormBase = $50AA DEFC _FormDCplx = $4996 DEFC _FormEReal = $4990 DEFC _FormReal = $4999 DEFC _FourExec = $467B DEFC _FPAdd = $4072 DEFC _FPDiv = $4099 DEFC _FPMult = $4084 DEFC _FPRecip = $4096 DEFC _FPSquare = $4081 DEFC _FPSub = $406F DEFC _Frac = $4093 DEFC _GetBaseVer = $4C6F DEFC _GetCSC = $4018 DEFC _GetKey = $4972 DEFC _GetLToOP1 = $4636 DEFC _GetMToOP1 = $4615 DEFC _GetTokLen = $4591 DEFC _GrBufClr = $4BD0 DEFC ClearPlots = _GrBufClr DEFC _GrBufCpy = $486A DEFC _GrphCirc = $47D7 DEFC _HLTimes9 = $40F9 DEFC _HorizCmd = $48A6 DEFC _HTimesL = $4276 DEFC _IBounds = $4C60 DEFC _IBoundsFull = $4D98 DEFC _ILine = $47E0 DEFC _IncLstSize = $4A29 DEFC _InsertList = $4A2C DEFC InsertMem = $42F7 DEFC _Int = $40A5 DEFC _Intgr = $405D DEFC _InvCmd = $48C7 DEFC _InvertRect = $4D5F DEFC _InvOP1S = $408D DEFC _InvOP1SC = $408A DEFC _InvOP2S = $4090 DEFC _InvSub = $4063 DEFC _IOffset = $4C63 DEFC _IPoint = $47E3 DEFC _JError = $44D7 DEFC _JErrorNo = $4000 DEFC _JForceCmdNoChar = $4027 DEFC _JForceGraphKey = $5005 DEFC _JForceGraphNoKey = $5002 DEFC _KeyToString = $45CA DEFC _LineCmd = $48AC DEFC _LnX = $40AB DEFC _Load_SFont = $4783 DEFC _LoadCIndPaged = $501D DEFC _LoadDEIndPaged = $501A DEFC _LoadPattern = $4CB1 DEFC _LogX = $40AE DEFC _Max = $4057 DEFC MemFree = $42E5 DEFC _MemClear = $4C30 DEFC _MemSet = $4C33 DEFC _Min = $4054 DEFC _Minus1 = $406C DEFC _Mov10B = $415C DEFC _Mov18B = $47DA DEFC _Mov7B = $4168 DEFC _Mov8B = $4165 DEFC _Mov9B = $415F DEFC _Mov9OP1OP2 = $417D DEFC _Mov9OP2Cp = $410B DEFC _Mov9ToOP1 = $417A DEFC _Mov9ToOP2 = $4180 DEFC _MovFrOP1 = $4183 DEFC _OneVar = $4BA3 DEFC _OP1ExOP2 = $421F DEFC _OP1ExOP3 = $4219 DEFC _OP1ExOP4 = $421C DEFC _OP1ExOP5 = $420D DEFC _OP1ExOP6 = $4210 DEFC _OP1ExpToDec = $4252 DEFC _OP1Set0 = $41BF DEFC _OP1Set1 = $419B DEFC _OP1Set2 = $41A7 DEFC _OP1Set3 = $41A1 DEFC _OP1Set4 = $419E DEFC _OP1ToOP2 = $412F DEFC _OP1ToOP3 = $4123 DEFC _OP1ToOP4 = $4117 DEFC _OP1ToOP5 = $4153 DEFC _OP1ToOP6 = $4150 DEFC _OP2ExOP4 = $4213 DEFC _OP2ExOP5 = $4216 DEFC _OP2ExOP6 = $4207 DEFC _OP2Set0 = $41BC DEFC _OP2Set1 = $41AD DEFC _OP2Set2 = $41AA DEFC _OP2Set3 = $4198 DEFC _OP2Set4 = $4195 DEFC _OP2Set5 = $418F DEFC _OP2Set60 = $4AB0 DEFC _OP2Set8 = $418C DEFC _OP2SetA = $4192 DEFC _OP2ToOP1 = $4156 DEFC _OP2ToOP3 = $416E DEFC _OP2ToOP4 = $411A DEFC _OP2ToOP5 = $414A DEFC _OP2ToOP6 = $414D DEFC _OP3Set0 = $41B9 DEFC _OP3Set1 = $4189 DEFC _OP3Set2 = $41A4 DEFC _OP3ToOP1 = $413E DEFC _OP3ToOP2 = $4120 DEFC _OP3ToOP4 = $4114 DEFC _OP3ToOP5 = $4147 DEFC _OP4Set0 = $41B6 DEFC _OP4Set1 = $4186 DEFC _OP4ToOP1 = $4138 DEFC _OP4ToOP2 = $411D DEFC _OP4ToOP3 = $4171 DEFC _OP4ToOP5 = $4144 DEFC _OP4ToOP6 = $4177 DEFC _OP5ExOP6 = $420A DEFC _OP5Set0 = $41B3 DEFC _OP5ToOP1 = $413B DEFC _OP5ToOP2 = $4126 DEFC _OP5ToOP3 = $4174 DEFC _OP5ToOP4 = $412C DEFC _OP5ToOP6 = $4129 DEFC _OP6ToOP1 = $4135 DEFC _OP6ToOP2 = $4132 DEFC _OP6ToOP5 = $4141 DEFC _OutputExpr = $4BB2 DEFC _PagedGet = $5023 DEFC _ParseInp = $4A9B DEFC _PDspGrph = $48A3 DEFC _PixelTest = $48B5 DEFC _Plus1 = $4069 DEFC _PointCmd = $48B2 DEFC _PointOn = $4C39 DEFC _PopOP1 = $437E DEFC _PopOP3 = $437B DEFC _PopOP5 = $4378 DEFC _PopReal = $4393 DEFC _PopRealO1 = $4390 DEFC _PopRealO2 = $438D DEFC _PopRealO3 = $438A DEFC _PopRealO4 = $4387 DEFC _PopRealO5 = $4384 DEFC _PopRealO6 = $4381 DEFC _PosNo0Int = $422E DEFC _PtoR = $40F3 DEFC _PushOP1 = $43C9 DEFC _PushOP3 = $43C3 DEFC _PushOP5 = $43C0 DEFC _PushReal = $43BD DEFC _PushRealO1 = $43BA DEFC _PushRealO2 = $43B7 DEFC _PushRealO3 = $43B4 DEFC _PushRealO4 = $43B1 DEFC _PushRealO5 = $43AE DEFC _PushRealO6 = $43AB DEFC _PutC = $4504 DEFC _PutMap = $4501 DEFC _PutPS = $4510 DEFC _PutS = $450A DEFC _PutTokString = $4960 DEFC _PutToL = $4645 DEFC _PutToMat = $461E DEFC _RandInit = $4B7F DEFC _Random = $4B79 DEFC _Rcl_StatVar = $42DC DEFC _RclAns = $4AD7 DEFC _RclGDB2 = $47D1 DEFC _RclN = $4ADD DEFC _RclSysTok = $4AE6 DEFC _RclVarSym = $4AE3 DEFC _RclX = $4AE0 DEFC _RclY = $4ADA DEFC _Rec1stByte = $4EFA DEFC _Rec1stByteNC = $4EFD DEFC _RecAByteIO = $4F03 DEFC _RedimMat = $4A26 DEFC _Regraph = $488E DEFC _ReloadAppEntryVecs = $4C36 DEFC _RestoreDisp = $4870 DEFC _RName = $427F DEFC _RndGuard = $409F DEFC _RnFx = $40A2 DEFC _Round = $40A8 DEFC _RToD = $4078 DEFC _RToP = $40F6 DEFC _RunIndicOff = $4570 DEFC _RunIndicOn = $456D DEFC _SaveDisp = $4C7B DEFC _SendAByte = $4EE5 DEFC _SetAllPlots = $4FCC DEFC _SetFuncM = $4840 DEFC _SetNorm_Vals = $49FC DEFC _SetParM = $4849 DEFC _SetPolM = $4846 DEFC _SetSeqM = $4843 DEFC _SetTblGraphDraw = $4C00 DEFC _SetupPagedPtr = $5020 DEFC _SetXXOP1 = $478C DEFC _SetXXOP2 = $478F DEFC _SetXXXXOP2 = $4792 DEFC _SFont_Len = $4786 DEFC _Sin = $40BD DEFC _SinCosRad = $40BA DEFC _SinH = $40CF DEFC _SinHCosH = $40C6 DEFC _SqRoot = $409C DEFC _SrchVLstDn = $4F12 DEFC _SrchVLstUp = $4F0F DEFC _SStringLength = $4CB4 DEFC _StMatEl = $4AE9 DEFC _StoAns = $4ABF DEFC _StoGDB2 = $47CE DEFC _StoN = $4ACB DEFC _StoOther = $4AD4 DEFC _StoR = $4AC5 DEFC _StoRand = $4B7C DEFC _StoSysTok = $4ABC DEFC _StoT = $4ACE DEFC _StoTheta = $4AC2 DEFC _StoX = $4AD1 DEFC _StoY = $4AC8 DEFC _StrCopy = $44E3 DEFC _StrLength = $4C3F DEFC _Tan = $40C3 DEFC _TanH = $40C9 DEFC _TanLnF = $48BB DEFC _TenX = $40B7 DEFC _ThetaName = $427C DEFC _ThreeExec = $4675 DEFC _Times2 = $4066 DEFC _TimesPt5 = $407E DEFC _TName = $428E DEFC _ToFrac = $4657 DEFC _Trunc = $4060 DEFC _UCLineS = $4795 DEFC _UnLineCmd = $48AF DEFC _UnOPExec = $4672 DEFC _VertCmd = $48A9 DEFC _VPutMap = $455E DEFC _VPutS = $4561 DEFC _VPutSN = $4564 DEFC _VtoWHLDE = $47FB DEFC _XftoI = $4804 DEFC _Xitof = $47FE DEFC _XName = $4288 DEFC _XRootY = $479E DEFC _YftoI = $4801 DEFC _YName = $428B DEFC _YToX = $47A1 DEFC _Zero16D = $41B0 DEFC _ZeroOP = $41CE DEFC _ZeroOP1 = $41C5 DEFC _ZeroOP2 = $41C8 DEFC _ZeroOP3 = $41CB DEFC _ZmDecml = $484F DEFC _ZmFit = $485B DEFC _ZmInt = $484C DEFC _ZmPrev = $4852 DEFC _ZmSquare = $485E DEFC _ZmStats = $47A4 DEFC _ZmTrig = $4861 DEFC _ZmUsr = $4855 DEFC _ZooDefault = $4867 ; ;====================================================================== ; System-defined RAM Variable Address Equates ;====================================================================== ; DEFC ramStart = $8000 DEFC appData = $8000 DEFC ramCode = $8100 DEFC ramCodeEnd = $822F DEFC baseAppBrTab = $8230 DEFC bootTemp = $8251 DEFC appSearchPage = $82A3 DEFC tempSwapArea = $82A5 DEFC appID = $838D DEFC ramReturnData = $83ED DEFC arcInfo = $83EE DEFC savedArcInfo = $8406 DEFC appInfo = $8432 DEFC appBank_jump = $843C DEFC appPage = $843E DEFC kbdScanCode = $843F DEFC kbdKey = $8444 DEFC kbdGetKy = $8445 DEFC keyExtend = $8446 DEFC contrast = $8447 DEFC apdSubTimer = $8448 DEFC apdTimer = $8449 DEFC curTime = $844A DEFC curRow = $844B DEFC curCol = $844C DEFC curOffset = $844D DEFC curUnder = $844E DEFC curY = $844F DEFC curType = $8450 DEFC curXRow = $8451 DEFC prevDData = $8452 DEFC lFont_record = $845A DEFC sFont_record = $8462 DEFC tokVarPtr = $846A DEFC tokLen = $846C DEFC indicMem = $846E DEFC indicCounter = $8476 DEFC indicBusy = $8477 DEFC OP1 = $8478 DEFC OP1M = $847A DEFC OP2 = $8483 DEFC OP2M = $8485 DEFC OP2EXT = $848C DEFC OP3 = $848E DEFC OP3M = $8490 DEFC OP4 = $8499 DEFC OP4M = $849B DEFC OP5 = $84A4 DEFC OP5M = $84A6 DEFC OP6 = $84AF DEFC OP6M = $84B1 DEFC OP6EXT = $84B8 DEFC progToEdit = $84BF DEFC nameBuff = $84C7 DEFC equ_edit_save = $84D2 DEFC iMathPtr1 = $84D3 DEFC iMathPtr2 = $84D5 DEFC iMathPtr3 = $84D7 DEFC iMathPtr4 = $84D9 DEFC iMathPtr5 = $84DB DEFC chkDelPtr1 = $84DD DEFC chkDelPtr2 = $84DF DEFC insDelPtr = $84E1 DEFC upDownPtr = $84E3 DEFC fOutDat = $84E5 DEFC asm_data_ptr1 = $84EB DEFC asm_data_ptr2 = $84ED DEFC asm_sym_ptr1 = $84EF DEFC asm_sym_ptr2 = $84F1 DEFC asm_ram = $84F3 DEFC asm_ind_call = $8507 DEFC textShadow = $8508 DEFC textShadCur = $8588 DEFC textShadTop = $858A DEFC textShadAlph = $858B DEFC textShadIns = $858C DEFC cxMain = $858D DEFC cxPPutAway = $858F DEFC cxPutAway = $8591 DEFC cxRedisp = $8593 DEFC cxErrorEP = $8595 DEFC cxSizeWind = $8597 DEFC cxPage = $8599 DEFC cxCurApp = $859A DEFC cxPrev = $859B DEFC monQH = $85AA DEFC monQT = $85AB DEFC monQueue = $85AC DEFC onSP = $85BC DEFC promptRow = $85C0 DEFC promptCol = $85C1 DEFC promptIns = $85C2 DEFC promptShift = $85C3 DEFC promptRet = $85C4 DEFC promptValid = $85C6 DEFC promptTop = $85C8 DEFC promptCursor = $85CA DEFC promptTail = $85CC DEFC promptBtm = $85CE DEFC varType = $85D0 DEFC varCurrent = $85D1 DEFC varClass = $85D9 DEFC menuActive = $85DC DEFC menuAppDepth = $85DD DEFC MenuCurrent = $85DE DEFC ProgCurrent = $85E8 DEFC userMenuSA = $85FE DEFC ioPrompt = $865F DEFC dImageWidth = $8660 DEFC ioFlag = $8670 DEFC sndRecState = $8672 DEFC ioErrState = $8673 DEFC header = $8674 DEFC ioData = $867D DEFC ioNewData = $8689 DEFC bakHeader = $868B DEFC penCol = $86D7 DEFC penRow = $86D8 DEFC rclQueue = $86D9 DEFC rclQueueEnd = $86DB DEFC errNo = $86DD DEFC errSP = $86DE DEFC errOffset = $86E0 DEFC saveScreen = $86EC DEFC bstCounter = $89EE DEFC flags = $89F0 DEFC statVars = $8A3A DEFC anovaf_vars = $8C17 DEFC infVars = $8C4D DEFC curGStyle = $8D17 DEFC curGY = $8D18 DEFC curGX = $8D19 DEFC curGY2 = $8D1A DEFC curGX2 = $8D1B DEFC freeSaveY = $8D1C DEFC freeSaveX = $8D1D DEFC XOffset = $8DA1 DEFC YOffset = $8DA2 DEFC lcdTallP = $8DA3 DEFC pixWideP = $8DA4 DEFC pixWide_m_1 = $8DA5 DEFC pixWide_m_2 = $8DA6 DEFC lastEntryPTR = $8DA7 DEFC lastEntryStk = $8DA9 DEFC numLastEntries = $8E29 DEFC currLastEntry = $8E2A DEFC curInc = $8E67 DEFC uXmin = $8E7E DEFC uXmax = $8E87 DEFC uXscl = $8E90 DEFC uYmin = $8E99 DEFC uYmax = $8EA2 DEFC uYscl = $8EAB DEFC uThetMin = $8EB4 DEFC uThetMax = $8EBD DEFC uThetStep = $8EC6 DEFC uTmin = $8ECF DEFC uTmax = $8ED8 DEFC uTStep = $8EE1 DEFC uPlotStart = $8EEA DEFC unMax = $8EF3 DEFC uu0 = $8EFC DEFC uv0 = $8F05 DEFC unMin = $8F0E DEFC uu02 = $8F17 DEFC uv02 = $8F20 DEFC uw0 = $8F29 DEFC uPlotStep = $8F32 DEFC uXres = $8F3B DEFC uw02 = $8F44 DEFC Xmin = $8F50 DEFC Xmax = $8F59 DEFC Xscl = $8F62 DEFC Ymin = $8F6B DEFC Ymax = $8F74 DEFC Yscl = $8F7D DEFC ThetaMin = $8F86 DEFC ThetaMax = $8F8F DEFC ThetaStep = $8F98 DEFC TminPar = $8FA1 DEFC TmaxPar = $8FAA DEFC Tstep = $8FB3 DEFC PlotStart = $8FBC DEFC nMax = $8FC5 DEFC u0 = $8FCE DEFC v0 = $8FD7 DEFC nMin = $8FE0 DEFC u02 = $8FE9 DEFC v02 = $8FF2 DEFC w0 = $8FFB DEFC PlotStep = $9004 DEFC XresO = $900D DEFC w02 = $9016 DEFC un1 = $901F DEFC un2 = $9028 DEFC vn1 = $9031 DEFC vn2 = $903A DEFC wn1 = $9043 DEFC wn2 = $904C DEFC fin_N = $9055 DEFC fin_I = $905E DEFC fin_PV = $9067 DEFC fin_PMT = $9070 DEFC fin_FV = $9079 DEFC fin_PY = $9082 DEFC fin_CY = $908B DEFC cal_N = $9094 DEFC cal_I = $909D DEFC cal_PV = $90A6 DEFC cal_PMT = $90AF DEFC cal_FV = $90B8 DEFC cal_PY = $90C1 DEFC smallEditRAM = $90D3 DEFC XFact = $913F DEFC YFact = $9148 DEFC Xres_int = $9151 DEFC deltaX = $9152 DEFC deltaY = $915B DEFC shortX = $9164 DEFC shortY = $916D DEFC lower = $9176 DEFC upper = $917F DEFC XOutSym = $918C DEFC XOutDat = $918E DEFC YOutSym = $9190 DEFC YOutDat = $9192 DEFC inputSym = $9194 DEFC inputDat = $9196 DEFC prevData = $9198 DEFC TblMin = $92B3 DEFC TblStep = $92BC DEFC plotScreen = $9340 DEFC seed1 = $9640 DEFC seed2 = $9649 DEFC cmdShadow = $966E DEFC cmdShadCur = $96EE DEFC cmdShadAlph = $96F0 DEFC cmdShadIns = $96F1 DEFC cmdCursor = $96F2 DEFC editTop = $96F4 DEFC editCursor = $96F6 DEFC editTail = $96F8 DEFC editBtm = $96FA DEFC editSym = $9706 DEFC editDat = $9708 DEFC winTop = $97A5 DEFC winBtm = $97A6 DEFC winLeftEdge = $97A7 DEFC winLeft = $97A8 DEFC winAbove = $97AA DEFC winRow = $97AC DEFC winCol = $97AE DEFC fmtDigits = $97B0 DEFC fmtString = $97B1 DEFC fmtConv = $97F2 DEFC fmtLeft = $9804 DEFC fmtIndex = $9806 DEFC fmtMatSym = $9808 DEFC fmtMatMem = $980A DEFC EQS = $980C DEFC tSymPtr1 = $9818 DEFC tSymPtr2 = $981A DEFC chkDelPtr3 = $981C DEFC chkDelPtr4 = $981E DEFC tempMem = $9820 DEFC fpBase = $9822 DEFC FPS = $9824 DEFC OPBase = $9826 DEFC OPS = $9828 DEFC pTempCnt = $982A DEFC cleanTmp = $982C DEFC pTemp = $982E DEFC progPtr = $9830 DEFC newDataPtr = $9832 DEFC pagedCount = $9834 DEFC pagedPN = $9835 DEFC pagedGetPtr = $9836 DEFC pagedPutPtr = $9838 DEFC pagedBuf = $983A DEFC appErr1 = $984D DEFC appErr2 = $985A DEFC flashByte1 = $9867 DEFC flashByte2 = $9868 DEFC freeArcBlock = $9869 DEFC arcPage = $986B DEFC arcPtr = $986C DEFC appRawKeyHandle = $9870 DEFC appBackUpScreen = $9872 DEFC customHeight = $9B72 DEFC localLanguage = $9B73 DEFC cursorHookPtr = $9B7C DEFC rawKeyHookPtr = $9B84 DEFC getKeyHookPtr = $9B88 DEFC fontHookPtr = $9B9C DEFC restartClr = $9BD0 DEFC localTokStr = $9D65 DEFC keyForStr = $9D76 DEFC keyToStrRam = $9D77 DEFC sedMonSp = $9D88 DEFC bpSave = $9D8A DEFC userMem = $9D95 DEFC symTable = $FE66 ;SYMBOLIC_DEBUG_END ; ;====================================================================== ; Error handler equates/macros ;====================================================================== ; ;#Define OnError(xxxx) LD HL, xxxx \ CALL APP_PUSH_ERRORH ;#Define OffError CALL APP_POP_ERRORH ; Syntax Enhancers DEFC APP_PUSH_ERRORH = $59 DEFC APP_POP_ERRORH = $5C ; ;====================================================================== ; System and State Flags ;====================================================================== ; DEFC trigFlags = 0 ;Trigonometry mode settings DEFC trigDeg = 2 ; 1=degrees, 0=radians DEFC kbdFlags = 0 ;Keyboard scan DEFC kbdSCR = 3 ; 1=scan code ready DEFC kbdKeyPress = 4 ; 1=key has been pressed DEFC doneFlags = 0 ;display "Done" DEFC donePrgm = 5 ; 1=display "Done" after prgm DEFC ioDelFlag = 0 DEFC inDelete = 0 ;1 = DELETE SCREEN ;---------------------------------------------------------------------- DEFC editFlags = 1 DEFC editOpen = 2 ; 1=edit buffer is open DEFC monFlags = 1 ;monitor flags DEFC monAbandon = 4 ; 1=don't start any long process ; in put away (#715) ;---------------------------------------------------------------------- DEFC plotFlags = 2 ;plot generation flags DEFC plotLoc = 1 ; 0=bkup & display, 1=display only DEFC plotDisp = 2 ; 1=plot is in display, 0=text in display DEFC grfModeFlags = 2 ;graph mode settings DEFC grfFuncM = 4 ; 1=function graph DEFC grfPolarM = 5 ; 1=polar graph DEFC grfParamM = 6 ; 1=parametric graph DEFC grfRecurM = 7 ; 1=RECURSION graph DEFC graphFlags = 3 DEFC graphDraw = 0 ; 0=graph is valid, 1=redraw graph DEFC grfDBFlags = 4 DEFC grfDot = 0 ; 0=line, 1=dot DEFC grfSimul = 1 ; 0=sequential, 1=simultaneous DEFC grfGrid = 2 ; 0=no grid, 1=grid DEFC grfPolar = 3 ; 0=rectangular, 1=polar coordinates DEFC grfNoCoord = 4 ; 0=display coordinates, 1=off DEFC grfNoAxis = 5 ; 0=axis, 1=no axis DEFC grfLabel = 6 ; 0=off, 1=axis label DEFC textFlags = 5 ;Text output flags DEFC textEraseBelow = 1 ; 1=erase line below small char DEFC textScrolled = 2 ; 1=screen scrolled DEFC textInverse = 3 ; 1=display inverse bit-map DEFC textInsMode = 4 ; 0=overstrike, 1=insert mode DEFC ParsFlag2 = 7 ;PARSER flags DEFC numOP1 = 0 ; 1=RESULT IN OP1, 0=NO RESULT DEFC newDispF = 8 ;Derivative mode flags DEFC preClrForMode = 0 ; 1=HELP BLINK ON MODE SCREEN DEFC apdFlags = 8 ;Automatic power-down DEFC apdAble = 2 ; 1=APD enabled DEFC apdRunning = 3 ; 1=APD clock running DEFC web_err_mask = $60 DEFC onFlags = 9 ;on key flags DEFC onInterrupt = 4 ; 1=on key interrupt request DEFC statFlags = 9 ;statistics flags DEFC statsValid = 6 ; 1=stats are valid DEFC fmtFlags = 10 ;numeric format flags DEFC fmtExponent = 0 ; 1=show exponent, 0=no exponent DEFC fmtEng = 1 ; 1=engineering notion, 0=scientific DEFC fmtHex = 2 ; 1=hexadecimal DEFC fmtOct = 3 ; 1=octal DEFC fmtBin = 4 ; 1=binary ; DEFC numMode = 10 DEFC fmtReal = 5 DEFC fmtRect = 6 DEFC fmtPolar = 7 DEFC realMode = 5 DEFC rectMode = 6 DEFC polarMode = 7 ; ; if Hex and Oct both = 1 ; ; then Bin=0 means >Frac ; ; Bin=1 means >DMS DEFC fmtBaseMask = @00011100 ; mask to base flags DEFC fmtBaseShift = 2 ; offset to base flags ; ; CHECK IF THESE ARE USED BY NUMFORM, ; ; EQU 6 ; EQU 7 DEFC fmtOverride = 11 ;copy of fmtFlags with conversion override DEFC fmtEditFlags = 12 ;numeric editing flags DEFC fmtEdit = 0 ; 1=format number for editing DEFC curFlags = 12 ;Cursor DEFC curAble = 2 ; 1=cursor flash is enabled DEFC curOn = 3 ; 1=cursor is showing DEFC curLock = 4 ; 1=cursor is locked off DEFC appFlags = 13 ;application flags DEFC appWantIntrpt = 0 ; 1=want ON key interrupts DEFC appTextSave = 1 ; 1=save characters in textShadow DEFC appAutoScroll = 2 ; 1=auto-scroll text on last line DEFC appMenus = 3 ; 1=process keys that bring up menus ; 0=check Lock menu flag DEFC appLockMenus = 4 ; 1=ignore menu keys ; 0=switch to home screen and bring up menu DEFC appCurGraphic = 5 ; 1=graphic cursor DEFC appCurWord = 6 ; 1=text cursor covers entire word DEFC appExit = 7 ; 1=application handles [EXIT] key itself ;DEFC appWantIntrptF = 1< normal DEFC grfSplitOverride = 3 ; 1 = ignore graph split flag if set DEFC write_on_graph = 4 ; 1 = TEXT OR EQU WRITING TO GRAPH SCREEN DEFC g_style_active = 5 ; 1 = GRAPH STYLES ARE ENABLED, USE THEM DEFC cmp_mod_box = 6 ; 1 = DOING MOD BOX PLOT COMPUTATION DEFC textWrite = 7 ; DEFC newIndicFlags = 21 DEFC extraIndic = 0 DEFC saIndic = 1 DEFC smartFlags = 23 ; ;---------------------------------------------------------------------- ; Note: Fix these Equates if smartFlags are moved ;---------------------------------------------------------------------- ; DEFC smarter_mask = 3 DEFC smarter_test = 1 DEFC smartGraph = 0 DEFC smartGraph_inv = 1 ;---------------------------------------------------------------------- ; Available for ASM programming ;---------------------------------------------------------------------- DEFC asm_Flag1 = 33 ; ASM CODING DEFC asm_Flag2 = 34 ; ASM CODING DEFC asm_Flag3 = 35 ; ASM CODING ;---------------------------------------------------------------------- ; DEFC getSendFlg = 36 DEFC comFailed = 1 ; 1 = Get/Send Communication Failed ; DEFC appLwrCaseFlag = 36 DEFC lwrCaseActive = 3 ; DEFC apiFlg3 = 42 ; DEFC apiFlg4 = 43 DEFC fullScrnDraw = 2 ; DRAW INTO LAST ROW/COL OF SCREEN DEFC groupFlags = 38 DEFC inGroup = 1 ;1 = IN GROUP CONTEXT DEFC xapFlag0 = 46 ; external app flags DEFC xapFlag1 = 47 DEFC xapFlag2 = 48 DEFC xapFlag3 = 49 DEFC fontFlags = 50 DEFC fracDrawLFont = 2 DEFC fracTallLFont = 3 DEFC customFont = 7 DEFC plotFlag3 = 60 DEFC bufferOnly = 0 DEFC useFastCirc = 4 ; DEFC varTypeMask = $1F DEFC varGraphRef = 6 ; ;====================================================================== ; Character Font equates ;====================================================================== ; DEFC LrecurN = $01 DEFC LrecurU = $02 DEFC LrecurV = $03 DEFC LrecurW = $04 DEFC Lconvert = $05 DEFC LsqUp = $06 DEFC LsqDown = $07 DEFC Lintegral = $08 DEFC Lcross = $09 DEFC LboxIcon = $0A DEFC LcrossIcon = $0B DEFC LdotIcon = $0C DEFC LsubT = $0D ;small capital T for parametric mode. DEFC LcubeR = $0E ;slightly different 3 for cubed root. DEFC LhexF = $0F DEFC Lroot = $10 DEFC Linverse = $11 DEFC Lsquare = $12 DEFC Langle = $13 DEFC Ldegree = $14 DEFC Lradian = $15 DEFC Ltranspose = $16 DEFC LLE = $17 DEFC LNE = $18 DEFC LGE = $19 DEFC Lneg = $1A DEFC Lexponent = $1B DEFC Lstore = $1C DEFC Lten = $1D DEFC LupArrow = $1E DEFC LdownArrow = $1F DEFC Lspace = $20 DEFC Lexclam = $21 DEFC Lquote = $22 DEFC Lpound = $23 DEFC Lfourth = $24 DEFC Lpercent = $25 DEFC Lampersand = $26 DEFC Lapostrophe = $27 DEFC LlParen = $28 DEFC LrParen = $29 DEFC Lasterisk = $2A DEFC LplusSign = $2B DEFC Lcomma = $2C DEFC Ldash = $2D DEFC Lperiod = $2E DEFC Lslash = $2F DEFC L0 = $30 DEFC L1 = $31 DEFC L2 = $32 DEFC L3 = $33 DEFC L4 = $34 DEFC L5 = $35 DEFC L6 = $36 DEFC L7 = $37 DEFC L8 = $38 DEFC L9 = $39 DEFC Lcolon = $3A DEFC Lsemicolon = $3B DEFC LLT = $3C DEFC LEQ = $3D DEFC LGT = $3E DEFC Lquestion = $3F DEFC LatSign = $40 DEFC LcapA = $41 DEFC LcapB = $42 DEFC LcapC = $43 DEFC LcapD = $44 DEFC LcapE = $45 DEFC LcapF = $46 DEFC LcapG = $47 DEFC LcapH = $48 DEFC LcapI = $49 DEFC LcapJ = $4A DEFC LcapK = $4B DEFC LcapL = $4C DEFC LcapM = $4D DEFC LcapN = $4E DEFC LcapO = $4F DEFC LcapP = $50 DEFC LcapQ = $51 DEFC LcapR = $52 DEFC LcapS = $53 DEFC LcapT = $54 DEFC LcapU = $55 DEFC LcapV = $56 DEFC LcapW = $57 DEFC LcapX = $58 DEFC LcapY = $59 DEFC LcapZ = $5A DEFC Ltheta = $5B DEFC Lbackslash = $5C DEFC LrBrack = $5D DEFC Lcaret = $5E DEFC Lunderscore = $5F DEFC Lbackquote = $60 DEFC La = $61 DEFC Lb = $62 DEFC Lc = $63 DEFC Ld = $64 DEFC Le = $65 DEFC Lf = $66 DEFC Lg = $67 DEFC Lh = $68 DEFC Li = $69 DEFC Lj = $6A DEFC Lk = $6B DEFC Ll = $6C DEFC Lm = $6D DEFC Ln = $6E DEFC Lo = $6F DEFC Lp = $70 DEFC Lq = $71 DEFC Lr = $72 DEFC Ls = $73 DEFC Lt = $74 DEFC Lu = $75 DEFC Lv = $76 DEFC Lw = $77 DEFC Lx = $78 DEFC Ly = $79 DEFC Lz = $7A DEFC LlBrace = $7B DEFC Lbar = $7C DEFC LrBrace = $7D DEFC Ltilde = $7E DEFC LinvEQ = $7F DEFC Lsub0 = $80 DEFC Lsub1 = $81 DEFC Lsub2 = $82 DEFC Lsub3 = $83 DEFC Lsub4 = $84 DEFC Lsub5 = $85 DEFC Lsub6 = $86 DEFC Lsub7 = $87 DEFC Lsub8 = $88 DEFC Lsub9 = $89 DEFC LcapAAcute = $8A DEFC LcapAGrave = $8B DEFC LcapACaret = $8C DEFC LcapADier = $8D DEFC LaAcute = $8E DEFC LaGrave = $8F DEFC LaCaret = $90 DEFC LaDier = $91 DEFC LcapEAcute = $92 DEFC LcapEGrave = $93 DEFC LcapECaret = $94 DEFC LcapEDier = $95 DEFC LeAcute = $96 DEFC LeGrave = $97 DEFC LeCaret = $98 DEFC LeDier = $99 DEFC LcapIAcute = $9A DEFC LcapIGrave = $9B DEFC LcapICaret = $9C DEFC LcapIDier = $9D DEFC LiAcute = $9E DEFC LiGrave = $9F DEFC LiCaret = $A0 DEFC LiDier = $A1 DEFC LcapOAcute = $A2 DEFC LcapOGrave = $A3 DEFC LcapOCaret = $A4 DEFC LcapODier = $A5 DEFC LoAcute = $A6 DEFC LoGrave = $A7 DEFC LoCaret = $A8 DEFC LoDier = $A9 DEFC LcapUAcute = $AA DEFC LcapUGrave = $AB DEFC LcapUCaret = $AC DEFC LcapUDier = $AD DEFC LuAcute = $AE DEFC LuGrave = $AF DEFC LuCaret = $B0 DEFC LuDier = $B1 DEFC LcapCCed = $B2 DEFC LcCed = $B3 DEFC LcapNTilde = $B4 DEFC LnTilde = $B5 DEFC Laccent = $B6 DEFC Lgrave = $B7 DEFC Ldieresis = $B8 DEFC LquesDown = $B9 DEFC LexclamDown = $BA DEFC Lalpha = $BB DEFC Lbeta = $BC DEFC Lgamma = $BD DEFC LcapDelta = $BE DEFC Ldelta = $BF DEFC Lepsilon = $C0 DEFC LlBrack = $C1 DEFC Llambda = $C2 DEFC Lmu = $C3 DEFC Lpi = $C4 DEFC Lrho = $C5 DEFC LcapSigma = $C6 DEFC Lsigma = $C7 DEFC Ltau = $C8 DEFC Lphi = $C9 DEFC LcapOmega = $CA DEFC LxMean = $CB DEFC LyMean = $CC DEFC LsupX = $CD DEFC Lellipsis = $CE DEFC Lleft = $CF DEFC Lblock = $D0 DEFC Lper = $D1 DEFC Lhyphen = $D2 DEFC Larea = $D3 DEFC Ltemp = $D4 DEFC Lcube = $D5 DEFC Lenter = $D6 DEFC LimagI = $D7 DEFC Lphat = $D8 DEFC Lchi = $D9 DEFC LstatF = $DA DEFC Llne = $DB DEFC LlistL = $DC DEFC LfinanN = $DD DEFC L2_r_paren = $DE DEFC LblockArrow = $DF DEFC LcurO = $E0 DEFC LcurO2 = $E1 DEFC LcurOcapA = $E2 DEFC LcurOa = $E3 DEFC LcurI = $E4 DEFC LcurI2 = $E5 DEFC LcurIcapA = $E6 DEFC LcurIa = $E7 DEFC LGline = $E8 ; = 0 DEFC LGthick = $E9 ; = 1 DEFC LGabove = $EA ; = 2 DEFC LGbelow = $EB ; = 3 DEFC LGpath = $EC ; = 4 DEFC LGanimate = $ED ; = 5 DEFC LGdot = $EE ; = 6 DEFC LUpBlk = $EF ;Up arrow and Block in solver DEFC LDnBlk = $F0 ;Down arrow and Block in solver DEFC LcurFull = $F1 ;note: must be last char (PutMap checks) ; ;====================================================================== ; Keypress Equates ;====================================================================== ; Keyboard key names ; ; ;kRight EQU $01 ;kLeft EQU $02 ;kUp EQU $03 ;kDown EQU $04 DEFC kEnter = $05 DEFC kAlphaEnter = $06 DEFC kAlphaUp = $07 DEFC kAlphaDown = $08 DEFC kClear = $09 DEFC kDel = $0A DEFC kIns = $0B DEFC kRecall = $0C DEFC kLastEnt = $0D DEFC kBOL = $0E DEFC kEOL = $0F ; DEFC kSelAll = $10 DEFC kUnselAll = $11 DEFC kLtoTI82 = $12 DEFC kBackup = $13 DEFC kRecieve = $14 DEFC kLnkQuit = $15 DEFC kTrans = $16 DEFC kRename = $17 DEFC kOverw = $18 DEFC kOmit = $19 DEFC kCont = $1A DEFC kSendID = $1B DEFC kSendSW = $1C DEFC kYes = $1D DEFC kNoWay = $1E DEFC kvSendType = $1F DEFC kOverWAll = $20 ; DEFC kNo = $25 DEFC kKReset = $26 DEFC kApp = $27 ; DEFC kDoug = $28 DEFC kListflag = $29 DEFC menuStart = $2B ; DEFC kAreYouSure = $2B DEFC kAppsMenu = $2C DEFC kPrgm = $2D DEFC kZoom = $2E DEFC kDraw = $2F DEFC kSPlot = $30 DEFC kStat = $31 DEFC kMath = $32 DEFC kTest = $33 DEFC kChar = $34 DEFC kVars = $35 DEFC kMem = $36 DEFC kMatrix = $37 DEFC kDist = $38 DEFC kAngle = $39 DEFC kList = $3A DEFC kCalc = $3B DEFC kFin = $3C ; DEFC menuEnd = kFin ; DEFC kCatalog = $3E DEFC kInputDone = $3F DEFC kOff = kInputDone ; DEFC kQuit = $40 DEFC appStart = kQuit ; DEFC kLinkIO = $41 DEFC kMatrixEd = $42 DEFC kStatEd = $43 DEFC kGraph = $44 DEFC kMode = $45 DEFC kPrgmEd = $46 ; PROGRAM EDIT DEFC kPrgmCr = $47 ; PROGRAM CREATE DEFC kWindow = $48 ; RANGE EDITOR DEFC kYequ = $49 ; EQUATION EDITOR DEFC kTable = $4A ; TABLE EDITOR DEFC kTblSet = $4B ; TABLE SET DEFC kChkRAM = $4C ; CHECK RAM DEFC kDelMem = $4D ; DELETE MEM DEFC kResetMem = $4E ; RESET MEM DEFC kResetDef = $4F ; RESET DEFAULT DEFC kPrgmInput = $50 ; PROGRAM INPUT DEFC kZFactEd = $51 ; ZOOM FACTOR EDITOR DEFC kError = $52 ; ERROR DEFC kSolveTVM = $53 ; TVM SOLVER DEFC kSolveRoot = $54 ; SOLVE EDITOR DEFC kStatP = $55 ; stat plot DEFC kInfStat = $56 ; Inferential Statistic DEFC kFormat = $57 ; FORMAT DEFC kExtApps = $58 ; External Applications. NEW DEFC kNewApps = $59 ; New Apps for Cerberus. ; DEFC append = kNewApps ; DEFC echoStart1 = $5A ; DEFC kTrace = $5A DEFC kZFit = $5B DEFC kZIn = $5C DEFC kZOut = $5D DEFC kZPrev = $5E DEFC kBox = $5F DEFC kDecml = $60 DEFC kSetZm = $61 DEFC kSquar = $62 DEFC kStd = $63 DEFC kTrig = $64 DEFC kUsrZm = $65 DEFC kZSto = $66 DEFC kZInt = $67 DEFC kZStat = $68 ; DEFC echoStart2 = $69 ; ;kSelect EQU $69 DEFC kCircl = $6A DEFC kClDrw = $6B DEFC kLine = $6C DEFC kPen = $6D DEFC kPtChg = $6E DEFC kPtOff = $6F DEFC kPtOn = $70 DEFC kVert = $71 DEFC kHoriz = $72 DEFC kText = $73 DEFC kTanLn = $74 ; DEFC kEval = $75 DEFC kInters = $76 DEFC kDYDX = $77 DEFC kFnIntg = $78 DEFC kRootG = $79 DEFC kDYDT = $7A DEFC kDXDT = $7B DEFC kDRDo = $7C DEFC KGFMin = $7D DEFC KGFMax = $7E ; ; DEFC EchoStart = $7F ; DEFC kListName = $7F DEFC kAdd = $80 DEFC kSub = $81 DEFC kMul = $82 DEFC kDiv = $83 DEFC kExpon = $84 DEFC kLParen = $85 DEFC kRParen = $86 DEFC kLBrack = $87 DEFC kRBrack = $88 DEFC kShade = $89 DEFC kStore = $8A DEFC kComma = $8B DEFC kChs = $8C DEFC kDecPnt = $8D DEFC k0 = $8E DEFC k1 = $8F DEFC k2 = $90 DEFC k3 = $91 DEFC k4 = $92 DEFC k5 = $93 DEFC k6 = $94 DEFC k7 = $95 DEFC k8 = $96 DEFC k9 = $97 DEFC kEE = $98 DEFC kSpace = $99 DEFC kCapA = $9A DEFC kCapB = $9B DEFC kCapC = $9C DEFC kCapD = $9D DEFC kCapE = $9E DEFC kCapF = $9F DEFC kCapG = $A0 DEFC kCapH = $A1 DEFC kCapI = $A2 DEFC kCapJ = $A3 DEFC kCapK = $A4 DEFC kCapL = $A5 DEFC kCapM = $A6 DEFC kCapN = $A7 DEFC kCapO = $A8 DEFC kCapP = $A9 DEFC kCapQ = $AA DEFC kCapR = $AB DEFC kCapS = $AC DEFC kCapT = $AD DEFC kCapU = $AE DEFC kCapV = $AF DEFC kCapW = $B0 DEFC kCapX = $B1 DEFC kCapY = $B2 DEFC kCapZ = $B3 DEFC kVarx = $B4 DEFC kPi = $B5 DEFC kInv = $B6 DEFC kSin = $B7 DEFC kASin = $B8 DEFC kCos = $B9 DEFC kACos = $BA DEFC kTan = $BB DEFC kATan = $BC DEFC kSquare = $BD DEFC kSqrt = $BE DEFC kLn = $BF DEFC kExp = $C0 DEFC kLog = $C1 DEFC kALog = $C2 DEFC kToABC = $C3 ; DEFC kClrTbl = $C4 ; DEFC kAns = $C5 DEFC kColon = $C6 ; DEFC kNDeriv = $C7 DEFC kFnInt = $C8 DEFC kRoot = $C9 ; DEFC kQuest = $CA DEFC kQuote = $CB DEFC kTheta = $CC DEFC kIf = $CD DEFC kThen = $CE DEFC kElse = $CF DEFC kFor = $D0 DEFC kWhile = $D1 DEFC kRepeat = $D2 DEFC kEnd = $D3 DEFC kPause = $D4 DEFC kLbl = $D5 DEFC kGoto = $D6 DEFC kISG = $D7 DEFC kDSL = $D8 DEFC kMenu = $D9 DEFC kExec = $DA DEFC kReturn = $DB DEFC kStop = $DC DEFC kInput = $DD DEFC kPrompt = $DE DEFC kDisp = $DF DEFC kDispG = $E0 DEFC kDispT = $E1 DEFC kOutput = $E2 DEFC kGetKey = $E3 DEFC kClrHome = $E4 DEFC kPrtScr = $E5 DEFC kSinH = $E6 DEFC kCosH = $E7 DEFC kTanH = $E8 DEFC kASinH = $E9 DEFC kACosH = $EA DEFC kATanH = $EB DEFC kLBrace = $EC DEFC kRBrace = $ED DEFC kI = $EE DEFC kCONSTeA = $EF DEFC kPlot3 = $F0 DEFC kFMin = $F1 DEFC kFMax = $F2 DEFC kL1A = $F3 DEFC kL2A = $F4 DEFC kL3A = $F5 DEFC kL4A = $F6 DEFC kL5A = $F7 DEFC kL6A = $F8 DEFC kunA = $F9 DEFC kvnA = $FA DEFC kwnA = $FB ; ;====================================================================== ; THIS KEY MEANS THAT IT IS A 2 BYTE KEYCODE ; THERE ARE 2 OF THESE KEYS; BE CAREFUL WITH USAGE ;====================================================================== ; DEFC kExtendEcho2 = $FC ; ;======================================================================; ; THIS KEY MEANS THAT THE KEY PRESS IS ONE THAT $ECOS ; INTO A BUFFER, AND IT IS A 2 BYTE KEY CODE, GO LOOK AT ; (EXTECHO) FOR THE KEY VALUE ;====================================================================== ; DEFC kExtendEcho = $FE ; DEFC kE1BT = 0 DEFC kDrawInv = kE1BT DEFC kDrawF = kE1BT+1 DEFC kPixelOn = kE1BT+2 DEFC kPixelOff = kE1BT+3 DEFC kPxlTest = kE1BT+4 DEFC kRCGDB = kE1BT+5 DEFC kRCPic = kE1BT+6 DEFC kSTGDB = kE1BT+7 DEFC kSTPic = kE1BT+8 DEFC kAbs = kE1BT+9 DEFC kTEqu = kE1BT+10 ; == DEFC kTNoteQ = kE1BT+11 ; <> DEFC kTGT = kE1BT+12 ; > DEFC kTGTE = kE1BT+13 ; > = DEFC kTLT = kE1BT+14 ; < DEFC kTLTE = kE1BT+15 ; < = DEFC kAnd = kE1BT+16 DEFC kOr = kE1BT+17 DEFC kXor = kE1BT+18 DEFC kNot = kE1BT+19 DEFC kLR1 = kE1BT+20 DEFC kXRoot = kE1BT+21 DEFC kCube = kE1BT+22 DEFC kCbRt = kE1BT+23 ; Cube ROOT DEFC kToDec = kE1BT+24 ; DEFC kCubicR = kE1BT+25 DEFC kQuartR = kE1BT+26 ; DEFC kPlot1 = kE1BT+27 DEFC kPlot2 = kE1BT+28 ; DEFC kRound = kE1BT+29 DEFC kIPart = kE1BT+30 DEFC kFPart = kE1BT+31 DEFC kInt = kE1BT+32 DEFC kRand = kE1BT+33 DEFC kNPR = kE1BT+34 DEFC kNCR = kE1BT+35 DEFC kXFactorial = kE1BT+36 DEFC kRad = kE1BT+37 DEFC kDegr = kE1BT+38 ; DEGREES CONV DEFC kAPost = kE1BT+39 DEFC kToDMS = kE1BT+40 DEFC kRToPo = kE1BT+41 ; R DEFC kRToPr = kE1BT+42 DEFC kPToRx = kE1BT+43 DEFC kPToRy = kE1BT+44 DEFC kRowSwap = kE1BT+45 DEFC kRowPlus = kE1BT+46 DEFC kTimRow = kE1BT+47 DEFC kTRowP = kE1BT+48 DEFC kSortA = kE1BT+49 DEFC kSortD = kE1BT+50 DEFC kSeq = kE1BT+51 DEFC kMin = kE1BT+52 DEFC kMax = kE1BT+53 DEFC kMean = kE1BT+54 DEFC kMedian = kE1BT+55 DEFC kSum = kE1BT+56 DEFC kProd = kE1BT+57 DEFC kDet = kE1BT+58 DEFC kTransp = kE1BT+59 DEFC kDim = kE1BT+60 DEFC kFill = kE1BT+61 DEFC kIdent = kE1BT+62 DEFC kRandm = kE1BT+63 DEFC kAug = kE1BT+64 DEFC kOneVar = kE1BT+65 DEFC kTwoVar = kE1BT+66 DEFC kLR = kE1BT+67 DEFC kLRExp = kE1BT+68 DEFC kLRLn = kE1BT+69 DEFC kLRPwr = kE1BT+70 DEFC kMedMed = kE1BT+71 DEFC kQuad = kE1BT+72 DEFC kClrLst = kE1BT+73 DEFC kHist = kE1BT+74 DEFC kxyLine = kE1BT+75 DEFC kScatter = kE1BT+76 DEFC kmRad = kE1BT+77 DEFC kmDeg = kE1BT+78 DEFC kmNormF = kE1BT+79 DEFC kmSci = kE1BT+80 DEFC kmEng = kE1BT+81 DEFC kmFloat = kE1BT+82 DEFC kFix = kE1BT+83 DEFC kSplitOn = kE1BT+84 DEFC kFullScreen = kE1BT+85 DEFC kStndrd = kE1BT+86 DEFC kParam = kE1BT+87 DEFC kPolar = kE1BT+88 DEFC kSeqG = kE1BT+89 DEFC kAFillOn = kE1BT+90 DEFC kAFillOff = kE1BT+91 DEFC kACalcOn = kE1BT+92 DEFC kACalcOff = kE1BT+93 DEFC kFNOn = kE1BT+94 DEFC kFNOff = kE1BT+95 DEFC kPlotsOn = kE1BT+96 DEFC kPlotsOff = kE1BT+97 DEFC kPixelChg = kE1BT+98 DEFC kSendMBL = kE1BT+99 DEFC kRecvMBL = kE1BT+100 DEFC kBoxPlot = kE1BT+101 DEFC kBoxIcon = kE1BT+102 DEFC kCrossIcon = kE1BT+103 DEFC kDotIcon = kE1BT+104 DEFC kE2BT = kE1BT+105 DEFC kSeqential = kE2BT DEFC kSimulG = kE2BT+1 DEFC kPolarG = kE2BT+2 DEFC kRectG = kE2BT+3 DEFC kCoordOn = kE2BT+4 DEFC kCoordOff = kE2BT+5 DEFC kDrawLine = kE2BT+6 DEFC kDrawDot = kE2BT+7 DEFC kAxisOn = kE2BT+8 DEFC kAxisOff = kE2BT+9 DEFC kGridOn = kE2BT+10 DEFC kGridOff = kE2BT+11 DEFC kLblOn = kE2BT+12 DEFC kLblOff = kE2BT+13 DEFC kL1 = kE2BT+14 DEFC kL2 = kE2BT+15 DEFC kL3 = kE2BT+16 DEFC kL4 = kE2BT+17 DEFC kL5 = kE2BT+18 DEFC kL6 = kE2BT+19 ; ;====================================================================== ; These keys are layed on top of existing keys to ; enable localization in the inferential stats editor ;====================================================================== ; DEFC kinfData = kL1 DEFC kinfStats = kL1+1 DEFC kinfYes = kL1+2 DEFC kinfNo = kL1+3 DEFC kinfCalc = kL1+4 DEFC kinfDraw = kL1+5 DEFC kinfAlt1ne = kL1+6 DEFC kinfAlt1lt = kL1+7 DEFC kinfAlt1gt = kL1+8 DEFC kinfAlt2ne = kL1+9 DEFC kinfAlt2lt = kL1+10 DEFC kinfAlt2gt = kL1+11 DEFC kinfAlt3ne = kL1+12 DEFC kinfAlt3lt = kL1+13 DEFC kinfAlt3gt = kL1+14 DEFC kinfAlt4ne = kL1+15 DEFC kinfAlt4lt = kL1+16 DEFC kinfAlt4gt = kL1+17 DEFC kinfAlt5ne = kL1+18 DEFC kinfAlt5lt = kL1+19 DEFC kinfAlt5gt = kL1+20 DEFC kinfAlt6ne = kL1+21 DEFC kinfAlt6lt = kL1+22 DEFC kinfAlt6gt = kL1+23 ; ; DEFC kMatA = kE2BT+20 DEFC kMatB = kE2BT+21 DEFC kMatC = kE2BT+22 DEFC kMatD = kE2BT+23 DEFC kMatE = kE2BT+24 DEFC kXmin = kE2BT+25 DEFC kXmax = kE2BT+26 DEFC kXscl = kE2BT+27 DEFC kYmin = kE2BT+28 DEFC kYmax = kE2BT+29 DEFC kYscl = kE2BT+30 DEFC kTmin = kE2BT+31 DEFC kTmax = kE2BT+32 DEFC kTStep = kE2BT+33 DEFC kOmin = kE2BT+34 DEFC kOmax = kE2BT+35 DEFC kOStep = kE2BT+36 DEFC ku0 = kE2BT+37 DEFC kv0 = kE2BT+38 DEFC knMin = kE2BT+39 DEFC knMax = kE2BT+40 DEFC kDeltaY = kE2BT+41 DEFC kDeltaX = kE2BT+42 DEFC kZXmin = kE2BT+43 DEFC kZXmax = kE2BT+44 DEFC kZXscl = kE2BT+45 DEFC kZYmin = kE2BT+46 DEFC kZYmax = kE2BT+47 DEFC kZYscl = kE2BT+48 DEFC kZTmin = kE2BT+49 DEFC kZTmax = kE2BT+50 DEFC kZTStep = kE2BT+51 DEFC kZOmin = kE2BT+52 DEFC kZOmax = kE2BT+53 DEFC kZOStep = kE2BT+54 DEFC kZu0 = kE2BT+55 DEFC kZv0 = kE2BT+56 DEFC kZnMin = kE2BT+57 DEFC kZnMax = kE2BT+58 DEFC kDelLast = kE2BT+59 DEFC kSinReg = kE2BT+60 DEFC kConstE = kE2BT+61 DEFC kPic1 = kE2BT+62 DEFC kPic2 = kE2BT+63 DEFC kPic3 = kE2BT+64 DEFC kDelVar = kE2BT+65 DEFC kGetCalc = kE2BT+66 DEFC kRealM = kE2BT+67 DEFC kPolarM = kE2BT+68 DEFC kRectM = kE2BT+69 DEFC kuv = kE2BT+70 ; U vs V DEFC kvw = kE2BT+71 ; V vs W DEFC kuw = kE2BT+72 ; U vs W DEFC kFinPMTend = kE2BT+73 DEFC kFinPMTbeg = kE2BT+74 ; DEFC kGraphStyle = kE2BT+75 ; DEFC kExprOn = kE2BT+76 DEFC kExprOff = kE2BT+77 DEFC kStatA = kE2BT+78 DEFC kStatB = kE2BT+79 DEFC kStatC = kE2BT+80 DEFC kCorr = kE2BT+81 DEFC kStatD = kE2BT+82 DEFC kStatE = kE2BT+83 DEFC kRegEq = kE2BT+84 DEFC kMinX = kE2BT+85 DEFC kQ1 = kE2BT+86 DEFC kMD = kE2BT+87 DEFC kQ3 = kE2BT+88 DEFC kMaxX = kE2BT+89 DEFC kStatX1 = kE2BT+90 DEFC kStatY1 = kE2BT+91 DEFC kStatX2 = kE2BT+92 DEFC kStatY2 = kE2BT+93 DEFC kStatX3 = kE2BT+94 DEFC kStatY3 = kE2BT+95 DEFC kTblMin = kE2BT+96 DEFC kTblStep = kE2BT+97 DEFC kSetupLst = kE2BT+98 DEFC kClrAllLst = kE2BT+99 DEFC kLogistic = kE2BT+100 DEFC kZTest = kE2BT+101 DEFC kTTest = kE2BT+102 DEFC k2SampZTest = kE2BT+103 DEFC k2SampTTest = kE2BT+104 DEFC k1PropZTest = kE2BT+105 DEFC k2PropZTest = kE2BT+106 DEFC kChiTest = kE2BT+107 DEFC k2SampFTest = kE2BT+108 DEFC kZIntVal = kE2BT+109 DEFC kTIntVal = kE2BT+110 DEFC k2SampTInt = kE2BT+111 DEFC k2SampZInt = kE2BT+112 DEFC k1PropZInt = kE2BT+113 DEFC k2PropZInt = kE2BT+114 DEFC kDNormal = kE2BT+115 DEFC kInvNorm = kE2BT+116 DEFC kDT = kE2BT+117 DEFC kChi = kE2BT+118 DEFC kDF = kE2BT+119 DEFC kBinPDF = kE2BT+120 DEFC kBinCDF = kE2BT+121 DEFC kPoiPDF = kE2BT+122 DEFC kPoiCDF = kE2BT+123 DEFC kun = kE2BT+124 DEFC kvn = kE2BT+125 DEFC kwn = kE2BT+126 DEFC kRecn = kE2BT+127 DEFC kPlotStart = kE2BT+128 DEFC kZPlotStart = kE2BT+129 ; recursion n DEFC kXFact = kE2BT+130 ; PlotStart DEFC kYFact = kE2BT+131 ; ZPlotStart DEFC kANOVA = kE2BT+132 ; XFact DEFC kMaxY = kE2BT+133 ; YFact DEFC kWebOn = kE2BT+134 ; MinY DEFC kWebOff = kE2BT+135 ; MaxY DEFC kTblInput = kE2BT+136 ; WEB ON DEFC kGeoPDF = kE2BT+137 ; WEB OFF DEFC kGeoCDF = kE2BT+138 ; WEB OFF DEFC kShadeNorm = kE2BT+139 DEFC kShadeT = kE2BT+140 DEFC kShadeChi = kE2BT+141 DEFC kShadeF = kE2BT+142 DEFC kPlotStep = kE2BT+143 DEFC kZPlotStep = kE2BT+144 DEFC kLinRegtTest = kE2BT+145 DEFC KMGT = kE2BT+146 ; VERT SPLIT DEFC kSelectA = kE2BT+147 DEFC kZFitA = kE2BT+148 DEFC kE2BT_End = kZFitA ; ; ;====================================================================== ; More 2 Byte Keys ;====================================================================== DEFC kE2BT2 = 0 DEFC kGDB1 = kE2BT2 DEFC kGDB2 = kE2BT2+1 DEFC kGDB3 = kE2BT2+2 DEFC kY1 = kE2BT2+3 DEFC kY2 = kE2BT2+4 DEFC kY3 = kE2BT2+5 DEFC kY4 = kE2BT2+6 DEFC kY5 = kE2BT2+7 DEFC kY6 = kE2BT2+8 DEFC kY7 = kE2BT2+9 DEFC kY8 = kE2BT2+10 DEFC kY9 = kE2BT2+11 DEFC kY0 = kE2BT2+12 DEFC kX1T = kE2BT2+13 DEFC kY1T = kE2BT2+14 DEFC kX2T = kE2BT2+15 DEFC kY2T = kE2BT2+16 DEFC kX3T = kE2BT2+17 DEFC kY3T = kE2BT2+18 DEFC kX4T = kE2BT2+19 DEFC kY4T = kE2BT2+20 DEFC kX5T = kE2BT2+21 DEFC kY5T = kE2BT2+22 DEFC kX6T = kE2BT2+23 DEFC kY6T = kE2BT2+24 DEFC kR1 = kE2BT2+25 DEFC kR2 = kE2BT2+26 DEFC kR3 = kE2BT2+27 DEFC kR4 = kE2BT2+28 DEFC kR5 = kE2BT2+29 DEFC kR6 = kE2BT2+30 DEFC kGDB4 = kE2BT2+31 DEFC kGDB5 = kE2BT2+32 DEFC kGDB6 = kE2BT2+33 DEFC kPic4 = kE2BT2+34 DEFC kPic5 = kE2BT2+35 DEFC kPic6 = kE2BT2+36 DEFC kGDB7 = kE2BT2+37 DEFC kGDB8 = kE2BT2+38 DEFC kGDB9 = kE2BT2+39 DEFC kGDB0 = kE2BT2+40 DEFC kPic7 = kE2BT2+41 DEFC kPic8 = kE2BT2+42 DEFC kPic9 = kE2BT2+43 DEFC kPic0 = kE2BT2+44 DEFC kStatN = kE2BT2+45 DEFC kXMean = kE2BT2+46 DEFC kConj = kE2BT2+47 DEFC kReal = kE2BT2+48 DEFC kFAngle = kE2BT2+49 DEFC kLCM = kE2BT2+50 DEFC kGCD = kE2BT2+51 DEFC kRandInt = kE2BT2+52 DEFC kRandNorm = kE2BT2+53 DEFC kToPolar = kE2BT2+54 DEFC kToRect = kE2BT2+55 DEFC kYMean = kE2BT2+56 DEFC kStdX = kE2BT2+57 DEFC kStdX1 = kE2BT2+58 DEFC kw0 = kE2BT2+59 DEFC kMatF = kE2BT2+60 DEFC kMatG = kE2BT2+61 DEFC kMatRH = kE2BT2+62 DEFC kMatI = kE2BT2+63 DEFC kMatJ = kE2BT2+64 DEFC kYMean1 = kE2BT2+65 DEFC kStdY = kE2BT2+66 DEFC kStdY1 = kE2BT2+67 DEFC kMatToLst = kE2BT2+68 DEFC kLstToMat = kE2BT2+69 DEFC kCumSum = kE2BT2+70 DEFC kDeltaLst = kE2BT2+71 DEFC kStdDev = kE2BT2+72 DEFC kVariance = kE2BT2+73 DEFC kLength = kE2BT2+74 DEFC kEquToStrng = kE2BT2+75 DEFC kStrngToEqu = kE2BT2+76 DEFC kExpr = kE2BT2+77 DEFC kSubStrng = kE2BT2+78 DEFC kInStrng = kE2BT2+79 DEFC kStr1 = kE2BT2+80 DEFC kStr2 = kE2BT2+81 DEFC kStr3 = kE2BT2+82 DEFC kStr4 = kE2BT2+83 DEFC kStr5 = kE2BT2+84 DEFC kStr6 = kE2BT2+85 DEFC kStr7 = kE2BT2+86 DEFC kStr8 = kE2BT2+87 DEFC kStr9 = kE2BT2+88 DEFC kStr0 = kE2BT2+89 DEFC kFinN = kE2BT2+90 DEFC kFinI = kE2BT2+91 DEFC kFinPV = kE2BT2+92 DEFC kFinPMT = kE2BT2+93 DEFC kFinFV = kE2BT2+94 DEFC kFinPY = kE2BT2+95 DEFC kFinCY = kE2BT2+96 DEFC kFinFPMT = kE2BT2+97 DEFC kFinFI = kE2BT2+98 DEFC kFinFPV = kE2BT2+99 DEFC kFinFN = kE2BT2+100 DEFC kFinFFV = kE2BT2+101 DEFC kFinNPV = kE2BT2+102 DEFC kFinIRR = kE2BT2+103 DEFC kFinBAL = kE2BT2+104 DEFC kFinPRN = kE2BT2+105 DEFC kFinINT = kE2BT2+106 DEFC kSumX = kE2BT2+107 DEFC kSumX2 = kE2BT2+108 DEFC kFinToNom = kE2BT2+109 DEFC kFinToEff = kE2BT2+110 DEFC kFinDBD = kE2BT2+111 DEFC kStatVP = kE2BT2+112 DEFC kStatZ = kE2BT2+113 DEFC kStatT = kE2BT2+114 DEFC kStatChi = kE2BT2+115 DEFC kStatF = kE2BT2+116 DEFC kStatDF = kE2BT2+117 DEFC kStatPhat = kE2BT2+118 DEFC kStatPhat1 = kE2BT2+119 DEFC kStatPhat2 = kE2BT2+120 DEFC kStatMeanX1 = kE2BT2+121 DEFC kStatMeanX2 = kE2BT2+122 DEFC kStatStdX1 = kE2BT2+123 DEFC kStatStdX2 = kE2BT2+124 DEFC kStatStdXP = kE2BT2+125 DEFC kStatN1 = kE2BT2+126 DEFC kStatN2 = kE2BT2+127 DEFC kStatLower = kE2BT2+128 DEFC kStatUpper = kE2BT2+129 DEFC kuw0 = kE2BT2+130 DEFC kImag = kE2BT2+131 DEFC kSumY = kE2BT2+132 DEFC kXres = kE2BT2+133 DEFC kStat_s = kE2BT2+134 DEFC kSumY2 = kE2BT2+135 DEFC kSumXY = kE2BT2+136 DEFC kuXres = kE2BT2+137 DEFC kModBox = kE2BT2+138 DEFC kNormProb = kE2BT2+139 DEFC kNormalPDF = kE2BT2+140 DEFC kTPDF = kE2BT2+141 DEFC kChiPDF = kE2BT2+142 DEFC kFPDF = kE2BT2+143 DEFC kMinY = kE2BT2+144 ; MinY DEFC kRandBin = kE2BT2+145 DEFC kRef = kE2BT2+146 DEFC kRRef = kE2BT2+147 DEFC kLRSqr = kE2BT2+148 DEFC kBRSqr = kE2BT2+149 DEFC kDiagOn = kE2BT2+150 DEFC kDiagOff = kE2BT2+151 DEFC kun1 = kE2BT2+152 ; FOR RCL USE WHEN GOTTEN FROM 82 DEFC kvn1 = kE2BT2+153 ; FOR RCL USE WHEN GOTTEN FROM 82 ; DEFC k83_00End = kvn1 ;end of original keys... DEFC kArchive = k83_00End + 1 DEFC kUnarchive = k83_00End + 2 DEFC kAsm = k83_00End + 3 ; Asm( DEFC kAsmPrgm = k83_00End + 4 ; AsmPrgm DEFC kAsmComp = k83_00End + 5 ; AsmComp( ; DEFC kcapAAcute = k83_00End + 6 DEFC kcapAGrave = k83_00End + 7 DEFC kcapACaret = k83_00End + 8 DEFC kcapADier = k83_00End + 9 DEFC kaAcute = k83_00End + 10 DEFC kaGrave = k83_00End + 11 DEFC kaCaret = k83_00End + 12 DEFC kaDier = k83_00End + 13 DEFC kcapEAcute = k83_00End + 14 DEFC kcapEGrave = k83_00End + 15 DEFC kcapECaret = k83_00End + 16 DEFC kcapEDier = k83_00End + 17 DEFC keAcute = k83_00End + 18 DEFC keGrave = k83_00End + 19 DEFC keCaret = k83_00End + 20 DEFC keDier = k83_00End + 21 DEFC kcapIAcute = k83_00End + 22 DEFC kcapIGrave = k83_00End + 23 DEFC kcapICaret = k83_00End + 24 DEFC kcapIDier = k83_00End + 25 DEFC kiAcute = k83_00End + 26 DEFC kiGrave = k83_00End + 27 DEFC kiCaret = k83_00End + 28 DEFC kiDier = k83_00End + 29 DEFC kcapOAcute = k83_00End + 30 DEFC kcapOGrave = k83_00End + 31 DEFC kcapOCaret = k83_00End + 32 DEFC kcapODier = k83_00End + 33 DEFC koAcute = k83_00End + 34 DEFC koGrave = k83_00End + 35 DEFC koCaret = k83_00End + 36 DEFC koDier = k83_00End + 37 DEFC kcapUAcute = k83_00End + 38 DEFC kcapUGrave = k83_00End + 39 DEFC kcapUCaret = k83_00End + 40 DEFC kcapUDier = k83_00End + 41 DEFC kuAcute = k83_00End + 42 DEFC kuGrave = k83_00End + 43 DEFC kuCaret = k83_00End + 44 DEFC kuDier = k83_00End + 45 DEFC kcapCCed = k83_00End + 46 DEFC kcCed = k83_00End + 47 DEFC kcapNTilde = k83_00End + 48 DEFC knTilde = k83_00End + 49 DEFC kaccent = k83_00End + 50 DEFC kgrave = k83_00End + 51 DEFC kdieresis = k83_00End + 52 DEFC kquesDown = k83_00End + 53 DEFC kexclamDown = k83_00End + 54 DEFC kalpha = k83_00End + 55 DEFC kbeta = k83_00End + 56 DEFC kgamma = k83_00End + 57 DEFC kcapDelta = k83_00End + 58 DEFC kdelta = k83_00End + 59 DEFC kepsilon = k83_00End + 60 DEFC klambda = k83_00End + 61 DEFC kmu = k83_00End + 62 DEFC kpi2 = k83_00End + 63 DEFC krho = k83_00End + 64 DEFC kcapSigma = k83_00End + 65 DEFC ksigma = k83_00End + 66 DEFC ktau = k83_00End + 67 DEFC kphi = k83_00End + 68 DEFC kcapOmega = k83_00End + 69 DEFC kphat = k83_00End + 70 DEFC kchi2 = k83_00End + 71 DEFC kstatF2 = k83_00End + 72 DEFC kLa = k83_00End + 73 DEFC kLb = k83_00End + 74 DEFC kLc = k83_00End + 75 DEFC kLd = k83_00End + 76 DEFC kLe = k83_00End + 77 DEFC kLf = k83_00End + 78 DEFC kLg = k83_00End + 79 DEFC kLh = k83_00End + 80 DEFC kLi = k83_00End + 81 DEFC kLj = k83_00End + 82 DEFC kLk = k83_00End + 83 DEFC kLl = k83_00End + 84 DEFC kLm = k83_00End + 85 DEFC kLsmalln = k83_00End + 86 DEFC kLo = k83_00End + 87 DEFC kLp = k83_00End + 88 DEFC kLq = k83_00End + 89 DEFC kLsmallr = k83_00End + 90 DEFC kLs = k83_00End + 91 DEFC kLt = k83_00End + 92 DEFC kLu = k83_00End + 93 DEFC kLv = k83_00End + 94 DEFC kLw = k83_00End + 95 DEFC kLx = k83_00End + 96 DEFC kLy = k83_00End + 97 DEFC kLz = k83_00End + 98 DEFC kGarbageC = k83_00End + 99 ; GarbageCollect ; DEFC kE2BT2_End = kGarbageC ; ;====================================================================== ; TI-83 Plus Context Equates ;====================================================================== ; DEFC cxCmd = kQuit ;home screen DEFC cxMatEdit = kMatrixEd ;matrix editor DEFC cxPrgmEdit = kPrgmEd ;program editor DEFC cxEquEdit = kYequ ;equation editor DEFC cxGrRange = kWindow ;graph range editor DEFC cxGrZfact = kZFactEd ;graph zoom factors editor DEFC cxGraph = kGraph ;graph mode DEFC cxStatEdit = kStatEd ;statistics list editor DEFC cxPrgmInput = kPrgmInput ;programmed input DEFC cxError = kError ;error handler DEFC cxLinkIO = kLinkIO ;LINK I/O interface DEFC cxMem = kResetMem ;reset memory DEFC cxDefMem = kResetDef ;reset default DEFC cxRAMApp = kChkRAM ;RAM usage screen DEFC cxMode = kMode ;mode settings screen DEFC cxErase = kDelMem ;memory erase DEFC cxPrgmCreate = kPrgmCr ;PROGRAM CREATE DEFC cxTableEditor = kTable ;TABLE EDITOR DEFC cxTableSet = kTblSet ;TABLE SET UP DEFC cxStatPlot = kStatP ;STAT PLOTS DEFC cxInfStat = kInfStat ;Inferential Statistic DEFC cxFormat = kFormat ;FORMAT CONTEXT DEFC cxSolveTVM = kSolveTVM ;Solve TVM DEFC cxSolveRoot = kSolveRoot ;Solve Root DEFC lastOldApp = kExtApps ;external applications DEFC cxextapps = kExtApps DEFC cxNewApps = kNewApps ;new cerberus applications DEFC cxGroup = cxNewApps+0 ;1st new app. DEFC cxUnGroup = cxNewApps+1 ;2nd new app. DEFC lastNewApp = cxUnGroup ;last new app for this ver ; ;====================================================================== ; Scan Code Equates ;======================================================================; DEFC skDown = $01 DEFC skLeft = $02 DEFC skRight = $03 DEFC skUp = $04 DEFC skEnter = $09 DEFC skAdd = $0A DEFC skSub = $0B DEFC skMul = $0C DEFC skDiv = $0D DEFC skPower = $0E DEFC skClear = $0F DEFC skChs = $11 DEFC sk3 = $12 DEFC sk6 = $13 DEFC sk9 = $14 DEFC skRParen = $15 DEFC skTan = $16 DEFC skVars = $17 DEFC skDecPnt = $19 DEFC sk2 = $1A DEFC sk5 = $1B DEFC sk8 = $1C DEFC skLParen = $1D DEFC skCos = $1E DEFC skPrgm = $1F DEFC skStat = $20 DEFC sk0 = $21 DEFC sk1 = $22 DEFC sk4 = $23 DEFC sk7 = $24 DEFC skComma = $25 DEFC skSin = $26 DEFC skMatrix = $27 DEFC skGraphvar = $28 DEFC skStore = $2A DEFC skLn = $2B DEFC skLog = $2C DEFC skSquare = $2D DEFC skRecip = $2E DEFC skMath = $2F DEFC skAlpha = $30 DEFC skGraph = $31 DEFC skTrace = $32 DEFC skZoom = $33 DEFC skWindow = $34 DEFC skYEqu = $35 DEFC sk2nd = $36 DEFC skMode = $37 DEFC skDel = $38 ; ;====================================================================== ; Tokens ;====================================================================== ; DEFC EOSSTART = 0 ; ; ; DISPLAY CONVERSIONS COME IMMEDIATELY BEFORE 'TSTORE' ; DEFC DCONV = $01 ; DEFC tToDMS = DCONV ; $01 DEFC tToDEC = DCONV+1 ; $02 DEFC tToAbc = DCONV+2 ; $03 > A b/c ; DEFC tStore = DCONV+3 ; $04 Lstore 01 ; DEFC tBoxPlot = $05 ; DEFC BRACKS = $06 ; DEFC tLBrack = BRACKS ; $06 '[' DEFC tRBrack = BRACKS+1 ; $07 ']' DEFC tLBrace = BRACKS+2 ; $08 '{' DEFC tRBrace = BRACKS+3 ; $09 '}' ; DEFC tPOST1 = BRACKS+4 ; DEFC tFromRad = tPOST1 ; $0A Lradian DEFC tFromDeg = tPOST1+1 ; $0B Ldegree DEFC tRecip = tPOST1+2 ; $0C Linverse DEFC tSqr = tPOST1+3 ; $0D Lsquare DEFC tTrnspos = tPOST1+4 ; $0E Ltranspose DEFC tCube = tPOST1+5 ; $0F '^3' ; DEFC tLParen = $10 ; 10h '(' DEFC tRParen = $11 ; 11h ')' ; ; DEFC IMUN = $12 ; DEFC tRound = IMUN ; $12 'round' DEFC tPxTst = IMUN+1 ; $13 'PXL-TEST' DEFC tAug = IMUN+2 ; $14 'aug' DEFC tRowSwap = IMUN+3 ; $15 'rSwap' DEFC tRowPlus = IMUN+4 ; $16 'rAdd' DEFC tmRow = IMUN+5 ; $17 'multR' DEFC tmRowPlus = IMUN+6 ; $18 'mRAdd' DEFC tMax = IMUN+7 ; $19 'max' DEFC tMin = IMUN+8 ; $1A 'min' DEFC tRToPr = IMUN+9 ; $1B 'R>Pr DEFC tRToPo = IMUN+10 ; $1C 'R>Po DEFC tPToRx = IMUN+11 ; $1D 'P>Rx DEFC tPToRy = IMUN+12 ; $1E 'P>Ry DEFC tMedian = IMUN+13 ; $1F 'MEDIAN DEFC tRandM = IMUN+14 ; $20 'randM' DEFC tMean = IMUN+15 ; $21 DEFC tRoot = IMUN+16 ; $22 'ROOT' DEFC tSeries = IMUN+17 ; $23 'seq' DEFC tFnInt = IMUN+18 ; $24 'fnInt' DEFC tNDeriv = IMUN+19 ; $25 'fnIr' DEFC tEvalF = IMUN+20 ; $26 DEFC tFmin = IMUN+21 ; $27 DEFC tFmax = IMUN+22 ; $28 ; DEFC tEOSEL = IMUN+23 ; DEFC tSpace = tEOSEL ; $29 ' ' DEFC tString = tEOSEL+1 ; $2A '"' DEFC tComma = tEOSEL+2 ; $2B ',' ; ; DEFC tii = $2C ; i ; ;====================================================================== ; Postfix Functions ;====================================================================== ; DEFC tPost = $2D ; DEFC tFact = tPost ; $2D '!' ; DEFC tCubicR = $2E DEFC tQuartR = $2F ;====================================================================== ; Number Tokens ;====================================================================== ; DEFC NUMS = $30 ; DEFC t0 = NUMS ; $30 DEFC t1 = NUMS+1 ; $31 DEFC t2 = NUMS+2 ; $32 DEFC t3 = NUMS+3 ; $33 DEFC t4 = NUMS+4 ; $34 DEFC t5 = NUMS+5 ; $35 DEFC t6 = NUMS+6 ; $36 DEFC t7 = NUMS+7 ; $37 DEFC t8 = NUMS+8 ; $38 DEFC t9 = NUMS+9 ; $39 DEFC tDecPt = NUMS+10 ; $3A DEFC tee = NUMS+11 ; $3B ; ;====================================================================== ; BINARY OP ;====================================================================== ; DEFC tOr = $3C ; 3Ch '_or_' DEFC tXor = $3D ; 3Dh ; DEFC tColon = $3E ; 3Eh ':' DEFC tEnter = $3F ; 3Fh Lenter ; DEFC tAnd = $40 ; 40h '_and_' ; ;====================================================================== ; LETTER TOKENS ;====================================================================== ; DEFC LET = $41 ; DEFC tA = LET ; $41 DEFC tB = LET+1 ; $42 DEFC tC = LET+2 ; $43 DEFC tD = LET+3 ; $44 DEFC tE = LET+4 ; $45 DEFC tF = LET+5 ; $46 DEFC tG = LET+6 ; $47 DEFC tH = LET+7 ; $48 DEFC tI = LET+8 ; $49 DEFC tJ = LET+9 ; $4A DEFC tK = LET+10 ; $4B DEFC tL = LET+11 ; $4C DEFC tM = LET+12 ; $4D DEFC tN = LET+13 ; $4E DEFC tO = LET+14 ; $4F DEFC tP = LET+15 ; $50 DEFC tQ = LET+16 ; $51 DEFC tR = LET+17 ; $52 DEFC tS = LET+18 ; $53 DEFC tT = LET+19 ; $54 DEFC tU = LET+20 ; $55 DEFC tV = LET+21 ; $56 DEFC tW = LET+22 ; $57 DEFC tX = LET+23 ; $58 DEFC tY = LET+24 ; $59 DEFC tZ = LET+25 ; $5A DEFC tTheta = LET+26 ; $5B ; ;====================================================================== ; THESE VAR TOKENS ARE 1ST OF A DOUBLE TOKEN ;====================================================================== ; DEFC vToks = LET+27 ; ; ; USER MATRIX TOKEN, 2ND TOKEN NEEDED FOR NAME ; DEFC tVarMat = vToks ; $5C ; ; USER LIST TOKEN, 2ND TOKEN NEEDED FOR NAME ; DEFC tVarLst = vToks+1 ; $5D ; ; USER EQUATION TOKEN, 2ND TOKEN NEEDED FOR NAME ; DEFC tVarEqu = vToks+2 ; $5E DEFC tProg = vToks+3 ; $5F ; ; USER PICT TOKEN, 2ND TOKEN NEEDED FOR NAME ; DEFC tVarPict = vToks+4 ; $60 ; ; USER GDB TOKEN, 2ND TOKEN NEEDED FOR NAME ; DEFC tVarGDB = vToks+5 ; $61 DEFC tVarOut = vToks+6 ; $62 DEFC tVarSys = vToks+7 ; $63 ; ; ;====================================================================== ; Mode Setting Commands ;====================================================================== ; DEFC MODESA = vToks+8 ; $64 ; DEFC tRad = MODESA ; $64 'Radian' DEFC tDeg = MODESA+1 ; $65 'Degree' DEFC tNormF = MODESA+2 ; $66 'Normal' DEFC tSci = MODESA+3 ; $67 'Sci' DEFC tEng = MODESA+4 ; $68 'Eng' DEFC tFloat = MODESA+5 ; $69 'Float' ; DEFC CMPS = $6A ; DEFC tEQ = CMPS ; $6A '==' DEFC tLT = CMPS+1 ; $6B '<' DEFC tGT = CMPS+2 ; $6C '>' DEFC tLE = CMPS+3 ; $6D LLE DEFC tGE = CMPS+4 ; $6E LGE DEFC tNE = CMPS+5 ; $6F LNE ; ;====================================================================== ; BINARY OP ;====================================================================== ; DEFC tAdd = $70 ; 70h '+' DEFC tSub = $71 ; 71h '-' DEFC tAns = $72 ; 72h ; ;====================================================================== ; Mode Setting Commands ;====================================================================== ; DEFC MODES = $73 ; DEFC tFix = MODES ; $73 'Fix_' DEFC tSplitOn = MODES+1 ; $74 DEFC tFullScreen = MODES+2 ; $75 DEFC tStndrd = MODES+3 ; $76 'Func' DEFC tParam = MODES+4 ; $77 'Param' DEFC tPolar = MODES+5 ; $78 'Pol' DEFC tSeqG = MODES+6 ; $79 DEFC tAFillOn = MODES+7 ; $7A 'AUTO FILL ON DEFC tAFillOff = MODES+8 ; $7B DEFC tACalcOn = MODES+9 ; $7C DEFC tACalcOff = MODES+10 ; $7D 'AutoFill OFF ; ; GRAPH FORMAT TOKENS ARE 2 BYTE TOKENS ; DEFC tGFormat = MODES+11 ; $7E ; DEFC tBoxIcon = $7F DEFC tCrossIcon = $80 DEFC tDotIcon = $81 ; ;====================================================================== ; (More) BINARY OP ;====================================================================== ; DEFC tMul = $82 ; 82h '*' DEFC tDiv = $83 ; 83h '/' ; ;====================================================================== ; SOME GRAPH COMMANDS ;====================================================================== ; DEFC GRCMDS = $84 ; DEFC tTrace = GRCMDS ; $84 'Trace' DEFC tClDrw = GRCMDS+1 ; $85 'ClDrw' DEFC tZoomStd = GRCMDS+2 ; $86 'ZStd' DEFC tZoomtrg = GRCMDS+3 ; $87 'Ztrg' DEFC tZoomBox = GRCMDS+4 ; $88 'ZBOX' DEFC tZoomIn = GRCMDS+5 ; $89 'ZIn' DEFC tZoomOut = GRCMDS+6 ; $8A 'ZOut' DEFC tZoomSqr = GRCMDS+7 ; $8B 'ZSqr' DEFC tZoomInt = GRCMDS+8 ; $8C 'ZInt' DEFC tZoomPrev = GRCMDS+9 ; $8D 'ZPrev' DEFC tZoomDec = GRCMDS+10 ; $8E 'ZDecm' DEFC tZoomStat = GRCMDS+11 ; $8F 'ZStat DEFC tUsrZm = GRCMDS+12 ; $90 'ZRcl' DEFC tPrtScrn = GRCMDS+13 ; $91 'PrtScrn' DEFC tZoomSto = GRCMDS+14 ; $92 ZOOM STORE DEFC tText = GRCMDS+15 ; $93 ; ;====================================================================== ; BINARY OP (Combination & Permutation) ;====================================================================== ; DEFC tnPr = GRCMDS+16 ; $94 '_nPr_' DEFC tnCr = GRCMDS+17 ; $95 '_nCr_' ; ;====================================================================== ; MORE GRAPH COMMANDS ;====================================================================== ; DEFC tYOn = GRCMDS+18 ; $96 'FnOn_' DEFC tYOff = GRCMDS+19 ; $97 'FnOff_' DEFC tStPic = GRCMDS+20 ; $98 'StPic_' DEFC tRcPic = GRCMDS+21 ; $99 'RcPic_' DEFC tStoDB = GRCMDS+22 ; $9A 'StGDB_' DEFC tRclDB = GRCMDS+23 ; $9B 'RcGDB_' DEFC tLine = GRCMDS+24 ; $9C 'Line' DEFC tVert = GRCMDS+25 ; $9D 'Vert_' DEFC tPtOn = GRCMDS+26 ; $9E 'PtOn' DEFC tPtOff = GRCMDS+27 ; $9F 'PtOff' ; ;====================================================================== ; TOKEN A0 CANNOT BE AN EOS FUNCTION ; SINCE LOW MULT=A0 ALREADY ;====================================================================== ; DEFC tPtChg = GRCMDS+28 ; $A0 'PtChg' DEFC tPXOn = GRCMDS+29 ; $A1 DEFC tPXOff = GRCMDS+30 ; $A2 DEFC tPXChg = GRCMDS+31 ; $A3 DEFC tShade = GRCMDS+32 ; $A4 'Shade' DEFC tCircl = GRCMDS+33 ; $A5 'Circl' DEFC tHorz = GRCMDS+34 ; $A6 'HORIZONTAL' DEFC tTanLn = GRCMDS+35 ; $A7 'TanLn' DEFC tDrInv = GRCMDS+36 ; $A8 'DrInv_' DEFC tDrawF = GRCMDS+37 ; $A9 'DrawF_' ; DEFC tVarStrng = $AA ; ;====================================================================== ; Functions with No Arguments ;====================================================================== ; DEFC NOARG = $AB ; DEFC tRand = NOARG ; $AB 'rand' DEFC tPi = NOARG+1 ; $AC Lpi DEFC tGetKey = NOARG+2 ; $AD 'getKy' ; ; DEFC tAPost = tGetKey+1 ; APOSTROPHY DEFC tQuest = tAPost+1 ; QUESTION MARK ; ; DEFC UNARY = tQuest+1 ; $B0 ; DEFC tChs = UNARY ; $B0 DEFC tInt = UNARY+1 ; $B1 DEFC tAbs = UNARY+2 ; $B2 DEFC tDet = UNARY+3 ; $B3 DEFC tIdent = UNARY+4 ; $B4 DEFC tDim = UNARY+5 ; $B5 DEFC tSum = UNARY+6 ; $B6 DEFC tProd = UNARY+7 ; $B7 DEFC tNot = UNARY+8 ; $B8 DEFC tIPart = UNARY+9 ; $B9 DEFC tFPart = UNARY+10 ; $BA ; ; ;====================================================================== ; NEW 2 BYTE TOKENS ;====================================================================== ; DEFC t2ByteTok = $BB ; ; ; DEFC UNARYLR = UNARY+12 ; DEFC tSqrt = UNARYLR ; $BC DEFC tCubRt = UNARYLR+1 ; $BD DEFC tLn = UNARYLR+2 ; $BE DEFC tExp = UNARYLR+3 ; $BF DEFC tLog = UNARYLR+4 ; $C0 DEFC tALog = UNARYLR+5 ; $C1 DEFC tSin = UNARYLR+6 ; $C2 DEFC tASin = UNARYLR+7 ; $C3 DEFC tCos = UNARYLR+8 ; $C4 DEFC tACos = UNARYLR+9 ; $C5 DEFC tTan = UNARYLR+10 ; $C6 DEFC tATan = UNARYLR+11 ; $C7 DEFC tSinH = UNARYLR+12 ; $C8 DEFC tASinH = UNARYLR+13 ; $C9 DEFC tCoshH = UNARYLR+14 ; $CA DEFC tACosH = UNARYLR+15 ; $CB DEFC tTanH = UNARYLR+16 ; $CC DEFC tATanH = UNARYLR+17 ; $CD ; ;====================================================================== ; SOME PROGRAMMING COMMANDS ;====================================================================== ; DEFC PROGTOK = UNARYLR+18 ; DEFC tIf = PROGTOK ; $CE DEFC tThen = PROGTOK+1 ; $CF DEFC tElse = PROGTOK+2 ; $D0 DEFC tWhile = PROGTOK+3 ; $D1 DEFC tRepeat = PROGTOK+4 ; $D2 DEFC tFor = PROGTOK+5 ; $D3 DEFC tEnd = PROGTOK+6 ; $D4 DEFC tReturn = PROGTOK+7 ; $D5 DEFC tLbl = PROGTOK+8 ; $D6 'Lbl_' DEFC tGoto = PROGTOK+9 ; $D7 'Goto_' DEFC tPause = PROGTOK+10 ; $D8 'Pause_' DEFC tStop = PROGTOK+11 ; $D9 'Stop' DEFC tISG = PROGTOK+12 ; $DA 'IS>' DEFC tDSL = PROGTOK+13 ; $DB 'DS<' DEFC tInput = PROGTOK+14 ; $DC 'Input_' DEFC tPrompt = PROGTOK+15 ; $DD 'Prompt_' DEFC tDisp = PROGTOK+16 ; $DE 'Disp_' DEFC tDispG = PROGTOK+17 ; $DF 'DispG' ; DEFC tOutput = PROGTOK+18 ; $E0 'Outpt' DEFC tClLCD = PROGTOK+19 ; $E1 'ClLCD' DEFC tConst = PROGTOK+20 ; $E2 'Fill' DEFC tSortA = PROGTOK+21 ; $E3 'sortA_' DEFC tSortD = PROGTOK+22 ; $E4 'sortD_' DEFC tDispTab = PROGTOK+23 ; $E5 'Disp Table DEFC tMenu = PROGTOK+24 ; $E6 'Menu' DEFC tSendMBL = PROGTOK+25 ; $E7 'SEND' DEFC tGetMBL = PROGTOK+26 ; $E8 'GET' ; ;====================================================================== ; STAT PLOT COMMANDS ;====================================================================== ; DEFC statPCmd = PROGTOK+27 ; DEFC tPlotOn = statPCmd ; $E9 ' PLOTSON' DEFC tPlotOff = statPCmd+1 ; $EA ' PLOTSOFF ; DEFC tListName = $EB ; LIST DESIGNATOR ; DEFC tPlot1 = $EC DEFC tPlot2 = $ED DEFC tPlot3 = $EE ; DEFC tUnused01 = $EF ; available? ; DEFC tPower = $F0 ; '^' DEFC tXRoot = $F1 ; LsupX,Lroot DEFC STATCMD = $F2 ; DEFC tOneVar = STATCMD ; $F2 'OneVar_' DEFC tTwoVar = STATCMD+1 ; $F3 DEFC tLR = STATCMD+2 ; $F4 'LinR(A+BX DEFC tLRExp = STATCMD+3 ; $F5 'ExpR_' DEFC tLRLn = STATCMD+4 ; $F6 'LnR_' DEFC tLRPwr = STATCMD+5 ; $F7 'PwrR_' DEFC tMedMed = STATCMD+6 ; $F8 DEFC tQuad = STATCMD+7 ; $F9 DEFC tClrLst = STATCMD+8 ; $FA 'CLEAR LIST DEFC tClrTbl = STATCMD+9 ; $FB CLEAR TABLE DEFC tHist = STATCMD+10 ; $FC 'Hist_' DEFC txyLine = STATCMD+11 ; $FD 'xyline_' DEFC tScatter = STATCMD+12 ; $FE 'Scatter_' DEFC tLR1 = STATCMD+13 ; $FF 'LINR(AX+B ; ;====================================================================== ; 2ND HALF OF GRAPH FORMAT TOKENS ;====================================================================== ; Format settings commands ; DEFC GFMT = 0 ; DEFC tSeq = GFMT ; 'SeqG' DEFC tSimulG = GFMT+1 ; 'SimulG' DEFC tPolarG = GFMT+2 ; 'PolarGC' DEFC tRectG = GFMT+3 ; 'RectGC' DEFC tCoordOn = GFMT+4 ; 'CoordOn' DEFC tCoordOff = GFMT+5 ; 'CoordOff' DEFC tDrawLine = GFMT+6 ; 'DrawLine' DEFC tDrawDot = GFMT+7 ; 'DrawDot' DEFC tAxisOn = GFMT+8 ; 'AxesOn' DEFC tAxisOff = GFMT+9 ; 'AxesOff' DEFC tGridOn = GFMT+10 ; 'GridOn' DEFC tGridOff = GFMT+11 ; 'GridOff' DEFC tLblOn = GFMT+12 ; 'LabelOn' DEFC tLblOff = GFMT+13 ; 'LabelOff' DEFC tWebOn = GFMT+14 ; 'WebOn' DEFC tWebOff = GFMT+15 ; 'WebOFF' DEFC tuv = GFMT+16 ; U vs V DEFC tvw = GFMT+17 ; V vs W DEFC tuw = GFMT+18 ; U vs W ; ;====================================================================== ; 2ND HALF OF USER MATRIX TOKENS ;====================================================================== ; DEFC tMatA = $00 ; MAT A DEFC tMatB = $01 ; MAT B DEFC tMatC = $02 ; MAT C DEFC tMatD = $03 ; MAT D DEFC tMatE = $04 ; MAT E DEFC tMatF = $05 ; MAT F DEFC tMatG = $06 ; MAT G DEFC tMatH = $07 ; MAT H DEFC tMatI = $08 ; MAT I DEFC tMatJ = $09 ; MAT J ; ;====================================================================== ; 2ND HALF OF USER LIST TOKENS ;====================================================================== ; DEFC tL1 = $00 ; LIST 1 DEFC tL2 = $01 ; LIST 2 DEFC tL3 = $02 ; LIST 3 DEFC tL4 = $03 ; LIST 4 DEFC tL5 = $04 ; LIST 5 DEFC tL6 = $05 ; LIST 6 ; ;====================================================================== ; 2ND HALF OF USER EQUATION TOKENS ;====================================================================== ; ; "Y" EQUATIONS HAVE BIT 4 SET ; DEFC tY1 = $10 ; Y1 DEFC tY2 = $11 ; Y2 DEFC tY3 = $12 ; Y3 DEFC tY4 = $13 ; Y4 DEFC tY5 = $14 ; Y5 DEFC tY6 = $15 ; Y6 DEFC tY7 = $16 ; Y7 DEFC tY8 = $17 ; Y8 DEFC tY9 = $18 ; Y9 DEFC tY0 = $19 ; Y0 ; ; PARAM EQUATIONS HAVE BIT 5 SET ; DEFC tX1T = $20 ; X1t DEFC tY1T = $21 ; Y1t DEFC tX2T = $22 ; X2t DEFC tY2T = $23 ; Y2t DEFC tX3T = $24 ; X3t DEFC tY3T = $25 ; Y3t DEFC tX4T = $26 ; X4t DEFC tY4T = $27 ; Y4t DEFC tX5T = $28 ; X5t DEFC tY5T = $29 ; Y5t DEFC tX6T = $2A ; X6t DEFC tY6T = $2B ; Y6t ; ; POLAR EQUATIONS HAVE BIT 6 SET ; DEFC tR1 = $40 ; R1 DEFC tR2 = $41 ; R2 DEFC tR3 = $42 ; R3 DEFC tR4 = $43 ; R4 DEFC tR5 = $44 ; R5 DEFC tR6 = $45 ; R6 ; ; RECURSION EQUATIONS HAVE BIT 7 SET ; DEFC tun = $80 ; Un DEFC tvn = $81 ; Vn DEFC twn = $82 ; Wn ; ;====================================================================== ; 2ND HALF OF USER PICTURE TOKENS ;====================================================================== ; DEFC tPic1 = $00 ; PIC1 DEFC tPic2 = $01 ; PIC2 DEFC tPic3 = $02 ; PIC3 DEFC tPic4 = $03 ; PIC4 DEFC tPic5 = $04 ; PIC5 DEFC tPic6 = $05 ; PIC6 DEFC tPic7 = $06 ; PIC7 DEFC tPic8 = $07 ; PIC8 DEFC tPic9 = $08 ; PIC9 DEFC tPic0 = $09 ; PIC0 ; ;====================================================================== ; 2ND HALF OF USER GRAPH DATABASE TOKENS ;====================================================================== ; DEFC tGDB1 = $00 ; GDB1 DEFC tGDB2 = $01 ; GDB2 DEFC tGDB3 = $02 ; GDB3 DEFC tGDB4 = $03 ; GDB4 DEFC tGDB5 = $04 ; GDB5 DEFC tGDB6 = $05 ; GDB6 DEFC tGDB7 = $06 ; GDB7 DEFC tGDB8 = $07 ; GDB8 DEFC tGDB9 = $08 ; GDB9 DEFC tGDB0 = $09 ; GDB0 ; ;====================================================================== ; 2ND HALF OF STRING VARS ;====================================================================== ; DEFC tStr1 = $00 DEFC tStr2 = $01 DEFC tStr3 = $02 DEFC tStr4 = $03 DEFC tStr5 = $04 DEFC tStr6 = $05 DEFC tStr7 = $06 DEFC tStr8 = $07 DEFC tStr9 = $08 DEFC tStr0 = $09 ; ;====================================================================== ; 2ND HALF OF SYSTEM OUTPUT ONLY VARIABLES ;====================================================================== ; ; ; OPEN EQU $00 ; DEFC tRegEq = $01 ; REGRESSION EQUATION ; DEFC tStatN = $02 ; STATISTICS N ; DEFC tXMean = $03 ; X MEAN DEFC tSumX = $04 ; SUM(X) DEFC tSumXSqr = $05 ; SUM(X^2) DEFC tStdX = $06 ; STANDARD DEV X DEFC tStdPX = $07 ; STANDARD DEV POP X DEFC tMinX = $08 ; Min X VALUE DEFC tMaxX = $09 ; Max X VALUE ; DEFC tMinY = $0A ; Min Y VALUE DEFC tMaxY = $0B ; Max Y VALUE DEFC tYmean = $0C ; Y MEAN DEFC tSumY = $0D ; SUM(Y) DEFC tSumYSqr = $0E ; SUM(Y^2) DEFC tStdY = $0F ; STANDARD DEV Y DEFC tStdPY = $10 ; STANDARD DEV POP Y ; DEFC tSumXY = $11 ; SUM(XY) DEFC tCorr = $12 ; CORRELATION DEFC tMedX = $13 ; MED(X) DEFC tQ1 = $14 ; 1ST QUADRANT OF X DEFC tQ3 = $15 ; 3RD QUADRANT OF X DEFC tQuadA = $16 ; 1ST TERM OF QUAD POLY REG/ Y-INT DEFC tQuadB = $17 ; 2ND TERM OF QUAD POLY REG/ SLOPE DEFC tQuadC = $18 ; 3RD TERM OF QUAD POLY REG DEFC tCubeD = $19 ; 4TH TERM OF CUBIC POLY REG DEFC tQuartE = $1A ; 5TH TERM OF QUART POLY REG DEFC tMedX1 = $1B ; x1 FOR MED-MED DEFC tMedX2 = $1C ; x2 FOR MED-MED DEFC tMedX3 = $1D ; x3 FOR MED-MED DEFC tMedY1 = $1E ; y1 FOR MED-MED DEFC tMedY2 = $1F ; y2 FOR MED-MED DEFC tMedY3 = $20 ; y3 FOR MED-MED ; DEFC tRecurn = $21 ; RECURSION N DEFC tStatP = $22 DEFC tStatZ = $23 DEFC tStatT = $24 DEFC tStatChi = $25 DEFC tStatF = $26 DEFC tStatDF = $27 DEFC tStatPhat = $28 DEFC tStatPhat1 = $29 DEFC tStatPhat2 = $2A DEFC tStatMeanX1 = $2B DEFC tStatStdX1 = $2C DEFC tStatN1 = $2D DEFC tStatMeanX2 = $2E DEFC tStatStdX2 = $2F DEFC tStatN2 = $30 DEFC tStatStdXP = $31 DEFC tStatLower = $32 DEFC tStatUpper = $33 DEFC tStat_s = $34 DEFC tLRSqr = $35 ; r^2 DEFC tBRSqr = $36 ; R^2 ; ;====================================================================== ; These next tokens are only used to access the data ; they are display only and the user cannot access them at all ;====================================================================== ; DEFC tF_DF = $37 ; ANOFAV FACTOR DF DEFC tF_SS = $38 ; ANOFAV FACTOR SS DEFC tF_MS = $39 ; ANOFAV FACTOR MS DEFC tE_DF = $3A ; ANOFAV ERROR DF DEFC tE_SS = $3B ; ANOFAV ERROR SS DEFC tE_MS = $3C ; ANOFAV ERROR MS ; ; ;====================================================================== ; 2ND HALF OF SYSTEM INPUT/OUTPUT VARIABLES ;====================================================================== ; SYSTEM VARIABLE EQUATES ; DEFC tuXscl = 0 DEFC tuYscl = 1 DEFC tXscl = 2 DEFC tYscl = 3 DEFC tRecuru0 = 4 ; U 1ST INITIAL COND DEFC tRecurv0 = 5 ; V 1ST INITIAL COND DEFC tun1 = 6 ; U(N-1) ; NOT USED DEFC tvn1 = 7 ; V(N-1) ; NOT USED DEFC tuRecuru0 = 8 ; DEFC tuRecurv0 = 9 ; ; DEFC tXmin = $0A DEFC tXmax = $0B DEFC tYmin = $0C DEFC tYmax = $0D DEFC tTmin = $0E DEFC tTmax = $0F DEFC tThetaMin = $10 DEFC tThetaMax = $11 DEFC tuXmin = $12 DEFC tuXmax = $13 DEFC tuYmin = $14 DEFC tuYmax = $15 DEFC tuThetMin = $16 DEFC tuThetMax = $17 DEFC tuTmin = $18 DEFC tuTmax = $19 DEFC tTblMin = $1A DEFC tPlotStart = $1B DEFC tuPlotStart = $1C DEFC tnMax = $1D DEFC tunMax = $1E DEFC tnMin = $1F DEFC tunMin = $20 ; DEFC tTblStep = $21 DEFC tTStep = $22 DEFC tThetaStep = $23 DEFC tuTStep = $24 DEFC tuThetStep = $25 ; DEFC tDeltaX = $26 DEFC tDeltaY = $27 ; DEFC tXFact = $28 DEFC tYFact = $29 ; DEFC tTblInput = $2A ; DEFC tFinN = $2B DEFC tFinI = $2C DEFC tFinPV = $2D DEFC tFinPMT = $2E DEFC tFinFV = $2F DEFC tFinPY = $30 DEFC tFinCY = $31 ; DEFC tRecurw0 = $32 ; w0(1) DEFC tuRecurw0 = $33 ; DEFC tPlotStep = $34 DEFC tuPlotStep = $35 ; DEFC tXres = $36 DEFC tuXres = $37 ; DEFC tRecuru02 = $38 ; u0(2) DEFC tuRecuru02 = $39 DEFC tRecurv02 = $3C ; v0(2) DEFC tuRecurv02 = $3D DEFC tRecurw02 = $3E ; w0(2) DEFC tuRecurw02 = $3F ; ;====================================================================== ; 2nd byte of t2ByteTok tokens ;====================================================================== ; DEFC tFinNPV = $00 ; DEFC tFinIRR = $01 ; DEFC tFinBAL = $02 ; DEFC tFinPRN = $03 ; DEFC tFinINT = $04 ; DEFC tFinToNom = $05 ; DEFC tFinToEff = $06 ; DEFC tFinDBD = $07 ; DEFC tLCM = $08 ; DEFC tGCD = $09 ; DEFC tRandInt = $0A ; DEFC tRandBin = $0B ; DEFC tSubStrng = $0C ; DEFC tStdDev = $0D ; DEFC tVariance = $0E ; DEFC tInStrng = $0F ; DEFC tDNormal = $10 ; DEFC tInvNorm = $11 ; DEFC tDT = $12 ; DEFC tChI = $13 ; DEFC tDF = $14 ; DEFC tBINPDF = $15 ; DEFC tBINCDF = $16 ; DEFC tPOIPDF = $17 ; DEFC tPOICDF = $18 ; DEFC tGEOPDF = $19 ; DEFC tGEOCDF = $1A ; DEFC tNormalPDF = $1B ; DEFC tTPDF = $1C ; DEFC tChiPDF = $1D ; DEFC tFPDF = $1E ; DEFC tRandNorm = $1F ; DEFC tFinFPMT = $20 ; DEFC tFinFI = $21 ; DEFC tFinFPV = $22 ; DEFC tFinFN = $23 ; DEFC tFinFFV = $24 ; DEFC tConj = $25 ; DEFC tReal = $26 ; DEFC tImag = $27 ; DEFC tAngle = $28 ; DEFC tCumSum = $29 ; DEFC tExpr = $2A ; DEFC tLength = $2B ; DEFC tDeltaLst = $2C ; DEFC tRef = $2D ; DEFC tRRef = $2E ; DEFC tToRect = $2F ; DEFC tToPolar = $30 ; DEFC tConste = $31 ; DEFC tSinReg = $32 ; DEFC tLogistic = $33 ; DEFC tLinRegTTest = $34 ; DEFC tShadeNorm = $35 ; DEFC tShadeT = $36 ; DEFC tShadeChi = $37 ; DEFC tShadeF = $38 ; DEFC tMatToLst = $39 ; DEFC tLstToMat = $3A ; DEFC tZTest = $3B ; DEFC tTTest = $3C ; DEFC t2SampZTest = $3D ; DEFC t1PropZTest = $3E ; DEFC t2PropZTest = $3F ; DEFC tChiTest = $40 ; DEFC tZIntVal = $41 ; DEFC t2SampZInt = $42 ; DEFC t1PropZInt = $43 ; DEFC t2PropZInt = $44 ; DEFC tGraphStyle = $45 ; DEFC t2SampTTest = $46 ; DEFC t2SampFTest = $47 ; DEFC tTIntVal = $48 ; DEFC t2SampTInt = $49 ; DEFC tSetupLst = $4A ; DEFC tFinPMTend = $4B ; DEFC tFinPMTbeg = $4C ; DEFC tRealM = $4D ; DEFC tPolarM = $4E ; DEFC tRectM = $4F ; DEFC tExprOn = $50 ; DEFC tExprOff = $51 ; DEFC tClrAllLst = $52 ; DEFC tGetCalc = $53 ; DEFC tDelVar = $54 ; DEFC tEquToStrng = $55 ; DEFC tStrngToEqu = $56 ; DEFC tDelLast = $57 ; DEFC tSelect = $58 ; DEFC tANOVA = $59 ; DEFC tModBox = $5A ; DEFC tNormProb = $5B ; ; ; DEFC tMGT = $64 ; VERTICAL SPLIT DEFC tZFit = $65 ; ZOOM FIT DEFC tDiag_on = $66 ; DIANOSTIC DISPLAY ON DEFC tDiag_off = $67 ; DIANOSTIC DISPLAY OFF DEFC tOkEnd2v0 = $67 ;end of 2byte tokens for version 0. DEFC tArchive = $68 ;archive DEFC tUnarchive = $69 ;unarchive DEFC tasm = $6A DEFC tasmComp = $6B ; asm compile DEFC tasmPrgm = $6C ; signifies a program is asm DEFC tasmCmp = $6D ; asm program is compiled ; DEFC tLcapAAcute = $6E DEFC tLcapAGrave = $6F DEFC tLcapACaret = $70 DEFC tLcapADier = $71 DEFC tLaAcute = $72 DEFC tLaGrave = $73 DEFC tLaCaret = $74 DEFC tLaDier = $75 DEFC tLcapEAcute = $76 DEFC tLcapEGrave = $77 DEFC tLcapECaret = $78 DEFC tLcapEDier = $79 DEFC tLeAcute = $7A DEFC tLeGrave = $7B DEFC tLeCaret = $7C DEFC tLeDier = $7D ; DEFC tLcapIGrave = $7F DEFC tLcapICaret = $80 DEFC tLcapIDier = $81 DEFC tLiAcute = $82 DEFC tLiGrave = $83 DEFC tLiCaret = $84 DEFC tLiDier = $85 DEFC tLcapOAcute = $86 DEFC tLcapOGrave = $87 DEFC tLcapOCaret = $88 DEFC tLcapODier = $89 DEFC tLoAcute = $8A DEFC tLoGrave = $8B DEFC tLoCaret = $8C DEFC tLoDier = $8D DEFC tLcapUAcute = $8E DEFC tLcapUGrave = $8F DEFC tLcapUCaret = $90 DEFC tLcapUDier = $91 DEFC tLuAcute = $92 DEFC tLuGrave = $93 DEFC tLuCaret = $94 DEFC tLuDier = $95 DEFC tLcapCCed = $96 DEFC tLcCed = $97 DEFC tLcapNTilde = $98 DEFC tLnTilde = $99 DEFC tLaccent = $9A DEFC tLgrave = $9B DEFC tLdieresis = $9C DEFC tLquesDown = $9D DEFC tLexclamDown = $9E DEFC tLalpha = $9F DEFC tLbeta = $a0 DEFC tLgamma = $a1 DEFC tLcapDelta = $a2 DEFC tLdelta = $a3 DEFC tLepsilon = $a4 DEFC tLlambda = $a5 DEFC tLmu = $a6 DEFC tLpi = $a7 DEFC tLrho = $a8 DEFC tLcapSigma = $a9 ; ; DEFC tLphi = $aB DEFC tLcapOmega = $aC DEFC tLphat = $aD DEFC tLchi = $aE DEFC tLstatF = $aF ; DEFC tLa = $b0 DEFC tLb = $b1 DEFC tLc = $b2 DEFC tLd = $b3 DEFC tLsmalle = $b4 DEFC tLf = $b5 DEFC tLsmallg = $b6 DEFC tLh = $b7 DEFC tLi = $b8 DEFC tLj = $b9 DEFC tLk = $bA ; DEFC tLl = $bC DEFC tLm = $bD ;tLn EQU $bE DEFC tLo = $bF DEFC tLp = $c0 DEFC tLq = $c1 DEFC tLsmallr = $c2 DEFC tLs = $c3 DEFC tLsmallt = $c4 DEFC tLu = $c5 DEFC tLv = $c6 DEFC tLw = $c7 DEFC tLx = $c8 DEFC tLy = $c9 DEFC tLz = $cA DEFC tLsigma = $cb DEFC tLtau = $cc DEFC tLcapIAcute = $cd ; ; DEFC tGarbagec = $Ce DEFC LastToken = $Ce ;tLAST TOKEN IN THIS VERSION... ; ;====================================================================== ; Data Type Equates ;====================================================================== ; DEFC RealObj = 0 DEFC ListObj = 1 DEFC MatObj = 2 DEFC EquObj = 3 DEFC StrngObj = 4 DEFC ProgObj = 5 DEFC ProtProgObj = 6 DEFC PictObj = 7 DEFC GDBObj = 8 DEFC UnknownObj = 9 DEFC UnknownEquObj = $0A DEFC NewEquObj = $0B DEFC CplxObj = $0C DEFC CListObj = $0D DEFC UndefObj = $0E DEFC WindowObj = $0F DEFC ZStoObj = $10 DEFC TblRngObj = $11 DEFC LCDObj = $12 DEFC BackupObj = $13 DEFC AppObj = $14 ;application, only used in menus/link DEFC AppVarObj = $15 ;application variable DEFC TempProgObj = $16 ;program, home deletes when finished DEFC GroupObj = $17 ;group. ; ;====================================================================== ; I/O equates ;====================================================================== ; DEFC D0D1_bits = $03 DEFC D0LD1L = $03 DEFC D0LD1H = $01 DEFC D0HD1L = $02 DEFC D0HD1H = $00 DEFC bport = 0 ; 4-BIT LINK PORT (I/O) ; ;====================================================================== ; DEVICE CODES ;====================================================================== ; ; DEFC TI82DEV = $82 DEFC PC82DEV = $02 DEFC MAC82DEV = $12 ; DEFC TI83FDEV = $73 DEFC LINK83FDEV = $23 ; DEFC TI83DEV = $83 DEFC PC83DEV = $03 DEFC MAC83DEV = $13 ; DEFC TI85DEV = $95 ; DIFF THEN REAL 85 SO ME TALK DEFC PC85DEV = $05 DEFC MAC85DEV = $15 ; DEFC TI73DEV = $74 ; Device x3 is always an 83 DEFC PC73DEV = $07 DEFC MAC73DEV = $17 ; ;TI83FDEV EQU $73 DEFC LINK73FDEV = $23 DEFC PC83FDEV = $23 ;====================================================================== ; EQUATES TO RAM LOCATIONS FOR STAT VARS ;====================================================================== ; ; DEFC FPLEN = 9 ;Length of a floating-point number. DEFC StatN = statVars DEFC XMean = StatN + FPLEN DEFC SumX = XMean + FPLEN DEFC SumXSqr = SumX + FPLEN DEFC StdX = SumXSqr + FPLEN DEFC StdPX = StdX + FPLEN DEFC MinX = StdPX + FPLEN DEFC MaxX = MinX + FPLEN DEFC MinY = MaxX + FPLEN DEFC MaxY = MinY + FPLEN DEFC YMean = MaxY + FPLEN DEFC SumY = YMean + FPLEN DEFC SumYSqr = SumY + FPLEN DEFC StdY = SumYSqr + FPLEN DEFC StdPY = StdY + FPLEN DEFC SumXY = StdPY + FPLEN DEFC Corr = SumXY + FPLEN DEFC MedX = Corr + FPLEN DEFC Q1 = MedX + FPLEN DEFC Q3 = Q1 + FPLEN DEFC QuadA = Q3 + FPLEN DEFC QuadB = QuadA + FPLEN DEFC QuadC = QuadB + FPLEN DEFC CubeD = QuadC + FPLEN DEFC QuartE = CubeD + FPLEN DEFC MedX1 = QuartE + FPLEN DEFC MedX2 = MedX1 + FPLEN DEFC MedX3 = MedX2 + FPLEN DEFC MedY1 = MedX3 + FPLEN DEFC MedY2 = MedY1 + FPLEN DEFC MedY3 = MedY2 + FPLEN DEFC PStat = MedY3 + 2*FPLEN DEFC ZStat = PStat + FPLEN DEFC TStat = ZStat + FPLEN DEFC ChiStat = TStat + FPLEN DEFC FStat = ChiStat + FPLEN DEFC DF = FStat + FPLEN DEFC Phat = DF + FPLEN DEFC Phat1 = Phat + FPLEN DEFC Phat2 = Phat1 + FPLEN DEFC MeanX1 = Phat2 + FPLEN DEFC StdX1 = MeanX1 + FPLEN DEFC StatN1 = StdX1 + FPLEN DEFC MeanX2 = StatN1 + FPLEN DEFC StdX2 = MeanX2 + FPLEN DEFC StatN2 = StdX2 + FPLEN DEFC StdXP2 = StatN2 + FPLEN DEFC SLower = StdXP2 + FPLEN DEFC SUpper = SLower + FPLEN DEFC SStat = SUpper + FPLEN DEFC F_DF = anovaf_vars DEFC F_SS = F_DF + FPLEN DEFC F_MS = F_SS + FPLEN DEFC E_DF = F_MS + FPLEN DEFC E_SS = E_DF + FPLEN DEFC E_MS = E_SS + FPLEN ;====================================================================== z88dk-1.8.ds1/lib/ti83p_crt0.asm0000644000175000017500000001602710640546530015664 0ustar tygrystygrys; Stub for the TI 83+ calculator ; ; Stefano Bodrato - Dec 2000 ; Feb 2000 - Speeded up the cpygraph ; ; $Id: ti83p_crt0.asm,v 1.21 2007/06/27 20:49:28 dom Exp $ ; ; startup = ; n - Primary shell, compatible shells ; (Primary shell merely means it's the smallest implementation ; for that shell, that uses full capabilities of the shell) ; ; 1 - Ion (default) ; 2 - MirageOS without quit key ; 3 - ; 4 - TSE Kernel ; 10 - asm( executable ; ;----------------------------------------------------- ; Some general XDEFs and XREFs needed by the assembler ;----------------------------------------------------- MODULE Ti83plus_crt0 XREF _main ; No matter what set up we have, main is ; always, always external to this file. XDEF cleanup ; used by exit() XDEF l_dcal ; used by calculated calls = "call (hl)" XDEF _std_seed ; Integer rnd seed XDEF _vfprintf ; vprintf is internal to this file so we ; only ever include one of the set of ; routines XDEF exitsp ; Exit variables XDEF exitcount ; XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ; For stdin, stdout, stder XDEF base_graphics ; Graphics stuff XDEF coords ; XDEF cpygraph ; TI calc specific stuff XDEF tidi ; XDEF tiei ; ;------------------------- ; Begin of (shell) headers ;------------------------- INCLUDE "#Ti83p.def" ; ROM / RAM adresses on Ti83+[SE] INCLUDE "zcc_opt.def" ; Receive all compiler-defines ;----------------------------- ;2 - MirageOS without quit key ;----------------------------- IF (startup=2) DEFINE MirageOS ;Used by greyscale interrupt etc. DEFINE NOT_DEFAULT_SHELL ;Else we would use Ion ;org $9D93 ;Origin ;defb $BB,$6D ;Compiled AsmPrgm token org $9D95 ;We use Bin2var ret ;So TIOS wont run the program defb 1 ;Identifier as MirageOS program DEFINE NEED_mirage_icon INCLUDE "zcc_opt.def" UNDEFINE NEED_mirage_icon IF !DEFINED_NEED_mirage_icon defb @01111000,@00000000 ;Picture of a map with "C+" on it defb @10000100,@00000000 defb @10000011,@11111100 ;15x15 button defb @10000000,@00000010 defb @10011111,@00000010 defb @10111111,@00000010 defb @10110000,@00110010 defb @10110000,@01111010 defb @10110000,@01111010 defb @10110000,@00110010 defb @10111111,@00000010 defb @10011111,@00000010 defb @10000000,@00000010 defb @10000000,@00000010 defb @01111111,@11111100 ENDIF DEFINE NEED_name INCLUDE "zcc_opt.def" ; Get namestring from zcc_opt.def UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ; Termination zero im 1 ; Disable MirageOS tasker interrupt... ENDIF ;-------------- ;4 - TSE Kernel ;-------------- IF (startup = 4) DEFINE TSE DEFINE NOT_DEFAULT_SHELL org $9D94 ret defm "TSE" defb 1 defm " " DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ;----------------------------------------------------------------------------- ; External Data Required for virtual stack. I've set this to 400 ; (the normal size of the Ti83+ stack). You can use #pragma to set ; a userdefined value (RECOMMENDED): ; #pragma output StackNeeded = nnn; ;----------------------------------------------------------------------------- IF !DEFINED_StackNeeded defw 400 ELSE defw DEFINED_StackNeeded ENDIF ENDIF ;-------------------- ;10 - asm( executable ;-------------------- IF (startup=10) DEFINE ASM DEFINE NOT_DEFAULT_SHELL org $9D93 defb $BB,$6D ENDIF ;----------------- ;1 - Ion (default) ;----------------- IF !NOT_DEFAULT_SHELL DEFINE Ion org $9D95 ;org $9D93 ;defb $BB,$6D ret jr nc,start DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ENDIF ;------------------------------------- ; End of header, begin of startup part ;------------------------------------- .start IF DEFINED_GimmeSpeed ld a,1 ; switch to 15MHz (extra fast) rst 28 ; bcall(SetExSpeed) defw SetExSpeed ; ENDIF ; ld hl,0 ; add hl,sp ; ld (start1+1),hl ; IF !DEFINED_atexit ; Less stack use ld hl,-6 ; 3 pointers (more likely value) add hl,sp ; ld sp,hl ; ld (exitsp),sp ; ELSE ; ld hl,-64 ; 32 pointers (ANSI standard) add hl,sp ; ld sp,hl ; ld (exitsp),sp ; ENDIF LIB fputc_cons ld hl,12 push hl call fputc_cons pop hl IF DEFINED_GRAYlib IF DEFINED_GimmeSpeed INCLUDE "#gray83pSE.asm" ; 15MHz grayscale interrupt ELSE INCLUDE "#gray83p.asm" ; 6MHz grayscale interrupt ENDIF ELSE INCLUDE "#intwrap83p.asm" ; Interrupt Wrapper ENDIF im 2 ; enable IM2 interrupt call _main ; call main() .cleanup ; exit() jumps to this point ld iy,_IY_TABLE ; Restore flag pointer im 1 ; IF DEFINED_GimmeSpeed ; xor a ; Switch to 6MHz (normal speed) rst 28 ; bcall(SetExSpeed) defw SetExSpeed ; ENDIF ; .start1 ld sp,0 ; Restore SP IF TSE ; TSE Kernel call _tseForceYield ; Task-switch back to shell (can return...) jp start ; begin again if needed... ENDIF ; .tiei ei ; IF DEFINED_GRAYlib ; .cpygraph ; ENDIF ; .tidi ret ; ;---------------------------------------- ; End of startup part, routines following ;---------------------------------------- .l_dcal jp (hl) ; used as "call (hl)" ; Now, define some values for stdin, stdout, stderr IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND .__sgoioblk INCLUDE "#stdio_fp.asm" ENDIF ; Now, which of the vfprintf routines do we need? IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND IF DEFINED_floatstdio ._vfprintf LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio ._vfprintf LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio ._vfprintf LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; mem stuff .base_graphics defw plotSScreen .coords defw 0 IF !DEFINED_GRAYlib IF DEFINED_GimmeSpeed .cpygraph call $50 ; bjump(GrBufCpy) defw GrBufCpy ; FastCopy is far too fast at 15MHz... ELSE IF Ion defc cpygraph = $966E+80+15 ; Ion FastCopy call ENDIF IF MirageOS defc cpygraph = $4092 ; MirageOS FastCopy call ENDIF IF TSE defc cpygraph = $8A3A+18 ; TSE FastCopy call ENDIF IF ASM .cpygraph ;(ion)FastCopy from Joe Wingbermuehle di ld a,$80 ; 7 out ($10),a ; 11 ld hl,plotSScreen-12-(-(12*64)+1) ; 10 ld a,$20 ; 7 ld c,a ; 4 inc hl ; 6 waste dec hl ; 6 waste fastCopyAgain: ld b,64 ; 7 inc c ; 4 ld de,-(12*64)+1 ; 10 out ($10),a ; 11 add hl,de ; 11 ld de,10 ; 10 fastCopyLoop: add hl,de ; 11 inc hl ; 6 waste inc hl ; 6 waste inc de ; 6 ld a,(hl) ; 7 out ($11),a ; 11 dec de ; 6 djnz fastCopyLoop ; 13/8 ld a,c ; 4 cp $2B+1 ; 7 jr nz,fastCopyAgain ; 10/1 ret ; 10 ENDIF ENDIF ENDIF IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/ti83p_crt0.opt0000644000175000017500000000003407224335500015672 0ustar tygrystygrys INCLUDE "#ti83p_crt0.asm" z88dk-1.8.ds1/lib/ti83papp.asm0000644000175000017500000001506410640546530015435 0ustar tygrystygrys; Cerberus Application Header (Ti83+[SE] App) ; ; hjp - 28 june 2001 - First (clumsy) attempt to write a header-file ; hjp - 29 june 2001 - Fixed/added things ; hjp - 3 july 2001 - Straightened up some things for grayscale ; hjp - 13 july 2001 - Reshaped variable initialisation (clears statvars now) MODULE Ti83plus_App_crt0 DEFINE TI83PLUSAPP ;Used by grayscale interrupt and the such XREF _main ; No matter what set up we have, main is ; always, always external to this file. XDEF cleanup ; used by exit() XDEF l_dcal ; used by calculated calls = "call (hl)" XDEF _std_seed ; Integer rnd seed XDEF _vfprintf ; vprintf is internal to this file so we ; only ever include one of the set of ; routines XDEF exitsp ; Exit variables XDEF exitcount ; XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ; For stdin, stdout, stder XDEF base_graphics ; Graphics stuff XDEF coords ; XDEF cpygraph ; TI calc specific stuff XDEF tidi ; XDEF tiei ; ;------------------------------ ; Begin of Application header: ;------------------------------ INCLUDE "#Ti83p.def" ; ROM / RAM adresses on Ti83+[SE] INCLUDE "zcc_opt.def" ;Get compiler defines org $4000 DEFB $80,$0F ;Field: Program length DEFB $00,$00,$00,$00 ;Length=0 (N/A for unsigned apps) DEFB $80,$12 ;Field: Program type DEFB $01,$04 ;Type = Freeware, 0104 DEFB $80,$21 ;Field: App ID DEFB $01 ;Id = 1 DEFB $80,$31 ;Field: App Build DEFB $01 ;Build = 1 DEFB $80,$48 ;Field: App Name .beginname DEFINE NEED_AppName INCLUDE "zcc_opt.def" UNDEFINE NEED_AppName .endname0 IF !DEFINED_NEED_AppName | ((endname0-beginname)=0) DEFS "TI83+APP" ;App Name (Needs to be 8 bytes) ENDIF .endname DEFINE NameLength = (endname-beginname) IF NameLength < 2 ; Padd spaces if not 8 bytes... (horrible) defm '' ENDIF IF NameLength < 3 defm '' ENDIF IF NameLength < 4 defm '' ENDIF IF NameLength < 5 defm '' ENDIF IF NameLength < 6 defm '' ENDIF IF NameLength < 7 defm '' ENDIF IF NameLength < 8 defm '' ENDIF DEFB $80,$81 ;Field: App Pages DEFB $01 ;App Pages = 1 DEFB $80,$90 ;No default splash screen DEFB $03,$26,$09,$04 ;Field: Date stamp = DEFB $04,$6f,$1b,$80 ;5/12/1999 DEFB $02, $0d, $40 ;Dummy encrypted TI date stamp signature DEFB $a1, $6b, $99, $f6 DEFB $59, $bc, $67, $f5 DEFB $85, $9c, $09, $6c DEFB $0f, $b4, $03, $9b DEFB $c9, $03, $32, $2c DEFB $e0, $03, $20, $e3 DEFB $2c, $f4, $2d, $73 DEFB $b4, $27, $c4, $a0 DEFB $72, $54, $b9, $ea DEFB $7c, $3b, $aa, $16 DEFB $f6, $77, $83, $7a DEFB $ee, $1a, $d4, $42 DEFB $4c, $6b, $8b, $13 DEFB $1f, $bb, $93, $8b DEFB $fc, $19, $1c, $3c DEFB $ec, $4d, $e5, $75 DEFB $80,$7F ;Field: Program Image length DEFB 0,0,0,0 ;Length=0, N/A DEFB 0,0,0,0 ;Reserved DEFB 0,0,0,0 ;Reserved DEFB 0,0,0,0 ;Reserved DEFB 0,0,0,0 ;Reserved ;-------------------------------------- ; End of header, begin of startup part ;-------------------------------------- .start IF DEFINED_GimmeSpeed ; ld a,1 ; switch to 15MHz (extra fast) rst 28 ; bcall(SetExSpeed) defw SetExSpeed ; ENDIF ; rst $28 ; B_CALL(DelRes), we use the statvars-area, DEFW DelRes ; Cerberus needs to know it's invalid now... ; ld hl,statvars ; Clear statvars ld (hl),0 ; ld d,h ; ld e,l ; inc de ; ld bc,530 ; 531-1 bytes ldir ; IF !DEFINED_atexit ; Less stack use ld hl,-6 ; 3 pointers (more likely value) add hl,sp ; ld sp,hl ; ld (exitsp),sp ; ELSE ; ld hl,-64 ; 32 pointers (ANSI standard) add hl,sp ; ld sp,hl ; ld (exitsp),sp ; ENDIF ; ld hl,plotSScreen ; ld (base_graphics),hl IF DEFINED_GRAYlib ; ld (graybit1),hl ; ld hl,appBackUpScreen ld (graybit2),hl ; ENDIF ; ld hl,$8080 ; ld (fp_seed),hl ; LIB fputc_cons ld hl,12 push hl call fputc_cons pop hl IF DEFINED_GRAYlib IF DEFINED_GimmeSpeed INCLUDE "#gray83pSE.asm" ; 15MHz grayscale interrupt ELSE INCLUDE "#gray83p.asm" ; 6MHz grayscale interrupt ENDIF ENDIF im 2 ; call _main ; .cleanup ; ld iy,$89F0 ; Load IY (flags) with it's normal value im 1 ; IF DEFINED_GimmeSpeed ; xor a ; switch to 6MHz (normal speed) rst 28 ; bcall(SetExSpeed) defw SetExSpeed ; ENDIF ; call $50 ; B_JUMP(_jforcecmdnochar) DEFW _jforcecmdnochar; Exit back to Cerberus (TIOS) ;----------------------------------------- ; End of startup part, routines following ;----------------------------------------- .l_dcal jp (hl) ; used as "call (hl)" .tiei ei IF DEFINED_GRAYlib .cpygraph ENDIF .tidi ret ; Now, which of the vfprintf routines do we need? IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND IF DEFINED_floatstdio ._vfprintf LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio ._vfprintf LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio ._vfprintf LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ENDIF IF !DEFINED_GRAYlib .cpygraph call $50 ; B_JUMP(GrBufCpy) defw GrBufCpy ; Since we don't have any shellsupport... ENDIF ; plus this is safe for possible ; Ti83+ Silver Edition at 15MHz IF NEED_floatpack INCLUDE "#float.asm" ENDIF defc intuse = IntProcEnd-IntProcStart DEFVARS $8A3A ; statVars (531 bytes of free space) See graylib83p.asm { ; for more info on free space in this memory area. __sgoioblk ds.b 40 ; 40 bytes = 4 bytes * 10 handles coords ds.w 1 ; 2 bytes base_graphics ds.w 1 ; 2 bytes gfx_bank ds.w 1 ; 2 bytes _std_seed ds.w 1 ; 2 bytes exitsp ds.w 1 ; 2 bytes exitcount ds.b 1 ; 1 byte fp_seed ;not used... ds.w 3 ; 6 bytes extra ds.w 3 ; 6 bytes fa ds.w 3 ; 6 bytes fasign ds.b 1 ; 1 byte heapblocks ds.w 1 ; 2 bytes heaplast ds.w 1 ; 2 bytes hl1save ds.w 1 ; 2 bytes de1save ds.w 1 ; 2 bytes bc1save ds.w 1 ; 2 bytes iysave ds.w 1 ; 2 bytes ; total 80 bytes ;------------------------------------------------------------------------------ ; !!!BIG TROUBLE!!! ; Grayscale interrupt is 125/130 bytes now, that won't fit into ; the [max] 118 bytes free here... ; (intwrapper is 44 bytes, so that does fit) ;------------------------------------------------------------------------------ jp_intprocstart ; $8A8A / $8xxx ds.b intuse ; xx bytes used by interrupt routine freestatvarsA: ds.b 113-intuse intcount ds.b 1 ; 1 byte used by interrupt routine graybit1 ds.w 1 ; 2 bytes used by interrupt routine graybit2 ds.w 1 ; 2 bytes used by interrupt routine IV_table ; $8B00 / $8C00 ds.b 256 ;256 bytes used by interrupt routine freestatvarsB: ; $8C01 / $8C4D ds.b 77 ; 77 bytes free } ENDIF z88dk-1.8.ds1/lib/Ti85.def0000644000175000017500000001054407455120417014474 0ustar tygrystygrys;------------------------------- ; Some DEFC's needed by the code ;------------------------------- defc PROGRAM_ADDR = $8C3C ; defc ROM_VERS = $8C3E ; ;zshell stuff defc ZSHELL_VER = $8C3F ; We don't use zshell BTW... defc ZS_BITS = $8C40 ; ;USGard stuff defc USG_VER = $8C3F ; We don't use USGard BTW... defc USG_BITS = $8C40 ; defc ORGSP = $8E8B ; defc USGSHELL = $8EA2 ; defc VATName = $8EAB ; defc DEST_ADDR = $8EB4 ; defc PAGE1ADDR = $8EB4 ; defc PAGE2ADDR = $8EB6 ; defc PROG_BYTE = $8C08 ; ;SuperNova Stuff (???) defc SNOVA_VER = $8C3F ; We don't use SuperNova BTW... defc SN_BITS = $8C40 ; defc VAT_NAME = $8C68 ; defc VAT_TYPE = $8C71 ; defc VAT_SIZE = $8C72 ; defc PLUGIN_CALL = $8CE4 ; defc IFACE = $8D7B ; defc PROG_NUM = $8D81 ; defc SEARCH_START = $8D83 ; defc SEARCH_COUNT = $8D85 ; defc FOUND_ADDR = $8D87 ; defc IFACE_MEM = $8D9C ; defc ERROR_CALL = $8C67 ; defc STRING_COMP = $8CA1 ; defc SEARCH_VAT = $8C74 ; defc SEARCH_VAR = $8CB3 ; ;defc GET_KEY = $8CE0 ; defc CURR_ADDR = $8CE7 ; defc RUN_IT = $8D89 ; defc REFRESH = $8EE2 ; defc LD_HL_MHL = $0033 ; defc CP_HL_DE = $008E ; defc UNPACK_HL = $009A ; defc READ_KEYPAD = $01A2 ; defc STORE_KEY = $01B1 ; defc GET_KEY = $01BE ; ;defc GET_KEY2 = $01BE ; defc UPDATE_APD = $0115 ; defc READ_KEY = $0168 ; ;rom_call() stuff (zshell and SuperNova) defc TX_CHARPUT = $0000 ; defc D_LT_STR = $0001 ; defc M_CHARPUT = $0002 ; defc D_ZM_STR = $0003 ; defc D_LM_STR = $0004 ; defc GET_T_CUR = $0005 ; defc SCROLL_UP = $0006 ; defc TR_CHARPUT = $0007 ; defc CLEARLCD = $0008 ; defc D_HL_DECI = $0009 ; defc CLEARTEXT = $000A ; defc D_ZT_STR = $000B ; defc BUSY_OFF = $000C ; defc BUSY_ON = $000D ; defc FIND_PIXEL = $0080 ; defc RANDOMIZE = $000E ; defc D_STR_HL = $000F ; defc CL_ENDLINE = $0010 ; defc RESET_RAND = $0011 ; defc HLX10 = $0040 ; defc ZERO_BYTES = $0041 ; defc MULT_HL = $0042 ; defc MSR_STRLN = $0043 ; defc LNSTR_COMP = $0044 ; ;USGard rcall_() stuff ;defc TX_CHARPUT = $8C41 ;defc D_LT_STR = $8C44 ;defc M_CHARPUT = $8C47 ;defc D_ZM_STR = $8C4A ;defc D_LM_STR = $8C4D ;defc SCROLL_UP = $8C50 ;defc TR_CHARPUT = $8C53 ;defc CLEARLCD = $8C56 ;defc D_HL_DECI = $8C59 ;defc CLEARTEXT = $8C5C ;defc D_ZT_STR = $8C5F ;defc BUSY_OFF = $8C62 ;defc BUSY_ON = $8C65 ;defc RANDOM = $8C68 ;defc FIND_PIXEL = $8C6B ;defc FREEMEM = $8C77 ;defc VAR_LENGTH = $8C7A ;defc ASCIIZ_LEN = $8C7D ;defc NEG_BC = $8C80 ;defc MUL_HL = $8C83 ;defc COPY_STRING = $8C8C ;defc INT_INSTALL = $8C9B ;defc INT_REMOVE = $8C9E ;defc INT_CLEAN = $8CA1 ;defc APPEND = $8C95 ;defc UNAPPEND = $8C98 ;defc CHECK_APPEND = $8CCB ;defc VAR_NEW = $8CA4 ;defc VAR_DELETE = $8CA7 ;defc VAR_EXEC = $8CAA ;defc VAR_GET = $8CAD ;defc VAR_RESIZE = $8CB0 ;defc RELOC = $8CCE ;defc DERELOC = $8CD1 ;defc RELOC_TAB = $8CD7 ;defc SEARCH_VAT = $8CB3 ;defc OTH_SHUTDOWN = $8CB6 ;defc DM_HL_DECI = $8CB9 ;defc OTH_PAUSE = $8CBC ;defc OTH_CLEAR = $8CBF ;defc OTH_EXIT = $8CC2 ;defc OTH_ARROW = $8CC5 ;defc OTH_FILL = $8CD4 ;Memory adresses defc KEY_0 = $8000 ; defc KEY_1 = $8001 ; defc KEY_2 = $8002 ; defc KEY_STAT = $8004 ; defc LAST_KEY = $8006 ; defc CONTRAST = $8007 ; defc CURSOR_ROW = $800C ; defc CURSOR_COL = $800D ; defc CURSOR_ROW2 = $800C ; defc CURSOR_COL2 = $800D ; defc CURSOR_LET = $800E ; defc BUSY_COUNTER = $8080 ; defc BUSY_BITMAP = $8081 ; defc OP1 = $8082 ; defc OP2 = $808D ; defc OP3 = $8098 ; defc OP4 = $80A3 ; defc OP5 = $80AE ; defc OP6 = $80B9 ; defc CURR_INPUT = $80C6 ; defc BYTES_USED = $80CC ; defc TEXT_MEM = $80DF ; defc DELC_LEN = $800F ; defc DELC = $8010 ; defc CHECKSUM = $81BE ; defc TEMP_STORAGE = $827C ; defc CURSOR_X = $8333 ; defc CURSOR_Y = $8334 ; defc _IY_TABLE = $8346 ; Where IY normaly points to defc GRAPH_MEM = $8641 ; defc TEXT_MEM2 = $8A6B ; defc USER_MEM = $8B1B ; defc SCROLL_START = $8B2F ; defc SCROLL_END = $8B30 ; defc FIXED_POINT = $8B3A ; defc FIRST_FREE = $8BE1 ; defc VAT_END = $8BEB ; defc VAT_START = $FA6F ; defc VIDEO_MEM = $FC00 ; z88dk-1.8.ds1/lib/ti85_crt0.asm0000644000175000017500000001702710640546530015507 0ustar tygrystygrys; Stub for the TI 85 calculator ; ; Stefano Bodrato - Dec 2000 ; ; $Id: ti85_crt0.asm,v 1.20 2007/06/27 20:49:28 dom Exp $ ; ;----------------------------------------------------- ; Some general XDEFs and XREFs needed by the assembler ;----------------------------------------------------- MODULE Ti85_crt0 XREF _main ; No matter what set up we have, main is ; always, always external to this file. XDEF cleanup ; used by exit() XDEF l_dcal ; used by calculated calls = "call (hl)" XDEF _std_seed ; Integer rnd seed XDEF _vfprintf ; vprintf is internal to this file so we ; only ever include one of the set of ; routines XDEF exitsp ; Exit variables XDEF exitcount ; XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ; For stdin, stdout, stder XDEF base_graphics ; Graphics stuff XDEF coords ; XDEF snd_tick ; Sound variable XDEF cpygraph ; TI calc specific stuff XDEF tidi ; XDEF tiei ; ;------------------------- ; Begin of (shell) headers ;------------------------- LSTOFF INCLUDE "#Ti85.def" ; ROM / RAM adresses on Ti85 INCLUDE "zcc_opt.def" ; Receive all compiler-defines LSTON ; ;PROGRAMS: ;~~~~~~~~~ ; 00 FD - ZShell programs ; 00 FC - Rigel program string ; 00 FB - Usgard 1.0 programs ; 00 F9 - Usgard 1.1 programs ; 00 F8 - Usgard 1.5 programs ; 00 53 - Summit Shell Patch (BETA 1-3) ; 00 50 - PhatOS ; 02 50 - Peak BETA 2 Relocation Program ; 02 70 - Peak BETA 2 Non-Relocation Program ; 04 42 - Summit BETA 4 TI-BASIC ASM Subroutine ; 04 4E - Summit BETA 4 Non-Relocation Program ; 04 52 - Summit BETA 4 Relocation Program ; 04 54 - Summit BETA 4 TSR ; ;LIST OF LIBRARY HEADERS: ;~~~~~~~~~~~~~~~~~~~~~~~~ ; 00 FB - Rigel library string ; 00 90 - fake library ; ;LIST OF FILE HEADERS: ;~~~~~~~~~~~~~~~~~~~~~ ; 00 81 - GCP image (screenwide) ; 00 80 - ZCP image (screenwide) ; 00 7D - 128 x 64 B/W image ; 00 7E - 128 x 64 GR4 image ; 00 7F - 128 x 64 GR8 image ; ;LIST OF LEVEL HEADERS: ;~~~~~~~~~~~~~~~~~~~~~~ ;(first byte=game,second byte could be [save game,level,hiscore,...] ; 01 00 - Plainjump II level file ; 02 00 - Sqrxz world (not compressed) ; 02 01 - Sqrxz compressed world ; 03 00 - Plainjump level file ; 04 00 - Balloon compressed level file ; Offset Example Description ; ; 0000-0001 xx xx - A two-byte size of the string. This is added ; by the TI-85. ; 0002-0003 00 xx - A signature word, where xx is either FD, FC, ; or FB. ; FD = ZShell 4.0 string. ; FC = Rigel program string. ; FB = Rigel library string. ; 0004 xx - The size of the description string. ; xxxx-xxxx - The description string (null terminated). ; xxxx-xxxx xx xx - A relative pointer to the fixup table. (not ; used in ZShell). ; ; BELOW ARE DATA AREAS WITHIN THE FIXUP TABLE ; ; xxxx xx - The number of location fixups. ; xxxx-xxxx - The relative addresses within the string ; that need to be fixed up. ; xxxx xx - The number of libraries to be linked. ; xxxx-xxxx - A length-indexed string of the first library ; to be linked. ; xxxx xx - the number of fixups to be made to call ; functions within the preceding library or ; more clearly, the number of calls made to ; the preceding library. ; xxxx-xxxx - The relative addresses within the string ; that need to be fixed up to make calls to the ; preceding library. ; ; (if more than one library is to be linked, the last three ranges described ; are repeated as necessary. The "number of libraries" byte denotes this). ; ;-------- ;2 - Peak ;-------- ;IF (startup=2) ;DEFINE NOT_DEFAULT_SHELL ;DEFC ORIGIN = $906D ; org ORIGIN ; defb $02,$50 ;ENDIF ;---------- ;3 - PhatOS (doesn't work right) ;---------- IF (startup=3) DEFINE PhatOS DEFINE NOT_DEFAULT_SHELL org $8E54 ; 'real' origin to PhatOS programs defw $5000 ; This is a PhatOS program string defb enddesc-description+1 ;org $8E57 ; Origin to PhatOS programs .description DEFINE NEED_name INCLUDE "zcc_opt.def" ; Get namestring from zcc_opt.def UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ; Termination zero .enddesc im 1 ENDIF ;------------------- ;1 - Rigel (default) ;------------------- IF !NOT_DEFAULT_SHELL DEFINE Rigel org $9293 ; 'real' origin to Rigel programs defw $FC00 ; This is a Rigel program string defb enddesc-description-1 .description ; = "official" origin adress DEFINE NEED_name INCLUDE "zcc_opt.def" ; Get namestring from zcc_opt.def UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ; Termination zero .enddesc defw fixuptable-description ; Relative ptr to the fixup table im 1 ENDIF ;------------------------------------- ; End of header, begin of startup part ;------------------------------------- .start ld (start1+1),sp IF !DEFINED_atexit ; Less stack use ld hl,-6 ; 3 pointers (more likely value) add hl,sp ld sp,hl ld (exitsp),sp ELSE ld hl,-64 ; 32 pointers (ANSI standard) add hl,sp ld sp,hl ld (exitsp),sp ENDIF LIB fputc_cons ld hl,12 push hl call fputc_cons pop hl IF DEFINED_GRAYlib INCLUDE "#gray85.asm" ;im 2 ENDIF call tidi call _main .cleanup IF DEFINED_GRAYlib ld a,$3c out (0),a ;Set screen back to normal ENDIF .start1 ld sp,0 ld iy,_IY_TABLE ; Restore flag-pointer im 2 ei .cpygraph ret ;---------------------------------------- ; End of startup part, routines following ;---------------------------------------- .l_dcal jp (hl) .tiei ;exx ;ld hl,(hl1save) ;ld bc,(bc1save) ;ld de,(de1save) ;exx ;ld iy,(iysave) IF DEFINED_GRAYlib im 1 ELSE ei ENDIF ret .tidi IF DEFINED_GRAYlib im 2 ELSE di ENDIF ;exx ;ld (hl1save),hl ;ld (bc1save),bc ;ld (de1save),de ;exx ;ld (iysave),iy ret ;.hl1save defw 0 ;.de1save defw 0 ;.bc1save defw 0 ;.iysave defw 0 ; Now, define some values for stdin, stdout, stderr IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND .__sgoioblk INCLUDE "#stdio_fp.asm" ENDIF ; Now, which of the vfprintf routines do we need? IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND IF DEFINED_floatstdio ._vfprintf LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio ._vfprintf LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio ._vfprintf LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ENDIF IF Rigel .fixuptable defb 0,0 ; zero fixups, zero ZShell libs ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; mem stuff .base_graphics defw VIDEO_MEM .coords defw 0 IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/ti85_crt0.opt0000644000175000017500000000003307240553473015524 0ustar tygrystygrys INCLUDE "#ti85_crt0.asm" z88dk-1.8.ds1/lib/Ti86.def0000644000175000017500000013140307455120417014473 0ustar tygrystygrysdefc _ldhlind = $4010 defc _chkON = $4028 defc _bitgrffuncm = $402C defc _bitgrfpolarm = $4030 defc _bitgrfparamm = $4034 defc _bitgrfrecurm = $4038 defc _cphlde = $403C defc _put_colon = $4040 defc _divHLby10 = $4044 defc _divHLbyA = $4048 defc _divAHLby10 = $404C defc _timeout = $4058 defc _resetAPD = $4060 defc _scan_code = $4064 defc _get_key = $4068 defc _jforcecmdnochar = $409C defc _pPutAwayPrompt = $40B5 defc _call_cxPPutAway = $40BD defc _call_cxPutAway = $40C1 defc _call_cxSizeWind = $40C5 defc _call_cxErrorEP = $40C9 defc _call_cxMain = $40CD defc _cxNull = $40D1 defc _p_cxNull = $40D2 defc _err_handler = $40DD defc _set_cx_100 = $40E1 defc _set_cx_50 = $40E5 defc _set_cx_dec = $40E9 defc _set_context = $40ED defc _off = $4101 defc _reset = $4109 defc _removTok = $4119 defc _errAxes = $412D defc _errFldOrder = $4130 defc _errStatPlot = $4133 defc _errOverflow = $4136 defc _errDivBy0 = $4139 defc _errSingularMat = $413c defc _errDomain = $413f defc _errIncrement = $4142 defc _errSyntax = $4145 defc _errNumberBase = $4148 defc _errMode = $414B defc _errDataType = $414e defc _errArgument = $4151 defc _errDimMismatch = $4154 defc _errDimension = $4157 defc _errUndefined = $415A defc _errReserved = $4169 defc _errInvalid = $416c defc _errIllegalNest = $416f defc _errBound = $4172 defc _errGraphWindow = $4175 defc _errZoom = $4178 defc _errBreak = $417b defc _errStat = $417e defc _errConversion = $4181 defc _errSolver = $4184 defc _errIterations = $4187 defc _errBadGuess = $418a defc _errDifEqSetup = $418d defc _errPoly = $4190 defc _errTolNotMet = $4193 defc _errLink = $4196 defc _errorA = $4199 defc _error = $419C defc _instError = $41A1 defc _removError = $41A4 defc _ld_de_fp0 = $41B7 defc _ld_de_fp1 = $41BB defc _mulHL10 = $41BF defc _ckop1cplx = $41C3 defc _ckcplx = $41C7 defc _ckop1real = $41CB defc _cpop1op2 = $41FB defc _op3toop4 = $4203 defc _op1toop4 = $4207 defc _op2toop4 = $420B defc _movtoop4 = $420F defc _op4toop2 = $4213 defc _op4toop3 = $4217 defc _op3toop2 = $421B defc _op1toop3 = $421F defc _movfrop1 = $4223 defc _op5toop2 = $4227 defc _op5toop6 = $422B defc _op5toop4 = $422F defc _op1toop2 = $4233 defc _movtoop2 = $4237 defc _op6toop2 = $423B defc _op6toop1 = $423F defc _op4toop1 = $4243 defc _op5toop1 = $4247 defc _op3toop1 = $424B defc _op4toop5 = $424F defc _op3toop5 = $4253 defc _op2toop5 = $4257 defc _movtoop5 = $425B defc _op2toop6 = $425F defc _op1toop6 = $4263 defc _movtoop6 = $4267 defc _op1toop5 = $426B defc _op2toop1 = $426F defc _movtoop1 = $4273 defc _mov11b = $4277 defc _mov10b = $427B defc _mov9b = $427F defc _mov9b_ = $4283 defc _mov8b = $4287 defc _mov7b = $428B defc _mov7b_ = $428F defc _mov6b = $4293 defc _mov5b = $4297 defc _mov4b = $429B defc _mov3b = $429F defc _mov2b = $42A3 defc _op4toop2m = $42A7 defc _op2toop3 = $42CB defc _movtoop3 = $42CF defc _op4toop6 = $42D3 defc _mov10toop1 = $42D7 defc _mov10toop1op2 = $42DB defc _mov10toop2 = $42DF defc _movfroop1 = $42E3 defc _op4set1 = $42E7 defc _op3set1 = $42EB defc _op2set8 = $42EF defc _op2set5 = $42F7 defc _op2set4 = $42FB defc _op2set3 = $4303 defc _op1set1 = $430F defc _op1set4 = $4313 defc _op1set3 = $4317 defc _op3set2 = $431B defc _op1set2 = $431F defc _op2set2 = $4323 defc _op2set1 = $432F defc _ld_hl_8z = $4343 defc _ld_hl_8a = $4347 defc _ld_hlplus1_7a = $434B defc _ld_hl_7a = $434F defc _op4set0 = $4353 defc _op3set0 = $4357 defc _op2set0 = $435B defc _op1set0 = $435F defc _ld_hl_fp0 = $4363 defc _zeroop1m = $4367 defc _zeroop1 = $436B defc _zeroop2 = $436F defc _zeroop3 = $4373 defc _ld_hl_11z = $4377 defc _ld_hl_bz = $437B defc _shracc = $4383 defc _shlacc = $438B defc _ex_op2_op6 = $446F defc _ex_op5_op6 = $4473 defc _ex_op1_op5 = $4477 defc _ex_op1_op6 = $447B defc _ex_op2_op4 = $447F defc _ex_op2_op5 = $4483 defc _ex_op1_op3 = $4487 defc _ex_op1_op4 = $448B defc _ex_op1_op2 = $448F defc _ckop1fp0 = $449B defc _ckop2fp0 = $44A3 defc _ckop1int = $44B3 defc _ckint = $44B7 defc _ckop1odd = $44BB defc _ckodd = $44BF defc _ckop2pos = $450B defc _ckop1pos = $450F defc _absop2 = $4513 defc _inco1exp = $4527 defc _HtimesL = $4547 defc _findsym_error = $458F defc _invsub = $45E3 defc _PLUS1 = $45EB defc _inc_ptr_ade = $45EF defc _ex_ahl_bde = $45F3 defc _get_size_word = $460B defc _setXXop1 = $4613 defc _setXXop2 = $4617 defc _setXXXXop2 = $461B defc _load_ram_ahl = $462F defc _conv_ahl = $4633 defc _inc_ptr_ahl = $4637 defc _dec_ptr_ahl = $463B defc _inc_ptr_bde = $463F defc _dec_ptr_bde = $4643 defc _set_abs_src_addr = $4647 defc _get_free_mem = $464B defc _set_mm_num_bytes = $464F defc _round_OP1 = $4657 defc _check_asm = $46AF defc _jump_table = $46B7 defc _memchk = $46BB defc _dec_ptr_ade = $46BF defc _getb_ahl = $46C3 defc _cp_ahl_bde = $46C7 defc _findsym = $46CB defc _copy_fwd = $46D3 defc _del_temp_vars = $46D7 defc _createreal = $46EB defc _createrconst = $46EF defc _createcconst = $46F3 defc _createcplx = $46F7 defc _creatervect_temp = $46FB defc _creatervect = $46FF defc _createcvect_temp = $4703 defc _createcvect = $4707 defc _createrlist_temp = $470B defc _createrlist = $470F defc _createclist_temp = $4713 defc _createclist = $4717 defc _creatermat_temp = $471B defc _creatermat = $471F defc _createcmat_temp = $4723 defc _createcmat = $4727 defc _createstrng_temp = $472B defc _createstrng = $472F defc _createequ_temp = $4733 defc _createequ = $4737 defc _createpict = $473B defc _createprog = $474F defc _copy_bkwd = $475B defc _delvar = $475F defc _update_VAT_ptrs = $476F defc _get_size = $477B defc _get_var_size = $477F defc _push_bc_OPS = $4783 defc _check_STACK_mem = $4787 defc _pop_bc_OPS = $478B defc _push_a_OPS = $478F defc _pop_a_OPS = $4793 defc _popop1 = $479F defc _poprealo6 = $47A3 defc _poprealo5 = $47A7 defc _poprealo4 = $47AB defc _poprealo3 = $47AF defc _poprealo2 = $47A3 defc _poprealo1 = $47A7 defc _sub_FPS_20 = $47CB defc _sub_FPS_10 = $47CF defc _sub_FPS_bc = $47D3 defc _deallocfps1 = $47DB defc _ram_page_1 = $47E3 defc _load_ram_OPS = $47E7 defc _load_ram_ES = $47EB defc _load_ram_FPS = $47EF defc _ram_page_7 = $47F3 defc _pushrealo1 = $4813 defc _cpyto2fpst = $4893 defc _cpyto1fpst = $4897 defc _cpyto2fps1 = $48AF defc _cpyto2fps2 = $48C3 defc _cpyo2tofpst = $48D7 defc _cpyo6tofpst = $48DB defc _cpyo1tofpst = $48DF defc _cpydetofpst = $48E3 defc _cpydetohlt = $48E7 defc _cpydetohlc = $48EB defc _cpyo5tofps2 = $48EF defc _cpyo2tofpsto1tofps1 = $48F3 defc _cpyo1tofps1 = $48F7 defc _cpydetofps1 = $48FB defc _cpydetohl1 = $48FF defc _cpyo2tofps2 = $4903 defc _cpyo3tofps2 = $4907 defc _cpyo6tofps2 = $490B defc _cpyo1tofps2 = $490F defc _cpydetofps2 = $4913 defc _cpydetohl2 = $4917 defc _cpyo5tofps3 = $491B defc _cpyo2tofps2o1tofps3 = $491F defc _cpyo1tofps3 = $4923 defc _cpydetofps3 = $4927 defc _cpydetohl3 = $492B defc _cpyo1tofps4 = $492F defc _cpydetofps4 = $4933 defc _cpydetohl4 = $4937 defc _cpyo1tofps6 = $493B defc _cpyo1tofps7 = $493F defc _cpyo1tofps8 = $4943 defc _ask_self_test = $494F defc _self_test = $4953 defc _strlen = $4957 defc _strcpy = $495B defc _strcat = $495F defc _strcmp = $4963 defc _find_bit = $496B defc _cursorOff = $498C defc _cursorOn = $4994 defc _reset_MATH = $49A0 defc _disp_GRAPH = $49B0 defc _flushallmenus = $49DC defc _disp_menu = $49E8 defc _exec_pg1 = $4A0A defc _putmap = $4A27 defc _putc = $4A2B defc _dispAHL = $4A33 defc _puts = $4A37 defc _putps = $4A3B defc _newline = $4A5F defc _clrLCD = $4A7E defc _clrScrn = $4A82 defc _clrWindow = $4A86 defc _clrLine = $4A8A defc _homeup = $4A95 defc _vputmap = $4AA1 defc _vputs = $4AA5 defc _vputsn = $4AA9 defc _runindicon = $4AAD defc _runindicoff = $4AB1 defc _clrText = $4AB5 defc _exec_pg2 = $4B1B defc _binopexec1 = $4B1F defc _tofrac = $4B93 defc _gfudydx = $4B9F defc _INTOP1 = $4C2F defc _ahl_plus_2_pg3 = $4C3F defc _exec_basic = $4C47 defc _stoAns = $4C9F defc _stoY = $4CB3 defc _stoX = $4CBB defc _stoOther = $4CBF defc _rclY = $4CDF defc _rclX = $4CE3 defc _rclVarSym = $4CE7 defc _get_token = $4D13 defc _get_varname = $4D1B defc _disp = $4D3F defc _pause = $4D43 defc _PDspGrph = $4D6F defc _horizCmd = $4D73 defc _vertCmd = $4D77 defc _unpack_hex = $4DAF defc _grbufcpy = $4E39 defc _ILine = $4E51 defc _IPoint = $4E59 defc _geqnamea = $4E71 defc _set_app_title = $4FA8 defc _FindAlphaUp = $514B defc _FindAlphaDn = $514F defc _dispOP1 = $515B defc _dispDone = $515F defc _formReal = $5191 defc _CLine = $51E9 defc _get_abs_src_addr = $5209 defc _get_word_ahl = $521D defc _set_word_ahl = $5221 defc _abs_mov10toop1 = $5235 defc _abs_mov10toop1_noset = $5239 defc _abs_mov10b_set_d = $523D defc _abs_mov10b = $5249 defc _abs_movfrop1_set_d = $5241 defc _abs_movfrop1 = $5245 defc _set_abs_dest_addr = $5285 defc _RcPicGrph = $52B5 defc _mm_ldir = $52ED defc _mm_lddr = $52F1 defc _get_statvar = $5369 defc _getky = $5371 defc _low_battery = $5398 defc _mov10op2add = $5464 defc _INTGR = $5468 defc _MINUS1 = $5470 defc _FPSUB = $5474 defc _FPADD = $5478 defc _TIMESPT5 = $5484 defc _FPSQUARE = $5488 defc _FPMULT = $548C defc _invop1op2 = $5490 defc _invop1s = $5494 defc _invop2s = $5498 defc _FRAC = $549C defc _FPRECIP = $54A4 defc _FPDIV = $54A8 defc _SQROOT = $54AC defc _SQROOTP = $54B0 defc _RNDGUARD = $54BC defc _ROUND = $54C0 defc _LNX = $54C4 defc _LNXP = $54C8 defc _LOGXP = $54CC defc _LOGX = $54D0 defc _ETOX = $54D4 defc _TENX = $54D8 defc _SIN = $54E0 defc _COS = $54E4 defc _TAN = $54E8 defc _TANH = $54F0 defc _COSH = $54F4 defc _SINH = $54F8 defc _ACOS = $5508 defc _ACOSP = $550C defc _ATAN = $5510 defc _ASIN = $5514 defc _ATANH = $551C defc _ASINH = $5524 defc _ACOSH = $5528 defc _YTOX = $5538 defc _randint = $5544 defc _writeb_inc_ahl = $5567 defc _convop1 = $5577 defc _set_mode = $557B defc _asmComp = $55a3 defc _getkey = $55AA defc _random = $55DA defc _vputspace = $5643 defc _get_char = $569D defc _get_vchar = $56A1 defc _call_user_on = $56EA defc _call_user_off = $56ED defc _call_sqrtexpr = $56F0 defc _call_sqrtparse = $56F3 defc _call_sqrtexec = $56F6 defc _call_sqrtform = $56F9 defc _call_sqrtcmdtok = $56FC defc _call_sqrthome = $56FF defc _call_sqrtkey = $5702 defc _call_sqrtgrf = $5705 defc _exec_pg4 = $5718 defc _exec_pg3 = $5714 defc _linkExec = $571C defc _exec_assembly = $5730 defc _errNoSignChng = $5732 defc _instTok = $575C defc _RAMStart = $C000 defc _kbdScanCode = $C000 defc _kbdLGSC = $C001 defc _kbdPSC = $C002 defc _kbdWUR = $C003 defc _kbdDebncCnt = $C004 defc _kbdkey = $C005 defc _kbdGetKy = $C006 defc _keyextend = $C007 defc _contrast = $C008 defc _APDSubTimer = $C009 defc _APDTimer = $C00A defc _APDWarmUp = $C00B defc _viet = $C00C defc _curTime = $C00E defc _curRow = $C00F defc _curCol = $C010 defc _curUnder = $C011 defc _undelBufLen = $C012 defc _undelBuf = $C013 defc _P_tokVarPtr = $C077 defc _toklen = $C07A defc _TOK_B3 = $C07C defc _DETOK_H3 = $C07D defc _MEMPRE_H3 = $C07E defc _indicMem = $C07F defc _indicCounter = $C087 defc _indicBusy = $C088 defc _OP1 = $C089 defc _OP1EXPM = $C08A defc _OP1EXPL = $C08B defc _OP1M = $C08C defc _OP1EXT = $C093 defc _LOGKP = $C094 defc _OP2 = $C094 defc _OP2EXPM = $C095 defc _OP2EXPL = $C096 defc _OP2M = $C097 defc _OP2EXT = $C09E defc _OP3 = $C09F defc _LOGKM = $C09F defc _OP3EXPM = $C0A0 defc _OP3EXPL = $C0A1 defc _OP3M = $C0A2 defc _OP3EXT = $C0A9 defc _CORDFLG1 = $C0AA defc _OP4 = $C0AA defc _OP4EXPM = $C0AB defc _OP4EXPL = $C0AC defc _OP4M = $C0AD defc _OP4EXT = $C0B4 defc _EK = $C0B5 defc _CORDFLG = $C0B5 defc _OP5 = $C0B5 defc _OP5EXPM = $C0B6 defc _SF = $C0B6 defc _EL = $C0B6 defc _OP5EXPL = $C0B7 defc _EM = $C0B7 defc _OP5M = $C0B8 defc _EMM1 = $C0B8 defc _EITS = $C0B9 defc _ENM2 = $C0BA defc _ENA = $C0BB defc _EEN = $C0BC defc _OP5EXT = $C0BF defc _EN = $C0C0 defc _OP6 = $C0C0 defc _EJ = $C0C1 defc _OP6EXPM = $C0C1 defc _OP6EXPL = $C0C2 defc _EEI = $C0C2 defc _OP6M = $C0C3 defc _ELOW = $C0C5 defc _EIGH = $C0C6 defc _OP6EXT = $C0CA defc _OP7 = $C0CC defc _CPLXTRG = $C0D7 defc _IOFLAG = $C0D7 defc _P_IMATHPTR1 = $C0D8 defc _P_IMATHPTR2 = $C0DB defc _P_IMATHPTR3 = $C0DE defc _P_IMATHPTR4 = $C0E1 defc _P_IMATHPTR5 = $C0E4 defc _CHKDELPTR1 = $C0E7 defc _P_CHKDELPTR1 = $C0E7 defc _P_CHKDELPTR2 = $C0EA defc _P_INSDELPTR = $C0ED defc _P_UPDOWNPTR = $C0F0 defc _STDRNGSGN = $C0F3 defc _POLRNGSGN = $C0F4 defc _PARRNGSGN = $C0F5 defc _DIFRNDSGN = $C0F6 defc _USRRNGSGN = $C0F7 defc _STATSGN = $C0F8 defc _textShadow = $C0F9 defc _textShadCur = $C1A1 defc _textShadTop = $C1A3 defc _textShadAlph = $C1A4 defc _textShadIns = $C1A5 defc _textAccent = $C1A6 defc _cxMain = $C1A7 defc _cxPPutAway = $C1A9 defc _cxPutAway = $C1AB defc _cxRedisp = $C1AD defc _cxErrorEP = $C1AF defc _cxSizeWind = $C1B1 defc _cxPage = $C1B3 defc _CXCURAPP = $C1B4 defc _cxPrev = $C1B5 defc _monQH = $C1C4 defc _monQT = $C1C5 defc _monQueue = $C1C6 defc _onSP = $C1D6 defc _onCheckSum = $C1D8 defc _promptRow = $C1DA defc _promptCol = $C1DB defc _promptIns = $C1DC defc _promptShift = $C1DD defc _promptRet = $C1DE defc _promptValid = $C1E0 defc _P_promptTop = $C1E2 defc _P_promptCursor = $C1E5 defc _P_promptTail = $C1E8 defc _P_promptBtm = $C1EB defc _varType = $C1EE defc _varCurrent = $C1EF defc _varFAFlags = $C1F8 defc _varClass = $C1FA defc _catCurrent = $C1FB defc _menuActive = $C1FD defc _menu2Hilite = $C1FE defc _menuSingle = $C1FF defc _menuAppStack = $C201 defc _menuAppPtr = $C20D defc _menuAppDepth = $C20F defc _menuSysStack = $C210 defc _menuSysPtr = $C21C defc _menuSysDepth = $C21E defc _menuPrvStack = $C21F defc _menuPrvPtr = $C22B defc _menuPrvDepth = $C22D defc _m2i = $C22E defc _menuDyn1 = $C242 defc _menuDyn5 = $C26A defc _userMenu1 = $C274 defc _userMenuTitle = $C275 defc _userMenu2 = $C27C defc _userMenu3 = $C284 defc _userMenu4 = $C28C defc _userMenu5 = $C294 defc _userMenuSA = $C29C defc _XSTATSAV = $C31C defc _ioPrompt = $C324 defc _YSTATSAV = $C326 defc _FSTATSAV = $C330 defc _IOSNDTYP = $C33A defc _SNDRECSTATE = $C33B defc _IOERRSTATE = $C33C defc _HEADER = $C33D defc _IODATA = $C346 defc _BAKHEADER = $C352 defc _TBLRNGSGN = $C35B defc _calc_id = $C35C defc _penCol = $C37C defc _penRow = $C37D defc _P_RCLQUEUE = $C37E defc _ERRNO = $C381 defc _ERRSP = $C382 defc _errOffset = $C384 defc _ram_to_use = $C386 defc _offerr_sav_bc = $C390 defc _ABS_SRC_ADDR = $C392 defc _ABS_DEST_ADDR = $C395 defc _MM_NUM_BYTES = $C398 defc _mm_tmp1 = $C39B defc _mm_tmp2 = $C39D defc _mm_tmp3 = $C39F defc _mm_tmp4 = $C3A1 defc _mm_tmp5 = $C3A3 defc _ram_cache = $C3A5 defc _Flags = $C3E5 defc _ram_to_use1 = $C40A defc _statReg = $C414 defc _STATVARS = $C415 defc _STCounter = $C555 defc _curgstyle = $C555 defc _curGY = $C556 defc _curGX = $C557 defc _curGY2 = $C558 defc _curGX2 = $C559 defc _curgstyle_save = $C55A defc _curgstylesave = $C55B defc _plotflagsave = $C55C defc _XMINPTR = $C55D defc _XMAXPTR = $C55F defc _XSCLPTR = $C561 defc _YMINPTR = $C563 defc _YMAXPTR = $C565 defc _YSCLPTR = $C567 defc _DIF1STCURINC = $C569 defc _TRACEPLOT = $C56B defc _BOXPLOTINFO = $C56C defc _SCURINC = $C56D defc _CURINC = $C56F defc _YPIXEL = $C571 defc _ORGXMIN = $C572 defc _PANSHIFT = $C57C defc _USRRNGSIZE = $C586 defc _UTHETMIN = $C588 defc _STSP = $C58D defc _STRAMStart = $C58D defc _UTHETMAX = $C592 defc _UTHETSTEP = $C59C defc _UTPLOT = $C5A6 defc _UTMIN = $C5B0 defc _UTMAX = $C5BA defc _UTSTEP = $C5C4 defc _UXMIN = $C5CE defc _UXMAX = $C5D8 defc _UXSCL = $C5E2 defc _UYMIN = $C5EC defc _UYMAX = $C5F6 defc _UYSCL = $C600 defc _UXRES = $C60A defc _XRES_INT = $C614 defc _HDERIV = $C615 defc _TOL = $C61F defc _XFACT = $C629 defc _YFACT = $C633 defc _DELTAX = $C63D defc _DELTAY = $C647 defc _SHORTX = $C651 defc _SHORTY = $C65B defc _FUNRNGSIZE = $C665 defc _FLAGSF = $C667 defc _XMINF = $C668 defc _XMAXF = $C672 defc _XSCLF = $C67C defc _YMINF = $C686 defc _YMAXF = $C690 defc _YSCLF = $C69A defc _LOWER = $C6A4 defc _UPPER = $C6AE defc _XRES = $C6B8 defc _POLRNGSIZE = $C6C2 defc _FLAGSPOL = $C6C4 defc _THETAMIN = $C6C5 defc _THETAMAX = $C6CF defc _THETASTEP = $C6D9 defc _XMINPOL = $C6E3 defc _XMAXPOL = $C6ED defc _XSCLPOL = $C6F7 defc _YMINPOL = $C701 defc _YMAXPOL = $C70B defc _YSCLPOL = $C715 defc _PARRNGSIZE = $C71F defc _FLAGSPAR = $C721 defc _TMINPAR = $C722 defc _TMAXPAR = $C72C defc _TSTEPPAR = $C736 defc _XMINPAR = $C740 defc _XMAXPAR = $C74A defc _XSCLPAR = $C754 defc _YMINPAR = $C75E defc _YMAXPAR = $C768 defc _YSCLPAR = $C772 defc _DIFRNGSIZE = $C77C defc _FLAGSDIF = $C77E defc _TOLERDIF = $C77F defc _TPLOTDIF = $C789 defc _TMINDIF = $C793 defc _TMAXDIF = $C79D defc _TSTEPDIF = $C7A7 defc _XMINDIF = $C7B1 defc _XMAXDIF = $C7BB defc _XSCLDIF = $C7C5 defc _YMINDIF = $C7CF defc _YMAXDIF = $C7D9 defc _YSCLDIF = $C7E3 defc _XAXISDIF = $C7ED defc _YAXISDIF = $C7EE defc _SLOPEF_EQU = $C7EF defc _DIRF_X = $C7F0 defc _DIRF_Y = $C7F1 defc _DIRF_TIME = $C7F2 defc _FRES = $C7FC defc _INTS = $C806 defc _DNEQ = $C810 defc _P_XOUTSYM = $C811 defc _P_XOUTDAT = $C814 defc _P_YOUTSYM = $C817 defc _P_YOUTDAT = $C81A defc _P_INPUTSYM = $C81D defc _P_INPUTDAT = $C820 defc _P_FOUTDAT = $C823 defc _PREVDATA = $C826 defc _PREVDATA_EXT = $C862 defc _P1TYPE = $C86C defc _SavX1List = $C86D defc _SavY1List = $C876 defc _SavF1List = $C87F defc _P1FRQONOFF = $C888 defc _P2TYPE = $C889 defc _SavX2List = $C88A defc _SavY2List = $C893 defc _SavF2List = $C89C defc _P2FRQONOFF = $C8A5 defc _P3TYPE = $C8A6 defc _SavX3List = $C8A7 defc _SavY3List = $C8B0 defc _SavF3List = $C8B9 defc _P3FRQONOFF = $C8C2 defc _oldtype = $C8C3 defc _oldxlist = $C8C4 defc _oldylist = $C8CD defc _oldflist = $C8D6 defc _uppery = $C8D6 defc _oldonoff = $C8DF defc _tblpsrow = $C8E0 defc _tblscroll = $C8E1 defc _INPUTDAT_PG0 = $C8E3 defc _TblLine = $C8ED defc _OldTblMin = $C8F7 defc _TBLRNGSIZE = $C901 defc _TblMin = $C903 defc _TblStep = $C90D defc _TABLESGN = $C917 defc _TableYPtr = $C918 defc _curTblcol = $C919 defc _curTblrow = $C91A defc _dspTblcol = $C91B defc _dspTblrow = $C91C defc _higTblcol = $C91D defc _higTblrow = $C91E defc _TABLEXDATA = $C920 defc _TBLMATRIX = $C920 defc _TABLEYDATA = $C95C defc _TABLETEMPLATE = $C9D4 defc _SavedEqTok = $C9D5 defc _SavedEqNum1 = $C9D7 defc _SavedEqTok1 = $C9D8 defc _SaveAppFlags = $C9DA defc _SaveCurFlags = $C9DB defc _SaveCurGstyle = $C9DC defc _SaveGraphFlags = $C9DD defc _evalflevel = $C9DE defc _TmpMatCols = $C9DF defc _ES = $C9DF defc _TmpMatRows = $C9E0 defc _P_DERIVPTR = $C9E1 defc _DTMPThresh = $C9E4 defc _ELCPLXLCNT = $C9E6 defc _DERIVLEVEL = $C9E8 defc _P_DIFFEQPTR = $C9E9 defc _P_DSOLVPTR = $C9EB defc _SOLVAR = $C9EE defc _P_QUADPTR = $C9F7 defc _plotSScreen = $C9FA defc _SEED1 = $CDFA defc _SEED2 = $CE04 defc _PARSEVAR = $CE0E defc _P_BEGPC = $CE18 defc _P_CURPC = $CE1B defc _P_ENDPC = $CE1E defc _ELCNT = $CE21 defc _COLCNT = $CE23 defc _ROWCNT = $CE24 defc _LCOUNT = $CE25 defc _EOS_ASAP_2ND = $CE27 defc _EXEC_CONV_SAVE = $CE28 defc _LASTENTRYPTR = $CE2A defc _LASTENTRYSTK = $CE2C defc _numlastentries = $CEAC defc _currlastentry = $CEAD defc _FREESAVEY = $CEAE defc _FREESAVEX = $CEAF defc _STRACESAVE_TYPE = $CEB0 defc _STRACESAVE = $CEB1 defc _TRACESAVE = $CEB3 defc _DIF_T_SAVE = $CEB5 defc _A_B_SAVE = $CEBF defc _A_B_TYPE = $CEC0 defc _GS_DELX = $CEC1 defc _GS_D1_YINC = $CEC2 defc _GS_D2_YINC = $CEC3 defc _GS_DELY = $CEC4 defc _GS_MAX_Y_PIX = $CEC5 defc _CURRENT_STYLE = $CEC6 defc _CL_X1 = $CEC7 defc _CL_X2 = $CEC8 defc _CL_Y_DAT = $CEC9 defc _PREV_POINT = $CECB defc _RESSAVE = $CECD defc _DREQU_X = $CECE defc _DREQU_XINIT = $CECF defc _DREQU_Y = $CED9 defc _DREQU_YINIT = $CEDA defc _DREQU_XLIST = $CEE4 defc _DREQU_YLIST = $CEE7 defc _DREQU_tLIST = $CEEA defc _DREQU_COUNT = $CEED defc _GY1 = $CEEF defc _GX1 = $CF21 defc _GR1 = $CF53 defc _GQ1 = $CF85 defc _EQU_EDIT_SAVE = $CF8A defc _FORMULA_BITMAP = $CF8B defc _MENUCMD_M2I = $CFAB defc _cmdShadow = $CFAB defc _MENUCMD_ITEMS = $CFC9 defc _MENUCMD_NUMROWS = $D041 defc _MENUCMD_CURROW = $D042 defc _cmdShadCur = $D053 defc _cmdShadAlph = $D055 defc _cmdShadIns = $D056 defc _cmdCursor = $D057 defc _P_editTop = $D059 defc _P_EDITCURSOR = $D05C defc _P_editTail = $D05F defc _P_editBtm = $D062 defc _curmatcol = $D065 defc _curmatrow = $D066 defc _curlstrow = $D067 defc _numedTbl = $D069 defc _curlistel = $D069 defc _curlstrowh = $D06A defc _higmatcol = $D06B defc _higmatrow = $D06C defc _higlstrow = $D06D defc _maxdsprow = $D06F defc _ForCurMat = $D070 defc _higlstrowh = $D070 defc _ForDspCol = $D072 defc _forerrornum = $D074 defc _P_editSym = $D075 defc _P_editDat = $D078 defc _DspMatCol = $D07B defc _DspMatRow = $D07C defc _TmpMatCol = $D07D defc _TmpMatRow = $D07E defc _numoflist = $D07F defc _num1stlist = $D080 defc _NumCurList = $D081 defc _STATED_CUT_COL = $D082 defc _listnamebuffer = $D083 defc _LastName = $D12E defc _modeRoot = $D137 defc _modeCount = $D139 defc _modeItem = $D13A defc _modePtr = $D13B defc _winTop = $D13D defc _winBtm = $D13E defc _winLeftEdge = $D13F defc _winLeft = $D140 defc _winAbove = $D142 defc _winRow = $D144 defc _winCol = $D146 defc _fmtDigits = $D148 defc _fmtString = $D149 defc _fmtConv = $D18A defc _fmtLeft = $D19E defc _fmtIndex = $D1A0 defc _P_fmtMatSym = $D1A2 defc _P_fmtMatMem = $D1A5 defc _EQS = $D1A8 defc _LSTINDEX = $D1AA defc _LSTSIZE = $D1AC defc _EQUINDEX = $D1AE defc _order = $D1B0 defc _xnamesav = $D1B1 defc _ynamesav = $D1BA defc _CustMType = $D1C3 defc _MCustM = $D1C3 defc _CustMLen = $D1C4 defc _CustMSav = $D1C5 defc _custmnames = $D1E3 defc _VARSAVECNT = $D279 defc _DELADJAMT = $D27A defc _TEMPINPUT = $D27D defc _TSYMPTR1 = $D27E defc _TSYMPTR2 = $D280 defc _P_CHKDELPTR3 = $D282 defc _P_CHKDELPTR4 = $D285 defc _P_TEMPMEM = $D288 defc _FPBASE = $D28B defc _FPS = $D28D defc _OPBASE = $D28F defc _OPS = $D291 defc _PTempCnt = $D293 defc _CLEANTMP = $D295 defc _P_PTEMP = $D297 defc _PTEMP_END = $D29A defc _FREE_MEM = $D29D defc _newdataptr = $D2A0 defc _SavBotRow = $D2A3 defc _curstatplot = $D2B8 defc _curstatplotprompt = $D2B9 defc _difeqfieldmode = $D2BA defc _matedoldtype = $D2BB defc _modesave1 = $D2BC defc _statansfirst = $D2BD defc _statanslast = $D2BF defc _statanscur = $D2C1 defc _charmap = $D2C3 defc _altcharmap = $D2CB defc _toktmp1 = $D2D3 defc _toktmp2 = $D2D4 defc _IOSAVOP1 = $D2D5 defc _DELVAR_SAV_F = $D2DF defc _DEL_SAV_OP1 = $D2E0 defc _alt_asm_exec_btm = $D2EB defc _altlfontptr = $D2ED defc _altsfontptr = $D2F0 defc _altonptr = $D2F3 defc _altslinkptr = $D2F6 defc _alt_ret_status = $D2F9 defc _alt_ret_jmp_page = $D2FA defc _alt_ret_jmp_addr = $D2FB defc _alt_int_chksum = $D2FD defc _alt_interrupt_exec = $D2FE defc _alt_slink_chksum = $D3C6 defc _alt_slink_exec = $D3C7 defc _alt_on_chksum = $D48F defc _alt_on_exec = $D490 defc _alt_off_chksum = $D558 defc _alt_off_exec = $D559 defc _altram_end = $D621 defc _asm_exec_btm = $D621 defc _ASAP_IND = $D623 defc _asm_reg_af = $D624 defc _asm_reg_a = $D625 defc _asm_reg_l = $D626 defc _asm_reg_hl = $D626 defc _asm_reg_h = $D627 defc _asm_reg_bc = $D628 defc _asm_reg_c = $D628 defc _asm_reg_b = $D629 defc _asm_reg_de = $D62A defc _asm_reg_e = $D62A defc _asm_reg_d = $D62B defc _mPrgmMATH = $D62C defc _mMath = $D64C defc _mMath_asap1 = $D65A defc _mMath_asap2 = $D65C defc _mMath_asap3 = $D65E defc _iASAP1 = $D66C defc _iASAP2 = $D678 defc _iASAP3 = $D684 defc _iASAP4 = $D690 defc _iASAP5 = $D69C defc _iASAP6 = $D6A8 defc _iASAP7 = $D6B4 defc _iASAP8 = $D6C0 defc _iASAP9 = $D6CC defc _asapnames = $D6D8 defc _asap_nl1 = $D6D8 defc _asap_nl2 = $D6E1 defc _asap_nl3 = $D6EA defc _asapvar = $D6FC defc _tokspell_asap1 = $D706 defc _tokspelltblptr = $D706 defc _tokspell_asap2 = $D708 defc _tokspell_asap3 = $D70A defc _numtokens = $D70E defc _numtok_asap1 = $D70E defc _numtok_asap2 = $D70F defc _numtok_asap3 = $D710 defc _eostblptr = $D712 defc _eostbl_asap1 = $D712 defc _eostbl_asap2 = $D714 defc _eostbl_asap3 = $D716 defc _Amenu_offset = $D71A defc _reinstall_asap1 = $D722 defc _reinstall_vec = $D722 defc _reinstall_asap2 = $D724 defc _reinstall_asap3 = $D726 defc _asap1_ram = $D72A defc _asap2_ram = $D734 defc _asap3_ram = $D73E defc _checkStart = $D748 defc _asm_exec_ram = $D748 z88dk-1.8.ds1/lib/ti86_crt0.asm0000644000175000017500000001602610640546530015506 0ustar tygrystygrys; Stub for the TI 86 calculator ; ; Stefano Bodrato - Dec 2000 ; ; $Id: ti86_crt0.asm,v 1.21 2007/06/27 20:49:28 dom Exp $ ; ; startup = ; n - Primary shell(s); compatible shell(s) ; (Primary shell merely means it's the smallest implementation ; for that shell, that uses full capabilities of the shell) ; ; 1 - LASM (default) ; 2 - ASE, Rascal, emanon, etc. ; 3 - zap2000 ; 4 - emanon ; 5 - Embedded LargeLd - !!!EXPERIMENTAL!!! ; 10 - asm() executable ; ;----------------------------------------------------- ; Some general XDEFs and XREFs needed by the assembler ;----------------------------------------------------- MODULE Ti86_crt0 XREF _main ; No matter what set up we have, main is ; always, always external to this file. XDEF cleanup ; used by exit() XDEF l_dcal ; used by calculated calls = "call (hl)" XDEF _std_seed ; Integer rnd seed XDEF _vfprintf ; vprintf is internal to this file so we ; only ever include one of the set of ; routines XDEF exitsp ; Exit variables XDEF exitcount ; XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ; For stdin, stdout, stder XDEF base_graphics ; Graphics stuff XDEF coords ; XDEF snd_tick ; Sound variable XDEF cpygraph ; TI calc specific stuff XDEF tidi ; XDEF tiei ; ;------------------------- ; Begin of (shell) headers ;------------------------- INCLUDE "#Ti86.def" ; ROM / RAM adresses on Ti86 INCLUDE "zcc_opt.def" ; Receive all compiler-defines ;----------------------------- ;2 - ASE, Rascal, emanon, etc. ;----------------------------- IF (startup=2) DEFINE ASE DEFINE NOT_DEFAULT_SHELL org _asm_exec_ram-2 ;TI 86 standard asm() entry point. defb $8e, $28 nop ;identifier of table jp start defw $0000 ;version number of table defw description ;pointer to the description .description DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ; Termination zero ENDIF ;----------- ;3 - zap2000 ;----------- IF (startup=3) DEFINE ZAP2000 DEFINE NOT_DEFAULT_SHELL org _asm_exec_ram-2 defb $8e, $28 nop jp start defw description defw icon .description DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ; Termination zero .icon DEFINE NEED_icon INCLUDE "zcc_opt.def" UNDEFINE NEED_icon IF !DEFINED_NEED_icon defb @00000000 ; 8x8 icon defb @00110010 ; C with a small '+' defb @01000111 defb @01000010 defb @01000000 defb @00110000 defb @00000000 defb @00000000 ENDIF ENDIF ;---------- ;4 - emanon ;---------- IF (startup=4) DEFINE EMANON DEFINE NOT_DEFAULT_SHELL org _asm_exec_ram-2 ;TI 86 standard asm() entry point. defb $8e, $28 nop ;identifier of table jp start defw $0001 ;version number of table defw description ;pointer to description defw icon ;pointer to icon .description DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF defb $0 ; Termination zero .icon DEFINE NEED_icon INCLUDE "zcc_opt.def" ; Get icon from zcc_opt.def UNDEFINE NEED_icon IF !DEFINED_NEED_icon defb @00000000 ; 7x7 icon defb @00110010 defb @01000111 defb @01000010 defb @01000000 defb @00110000 defb @00000000 ENDIF ENDIF ;---------------------- ; 10 - asm() executable ;---------------------- IF (startup=10) DEFINE STDASM DEFINE NOT_DEFAULT_SHELL org _asm_exec_ram - 2 defb $8e, $28 ENDIF ;-------------------------------------------------- ; 5 - Embedded LargeLd - !!!EXPERIMENTAL!!! ; - The calculator needs to be reset (memory clean) ; - This has to be the first program in memory ;-------------------------------------------------- IF (startup=5) DEFINE NOT_DEFAULT_SHELL org $8000+14 ld a,$42 ; (RAM_PAGE_1) out (6),a jp start ENDIF ;------------------ ;1 - LASM (default) ;------------------ IF !NOT_DEFAULT_SHELL DEFINE LASM org $801D ; "Large asm block". To be loaded with "LASM" ; You need LASM 0.8 Beta by Patrick Wong for this (www.ticalc.org) ; - First wipe TI86 RAM (InstLASM is simply a memory cleaner) ; - Load LargeLd ; - Load your compiled and converted .86p code ; - run asm(LargeLd ; It will run your program. Loading order is important. defb $8e, $28 ;org $801F ; Start from here if you want to use PRGM86 ret nop ;Identifies the table jp start defw 1 ;Version # of Table. Release 0 has no icon (Title only) defw description ;Absolute pointer to program description defw icon ;foo pointer to icon .description DEFINE NEED_name INCLUDE "zcc_opt.def" UNDEFINE NEED_name IF !DEFINED_NEED_name defm "Z88DK Small C+ Program" ENDIF .icon defb $0 ; Termination zero ENDIF ;------------------------------------- ; End of header, begin of startup part ;------------------------------------- .start IF STDASM | LASM ; asm( executable call _runindicoff ; stop anoing run-indicator ENDIF ld hl,0 add hl,sp ld (start1+1),hl IF !DEFINED_atexit ; Less stack use ld hl,-6 ; 3 pointers (more likely value) add hl,sp ld sp,hl ld (exitsp),sp ELSE ld hl,-64 ; 32 pointers (ANSI standard) add hl,sp ld sp,hl ld (exitsp),sp ENDIF ; IF NONANSI call _homeup ; Set text cursor at (0,0) ld a,8 ; Set _winBtm back to 8, so we ld (_winBtm),a ; can print on the last line ; ELSE LIB fputc_cons ld hl,12 push hl call fputc_cons pop hl IF DEFINED_GRAYlib INCLUDE "#gray86.asm" ENDIF ;im 2 call tidi call _flushallmenus call _main .cleanup ; exit() jumps to this point .start1 ld sp,0 IF DEFINED_GRAYlib ld a,$3C ; Make sure video mem is active out (0),a ENDIF .tiei ld IY,_Flags exx ld hl,(hl1save) ld bc,(bc1save) ld de,(de1save) exx IF DEFINED_GRAYlib im 1 ELSE ei ENDIF ret .tidi IF DEFINED_GRAYlib im 2 ELSE di ENDIF exx ld (hl1save),hl ld (bc1save),bc ld (de1save),de exx ret .hl1save defw 0 .de1save defw 0 .bc1save defw 0 .cpygraph ret ;---------------------------------------- ; End of startup part, routines following ;---------------------------------------- .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND .__sgoioblk INCLUDE "#stdio_fp.asm" ENDIF ; Now, which of the vfprintf routines do we need? IF (!DEFINED_nostreams) ~ (DEFINED_ANSIstdio) ; ~ = AND IF DEFINED_floatstdio ._vfprintf LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio ._vfprintf LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio ._vfprintf LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 ; mem stuff .base_graphics defw $FC00 ;TI86 .coords defw 0 IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/ti86_crt0.opt0000644000175000017500000000003307224335500015514 0ustar tygrystygrys INCLUDE "#ti86_crt0.asm" z88dk-1.8.ds1/lib/time.def0000644000175000017500000000224507455120417014700 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989 DEFC Gn_Gmt = $1A09 ; get (read) machine time in internal format DEFC Gn_Pmt = $1E09 ; put (set) machine date DEFC Gn_Msc = $2009 ; Miscellaneous time operations DEFC Gn_Gtm = $0A09 ; convert ASCII string to internal time format DEFC Gn_Ptm = $0C09 ; convert internal time to ASCII string DEFC Gn_Sdo = $0E09 ; convert real time to time to elapse DEFC Os_Dly = $D606 ; delay a given period DEFC Gn_Gdt = $0609 ; convert ASCII string to internal date DEFC Gn_Pdt = $0809 ; convert internal date to ASCII string DEFC Gn_Die = $1409 ; convert from internal to zoned format DEFC Gn_Dei = $1609 ; convert from zoned format to internal format DEFC Gn_Gmd = $1809 ; get current machine date in internal format DEFC Gn_Pmd = $1C09 ; set machine date DEFC Os_Ht = $F206 ; hardware time manipulation (internal OZ usage) DEFC HT_RES = $01 ; reset hardware timer DEFC HT_RD = $02 ; read hardware timer DEFC HT_MDT = $03 ; read monthy/date/time address DEFC Os_Ust = $78 ; update small timer (internal) lston z88dk-1.8.ds1/lib/tokens.def0000644000175000017500000000040507455120417015241 0ustar tygrystygryslstoff ; Standard Z88 Operating System manifests: ; The information below is defined in Developers Notes, release 3.00 ; (c) Cambridge Computer 1989 ; Token manipulation: DEFC Os_Wrt = $CC06 ; Write token DEFC Os_Wtb = $CA06 ; Write token base lston z88dk-1.8.ds1/lib/ts2068_crt0.asm0000755000175000017500000001755610760606667015711 0ustar tygrystygrys; TS 2068 startup code ; ; $Id: ts2068_crt0.asm,v 1.3 2008/02/25 18:49:27 aralbrec Exp $ ; MODULE zx82_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF __sgoioblk ;stdio info block XDEF base_graphics ;Graphical variables XDEF coords ;Current xy position XDEF snd_tick ;Sound variable ;-------- ; Set an origin for the application (-zorg=) default to 32768 ;-------- IF DEFINED_ZXVGS IF !myzorg DEFC myzorg = $5CCB ;repleaces BASIC program ENDIF IF !STACKPTR DEFC STACKPTR = $FF57 ;below UDG, keep eye when using banks ENDIF ENDIF IF !myzorg defc myzorg = 32768 ENDIF org myzorg .start ld iy,23610 ; restore the right iy value, fixes the self-relocating trick IF !DEFINED_ZXVGS ld (start1+1),sp ;Save entry stack ENDIF IF STACKPTR ld sp,STACKPTR ENDIF exx ld (hl1save + 1),hl ld hl,-64 add hl,sp ld sp,hl ld (exitsp),sp IF DEFINED_ZXVGS ;setting variables needed for proper keyboard reading LD (IY+1),$CD ;FLAGS #5C3B LD (IY+48),1 ;FLAGS2 #5C6A EI ;ZXVGS starts with disabled interrupts ENDIF ;ld a,2 ;open the upper display (uneeded?) ;call 5633 -> NOT THE TS2068 LOCATION !! IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF IF DEFINED_NEEDresidos call residos_detect jp c,cleanup_exit ENDIF call _main ;Call user program .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF IF DEFINED_ZXVGS POP BC ;let's say exit code goes to BC RST 8 DEFB $FD ;Program finished ELSE .cleanup_exit .hl1save ld hl,0 exx pop bc .start1 ld sp,0 ;Restore stack to entry value ret ENDIF .l_dcal jp (hl) ;Used for function pointer calls ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;--------------------------------------------- ; Some +3 stuff - this needs to be below 49152 ;--------------------------------------------- IF DEFINED_NEEDresidos INCLUDE "#idedos.def" defc ERR_NR=$5c3a ; BASIC system variables defc ERR_SP=$5c3d XDEF dodos ; ; This is support for residos, we use the normal ; +3 -lplus3 library and rewrite the values so ; that they suit us somewhat .dodos exx push iy pop hl ld b,PKG_IDEDOS rst RST_HOOK defb HOOK_PACKAGE ld iy,23610 ret ; Detect an installed version of ResiDOS. ; ; This should be done before you attempt to call any other ResiDOS/+3DOS/IDEDOS ; routines, and ensures that the Spectrum is running with ResiDOS installed. ; Since +3DOS and IDEDOS are present only from v1.40, this version must ; be checked for before making any further calls. ; ; If you need to use calls that were only provided from a certain version of ; ResiDOS, you can check that here as well. ; ; The ResiDOS version call is made with a special hook-code after a RST 8, ; which will cause an error on Speccies without ResiDOS v1.20+ installed, ; or error 0 (OK) if ResiDOS v1.20+ is present. Therefore, we need ; to trap any errors here. .residos_detect ld hl,(ERR_SP) push hl ; save the existing ERR_SP ld hl,detect_error push hl ; stack error-handler return address ld hl,0 add hl,sp ld (ERR_SP),hl ; set the error-handler SP rst RST_HOOK ; invoke the version info hook code defb HOOK_VERSION pop hl ; ResiDOS doesn't return, so if we get jr noresidos ; here, some other hardware is present .detect_error pop hl ld (ERR_SP),hl ; restore the old ERR_SP ld a,(ERR_NR) inc a ; is the error code now "OK"? jr nz,noresidos ; if not, ResiDOS was not detected ex de,hl ; get HL=ResiDOS version push hl ; save the version ld de,$0140 ; DE=minimum version to run with and a sbc hl,de pop bc ; restore the version to BC ret nc ; and return with it if at least v1.40 .noresidos ld bc,0 ; no ResiDOS ld a,$ff ld (ERR_NR),a ; clear error ret ENDIF ;--------------------------------------------- ; Some +3 stuff - this needs to be below 49152 ;--------------------------------------------- IF DEFINED_NEEDplus3dodos ; Routine to call +3DOS Routines. Located in startup ; code to ensure we don't get paged out ; (These routines have to be below 49152) ; djm 17/3/2000 (after the manual!) XDEF dodos .dodos call dodos2 ;dummy routine to restore iy afterwards ld iy,23610 ret .dodos2 push af push bc ld a,7 ld bc,32765 di ld (23388),a out (c),a ei pop bc pop af call cjumpiy push af push bc ld a,16 ld bc,32765 di ld (23388),a out (c),a ei pop bc pop af ret .cjumpiy jp (iy) ENDIF IF 0 ; Short routine to set up a +3 DOS header so files ; Can be accessed from BASIC, we set to type code ; load address 0 and length supplied ; ; Entry: b = file handle ; hl = file length .setheader ld iy,setheader_r call dodos ret .setheader_r push hl call 271 ;DOS_RED_HEAD pop hl ld (ix+0),3 ;CODE ld (ix+1),l ;Length ld (ix+2),h ld (ix+3),0 ;Load address ld (ix+4),0 ret ENDIF ;----------- ; Now some variables ;----------- .coords defw 0 ; Current graphics xy coordinates .base_graphics defw 0 ; Address of the Graphics map IF !DEFINED_HAVESEED XDEF _std_seed ;Integer rand() seed ._std_seed defw 0 ; Seed for integer rand() routines ENDIF .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF defm "Small C+ ZX" ;Unnecessary file signature defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/ts2068_crt0.opt0000755000175000017500000000003510600320740015665 0ustar tygrystygrys INCLUDE "#ts2068_crt0.asm" z88dk-1.8.ds1/lib/uzi_crt0.asm0000644000175000017500000000144110445322021015504 0ustar tygrystygrys; ; Startup code for the UZI system ; ; Created 22/1/99 ; ; UZI is completely stand alone so we don't need most ; of the gunk that OZ offers.. ; We may have more vars later to control memory ; size etc.. INCLUDE "#director.def" XDEF _start_init ; UZI proper starts at 8192 and runs to 32768 ; Processes are loaded at 32768 org 8192 ; We enter in with sp pointing to somewhere in the system ; stack...so just store it for use in any (rare) syscalls ; that we make ld (system_stack),sp jp _start_init ; Jump back to quit application (user shutdown) .user_shutdown ld sp,(system_stack) xor a call_oz(os_bye) ;Save a byte here, byte there! This has label because it's used for ;calculated calls etc .l_dcal jp (hl) .system_stack defw 0 defm "UZIz88" defb 0 z88dk-1.8.ds1/lib/vz_crt0.asm0000644000175000017500000000671310640546530015355 0ustar tygrystygrys; Startup for VZ200/300 ; ; Stefano Bodrato - Apr. 2000 ; ; If an error occurs eg break we just drop back to BASIC ; ; $Id: vz_crt0.asm,v 1.8 2007/06/27 20:49:28 dom Exp $ ; MODULE vz_crt0 ; ; Initially include the zcc_opt.def file to find out lots of lovely ; information about what we should do.. ; INCLUDE "zcc_opt.def" ; No matter what set up we have, main is always, always external to ; this file XREF _main ; ; Some variables which are needed for both app and basic startup ; XDEF cleanup XDEF l_dcal ; Integer rnd seed XDEF _std_seed ; vprintf is internal to this file so we only ever include one of the set ; of routines XDEF _vfprintf ;Exit variables XDEF exitsp XDEF exitcount ;For stdin, stdout, stder XDEF __sgoioblk ;Graphic function XDEFS.. XDEF coords XDEF base_graphics XDEF gfx_bank ; Now, getting to the real stuff now! IF (startup=2) org 32768 ELSE org $7ae9-24 defb $20,$20,0,0 defm "z80.mc" defb 0,0,0,0,0,0,0,0,0,0,0 defb $f0 defw $7ae9 ; 24 bytes so far defw $7b04 defw 1 defb $B1 ;POKE defm " 30862,18:" defb $B1 ;POKE defm " 30863,123" defb 0 ; this block is 27 bytes long defw $7b0f defw 2 defb $b2 ; PRINT defb ' ' defb $c1 ; USR defm "(0)" defb 0 ; this block is 11 bytes long defw 0 defb 4 ; Header ends here: 65 bytes ENDIF .start call _main .cleanup ; ; Deallocate memory which has been allocated here! ; push hl IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF exx ld hl,10072 exx pop bc .start1 ld sp,0 jp 1A19h .l_dcal jp (hl) ; Now, define some values for stdin, stdout, stderr .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ; Now, which of the vfprintf routines do we need? ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;Seed for integer rand() routines ._std_seed defw 0 ;Atexit routine .exitsp defw 0 .exitcount defb 0 ; Heap stuff .heaplast defw 0 .heapblocks defw 0 .coords defw 0 .base_graphics defw 28672 .gfx_bank defb 0 defm "Small C+ VZ" defb 0 ;All the float stuff is kept in a different file...for ease of altering! ;It will eventually be integrated into the library ; ;Here we have a minor (minor!) problem, we've no idea if we need the ;float package if this is separated from main (we had this problem before ;but it wasn't critical..so, now we will have to read in a file from ;the directory (this will be produced by zcc) which tells us if we need ;the floatpackage, and if so what it is..kludgey, but it might just work! ; ;Brainwave time! The zcc_opt file could actually be written by the ;compiler as it goes through the modules, appending as necessary - this ;way we only include the package if we *really* need it! IF NEED_floatpack INCLUDE "#float.asm" ;seed for random number generator - not used yet.. .fp_seed defb $80,$80,0,0,0,0 ;Floating point registers... .extra defs 6 .fa defs 6 .fasign defb 0 ENDIF z88dk-1.8.ds1/lib/vz_crt0.opt0000644000175000017500000000003107130401717015357 0ustar tygrystygrys INCLUDE "#vz_crt0.asm" z88dk-1.8.ds1/lib/z80_crt0.hdr0000644000175000017500000001100410303727473015324 0ustar tygrystygrys; ; Header file which contains all required variables from the ; startup that need to be exposed to individual C files ; ; Stick in this file any routines which are needed or implicitly ; implied by sccz80. ; ; This file is included by every module ; To handle multi module programs which use floating point ; routines in different modules, we have got rid of ; the conditional assembly around the float routines ; ; $Id: z80_crt0.hdr,v 1.6 2005/08/27 00:09:31 aralbrec Exp $ XREF base_graphics ; Address of graphics screen XREF _cpfar2near ; Far->near conversion (z88) XREF packintrout ; Process interrupt (z88 apps) XREF l_dcal ; jp(hl) XREF cleanup ; cleanup before program exit LIB l_jphl ; another jp(hl) LIB l_jpix ; jp(ix) LIB l_jpiy ; jp(iy) ;------------------------------------ ; Scopes for integer library routines ;------------------------------------ LIB l_getptr ;Get 3 byte pointer LIB l_putptr ;Put 3 byte pointer LIB l_gchar ;Get signed char LIB l_sxt ;Sign extend char LIB l_gint ;Get int LIB l_gint_eq ;Get int and test == 0 LIB l_ghtonsint ;Get reverse order int LIB l_pint ;Put int LIB l_pint_eq ;Put int and test == 0 LIB l_pint_pop ;Put int and pop place address LIB l_pint_ex ;Put int hl to addr de return addr in hl LIB l_or ;Int logical or LIB l_xor ;Int logical xor LIB l_and ;Int logical and LIB l_eq ;Int equality LIB l_ne ;Int inequality LIB l_gt ;Int signed > LIB l_le ;Int signed <= LIB l_ge ;Int signed >= LIB l_lt ;Int signed < LIB l_uge ;Int unsigned >= LIB l_ult ;Int unsigned < LIB l_ugt ;Int unsigned > LIB l_ule ;Int unsigned <= LIB l_cmp ;Int signed compare LIB l_ucmp ;Int unsigned compare LIB l_asr ;Int signed >> LIB l_asr_u ;Int unsigned >> LIB l_asl ;Int << LIB l_sub ;Int subtract LIB l_neg ;Int negate LIB l_com ;Int ~ LIB l_lneg ;Int logical negate LIB l_bool ;Int boolean tetst LIB l_cm_de ; LIB l_cm_bc LIB l_deneg LIB l_bcneg LIB l_case ;Integer case LIB l_mult ;Integer * LIB l_div ;Integer signed / LIB l_div_u ;Integer unsigned / ;------------------ ;Long functions now ;------------------ LIB lpush2 ;Push a long under the stack LIB l_int2long_s ;Int->long signed conversion LIB l_long2int_s ;Long->int signed conversion LIB l_glong ;Get long LIB l_long_add LIB l_long_and LIB l_long_asl LIB l_long_asr LIB l_long_aslo ;Long << shift in c LIB l_long_asro ;Long >> shift in c (signed) LIB l_long_bool LIB l_long_cmp LIB l_long_com LIB l_long_eq LIB l_long_ge LIB l_long_gt LIB l_long_le LIB l_long_lneg LIB l_long_lt LIB l_long_ne LIB l_long_neg LIB l_long_or LIB l_long_sub LIB l_long_ucmp LIB l_long_uge LIB l_long_ugt LIB l_long_ule LIB l_long_ult LIB l_long_xor LIB l_plong LIB l_inclong ;Increment long LIB l_declong ;Decrement long LIB l_long_div LIB l_long_div_u LIB l_long_mult LIB l_long_asr_u ;Long unsigned >> LIB l_long_asr_uo ;Long unsigned >> shift in c LIB l_long_case ;-------------------------------------------------------------- ; Floating point support routines, mostly in library ;-------------------------------------------------------------- LIB dadd LIB ddiv LIB dsub LIB dmul LIB dge LIB dgt LIB dleq LIB dlt LIB deq LIB dne LIB minusfa ;FA=-FA LIB dswap ;Exchange FA with top of stack LIB float ;Convert int to float LIB ufloat ;unsigned int to float LIB ifix ;Convert float to int XREF dstore ;FA->(de) XREF dload ;FA<-(hl) XREF dldpsh ;(hl)->(stack) XREF dpush ;FA->(stack) XREF dpush2 ;FA->(stack under) XREF fa ;may not be needed in this file XREF extra ;dittot XREF __atof2 ;string->fa convsersion ;-------------------------------------------------- ; Routines for picking up variables from far memory ;-------------------------------------------------- LIB lp_gchar LIB lp_gdoub LIB lp_gint LIB lp_glong LIB lp_gptr LIB lp_pchar LIB lp_pdoub LIB lp_pint LIB lp_plong LIB lp_pptr z88dk-1.8.ds1/lib/z80_crt0.hdx0000644000175000017500000001246510303727541015342 0ustar tygrystygrys; ; Header file which contains all required variables from the ; startup that need to be exposed to individual C files ; ; Stick in this file any routines which are needed or implicitly ; implied by sccz80. ; ; This file is included by every module ; To handle multi module programs which use floating point ; routines in different modules, we have got rid of ; the conditional assembly around the float routines ; ; (Used by asxxx) ; ; $Id: z80_crt0.hdx,v 1.4 2005/08/27 00:10:09 aralbrec Exp $ .globl base_graphics ; Address of graphics screen .globl _cpfar2near ; Far->near conversion (z88) .globl packintrout ; Process interrupt (z88 apps) .globl l_dcal ; jp(hl) .globl cleanup ; cleanup before program exit .globl l_jphl .globl l_jpix .globl l_jpiy ;------------------------------------ ; Scopes for integer library routines ;------------------------------------ .globl l_getptr ;Get 3 byte pointer .globl l_putptr ;Put 3 byte pointer .globl l_gchar ;Get signed char .globl l_sxt ;Sign extend char .globl l_gint ;Get int .globl l_gint_eq ;Get int and test == 0 .globl l_ghtonsint ;Get reverse order int .globl l_pint ;Put int .globl l_pint_eq ;Put int and test == 0 .globl l_pint_pop ;Put int and pop place address .globl l_pint_ex ;Put int hl to addr de return addr in hl .globl l_or ;Int logical or .globl l_xor ;Int logical xor .globl l_and ;Int logical and .globl l_eq ;Int equality .globl l_ne ;Int inequality .globl l_gt ;Int signed > .globl l_le ;Int signed <= .globl l_ge ;Int signed >= .globl l_lt ;Int signed < .globl l_uge ;Int unsigned >= .globl l_ult ;Int unsigned < .globl l_ugt ;Int unsigned > .globl l_ule ;Int unsigned <= .globl l_cmp ;Int signed compare .globl l_ucmp ;Int unsigned compare .globl l_asr ;Int signed >> .globl l_asr_u ;Int unsigned >> .globl l_asl ;Int << .globl l_sub ;Int subtract .globl l_neg ;Int negate .globl l_com ;Int ~ .globl l_lneg ;Int logical negate .globl l_bool ;Int boolean tetst .globl l_cm_de ; .globl l_cm_bc .globl l_deneg .globl l_bcneg .globl l_case ;Integer case .globl l_mult ;Integer * .globl l_div ;Integer signed / .globl l_div_u ;Integer unsigned / ;------------------ ;Long functions now ;------------------ .globl lpush2 ;Push long under the stack .globl l_int2long_s ;Int->long signed conversion .globl l_long2int_s ;Long->int signed conversion .globl l_glong ;Get long .globl l_long_add .globl l_long_and .globl l_long_asl .globl l_long_asr .globl l_long_aslo ;Long << shift in c .globl l_long_asro ;Long >> shift in c (signed) .globl l_long_bool .globl l_long_cmp .globl l_long_com .globl l_long_eq .globl l_long_ge .globl l_long_gt .globl l_long_le .globl l_long_lneg .globl l_long_lt .globl l_long_ne .globl l_long_neg .globl l_long_or .globl l_long_sub .globl l_long_ucmp .globl l_long_uge .globl l_long_ugt .globl l_long_ule .globl l_long_ult .globl l_long_xor .globl l_plong .globl l_inclong ;Increment long .globl l_declong ;Decrement long .globl l_long_div .globl l_long_div_u .globl l_long_mult .globl l_long_asr_u ;Long unsigned >> .globl l_long_asr_uo ;Long unsigned >> shift in c .globl l_long_case ;-------------------------------------------------------------- ; Floating point support routines, held in startup code so .globl ;-------------------------------------------------------------- XRER DADD .globl DDIV .globl DGE .globl DIV1 .globl DIV17 .globl DLOAD .globl DLDPSH .globl DMUL .globl DSTORE .globl DSWAP .globl DSUB .globl DEQ .globl DGT .globl DLEq ;djm 7/10/98 .globl DLT .globl DNE .globl DPUSH .globl DPUSH2 .globl FA .globl extra .globl FADD .globl FDIV .globl FMUL .globl FSUB ; .globl GRIPE .globl PUSHF2 .globl LDBCFA .globl LDBCHL .globl LDFABC .globl MINUSFA ;negate FP number .globl NORMA .globl ODD .globl PUSHFA .globl SGN ; .globl OFLOW .globl FASIGN .globl NORM .globl COMPARE .globl INT2 .globl PI .globl HALFPI .globl __atof2 .globl float ;Convert int to float .globl ufloat ;unsigned int to float .globl ifix ;Convert float to int ;-------------------------------------------------- ; Routines for picking up variables from far memory ;-------------------------------------------------- .globl lp_gchar .globl lp_gdoub .globl lp_gint .globl lp_glong .globl lp_gptr .globl lp_pchar .globl lp_pdoub .globl lp_pint .globl lp_plong .globl lp_pptr z88dk-1.8.ds1/lib/z80rules.00000644000175000017500000000435107474745714015055 0ustar tygrystygrys call l_pint ld a,h or l = call l_pint_eq call l_gint ;%9 ld a,h or l = call l_gint_eq ;%9 call l_long%1 call l_int2long_s = call l_long%1 ld hl,_%1 push hl call l_gint ;%9 %2c hl pop de call l_pint = ld hl,(_%1) %2c hl ld (_%1),hl ld hl,_%1 push hl pop bc pop hl push hl push bc ld l,(hl) ld h,0 add hl,hl pop de add hl,de push hl call l_gint ;%9 inc hl pop de call l_pint = pop hl push hl ld l,(hl) ld h,0 add hl,hl ld de,_%1 add hl,de ld e,(hl) inc hl ld d,(hl) inc de ld (hl),d dec hl ld (hl),e ex de,hl ld hl,%1 ld a,h or l jp %2 ld hl,%1 = ld hl,%1 ld a,h or l jp %2 push hl pop bc pop hl push hl push bc = pop de push de push hl ex de,hl pop hl push hl inc hl inc hl pop de push de push hl ex de,hl inc hl inc hl = pop hl push hl inc hl inc hl push hl pop hl push hl ld bc,%1 add hl,bc ld (hl),%2 inc hl ld (hl),%3 pop hl push hl ld bc,%4 add hl,bc = pop hl push hl ld bc,%1 add hl,bc ld (hl),%2 inc hl ld (hl),%3 ld bc,%4-(%1)-1 add hl,bc pop hl push hl ld bc,%1 add hl,bc ld (hl),%2 pop hl push hl ld bc,%3 add hl,bc = pop hl push hl ld bc,%1 add hl,bc ld (hl),%2 ld bc,%3-(%1) add hl,bc ld hl,%1 ;const push hl call l_gint ;%3 %2c hl pop de call l_pint = ld hl,(%1) %2c hl ld (%1),hl call l_eq ld de,0 ;const ex de,hl call l_eq jr c,%1 = call l_eq jr nc,%1 call l_eq ld de,0 ;const ex de,hl call l_eq jr nc,%1 = call l_eq jr c,%1 call l_pint ld de,%1 ;const ex de,hl = call l_pint_ex ld hl,%1 ;const pop de call l_pint = call l_pint_pop push hl call l_gint ;%9 ld h,0 call l_pint_pop = call l_gint ld h,0 ld hl,%1 ;const call l_gint ld h,0 ld de,%2 ;const ex de,hl = ld de,(%1) ld hl,%2 ;const ld hl,%1 ;const call l_and ld de,%1 ;const ex de,hl call l_eq = ld hl,%1 ;const call l_and call l_eq ld de,%1 ;const ex de,hl call l_eq = ld de,%1 ;const call l_eq ld hl,%1 ;const ld l,(hl) ld h,0 = ld hl,(%1) ld h,0 %1c hl ld hl,%2 = ld hl,%2 ld hl,_udata%1 ld (hl),#(%2 % 256) inc hl ld (hl),#(%2 / 256) ld hl,%3 = ld hl,%2 ld (_udata%1),hl ld hl,%3 call l_gint ; call l_pint ld hl,%1 = ld a,(hl) ld (de),a inc hl inc de ld a,(hl) ld (de),a ld hl,%1 z88dk-1.8.ds1/lib/z80rules.10000644000175000017500000004301310437032617015034 0ustar tygrystygrys ld a,#(0 % 256) = xor a ld hl,%0 ;const ld a,l ld (%1),a ld hl,%2 = ld a,#(%0 % 256) ld (%1),a ld hl,%2 jp %0 .%0 = .%0 ex de,hl ld l,#(8 % 256) call l_asr_u = ld l,h ld h,0 ex de,hl ld l,#(8 % 256) call l_asr = ld a,h call l_sxt ex de,hl ld l,#(0 % 256) call l_asr%1 = ex de,hl ld l,#(8 % 256) call l_asl = ld h,l ld l,0 ex de,hl ld l,#(0 % 256) call l_asl = ex de,hl ld l,#(1 % 256) call l_asl = add hl,hl ld hl,0 ;const add hl,sp push hl call l_gint ;%9 inc hl pop de call l_pint = pop hl inc hl push hl ld hl,0 ;const add hl,sp call l_gint ;%9 inc hl pop bc push hl = pop hl inc hl push hl ld hl,0 ;const add hl,sp call l_gint ;%9 ld de,%1 add hl,de pop bc push hl = pop hl ld de,%1 ;const add hl,de push hl ld hl,0 ;const add hl,sp call l_gint ;%9 dec hl pop bc push hl = pop hl dec hl push hl ld hl,0 ;const add hl,sp push hl call l_gint ;%9 dec hl pop de call l_pint = pop hl dec hl push hl ld hl,2 ;const add hl,sp push hl call l_gint ;%9 inc hl pop de call l_pint = pop de pop hl inc hl push hl push de ld hl,2 ;const add hl,sp call l_gint ;%9 inc hl pop de pop bc push hl push de = pop de pop hl inc hl push hl pop de ld hl,0 ;const add hl,sp call l_gint ;%9 ld de,%1 add hl,de pop de pop bc push hl push de = pop de pop hl ld bc,%1 add hl,bc push hl push de ld hl,2 ;const add hl,sp call l_gint ;%9 dec hl pop de pop bc push hl push de = pop de pop hl dec hl push hl push de ld hl,2 ;const add hl,sp push hl call l_gint ;%9 dec hl pop de call l_pint = pop de pop hl dec hl push hl push de ld hl,2 ;const add hl,sp call l_gint ;%9 = pop bc pop hl push hl push bc call dload call dpush = call dldpsh jp nz,%1 jp %2 .%1 = jp z,%2 .%1 jp z,%1 jp %2 .%1 = jp nz,%2 .%1 jp nz,%1 jp z,%2 .%1 = jp z,%2 .%1 jp z,%1 jp nz,%2 .%1 = jp nz,%2 .%1 jp z,%1 call %2 .%1 = call nz,%2 .%1 jp nz,%1 call %2 .%1 = call z,%2 .%1 call _%1 ret = jp _%1 jp z,%1 jp %2 .%1 = jp nz,%2 .%1 ld hl,%1 ;const ex de,hl ld hl,%2 ;const = ld de,%1 ld hl,%2 ;const ld (%1),%2 ld %2,(%1) = ld (%1),%2 jp z,%1 ret .%1 = ret nz .%1 jp nz,%1 ret .%1 = ret z .%1 push hl ld hl,%1 ;const pop de = ld de,%1 ;const ex de,hl ld hl,0 ;const add hl,sp call l_gint ;%9 = pop hl push hl ld hl,%1 ;const add hl,sp ld de,%2 add hl,de = ld hl,%1+%2 ;const add hl,sp ld hl,%1 ;const add hl,sp inc hl = ld hl,%1+1 ;const add hl,sp ld de,0 ex de,hl call l_eq jp c,%1 = ld a,h or l jp z,%1 ld de,%1 ;const ex de,hl ld a,l ld (de),a = ld (hl),#(%1 % 256) ld l,(hl) ld h,0 push de push hl ld hl,1 ;const ld de,0 call l_long_add = call l_inclong push de push hl ld hl,2 ;const ld de,0 call l_long_add = call l_inclong call l_inclong push de push hl ld hl,65535 ;const ld de,65535 call l_long_add = call l_declong dec hl ld hl,%1 ;const = ld hl,%1 ;const inc hl ld hl,%1 ;const = ld hl,%1 ;const add hl,%1 ld hl,%2 ;const = ld hl,%2 ;const push bc pop bc push hl = push hl push bc ld hl,%1 ;const pop bc push hl = ld hl,%1 ;const push hl pop hl push hl pop bc ret = pop hl ret ld a,h or l jp nz,%1 ld hl,0 ;const pop bc ret = ld a,h or l jp nz,%1 pop bc ret ld hl,_%1 ld bc,%2 add hl,bc = ld hl,_%1+%2 ld hl,_%1 ld bc,-%2 add hl,bc = ld hl,_%1-%2 add hl,bc ld hl,_%1 inc hl = ld hl,_%1+1 ld hl,_%1 call l_gint ;%9 = ld hl,(_%1) ld hl,_%1 call l_glong = ld hl,(_%1) ld de,(_%1+2) ld hl,_%1 ld l,(hl) ld h,0 = ld hl,(_%1) ld h,0 ld hl,%1 ;const jp %2 ld hl,%1 ;const = ld hl,%1 ;const jp %2 pop bc pop hl push hl push bc pop bc pop bc ret = pop bc pop hl ret pop bc push hl pop hl push hl = pop bc push hl pop hl push hl ld bc,%1 add hl,bc pop bc push hl = pop hl ld bc,%1 add hl,bc push hl push bc push bc ld hl,%1 pop de pop bc push hl push de = ld hl,%1 push hl push bc ld hl,_%1 ld a,(hl) cp %3 = ld a,(_%1) cp %3 ld hl,_%1 ld a,(hl) and a = ld a,(_%1) and a ld de,%1 pop de = pop de pop bc ld hl,%1 ;const add hl,sp ld sp,hl = ld hl,%1+2 ;const add hl,sp ld sp,hl exx ld hl,%1 ;const add hl,sp ld sp,hl exx ld hl,%2 ;const add hl,sp ld sp,hl = exx ld hl,%1+%2 ;const add hl,sp ld sp,hl exx ld de,%1 pop de = pop de call l_int2long_s pop de = pop de jp i_%1 jp i_%2 = jp i_%1 ld hl,%1 ;const add hl,sp ld bc,%2 add hl,bc = ld hl,%1+%2 ;const add hl,sp call l_inclong ld hl,%1 = ld hl,%1 call l_declong ld hl,%1 = ld hl,%1 call exit pop %1 = call exit call exit ld hl,%1 ;const add hl,sp ld sp,hl = call exit push hl pop bc ret = ret ld de,1 ;const ex de,hl call l_eq jp nc,%1 = dec hl ld a,h or l jp nz,%1 ld de,1 ;const ex de,hl call l_eq jp c,%1 = dec hl ld a,h or l jp z,%1 ld de,65535 ;const ex de,hl call l_ne jp nc,%1 = inc hl ld a,h or l jp z,%1 push de ld hl,65535 ;const pop de call l_eq jp nc,%1 = inc de ld a,d or e jp nz,%1 push de ld hl,65535 ;const pop de call l_eq jp c,%1 = inc de ld a,d or e jp z,%1 push de ld hl,1 ;const pop de call l_eq jp c,%1 = dec de ld a,d or e jp z,%1 push de ld hl,1 ;const pop de call l_eq jp nc,%1 = dec de ld a,d or e jp nz,%1 ld de,65535 ;const ex de,hl call l_eq jp nc,%1 = inc hl ld a,h or l jp nz,%1 ld de,65535 ;const ex de,hl call l_eq jp c,%1 = inc hl ld a,h or l jp z,%1 ld hl,0 ;const ld de,0 call l_long_as%1 = pop bc pop bc ld hl,%1 ;const ld de,%2 call l_long_as%3 = ld l,#(%1 % 256) call l_long_as%3 push hl call l_glong push de push hl pop bc pop bc pop bc call l_plong = ld hl,%1 ;const add hl,sp ld hl,%2 = ld hl,%2 ld hl,%1 ;const call l_as%2 = ld l,#(%1 % 256) call l_as%2 ld de,%1 ;const ex de,hl call l_as%2 = ex de,hl ld l,#(%1 % 256) call l_as%2 ex de,hl pop hl push hl ex de,hl = pop de push de pop hl push hl ex de,hl = pop de push de .%1 jp %3 .%2 jp %1 .%3 = .%1 .%2 .%3 pop de pop bc push hl push de pop bc pop hl push hl push bc = pop de pop bc push hl push de ld a,h or l jp nz,%1 ld hl,1 ;const = ld a,h or l jp nz,%1 inc hl pop hl push hl ld a,l cp %2 jp z,%3 pop hl push hl ld a,l = pop hl push hl ld a,l cp %2 jp z,%3 ld hl,%1 ;const add hl,sp ld a,(hl) cp %2 jp z,%3 ld hl,%1 ;const add hl,sp ld a,(hl) = ld hl,%1 ;const add hl,sp ld a,(hl) cp %2 jp z,%3 push de push hl ld l,%1 call l_long_asl = ld a,%1 call l_long_aslo push de push hl ld l,%1 call l_long_asr%2 = ld c,%1 call l_long_asr%2o ld l,(hl) ld h,0 ld de,%1 ex de,hl = ld e,(hl) ld d,0 ld hl,%1 call l_gint ;%9 push hl ld hl,%1 = ld e,(hl) inc hl ld d,(hl) push de ld hl,%1 ld hl,_%1 ld de,%2 ex de,hl call l_pint = ld hl,%2 ld (_%1),hl pop bc push hl pop bc push hl = pop bc push hl ld hl,%1 ;const add hl,sp push hl call l_gint ;%9 pop de call l_pint = ld hl,%1 ;const add hl,sp call l_gint ;%9 ld hl,%1 ;const add hl,sp push hl call l_glong pop bc call l_plong = ld hl,%1 ;const add hl,sp call l_glong push de push hl ld hl,%1 ;const add hl,sp call l_gint ;%9 call l_int2long_s call l_long_asl = push hl ld hl,%1-2 ;const add hl,sp ld a,(hl) pop hl call l_long_aslo push de push hl ld hl,%1 ;const add hl,sp call l_gint ;%9 ld de,0 call l_long_asl = push hl ld hl,%1-2 ;const add hl,sp ld a,(hl) pop hl call l_long_aslo ld a,#(16 % 256) call l_long_aslo = ex de,hl ld hl,0 ;const push hl ld hl,(_%1 pop de = ex de,hl ld hl,(_%1 pop hl push hl ex de,hl = pop de push de ld hl,0 ;const add hl,sp ld a,(hl) add a,%1 ld (hl),a ld l,a ld h,0 = pop hl ld a,l add a,%1 ld l,a push hl ld h,0 push de pop bc pop hl push hl push bc = pop hl push hl push de push de ld hl,%1 ;const add hl,sp ld a,(hl) pop de = ld hl,%1-2 ;const add hl,sp ld a,(hl) ld hl,%1 push hl ld hl,%1 = ld hl,%1 push hl ld hl,%1 add hl,sp push hl ld hl,%1 add hl,sp = ld hl,%1 add hl,sp push hl dec hl dec hl ld hl,0 ;const jp %2 .%1 ld hl,1 ;const .%2 ld a,h or l jp z,%3 = ld hl,0 ;const jp %3 .%1 ld hl,1 ;const .%2 ld a,h or l jp z,%3 ld hl,(%1) ld h,0 dec hl ld a,l ld (%1),a = ld hl,%1 dec (hl) ld l,(hl) ld h,0 ld hl,(%1) ld h,0 inc hl ld a,l ld (%1),a = ld hl,%1 inc (hl) ld l,(hl) ld h,0 ld l,a ld h,0 ld hl,%1 = ld hl,%1 ld l,(hl) ld h,0 ld hl,%1 = ld hl,%1 ld hl,%1 %2 (hl) ld hl,(%1) ld h,0 = ld hl,%1 %2 (hl) ld l,(hl) ld h,0 ld l,a ld h,0 .%1 ld hl,%2 = .%1 ld hl,%2 ld a,l ld (de),a ld a,h or l jp z,%1 = ld a,l ld (de),a and a jp z,%1 ld a,l ld (de),a ld a,h or l jp nz,%1 = ld a,l ld (de),a and a jp nz,%1 ld e,(hl) ld d,0 ld hl,%1 ;const call l_eq jp nc,%2 ld hl,%3 = ld a,(hl) cp #(%1 % 256) jp nz,%2 ld hl,%3 ld e,(hl) ld d,0 ld hl,%1 ;const call l_eq jp c,%2 ld hl,%3 = ld a,(hl) cp #(%1 % 256) jp z,%2 ld hl,%3 ld e,(hl) ld d,0 ld hl,%1 ;const call l_ne jp c,%2 ld hl,%3 = ld a,(hl) cp #(%1 % 256) jp nz,%2 ld hl,%3 ld hl,(%1) ld h,0 ld a,h or l jp nz,%2 ld hl,%3 = ld a,(%1) and a jp nz,%2 ld hl,%3 push hl ld hl,(%1) ld h,0 pop de = ex de,hl ld hl,(%1) ld h,0 pop hl push hl push hl pop bc pop hl push hl push bc = pop hl push hl push hl ld de,0 ;const ex de,hl call l_eq pop bc push hl ld a,h or l jp z,%1 = pop bc push hl ld a,h or l jp nz,%1 push hl pop bc pop hl push hl push bc pop de = ex de,hl pop hl push hl push hl ld (%1),hl pop hl = ld (%1),hl ld l,(hl) ld h,0 ex de,hl ld hl,%1 = ld e,(hl) ld d,0 ld hl,%1 ld hl,_%1 ex de,hl pop hl push hl call l_pint = pop hl ld (_%1),hl push hl push hl pop hl ret = ret push de push hl ld hl,0 ;const ld de,0 call l_long_eq jp c,%1 = ld a,h or l or e or d jp z,%1 pop bc push hl ld a,h or l jp nz,%1 pop bc ret .%1 = pop bc ld a,h or l ret z push hl .%1 ; Rules for optimizing the tail of if statements (valid for && and || ) ; These are only valid if we don't try to set a variable to the logical result, if ; we do then it's a tad pointless and you'll suffer!!! ; Written August 1998 ; Updated for small C+ continuously through September ; Changes by DG implemented 28/9/98 ; GFX Stuff added 30/9/98 ; 19/10/98 Atexit stuff added ; 27/11/98 Atexit stuff rejigged to allow 32 levels of atexit ; ; 29/2/99 Added the include for zcc_opt so we now if float package ; required or not.. ; ; 14/3/99 Renamed the printf vars to smc_pf* ; ; 1/4/99 Changing to allow application startup ; ; - - - - - - - - ; ; $Id: z88_crt0.asm,v 1.6 2007/06/27 20:49:28 dom Exp $ ; ; - - - - - - - - MODULE z88_crt0 ;------- ; Include zcc_opt.def to find out information about us ;------- INCLUDE "zcc_opt.def" ;------- ; Some general scope declarations ;------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF coords ;Current graphics xy coords XDEF base_graphics ;Address of graphics map XDEF gfx_bank ;Bank for this XDEF _std_seed ;Integer rand() seed XDEF exitsp ;Pointer to atexit() stack XDEF exitcount ;Number of atexit() functions registered XDEF __sgoioblk ;std* control block XDEF processcmd ;Processing <> commands XDEF heaplast ;Near malloc heap variables XDEF heapblocks ; XDEF _cpfar2near ;Conversion of far to near data XDEF _vfprintf ;jp to printf() core routine XDEF snd_asave ;sound XDEF snd_tick ;sound ;------- ; Select which particular startup we want ;------- IF DEFINED_startup ; User specified startup type, so do as they wish then drop out otherwise ; Use -startup=1 for basic } (For sake of completeness only - don't ; -startup=2 for app } use them!) ; -startup=3 for code snippets IF (startup=1) INCLUDE "#bas_crt0.asm" ENDIF IF (startup=2) INCLUDE "#app_crt0.asm" ENDIF IF (startup=3) INCLUDE "#rel_crt0.asm" ENDIF IF (startup=4) INCLUDE "#dev_crt0.asm" ENDIF IF (startup=5) INCLUDE "#z88s_crt0.asm" ENDIF ELSE ELSE IF NEED_appstartup INCLUDE "#app_crt0.asm" ELSE INCLUDE "#bas_crt0.asm" ENDIF ENDIF z88dk-1.8.ds1/lib/z88_crt0.hdx0000644000175000017500000000777207130401717015355 0ustar tygrystygrys; ; This file is included by every module ; To handle multi module programs which use floating point ; routines in different modules, we have got rid of ; the conditional assembly around the float routines ; ; ; .globl for graphics fns ; .globl base_graphics ; ; stdio/printf things ; .globl _sf_string1 .globl _sf_oldch ; Process interrupt variable (**for apps only**) .globl packintrout ;Standard .globl for startup library.. .globl l_dcal .globl cleanup ;Hooks for library functions .globl l_gchar .globl l_sxt .globl l_gint .globl l_gint_eq .globl l_ghtonsint .globl l_pint .globl l_pint_eq .globl l_or .globl l_xor .globl l_and .globl l_eq .globl l_ne .globl l_gt .globl l_le .globl l_ge .globl l_lt .globl l_uge .globl l_ult .globl l_ugt .globl l_ule .globl l_cmp .globl l_ucmp .globl l_asr .globl l_asr_u .globl l_asl .globl l_sub .globl l_neg .globl l_com .globl l_lneg .globl l_bool .globl l_cm_de .globl l_cm_bc .globl l_deneg .globl l_bcneg .globl l_case .globl l_mult .globl l_div .globl l_div_u ;Long functions now .globl l_int2long_s .globl l_long2int_s .globl l_glong .globl l_long_add .globl l_long_and .globl l_long_asl .globl l_long_asr .globl l_long_aslo .globl l_long_asro .globl l_long_bool .globl l_long_cmp .globl l_long_com .globl l_long_eq .globl l_long_ge .globl l_long_gt .globl l_long_le .globl l_long_lneg .globl l_long_lt .globl l_long_ne .globl l_long_neg .globl l_long_or .globl l_long_sub .globl l_long_ucmp .globl l_long_uge .globl l_long_ugt .globl l_long_ule .globl l_long_ult .globl l_long_xor .globl l_plong .globl l_inclong .globl l_declong .globl l_long_div .globl l_long_div_u .globl l_long_mult .globl l_long_asr_u .globl l_long_asr_uo .globl l_long_case ;Now .globl for floating routines ; ;Since we're using startup module and are distancing that from here, ;we might as well set these permanently - djm 29/2/99 .globl DADD .globl DDIV .globl DGE .globl DIV1 .globl DIV17 .globl DLOAD .globl DLDPSH .globl DMUL .globl DSTORE .globl DSWAP .globl DSUB .globl DEQ .globl DGT .globl DLEq ;djm 7/10/98 .globl DLT .globl DNE .globl DPUSH .globl DPUSH2 .globl FA .globl extra .globl FADD .globl FDIV .globl FMUL .globl FSUB ; .globl GRIPE .globl PUSHF2 .globl LDBCFA .globl LDBCHL .globl LDFABC .globl MINUSFA ;negate FP number .globl NORMA .globl ODD .globl PUSHFA .globl SGN ; .globl OFLOW .globl FASIGN .globl NORM .globl COMPARE .globl INT2 .globl PI .globl HALFPI .globl float ;Convert int to float .globl ufloat ;unsigned int to float .globl ifix ;Convert float to int z88dk-1.8.ds1/lib/z88_crt0.opt0000644000175000017500000000003307130401716015352 0ustar tygrystygrys INCLUDE "#z88_crt0.asm" z88dk-1.8.ds1/lib/z88s_crt0.asm0000644000175000017500000002024110640546530015522 0ustar tygrystygrys; ; Startup stub for z88 Shell programs ; ; Created 12/2/2002 djm ; ; $Id: z88s_crt0.asm,v 1.8 2007/06/27 20:49:28 dom Exp $ INCLUDE "#stdio.def" INCLUDE "#error.def" INCLUDE "#shellapi.def" org shell_loadaddr-shell_headerlen .header_start defm "!bin" defb shell_verh defb shell_verm defb shell_verl defb 13 .shell_length defw 0 ; Fill in by make program defw start ;----------- ; Code starts executing from here ;----------- .start push bc ; Preserve registers that need to be push de ld (saveix),ix ld (saveiy),iy ld (start1+1),sp ;Save starting stack ld hl,(shell_cmdlen) ld de,(shell_cmdaddr) add hl,de ld (hl),0 ; terminate command line ld hl,-100 ; atexit stack (64) + argv space add hl,sp ld sp,hl ld (exitsp),sp call doerrhan ;Initialise a laughable error handler ;----------- ; Initialise the (ANSI) stdio descriptors so we can be called agin ;----------- IF DEFINED_ANSIstdio ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ;; Read in argc/argv ld hl,0 ; NULL pointer at end just in case push hl ;; Try and work out the length available ld hl,(shell_cmdlen) ld de,(shell_cmdaddr) add hl,de ; points to end ex de,hl ; end now in de, hl=cmdaddr ld bc,(shell_cmdptr) add hl,bc ; start in hl push de ; save end ex de,hl ; hl = end, de = start and a sbc hl,de ; hl is length available ex de,hl ; is now in de pop hl ; points to terminator ld c,0 ; number of arguments ld a,d or e jr z,argv_none dec hl dec de ; available length .argv_loop ld a,d or e jr z,argv_exit ld a,(hl) cp ' ' jr nz,argv_loop2 ld (hl),0 ; terminate previous one inc hl inc c push hl dec hl .argv_loop2 dec hl dec de jr argv_loop .argv_exit push hl ; first real argument inc c .argv_none ld hl,end ; program name inc c push hl ld hl,0 add hl,sp ; address of argv ld b,0 push bc ; argc push hl ; argv ld hl,(shell_cmdlen) ld (shell_cmdptr),hl call_oz(gn_nln) ; Start a new line... IF DEFINED_farheapsz call init_far ;Initialise far memory if required ENDIF call _main ;Run the program IF DEFINED_farheapsz call freeall_far ;Initialise far memory if required ENDIF pop bc ; kill argv pop bc ; kill argc .cleanup ;Jump back here from exit() if needed IF DEFINED_ANSIstdio LIB closeall call closeall ;Close any open files (fopen) ENDIF call resterrhan ;Restore the original error handler .start1 ld sp,0 ;Restore stack to entry value ld ix,(saveix) ;Get back those registers ld iy,(saveiy) pop de pop bc jp shell_next ; phew! back to Forth at last. ;----------- ; Install the error handler ;----------- .doerrhan xor a ld (exitcount),a ld b,0 ld hl,errhand call_oz(os_erh) ld (l_erraddr),hl ld (l_errlevel),a ret ;----------- ; Restore BASICs error handler ;----------- .resterrhan ld hl,(l_erraddr) ld a,(l_errlevel) ld b,0 call_oz(os_erh) .processcmd ;processcmd is called after os_tin ld hl,0 ret ;----------- ; The error handler ;----------- .errhand ret z ;Fatal error cp rc_esc jr z,errescpressed ld hl,(l_erraddr) ;Pass everything to BASIC's handler scf .l_dcal jp (hl) ;Used for function pointer calls also .errescpressed call_oz(os_esc) ;Acknowledge escape pressed jr cleanup ;Exit the program ;----------- ; Select which vfprintf routine is needed ;----------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;-------- ; Far memory setup ;-------- IF DEFINED_farheapsz LIB freeall_far XDEF farpages XDEF malloc_table XDEF farmemspec XDEF pool_table INCLUDE "#init_far.asm" ; Variables that can't be place in the normal defvars .copybuff defs 258 .actual_malloc-table defs ((farheapsz/256)+1)*2 ; Now some memory shared with Forth - same as application setup DEFVARS 8192 { pool_table ds.b 224 malloc_table ds.w 1 farpages ds.w 1 farmemspec ds.b 1 } ENDIF ;-------- ; This bit of code allows us to use OZ ptrs transparently ; We copy any data from up far to a near buffer so that OZ ; is happy about it ; Prototype is extern void __FASTCALL__ *cpfar2near(far void *) ;-------- IF DEFINED_farheapsz LIB strcpy_far ._cpfar2near pop bc ;ret address pop hl pop de ;far ptr push bc ;keep ret address ld a,e and a ret z ;already local push ix ;keep ix safe ld bc,0 ;local push bc ld bc,copybuff push bc ;dest push de ;source push hl call strcpy_far pop bc ;dump args pop bc pop bc pop bc pop ix ;get ix back ld hl,copybuff ret ELSE ; We have no far code installed so all we have to do is fix the stack ._cpfar2near pop bc pop hl pop de push bc ret ENDIF ;---------- ; The system() function for the shell ;---------- XDEF _system ._system pop de ; DE=return address pop bc ; BC=command address push bc push de push bc ; Forth stack: addr-- ld hl,system_forthcode call _shellapi ; Forth stack: flag-- pop hl ; HL=0 or error code ret .system_forthcode defw shell_also,shell_internal,shell_ztos,shell_eval,shell_previous defw shellapi_back ;---------- ; The shellapi() interface ;---------- XDEF _shellapi ._shellapi push hl call resterrhan ;restore forth error handler pop de ; DE=Forth's IP ld iy,(saveiy) ; IY=Forth's UP ld ix,(saveix) ; IX=Forth's RSP pop hl dec ix ld (ix+0),h ; save return address on Forth's return stack dec ix ld (ix+0),l pop bc ; BC=TOS jp shell_next ; execute Forth code .shellapi_back push bc ; stack TOS ld e,(ix+0) ld d,(ix+1) push de ; stack return address call doerrhan ;put c error hander back ret ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;----------- ; Now some variables ;----------- .l_erraddr defw 0 ; BASIC error handler address .l_errlevel defb 0 ; And error level .coords defw 0 ; Current graphics xy coordinates .base_graphics defw 0 ; Address of the Graphics map .gfx_bank defb 0 ; And the bank ._std_seed defw 0 ; Seed for integer rand() routines .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack IF DEFINED_NEED1bitsound .snd_asave defb 0 ; Sound variable .snd_tick defb 0 ; " " ENDIF .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks .packintrout defw 0 ; Address of user interrupt routine .saveix defw 0 ; Save ix for system() calls .saveiy defw 0 ; Save iy for system() calls ;----------- ; Unnecessary file signature ;----------- defm "Small C+ z88shell" .end defb 0 ;----------- ; Floating point ;----------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ; FP seed (unused ATM) .extra defs 6 ; Extra register temp store .fa defs 6 ; "" .fasign defb 0 ; "" ENDIF z88dk-1.8.ds1/lib/zsock.def0000644000175000017500000000416407357654106015105 0ustar tygrystygryslstoff ; ; Package defines for ZSock ; ; djm 11/2/2000 ; ; Because ZSock is a big package we have a single ; call to avoid the (large) overhead of switching in ; all the relevent banks for all the routines ; defc package_id = $15 defc tcp_inf = $0015 defc tcp_ayt = $0215 defc tcp_bye = $0415 defc tcp_dat = $0615 defc tcp_exp = $0815 ; Standard ones out the way, now come package ones defc tcp_int = $0A15 defc tcp_all = $0C15 ; Turn device on/offline - for slip stop sending packets defc tcp_offline = $0E15 defc tcp_online = $1015 ; These two page in/out data segment (useful for daemons) defc tcp_pgin = $1215 defc tcp_pgout = $1415 defc tcp_GoTCP = $1615 ;busy loop for tcp ; Reason codes for tcp_all (given to tcp_all in a) defc r_sock_write = 0 defc r_sock_putc = 1 defc r_sock_puts = 2 defc r_sock_flush = 3 defc r_sock_read = 4 defc r_sock_close = 5 defc r_sock_abort = 6 defc r_sock_shutdown = 7 defc r_sock_dataready = 8 defc r_sock_opened = 9 defc r_sock_closed = 10 defc r_sock_listen = 11 defc r_sock_open = 12 defc r_sock_settimeout = 13 defc r_sock_chktimeout = 14 defc r_tcp_settimeout = 15 defc r_tcp_setctimeout = 16 defc r_tcp_chktimeout = 17 defc r_resolve = 18 defc r_reverse_addr_lookup = 19 defc r_getservbyname = 20 defc r_getservbyport = 21 defc r_getservprotobyport = 22 defc r_getservprotobyname = 23 defc r_getprotobyname = 24 defc r_getprotobynumber = 25 defc r_getnetbyname = 26 defc r_getnetbynumber = 27 defc r_getdomainname = 28 defc r_gethostaddr = 29 defc r_sethostaddr = 30 defc r_setnameservers = 31 defc r_getnetstat = 32 defc r_inet_addr = 33 defc r_inet_ntoa = 34 defc r_tcp_malloc = 35 defc r_tcp_calloc = 36 defc r_tcp_free = 37 defc r_tcp_regcatchall = 38 defc r_sock_setptr = 39 defc r_sock_getptr = 40 defc r_sock_sethandler = 41 defc r_sock_setrsize = 42 defc r_sock_setmode = 43 defc r_sock_waitopen = 44 defc r_killdaemon = 45 defc r_sock_waitclose = 46 defc r_sock_settos = 47 defc r_sock_setttl = 48 defc r_sock_pair_listen = 49 defc r_sock_setssize = 50 defc r_sock_recv = 51 defc r_sock_getinfo = 52 lston z88dk-1.8.ds1/lib/zx81_altint.def0000644000175000017500000001104610731746267016136 0ustar tygrystygrys; CRT0 for the ZX81 - SLOW MODE ; ; ; ---------------------------------------------------------------------------------------- ; Modified display handler to preserve IY ; Note: a swap between IX and IY happens "on the fly" during assembly ! ; ---------------------------------------------------------------------------------------- ; ; Stefano Bodrato Sept. 2007 ; Sync fixed by Siegfried Engel - Dec. 2007 ; ; - - - - - - - ; ; $Id: zx81_altint.def,v 1.7 2007/12/18 13:35:51 stefano Exp $ ; ; - - - - - - - ;-------------------------------------------------------------- ;-------------------------------------------------------------- XDEF hrg_on XDEF hrg_off ;======== ; Not HRG really, but switches the new interrupt handler with no sighs ;======== hrg_on: call $F2B ; SLOW ld hl,L0281 push hl jr HRG_Sync hrg_off: ld hl,$281 push hl ;ld a,$1e ;ld i,a HRG_Sync: ld hl,$4034 ; FRAMES counter ld a,(hl) ; get old FRAMES HRG_Sync1: cp (hl) ; compare to new FRAMES jr z,HRG_Sync1 ; exit after a change is detected pop iy ; switch to new display handler ret ;-------------------------------------------------------------- ;-------------------------------------------------------------- ;; DISPLAY-1 L0229: LD HL,($4034) ; fetch two-byte system variable FRAMES. DEC HL ; decrement frames counter. ;; DISPLAY-P L022D: LD A,$7F ; AND H ; OR L ; LD A,H ; JR NZ,L0237 ; to ANOTHER RLA ; JR L0239 ; to OVER-NC ; --- ;; ANOTHER L0237: LD B,(HL) ; SCF ; Set Carry Flag ;; OVER-NC L0239: LD H,A ; LD ($4034),HL ; sv FRAMES_lo RET NC ; ;; DISPLAY-2 L023E: push ix ld ix,16384 CALL $2BB ; routine KEYBOARD pop ix LD BC,($4025) ; sv LAST_K LD ($4025),HL ; sv LAST_K LD A,B ; ADD A,$02 ; SBC HL,BC ; LD A,($4027) ; sv DEBOUNCE OR H ; OR L ; LD E,B ; LD B,$0B ; LD HL,$403B ; system variable CDFLAG RES 0,(HL) ; JR NZ,L0264 ; to NO-KEY BIT 7,(HL) ; SET 0,(HL) ; RET Z ; DEC B ; NOP ; SCF ; Set Carry Flag ;; NO-KEY L0264: LD HL,$4027 ; sv DEBOUNCE CCF ; Complement Carry Flag RL B ; ;; LOOP-B L026A: DJNZ L026A ; to LOOP-B LD B,(HL) ; LD A,E ; CP $FE ; SBC A,A ; LD B,$1F ; OR (HL) ; AND B ; RRA ; LD (HL),A ; OUT ($FF),A ; LD HL,($400C) ; sv D_FILE_lo SET 7,H ; CALL L0292 ; routine DISPLAY-3 ; --- ;; R-IX-1 L0281: LD A,R ; LD BC,$1901 ; LD A,$F5 ; CALL $2B5 ; routine DISPLAY-5 DEC HL ; CALL L0292 ; routine DISPLAY-3 ; --- ;; R-IX-2 L028F: JP L0229 ; to DISPLAY-1 ; --- ;; DISPLAY-3 L0292: POP IY ; return address to IX register (-IXIY swap). ; will be either L0281 or L028F - see above. ; Modified here to keep IY unchanged ld a,(16424) ; load C with MARGIN ld c,a ld a,(16443) ; test CDFLAG bit 7,a jp z,$2a9 ld a,c neg inc a ex af,af out ($FE),a ld hl,(frames) ; clock handler inc hl ld (frames),hl ld a,h or l jp nz,nofr1 ld hl,frames+1 inc (hl) .nofr1 jp $2A4 z88dk-1.8.ds1/lib/zx81_crt0.asm0000644000175000017500000001604010710126720015513 0ustar tygrystygrys; CRT0 for the ZX81 ; ; Stefano Bodrato Apr. 2000 ; ; If an error occurs (eg. out if screen) we just drop back to BASIC ; ; ZX81 will be thrown in FAST mode by default. ; The "startup=2" parameter forces the SLOW mode. ; Values for "startup" from 3 to 6 activate the HRG modes ; ; - - - - - - - ; ; $Id: zx81_crt0.asm,v 1.22 2007/10/25 14:53:04 stefano Exp $ ; ; - - - - - - - MODULE zx81_crt0 ;------- ; Include zcc_opt.def to find out information about us ;------- INCLUDE "zcc_opt.def" ;------- ; Some general scope declarations ;------- XREF _main ;main() is always external to crt0 code XDEF cleanup ;jp'd to by exit() XDEF l_dcal ;jp(hl) XDEF _vfprintf ;jp to the printf() core XDEF exitsp ;atexit() variables XDEF exitcount XDEF __sgoioblk ;stdio info block XDEF heaplast ;Near malloc heap variables XDEF heapblocks XDEF hr_rows ;Current number of text rows in graphics mode XDEF _hr_rows ;as above for C declarations XDEF text_rows ;as above for VT ANSI mode XDEF base_graphics ;Graphical variables XDEF _base_graphics ;as above for C declarations XDEF coords ;Current xy position XDEF save81 ;Save ZX81 critical registers XDEF restore81 ;Restore ZX81 critical registers XDEF frames ;Frame counter for time() org 16514 ; Hide the mess in the REM line from BASIC program listing ; jr start ; defb 118,255 ; block further listing ; As above, but more elegant ld a,(hl) ; hide the first 6 bytes of REM line jp start ; invisible ._base_graphics ; Address of the Graphics map.. .base_graphics ; it is POKEable at address 16518/16519 IF DEFINED_hrgpage defw hrgpage ELSE defw 0 ENDIF defb 'Z'-27 ; Change this with your own signature defb '8'-20 defb '8'-20 defb 'D'-27 defb 'K'-27 defb 0 defb 'C'+101 defb 149 ; '+' defb 118,255 ; block further listing .start call save81 IF (!DEFINED_startup | (startup=1)) ; FAST mode, safest way to use the special registers call $F23 ; FAST mode ;call $2E7 ;setfast ENDIF IF (startup>=2) call hrg_on IF ((startup=3)|(startup=5)) ld a,1 ld (hrgbrkflag),a call hrg_on ENDIF ENDIF ; this must be after 'hrg_on', sometimes ; the stack will be moved to make room ; for high-resolution graphics. ld (start1+1),sp ;Save entry stack ;ld hl,-64 ;Create an atexit() stack ld hl,0 ;Create an atexit() stack add hl,sp ld sp,hl ld (exitsp),sp IF !DEFINED_nostreams IF DEFINED_ANSIstdio ; Set up the std* stuff so we can be called again ld hl,__sgoioblk+2 ld (hl),19 ;stdin ld hl,__sgoioblk+6 ld (hl),21 ;stdout ld hl,__sgoioblk+10 ld (hl),21 ;stderr ENDIF ENDIF call _main ;Call user program .cleanup ; ; Deallocate memory which has been allocated here! ; push hl ; keep return code IF !DEFINED_nostreams IF DEFINED_ANSIstdio LIB closeall call closeall ENDIF ENDIF call restore81 IF (startup>=2) IF ((startup=3)|(startup=5)) xor a ld (hrgbrkflag),a ELSE call hrg_off ; this is valid for mode 2, too ! ENDIF ELSE IF (!DEFINED_startup | (startup=1)) call $F2B ; SLOW mode ;call $207 ;slowfast ENDIF ENDIF pop bc ; return code (for BASIC) .start1 ld sp,0 ;Restore stack to entry value ret .l_dcal jp (hl) ;Used for function pointer calls jp (hl) .restore81 IF (!DEFINED_startup | (startup=1)) ex af,af ld a,(a1save) ex af,af ENDIF exx ld hl,(hl1save) ;ld bc,(bc1save) ;ld de,(de1save) exx ld ix,16384 ; IT WILL BECOME IY !! ret .save81 IF (!DEFINED_startup | (startup=1)) ex af,af ld (a1save),a ex af,af ENDIF exx ld (hl1save),hl ;ld (bc1save),bc ;ld (de1save),de exx ret IF (!DEFINED_startup | (startup=1)) .a1save defb 0 ENDIF .hl1save defw 0 ;.bc1save defw 0 .de1save defw 0 ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;--------------------------------------- ; Modified IRQ handler ;--------------------------------------- IF (startup=2) INCLUDE "#zx81_altint.def" ENDIF ;--------------------------------------- ; High Resolution Graphics (Wilf Rigter WRX mode) ; Code my Matthias Swatosch ;--------------------------------------- IF (startup>=3) INCLUDE "#zx81_hrg.def" ENDIF ;----------- ; Now some variables ;----------- IF (startup>=3) .text_rows .hr_rows ._hr_rows IF (startup>=5) defw 8 ; Current number of text rows in graphics mode ELSE defw 24 ; Current number of text rows in graphics mode ENDIF ENDIF .coords defw 0 ; Current graphics xy coordinates IF !DEFINED_HAVESEED XDEF _std_seed ;Integer rand() seed ._std_seed defw 0 ; Seed for integer rand() routines ENDIF .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack .heaplast defw 0 ; Address of last block on heap .heapblocks defw 0 ; Number of blocks .frames defw 0 ; counter handled with new interrupt defb 0 ; third byte for "frames" defm "Small C+ ZX81" ;Unnecessary file signature defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/zx81_crt0.opt0000644000175000017500000000003307130401717015534 0ustar tygrystygrys INCLUDE "#zx81_crt0.asm" z88dk-1.8.ds1/lib/zx81_hrg.def0000644000175000017500000002464710712652535015427 0ustar tygrystygrys; CRT0 for the ZX81 - HIGH RESOLUTION MODE (WRX trick by Wilf Rigter) ; ; This code comes from the 'HRG_Tool' by Matthias Swatosch ; Display handler modifications (to preserve IY) by Stefano Bodrato ; ; ; - - - - - - - ; ; $Id: zx81_hrg.def,v 1.12 2007/11/02 16:50:37 stefano Exp $ ; ; - - - - - - - XDEF hrg_on XDEF hrg_off IF (startup>=5) IF (startup=7) IF DEFINED_MEM8K DEFC TOPOFRAM = $6000 DEFC BASE_VRAM = $5000 DEFC NEW_RAMTOP = $4F80 ELSE DEFC TOPOFRAM = $8000 DEFC BASE_VRAM = $7000 DEFC NEW_RAMTOP = $6F80 ENDIF DEFC WHOLEMEM = 4096+128 ; size of graphics map in grayscale mode ELSE IF DEFINED_MEM8K DEFC TOPOFRAM = $6000 DEFC BASE_VRAM = $5800 DEFC NEW_RAMTOP = $5780 ELSE DEFC TOPOFRAM = $8000 DEFC BASE_VRAM = $7800 DEFC NEW_RAMTOP = $7780 ENDIF DEFC WHOLEMEM = 2048+128 ; size of graphics map in 256x64 mode ENDIF ELSE IF DEFINED_MEM8K DEFC TOPOFRAM = $6000 DEFC BASE_VRAM = $4800 DEFC NEW_RAMTOP = $4780 ELSE DEFC TOPOFRAM = $8000 DEFC BASE_VRAM = $6800 DEFC NEW_RAMTOP = $6780 ENDIF DEFC WHOLEMEM = 6144+128 ; size of graphics map in 256x192 mode ENDIF IF ((startup=3)|(startup=5)) .hrgbrkflag defb 0 ENDIF ;-------------------------------------------------------------- ;-------------------------------------------------------------- ;------------------------------------------ ; ; ZX81 system variables ; ;------------------------------------------ ;DEFC ERR_NR = 16384 ;byte one less than the report code ;DEFC FLAGS = 16385 ;byte flags to control the BASIC system. ;DEFC MODE = 16390 ;byte Specified K, L, F or G cursor. ;DEFC PPC = 16391 ;word Line number of statement currently being executed DEFC ERR_SP = 16386 ;word Address of first item on machine stack (after GOSUB returns). DEFC RAMTOP = 16388 ;word Address of first byte above BASIC system area. ;---------------------------------------------------------------- ; ; Switch to HRG mode ; "base_graphics" has to point to a reasonable adress ; ;---------------------------------------------------------------- hrg_on: call $F2B ; SLOW IF !DEFINED_hrgpage ld hl,(base_graphics) ld a,h or l call z,HRG_Interface_BaseRamtop ; if zero, make space and adjust ramtop for 16K ENDIF IF (startup=7) ld hl,(base_graphics) ld (graybit1),hl ld de,2048 add hl,de ld (graybit2),hl ld (current_graphics),hl ENDIF call HRG_Sync ld iy,HRG_handler ; starts the hires mode when JP (IX) is made ret ;---------------------------------------------------------------- ; ; Switch to TXT mode ; ;---------------------------------------------------------------- hrg_off: call HRG_Sync ld iy,$281 ; switch back to text (original video routine) ld a,$1e ld i,a ret ;---------------------------------------------------------------- ; ; Sync display before mode switching ; ;---------------------------------------------------------------- HRG_Sync: ld hl,$4034 ; FRAMES counter ld a,(hl) ; get old FRAMES HRG_Sync1: cp (hl) ; compare to new FRAMES jr z,HRG_Sync1 ; exit after a change is detected ret ;---------------------------------------------------------------- ; ; This is the HRG handler ; ;---------------------------------------------------------------- ;calculation of label above 32k HRG_handler: ld b,6 ; delay sets the left edge of the screen HRG_wait_left: djnz HRG_wait_left ; delay loop ld hl,0 ; delay fine tuning here! Do not change! nop ; delay fine tuning here! Do not change! dec b ; make Z flag=0 IF (startup=7) ld hl,(current_graphics) ELSE ld hl,(base_graphics) ENDIF ld de,32 ; 32 bytes offset is added to HL for next hline IF (startup>=5) ld b,64 ; 64 lines per hires screen ELSE ld b,192 ; 192 lines per hires screen ENDIF HRG_outloop: ld a,h ; get HGR address MSB from HL ld i,a ; load MSB into I register which is RFSH address MSB ld a,l ; get HGR address LSB from HL call (HRG_LineStart + $8000) add hl,de ; add 32 to HL to point to next hline dec b ; decrement line counter jp nz,HRG_outloop ; test for last line ld hl,(frames) ; clock handler inc hl ld (frames),hl ld a,h or l jp nz,nofr1 ld hl,frames+1 inc (hl) .nofr1 ;call $0292 ; return to application program ; Different from original call to keep IY unchanged ; and to eventually add blank lines ld iy,pointedbyix ; in ROM we'd have had a POP IX and JP IX as a 'return' ld a,(16424) ; MARGIN ; this idea comes from the Wilf Rigter's WRX1K hi-resolution implementation ; if we run in 64 lines mode we need to increase the number of border's lines IF (startup>=5) add 140 ; more blank lines for fast application code and correct sync ; Siegfried Engel reports that values between 80 and 159 worked ; fine on both a normal TV and an LCD one ENDIF ld c,a ; load C with MARGIN ld a,(16443) ; test CDFLAG bit 7,a jp $29b ; save blank lines, start NMI, POP registers and RETURN pointedbyix: push ix ld ix,16384 call $0220 ; first PUSH register, then do VSYNC and get KEYBD IF ((startup=3)|(startup=5)) call $0F46 ; check break (space) key jp c,nobrkk ld a,(hrgbrkflag) ; set to '0' if program isn't running and a jr z,nobrkk SCF .nobrkk ENDIF pop ix IF ((startup=3)|(startup=5)) ld a,$1e ; the I register is restored with the MSB address ld i,a ; of the ROM pattern table in case of BREAK key down jp nc,$02A4 ENDIF IF (startup=7) ld hl,gcount ;res 7,(hl) inc (hl) ld a,(hl) dec a jp z,Display_pic1 dec a jp z,Display_pic2 ld (hl),0 Display_pic1: ld hl,(graybit1) jp setpage Display_pic2: ld hl,(graybit2) setpage: ld (current_graphics),hl ENDIF ld iy,HRG_handler ; reload vector if no BREAK or else SINCLAIR video jp $02A4 ; now return to BASIC and other application programs ;---------------------------------------------------------------- ; Variables for grayscale graphics ;---------------------------------------------------------------- IF (startup=7) XDEF graybit1 XDEF graybit2 gcount: defb 0 current_graphics: defw 0 graybit1: defw 0 graybit2: defw 0 ENDIF ;---------------------------------------------------------------- ; ; This is a dummy-line used for HRG output ; ;---------------------------------------------------------------- HRG_LineStart: ld r,a ; load LSB to R register which is RFSH address LSB defb 0, 0, 0, 0 ; 32 NOPs = 32x8 bits = 256 pixels each HLINE defb 0, 0, 0, 0 defb 0, 0, 0, 0 defb 0, 0, 0, 0 defb 0, 0, 0, 0 defb 0, 0, 0, 0 defb 0, 0, 0, 0 defb 0, 0, 0, 0 ret nz ; always returns because Z flag=0 ;---------------------------------------------------------------- ; ; End of HRG handler ; ;---------------------------------------------------------------- IF !DEFINED_hrgpage ;-------------------------------------------------------------- ; ; HRG_Interface_BaseRamtop ; ; checks if RAMTOP is set to 16k ram pack ; if so it lowers RAMTOP, copies stack and adapts all ; needed variables so that the program can coninue without ; NEW. ; And of course it sets HRG base to the location over ; RAMTOP ; ;-------------------------------------------------------------- HRG_Interface_BaseRamtop: ld hl,(RAMTOP) ld de,TOPOFRAM ;is RAMTOP in original 8k/16k position? xor a sbc hl,de ld a,h or l jr z,HRG_Interface_BaseRamtopModify ld hl,(RAMTOP) ld de,NEW_RAMTOP ;is RAMTOP already lowered? xor a sbc hl,de ld a,h or l ;no, so this is a problem! jr nz,HRG_Interface_BaseRamError ld hl,BASE_VRAM ;yes, then set base_graphics ld (base_graphics),hl ret HRG_Interface_BaseRamtopModify: ld hl,BASE_VRAM ld (base_graphics),hl ld hl,NEW_RAMTOP ;lower RAMTOP ld (RAMTOP),hl ld hl,(ERR_SP) ld de,WHOLEMEM xor a sbc hl,de ld (ERR_SP),hl ;lower ERR_SP ld hl,$0000 add hl,sp ;load SP into HL push hl ; *** stack pointer ld de,TOPOFRAM ;prepare to copy the stack ex de,hl xor a sbc hl,de ld de,$0040 add hl,de ;stackdeepth in HL push hl pop bc ;stackdeepth in BC ld hl,TOPOFRAM-1 ;make a copy of the stack ld de,NEW_RAMTOP-1 lddr pop hl ; *** stackpointer in HL ld de,WHOLEMEM xor a sbc hl,de ;lower the stackpointer ld sp,hl ;WOW! HRG_Interface_BaseRamError: ;rst $08 ;error ;defb $1a ;type R ; Nothig is as expected: let's put graphics just above the actual RAMTOP ; and cross fingers ld hl,(RAMTOP) ld (base_graphics),hl ret ENDIF z88dk-1.8.ds1/lib/zxfp.def0000644000175000017500000000566307635350725014747 0ustar tygrystygryslstoff ; ZX Spectrum stack calculator functions (ZXFP) ; $Id: zxfp.def,v 1.6 2003/03/17 13:47:01 stefano Exp $ ; function codes: ; RST 28h activates the FP calculator DEFC ZXFP_BEGIN_CALC = $28 DEFC ZXFP_STK_PTR = $5C65 DEFC ZXFP_STK_STORE = $2AB6 DEFC ZXFP_TEST_5_FP = $33A9 DEFC ZXFP_STK_STR = $2AB2 DEFC ZXFP_STK_FETCH = $2BF1 DEFC ZXFP_STACK_A = $2D28 DEFC ZXFP_STACK_BC = $2D2B DEFC ZXFP_FP_TO_BC = $2DA2 DEFC ZXFP_FP_TO_A = $2DD5 DEFC ZXFP_INT_TO_FP = $2D3B DEFC ZXFP_DEC_TO_FP = $2C9B DEFC ZXFP_DO_RESTACK = $3297 DEFC ZXFP_JUMP_TRUE = $00 DEFC ZXFP_EXCHANGE = $01 DEFC ZXFP_DELETE = $02 DEFC ZXFP_SUBTRACT = $03 DEFC ZXFP_MULTIPLY = $04 DEFC ZXFP_DIVISION = $05 DEFC ZXFP_TO_POWER = $06 DEFC ZXFP_OR = $07 DEFC ZXFP_NO_AND_NO = $08 DEFC ZXFP_NO_L_EQL = $09 DEFC ZXFP_NO_GR_EQL = $0A DEFC ZXFP_NOS_NEQL = $0B DEFC ZXFP_NO_GRTR = $0C DEFC ZXFP_NO_LESS = $0D DEFC ZXFP_NOS_EQL = $0E DEFC ZXFP_ADDITION = $0F DEFC ZXFP_STR_AND_NO = $10 ; String and Number DEFC ZXFP_STR_L_EQL = $11 ; String <= DEFC ZXFP_STR_GR_EQL = $12 ; String >= DEFC ZXFP_STRS_NEQL = $13 ; String <> DEFC ZXFP_STRS_GRTR = $14 ; String > DEFC ZXFP_STRS_LESS = $15 ; String < DEFC ZXFP_STRS_EQL = $16 ; String = DEFC ZXFP_STRS_ADD = $17 ; String addition DEFC ZXFP_VAL_STR = $18 ; VAL$ DEFC ZXFP_USR_STR = $19 ; Computes the UDG Addresses DEFC ZXFP_READ_IN = $1A DEFC ZXFP_NEGATE = $1B DEFC ZXFP_CODE = $1C DEFC ZXFP_VAL = $1D DEFC ZXFP_LEN = $1E DEFC ZXFP_SIN = $1F DEFC ZXFP_COS = $20 DEFC ZXFP_TAN = $21 DEFC ZXFP_ASN = $22 DEFC ZXFP_ACS = $23 DEFC ZXFP_ATN = $24 DEFC ZXFP_LN = $25 DEFC ZXFP_EXP = $26 DEFC ZXFP_INT = $27 DEFC ZXFP_SQR = $28 DEFC ZXFP_SGN = $29 DEFC ZXFP_ABS = $2A DEFC ZXFP_PEEK = $2B DEFC ZXFP_IN = $2C DEFC ZXFP_USR_NO = $2D DEFC ZXFP_STRS = $2E DEFC ZXFP_CHRS = $2F DEFC ZXFP_NOT = $30 DEFC ZXFP_DUPLICATE = $31 DEFC ZXFP_N_MOD_M = $32 DEFC ZXFP_JUMP = $33 DEFC ZXFP_STK_DATA = $34 DEFC ZXFP_DEC_JR_NZ = $35 ; DJNZ DEFC ZXFP_LESS_0 = $36 DEFC ZXFP_GREATER_0 = $37 DEFC ZXFP_END_CALC = $38 ; END DEFC ZXFP_GET_ARGT = $39 DEFC ZXFP_TRUNCATE = $3A DEFC ZXFP_FP_CALC_2 = $3B DEFC ZXFP_E_TO_FP = $3C DEFC ZXFP_RE_STACK = $3D DEFC ZXFP_SERIES_06 = $3E ; Polynomenentwicklung DEFC ZXFP_ST_MEM_0 = $C0 DEFC ZXFP_ST_MEM_1 = $C1 DEFC ZXFP_ST_MEM_2 = $C2 DEFC ZXFP_ST_MEM_3 = $C3 DEFC ZXFP_ST_MEM_4 = $C4 DEFC ZXFP_ST_MEM_5 = $C5 DEFC ZXFP_GET_MEM_0 = $E0 DEFC ZXFP_GET_MEM_1 = $E1 DEFC ZXFP_GET_MEM_2 = $E2 DEFC ZXFP_GET_MEM_3 = $E3 DEFC ZXFP_GET_MEM_4 = $E4 DEFC ZXFP_GET_MEM_5 = $E5 DEFC ZXFP_STK_ZERO = $3F DEFC ZXFP_STK_ONE = $A1 DEFC ZXFP_STK_HALF = $A2 DEFC ZXFP_STK_PI_D_2 = $A3 DEFC ZXFP_STK_TEN = $A4 ; System variables DEFC ZXFP_CH_ADD = $5C5D lston z88dk-1.8.ds1/lib/zxr_crt0.asm0000644000175000017500000001061210640546530015532 0ustar tygrystygrys; ; Startup for Residos packages ; ; $Id: zxr_crt0.asm,v 1.2 2007/06/27 20:49:28 dom Exp $ ; MODULE zxs_crt0 org 0 INCLUDE "zcc_opt.def" INCLUDE "zxsysvar48.def" ; Define all the restarts to go to an appropriate routine if (ASMPC<>$0000) defs CODE_ALIGNMENT_ERROR endif .restart0 jp call_rom3 defs $0008-ASMPC if (ASMPC<>$0008) defs CODE_ALIGNMENT_ERROR endif .restart8 ret defs $0010-ASMPC if (ASMPC<>$0010) defs CODE_ALIGNMENT_ERROR endif .restart16 ret defs $0018-ASMPC if (ASMPC<>$0018) defs CODE_ALIGNMENT_ERROR endif .restart24 ret defs $0020-ASMPC if (ASMPC<>$0020) defs CODE_ALIGNMENT_ERROR endif .restart32 ret defs $0028-ASMPC if (ASMPC<>$0028) defs CODE_ALIGNMENT_ERROR endif .restart40 ret defs $0030-ASMPC if (ASMPC<>$0030) defs CODE_ALIGNMENT_ERROR endif .restart48 ret ; Always remember to provide an IM1 routine. It should update FRAMES as with ; the standard 48K ROM. defs $0038-ASMPC if (ASMPC<>$0038) defs CODE_ALIGNMENT_ERROR endif .im1routine push af push hl ld hl,(FRAMES) inc hl ld (FRAMES),hl ld a,h or l jr nz,im1end ld a,(FRAMES+2) inc a ld (FRAMES+2),a .im1end pop hl pop af ei ret ; Always provide an NMI routine which performs a simple RETN. defs $0066-ASMPC if (ASMPC<>$0066) defs CODE_ALIGNMENT_ERROR endif .nmiroutine retn ; Allow the calling of a ROM3 routine .call_rom3 ex (sp),hl ; get return address ld c,(hl) inc hl ld b,(hl) ; BC=BASIC address inc hl ex (sp),hl ; restore return address push bc pop iy ;iy=BASIC address, as needed by RESI_BASIC exx ; switch to alternates ld b,PKG_RESIDOS ; ResiDOS call ld hl,RESI_BASIC ; call BASIC jp PACKAGE_CALL_PKG ; do the package call, then return ; Allow calling of +3 dos routines .dodos exx ld b,PKG_IDEDOS ; We want the IDEDOS package push iy ; Get the call into iy pop hl ld iy,23610 ; Restore IY jp PACKAGE_CALL_PKG .l_dcal jp (hl) ;Used for function pointer calls ;----------- ; Define the stdin/out/err area. For the z88 we have two models - the ; classic (kludgey) one and "ANSI" model ;----------- .__sgoioblk IF DEFINED_ANSIstdio INCLUDE "#stdio_fp.asm" ELSE defw -11,-12,-10 ENDIF ;--------------------------------- ; Select which printf core we want ;--------------------------------- ._vfprintf IF DEFINED_floatstdio LIB vfprintf_fp jp vfprintf_fp ELSE IF DEFINED_complexstdio LIB vfprintf_comp jp vfprintf_comp ELSE IF DEFINED_ministdio LIB vfprintf_mini jp vfprintf_mini ENDIF ENDIF ENDIF ;----------- ; Now some variables ;----------- .coords defw 0 ; Current graphics xy coordinates .base_graphics defw 0 ; Address of the Graphics map ._std_seed defw 0 ; Seed for integer rand() routines .exitsp defw 0 ; Address of where the atexit() stack is .exitcount defb 0 ; How many routines on the atexit() stack IF DEFINED_NEED1bitsound .snd_tick defb 0 ; Sound variable ENDIF defm "Small C+ ZXR" ;Unnecessary file signature defb 0 ;----------------------- ; Floating point support ;----------------------- IF NEED_floatpack defs FLOATING_POINT_NOT_SUPPORTED_FOR_RESIDOS_PACKAGES INCLUDE "#float.asm" .fp_seed defb $80,$80,0,0,0,0 ;FP seed (unused ATM) .extra defs 6 ;FP register .fa defs 6 ;FP Accumulator .fasign defb 0 ;FP register ENDIF z88dk-1.8.ds1/lib/zxr_packages.def0000644000175000017500000000512310637522431016417 0ustar tygrystygrys; Defines for calling ResiDOS from BASIC defc RST_HOOK=$08 defc HOOK_VERSION=$fc defc HOOK_PACKAGE=$fb ; Hook codes that may be handled by packages defc HOOK_SAVE=$ef defc HOOK_LOAD=$ee ; Routine to call to execute a package call from within ; another package. Packages must not use their bank beyond ; this point. defc PACKAGE_CALL_PKG=$3fc0 ; Package IDs defgroup { PKG_RESIDOS=$00, PKG_IDEDOS=$01, PKG_SYNTAX=$02, } ; Standard package calls that must be provided defgroup { PKG_STDCALL_INSTALL=$00, PKG_STDCALL_BYE=$01, PKG_STDCALL_INFO=$02 PKG_STDCALL_EXP=$03, PKG_STDCALL_HOOK=$04, PKG_STDCALL_CHANNELS=$05, PKG_STDCALL_FS=$06, PKG_STDCALL_NMI=$07, } defc PKG_STDCALL_HIGHEST = PKG_STDCALL_NMI ; Reason codes for INFO call defgroup { info_version=0, info_error, } ; Reason codes for EXP call defgroup { exp_boot=0, exp_fs_setdrive, exp_fs_setuser, exp_fs_snapdata } ; Reason codes for NMI call defgroup { nmi_nmi=0, nmi_startup } ; Reason codes for RESI_NMISVC call defgroup { nmisvc_getregs=0, nmisvc_putregs } ; Reason codes for RESI_CONFIG call ; NOTE - the ordering of these is relied on by RESI_CONFIG defgroup { rc_config_getvalue=0, rc_config_gettext, rc_config_setvalue, rc_config_settext, rc_config_delete } ; Low-level calls provided for filesystem packages. defc PACKAGE_FS_LOWLEVEL=$3dc0 defc PACKAGE_FS_SECTOR_READ=$3dc0 defc PACKAGE_FS_SECTOR_WRITE=$3dc3 defc PACKAGE_FS_SECBUF_INIT=$3dc6 defc PACKAGE_FS_SECBUF_ADD=$3dc9 defc PACKAGE_FS_SECBUF_FINISH=$3dcc ; Package capabilities defc pkgcaps_bit_syntax=0 defc pkgcaps_bit_hook=1 defc pkgcaps_bit_channels=2 defc pkgcaps_bit_nmi=3 defc pkgcaps_bit_fs=4 defc pkgcaps_bit_ram=5 defc pkgcaps_bit_di=6 defc PKGCAPS_SYNTAX=$01 defc PKGCAPS_HOOK=$02 defc PKGCAPS_CHANNELS=$04 defc PKGCAPS_NMI=$08 defc PKGCAPS_FS=$10 defc PKGCAPS_RAM=$20 defc PKGCAPS_DI=$40 ; ResiDOS Package Calls defc RESI_REPORT=$0310 defc RESI_BASIC=$0313 defc RESI_SAVEPRBUFF=$0316 defc RESI_RESTOREPRBUFF=$0319 defc RESI_GETPAGER=$031c defc RESI_FINDPKG=$031f defc RESI_FINDBASIC=$0322 defc RESI_ALLOC=$0325 defc RESI_DEALLOC=$0328 defc RESI_LOGO=$032b defc RESI_MESSAGE=$032e defc RESI_NMISVC=$0331 defc RESI_BROADCASTEXP=$0334 defc RESI_CONFIG=$0337 ; Syntax Package Calls defc SYNTAX_VERSION=$0100 ; Current version of Syntax package defgroup { SYNTAX_CHECKER=$0208, SYNTAX_FUNCTION, SYNTAX_ADDPKG, SYNTAX_REMOVEPKG, SYNTAX_MAXCALL ; dummy } z88dk-1.8.ds1/lib/zxvgs.def0000644000175000017500000000473207423104324015120 0ustar tygrystygryslstoff ; List of parameters for ZXVGS calls defc ZXVGS_J0 = $80 defc ZXVGS_J1 = $81 defc ZXVGS_J2 = $82 defc ZXVGS_J3 = $83 defc ZXVGS_MSEINI = $84 defc ZXVGS_MSEGET = $85 defc ZXVGS_FAST = $87 defc ZXVGS_SLOW = $88 defc ZXVGS_KBDGET = $8C defc ZXVGS_KBDTST = $8D defc ZXVGS_KBDMOD = $8E defc ZXVGS_KBDINT = $8F defc ZXVGS_CHOICE = $9F defc ZXVGS_GETCFG = $A2 defc ZXVGS_SETCFG = $A3 defc ZXVGS_SOUND = $A4 defc ZXVGS_OPENSOUND = $A5 defc ZXVGS_VIDEO = $A6 defc ZXVGS_OPENVIDEO = $A7 defc ZXVGS_RSXINIT = $AC defc ZXVGS_RSXCTRL = $AD defc ZXVGS_RSXINFO = $AE defc ZXVGS_RSXLOAD = $AF defc ZXVGS_BNK0 = $B0 defc ZXVGS_BNK1 = $B1 defc ZXVGS_BNK2 = $B2 defc ZXVGS_BNK3 = $B3 defc ZXVGS_BNK4 = $B4 defc ZXVGS_BNK5 = $B5 defc ZXVGS_BNK6 = $B6 defc ZXVGS_BNK7 = $B7 defc ZXVGS_BNKE = $B8 defc ZXVGS_BNKCTRL = $B9 defc ZXVGS_BNKCODE = $BA defc ZXVGS_BNKCOPY = $BB defc ZXVGS_BNKOPEN = $BC defc ZXVGS_BNKCLOSE = $BD defc ZXVGS_BNKRESET = $BE defc ZXVGS_BNKINFO = $BF defc ZXVGS_GETPATH = $C0 defc ZXVGS_SETPATH = $C1 defc ZXVGS_GETENTRY = $C2 defc ZXVGS_SETMASK = $C3 defc ZXVGS_GETINFO = $C4 defc ZXVGS_SETINFO = $C5 defc ZXVGS_GETINFS = $C6 defc ZXVGS_SETINFS = $C7 defc ZXVGS_RESET = $C8 defc ZXVGS_FLUSH = $C9 defc ZXVGS_MAKE = $CA defc ZXVGS_KILL = $CB defc ZXVGS_EXIST = $CC defc ZXVGS_ASSIGN = $CD defc ZXVGS_MOVE = $CE defc ZXVGS_COPY = $CF defc ZXVGS_CLOSE = $D0 defc ZXVGS_OPENI = $D1 defc ZXVGS_OPENO = $D2 defc ZXVGS_OPENB = $D3 defc ZXVGS_READ = $D4 defc ZXVGS_WRITE = $D5 defc ZXVGS_GETL = $D6 defc ZXVGS_PUTL = $D7 defc ZXVGS_FPOS = $D8 defc ZXVGS_SEEK = $D9 defc ZXVGS_EOF = $DA defc ZXVGS_TRUNC = $DB defc ZXVGS_HEADER0 = $E0 defc ZXVGS_HEADER1 = $E1 defc ZXVGS_HEADER2 = $E2 defc ZXVGS_HEADER3 = $E3 defc ZXVGS_LOAD = $E4 defc ZXVGS_SAVE = $E5 defc ZXVGS_VERIFY = $E6 defc ZXVGS_SHIFT = $E7 defc ZXVGS_LOADSCR = $E8 defc ZXVGS_SAVESCR = $E9 defc ZXVGS_LOADCFG = $EA defc ZXVGS_SAVECFG = $EB defc ZXVGS_LOADANY = $EC defc ZXVGS_SAVEANY = $ED defc ZXVGS_FILESELL = $EE defc ZXVGS_FILESELH = $EF defc ZXVGS_GETPRINT = $F0 defc ZXVGS_SETPRINT = $F1 defc ZXVGS_DUMP = $F2 defc ZXVGS_DUMPANY = $F3 defc ZXVGS_ZXPRINT = $F4 defc ZXVGS_HLPRINT = $F5 defc ZXVGS_DEPRINT = $F6 defc ZXVGS_LPRINT = $F7 defc ZXVGS_OVRLOAD = $F8 defc ZXVGS_OVRPREPARE= $F9 defc ZXVGS_OVRSTORE = $FA defc ZXVGS_OVRREMOVE = $FB defc ZXVGS_MENU = $FC defc ZXVGS_QUIT = $FD defc ZXVGS_FATAL = $FE defc ZXVGS_OK = $FF lstoff z88dk-1.8.ds1/libsrc/0000755000175000017500000000000010765202715013767 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/abc80/0000755000175000017500000000000010765202715014664 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/abc80/abc_cursor.asm0000644000175000017500000000042710712125050017477 0ustar tygrystygrys; ; ABC80 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Set cursor shape ; ; void abc_cursor(unsigned char shape); ; ; ; $Id: abc_cursor.asm,v 1.1 2007/10/31 16:15:36 stefano Exp $ ; XLIB abc_cursor abc_cursor: ld a,11 out (56),a ld a,l ; FASTCALL out (57),a ret z88dk-1.8.ds1/libsrc/abc80/abc_inv.asm0000644000175000017500000000111010712125050016744 0ustar tygrystygrys; ; ABC80 Graphics Functions ; ; xorg () -- invert graphics on screen ; ; routine found in "grafik.asm" ; by Bengt Holgersson - 1986-03-13 22.58.30 ; ; imported by Stefano Bodrato - 29/12/2006 :o) ; ; ; $Id: abc_inv.asm,v 1.1 2007/10/31 16:15:36 stefano Exp $ ; XLIB abc_inv .abc_inv ld ix,884 ld b,24 .xorloop push bc ld l,(ix+0) ld h,(ix+1) ld a,(590) ld b,a .xorloop1 ld a,(hl) bit 5,a jr z,nograf xor 95 ld (hl),a .nograf inc hl djnz xorloop1 inc ix inc ix pop bc djnz xorloop ret z88dk-1.8.ds1/libsrc/abc80/abc_vdu.asm0000644000175000017500000000042410712125050016755 0ustar tygrystygrys; ; ABC80 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Set cursor shape ; ; void abc_cursor(unsigned char shape); ; ; ; $Id: abc_vdu.asm,v 1.1 2007/10/31 16:15:36 stefano Exp $ ; XLIB abc_cursor abc_cursor: ld a,11 out (56),a ld a,l ; FASTCALL out (57),a ret z88dk-1.8.ds1/libsrc/abc80.lst0000644000175000017500000000664310712616525015421 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/abc80/fgetc_cons stdio/abc80/fputc_cons stdio/fgets_cons stdio/abc80/getk stdio/puts_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp time/spectrum/clock setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/abc80/clsgraph graphics/abc80/pixel graphics/plotpixl_smc graphics/respixl_smc graphics/xorpixl_smc graphics/putsprite_smc graphics/swapgfxbk_foo graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorplot graphics/setxy games/joystick printflike/ltoa_any abc80/abc_inv z88dk-1.8.ds1/libsrc/abc800/0000755000175000017500000000000010765202715014744 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/abc800/abc_cursor.asm0000755000175000017500000000043010714614446017572 0ustar tygrystygrys; ; ABC800 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Set cursor shape ; ; void abc_cursor(unsigned char shape); ; ; ; $Id: abc_cursor.asm,v 1.1 2007/11/08 14:11:50 stefano Exp $ ; XLIB abc_cursor abc_cursor: ld a,11 out (56),a ld a,l ; FASTCALL out (57),a ret z88dk-1.8.ds1/libsrc/abc800/abc_vdu.asm0000755000175000017500000000052510714614446017060 0ustar tygrystygrys; ; ABC800 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Set video control registers ; ; int abc_vdu(unsigned char register, unsigned char value); ; ; ; $Id: abc_vdu.asm,v 1.1 2007/11/08 14:11:50 stefano Exp $ ; XLIB abc_vdu abc_vdu: pop bc pop de pop hl push hl push de push bc ld a,l out (56),a ld a,e out (57),a ret z88dk-1.8.ds1/libsrc/abc800.lst0000755000175000017500000000667210714614445015507 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/abc800/fgetc_cons stdio/abc800/fputc_cons stdio/fgets_cons stdio/abc800/getk stdio/puts_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp time/spectrum/clock setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/abc80/clsgraph graphics/abc80/pixel graphics/plotpixl_smc graphics/respixl_smc graphics/xorpixl_smc graphics/putsprite_smc graphics/swapgfxbk_foo graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorplot graphics/setxy games/joystick printflike/ltoa_any abc800/abc_cursor abc800/abc_vdu z88dk-1.8.ds1/libsrc/abc80ansi.lst0000644000175000017500000000727510712616525016276 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/abc80/fgetc_cons stdio/fgets_cons stdio/abc80/getk stdio/puts_cons stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/abc80/f_ansi_attr stdio/ansi/abc80/f_ansi_bel stdio/ansi/abc80/f_ansi_char stdio/ansi/abc80/f_ansi_cls stdio/ansi/abc80/f_ansi_dline stdio/ansi/abc80/f_ansi_scrollup stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp time/spectrum/clock setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/abc80/clsgraph graphics/abc80/pixel graphics/plotpixl_smc graphics/respixl_smc graphics/xorpixl_smc graphics/putsprite_smc graphics/swapgfxbk_foo graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorplot graphics/setxy games/joystick printflike/ltoa_any abc80/abc_inv z88dk-1.8.ds1/libsrc/ace/0000755000175000017500000000000010765202715014517 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/ace/.keepme0000644000175000017500000000000007237752755015772 0ustar tygrystygrysz88dk-1.8.ds1/libsrc/aceansi.lst0000644000175000017500000000752110712620314016112 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/ace/fgetc_cons stdio/fgets_cons stdio/ace/getk stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/ace/f_ansi_attr stdio/ansi/ace/f_ansi_bel stdio/ansi/ace/f_ansi_char stdio/ansi/ace/f_ansi_cls stdio/ansi/generic/f_ansi_dline stdio/ansi/ace/f_ansi_scrollup stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/ace/plotpixl graphics/ace/respixl graphics/ace/xorpixl graphics/ace/clsgraph graphics/putsprite2 graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorplot graphics/setxy graphics/vz200/swapgfxbk games/joystick games/ace/bit_open games/ace/bit_open_di games/ace/bit_close games/ace/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/beeper printflike/ltoa_any z88dk-1.8.ds1/libsrc/adt/0000755000175000017500000000000010765202715014537 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/adt/adt.lst0000644000175000017500000000337710577133545016052 0ustar tygrystygrysheap/adt_HeapAdd heap/adt_HeapAdd_callee heap/adt_HeapExtract heap/adt_HeapExtract_callee heap/adt_Heapify heap/adt_Heapify_callee heap/ADThcompare heap/ADTHeapAdd heap/ADTHeapExtract heap/ADTHeapify heap/ADTHeapSiftDown heap/ADTHeapSiftUp linkedlist/adt_ListAdd linkedlist/adt_ListAdd_callee linkedlist/adt_ListAppend linkedlist/adt_ListAppend_callee linkedlist/adt_ListConcat linkedlist/adt_ListConcat_callee linkedlist/adt_ListCount linkedlist/adt_ListCreate linkedlist/adt_ListCreateS linkedlist/adt_ListCurr linkedlist/adt_ListDelete linkedlist/adt_ListDelete_callee linkedlist/adt_ListDeleteS linkedlist/adt_ListDeleteS_callee linkedlist/adt_ListFirst linkedlist/adt_ListInsert linkedlist/adt_ListInsert_callee linkedlist/adt_ListLast linkedlist/adt_ListNext linkedlist/adt_ListPopFront linkedlist/adt_ListPrepend linkedlist/adt_ListPrepend_callee linkedlist/adt_ListPrev linkedlist/adt_ListRemove linkedlist/adt_ListSearch linkedlist/adt_ListSearch_callee linkedlist/adt_ListSetCurr linkedlist/adt_ListSetCurr_callee linkedlist/adt_ListSetCurrAfter linkedlist/adt_ListSetCurrBefore linkedlist/adt_ListTrim linkedlist/ADTemptylistadd linkedlist/ADTListSearch queue/adt_QueueBack queue/adt_QueueCreate queue/adt_QueueCreateS queue/adt_QueueDelete queue/adt_QueueDelete_callee queue/adt_QueueDeleteS queue/adt_QueueDeleteS_callee queue/adt_QueueFront queue/adt_QueuePopBack queue/adt_QueuePopFront queue/adt_QueuePushBack queue/adt_QueuePushBack_callee queue/adt_QueuePushFront queue/adt_QueuePushFront_callee queue/adt_QueueCount stack/adt_StackCreate stack/adt_StackCreateS stack/adt_StackDelete stack/adt_StackDelete_callee stack/adt_StackDeleteS stack/adt_StackDeleteS_callee stack/adt_StackPeek stack/adt_StackPop stack/adt_StackPush stack/adt_StackPush_callee stack/adt_StackCount z88dk-1.8.ds1/libsrc/adt/hashtable/0000755000175000017500000000000010765202715016472 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/adt/heap/0000755000175000017500000000000010765202715015454 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/adt/heap/adt_HeapAdd.asm0000644000175000017500000000054410601576404020275 0ustar tygrystygrys; void adt_HeapAdd(void *item, void **array, uint *n, void *compare) ; CALLER linkage for function pointers XLIB adt_HeapAdd LIB adt_HeapAdd_callee XREF CDISP_ADT_HEAPADD_CALLEE .adt_HeapAdd pop af pop iy pop hl pop bc pop de push de push bc push hl push hl push af jp adt_HeapAdd_callee + CDISP_ADT_HEAPADD_CALLEE z88dk-1.8.ds1/libsrc/adt/heap/adt_HeapAdd_callee.asm0000644000175000017500000000074610601576404021606 0ustar tygrystygrys; void __CALLEE__ adt_HeapAdd_callee(void *item, void **array, uint *n, void *compare) ; 08.2005 aralbrec XLIB adt_HeapAdd_callee XDEF CDISP_ADT_HEAPADD_CALLEE LIB ADTHeapAdd, ADThcompare .adt_HeapAdd_callee pop af pop iy pop hl pop bc pop de push af .centry inc (hl) ld a,(hl) inc hl jr nz, noinchi inc (hl) .noinchi ld h,(hl) ld l,a ld ix,ADThcompare jp ADTHeapAdd DEFC CDISP_ADT_HEAPADD_CALLEE = centry - adt_HeapAdd_callee z88dk-1.8.ds1/libsrc/adt/heap/adt_HeapExtract.asm0000644000175000017500000000053010601576404021212 0ustar tygrystygrys; void *adt_HeapExtract(void **array, uint *n, void *compare) ; CALLER linkage for function pointers XLIB adt_HeapExtract LIB adt_HeapExtract_callee XREF CDISP_HEAPEXTRACT_CALLEE .adt_HeapExtract pop bc pop iy pop hl pop de push de push hl push hl push bc jp adt_HeapExtract_callee + CDISP_HEAPEXTRACT_CALLEE z88dk-1.8.ds1/libsrc/adt/heap/adt_HeapExtract_callee.asm0000644000175000017500000000122510601576404022521 0ustar tygrystygrys; void __CALLEE__ *adt_HeapExtract_callee(void **array, uint *n, void *compare) ; 08.2005 aralbrec XLIB adt_HeapExtract_callee XDEF CDISP_ADT_HEAPEXTRACT_CALLEE LIB ADTHeapExtract, ADThcompare .adt_HeapExtract_callee pop bc pop iy pop hl pop de push bc .centry push hl ld a,(hl) inc hl ld h,(hl) ld l,a push hl ld ix,ADThcompare call ADTHeapExtract jr nc, nothing pop de ld c,l ld b,h pop hl dec de ld (hl),e inc hl ld (hl),d ld l,c ld h,b ret .nothing pop hl pop hl ld hl,0 ret DEFC CDISP_ADT_HEAPEXTRACT_CALLEE = centry - adt_HeapExtract_callee z88dk-1.8.ds1/libsrc/adt/heap/adt_Heapify.asm0000644000175000017500000000042610577133545020402 0ustar tygrystygrys; void adt_Heapify(void **array, uint n, void *compare) ; CALLER linkage for function pointers XLIB adt_Heapify LIB ADTHeapify, ADThcompare .adt_Heapify pop de pop iy pop hl pop bc push bc push hl push hl push de ld ix,ADThcompare jp ADTHeapify z88dk-1.8.ds1/libsrc/adt/heap/adt_Heapify_callee.asm0000644000175000017500000000037610577133545021713 0ustar tygrystygrys; void __LIB__ adt_Heapify_callee(void **array, uint n, void *compare) ; 08.2005 aralbrec XLIB adt_Heapify_callee LIB ADTHeapify, ADThcompare .adt_Heapify_callee pop de pop iy pop hl pop bc push de ld ix,ADThcompare jp ADTHeapify z88dk-1.8.ds1/libsrc/adt/heap/ADThcompare.asm0000644000175000017500000000021110577133545020304 0ustar tygrystygrys XLIB ADThcompare LIB l_jpiy .ADThcompare push bc push de push hl call l_jpiy rl l pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/adt/heap/ADTHeapAdd.asm0000644000175000017500000000115410302466306017771 0ustar tygrystygrys; void adt_HeapAdd(void *item, void **array, uint n, void *compare) ; 08.2005 aralbrec XLIB ADTHeapAdd LIB ADTHeapSiftUp ; enter: HL = N+1 (number of items in array after this one added) ; BC = array address ; DE = &item ; IX = compare(DE=&array[child], HL=&array[parent]) ; set carry if child < parent (min heap) -- MUST PRESERVE BC,DE,HL,IX .ADTHeapAdd add hl,hl push hl add hl,bc ; hl = &array[N+1] ld (hl),e ; store new item at end of array inc hl ld (hl),d dec hl pop de ; de = start index * 2 jp ADTHeapSiftUp z88dk-1.8.ds1/libsrc/adt/heap/ADTHeapExtract.asm0000644000175000017500000000332210307440307020710 0ustar tygrystygrys; void *adt_HeapExtract(void **array, uint n, void *compare) ; 08.2005 aralbrec XLIB ADTHeapExtract LIB ADTHeapSiftDown ; enter: DE = array address ; HL = N (number of items in array, set to one less after calling) ; IX = compare (de) < (hl)? set carry if true MUST PRESERVE BC,DE,HL,IX ; exit : no carry = empty heap, else: HL = extracted item and carry set ; uses : AF,BC,DE,HL,AF' .ADTHeapExtract ld a,h or l ret z ; return if no items in heap add hl,hl push hl ; stack = N * 2 inc de add hl,de ; hl = &array[N] + 1b inc de ld c,e ld b,d inc de ; de = &array[1] + 1b ld a,(de) ex af,af ldd ; copy array[N] to front of array ld a,(de) ldd ; bc = array address ex de,hl inc de ; de = &array[N] ld (de),a ; write extracted item to end of array ld l,a ; copying extracted item to end of ex af,af ; array gives a heapsort for free inc de ; (well almost, we do pay 30 extra cycles for it) ld (de),a ld h,a ex (sp),hl ; hl = N * 2, stack = extracted item dec hl dec hl ; hl = (N-1)*2 one less item in heap now ld a,l and $fc or h jr z, done ; if one item or less left, don't bother sifting ld de,2 ; de = top of heap -- sift item copied down the heap call ADTHeapSiftDown .done pop hl ; hl = extracted item scf ; indicate item was extracted ret z88dk-1.8.ds1/libsrc/adt/heap/ADTHeapify.asm0000644000175000017500000000117510303725653020077 0ustar tygrystygrys; void adt_Heapify(void **array, uint n, void *compare) ; 08.2005 aralbrec XLIB ADTHeapify LIB ADTHeapSiftDown ; enter: BC = array address ; IX = compare (de) < (hl)? set carry if true MUST PRESERVE BC,DE,HL,IX ; HL = N (number of items in array) .ADTHeapify ld a,l and $fe or h ret z ; return if one or less items in array ld e,l ld d,h add hl,hl ; hl = N * 2 res 0,e ; de = parent of last item in array (index * 2) .while ld a,d or e ret z push de push hl call ADTHeapSiftDown pop hl pop de dec de dec de jp while z88dk-1.8.ds1/libsrc/adt/heap/ADTHeapSiftDown.asm0000644000175000017500000000572010302466306021041 0ustar tygrystygrys; void adt_HeapSiftDown(uint start, void **array, uint n, void *compare) ; 03.2003, 08.2005 aralbrec XLIB ADTHeapSiftDown LIB l_jpix ; enter: DE = start index * 2 (offset into array in bytes) ; BC = array address ; IX = compare (de) < (hl)? set carry if true MUST PRESERVE BC,DE,HL,IX ; HL = N * 2 (number of items in array * 2) ; uses : AF,DE,HL,AF' .ADTHeapSiftDown push hl ; stack = N * 2 ld l,e ld h,d add hl,hl ex de,hl ; de = child index * 2 add hl,bc ex (sp),hl ; hl = N * 2, stack = &array[parent] ; de = child index * 2 ; hl = N * 2 ; bc = array address ; stack = &array[parent] .while ld a,d ; if child < N not done yet cp h jr c, cont jr nz, done ld a,e cp l jr nc, done .cont ex (sp),hl push hl push de ; stack = N * 2, &array[parent], child index * 2 ex de,hl add hl,bc ld e,l ld d,h ; de = &array[child] inc hl inc hl ; hl = &array[child+1] call l_jpix ; is child < child+1? (de) < (hl)? pop hl jr c, skip ; branch if child smaller inc hl inc hl ; hl = child+1 index * 2 inc de inc de ; de = &array[child+1] .skip ; hl = child index * 2; de = &array[child]; stack = N * 2, &array[parent] ex (sp),hl ; hl = &array[parent]; stack = N * 2, child index * 2 call l_jpix ; is child < parent? (de) < (hl) jr nc, done2 ; if parent smaller it's in right place so done ld a,(de) ; swap(child, parent) ex af,af ld a,(hl) ld (de),a ex af,af ld (hl),a inc hl inc de ld a,(de) ex af,af ld a,(hl) ld (de),a ex af,af ld (hl),a pop hl add hl,hl ; hl = new child index * 2 dec de ; de = &array[new parent which was old child] ex de,hl ; hl = &array[parent], de = child index * 2 ex (sp),hl ; hl = N * 2, stack = &array[parent] jp while .done ; one last item to worry about sbc hl,de ; carry reset at this point jr nz, reallydone ; if child != N we are really done, otherwise one more compare to do ex de,hl add hl,bc ; hl = &array[child] pop de ; de = &array[parent] ex de,hl ; hl = &array[parent], de = &array[child] call l_jpix ; is child < parent? (de) < (hl)? ret nc ; if no, things are as they should be ld a,(de) ; swap(child, parent) ex af,af ld a,(hl) ld (de),a ex af,af ld (hl),a inc hl inc de ld a,(de) ex af,af ld a,(hl) ld (de),a ex af,af ld (hl),a ret .done2 pop af .reallydone pop af ret z88dk-1.8.ds1/libsrc/adt/heap/ADTHeapSiftUp.asm0000644000175000017500000000227710303725564020527 0ustar tygrystygrys; void adt_HeapSiftUp(uint start, void **array, void *compare) ; 03.2003, 08.2005 aralbrec XLIB ADTHeapSiftUp LIB l_jpix ; enter: DE = start index * 2 (offset into array in bytes) ; HL = &array[start] = bc + de ; BC = array address ; IX = compare(DE=&array[child], HL=&array[parent]) ; set carry if child < parent (min heap) -- MUST PRESERVE BC,DE,HL,IX ; uses : AF,DE,HL,AF' .ADTHeapSiftUp ld a,e and $fc or d ret z ; if start <= 2 we have reached root so return srl d rr e res 0,e push de ; stack = parent(child=start) index ex de,hl ; de = &array[child=start] add hl,bc ; hl = &array[parent] call l_jpix ; compare(child, parent) jr nc, done ; if child >= parent, we are done ld a,(de) ; swap(child, parent) ex af,af ld a,(hl) ld (de),a ex af,af ld (hl),a inc hl inc de ld a,(de) ex af,af ld a,(hl) ld (de),a ex af,af ld (hl),a dec hl ; hl = &array[parent] pop de ; de = parent index jp ADTHeapSiftUp ; parent becomes child .done pop de ret z88dk-1.8.ds1/libsrc/adt/linkedlist/0000755000175000017500000000000010765202715016701 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListAdd.asm0000644000175000017500000000051310577133545021563 0ustar tygrystygrys; int adt_ListAdd(struct adt_List *list, void *item) ; 02.2003, 06.2005 aralbrec ; CALLER linkage for function pointers XLIB adt_ListAdd LIB adt_ListAdd_callee XREF ASMDISP_ADT_LISTADD_CALLEE .adt_ListAdd pop hl pop bc pop de push de push bc push hl jp adt_ListAdd_callee + ASMDISP_ADT_LISTADD_CALLEE z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListAdd_callee.asm0000644000175000017500000000725210577133546023100 0ustar tygrystygrys; int adt_ListAdd_callee(struct adt_List *list, void *item) ; 02.2003, 06.2005 aralbrec XLIB adt_ListAdd_callee XDEF ASMDISP_ADT_LISTADD_CALLEE XREF _u_malloc LIB adt_ListPrepend_callee XREF ASMDISP_ADT_LISTPREPEND2 LIB adt_ListAppend_callee XREF ASMDISP_ADT_LISTAPPEND2 LIB ADTemptylistadd .adt_ListAdd_callee pop hl pop bc pop de push hl .asmentry ; enter: de = struct adt_List * ; bc = item * ; exit : carry reset if fail (no memory) and hl=0 else: ; new item inserted after current, current points at new item, hl!=0 ; uses : af, bc, de, hl push de push bc ld hl,6 ; sizeof(struct adt_ListNode) push hl call _u_malloc pop bc pop bc pop de ret nc ; memory allocation failed ld (hl),c inc hl ld (hl),b ; store user item into new NODE inc hl ; hl = new NODE.next ex de,hl ; hl = LIST*, de = new NODE.next ld a,(hl) inc (hl) ; increase item count inc hl jp nz, noinchi inc (hl) jp cont .noinchi or (hl) ; hl = LIST.count+1, de = new NODE.next, list count & item done jp z, ADTemptylistadd ; if there are no items in list jump to emptylistadd helper .cont inc hl ; hl = LIST.state, de = new NODE.next, list count & item done ld a,(hl) or a jp z, adt_ListPrepend_callee + ASMDISP_ADT_LISTPREPEND2 ; if current points before start of list dec a jp nz, adt_ListAppend_callee + ASMDISP_ADT_LISTAPPEND2 ; if current points past end of list inc hl ; hl = LIST.current ; adding into non-empty list -- insert after current item ; hl = LIST.current, de = new NODE.next push hl ; save LIST.current, de = new NODE.next ld a,(hl) inc hl ld l,(hl) ld h,a ; hl = current NODE inc hl inc hl ; hl = current NODE.next ldi ldi ; copy current NODE.next into new NODE.next dec hl ; hl = current NODE.next + 1 push de ; stack = LIST.current, new NODE.prev dec de dec de dec de dec de ; de = new NODE ld (hl),e dec hl ; hl = current NODE.next ld (hl),d ; current NODE.next = new NODE dec hl dec hl ; hl = current NODE ex de,hl ; de = current NODE, hl = new NODE ex (sp),hl ; hl = new NODE.prev, stack = LIST.current, new NODE ld (hl),d inc hl ; hl = new NODE.prev + 1 ld (hl),e ; new NODE.prev = current NODE dec hl dec hl ; hl = new NODE.next + 1 ld e,(hl) dec hl ld d,(hl) ; de = next NODE, hl = new NODE.next ld a,d or a jr z, newtail ; if there is no next node, this is the new tail of the list ld hl,4 add hl,de ; hl = next NODE.prev pop de ; de = new NODE ld (hl),d inc hl ld (hl),e ; next NODE.prev = new NODE pop hl ; hl = LIST.current ld (hl),d inc hl ld (hl),e ; current = new NODE scf ret .newtail ; hl = new NODE.next, stack = LIST.current, new NODE pop de ; de = new NODE pop hl ; hl = LIST.current ld (hl),d inc hl ld (hl),e ; current = new NODE inc hl inc hl inc hl ld (hl),d inc hl ld (hl),e ; tail = new NODE scf ret DEFC ASMDISP_ADT_LISTADD_CALLEE = asmentry - adt_ListAdd_callee z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListAppend.asm0000644000175000017500000000054010577133545022302 0ustar tygrystygrys; int adt_ListAppend(struct adt_List *list, void *item) ; 02.2003, 06.2005 aralbrec ; CALLER linkage for function pointers XLIB adt_ListAppend LIB adt_ListAppend_callee XREF ASMDISP_ADT_LISTAPPEND_CALLEE .adt_ListAppend pop hl pop bc pop de push de push bc push hl jp adt_ListAppend_callee + ASMDISP_ADT_LISTAPPEND_CALLEE z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListAppend_callee.asm0000644000175000017500000000454010577133546023614 0ustar tygrystygrys; int adt_ListAppend_callee(struct adt_List *list, void *item) ; 02.2003, 06.2005 aralbrec XLIB adt_ListAppend_callee XDEF ASMDISP_ADT_LISTAPPEND_CALLEE XDEF ASMDISP_ADT_LISTAPPEND2 LIB ADTemptylistadd XREF _u_malloc .adt_ListAppend_callee pop hl pop bc pop de push hl .asmentry ; enter: DE = struct adt_List * ; BC = item * ; exit : carry reset if fail (no memory) and hl=0 else: ; new item appended to end of list, current points at new item and hl!=0 ; uses : AF,BC,DE,HL push bc push de ld hl,6 ; sizeof(struct adt_ListNode) push hl call _u_malloc pop bc pop de pop bc ret nc ; alloc memory failed ld (hl),c inc hl ld (hl),b ; store user item into new NODE inc hl ; hl = new NODE.next ex de,hl ; hl = LIST*, de = new NODE.next ld a,(hl) inc (hl) ; increase item count inc hl jp nz, noinchi inc (hl) jp cont .noinchi or (hl) ; hl = LIST.count+1, de = new NODE.next, list count & item done jp z, ADTemptylistadd ; if there are no items in list jump to emptylistadd helper .cont inc hl ; hl = LIST.state, de = new NODE.next, list count & item done .ADTListAppend2 ld (hl),1 ; current INLIST inc hl dec de dec de ; de = new NODE push de ; stack = new NODE ld (hl),d inc hl ld (hl),e ; current = new NODE inc hl inc hl inc hl ; hl = tail inc de inc de ; de = new NODE.next xor a ld (de),a inc de ld (de),a ; new NODE.next = NULL inc de ; de = new NODE.prev ldi ldi ; new NODE.prev = tail dec hl ld e,(hl) dec hl ; hl = tail ld d,(hl) ; de = old tail NODE pop bc ; bc = new NODE ld (hl),b inc hl ld (hl),c ; tail = new NODE ex de,hl ; hl = old tail NODE inc hl inc hl ; hl = old tail NODE.next ld (hl),b inc hl ld (hl),c ; old tail NODE.next = new NODE scf ret DEFC ASMDISP_ADT_LISTAPPEND_CALLEE = asmentry - adt_ListAppend_callee DEFC ASMDISP_ADT_LISTAPPEND2 = ADTListAppend2 - adt_ListAppend_callee z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListConcat.asm0000644000175000017500000000052010577133545022300 0ustar tygrystygrys; void adt_ListConcat(struct adt_List *list1, struct sp_List *list2) ; CALLER linkage for function pointers XLIB adt_ListConcat LIB adt_ListConcat_callee XREF ASMDISP_ADT_LISTCONCAT_CALLEE .adt_ListConcat pop bc pop hl pop de push de push hl push bc jp adt_ListConcat_callee + ASMDISP_ADT_LISTCONCAT_CALLEE z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListConcat_callee.asm0000644000175000017500000000627610577133546023624 0ustar tygrystygrys; void __CALLEE__ adt_ListConcat_callee(struct adt_List *list1, struct adt_List *list2) ; 02.2003, 06.2005 aralbrec XLIB adt_ListConcat_callee XDEF ASMDISP_ADT_LISTCONCAT_CALLEE XREF _u_free .adt_ListConcat_callee pop bc pop hl pop de push bc .asmentry ; enter: hl = list2, de = list1 ; exit : list1 = list1 concat list2, list2 is deleted ; uses : af, bc, de, hl push hl ; stack = list2 ld a,(hl) inc hl or (hl) jp z, list2nonempty ; list2 is empty, do nothing pop hl push hl call _u_free ; free(list2) pop hl ret .list2nonempty ; stack = list2 ex de,hl ; de = list2.count+1, hl = list1 ld a,(hl) inc hl or (hl) jp nz, list1nonempty ; list1 empty, copy list2 dec de dec hl ex de,hl ; hl = list2, de = list1 ld bc,9 ldir ; copy list2 into list1 dec de dec de dec de ex de,hl ; hl = list1.head+1 ld e,(hl) dec hl ld d,(hl) ; de = list1 head dec hl ld (hl),e dec hl ld (hl),d ; list1.current = list1 head dec hl ld (hl),1 ; INLIST pop hl push hl call _u_free ; free(list2) pop hl ret ; both lists nonempty .list1nonempty ; de = list2.count+1, hl = list1.count+1, stack = list2 dec de dec hl ld a,(de) add a,(hl) ld (hl),a inc de inc hl ld a,(de) adc a,(hl) ld (hl),a ; ** list1 count += list2 count inc hl ; hl = list1.state inc de inc de inc de inc de ; de = list2.head ld a,(hl) cp 2 ; ** list1.state = AFTER? jp nz, list1notafter ld (hl),1 ; ** list1.state = INLIST inc hl ld a,(de) ld (hl),a inc de ; de = list2.head+1 inc hl ; hl = list1.current+1 ld a,(de) ld (hl),a ; ** list1 current = list2 head dec de ; de = list2.head inc hl inc hl inc hl ; hl = list1.tail jp rejoin1 .list1notafter ; de = list2.head, hl = list1.state ld bc,5 add hl,de ; hl = list1.tail .rejoin1 ld b,(hl) inc hl ; hl = list1.tail+1 ld c,(hl) ; bc = list1 tail NODE inc bc inc bc ; bc = list1 tail NODE.next ld a,(de) ld (bc),a inc de ; de = list2.head+1 inc bc ld a,(de) ld (bc),a ; ** list1 tail NODE.next = list2 head NODE ex de,hl ; hl = list2.head+1, de = list1.tail+1 ld c,(hl) dec hl ; hl = list2.head ld b,(hl) ; bc = list2 head NODE inc bc inc bc inc bc inc bc inc bc ; bc = list2 head NODE.prev+1 ld a,(de) ld (bc),a dec bc dec de ; de = list1.tail ld a,(de) ld (bc),a ; ** list2 head NODE.prev = list1 tail NODE inc hl inc hl ; hl = list2.tail ldi ldi ; ** list1 tail = list2 tail pop hl push hl call _u_free ; free(list2) pop hl ret DEFC ASMDISP_ADT_LISTCONCAT_CALLEE = asmentry - adt_ListConcat_callee z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListCount.asm0000644000175000017500000000044010577133545022162 0ustar tygrystygrys; uint __FASTCALL__ adt_ListCount(struct adt_List *list) ; 02.2003, 06.2005 aralbrec XLIB adt_ListCount ; Return # elements in list ; ; enter : HL = struct adt_List * ; exit : HL = # items in list ; uses : DE,HL .adt_ListCount ld e,(hl) inc hl ld d,(hl) ex de,hl ret z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListCreate.asm0000644000175000017500000000075510577133545022306 0ustar tygrystygrys; struct adt_List *adt_ListCreate(void) ; 02.2003, 06.2005 aralbrec XLIB adt_ListCreate LIB l_setmem XREF _u_malloc ; Create List ; ; exit : HL = addr of struct adt_List ; = 0 and carry reset if fail (no mem) ; used : AF,BC,DE,HL .adt_ListCreate ld hl,9 ; sizeof(struct adt_List) push hl call _u_malloc ; alloc memory, hl=0 & carry reset if fail pop bc ret nc ld e,l ld d,h ld a,0 call l_setmem-17 ; clear 9 bytes ex de,hl ret z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListCreateS.asm0000644000175000017500000000027310577133545022424 0ustar tygrystygrys; void __FASTCALL__ adt_ListCreateS(struct adt_List *) ; 11.2006 aralbrec XLIB adt_ListCreateS LIB l_setmem ; initialize a struct adt_List .adt_ListCreateS xor a jp l_setmem-17 z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListCurr.asm0000644000175000017500000000127010577133545022007 0ustar tygrystygrys; void __FASTCALL__ *adt_ListCurr(struct adt_List *list) ; 02.2003, 06.2005 aralbrec XLIB adt_ListCurr .adt_ListCurr ; enter: hl = struct adt_List * ; exit : no carry = list empty or current points outside list, else: ; hl = current item in list and carry set ; uses : af, hl ld a,(hl) inc hl or (hl) jr z, nothing ; zero items in list inc hl ld a,(hl) dec a jr nz, nothing ; current ptr not INLIST inc hl ld a,(hl) inc hl ld l,(hl) ld h,a ; hl = current adt_ListNode ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = item scf ret .nothing ld hl,0 ret z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListDelete.asm0000644000175000017500000000050610577133545022277 0ustar tygrystygrys; void adt_ListDelete(struct adt_List *list, void *delete) ; CALLER linkage for function pointers XLIB adt_ListDelete LIB adt_ListDelete_callee XREF ASMDISP_ADT_LISTDELETE_CALLEE .adt_ListDelete pop bc pop de pop hl push hl push de push bc jp adt_ListDelete_callee + ASMDISP_ADT_LISTDELETE_CALLEE z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListDelete_callee.asm0000644000175000017500000000155710577133546023614 0ustar tygrystygrys; void __CALLEE__ adt_ListDelete_callee(struct adt_List *list, void *delete) ; /* void __FASTCALL__ (*delete)(void *item) */ ; 02.2003, 06.2005 aralbrec XLIB adt_ListDelete_callee XDEF ASMDISP_ADT_LISTDELETE_CALLEE LIB adt_ListDeleteS_callee XREF ASMDISP_ADT_LISTDELETES_CALLEE XREF _u_free .adt_ListDelete_callee pop bc pop de pop hl push bc .asmentry ; enter: hl = struct adt_List * ; de = delete with HL = item ; exit : All items in list deleted but not adt_List struct itself ; (delete) is called once for each item in the list with ; HL = item and stack=item ; note : not multi-thread safe ; uses : af, bc, de, hl, ix push hl call adt_ListDeleteS_callee + ASMDISP_ADT_LISTDELETES_CALLEE pop hl push hl call _u_free pop hl ret DEFC ASMDISP_ADT_LISTDELETE_CALLEE = asmentry - adt_ListDelete_callee z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListDeleteS.asm0000644000175000017500000000051510577133545022422 0ustar tygrystygrys; void adt_ListDeleteS(struct adt_List *list, void *delete) ; CALLER linkage for function pointers XLIB adt_ListDeleteS LIB adt_ListDeleteS_callee XREF ASMDISP_ADT_LISTDELETES_CALLEE .adt_ListDeleteS pop bc pop de pop hl push hl push de push bc jp adt_ListDeleteS_callee + ASMDISP_ADT_LISTDELETES_CALLEE z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListDeleteS_callee.asm0000644000175000017500000000256010577133546023732 0ustar tygrystygrys; void __CALLEE__ adt_ListDeleteS_callee(struct adt_List *list, void *delete) ; /* void __FASTCALL__ (*delete)(void *item) */ ; 02.2003, 06.2005 aralbrec XLIB adt_ListDeleteS_callee XDEF ASMDISP_ADT_LISTDELETES_CALLEE LIB l_jpix XREF _u_free .adt_ListDeleteS_callee pop bc pop de pop hl push bc .asmentry ; enter: hl = struct adt_List * ; de = delete with HL = item ; exit : All items in list deleted but not adt_List struct itself ; (delete) is called once for each item in the list with ; HL = item and stack=item ; note : not multi-thread safe ; uses : af, bc, de, hl, ix ld a,d or e jr nz, deletenotnull ld de,justret .deletenotnull ld ixl,e ld ixh,d ld de,5 add hl,de ; hl = head .while ld a,(hl) or a ret z inc hl ld l,(hl) ld h,a ; hl = next NODE ld e,(hl) push hl ; save NODE inc hl ; hl = NODE.item+1 ld d,(hl) ; de = item ex de,hl push hl call l_jpix ; call itemfree with HL = item pop hl pop hl ; hl = NODE push hl ; save NODE call _u_free ; free NODE container pop hl inc hl inc hl ; hl = NODE.next jp while .justret ret DEFC ASMDISP_ADT_LISTDELETES_CALLEE = asmentry - adt_ListDeleteS_callee z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListFirst.asm0000644000175000017500000000160210577133545022162 0ustar tygrystygrys; void __FASTCALL__ *adt_ListFirst(struct adt_List *list) ; 02.2003, 06.2005 aralbrec XLIB adt_ListFirst .adt_ListFirst ; enter: hl = struct adt_list * ; exit : hl = item at start of list ; current pointer changed to point at first item in list, carry set ; IF FAIL: carry reset, hl = 0 ; uses : af, bc, de, hl ld a,(hl) inc hl or (hl) jr z, fail inc hl ld (hl),1 ; list ptr is inlist inc hl ld e,l ld d,h ; de = list.current inc hl inc hl ; hl = list.head ldi ldi ; list.current = list.head ex de,hl ; hl = list.head ld a,(hl) inc hl ld l,(hl) ld h,a ; hl = headnode ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = item scf ret .fail ld l,a ld h,a ret z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListInsert.asm0000644000175000017500000000050410577133545022337 0ustar tygrystygrys; int adt_ListInsert(struct adt_List *list, void *item) ; CALLER linkage for function pointers XLIB adt_ListInsert LIB adt_ListInsert_callee XREF ASMDISP_ADT_LISTINSERT_CALLEE .adt_ListInsert pop hl pop bc pop de push de push bc push hl jp adt_ListInsert_callee + ASMDISP_ADT_LISTINSERT_CALLEE z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListInsert_callee.asm0000644000175000017500000000624510577133546023655 0ustar tygrystygrys; int __CALLEE__ adt_ListInsert_callee(struct adt_List *list, void *item) ; 08.2005 aralbrec XLIB adt_ListInsert_callee XDEF ASMDISP_ADT_LISTINSERT_CALLEE LIB adt_ListPrepend_callee XREF ASMDISP_ADT_LISTPREPEND2 LIB adt_ListAppend_callee XREF ASMDISP_ADT_LISTAPPEND2 LIB ADTemptylistadd XREF _u_malloc .adt_ListInsert_callee pop hl pop bc pop de push hl .asmentry ; enter: de = struct adt_List * ; bc = item * ; exit : carry reset if fail and hl = 0 (no memory) else: ; new item inserted before current, current points at new item, carry set, hl!=0 ; uses : af, bc, de, hl push de push bc ld hl,6 ; sizeof(struct adt_ListNode) push hl call _u_malloc pop bc pop bc pop de ret nc ; alloc memory failed ld (hl),c inc hl ld (hl),b ; store item into new NODE inc hl ex de,hl ; de = new NODE.next, hl = list ld a,(hl) inc (hl) ; increase item count inc hl jp nz, noinchi inc (hl) jp cont .noinchi or (hl) ; hl = list.count+1, de = new NODE.next, list count & item done jp z, ADTemptylistadd ; if there are no items in list, use empty list helper .cont inc hl ; hl = list.state, de = new NODE.next, list count & item done ld a,(hl) or a jp z, adt_ListPrepend_callee + ASMDISP_ADT_LISTPREPEND2 ; if current points before start of list dec a jp nz, adt_ListAppend_callee + ASMDISP_ADT_LISTAPPEND2 ; if current points past end of list inc hl ; hl = list.current ; inserting into non-empty list -- insert before current item ; hl = list.current, de = new NODE.next push hl ; stack = list.current, de = new NODE.next ld a,(hl) inc hl ld l,(hl) ld h,a ; hl = current NODE ex de,hl ; de = current NODE, hl = new NODE.next ld (hl),d inc hl ld (hl),e ; new NODE.next = current NODE inc hl ; hl = new NODE.prev ex de,hl ; de = new NODE.prev, hl = current NODE ld bc,4 add hl,bc ; hl = current.prev ld a,(hl) ; a == 0 if no prev ldi ldi ; new NODE.prev = current.prev dec hl ; hl = current.prev+1 ld c,(hl) ; ac = prev NODE dec de dec de dec de dec de dec de dec de ; de = new NODE ld (hl),e dec hl ld (hl),d ; current.prev = new NODE or a ; de = new NODE, ac = prev NODE, stack = list.current jr z, newhead ld l,c ld h,a inc hl inc hl ; hl = prev NODE.next ld (hl),d inc hl ld (hl),e ; prev NODE.next = new NODE pop hl ; hl = list.current ld (hl),d inc hl ld (hl),e ; list.current = new NODE scf ret .newhead pop hl ; hl = list.current ld (hl),d inc hl ld (hl),e ; list.current = new NODE inc hl ld (hl),d inc hl ld (hl),e ; list.head = new NODE scf ret DEFC ASMDISP_ADT_LISTINSERT_CALLEE = asmentry - adt_ListInsert_callee z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListLast.asm0000644000175000017500000000146410577133545022004 0ustar tygrystygrys; void __FASTCALL__ *adt_ListLast(struct adt_List *list) ; 02.2003, 06.2005 aralbrec XLIB adt_ListLast .adt_ListLast ; enter: hl = struct adt_List * ; exit : no carry = list empty, hl = 0 else: ; hl = item at end of list ; current pointer changed to point at last item in list ; uses : af, bc, de, hl ld a,(hl) inc hl or (hl) ret z ; nothing in list inc hl ld (hl),1 ; current will be INLIST inc hl ld e,l ld d,h ; de points at current ld hl,4 add hl,de ; hl points at tail ldi ldi ; copy tail to current dec hl ld a,(hl) dec hl ld h,(hl) ; hl = NODE stored at tail of list ld l,a ld a,(hl) inc hl ld h,(hl) ; hl = item ld l,a scf ret z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListNext.asm0000644000175000017500000000306710577133545022020 0ustar tygrystygrys; void __FASTCALL__ *adt_ListNext(struct adt_List *list) ; 02.2003, 06.2005 aralbrec XLIB adt_ListNext LIB adt_ListFirst .adt_ListNext ; enter: hl = struct adt_List * ; exit : no carry = list empty or current pointer is past end of list, hl = 0 else: ; hl = next item after current in list ; current pointer changed to point at next item in list ; uses : af, bc, de, hl ld a,(hl) inc hl or (hl) jr z, fail ; fail if no items in list inc hl ; hl = state ld a,(hl) ; 0 = BEFORE, 1 = INLIST, 2 = AFTER or a jp z, adt_ListFirst + 6 ; BEFORE, so do ListFirst dec a jr nz, fail ; return failure if current is AFTER end of list ; current pointer INLIST inc hl ld d,(hl) inc hl ; hl = current + 1 ld e,(hl) ; de = NODE for current ptr inc de inc de ; de = NODE.next ld a,(de) ; if NODE->next == NULL, moving past end of list or a jr z, movedpastend ld b,a inc de ld a,(de) ld e,a ld d,b ; de = NODE->next ld (hl),e dec hl ld (hl),d ; current ptr = next NODE ex de,hl ; hl = next NODE ld e,(hl) inc hl ld d,(hl) ; de = list item ex de,hl scf ret .movedpastend ; hl = current+1, de = current NODE.next ld (hl),0 dec hl ld (hl),0 ; mark current pointing at nothing dec hl ld (hl),2 ; mark current pointing after end of list .fail ld hl,0 ret z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListPopFront.asm0000644000175000017500000000420710577133545022646 0ustar tygrystygrys; void __FASTCALL__ *adt_ListPopFront(struct adt_List *list) ; 11.2006 aralbrec XLIB adt_ListPopFront LIB l_setmem XREF _u_free .adt_ListPopFront ; enter: hl = struct adt_List * ; exit : no carry indicates list empty, hl = 0 else: ; hl = item removed from list ; last item removed from list and current points to new last item ; uses : af, bc, de, hl ld e,(hl) inc hl ld d,(hl) ; de = count dec hl ; hl = list ld a,d or e jr z, fail ; fail if list empty dec de ; count = count - 1 ld a,d or e jp nz, morethanone ; getting rid of only item in list push hl ; save list ld de,5 add hl,de ; hl = head ld d,(hl) inc hl ld e,(hl) ; de = NODE ex de,hl ; hl = NODE ld e,(hl) inc hl ld d,(hl) ; de = item push de ; save item dec hl push hl call _u_free ; free NODE pop hl pop hl ex (sp),hl ; hl = list, stack = item xor a call l_setmem-17 pop hl ; hl = item scf ret ; more than one item in list .morethanone ; hl = list, de = new count ld (hl),e inc hl ld (hl),d ; count-- inc hl ld (hl),1 ; state = INLIST inc hl inc hl inc hl ; hl = head ld d,(hl) inc hl ; hl = head+1 ld e,(hl) ; de = head NODE ex de,hl ; hl = head NODE, de = head+1 ld c,(hl) inc hl ld b,(hl) ; bc = item push bc ; save item inc hl ld b,(hl) inc hl ld c,(hl) ; bc = next NODE ex de,hl ; hl = head+1, de = head NODE.next+1 ld (hl),c dec hl ld (hl),b ; new head ptr = next NODE dec hl ld (hl),c dec hl ld (hl),b ; new curr ptr = next NODE ld hl,4 add hl,bc ; hl = next NODE.prev ld (hl),0 inc hl ld (hl),0 ; next NODE.prev = 0 ld hl,-3 add hl,de ; hl = NODE to delete push hl call _u_free ; free the NODE pop hl pop hl ; hl = front item scf ret .fail ex de,hl ret z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListPrepend.asm0000644000175000017500000000051210577133546022470 0ustar tygrystygrys; int adt_ListPrepend(struct adt_List *list, void *item) ; CALLER linkage for function pointers XLIB adt_ListPrepend LIB adt_ListPrepend_callee XREF ASMDISP_ADT_LISTPREPEND_CALLEE .adt_ListPrepend pop hl pop bc pop de push de push bc push hl jp adt_ListPrepend_callee + ASMDISP_ADT_LISTPREPEND_CALLEE z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListPrepend_callee.asm0000644000175000017500000000450710577133546024005 0ustar tygrystygrys; int __CALLEE__ adt_ListPrepend_callee(struct adt_List *list, void *item) ; 02.2003, 06.2005 aralbrec XLIB adt_ListPrepend_callee XDEF ASMDISP_ADT_LISTPREPEND_CALLEE XDEF ASMDISP_ADT_LISTPREPEND2 LIB ADTemptylistadd XREF _u_malloc .adt_ListPrepend_callee pop hl pop bc pop de push hl .asmentry ; enter: de = struct adt_List * ; bc = item * ; exit : carry reset if fail (no memory) and hl = 0 else: ; new item prepended to start of list, current points at new item, hl != 0 ; uses : af, bc, de, hl push bc push de ld hl,6 ; sizeof(struct adt_ListNode) push hl call _u_malloc pop bc pop de pop bc ret nc ; alloc memory failed ld (hl),c inc hl ld (hl),b ; store user item into new NODE inc hl ; hl = new NODE.next ex de,hl ; hl = LIST*, de = new NODE.next ld a,(hl) inc (hl) ; increase item count inc hl jp nz, noinchi inc (hl) jp cont .noinchi or (hl) ; hl = LIST.count+1, de = new NODE.next, list count & item done jp z, ADTemptylistadd ; if there are no items in list jump to emptylistadd helper .cont inc hl ; hl = LIST.state, de = new NODE.next, list count & item done .ADTListPrepend2 ld (hl),1 ; current INLIST inc hl dec de dec de ; de = new NODE push de ; stack = new NODE ld (hl),d inc hl ld (hl),e ; current = new NODE inc hl ; hl = head inc de inc de ; de = new NODE.next ldi ldi ; new NODE.next = head, hl = tail xor a ld (de),a inc de ld (de),a ; new NODE.prev = NULL dec hl ld e,(hl) dec hl ; hl = head ld d,(hl) ; de = old head NODE pop bc ; bc = new NODE ld (hl),b inc hl ld (hl),c ; head = new NODE ex de,hl ; hl = old head NODE inc hl inc hl inc hl inc hl ; hl = old head NODE.prev ld (hl),b inc hl ld (hl),c ; old head NODE.prev = new NODE scf ret DEFC ASMDISP_ADT_LISTPREPEND_CALLEE = asmentry - adt_ListPrepend_callee DEFC ASMDISP_ADT_LISTPREPEND2 = ADTListPrepend2 - adt_ListPrepend_callee z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListPrev.asm0000644000175000017500000000305610577133546022015 0ustar tygrystygrys; void __FASTCALL__ *adt_ListPrev(struct adt_List *list) ; 02.2003, 06.2005 aralbrec XLIB adt_ListPrev LIB adt_ListLast, l_setmem .adt_ListPrev ; enter: hl = struct adt_List * ; exit : no carry = list empty or current pointer is before start of list and hl = 0 else: ; hl = prev item before current in list ; current pointer changed to point at prev item in list ; uses : af, bc, de, hl ld a,(hl) inc hl or (hl) ret z ; fail if no items in list inc hl ; hl = state ld a,(hl) ; 0 = BEFORE, 1 = INLIST, 2 = AFTER or a ret z ; return failure if current is BEFORE start of list dec a jp nz, adt_ListLast+5 ; if current pointer is past end of list ; current pointer INLIST inc hl ld d,(hl) inc hl ; hl = current + 1 ld e,(hl) ; de = current->NODE inc de inc de inc de inc de ; de = NODE.prev ld a,(de) ; if NODE->prev == NULL, moving past start of list or a jr z, movedpaststart ld b,a inc de ld a,(de) ld e,a ld d,b ; de = NODE->prev ld (hl),e dec hl ld (hl),d ; current ptr = prev NODE ex de,hl ; hl = prev NODE ld e,(hl) inc hl ld d,(hl) ; de = list item scf ret .movedpaststart ; hl = current+1, de = current NODE.prev xor a call l_setmem-5 ; set 3 bytes to zero at hl ld l,a ld h,a ret ; carry flag reset indicates failure z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListRemove.asm0000644000175000017500000000676010600557061022330 0ustar tygrystygrys; void __FASTCALL__ *adt_ListRemove(struct adt_List *list) ; 02.2003, 06.2005 aralbrec XLIB adt_ListRemove XREF _u_free .adt_ListRemove ; enter: hl = struct adt_list * ; exit : no carry = list empty or current is not INLIST and hl = 0 else: ; hl = item removed ; remove current item from list, current moves to next item ; uses : af, bc, de, hl ld a,(hl) ; decrease list count dec (hl) inc hl or a jr nz, nomoredec or (hl) jr z, fail ; list has zero items dec (hl) .nomoredec inc hl inc hl ; hl = current ld d,(hl) inc hl ; hl = current + 1 ld e,(hl) ; de = current NODE push de ; stack = current NODE ex de,hl ; hl = current NODE, de = current+1 ld c,(hl) inc hl ld b,(hl) ; bc = item push bc ; stack = current NODE, item inc hl ; hl = current NODE.next ld b,(hl) inc hl ld c,(hl) ; bc = next NODE after current NODE inc hl ; hl = current NODE.prev ex de,hl ; de = current NODE.prev, hl = current+1 ld (hl),c dec hl ; hl = current ld (hl),b ; ** current = next NODE push hl ; stack = current NODE, item, current ld a,b or a jr z, nonext ; if there is no next NODE ; there is a next node ; hl = current, bc = next NODE, de = current NODE.prev ld hl,5 add hl,bc ; hl = next NODE.prev + 1 ex de,hl ; de = next NODE.prev + 1, hl = current NODE.prev ld b,(hl) inc hl ; hl = current NODE.prev + 1 ld c,(hl) ; bc = prev NODE ex de,hl ; de = current NODE.prev+1, hl = next NODE.prev+1 ld (hl),c dec hl ; hl = next NODE.prev ld (hl),b ; ** next NODE.prev = prev NODE ld de,-4 add hl,de ; hl = next NODE, bc = prev NODE .rejoin1 ld a,b or a jr z, noprev ; there is a previous node ; hl = next NODE, bc = prev NODE inc bc inc bc ; bc = prev NODE.next ld a,h ld (bc),a inc bc ld a,l ld (bc),a ; ** prev NODE.next = next NODE pop hl ; pop current .rejoin2 pop hl ; pop item ex (sp),hl ; stack = item, hl = freed NODE container push hl call _u_free ; free(hl) pop hl pop hl ; pop item scf ret ; removing first node in list .noprev ; hl = next NODE, bc = prev NODE pop de ex de,hl ; de = next NODE, hl = current dec hl ld a,d or a ; if next NODE == NULL, list is emptying, make BEFORE jr z, okaynext ld a,1 ; INLIST .okaynext ld (hl),a ; state = INLIST or BEFORE inc hl inc hl inc hl ; hl = head ld (hl),d inc hl ld (hl),e ; ** head = next NODE jp rejoin2 ; removing last node in list .nonext ; hl = current, de = current NODE.prev dec hl ld (hl),2 ; current now points after end of list, state = AFTER ld bc,5 add hl,bc ; hl = tail ex de,hl ; de = tail, hl = current NODE.prev ld b,(hl) inc hl ld c,(hl) ; bc = prev NODE ex de,hl ; hl = tail ld (hl),b inc hl ld (hl),c ; ** tail = prev NODE ld hl,0 ; hl = next NODE = NULL, bc = prev NODE jp rejoin1 .fail dec hl ld (hl),a ld h,a ld l,a ret z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListSearch.asm0000644000175000017500000000055010577133546022302 0ustar tygrystygrys; void *adt_ListSearch(struct adt_List *list, void *match, void *item1) ; CALLER linkage for function pointers XLIB adt_ListSearch LIB adt_ListSearch_callee XREF ASMDISP_ADT_LISTSEARCH_CALLEE .adt_ListSearch pop bc pop de pop iy pop hl push hl push hl push de push bc jp adt_ListSearch_callee + ASMDISP_ADT_LISTSEARCH_CALLEE z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListSearch_callee.asm0000644000175000017500000000163110577133546023610 0ustar tygrystygrys; void __CALLEE__ *adt_ListSearch_callee(struct adt_List *list, void *match, void *item1) ; 02.2003, 08.2005 aralbrec XLIB adt_ListSearch_callee XDEF ASMDISP_ADT_LISTSEARCH_CALLEE LIB ADTListSearch, l_jpiy .adt_ListSearch_callee pop hl pop de pop iy ex (sp),hl .asmentry ; enter: hl = struct adt_List * ; de = item1 * ; iy = void (*match)(DE = void *item1, BC = void *item2) -- MUST PRESERVE BC,DE,IX,HL ; sets carry if equal ; exit : no carry = item not found, current points past end of list, hl = 0 ; else hl = item found, current points at found item ; uses : af, bc, de, hl ld ix,compare call ADTListSearch ld l,c ld h,b ret c ld hl,0 ret .compare push hl push de push bc call l_jpiy ld a,l pop bc pop de pop hl or a ret nz scf ret DEFC ASMDISP_ADT_LISTSEARCH_CALLEE = asmentry - adt_ListSearch_callee z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListSetCurr.asm0000644000175000017500000000052710577133546022470 0ustar tygrystygrys; void adt_ListSetCurr(struct adt_List *list, struct adt_ListNode *n) ; CALLER linkage for function pointers XLIB adt_ListSetCurr LIB adt_ListSetCurr_callee XREF ASMDISP_ADT_LISTSETCURR_CALLEE .adt_ListSetCurr pop af pop de pop hl push hl push de push af jp adt_ListSetCurr_callee + ASMDISP_ADT_LISTSETCURR_CALLEE z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListSetCurr_callee.asm0000644000175000017500000000127610577133546023777 0ustar tygrystygrys; void __CALLEE__ adt_ListSetCurr_callee(struct adt_List *list, struct adt_ListNode *n) ; 11.2006 aralbrec XLIB adt_ListSetCurr_callee XDEF ASMDISP_ADT_LISTSETCURR_CALLEE .adt_ListSetCurr_callee pop hl pop de ex (sp),hl .asmentry ; enter: hl = struct adt_List* ; de = struct adt_ListNode*, if MSB = 0 no changes done ld a,d ; if new current pointer has MSB 0, do not change anything or a ret z inc hl inc hl ld (hl),1 ; current will point inside list inc hl ld (hl),d ; store current pointer inc hl ld (hl),e ret DEFC ASMDISP_ADT_LISTSETCURR_CALLEE = asmentry - adt_ListSetCurr_callee z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListSetCurrAfter.asm0000644000175000017500000000052610577133546023451 0ustar tygrystygrys; void __FASTCALL__ adt_ListSetCurrAfter(struct adt_List *list) ; 11.2006 aralbrec XLIB adt_ListSetCurrAfter LIB l_setmem ; enter: hl = struct adt_List* .adt_ListSetCurrAfter inc hl inc hl ld (hl),2 ; indicate current pointer points after end of list inc hl xor a jp l_setmem-3 ; current ptr = 0 z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListSetCurrBefore.asm0000644000175000017500000000041710577133546023611 0ustar tygrystygrys; void __FASTCALL__ adt_ListSetCurrBefore(struct adt_List *list) ; 11.2006 aralbrec XLIB adt_ListSetCurrBefore LIB l_setmem ; enter: HL = struct adt_List* .adt_ListSetCurrBefore inc hl inc hl xor a jp l_setmem-5 ; state = AFTER, current ptr = 0 z88dk-1.8.ds1/libsrc/adt/linkedlist/adt_ListTrim.asm0000644000175000017500000000451210577133546022012 0ustar tygrystygrys; void __FASTCALL__ *adt_ListTrim(struct adt_List *list) ; 02.2003, 08.2005 aralbrec XLIB adt_ListTrim LIB l_setmem XREF _u_free .adt_ListTrim ; enter: hl = struct adt_List * ; exit : no carry = list empty, hl = 0 else: ; HL = item removed from list ; last item removed from list and current points to new last item ; uses : af, bc, de, hl ld e,(hl) inc hl ld d,(hl) dec hl ; hl = list ld a,d or e jr z, fail ; fail if list empty dec de ; count = count - 1 ld a,d or e jp nz, morethanone ; getting rid of only item in list push hl ; save list ld de,5 add hl,de ; hl = head ld d,(hl) inc hl ld e,(hl) ; de = NODE ex de,hl ; hl = NODE ld e,(hl) inc hl ld d,(hl) ; de = item push de ; save item dec hl push hl call _u_free ; free NODE pop hl pop hl ex (sp),hl ; hl = list, stack = item xor a call l_setmem-17 ; clear 9 bytes pop hl ; hl = item scf ret ; more than one item in list .morethanone ; hl = list, de = new count ld (hl),e inc hl ld (hl),d ; count-- inc hl ld (hl),1 ; state = INLIST ld de,5 add hl,de ; hl = tail ld d,(hl) inc hl ; hl = tail+1 ld e,(hl) ; de = tail NODE ex de,hl ; hl = tail NODE, de = tail+1 ld c,(hl) inc hl ld b,(hl) ; bc = item push bc ; save item ld bc,4 add hl,bc ; hl = tail NODE.prev+1 ld c,(hl) dec hl ld b,(hl) ; bc = prev NODE dec hl ; hl = tail NODE.next+1 ex de,hl ; de = tail NODE.next+1, hl = tail+1 ld (hl),c dec hl ; hl = tail ld (hl),b ; tail = prev NODE dec hl dec hl dec hl ; hl = current+1 ld (hl),c dec hl ; hl = current ld (hl),b ; current = prev NODE ld l,c ld h,b inc hl inc hl ; hl = prev NODE.next ld (hl),0 inc hl ld (hl),0 ; prev NODE.next = NULL dec de dec de dec de ; de = tail NODE ex de,hl push hl call _u_free ; free tail NODE pop hl pop hl ; hl = item scf ret .fail ex de,hl ret z88dk-1.8.ds1/libsrc/adt/linkedlist/ADTemptylistadd.asm0000644000175000017500000000156410302466361022441 0ustar tygrystygrys; 02.2003 aralbrec XLIB ADTemptylistadd ; enter: HL = LIST.count+1 ; DE = new NODE.next ; item stored in new NODE ; exit : initialize list data structures for one item ; carry set to indicate success .ADTemptylistadd dec hl ld (hl),1 inc hl ld (hl),0 ; list count = 1 inc hl ld (hl),1 ; current is INLIST inc hl ; hl = current dec de dec de ; de = new NODE ld (hl),d inc hl ld (hl),e ; current = new NODE inc hl ld (hl),d inc hl ld (hl),e ; head = new NODE inc hl ld (hl),d inc hl ld (hl),e ; tail = new NODE inc de inc de ; de = new NODE.next xor a ld (de),a inc de ld (de),a ; new NODE.next = NULL inc de ld (de),a inc de ld (de),a ; new NODE.prev = NULL scf ret z88dk-1.8.ds1/libsrc/adt/linkedlist/ADTListSearch.asm0000644000175000017500000000312410577133545022002 0ustar tygrystygrys; void *adt_ListSearch(struct adt_List *list, void *match, void *item1) ; 02.2003, 08.2005 aralbrec XLIB ADTListSearch LIB l_jpix ; enter: HL = struct adt_List * ; DE = item1 * ; IX = void (*match)(DE = void *item1, BC = void *item2) -- MUST PRESERVE BC,DE,IX,HL ; sets carry if equal ; exit : no carry = item not found, current points past end of list ; else BC = item found, current points at found item ; uses : AF,BC,DE,HL .ADTListSearch inc hl inc hl ld a,(hl) ; a = list state inc hl or a jp nz, notbefore inc hl push hl ; stack = list.current + 1 inc hl ld a,(hl) inc hl jp rejoin .notbefore ld a,(hl) inc hl push hl ; stack = list.current + 1 .rejoin ld l,(hl) ld h,a ; hl = current NODE .while ld a,h or l jr z, fail ; if hl = NULL, failure ld c,(hl) inc hl ld b,(hl) ; bc = item2 * inc hl ; hl = NODE.next call l_jpix ; compare two items, set carry if = jr c, found ld a,(hl) inc hl ld l,(hl) ld h,a jp while .found dec hl dec hl ; hl = NODE pop de ex de,hl ; de = NODE, hl = list.current + 1 ld (hl),e dec hl ld (hl),d ; list.current = NODE dec hl ld (hl),1 ; current ptr is INLIST scf ret .fail pop hl ; hl = list.current + 1 xor a ld (hl),a dec hl ld (hl),a ; list.current = NULL dec hl ld (hl),2 ; current ptr past end of list ret z88dk-1.8.ds1/libsrc/adt/Makefile0000644000175000017500000000066010630724403016173 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../Make.config all: $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/adt @adt.lst clean: cd hashtable ; $(RM) *.o* *.sym *.map zcc_opt.def ; cd .. cd heap ; $(RM) *.o* *.sym *.map zcc_opt.def ; cd .. cd linkedlist ; $(RM) *.o* *.sym *.map zcc_opt.def ; cd .. cd stack ; $(RM) *.o* *.sym *.map zcc_opt.def ; cd .. cd queue ; $(RM) *.o* *.sym *.map zcc_opt.def ; cd .. z88dk-1.8.ds1/libsrc/adt/queue/0000755000175000017500000000000010765202715015663 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/adt/queue/adt_QueueBack.asm0000644000175000017500000000040510577133547021070 0ustar tygrystygrys; void *adt_QueueBack(struct adt_Queue *q) ; 09.2005 aralbrec XLIB adt_QueueBack LIB adt_QueueFront ; enter: HL = struct adt_Queue * ; exit : HL = peek at last item or 0 and carry reset if queue empty .adt_QueueBack inc hl inc hl jp adt_QueueFront z88dk-1.8.ds1/libsrc/adt/queue/adt_QueueCount.asm0000644000175000017500000000025110525542520021303 0ustar tygrystygrys; uint __FASTCALL__ adt_QueueCount(struct adt_Queue *q) ; 09.2005 aralbrec XLIB adt_QueueCount .adt_QueueCount ld a,(hl) inc hl ld h,(hl) ld l,a ret z88dk-1.8.ds1/libsrc/adt/queue/adt_QueueCreate.asm0000644000175000017500000000065310577133547021440 0ustar tygrystygrys; struct adt_Queue *adt_QueueCreate(void) ; 09.2005 aralbrec XLIB adt_QueueCreate LIB l_setmem XREF _u_malloc ; exit : HL = struct adt_Queue * and carry set ; = 0 and nc if fail .adt_QueueCreate ld hl,6 ; sizeof(struct adt_Queue) push hl call _u_malloc pop de ret nc ; ret with hl = 0 and nc if fail ld e,l ld d,h xor a call l_setmem-11 ex de,hl scf ret z88dk-1.8.ds1/libsrc/adt/queue/adt_QueueCreateS.asm0000644000175000017500000000032710577133547021561 0ustar tygrystygrys; void __FASTCALL__ *adt_QueueCreateS(struct adt_Queue *q) ; 11.2006 aralbrec XLIB adt_QueueCreateS LIB l_setmem ; initialize an adt_Queue ; ; hl = struct adt_Queue* .adt_QueueCreateS xor a jp l_setmem-11 z88dk-1.8.ds1/libsrc/adt/queue/adt_QueueDelete.asm0000644000175000017500000000051310577133547021432 0ustar tygrystygrys; void adt_QueueDelete(struct adt_Queue *q, void *delete) ; CALLER linkage for function pointers XLIB adt_QueueDelete LIB adt_QueueDelete_callee XREF ASMDISP_ADT_QUEUEDELETE_CALLEE .adt_QueueDelete pop bc pop de pop hl push hl push de push bc jp adt_QueueDelete_callee + ASMDISP_ADT_QUEUEDELETE_CALLEE z88dk-1.8.ds1/libsrc/adt/queue/adt_QueueDelete_callee.asm0000644000175000017500000000106610577133547022743 0ustar tygrystygrys; void __CALLEE__ adt_QueueDelete_callee(struct adt_Queue *q, void *delete) ; 09.2005 aralbrec XLIB adt_QueueDelete_callee XDEF ASMDISP_ADT_QUEUEDELETE_CALLEE LIB adt_QueueDeleteS_callee XREF ASMDISP_ADT_QUEUEDELETES_CALLEE XREF _u_free .adt_QueueDelete_callee pop hl pop de ex (sp),hl .asmentry push hl call adt_QueueDeleteS_callee + ASMDISP_ADT_QUEUEDELETES_CALLEE pop hl push hl call _u_free ; free struct adt_Queue container pop hl ret DEFC ASMDISP_ADT_QUEUEDELETE_CALLEE = asmentry - adt_QueueDelete_callee z88dk-1.8.ds1/libsrc/adt/queue/adt_QueueDeleteS.asm0000644000175000017500000000052210577133547021555 0ustar tygrystygrys; void adt_QueueDeleteS(struct adt_Queue *q, void *delete) ; CALLER linkage for function pointers XLIB adt_QueueDeleteS LIB adt_QueueDeleteS_callee XREF ASMDISP_ADT_QUEUEDELETES_CALLEE .adt_QueueDeleteS pop bc pop de pop hl push hl push de push bc jp adt_QueueDeleteS_callee + ASMDISP_ADT_QUEUEDELETES_CALLEE z88dk-1.8.ds1/libsrc/adt/queue/adt_QueueDeleteS_callee.asm0000644000175000017500000000240710577133547023066 0ustar tygrystygrys; void __CALLEE__ adt_QueueDeleteS_callee(struct adt_Queue *q, void *delete) ; 09.2005 aralbrec XLIB adt_QueueDeleteS_callee XDEF ASMDISP_ADT_QUEUEDELETES_CALLEE LIB l_jpix XREF _u_free .adt_QueueDeleteS_callee pop hl pop de ex (sp),hl .asmentry ; free all items in queue but not adt_Queue struct itself ; ; enter: HL = struct adt_Queue * ; DE = delete function (HL = user item) ld a,d or e jr nz, notzero ld de, justret .notzero ld ixl,e ld ixh,d ; ix = delete function inc hl inc hl ld a,(hl) inc hl ld h,(hl) ld l,a .loop ; hl = QueueNode to delete ld a,h or l ret z ld e,(hl) inc hl ld d,(hl) inc hl push hl ; stack = QueueNode.next ex de,hl ; hl = user item push hl call l_jpix ; delete(user item) pop hl pop hl ld e,(hl) inc hl ld d,(hl) ; de = next QueueNode dec hl dec hl dec hl push de push hl call _u_free ; free QueueNode container pop hl pop hl ; hl = next QueueNode jp loop .justret ret DEFC ASMDISP_ADT_QUEUEDELETES_CALLEE = asmentry - adt_QueueDeleteS_callee z88dk-1.8.ds1/libsrc/adt/queue/adt_QueueFront.asm0000644000175000017500000000054010577133547021320 0ustar tygrystygrys; void *adt_QueueFront(struct adt_Queue *q) ; 09.2005 aralbrec XLIB adt_QueueFront ; enter: HL = struct adt_Queue * ; exit : HL = peek at top item or 0 and carry reset if queue empty .adt_QueueFront inc hl inc hl ld a,(hl) inc hl ld h,(hl) ld l,a or h ret z ld a,(hl) inc hl ld h,(hl) ld l,a scf ret z88dk-1.8.ds1/libsrc/adt/queue/adt_QueuePopBack.asm0000644000175000017500000000376610577133547021564 0ustar tygrystygrys; void __FASTCALL__ *adt_QueuePopBack(struct adt_Queue *q) ; 11.2006 aralbrec XLIB adt_QueuePopBack XREF _u_free ; enter: HL = struct adt_Queue * ; exit : HL = top item, item removed from queue ; = 0 and carry reset if queue empty .adt_QueuePopBack ld a,(hl) ; reduce count dec (hl) inc hl or a jp nz, nomoredec or (hl) jr z, fail dec (hl) .nomoredec inc hl ; hl = &adt_Queue.front ld e,l ; de = & lagger's next pointer ld d,h ; = &adt_Queue.front to start with ld a,(hl) inc hl push hl ; stack = &adt_Queue.front + 1b ld h,(hl) ld l,a ; hl = & current adt_QueueNode to investigate .loop ; find the second last item in the queue ; de = & lagger's next pointer ; hl = & current adt_QueueNode inc hl inc hl push hl ; save & current adt_QueueNode.next ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = & next adt_QueueNode to investigate or h ; if next is 0, we found the end of the list jr z, exitloop pop de ; otherwise lagger follows jp loop .exitloop ; stack = &adt_Queue.front + 1b, & last adt_QueueNode.next ; de = & lagger adt_QueueNode.next pop hl ex (sp),hl ; hl = &adt_Queue.front + 1b inc hl ld (hl),e ; store ptr to new last node into adt_Queue.back inc hl ld (hl),d xor a ; store 0 into the second last node's next pointer ld (de),a inc de ld (de),a pop hl ; hl = & last adt_QueueNode.next dec hl ld d,(hl) dec hl ld e,(hl) push de ; stack = last item push hl call _u_free ; free last QueueNode container pop hl pop hl ; hl = item scf ret .fail dec hl ld (hl),a ld l,a ld h,a ret z88dk-1.8.ds1/libsrc/adt/queue/adt_QueuePopFront.asm0000644000175000017500000000252410577133547022003 0ustar tygrystygrys; void *adt_QueuePopFront(struct adt_Queue *q) ; 09.2005 aralbrec XLIB adt_QueuePopFront XREF _u_free ; enter: HL = struct adt_Queue * ; exit : HL = top item, item removed from queue ; = 0 and carry reset if queue empty .adt_QueuePopFront ld a,(hl) ; decrease count dec (hl) inc hl or a jp nz, nomoredec or (hl) jr z, fail dec (hl) .nomoredec inc hl ld e,(hl) inc hl ld d,(hl) ; de = front adt_QueueNode * ex de,hl ; hl = adt_QueueNode *, de = adt_Queue.front + 1b ld c,(hl) inc hl ld b,(hl) push bc ; stack = item inc hl ; hl = adt_QueueNode.next dec de ; de = adt_Queue.front ld a,(hl) ; next node becomes front ldi ; so set adt_Queue.front = adt_QueueNode.next or (hl) ldi jp nz, notemptynow ; if the queue is now empty ld (de),a ; if queue empty, store 0 into adt_Queue.back inc de ld (de),a .notemptynow ; hl = adt_QueueNode.next + 2b ld bc,-4 add hl,bc ; hl = adt_QueueNode * push hl call _u_free ; free empty container pop hl pop hl ; hl = item scf ret .fail dec hl ld (hl),a ld l,a ld h,a ret z88dk-1.8.ds1/libsrc/adt/queue/adt_QueuePushBack.asm0000644000175000017500000000052610577133547021734 0ustar tygrystygrys; int adt_QueuePushBack(struct adt_Queue *q, void *item) ; CALLER linkage for function pointers XLIB adt_QueuePushBack LIB adt_QueuePushBack_callee XREF ASMDISP_ADT_QUEUEPUSHBACK_CALLEE .adt_QueuePushBack pop bc pop de pop hl push hl push de push bc jp adt_QueuePushBack_callee + ASMDISP_ADT_QUEUEPUSHBACK_CALLEE z88dk-1.8.ds1/libsrc/adt/queue/adt_QueuePushBack_callee.asm0000644000175000017500000000351710577133547023244 0ustar tygrystygrys; int __CALLEE__ adt_QueuePushBack_callee(struct adt_Queue *q, void *item) ; 09.2005 aralbrec XLIB adt_QueuePushBack_callee XDEF ASMDISP_ADT_QUEUEPUSHBACK_CALLEE XREF _u_malloc .adt_QueuePushBack_callee pop hl pop de ex (sp),hl .asmentry ; enter: HL = struct adt_Queue * ; DE = item ; exit : HL = 0 and carry reset if memory allocation failed ; carry set if success push de push hl ld hl,4 ; sizeof (struct adt_QueueNode) push hl call _u_malloc ; get memory for a queue node pop de pop de ; de = struct adt_Queue * pop bc ; bc = item ret nc ; ret with hl = 0 if alloc failed push hl ; stack = new QueueNode* ld (hl),c ; store item in new QueueNode container inc hl ld (hl),b inc hl xor a ld (hl),a ; QueueNode.next = 0 inc hl ld (hl),a ex de,hl ; hl = Queue.count ld a,(hl) inc (hl) ; count++ inc hl ld c,(hl) jr nz, nohi inc (hl) .nohi or c ; Z flag if no items in queue inc hl ; hl = Queue.front pop bc ; bc = new QueueNode jp nz, Qnotempty ld (hl),c ; an empty queue so make inc hl ; Queue.front = new QueueNode ld (hl),b dec hl .Qnotempty inc hl inc hl ; hl = Queue.back ld e,(hl) ; de = current last QueueNode ld (hl),c ; Queue.back = new QueueNode inc hl ld d,(hl) ld (hl),b ex de,hl ; hl = last QueueNode inc hl inc hl ld (hl),c ; last QueueNode.next = new QueueNode inc hl ld (hl),b scf ret DEFC ASMDISP_ADT_QUEUEPUSHBACK_CALLEE = asmentry - adt_QueuePushBack_callee z88dk-1.8.ds1/libsrc/adt/queue/adt_QueuePushFront.asm0000644000175000017500000000053510577133547022164 0ustar tygrystygrys; int adt_QueuePushFront(struct adt_Queue *q, void *item) ; CALLER linkage for function pointers XLIB adt_QueuePushFront LIB adt_QueuePushFront_callee XREF ASMDISP_ADT_QUEUEPUSHFRONT_CALLEE .adt_QueuePushFront pop bc pop de pop hl push hl push de push bc jp adt_QueuePushFront_callee + ASMDISP_ADT_QUEUEPUSHFRONT_CALLEE z88dk-1.8.ds1/libsrc/adt/queue/adt_QueuePushFront_callee.asm0000644000175000017500000000330210577133547023464 0ustar tygrystygrys; int __CALLEE__ adt_QueuePushFront_callee(struct adt_Queue *q, void *item) ; 11.2006 aralbrec XLIB adt_QueuePushFront_callee XDEF ASMDISP_ADT_QUEUEPUSHFRONT_CALLEE XREF _u_malloc .adt_QueuePushFront_callee pop hl pop de ex (sp),hl .asmentry ; enter: HL = struct adt_Queue * ; DE = item ; exit : HL = 0 and carry reset if memory allocation failed ; carry set if success push de push hl ld hl,4 ; sizeof (struct adt_QueueNode) push hl call _u_malloc ; get memory for a queue node pop de pop de ; de = struct adt_Queue * pop bc ; bc = item ret nc ; ret with hl = 0 if alloc failed push hl ; stack = new QueueNode* ld (hl),c ; store item in new QueueNode container inc hl ld (hl),b inc hl ex de,hl ; hl = Queue.count, de = new QueueNode.next ld a,(hl) inc (hl) ; count++ inc hl ld c,(hl) jp nz, nohi inc (hl) .nohi or c ; Z flag if 0 items in Queue inc hl ; hl = Queue.front ldi ; copy Queue.front into new QueueNode.next ld a,(hl) ; hl = Queue.front + 1b ld (de),a pop de ; de = new QueueNode ld (hl),d ; Queue.front = new QueueNode dec hl ld (hl),e scf ret nz ; ret if this is not the only item inc hl ; otherwise make back ptr point at item too inc hl ; hl = Queue.back ld (hl),e inc hl ld (hl),d ret DEFC ASMDISP_ADT_QUEUEPUSHFRONT_CALLEE = asmentry - adt_QueuePushFront_callee z88dk-1.8.ds1/libsrc/adt/stack/0000755000175000017500000000000010765202715015644 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/adt/stack/adt_StackCount.asm0000644000175000017500000000041210525174655021256 0ustar tygrystygrys; uint __FASTCALL__ adt_StackCount(struct adt_Stack *s) ; 11.2006 aralbrec XLIB adt_StackCount ; return number of items in stack ; ; enter: HL = struct adt_Stack * ; exit : HL = number of items .adt_StackCount ld a,(hl) inc hl ld h,(hl) ld l,a ret z88dk-1.8.ds1/libsrc/adt/stack/adt_StackCreate.asm0000644000175000017500000000076310577133547021404 0ustar tygrystygrys; struct adt_Stack *adt_StackCreate(void) ; 09.2005, 11.2006 aralbrec XLIB adt_StackCreate LIB l_setmem XREF _u_malloc ; create an empty stack ; ; exit : if fail HL = 0 and carry reset ; if successful HL = new stack handle and carry set .adt_StackCreate ld hl,4 ; sizeof(struct adt_Stack) push hl call _u_malloc pop de ret nc ; mem alloc failed, hl = 0 ld e,l ld d,h xor a call l_setmem-7 ex de,hl scf ret z88dk-1.8.ds1/libsrc/adt/stack/adt_StackCreateS.asm0000644000175000017500000000027310577133547021523 0ustar tygrystygrys; void __FASTCALL__ adt_StackCreateS(struct adt_Stack *s) ; 11.2006 aralbrec XLIB adt_StackCreateS LIB l_setmem ; initialize an adt_Stack* .adt_StackCreateS xor a jp l_setmem-7 z88dk-1.8.ds1/libsrc/adt/stack/adt_StackDelete.asm0000644000175000017500000000051310577133547021374 0ustar tygrystygrys; void adt_StackDelete(struct adt_Stack *s, void *delete) ; CALLER linkage for function pointers XLIB adt_StackDelete LIB adt_StackDelete_callee XREF ASMDISP_ADT_STACKDELETE_CALLEE .adt_StackDelete pop bc pop de pop hl push hl push de push bc jp adt_StackDelete_callee + ASMDISP_ADT_STACKDELETE_CALLEE z88dk-1.8.ds1/libsrc/adt/stack/adt_StackDelete_callee.asm0000644000175000017500000000102010577133547022673 0ustar tygrystygrys; void __CALLEE__ adt_StackDelete_callee(struct adt_Stack *s, void *delete) ; 09.2005, 11.2006 aralbrec XLIB adt_StackDelete_callee XDEF ASMDISP_ADT_STACKDELETE_CALLEE LIB adt_StackDeleteS_callee XREF ASMDISP_ADT_STACKDELETES_CALLEE XREF _u_free .adt_StackDelete_callee pop hl pop de ex (sp),hl .asmentry push hl call adt_StackDeleteS_callee + ASMDISP_ADT_STACKDELETES_CALLEE pop hl push hl call _u_free pop hl ret DEFC ASMDISP_ADT_STACKDELETE_CALLEE = asmentry - adt_StackDelete_callee z88dk-1.8.ds1/libsrc/adt/stack/adt_StackDeleteS.asm0000644000175000017500000000052210577133547021517 0ustar tygrystygrys; void adt_StackDeleteS(struct adt_Stack *s, void *delete) ; CALLER linkage for function pointers XLIB adt_StackDeleteS LIB adt_StackDeleteS_callee XREF ASMDISP_ADT_STACKDELETES_CALLEE .adt_StackDeleteS pop bc pop de pop hl push hl push de push bc jp adt_StackDeleteS_callee + ASMDISP_ADT_STACKDELETES_CALLEE z88dk-1.8.ds1/libsrc/adt/stack/adt_StackDeleteS_callee.asm0000644000175000017500000000253710577133547023034 0ustar tygrystygrys; void __CALLEE__ adt_StackDeleteS_callee(struct adt_Stack *s, void *delete) ; 11.2006 aralbrec XLIB adt_StackDeleteS_callee XDEF ASMDISP_ADT_STACKDELETES_CALLEE LIB l_jpix XREF _u_free .adt_StackDeleteS_callee pop hl pop de ex (sp),hl .asmentry ; delete all items in stack but not adt_Stack struct itself ; ; enter: HL = struct adt_Stack * ; DE = void (*delete)(void *item) with HL,stack=item ld a,h or l ret z ld a,d or e jp nz, notzero ld de,justret .notzero ld ixl,e ld ixh,d inc hl inc hl ld e,(hl) inc hl ld d,(hl) ex de,hl ; hl = &adt_StackNode .loop ld a,h or l ret z push hl ; save node address ld c,(hl) inc hl ld b,(hl) ; bc = item inc hl ld e,(hl) inc hl ld d,(hl) push de ; save next node ld l,c ld h,b push hl call l_jpix ; user delete function pop hl pop hl ex (sp),hl ; stack = next node, hl = current node push hl call _u_free ; free this node pop hl pop hl ; do it all again for next node jp loop .justret ret DEFC ASMDISP_ADT_STACKEDELETES_CALLEE = asmentry - adt_StackDeleteS_callee z88dk-1.8.ds1/libsrc/adt/stack/adt_StackPeek.asm0000644000175000017500000000063210577133547021060 0ustar tygrystygrys; void __FASTCALL__ *adt_StackPeek(struct adt_Stack *s) ; 09.2005, 11.2006 aralbrec XLIB adt_StackPeek ; return the item at the top of the stack ; but don't pop it! ; ; enter: HL = struct adt_Stack * ; exit : HL = item at top of stack or 0 if stack empty .adt_StackPeek inc hl inc hl ld a,(hl) inc hl ld h,(hl) ld l,a or h ret z ld a,(hl) inc hl ld h,(hl) ld l,a ret z88dk-1.8.ds1/libsrc/adt/stack/adt_StackPop.asm0000644000175000017500000000161310577133547020732 0ustar tygrystygrys; void __FASTCALL__ *adt_StackPop(struct adt_Stack *s) ; 09.2005, 11.2006 aralbrec XLIB adt_StackPop XREF _u_free ; pop item off the top of stack and update stack ptr ; ; enter: HL = struct adt_Stack * ; exit : HL = item at top of stack or 0 if stack empty ; carry flag also set if stack not empty .adt_StackPop ld a,(hl) dec (hl) inc hl or a jp nz, nodec or (hl) jr z, fail dec (hl) .nodec inc hl ld e,(hl) inc hl ld d,(hl) ex de,hl ; de = &adt_Stack.next + 1b, hl = &adt_StackNode ld c,(hl) inc hl ld b,(hl) push bc ; stack = item inc hl ld a,(hl) inc hl ldd ld (de),a ; write new stack ptr dec hl dec hl push hl call _u_free ; free adt_StackNode container pop hl pop hl ; hl = item scf ret .fail dec hl ld (hl),a ld l,a ld h,a ret z88dk-1.8.ds1/libsrc/adt/stack/adt_StackPush.asm0000644000175000017500000000047210577133547021115 0ustar tygrystygrys; int adt_StackPush(struct adt_Stack *s, void *item) ; CALLER linkage for function pointers XLIB adt_StackPush LIB adt_StackPush_callee XREF ASMDISP_ADT_STACKPUSH_CALLEE .adt_StackPush pop bc pop de pop hl push hl push de push bc jp adt_StackPush_callee + ASMDISP_ADT_STACKPUSH_CALLEE z88dk-1.8.ds1/libsrc/adt/stack/adt_StackPush_callee.asm0000644000175000017500000000254310577133547022423 0ustar tygrystygrys; int __CALLEE__ adt_StackPush_callee(struct adt_Stack *s, void *item) ; 09.2005, 11.2006 aralbrec XLIB adt_StackPush_callee XDEF ASMDISP_ADT_STACKPUSH_CALLEE XREF _u_malloc .adt_StackPush_callee pop hl pop de ex (sp),hl .asmentry ; push item onto stack and update stack ptr ; ; enter: HL = struct adt_Stack * ; DE = item ; exit : HL = 0 and no carry if fail (insufficient memory) ; carry set if successful push hl push de ld hl,4 ; sizeof(struct adt_StackNode) push hl call _u_malloc pop bc pop bc ; bc = item pop de ; de = adt_Stack * ret nc ; mem alloc failed, hl = 0 push hl ; save adt_StackNode ld (hl),c ; hl = & new adt_StackNode inc hl ld (hl),b ; store item inc hl ex de,hl ; hl = adt_Stack *, de = &adt_StackNode.next inc (hl) ; increase stack count inc hl jr nz, nohi inc (hl) .nohi inc hl ; hl = & adt_Stack.next ldi ; adt_StackNode.next = adt_Stack.next ldi pop de ; de = &adt_StackNode dec hl ; hl = &adt_Stack.next + 1b ld (hl),d dec hl ld (hl),e ; new adt_StackNode at top of stack scf ret DEFC ASMDISP_ADT_STACKPUSH_CALLEE = asmentry - adt_StackPush_callee z88dk-1.8.ds1/libsrc/algorithm/0000755000175000017500000000000010765202715015755 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/algorithm/alg.lst0000644000175000017500000000031110550667106017240 0ustar tygrystygrysAStarSearch/astar_CleanUp AStarSearch/astar_DeletePath AStarSearch/astar_PathLength AStarSearch/astar_Search AStarSearch/astar_SearchResume AStarSearch/astar_WalkPath AStarSearch/astar_WalkPath_callee z88dk-1.8.ds1/libsrc/algorithm/AStarSearch/0000755000175000017500000000000010765202715020115 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/algorithm/AStarSearch/astar_CleanUp.asm0000644000175000017500000000114110550667106023336 0ustar tygrystygrys; void __FASTCALL__ astar_Cleanup(struct astar_path *p) ; delete paths in astar's priority queue and optional path in parameter ; 01.2007 aralbrec XLIB astar_CleanUp LIB astar_DeletePath XREF _astar_queueN, _astar_queue .astar_CleanUp call astar_DeletePath ; does nothing if hl=0 ld hl,(_astar_queue) inc hl inc hl ld bc,(_astar_queueN) .loop ld a,b or c jr z, done dec bc ld e,(hl) inc hl ld d,(hl) inc hl push hl push bc ex de,hl call astar_DeletePath pop bc pop hl jp loop .done ld (_astar_queueN),bc ret z88dk-1.8.ds1/libsrc/algorithm/AStarSearch/astar_DeletePath.asm0000644000175000017500000000163010550703364024026 0ustar tygrystygrys; void __FASTCALL__ astar_DeletePath(struct astar_path *p) ; delete the path by freeing any memory associated with it ; 01.2007 aralbrec XLIB astar_DeletePath XREF _u_free ; enter: hl = struct astar_path * ; uses : af, bc, de, hl .astar_DeletePath ld a,h or l ret z ld e,l ld d,h inc hl inc hl ld a,(hl) ; is ref count == 0? or a ret nz ; if not, no more freeing .loop ; de = & struct astar_path ; hl = & struct astar_path.ref_count inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = & next struct astar_path push hl ex de,hl push hl call _u_free pop hl pop hl ld a,h or l ret z ; no more paths! ld e,l ld d,h inc hl inc hl dec (hl) ; ref count-- jp z, loop ; if zero, delete it ret z88dk-1.8.ds1/libsrc/algorithm/AStarSearch/astar_PathLength.asm0000644000175000017500000000065410550667106024055 0ustar tygrystygrys; uint __FASTCALL__ astar_PathLength(struct astar_path *p) ; return the length of the path ; 01.2007 aralbrec XLIB astar_PathLength ; enter : hl = struct astar_path * ; exit : hl = path length ; uses : af, bc, de, hl .astar_PathLength ld bc,3 ld d,b ld e,b .loop ld a,h or l jr z, done inc de add hl,bc ld a,(hl) inc hl ld h,(hl) ld l,a jp loop .done ex de,hl ret z88dk-1.8.ds1/libsrc/algorithm/AStarSearch/astar_Search.asm0000644000175000017500000001633210550667106023224 0ustar tygrystygrys; struct astar_path *astar_Search(void) ; return least costly path from src_node to dst_node ; 01.2007 aralbrec ; exit : if path found, C flag set and HL = struct astar_path * ; if not found, NC flag set and HL = 0 ; if out of mem, NC flag set and HL = current lowest cost struct astar_path * ; ; NOTE : ; ; There will still be paths stored in the priority queue on ; return. Those paths and the path returned must have their ; memory deallocated to finish cleanup. A call to astar_CleanUp() ; will complete cleanup; if the path parameter to this function ; is non-zero, the path will also be deleted. This implementation ; does not perform this cleanup automatically on exit in order ; to allow search resumption. XLIB astar_Search XDEF ASMDISP_ASTAR_SEARCH_RESUME_SUCCESS, ASMDISP_ASTAR_SEARCH_RESUME_FAIL LIB l_setmem, l_jpix, ADTHeapAdd, ADTHeapExtract, astar_DeletePath XREF _u_malloc, _u_free XREF _astar_TestAndClose, _astar_Successor XREF _astar_queue, _astar_queueSize, _astar_queueN XREF _astar_startNode, _astar_destNode .astar_Search ; get memory for initial path containing starting point ld hl,7 ; sizeof(struct astar_path) push hl call _u_malloc pop de ret nc ; alloc failed, hl = 0, NC flag ; hl = & new struct astar_path ; fill in start path ld de,(_astar_startNode) ld (hl),e inc hl ld (hl),d inc hl xor a call l_setmem - 9 ; clear next five bytes to zero (ref count, prefix, cost) ld (_astar_queueN),a ; nothing in queue ld (_astar_queueN + 1),a ld bc,-6 add hl,bc ex de,hl .loop ; de = current path to investigate, & struct astar_Path ex de,hl .resumefail push hl ld e,(hl) inc hl ld d,(hl) ; stack = & current astar_Path ; de = last node in current path ld hl,(_astar_destNode) ; compare last node with dest node ld a,l cp e jp nz, pathnotfound ld a,h cp d jp z, foundpath ; if equal, path found .pathnotfound ; stack = & current astar_path ; de = last node in current path ex de,hl ; test if last node in current path was closed push hl ; and close it if not ld ix,(_astar_TestAndClose) call l_jpix ; astar_TestAndClose(hl=node) pop hl jp c, closepath ; if was closed, shorter path already through here ; stack = & current astar_path ; hl = last node in current path push hl ; cost push hl ; node ld hl,0 add hl,sp push hl ld e,l ld d,h inc de inc de push de ld ix,(_astar_Successor) call l_jpix ; astar_Successor(hl=&node,de=&cost) pop hl pop hl jp c, closepath2 ; there are no successors! .successorlp ; stack = & astar_path, cost, successor node ld hl,7 ; sizeof(struct astar_path) push hl call _u_malloc pop de jp nc, abandon ; no more memory must give up ; stack = & astar_path, cost, successor node ; hl = & new struct astar_path pop de ; de = successor node ld (hl),e ; store successor node in new path inc hl ld (hl),d inc hl ld (hl),0 ; reference count set to 0 inc hl pop de ; de = cost pop bc ; bc = & current astar_path ld (hl),c ; store current path into prefix of new one inc hl ld (hl),b inc hl ; hl = & new struct astar_path.cost ; bc = & current astar_path ; de = cost push hl ld hl,5 add hl,bc ld a,(hl) inc hl ld h,(hl) ld l,a ; stack = & new struct astar_path.cost ; bc = & current astar_path ; hl = cost of current path ; de = cost add hl,de jp nc, noadj ld hl,$ffff ; if overflow cap cost at max .noadj ex de,hl pop hl ld (hl),e ; write total cost into new path struct inc hl ld (hl),d ; bc = & current astar_path ; hl = & new astar_path + 6b push bc ld de,-6 add hl,de ; stack = & current astar_path ; hl = & new astar_path ld de,(_astar_queueN) ; de = # paths in queue now ld bc,(_astar_queueSize) ; bc = max # allowed ld a,e cp c jp nz, notatmax ld a,d cp b jr z, abandon2 ; if there's no room in the queue, must abandon search .notatmax inc de ld (_astar_queueN),de ; stack = & current astar_path ; hl = & new astar_path ; de = # items in queue after this one added ex de,hl ld bc,(_astar_queue) ld ix,costcompare call ADTHeapAdd ; add new path to priority queue pop hl push hl ; stack = & current astar_path ; hl = & current astar_path inc hl inc hl inc (hl) ; increase ref count of current path ; stack = & current astar_path ld hl,-1 push hl ; cost push hl ; node inc hl add hl,sp push hl ld e,l ld d,h inc de inc de push de ld ix,(_astar_Successor) call l_jpix ; astar_Successor(hl=&node,de=&cost) pop hl pop hl ; stack = & astar_path, cost, successor node jp nc, successorlp ; more successors to deal with ; stack = & astar_path, cost, successor node pop hl ; clear out the stack pop hl pop hl .getnextpath ld ix,costcompare ld de,(_astar_queue) ld hl,(_astar_queueN) call ADTHeapExtract jr nc, failed ; ran out of paths! ld e,l ld d,h ; de = & next astar_path to investigate jp loop .closepath2 ; stack = & astar_path, cost, successor node pop hl pop hl .closepath ; stack = & current astar_path pop hl call astar_DeletePath ; walk path, deleting nodes as necessary jp getnextpath .abandon2 ; stack = & current astar_path ; hl = & new astar_path push hl call _u_free pop hl pop hl ret ; ret with NC to indicate failure .abandon ; stack = & astar_path, cost, successor node pop hl pop hl pop hl ret ; ret with NC to indicate failure .failed ld hl,0 ; ret with NC to indicate failure ret .foundpath ; stack = & current astar_path pop hl scf ; carry set to indicate success ret .costcompare ; called by ADTHeapAdd ; de = &heap[child], hl=&heap[parent] ; return carry set if child < parent for min heap ; PRESERVE BC,DE,HL,IX push de push hl push bc ld bc,6 ld a,(hl) inc hl ld h,(hl) ld l,a add hl,bc ex de,hl ld a,(hl) inc hl ld h,(hl) ld l,a add hl,bc ; de = & parent astar_path.cost + 1b ; hl = & child astar_path.cost + 1b ld a,(de) ; compare costs cp (hl) jp c, exitcompare jp nz, exitcompare dec de dec hl ld a,(de) cp (hl) .exitcompare pop bc pop hl pop de ccf ; correct sense of carry flag for min heap ret DEFC ASMDISP_ASTAR_SEARCH_RESUME_SUCCESS = getnextpath - astar_Search DEFC ASMDISP_ASTAR_SEARCH_RESUME_FAIL = resumefail - astar_Search z88dk-1.8.ds1/libsrc/algorithm/AStarSearch/astar_SearchResume.asm0000644000175000017500000000100110550667106024370 0ustar tygrystygrys; struct astar_path __FASTCALL__ *astar_SearchResume(struct astar_path *p) ; resume a search previously stopped ; 01.2007 aralbrec XLIB astar_SearchResume LIB astar_Search XREF ASMDISP_ASTAR_SEARCH_RESUME_SUCCESS, ASMDISP_ASTAR_SEARCH_RESUME_FAIL ; enter : hl = path to start search with ; if 0, search not resumed from path but from queue .astar_SearchResume ld a,h or l jp z, astar_Search + ASMDISP_ASTAR_SEARCH_RESUME_SUCCESS jp astar_Search + ASMDISP_ASTAR_SEARCH_RESUME_FAIL z88dk-1.8.ds1/libsrc/algorithm/AStarSearch/astar_WalkPath.asm0000644000175000017500000000044010550667106023523 0ustar tygrystygrys; CALLER linkage for function pointers XLIB astar_WalkPath LIB astar_WalkPath_callee XREF ASMDISP_ASTAR_WALKPATH_CALLEE .astar_WalkPath pop af pop bc pop hl pop de push de push hl push bc push af jp astar_WalkPath_callee + ASMDISP_ASTAR_WALKPATH_CALLEE z88dk-1.8.ds1/libsrc/algorithm/AStarSearch/astar_WalkPath_callee.asm0000644000175000017500000000232410577177144025042 0ustar tygrystygrys ; uint *astar_WalkPath_callee(struct astar_path *p, uint *node_arr, uint n) ; write up to N nodes from the end of the path into the end of NODE_ARR, ret ptr in array to first node ; 01.2007 aralbrec XLIB astar_WalkPath_callee XDEF ASMDISP_ASTAR_WALKPATH_CALLEE .astar_WalkPath_callee pop af pop bc pop hl pop de push af ; enter : bc = uint n ; hl = uint [] ; de = astar_path * ; exit : hl = ptr into uint[] where first node in sequence written ; C flag set if entire path not written ; ; uses : af, bc, de, hl .asmentry ld a,d ; so many tests for zero, very annoying or e ret z ld a,b or c scf ret z add hl,bc add hl,bc ex de,hl .loop ld a,h or l jr z, done dec de inc hl ldd ld a,(hl) ld (de),a inc hl inc hl inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = & next struct astar_path jp pe, loop ex de,hl ld a,d ; wrote all nodes of path if next path = 0 or e ret z scf ret .done ex de,hl ret DEFC ASMDISP_ASTAR_WALKPATH_CALLEE = asmentry - astar_WalkPath_callee z88dk-1.8.ds1/libsrc/algorithm/Makefile0000644000175000017500000000052310630724403017407 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.2 2007/06/04 05:54:11 stefano Exp $ include ../Make.config default: $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/algorithm @alg.lst clean: $(RM) *.o* *.sym *.map *~ *.err zcc_opt.def *.i cd AStarSearch ; $(RM) *.o* *.sym *.map *~ *.err zcc_opt.def *.i ; cd .. z88dk-1.8.ds1/libsrc/aquansi.lst0000644000175000017500000000770210712620314016151 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/aquarius/fgetc_cons stdio/fgets_cons stdio/aquarius/getk stdio/puts_cons stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/aquarius/f_ansi_attr stdio/ansi/aquarius/f_ansi_bel stdio/ansi/aquarius/f_ansi_char stdio/ansi/aquarius/f_ansi_cls stdio/ansi/aquarius/f_ansi_dline stdio/ansi/aquarius/f_ansi_scrollup stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/aquarius/textpixl6 graphics/text6/plotpixl graphics/text6/respixl graphics/text6/xorpixl graphics/text6/div3 graphics/text6/clsgraph graphics/text6/swapgfxbk graphics/putsprite2 graphics/point graphics/text6/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorplot graphics/setxy games/aquarius/bit_open games/aquarius/bit_open_di games/aquarius/bit_close games/aquarius/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/beeper games/joystick printflike/ltoa_any z88dk-1.8.ds1/libsrc/aquarius/0000755000175000017500000000000010765202715015621 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/aquarius.lst0000644000175000017500000000722710712620314016344 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/aquarius/fgetc_cons stdio/fgets_cons stdio/aquarius/getk stdio/puts_cons stdio/aquarius/fputc_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/aquarius/textpixl6 graphics/text6/plotpixl graphics/text6/respixl graphics/text6/xorpixl graphics/text6/div3 graphics/text6/clsgraph graphics/text6/swapgfxbk graphics/putsprite2 graphics/point graphics/text6/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy games/aquarius/bit_open games/aquarius/bit_open_di games/aquarius/bit_close games/aquarius/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/beeper games/joystick printflike/ltoa_any z88dk-1.8.ds1/libsrc/assert/0000755000175000017500000000000010765202715015270 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/assert/assert.c0000644000175000017500000000054507266774472016761 0ustar tygrystygrys/* * l_assert(int, char *, char *) * * djm 28/2/2000 * * Untested..but what could go wrong?!?! * * $Id: assert.c,v 1.2 2001/04/17 08:05:14 stefano Exp $ */ #include #include #include void l_assert(int line, char *file, char *expr) { fprintf(stderr,"Assertion failed: %s %d \"%s\"\n",file,line,expr); abort(); } z88dk-1.8.ds1/libsrc/assert/Makefile0000644000175000017500000000032110763607611016726 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../Make.config all: assert.o .c.o: zcc +test $(CFLAGS) $*.c clean: $(RM) *.o* *.sym *.map *~ *.err zcc_opt.def $(RM) assert.asm *.i z88dk-1.8.ds1/libsrc/balloc/0000755000175000017500000000000010765202715015223 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/balloc/ba_AddMem.asm0000644000175000017500000000041410552633257017520 0ustar tygrystygrys; CALLER linkage for function pointers XLIB ba_AddMem LIB BAAddMem .ba_AddMem ld hl,8 add hl,sp ld c,(hl) dec hl dec hl ld b,(hl) dec hl ld d,(hl) dec hl ld e,(hl) dec hl ld a,(hl) dec hl ld l,(hl) ld h,a jp BAAddMem z88dk-1.8.ds1/libsrc/balloc/ba_AddMem_callee.asm0000644000175000017500000000042210552633257021024 0ustar tygrystygrys; void __CALLEE__ *ba_AddMem_callee(uchar q, uchar numblocks, uint size, void *addr) ; 05.2005 aralbrec XLIB ba_AddMem_callee LIB BAAddMem .ba_AddMem_callee pop af pop hl pop de pop bc ex (sp),hl ld b,c ld c,l pop hl push af jp BAAddMem z88dk-1.8.ds1/libsrc/balloc/ba_BestFit.asm0000644000175000017500000000026410552633257017734 0ustar tygrystygrys; CALLER linkage for function pointers XLIB ba_BestFit LIB BABestFit .ba_BestFit ld hl,2 add hl,sp ld b,(hl) inc hl inc hl ld l,(hl) ld h,0 jp BABestFit z88dk-1.8.ds1/libsrc/balloc/ba_BestFit_callee.asm0000644000175000017500000000032210577177144021241 0ustar tygrystygrys; void __CALLEE__ *ba_BestFit_callee(uchar q, uchar numq) ; 04.2004 aralbrec XLIB ba_BestFit_callee LIB BABestFit .ba_BestFit_callee pop hl pop bc ld b,c ex (sp),hl ld h,0 jp BABestFit z88dk-1.8.ds1/libsrc/balloc/ba_BlockCount.asm0000644000175000017500000000017010302466463020427 0ustar tygrystygrys; 05.2005 aralbrec XLIB ba_BlockCount LIB BABlockCount .ba_BlockCount call BABlockCount ld l,c ld h,b ret z88dk-1.8.ds1/libsrc/balloc/ba_Free.asm0000644000175000017500000000107210302466463017247 0ustar tygrystygrys; 04.2004 aralbrec XLIB ba_Free XREF _ba_qtbl ; Frees block of memory back to queues for reuse. ; ; enter: HL = address of block as returned by ba_malloc or ba_bestfit ; uses : AF,BC,DE,HL .ba_Free ld a,h or l ret z dec hl ld e,(hl) ; E = queue number inc hl ex de,hl ; DE = block address ld h,0 ; HL = queue number add hl,hl ld bc,_ba_qtbl add hl,bc ; HL = index into queue table ld c,(hl) inc hl ld b,(hl) ld (hl),d dec hl ld (hl),e ex de,hl ld (hl),c inc hl ld (hl),b ret z88dk-1.8.ds1/libsrc/balloc/ba_Init.asm0000644000175000017500000000040110302466463017264 0ustar tygrystygrys; 04.2004 aralbrec XLIB ba_Init XREF _ba_qtbl ; Clears all memory queues to empty. ; ; enter: HL = number of queues ; uses : F,BC,DE,HL .ba_Init add hl,hl ld c,l ld b,h ld hl,_ba_qtbl ld de,_ba_qtbl+1 ld (hl),0 dec bc ldir ret z88dk-1.8.ds1/libsrc/balloc/ba_Malloc.asm0000644000175000017500000000063610302466463017602 0ustar tygrystygrys; 04.2004 aralbrec XLIB ba_Malloc XREF _ba_qtbl ; Returns block of memory from the indicated queue. ; ; enter: HL = queue number ; exit : HL = address of memory block (0 = fail) ; Carry = success ; uses : AF,BC,DE,HL .ba_Malloc add hl,hl ld de,_ba_qtbl add hl,de ld e,(hl) inc hl ld d,(hl) ex de,hl ld a,h or l ret z inc hl ldd ld a,(hl) ld (de),a scf ret z88dk-1.8.ds1/libsrc/balloc/BAAddMem.asm0000644000175000017500000000116110415666717017266 0ustar tygrystygrys; 04.2004 aralbrec XLIB BAAddMem LIB ba_Free ; Adds memory blocks to a queue ; ; enter: B = number of blocks (>=1) ; C = queue number ; HL = address of free memory to create blocks from ; DE = block size in bytes (>=2) ; exit : HL = address of next free byte of memory ; uses : AF,B,HL .BAAddMem inc de ; make space in free blocks for queue identifier .loop ld (hl),c ; store identifier into free block push bc push de push hl inc hl call ba_Free ; freeing block adds it to queue pop hl pop de pop bc add hl,de djnz loop ret z88dk-1.8.ds1/libsrc/balloc/BABestFit.asm0000644000175000017500000000157010302466463017472 0ustar tygrystygrys; 04.2004 aralbrec XLIB BABestFit XREF _ba_qtbl ; If the queues are arranged such that queue i contains memory blocks ; that are smaller than in queue j, with i * * $Id: amax.c,v 1.1 2003/08/30 16:42:48 dom Exp $ */ #include #include float amax(float x,float y) { if ( x > y ) return x; return y; } z88dk-1.8.ds1/libsrc/cpcmath/amin.c0000644000175000017500000000037307724152010016472 0ustar tygrystygrys/* * CPC Maths Routines * * August 2003 **_|warp6|_** * * $Id: amin.c,v 1.1 2003/08/30 16:42:48 dom Exp $ */ #include #include float amin(float x,float y) { if ( x < y ) return x; return y; } z88dk-1.8.ds1/libsrc/cpcmath/atan.asm0000644000175000017500000000050410650475166017037 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: atan.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB atan XDEF atanc LIB get_para .atan call get_para call firmware .atanc defw CPCFP_FLO_ATAN ret z88dk-1.8.ds1/libsrc/cpcmath/atan2.c0000644000175000017500000000057607744601434016573 0ustar tygrystygrys#include #include #include extern double __LIB__ halfpi(); /* arc tangent of y/x */ double atan2(y,x) double x, y ; { double a; if (fabs(x) >= fabs(y)) { a = atan(y/x) ; if (x < 0.0) { if (y >= 0.0) a += pi() ; else a -= pi() ; } } else { a = -atan(x/y) ; if (y < 0.0) a -= halfpi() ; else a += halfpi() ; } return a ; } z88dk-1.8.ds1/libsrc/cpcmath/atof.c0000644000175000017500000000370407724166445016521 0ustar tygrystygrys/* * Atof (generic routine) * * Don't recompile cos we get a label clash! */ #include #include #include #include /* decimal to (double) binary conversion */ double atof(s) unsigned char s[]; /* s points to a character string */ { double sum, /* the partial result */ scale; /* scale factor for the next digit */ double ten; unsigned char *start, /* copy if input pointer */ *end, /* points to end of number */ c; /* character from input line */ int minus, /* nonzero if number is negative */ dot, /* nonzero if *s is decimal point */ decimal; /* nonzero if decimal point found */ ten = 10.; if ( *s == '-' ) { minus = 1 ; ++s ; } else minus = 0 ; start = s ; decimal = 0 ; /* no decimal point seen yet */ while( (dot=(*s=='.')) || isdigit(*s) ) { if ( dot ) ++decimal ; ++s ; /* scan to end of string */ } end = s ; sum = 0. ; /* initialize answer */ if ( decimal ) { /* handle digits to right of decimal */ --s ; while ( *s != '.' ) sum = ( sum + ((double)( *(s--) - '0' )) ) / 10. ; } scale = 1. ; /* initialize scale factor */ while ( --s >= start ) { /* handle remaining digits */ sum += scale * ((double)( *s-'0' )) ; scale *= 10. ; } c = *end++ ; if( tolower(c)=='e' ) { /* interpret exponent */ int neg ; /* nonzero if exp negative */ int expon ; /* absolute value of exp */ int k ; /* mask */ neg = expon = 0 ; if ( *end == '-' ) { /* negative exponent */ neg = 1 ; ++end ; } while(1) { /* read an integer */ if ( (c=*end++) >= '0' ) { if ( c <= '9' ) { expon = expon * 10 + c - '0' ; continue ; } } break; } if ( expon > 38 ) { #if 0 puts("overflow") ; #endif expon = 0 ; } k = 32 ; /* set one bit in mask */ scale = 1. ; while(k) { scale *= scale; if ( k & expon ) scale *= ten ; k >>= 1 ; } if(neg) sum /= scale; else sum *= scale; } if (minus) sum = -sum ; return sum ; } z88dk-1.8.ds1/libsrc/cpcmath/ceil.c0000644000175000017500000000034707724152010016463 0ustar tygrystygrys/* * CPC Maths Routines * * August 2003 **_|warp6|_** * * $Id: ceil.c,v 1.1 2003/08/30 16:42:48 dom Exp $ */ #include #include float ceil(float x) { return (float)((int)x); } z88dk-1.8.ds1/libsrc/cpcmath/cmpfin.asm0000644000175000017500000000034207724152010017354 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: cmpfin.asm,v 1.1 2003/08/30 16:42:48 dom Exp $ ; INCLUDE "#cpcfp.def" XLIB cmpfin LIB stkequcmp .cmpfin ld a,1 jp stkequcmp z88dk-1.8.ds1/libsrc/cpcmath/cos.asm0000644000175000017500000000050410650475166016700 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: cos.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB cos XDEF cosc LIB get_para .cos call get_para call firmware .cosc defw CPCFP_FLO_COS ret z88dk-1.8.ds1/libsrc/cpcmath/cosh.c0000644000175000017500000000021007724166120016477 0ustar tygrystygrys#include #include #include "float.h" double cosh(x) double x; { double e; e = exp(x) ; return 0.5*(e+1.0/e) ; } z88dk-1.8.ds1/libsrc/cpcmath/cpclist0000644000175000017500000000041507724167154017002 0ustar tygrystygrysatan cmpfin cos dadd ddiv deg deq dge dgt dleq dlt dmul dne dsub exp float floor fprand fsetup get_para ifix init_floatpack int_inv_sgn log10 log minusfa pi pow10 pow rad sin sqrt stkequ stkequcmp tan amax amin ceil fabs fmod ftoa ftoe cosh sinh tanh atan2 atof halfpi z88dk-1.8.ds1/libsrc/cpcmath/dadd.asm0000644000175000017500000000061010650475166017006 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: dadd.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB dadd XDEF daddc LIB fsetup LIB stkequ XREF fa .dadd ; (fa+1)=(fa+1)+(sp+3) call fsetup call firmware .daddc defw CPCFP_FLO_ADD ; (hl)=(hl)+(de) jp stkequ z88dk-1.8.ds1/libsrc/cpcmath/ddiv.asm0000644000175000017500000000060410650475166017043 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: ddiv.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB ddiv XDEF ddivc LIB fsetup LIB stkequ XREF fa .ddiv ; (fa+1)=(fa+1)*(sp+3) call fsetup call firmware .ddivc defw CPCFP_FLO_DIV ; (hl)=(hl)/(de) jp stkequ z88dk-1.8.ds1/libsrc/cpcmath/deg.asm0000644000175000017500000000044310650475166016655 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: deg.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB deg XDEF degc .deg ld a,1 call firmware .degc defw CPCFP_FLO_DEG_RAD ret z88dk-1.8.ds1/libsrc/cpcmath/deq.asm0000644000175000017500000000064510650475166016673 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: deq.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB deq XDEF deqc LIB fsetup LIB stkequcmp LIB cmpfin .deq call fsetup call firmware .deqc defw CPCFP_FLO_CMP ; comp (hl)?(de) cp 0 ;(hl) != (de) jp z,cmpfin xor a jp stkequcmp z88dk-1.8.ds1/libsrc/cpcmath/dge.asm0000644000175000017500000000070410650475166016655 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: dge.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB dge XDEF dgec LIB fsetup LIB stkequcmp LIB cmpfin .dge call fsetup call firmware .dgec defw CPCFP_FLO_CMP ; comp (hl)?(de) cp 0 ;(hl) <= (de) jp z,cmpfin cp 1 jp z,cmpfin xor a jp stkequcmp z88dk-1.8.ds1/libsrc/cpcmath/dgt.asm0000644000175000017500000000064510650475166016700 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: dgt.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB dgt XDEF dgtc LIB fsetup LIB stkequcmp LIB cmpfin .dgt call fsetup call firmware .dgtc defw CPCFP_FLO_CMP ; comp (hl)?(de) cp $1 ;(hl) > (de) jp z,cmpfin xor a jp stkequcmp z88dk-1.8.ds1/libsrc/cpcmath/dleq.asm0000644000175000017500000000071410650475166017044 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: dleq.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB dleq XDEF dleqc LIB fsetup LIB stkequcmp LIB cmpfin .dleq call fsetup call firmware .dleqc defw CPCFP_FLO_CMP ; comp (hl)?(de) cp 0 ;(hl) <= (de) jp z,cmpfin cp $255 jp z,cmpfin xor a jp stkequcmp z88dk-1.8.ds1/libsrc/cpcmath/dlt.asm0000644000175000017500000000064610650475166016706 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: dlt.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB dlt XDEF dltc LIB fsetup LIB stkequcmp LIB cmpfin .dlt call fsetup call firmware .dltc defw CPCFP_FLO_CMP ; comp (hl)?(de) cp $FF ;(hl) < (de) jp z,cmpfin xor a jp stkequcmp z88dk-1.8.ds1/libsrc/cpcmath/dmul.asm0000644000175000017500000000060710650475166017061 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: dmul.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB dmul XDEF dmulc LIB fsetup LIB stkequ XREF fa .dmul ; (fa+1)=(fa+1)*(sp+3) call fsetup call firmware .dmulc defw CPCFP_FLO_MUL ; (hl)=(hl)*(de) jp stkequ z88dk-1.8.ds1/libsrc/cpcmath/dne.asm0000644000175000017500000000064510650475166016670 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: dne.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB dne XDEF dnec LIB fsetup LIB stkequcmp LIB cmpfin .dne call fsetup call firmware .dnec defw CPCFP_FLO_CMP ; comp (hl)?(de) cp 0 ;(hl) != (de) jp z,stkequcmp xor a jp cmpfin z88dk-1.8.ds1/libsrc/cpcmath/dsub.asm0000644000175000017500000000107710650475166017057 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: dsub.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB dsub XDEF dsubc LIB stkequ XREF fa .dsub ; (fa+1)=(fa+1)-(sp+3) ld hl,3 add hl,sp ; hl=sp+3 ex de,hl ld hl,fa+1 ; de=fa+1 call firmware .dsubc defw CPCFP_FLO_REV_SUB ; (hl)=(de)-(hl) pop hl ;ret to program pop bc ;get rid of fp number pop bc pop bc jp (hl) ;outta here back to program z88dk-1.8.ds1/libsrc/cpcmath/exp.asm0000644000175000017500000000045510650475166016715 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: exp.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB exp XDEF expc LIB get_para .exp call get_para call firmware .expc defw CPCFP_FLO_EXP ret z88dk-1.8.ds1/libsrc/cpcmath/fabs.c0000644000175000017500000000036207724152010016457 0ustar tygrystygrys/* * CPC Maths Routines * * August 2003 **_|warp6|_** * * $Id: fabs.c,v 1.1 2003/08/30 16:42:48 dom Exp $ */ #include #include float fabs(float x) { if ( x < 0. ) x = -x; return x; } z88dk-1.8.ds1/libsrc/cpcmath/float.asm0000644000175000017500000000072210650475166017223 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: float.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfp.def" INCLUDE "#cpcfirm.def" XLIB float LIB int_inv_sgn XDEF floatc XREF fa .float ld a,h push af bit 7,h call nz,int_inv_sgn ; hl=-hl si nz pop af ld de,fa+1 call firmware .floatc defw CPCFP_INT_2_FLO ; (fa+1)<-hl et signe=bit 7,a ret z88dk-1.8.ds1/libsrc/cpcmath/floor.asm0000644000175000017500000000062210650475166017236 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: floor.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB floor XDEF floorc XDEF floorc2 LIB get_para .floor call get_para call firmware .floorc defw CPCFP_FLO_BINFIX ld a,b call firmware .floorc2 defw CPCFP_BIN_2_FLO ret z88dk-1.8.ds1/libsrc/cpcmath/fmod.c0000644000175000017500000000036007724152010016467 0ustar tygrystygrys/* * CPC Maths Routines * * August 2003 **_|warp6|_** * * $Id: fmod.c,v 1.1 2003/08/30 16:42:48 dom Exp $ */ #include #include float fmod(float x,float y) { return x - floor(x/y)*y; } z88dk-1.8.ds1/libsrc/cpcmath/fprand.asm0000644000175000017500000000050610650475166017370 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: fprand.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB fprand XDEF fprandc XREF fa .fprand ld hl,fa+1 call firmware .fprandc defw CPCFP_FLO_RND ret z88dk-1.8.ds1/libsrc/cpcmath/fsetup.asm0000644000175000017500000000044510650475166017426 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: fsetup.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfp.def" XLIB fsetup XREF fa .fsetup ld hl,fa+1 ; de=fa+1 ex de,hl ld hl,5 add hl,sp ; hl=sp+5 ret z88dk-1.8.ds1/libsrc/cpcmath/ftoa.c0000644000175000017500000000072607730363772016521 0ustar tygrystygrys/* Convert a floating point number into a buffer */ #include #include #include #include void ftoa(double number, int prec, char *str) { float fix_number,realpart_number; /* Weird things happen above a precision of 4... */ if ( prec > 4 ) { prec = 4; } fix_number=floor(number); realpart_number=(number-fix_number)*pow10(prec); sprintf(str,"%d.%d",(int)fix_number,abs(realpart_number)); } z88dk-1.8.ds1/libsrc/cpcmath/ftoe.c0000644000175000017500000000021707724152010016500 0ustar tygrystygrys/* Dummy scientific format converter */ #include void ftoe(double number, int prec, char *str) { ftoa(number,prec,str); } z88dk-1.8.ds1/libsrc/cpcmath/get_para.asm0000644000175000017500000000047610650475166017706 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: get_para.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfp.def" XLIB get_para XREF fa .get_para ld hl,4 add hl,sp ld de,fa ;(fa) <- (hl) ld bc,6 ldir ld hl,fa+1 ret z88dk-1.8.ds1/libsrc/cpcmath/halfpi.c0000644000175000017500000000023507724167154017025 0ustar tygrystygrys/* Horrendous hack to get halfpi out */ #include #include extern double __LIB__ halfpi(); double halfpi() { return ( pi() / 2. ); } z88dk-1.8.ds1/libsrc/cpcmath/ifix.asm0000644000175000017500000000053010650475166017052 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: ifix.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB ifix XDEF ifixc XREF fa LIB int_inv_sgn .ifix ld hl,fa+1 call firmware .ifixc defw CPCFP_FLO_2_INT call m,int_inv_sgn ret z88dk-1.8.ds1/libsrc/cpcmath/init_floatpack.asm0000644000175000017500000001506610650475166021114 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: init_floatpack.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfp.def" XLIB init_floatpack ; All the library routines that we have to change LIB atan LIB cos LIB dadd LIB ddiv LIB deg LIB deq LIB dge LIB dgt LIB dleq LIB dlt LIB dmul LIB dne LIB dsub LIB exp LIB float LIB floor LIB fprand LIB ifix LIB log10 LIB log LIB minusfa LIB pi LIB pow10 LIB pow LIB rad LIB sin LIB sqrt LIB tan ; The actual place where we have to change things XREF atanc XREF cosc XREF daddc XREF ddivc XREF degc XREF deqc XREF dgec XREF dgtc XREF dleqc XREF dltc XREF dmulc XREF dnec XREF dsubc XREF expc XREF floatc XREF floorc XREF floorc2 XREF fprandc XREF ifixc XREF log10c XREF logc XREF minusfac XREF pic XREF pow10c XREF powc XREF radc XREF sinc XREF skelc XREF sqrtc XREF tanc ; Now, a hack around z80asm - we have to reference the .lib labels to get ; them into scope. Ideally we'd go (libroutine+offset), but the offset may ; change at some point and this is arguable the simplest way to do it ; ; We save space by only using defb - this overflow, but no harm done there defb atan defb cos defb dadd defb ddiv defb deg defb deq defb dge defb dgt defb dleq defb dlt defb dmul defb dne defb dsub defb exp defb float defb floor defb fprand defb ifix defb log10 defb log defb minusfa defb pi defb pow10 defb pow defb rad defb sin defb sqrt defb tan .init_floatpack ld hl,$BD65 ld a,(hl) cp 158 jp z,init_cpc464float cp 200 jp z,init_cpc664float ret .init_cpc464float ld hl,CPCFP464_FLO_ATAN ld (atanc),hl ld hl,CPCFP464_FLO_COS ld (cosc),hl ld hl,CPCFP464_FLO_ADD ld (daddc),hl ld hl,CPCFP464_FLO_DIV ld (ddivc),hl ld hl,CPCFP464_FLO_DEG_RAD ld (degc),hl ld (radc),hl ld hl,CPCFP464_FLO_CMP ld (deqc),hl ld (dgec),hl ld (dgtc),hl ld (dleqc),hl ld (dltc),hl ld (dnec),hl ld hl,CPCFP464_FLO_MUL ld (dmulc),hl ld hl,CPCFP464_FLO_REV_SUB ld (dsubc),hl ld hl,CPCFP464_FLO_EXP ld (expc),hl ld hl,CPCFP464_INT_2_FLO ld (floatc),hl ld hl,CPCFP464_FLO_BINFIX ld (floorc),hl ld hl,CPCFP464_BIN_2_FLO ld (floorc2),hl ld hl,CPCFP464_FLO_RND ld (fprandc),hl ld hl,CPCFP464_FLO_2_INT ld (ifixc),hl ld hl,CPCFP464_FLO_LOG10 ld (log10c),hl ld hl,CPCFP464_FLO_LOG ld (logc),hl ld hl,CPCFP464_FLO_INV_SGN ld (minusfac),hl ld hl,CPCFP464_FLO_PI ld (pic),hl ld hl,CPCFP464_FLO_POW10 ld (pow10c),hl ld hl,CPCFP464_FLO_POW ld (powc),hl ld hl,CPCFP464_FLO_SIN ld (sinc),hl ld hl,CPCFP464_FLO_SQRT ld (sqrtc),hl ld hl,CPCFP464_FLO_TAN ld (tanc),hl ret .init_cpc664float ld hl,CPCFP664_FLO_ATAN ld (atanc),hl ld hl,CPCFP664_FLO_COS ld (cosc),hl ld hl,CPCFP664_FLO_ADD ld (daddc),hl ld hl,CPCFP664_FLO_DIV ld (ddivc),hl ld hl,CPCFP664_FLO_DEG_RAD ld (degc),hl ld (radc),hl ld hl,CPCFP664_FLO_CMP ld (deqc),hl ld (dgec),hl ld (dgtc),hl ld (dleqc),hl ld (dltc),hl ld (dnec),hl ld hl,CPCFP664_FLO_MUL ld (dmulc),hl ld hl,CPCFP664_FLO_REV_SUB ld (dsubc),hl ld hl,CPCFP664_FLO_EXP ld (expc),hl ld hl,CPCFP664_INT_2_FLO ld (floatc),hl ld hl,CPCFP664_FLO_BINFIX ld (floorc),hl ld hl,CPCFP664_BIN_2_FLO ld (floorc2),hl ld hl,CPCFP664_FLO_RND ld (fprandc),hl ld hl,CPCFP664_FLO_2_INT ld (ifixc),hl ld hl,CPCFP664_FLO_LOG10 ld (log10c),hl ld hl,CPCFP664_FLO_LOG ld (logc),hl ld hl,CPCFP664_FLO_INV_SGN ld (minusfac),hl ld hl,CPCFP664_FLO_PI ld (pic),hl ld hl,CPCFP664_FLO_POW10 ld (pow10c),hl ld hl,CPCFP664_FLO_POW ld (powc),hl ld hl,CPCFP664_FLO_SIN ld (sinc),hl ld hl,CPCFP664_FLO_SQRT ld (sqrtc),hl ld hl,CPCFP664_FLO_TAN ld (tanc),hl ret z88dk-1.8.ds1/libsrc/cpcmath/init_floatpack2.asm0000644000175000017500000000036307724152010021154 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: init_floatpack2.asm,v 1.1 2003/08/30 16:42:48 dom Exp $ ; ; Dummy initialisation for machine tailored libraries XLIB init_floatpack .init_floatpack ret z88dk-1.8.ds1/libsrc/cpcmath/int_inv_sgn.asm0000644000175000017500000000051310650475166020431 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: int_inv_sgn.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfp.def" XLIB int_inv_sgn .int_inv_sgn xor a sub l ld l,a sbc a,h sub l cp h ld h,a scf ret nz cp 1 ret z88dk-1.8.ds1/libsrc/cpcmath/log.asm0000644000175000017500000000045510650475166016702 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: log.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB log XDEF logc LIB get_para .log call get_para call firmware .logc defw CPCFP_FLO_LOG ret z88dk-1.8.ds1/libsrc/cpcmath/log10.asm0000644000175000017500000000047110650475166017041 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: log10.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB log10 XDEF log10c LIB get_para .log10 call get_para call firmware .log10c defw CPCFP_FLO_LOG10 ret z88dk-1.8.ds1/libsrc/cpcmath/Makefile0000644000175000017500000000173610763607615017063 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../Make.config CFILES = \ amax.c \ amin.c \ ceil.c \ fabs.c \ fmod.c \ ftoa.c \ ftoe.c \ cosh.c \ sinh.c \ tanh.c \ atan2.c \ atof.c \ halfpi.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: l464_math l664_math l6128_math lcpc_math objs: $(OBJECTS) l464_math: 464_math l664_math: 664_math l6128_math: 6128_math lcpc_math: cpc_math cpc_math: $(MAKE) clean $(MAKE) objs $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/cpc_math @cpclist 464_math: $(MAKE) clean $(MAKE) objs $(LIBLINKER) -DforCPC464 -x../$(OUTPUT_DIRECTORY)/464_math @468list 664_math: $(MAKE) clean $(MAKE) objs $(LIBLINKER) -DforCPC664 -x../$(OUTPUT_DIRECTORY)/664_math @468list 6128_math: $(MAKE) clean $(MAKE) objs $(LIBLINKER) -DforCPC6128 -x../$(OUTPUT_DIRECTORY)/6128_math @468list .c.o: zcc +cpc $(CFLAGS) -D__CPC__ -D__NATIVE_MATH__ $*.c clean: $(RM) *.o* *.sym *.map *.err zcc_opt.def *.i $(AFILES) z88dk-1.8.ds1/libsrc/cpcmath/minusfa.asm0000644000175000017500000000054310650475166017561 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: minusfa.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB minusfa XDEF minusfac XREF fa .minusfa ld hl,fa+1 call firmware .minusfac defw CPCFP_FLO_INV_SGN ;(hl)=-(hl) ret z88dk-1.8.ds1/libsrc/cpcmath/pi.asm0000644000175000017500000000044610650475166016531 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: pi.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB pi XDEF pic XREF fa .pi ld hl,fa+1 call firmware .pic defw CPCFP_FLO_PI ret z88dk-1.8.ds1/libsrc/cpcmath/pow.asm0000644000175000017500000000066110650475166016725 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: pow.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB pow XDEF powc XREF fa .pow ld hl,8 add hl,sp ld de,fa ; (fa)<-(hl) ld bc,6 ldir ld hl,3 add hl,sp ex de,hl ld hl,fa+1 call firmware .powc defw CPCFP_FLO_POW ret z88dk-1.8.ds1/libsrc/cpcmath/pow10.asm0000644000175000017500000000062110650475166017062 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: pow10.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB pow10 XDEF pow10c LIB float XREF fa .pow10 ld hl,1 call float ld hl,2 add hl,sp ld a,(hl) ld hl,fa+1 call firmware .pow10c defw CPCFP_FLO_POW10 ret z88dk-1.8.ds1/libsrc/cpcmath/rad.asm0000644000175000017500000000045210650475166016664 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: rad.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB rad XDEF radc XREF fa .rad xor a call firmware .radc defw CPCFP_FLO_DEG_RAD ret z88dk-1.8.ds1/libsrc/cpcmath/sin.asm0000644000175000017500000000045510650475166016712 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: sin.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB sin XDEF sinc LIB get_para .sin call get_para call firmware .sinc defw CPCFP_FLO_SIN ret z88dk-1.8.ds1/libsrc/cpcmath/sinh.c0000644000175000017500000000021007724166121016505 0ustar tygrystygrys#include #include #include "float.h" double sinh(x) double x; { double e; e = exp(x) ; return 0.5*(e-1.0/e) ; } z88dk-1.8.ds1/libsrc/cpcmath/sqrt.asm0000644000175000017500000000046310650475166017111 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: sqrt.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB sqrt XDEF sqrtc LIB get_para .sqrt call get_para call firmware .sqrtc defw CPCFP_FLO_SQRT ret z88dk-1.8.ds1/libsrc/cpcmath/stkequ.asm0000644000175000017500000000071210650475166017431 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: stkequ.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfp.def" XLIB stkequ XREF fa .stkequ ld de,fa+1 ; (fa+1)<-(sp+3) ld hl,3 add hl,sp ld bc,5 ldir pop hl ;ret to program pop bc ;get rid of fp number pop bc pop bc jp (hl) ;outa here back to program z88dk-1.8.ds1/libsrc/cpcmath/stkequcmp.asm0000644000175000017500000000063310650475166020133 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: stkequcmp.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfp.def" XLIB stkequcmp .stkequcmp pop de ;return address pop bc ;dump number.. pop bc pop bc push de ;put it back ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/cpcmath/tan.asm0000644000175000017500000000045510650475166016703 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: tan.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; INCLUDE "#cpcfirm.def" INCLUDE "#cpcfp.def" XLIB tan XDEF tanc LIB get_para .tan call get_para call firmware .tanc defw CPCFP_FLO_TAN ret z88dk-1.8.ds1/libsrc/cpcmath/tanh.c0000644000175000017500000000021307724166121016501 0ustar tygrystygrys#include #include #include "float.h" double tanh(double x) { double e; e = exp(x) ; return (e-1.0/e)/(e+1.0/e) ; } z88dk-1.8.ds1/libsrc/cpm/0000755000175000017500000000000010765202715014546 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/cpm.lst0000644000175000017500000000046410763607577015313 0ustar tygrystygrysstdio/cpm/fgetc_cons stdio/cpm/getk stdio/cpm/fputc_cons fcntl/cpm/bdos fcntl/cpm/close fcntl/cpm/creat fcntl/cpm/getfcb fcntl/cpm/open fcntl/cpm/open_z88 fcntl/cpm/parsefcb fcntl/cpm/_putoffset fcntl/cpm/read fcntl/cpm/readbyte fcntl/cpm/remove fcntl/cpm/setfcb fcntl/cpm/write fcntl/cpm/writebyte @z80.lst z88dk-1.8.ds1/libsrc/ctype/0000755000175000017500000000000010765202715015113 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/ctype/isalnum.asm0000644000175000017500000000100110546027532017254 0ustar tygrystygrys; ; Small C+ z88 Character functions ; Written by Dominic Morris ; ; 1/3/99 djm ; ; This routine is a little bit unwieldy to say the least ; ; $Id: isalnum.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB isalnum ; FASTCALL .isalnum ld a,l ld hl,0 ; check digits [09] cp '0' ret c inc l cp '9'+1 ret c ; now check chars [azAZ] dec l cp 'A' ret c cp 'z'+1 ret nc and 223 cp 'A' ret c cp 'Z'+1 ret nc inc l ret z88dk-1.8.ds1/libsrc/ctype/isalpha.asm0000644000175000017500000000053310546027532017236 0ustar tygrystygrys; ; Small C z88 Character functions ; Written by Dominic Morris ; 22 August 1998 ; ; 17/2/99 djm ; ; $Id: isalpha.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB isalpha ; FASTCALL .isalpha ld a,l ld hl,0 cp 'A' ret c cp 'z'+1 ret nc and 223 cp 'A' ret c cp 'Z'+1 ret nc inc l ret z88dk-1.8.ds1/libsrc/ctype/isascii.asm0000644000175000017500000000035610546027532017244 0ustar tygrystygrys; ; Small C+ Library ; ; ctype/isascii(char c) ; ; djm 1/3/99 ; ; $Id: isascii.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB isascii ; FASTCALL .isascii ld a,l ld hl,0 cp 128 ret nc inc l ret z88dk-1.8.ds1/libsrc/ctype/iscntrl.asm0000644000175000017500000000046710546027532017301 0ustar tygrystygrys; ; Small C z88 Character functions ; Written by Dominic Morris ; ; 1/3/99 djm ; ; Stylish, this returned the wrong way! (djm 17/5/99) ; ; $Id: iscntrl.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB iscntrl ; FASTCALL .iscntrl ld a,l ld hl,0 cp 32 ret nc inc l ret z88dk-1.8.ds1/libsrc/ctype/isdigit.asm0000644000175000017500000000047710546027532017260 0ustar tygrystygrys; ; Small C z88 Character functions ; Written by Dominic Morris ; 22 August 1998 ; ; 17/2/99 djm rewritten to be shorter ; ; $Id: isdigit.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB isdigit ; FASTCALL .isdigit ld a,l ld hl,0 cp '0' ret c cp '9'+1 ret nc inc l ret z88dk-1.8.ds1/libsrc/ctype/isgraph.asm0000644000175000017500000000014510546027532017251 0ustar tygrystygrys XLIB isgraph LIB isprint .isgraph ld a,l ld hl,0 cp 32 ret z inc l jp isprint+4 z88dk-1.8.ds1/libsrc/ctype/islower.asm0000644000175000017500000000052610546027532017303 0ustar tygrystygrys; ; Small C z88 Character functions ; Written by Dominic Morris ; 22 August 1998 ; ; 17/2/99 djm Rewritten to remove the jp and thus be shorter ; ; $Id: islower.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB islower ; FASTCALL .islower ld a,l ld hl,0 cp 'a' ret c cp 'z'+1 ret nc inc l ret z88dk-1.8.ds1/libsrc/ctype/isprint.asm0000644000175000017500000000071210546027532017304 0ustar tygrystygrys; ; Small C+ Library ; ; ctype/isprint(char c) ; ; djm 23/12/99 ; ; Okay, printable for the z88 is: ; 7,10,13,32-126,163? ; ; $Id: isprint.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB isprint ; FASTCALL .isprint ld a,l ld hl,1 cp 7 ; entry point for isgraph() ret z cp 10 ret z cp 13 ret z cp 163 ; UK pound ret z dec l cp 32 ret c cp 127 ret nc inc l ret z88dk-1.8.ds1/libsrc/ctype/ispunct.asm0000644000175000017500000000101210546027566017302 0ustar tygrystygrys; ; Small C z88 Character functions ; Written by Dominic Morris ; ; 1/3/99 djm ; ; Hurrah, this is our first table for our isxxx routines! ; ; $Id: ispunct.asm,v 1.3 2006/12/31 21:45:26 aralbrec Exp $ ; XLIB ispunct ; FASTCALL .ispunct ld a,l ld hl,punctbl ld bc,punctend - punctbl cpir ; use it or lose it! ld h,b ld l,c ret .punctbl defm "!$%^&*()_+={[]}#~'@;:/?.>,<\|" defb 34,163,163 ; quote and pound, must repeat last one .punctend z88dk-1.8.ds1/libsrc/ctype/isspace.asm0000644000175000017500000000063610546027532017250 0ustar tygrystygrys; ; Small C z88 Character functions ; Written by Dominic Morris ; 22 August 1998 ; ; $Id: isspace.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB isspace ; FASTCALL .isspace ld a,l ld hl,1 cp 32 ; space ret z cp 7 ; tab ret z cp 10 ; lf ret z cp 13 ; cr ret z dec l ret z88dk-1.8.ds1/libsrc/ctype/isupper.asm0000644000175000017500000000051210546027532017301 0ustar tygrystygrys; ; Small C z88 Character functions ; Written by Dominic Morris ; 22 August 1998 ; ; 17/2/99 djm - rewritten to remove jp - shorter ; ; $Id: isupper.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB isupper ; FASTCALL .isupper ld a,l ld hl,0 cp 'A' ret c cp 'Z'+1 ret nc inc l ret z88dk-1.8.ds1/libsrc/ctype/isxdigit.asm0000644000175000017500000000077210546027532017446 0ustar tygrystygrys; ; Small C+ z88 Character functions ; Written by Dominic Morris ; ; 1/3/99 djm ; ; This routine is a little bit unwieldy to say the least ; ; $Id: isxdigit.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB isxdigit ; FASTCALL .isxdigit ld a,l ld hl,0 ; match digit [09] cp '0' ret c inc l cp '9'+1 ret c ; match [afAF] dec l cp 'A' ret c cp 'f'+1 ret nc and 223 cp 'A' ret c cp 'F'+1 ret nc inc l ret z88dk-1.8.ds1/libsrc/ctype/Makefile0000644000175000017500000000025307555321665016564 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.2 2002/10/22 19:15:01 dom Exp $ all: @echo '' clean: $(RM) *.o* *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/ctype/README0000644000175000017500000000005607130401722015763 0ustar tygrystygrysALL ROUTINES IN HERE ARE MACHINE INDEPENDENT z88dk-1.8.ds1/libsrc/ctype/toascii.asm0000644000175000017500000000034710546027532017253 0ustar tygrystygrys; ; Small C+ Library ; ; ctype/toascii(char c) ; returns c&127 ; ; djm 1/3/99 ; ; $Id: toascii.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB toascii ; FASTCALL .toascii res 7,l ld h,0 ret z88dk-1.8.ds1/libsrc/ctype/tolower.asm0000644000175000017500000000043010546027532017304 0ustar tygrystygrys; ; Small C z88 Character functions ; Written by Dominic Morris ; 22 August 1998 ; ; $Id: tolower.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB tolower ; FASTCALL .tolower ld a,l ld h,0 cp 'A' ret c cp 'Z'+1 ret nc set 5,l ret z88dk-1.8.ds1/libsrc/ctype/toupper.asm0000644000175000017500000000043010546027532017307 0ustar tygrystygrys; ; Small C z88 Character functions ; Written by Dominic Morris ; 22 August 1998 ; ; $Id: toupper.asm,v 1.3 2006/12/31 21:44:58 aralbrec Exp $ ; XLIB toupper ; FASTCALL .toupper ld a,l ld h,0 cp 'a' ret c cp 'z'+1 ret nc res 5,l ret z88dk-1.8.ds1/libsrc/debug/0000755000175000017500000000000010765202715015055 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/debug/debug.lst0000644000175000017500000000001407477356271016677 0ustar tygrystygrysdump disz80z88dk-1.8.ds1/libsrc/debug/disz80.asm0000644000175000017500000003115207477356271016717 0ustar tygrystygrys XLIB disz80 LIB fputc_cons ; This code is been found in a ZX Spectrum tool called UTILITY3 v1.3 .disz80 pop hl pop bc pop de push de push bc push hl ld a,d and e cp 255 jr nz,dizloop ld hl,0 add hl,sp ld e,(hl) inc hl ld d,(hl) .dizloop push bc call DISASM pop bc ld a,13 call CHROP dec bc ld a,b or c jr nz,dizloop ld h,d ld l,e ret ; ==================== ; DIS-Z80 was published in the SUBSET column of Personal Computer World 1987. ; The routine disassembles a single Z80 instruction at address DE. ; It is required to be followed by a routine called CHROP that outputs a ; single ASCII character. ; It was originally developed for CP/M on an Amstrad CPC128. ; The original ORG was $0100. I have added $5000 to all addresses. ; The stated aim was to write a Z80 disassembly routine in as short a space ; as possible and, at just over 1K (1090 bytes), it is a rather incredible ; program. ; The SUBSET editor David Barrow was able to trim only one byte from John ; Kerr's compact code. I've forgotten where so there's a challenge. ; ==================== .DISASM CALL ADRSP LD BC,$0900 LD HL,$2020 .BUFFER PUSH HL DJNZ BUFFER LD H,B LD L,C ADD HL,SP PUSH BC EX (SP),IX PUSH BC PUSH BC ADD IX,SP PUSH HL LD HL,GROUP3 .TRYNDX CALL FETCH LD B,C CP $ED JR Z,CONFLG INC B CP $DD JR Z,CONFLG INC B CP $FD JR NZ,NOTNDX .CONFLG LD (IX+1),B INC B DJNZ TRYNDX JR NXBYTE .NOTNDX LD C,A LD A,(IX+1) OR A JR Z,NODISP LD A,C CP $CB JR Z,GETDIS AND $44 CP 4 JR Z,GETDIS LD A,C AND $C0 CP $40 JR NZ,NODISP .GETDIS CALL FETCH LD (IX+2),A .NODISP LD HL,GROUP1 LD A,C CP $CB JR NZ,NEWMSK LD HL,GROUP2 .NXBYTE CALL FETCH LD C,A .NEWMSK LD A,(HL) OR A JR Z,TABEND AND C INC HL .NEWMOD LD B,(HL) INC HL INC B JR Z,NEWMSK .TRYMAT CP (HL) INC HL JR Z,GETNDX BIT 7,(HL) INC HL JR Z,TRYMAT JR NEWMOD .GETNDX LD A,(HL) AND $7F DEC B .TABEND POP HL PUSH DE PUSH HL EX DE,HL LD HL,MONICS CALL XTRACT POP HL LD DE,5 ADD HL,DE POP DE LD A,B AND $F0 JR Z,SECOND RRA RRA RRA RRA PUSH BC LD B,A LD A,C CALL OPRND1 POP BC LD A,B AND $0F JR Z,OPDONE LD (HL),44 ;, INC HL .SECOND LD A,B AND $0F LD B,A LD A,C CALL NZ,OPRND2 .OPDONE LD A,3 SUB (IX+0) POP HL POP HL POP IX JR C,OUTEXT INC A LD B,A ADD A,B ADD A,B LD B,A .SPACES LD A,$20 CALL CHROP DJNZ SPACES .OUTEXT LD B,18 .PUTOUT DEC SP POP HL LD A,H CALL CHROP DJNZ PUTOUT RET ;*********************** .GROUP2 defb $C0,$36,$40 defb $04,$80,$2D,$C0,$BE defb $FF,$F8,$06,$00,$33 defb $08,$38,$10,$35,$18 defb $3A,$20,$3F,$28,$40 defb $30,$00,$38,$C1 .GROUP1 defb $FF,$00,$00 defb $24,$07,$32,$0F,$37 defb $17,$31,$1F,$36,$27 defb $0D,$2F,$0B,$37,$3D defb $3F,$06,$76,$14,$C9 defb $30,$D9,$12,$F3,$0F defb $FB,$91,$72,$C6,$02 defb $CE,$01,$DE,$BC,$02 defb $D6,$42,$E6,$03,$EE defb $43,$F6,$25,$FE,$8C defb $04,$08,$93,$01,$10 defb $10,$18,$9D,$AF,$22 defb $A2,$FA,$2A,$A2,$A7 defb $32,$A2,$7A,$3A,$A2 defb $03,$C3,$1C,$CD,$85 defb $97,$D3,$AA,$79,$DB defb $9B,$5F,$E3,$93,$0E defb $E9,$9C,$05,$EB,$93 defb $DF,$F9,$A2,$FF,$C0 defb $B6,$40,$A2,$FF,$F8 defb $76,$80,$02,$88,$01 defb $98,$BC,$06,$90,$42 defb $A0,$03,$A8,$43,$B0 defb $25,$B8,$8C,$FF,$C7 defb $0B,$04,$16,$05,$8E defb $B2,$06,$A2,$20,$C0 defb $B0,$23,$C2,$1C,$C4 defb $85,$10,$C7,$BB,$FF defb $CF,$D3,$01,$A2,$0D defb $03,$16,$0B,$8E,$FD defb $09,$82,$60,$C1,$2B defb $C5,$AC,$FF,$E7,$21 defb $20,$9D,$FF,$EF,$E7 defb $02,$A2,$7E,$0A,$A2 .GROUP3 defb $FF,$00,$44 defb $23,$45,$2F,$4D,$2E defb $4E,$00,$67,$39,$6F defb $34,$70,$00,$71,$00 defb $A0,$21,$A1,$0A,$A2 defb $1A,$A3,$29,$A8,$1F defb $A9,$08,$AA,$18,$AB defb $28,$B0,$20,$B1,$09 defb $B2,$19,$B3,$27,$B8 defb $1E,$B9,$07,$BA,$17 defb $BB,$A6,$FF,$C7,$B8 defb $40,$9B,$8B,$41,$AA defb $FF,$CF,$FD,$42,$3C defb $4A,$81,$AD,$43,$A2 defb $DA,$4B,$A2,$FF,$E7 defb $40,$46,$95,$FF,$F7 defb $C7,$47,$A2,$7C,$57 defb $A2,$FF,$00 ;_______________ .MONICS defb $BF defb 'A','D','C'+$80 ; ADC defb 'A','D','D'+$80 ; ADD defb 'A','N','D'+$80 ; AND defb 'B','I','T'+$80 ; BIT defb 'C','A','L','L'+$80 ; CALL defb 'C','C','F'+$80 ; CCF defb 'C','P','D','R'+$80 ; CPDR defb 'C','P','D'+$80 ; CPD defb 'C','P','I','R'+$80 ; CPIR defb 'C','P','I'+$80 ; CPI defb 'C','P','L'+$80 ; CPL defb 'C','P'+$80 ; CP defb 'D','A','A'+$80 ; DAA defb 'D','E','C'+$80 ; DEC defb 'D','I'+$80 ; DI defb 'D','J','N','Z'+$80 ; DJNZ defb 'E','I'+$80 ; EI defb 'E','X','X'+$80 ; EXX defb 'E','X'+$80 ; EX defb 'H','A','L','T'+$80 ; HALT defb 'I','M'+$80 ; IM defb 'I','N','C'+$80 ; INC defb 'I','N','D','R'+$80 ; INDR defb 'I','N','D'+$80 ; IND defb 'I','N','I','R'+$80 ; INIR defb 'I','N','I'+$80 ; INI defb 'I','N'+$80 ; IN defb 'J','P'+$80 ; JP defb 'J','R'+$80 ; JR defb 'L','D','D','R'+$80 ; LDDR defb 'L','D','D'+$80 ; LDD defb 'L','D','I','R'+$80 ; LDIR defb 'L','D','I'+$80 ; LDI defb 'L','D'+$80 ; LD defb 'N','E','G'+$80 ; NEG defb 'N','O','P'+$80 ; NOP defb 'O','R'+$80 ; OR defb 'O','T','D','R'+$80 ; OTDR defb 'O','T','I','R'+$80 ; OTIR defb 'O','U','T','D'+$80 ; OUTD defb 'O','U','T','I'+$80 ; OUTI defb 'O','U','T'+$80 ; OUT defb 'P','O','P'+$80 ; POP defb 'P','U','S','H'+$80 ; PUSH defb 'R','E','S'+$80 ; RES defb 'R','E','T','I'+$80 ; RETI defb 'R','E','T','N'+$80 ; RETN defb 'R','E','T'+$80 ; RET defb 'R','L','A'+$80 ; RLA defb 'R','L','C','A'+$80 ; RLCA defb 'R','L','C'+$80 ; RLC defb 'R','L','D'+$80 ; RLD defb 'R','L'+$80 ; RL defb 'R','R','A'+$80 ; RRA defb 'R','R','C','A'+$80 ; RA defb 'R','R','C'+$80 ; RRC defb 'R','R','D'+$80 ; RRD defb 'R','R'+$80 ; RR defb 'R','S','T'+$80 ; RST defb 'S','B','C'+$80 ; SBC defb 'S','C','F'+$80 ; SCF defb 'S','E','T'+$80 ; SET defb 'S','L','A'+$80 ; SLA defb 'S','R','A'+$80 ; SRA defb 'S','R','L'+$80 ; SRL defb 'S','U','B'+$80 ; SUB defb 'X','O','R'+$80 ; XOR ;***************** .OPRND1 DJNZ CONDIT .RSTADR AND $38 JR DA .OPRND2 DJNZ DAT8 .RELADR CALL FETCH LD C,A RLA SBC A,A LD B,A EX DE,HL PUSH HL ADD HL,BC JR DHL .CONDIT RRA RRA RRA DJNZ BITNUM BIT 4,A JR NZ,ABS AND 3 .ABS AND 7 ADD A,$14 JR PS1 .DAT8 DJNZ DAT16 .D8 CALL FETCH JR DA .BITNUM DJNZ INTMOD AND 7 .DA LD C,A SUB A JR DAC .DAT16 DJNZ EXAF .D16 CALL FETCH LD C,A CALL FETCH .DAC EX DE,HL PUSH HL LD H,A LD L,C .DHL LD C,$F8 PUSH HL CALL CONVHL POP HL LD BC,$000A OR A SBC HL,BC POP HL EX DE,HL RET C LD (HL),'H' INC HL RET .INTMOD DJNZ STKTOP AND 3 ADD A,$1C .PS1 JR PS3 .STKTOP LD C,$13 DEC B JR Z,PS2 .REG16P DJNZ COMMON RRA AND 3 CP 3 JR NZ,RX DEC A JR RNX .EXAF LD C,$0A DEC B JR Z,PS2 .EXDE INC C DEC B JR Z,PS2 .REG8S DJNZ ACCUM .R8 AND 7 CP 6 JR NZ,PS3 LD (HL),'(' INC HL CALL REGX LD A,(IX+2) OR A JR Z,RP LD (HL),43 ;+ RLCA RRCA JR NC,POS LD (HL),45 ;- NEG .POS INC HL EX DE,HL PUSH HL LD H,B LD L,A LD C,$FB CALL CONVHL POP HL EX DE,HL JR RP .ACCUM RRA RRA RRA .COMMON LD C,7 DEC B JR Z,PS2 .PORTC DEC C DJNZ IDAT8 .PS2 LD A,C .PS3 JR PS4 .IDAT8 DJNZ IDAT16 LD (HL),'(' INC HL CALL D8 JR RP .IDAT16 DJNZ REG8 LD (HL),'(' INC HL CALL D16 JR RP .REG8 DEC B JR Z,R8 .IPAREF DJNZ REG16 AND 9 JR PS4 .REG16 RRA DJNZ IREG16 .R16 AND 3 .RX CP 2 JR Z,REGX .RNX ADD A,$0C JR PS4 .IREG16 DJNZ REGX LD (HL),'(' INC HL CALL R16 .RP LD (HL),')' INC HL RET .REGX LD A,(IX+1) ADD A,$10 .PS4 EX DE,HL PUSH HL LD HL,RGSTRS CALL XTRACT POP HL EX DE,HL RET ;************* .RGSTRS defb 'B' +$80 defb 'C' +$80 defb 'D' +$80 defb 'E' +$80 defb 'H' +$80 defb 'L' +$80 defb '(','C',')' +$80 defb 'A' +$80 defb 'I' +$80 defb 'R' +$80 defb 'A','F',',','A','F',''' +$80 defb 'D','E',',','H','L' +$80 defb 'B','C' +$80 defb 'D','E' +$80 defb 'A','F' +$80 defb 'S','P' +$80 defb 'H','L' +$80 defb 'I','X' +$80 defb 'I','Y' +$80 defb '(','S','P',')' +$80 defb 'N','Z' +$80 defb 'Z' +$80 defb 'N','C' +$80 defb 'C' +$80 defb 'P','O' +$80 defb 'P','E' +$80 defb 'P' +$80 defb 'M' +$80 defb '0' +$80 defb '?' +$80 defb '1' +$80 defb '2' +$80 ;******************** .CONVHL SUB A .CVHL1 PUSH AF SUB A LD B,16 .CVHL2 ADD A,C JR C,CVHL3 SUB C .CVHL3 ADC HL,HL RLA DJNZ CVHL2 JR NZ,CVHL1 CP 10 INC B JR NC,CVHL1 .CVHL4 CP 10 SBC A,$69 DAA LD (DE),A INC DE POP AF JR NZ,CVHL4 RET ;**************** .XTRACT OR A JR Z,COPY .SKIP BIT 7,(HL) INC HL JR Z,SKIP DEC A JR NZ,SKIP .COPY LD A,(HL) RLCA SRL A LD (DE),A INC DE INC HL JR NC,COPY RET ;******************* .FETCH LD A,(DE) INC DE INC (IX+0) PUSH AF CALL BYTSP POP AF RET .ADRSP LD A,D CALL BYTOP LD A,E .BYTSP CALL BYTOP LD A,$20 JR CHROP .BYTOP PUSH AF RRA RRA RRA RRA CALL HEXOP POP AF .HEXOP AND $0F CP 10 SBC A,$69 DAA ; ----------------------------------- ; ; End of John Kerr's DIS-Z80 routine. ; ; The next routine outputs a character. ; ; ------------------------------------- .CHROP PUSH HL PUSH DE PUSH BC ld h,0 ld l,a push hl ; parameter passing call fputc_cons ; This calls the Z88DK "put char" function pop hl POP BC POP DE POP HL RET z88dk-1.8.ds1/libsrc/debug/dump.c0000644000175000017500000000304007501075757016173 0ustar tygrystygrys/* * Memory Dump functions * * Stefano 29/5/2002 * * $Id: dump.c,v 1.2 2002/06/10 10:14:07 stefano Exp $ */ #include #include void hexbyte (unsigned char mybyte); void hexword (unsigned int myword); unsigned int dump(unsigned int address, unsigned int count) { int x; // unsigned int didn't work ... if (address == 0xFFFF) { #asm pop hl pop bc pop de push de push bc push hl ld hl,8 add hl,sp push hl .sdloop push de push hl push hl call _hexword pop hl ld hl,':' push hl call fputc_cons pop hl pop hl push hl ld c,(hl) inc hl ld b,(hl) push bc call _hexword pop bc ld hl,13 push hl call fputc_cons pop hl pop hl pop de inc hl inc hl dec de ld a,d or e jr nz,sdloop pop hl pop bc ret #endasm } if ((address % 8) != 0) { fputc_cons(13); hexword (address); } for (x=address; x>8)); hexbyte ((unsigned char) myword); fputc_cons(' '); } void hexbyte (unsigned char mybyte) { #asm pop hl pop de push de push hl ld a,e push de srl a srl a srl a srl a ld e,a ld hl,hextab add hl,de ld a,(hl) ld l,a ld h,0 push hl call fputc_cons pop hl pop de ld a,e and 15 ld e,a ld hl,hextab add hl,de ld a,(hl) ld l,a ld h,0 push hl call fputc_cons pop hl ret .hextab defm "0123456789ABCDEF" #endasm } z88dk-1.8.ds1/libsrc/debug/Makefile0000644000175000017500000000050510763607617016525 0ustar tygrystygrys# # $Id: Makefile,v 1.7 2008/03/05 20:35:46 dom Exp $ include ../Make.config CFILES = dump.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: $(OBJECTS) $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/debug @debug.lst .c.o: zcc +test $(CFLAGS) $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* *~ *.err *.i $(AFILES) z88dk-1.8.ds1/libsrc/embedded.lst0000644000175000017500000000004010763607577016253 0ustar tygrystygrysrex/input8 rex/output8 @z80.lst z88dk-1.8.ds1/libsrc/farz88/0000755000175000017500000000000010765202715015111 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/farz88/farseg1.asm0000644000175000017500000000173507267325734017163 0ustar tygrystygrys; Sample subroutine to bind a far address to segment 1 ; 23/3/0 GWL ; 1/4/00 Fixed local memory bug ; ; Entry: EBC=far pointer ; A'=binding of seg 1 for local memory ; Exit: EBC=far pointer (still!) ; A'=binding of seg 1 for local memory (still!) ; HL=local address (bound to seg 1) ; ; ; $Id: farseg1.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB farseg1 XREF malloc_table .farseg1 ld a,e and a jr z,localfar ; move on if we've got a local pointer ld hl,malloc_table dec e ld d,e ld e,b add hl,de add hl,de ; HL points to 2-byte entry ld e,d inc e ; restore EBC ld a,(hl) ; A=bank inc hl ld h,(hl) ; H=address high byte (in seg 1) ld l,c ; low byte is the same ld ($04d1),a out ($d1),a ; bind to segment 1 ret .localfar ex af,af' ld ($04d1),a out ($d1),a ; bind local memory to seg 1 ex af,af' ld h,b ld l,c ret z88dk-1.8.ds1/libsrc/farz88/farz88.lst0000644000175000017500000000050607224634361016762 0ustar tygrystygrysfarseg1 free_far freeall_far incfar lp_gchar lp_gdoub lp_gint lp_glong lp_gptr lp_pchar lp_pdoub lp_pint lp_plong lp_pptr malloc_far strings/strcat_far strings/strchr_far strings/strcpy_far strings/strlen_far strings/strlwr_far strings/strncat_far strings/strncpy_far strings/strrchr_far strings/strupr_far strings/strdup_far z88dk-1.8.ds1/libsrc/farz88/free_far.asm0000644000175000017500000000414607267325734017403 0ustar tygrystygrys; FREE function for far memory model ; 31/3/00 GWL ; ; $Id: free_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB free_far XDEF free_loop XREF malloc_table,pool_table include "#memory.def" ; void free(far *p); .free_far pop hl pop bc pop de ; EBC=far pointer push de push bc push hl ld a,c cp 2 ret nz ; low byte=2 always dec e ; because 0=local pointer ld c,b ld b,e ; BC=page number ld hl,malloc_table add hl,bc add hl,bc ; HL=address in malloc_table ld a,($04d1) ex af,af' ; save seg 1 binding ld a,(hl) inc hl ld d,(hl) dec hl ld ($04d1),a out ($d1),a ld e,0 ld a,(de) ld c,a inc de ld a,(de) ld b,a ; BC=#pages to deallocate ex af,af' ld ($04d1),a out ($d1),a ; rebind segment 1 .free_loop ld a,(hl) and a jr z,notallocated ld e,a ld d,0 ; DE=bank ld (hl),d inc hl ld ix,pool_table-32 add ix,de ld a,(ix+0) ; A=compressed pool handle add a,a rl d ; D was 0 previously add a,a rl d add a,a rl d add a,a rl d ld ixh,d ld ixl,a ; IX=pool handle ld a,e ; A=bank ld d,(hl) ld e,0 ; DE=address ld (hl),e inc hl push bc ld bc,256 ex de,hl call_oz(os_mfr) ex de,hl pop bc .notallocated dec bc ld a,b or c jr nz,free_loop ret z88dk-1.8.ds1/libsrc/farz88/freeall_far.asm0000644000175000017500000000155607267325734020076 0ustar tygrystygrys; FREEALL function for far memory model ; 31/3/00 GWL ; ; This function should be called as part of the tidyup ; code for applications or packages using far memory ; ; $Id: freeall_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB freeall_far XREF pool_table include "#memory.def" ; void freeall(void); .freeall_far ld hl,pool_table ld b,224 .freeloop ld a,(hl) ld (hl),0 inc hl and a call nz,freepool djnz freeloop ret ; Subroutine to free a pool, compressed handle in A .freepool ld d,0 add a,a rl d add a,a rl d add a,a rl d add a,a rl d ld ixh,d ld ixl,a call_oz(os_mcl) ret z88dk-1.8.ds1/libsrc/farz88/incfar.asm0000644000175000017500000000071407267325734017071 0ustar tygrystygrys; Internal routine to read increment local address HL with far pointer EBC ; 31/3/00 GWL ; Corrupts D via farseg1, but preserves A ; ; $Id: incfar.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB incfar LIB farseg1 .incfar inc hl inc c ret nz inc b jr nz,skiphigh inc e .skiphigh push af call farseg1 pop af ret z88dk-1.8.ds1/libsrc/farz88/lp_gchar.asm0000644000175000017500000000071607267325734017410 0ustar tygrystygrys; Internal routine to read char at far pointer ; 31/3/00 GWL ; Entry: EHL=far pointer ; Exit: A=byte ; ; $Id: lp_gchar.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB lp_gchar LIB farseg1 .lp_gchar ld a,($04d1) ex af,af' ld b,h ld c,l call farseg1 ld a,(hl) ld l,a ld h,0 ex af,af' ld ($04d1),a out ($d1),a ex af,af' ret z88dk-1.8.ds1/libsrc/farz88/lp_gdoub.asm0000644000175000017500000000162207267325734017421 0ustar tygrystygrys; Internal routine to read double at far pointer ; 31/3/00 GWL ; Entry: EHL=far pointer ; Exit: FA->FA+5=double ; ; $Id: lp_gdoub.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB lp_gdoub XREF fa LIB farseg1,incfar .lp_gdoub ld a,($04d1) ex af,af' ld b,h ld c,l call farseg1 ld a,(hl) ld ixl,a call incfar ld a,(hl) ld ixh,a call incfar ld a,(hl) ld iyl,a call incfar ld a,(hl) ld iyh,a call incfar ld a,(hl) call incfar ld h,(hl) ld l,a ; double now in HLIYIX ex af,af' ld ($04d1),a out ($d1),a ld (fa),iy ld (fa+2),ix ld (fa+4),hl ret z88dk-1.8.ds1/libsrc/farz88/lp_gint.asm0000644000175000017500000000077107267325734017266 0ustar tygrystygrys; Internal routine to read int at far pointer ; 31/3/00 GWL ; Entry: EHL=far pointer ; Exit: HL=word ; ; $Id: lp_gint.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB lp_gint LIB farseg1,incfar .lp_gint ld a,($04d1) ex af,af' ld b,h ld c,l call farseg1 ld a,(hl) call incfar ld h,(hl) ld l,a ex af,af' ld ($04d1),a out ($d1),a ret z88dk-1.8.ds1/libsrc/farz88/lp_glong.asm0000644000175000017500000000125507267325734017431 0ustar tygrystygrys; Internal routine to read long at far pointer ; 31/3/00 GWL ; Entry: EHL=far pointer ; Exit: DEHL=long ; ; $Id: lp_glong.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB lp_glong LIB farseg1,incfar .lp_glong ld a,($04d1) ex af,af' ld b,h ld c,l call farseg1 ld a,(hl) ld ixl,a call incfar ld a,(hl) ld ixh,a call incfar ld a,(hl) call incfar ld d,(hl) ld e,a push ix pop hl ex af,af' ld ($04d1),a out ($d1),a ret z88dk-1.8.ds1/libsrc/farz88/lp_gptr.asm0000644000175000017500000000121607267325734017274 0ustar tygrystygrys; Internal routine to read pointer at far pointer ; 31/3/00 GWL ; Entry: EHL=far pointer ; Exit: EHL=pointer stored there... ; ; $Id: lp_gptr.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB lp_gptr LIB farseg1,incfar .lp_gptr ld a,($04d1) ex af,af' ld b,h ld c,l call farseg1 ld a,(hl) ld ixl,a call incfar ld a,(hl) ld ixh,a call incfar ld e,(hl) ld d,0 ;padding push ix pop hl ex af,af' ld ($04d1),a out ($d1),a ret z88dk-1.8.ds1/libsrc/farz88/lp_pchar.asm0000644000175000017500000000075107267325734017420 0ustar tygrystygrys; Internal routine to write char at far pointer ; 31/3/00 GWL ; Entry: E'H'L'=far pointer ; L=byte ; ; $Id: lp_pchar.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB lp_pchar LIB farseg1 .lp_pchar ld a,($04d1) ex af,af' exx ld b,h ld c,l call farseg1 exx ld a,l exx ld (hl),a ex af,af' ld ($04d1),a out ($d1),a ret z88dk-1.8.ds1/libsrc/farz88/lp_pdoub.asm0000644000175000017500000000170507267325734017434 0ustar tygrystygrys; Internal routine to write double at far pointer ; 31/3/00 GWL ; Entry: E'H'L'=far pointer ; FA->FA+5=double ; ; $Id: lp_pdoub.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB lp_pdoub XREF fa LIB farseg1,incfar .lp_pdoub ld a,($04d1) ex af,af' ld ix,(fa) ld iy,(fa+2) ld hl,(fa+4) push hl exx ld b,h ld c,l call farseg1 ld a,ixl ld (hl),a call incfar ld a,ixh ld (hl),a call incfar ld a,iyl ld (hl),a call incfar ld a,iyh ld (hl),a call incfar pop ix ld a,ixl ld (hl),a call incfar ld a,ixh ld (hl),a ex af,af' ld ($04d1),a out ($d1),a ret z88dk-1.8.ds1/libsrc/farz88/lp_pint.asm0000644000175000017500000000111007267325734017263 0ustar tygrystygrys; Internal routine to write int at far pointer ; 31/3/00 GWL ; Entry: E'H'L'=far pointer ; HL=word ; ; $Id: lp_pint.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB lp_pint LIB farseg1,incfar .lp_pint ld a,($04d1) ex af,af' push hl pop ix exx ld b,h ld c,l call farseg1 ld a,ixl ld (hl),a call incfar ld a,ixh ld (hl),a ex af,af' ld ($04d1),a out ($d1),a ret z88dk-1.8.ds1/libsrc/farz88/lp_plong.asm0000644000175000017500000000137407267325734017444 0ustar tygrystygrys; Internal routine to write long at far pointer ; 31/3/00 GWL ; Entry: E'H'L'=far pointer ; DEHL=long ; ; $Id: lp_plong.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB lp_plong LIB farseg1,incfar .lp_plong ld a,($04d1) ex af,af' push hl pop ix push de pop iy exx ld b,h ld c,l call farseg1 ld a,ixl ld (hl),a call incfar ld a,ixh ld (hl),a call incfar ld a,iyl ld (hl),a call incfar ld a,iyh ld (hl),a ex af,af' ld ($04d1),a out ($d1),a ret z88dk-1.8.ds1/libsrc/farz88/lp_pptr.asm0000644000175000017500000000130207267325734017301 0ustar tygrystygrys; Internal routine to write pointer at far pointer ; 31/3/00 GWL ; Entry: E'H'L'=far pointer ; EHL=pointer to write there ; ; $Id: lp_pptr.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB lp_pptr LIB farseg1,incfar .lp_pptr ld a,($04d1) ex af,af' push hl pop ix push de pop iy exx ld b,h ld c,l call farseg1 ld a,ixl ld (hl),a call incfar ld a,ixh ld (hl),a call incfar ld a,iyl ld (hl),a ex af,af' ld ($04d1),a out ($d1),a ret z88dk-1.8.ds1/libsrc/farz88/Makefile0000644000175000017500000000040710630724403016544 0ustar tygrystygrys# # Makefile for far malloc # # $Id: Makefile,v 1.10 2007/06/04 05:54:11 stefano Exp $ include ../Make.config all: cd strings ; $(MAKE) ; cd .. $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/farz88 @farz88.lst clean: $(RM) *.o *~ cd strings ; $(MAKE) clean ; cd .. z88dk-1.8.ds1/libsrc/farz88/malloc_far.asm0000644000175000017500000001341407267325734017727 0ustar tygrystygrys; MALLOC function for far memory model ; 29/3/00 GWL ; 30/3/00 Changed size type to long, so >64K mallocs possible ; ; $Id: malloc_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB malloc_far XREF malloc_table,pool_table,farpages,farmemspec XREF free_loop include "#memory.def" ; far *malloc(long size) .malloc_far pop de pop bc pop hl push hl ; HLBC=required size (bytes) push bc push de ld a,l and $80 or h jp nz,badmalloc ; trying to malloc 8Mb+.... ld a,c ld c,b ld b,l ; BC=pages required, ignoring low byte inc bc inc a jr nz,mall2 inc bc ; BC=total pages required (with 2byte ovhead) ; Stage 1 is to locate a free fragment in the malloc table large enough ; to hold the amount of memory we require .mall2 ld hl,malloc_table ; search start ld ix,0 ; and size found ld de,(farpages) ; pages to search push ix ; save best match so far push hl .malsearch ld a,d or e jr z,endsearch ; end of malloc_table reached dec de ld a,(hl) inc hl inc hl and a jr nz,malsearch ; back until found a free page push hl ; save start of this fragment+2 ld ix,0 .malfragment inc ix ld a,d or e jr z,endfragment ; end of malloc_table reached dec de ld a,(hl) inc hl inc hl and a jr z,malfragment ; back until end of fragment .endfragment push ix ex (sp),hl and a sbc hl,bc ; is fragment big enough? jr nc,goodmatch pop hl pop af ; discard fragment start jr malsearch .goodmatch add hl,bc ex (sp),hl exx pop hl ; HL'=fragment size pop ix ; IX=fragment start+2 dec ix dec ix ; IX=real fragment start pop de ; DE'=start of best so far pop bc ; BC'=size of best so far ld a,b or c jr z,usenew ; use new fragment if no previous one sbc hl,bc jr nc,useold ; use old if <=size of new one add hl,bc ; restore HL=fragment size .usenew push hl push ix exx jr malsearch .useold push bc push de exx jr malsearch .endsearch pop hl ; HL=start of best fragment found pop de ; DE=size ld a,d or e jr z,badmalloc ; no suitable fragment found ; Stage 2 is to fill the fragment with memory ; We start with HL=address in malloc_table & BC=pages required push hl ; save parameters push bc ld d,31 ; pretend bank 31 is available .nextpool call findpool ; IX=pool to allocate from, D=bank jr c,partmalloc .nextpage push bc ; save pages to do push hl ; save malloc_table address .badpage xor a ld bc,256 call_oz(os_mal) ; get a page jr nc,gotpage pop hl ; restore malloc_table address pop bc jr nextpool .gotpage ld a,l and a jr nz,badpage ; EEK! OZ returned non-page-aligned mem... ld a,b cp d jr nz,badpage ; EEK! Not from the expected bank... ld a,h pop hl ld (hl),d ; store bank inc hl ld (hl),a ; and high byte inc hl pop bc dec bc ld a,b or c jr nz,nextpage pop bc ; pages allocated pop hl ; HL=address in malloc_table ld a,($04d1) ex af,af' ; save seg1 binding ld a,(hl) inc hl ld d,(hl) dec hl ld ($04d1),a out ($d1),a ; bind in start of allocated memory ld e,0 ; DE=address in segment 1 ld a,c ld (de),a inc de ld a,b ld (de),a ; store #pages allocated in first two bytes ex af,af' ld ($04d1),a out ($d1),a ; rebind seg 1 ld de,malloc_table and a sbc hl,de srl h rr l ; HL=pool page number ld e,h inc e ; because E=0 reserved for local memory ld h,l ld l,2 ; EHL=far pointer (skipping #pages) ret ; success! ; At this point we need to free up what we've allocated so far and ; then return a NULL pointer .partmalloc pop bc pop hl call free_loop ; free pages already allocated ; Here we return a NULL pointer because we're unable to malloc what's ; required .badmalloc ld e,0 ld hl,0 ret ; Subroutine to find a new pool to allocate from. ; IN: D=previous bank ; OUT(success): Fc=0 ; D=new bank ; IX=pool handle ; OUT(failure): Fc=1 ; ; Registers changed after return: ; ..BC.EHL/..IY same ; AF..D.../IX.. different .findpool push bc push hl ld hl,pool_table-32 ld c,d ld b,0 add hl,bc .fpool2 inc hl inc d jr z,openpool ; open new pool if end of bank list ld a,(hl) and a jr z,fpool2 ; back if pool not open yet add a,a rl b ; (B was 0 from code above) add a,a rl b add a,a rl b add a,a rl b ld ixh,b ld ixl,a ; IX=pool handle and a ; Fc=0, success! .nopool pop hl pop bc ret .openpool ld a,(farmemspec) ld bc,0 call_oz(os_mop) jr c,nopool xor a ld bc,256 call_oz(os_mal) ld a,b push af ; save A=bank number ld bc,256 call_oz(os_mfr) pop af ld hl,pool_table-32 ld c,a ld b,0 add hl,bc ld a,ixl ld b,ixh srl b rra srl b rra srl b rra srl b rra ld (hl),a ; save compressed pool handle ld d,c ; D=bank pop hl pop bc and a ; success! ret z88dk-1.8.ds1/libsrc/farz88/strings/0000755000175000017500000000000010765202715016602 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/farz88/strings/Makefile0000644000175000017500000000041510763607620020244 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.7 2008/03/05 20:35:46 dom Exp $ include ../../Make.config all: strdup_far.o .c.o: zcc +z88 $(CFLAGS) $*.c clean: $(RM) *.o* *.sym *.map *~ *.err zcc_opt.def $(RM) strdup_far.asm *.i z88dk-1.8.ds1/libsrc/farz88/strings/strcat_far.asm0000644000175000017500000000236107267325734021450 0ustar tygrystygrys; strcat function for use with far pointers ; 31/3/00 GWL ; ; $Id: strcat_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; LIB farseg1,incfar XLIB strcat_far ;far *strcat(far *s1,far *s2) ; concatenates s2 onto the end of s1 .strcat_far ld ix,2 add ix,sp ld c,(ix+0) ld b,(ix+1) ld e,(ix+2) ; E'B'C'=s2 exx ld c,(ix+4) ld b,(ix+5) ld e,(ix+6) ; EBC=s1 ld a,($04d1) ex af,af' ; save seg 1 binding call farseg1 ; start with s1 jr startfind .findend call incfar .startfind ld a,(hl) ; char from s1 and a jr nz,findend exx ; switch to s2 .catloop call farseg1 ld a,(hl) ; char from s2 ld iyl,a call incfar exx call farseg1 ld a,iyl ld (hl),a ; place in s1 call incfar exx and a jr nz,catloop ex af,af' ld ($04d1),a out ($d1),a ; rebind segment 1 ld l,(ix+4) ld h,(ix+5) ld e,(ix+6) ; EHL=s1 ret z88dk-1.8.ds1/libsrc/farz88/strings/strchr_far.asm0000644000175000017500000000144707267325734021461 0ustar tygrystygrys; strchr function for use with far pointers ; 31/3/00 GWL ; ; $Id: strchr_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; LIB farseg1,incfar XLIB strchr_far ;far *strchr(far *s,int c) ; finds pointer to first occurrence of c in s (or NULL if not found) .strchr_far pop hl pop iy ; IYl=char pop bc pop de ; EBC=far pointer push de push bc push iy push hl ld a,($04d1) ex af,af' ; save seg 1 binding call farseg1 ; bind to segment 1, with address in HL .strchr1 ld a,(hl) cp iyl jr z,strchrend ; finished if found character call incfar and a jr nz,strchr1 ld e,a ld b,a ld c,a ; EBC=NULL, character not found .strchrend ld h,b ld l,c ; EHL=pointer to character, or NULL ex af,af' ld ($04d1),a out ($d1),a ; rebind segment 1 ret z88dk-1.8.ds1/libsrc/farz88/strings/strcpy_far.asm0000644000175000017500000000176007267325734021476 0ustar tygrystygrys; strcpy function for use with far pointers ; 31/3/00 GWL ; ; $Id: strcpy_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; LIB farseg1,incfar XLIB strcpy_far ;far *strcpy(far *s1,far *s2) ; copies s2 to s1 .strcpy_far ld ix,2 add ix,sp ld c,(ix+4) ld b,(ix+5) ld e,(ix+6) ; E'B'C'=s1 exx ld c,(ix+0) ld b,(ix+1) ld e,(ix+2) ; EBC=s2 ld a,($04d1) ex af,af' ; save seg 1 binding .strcpy1 call farseg1 ld a,(hl) ; char from s2 ld iyl,a call incfar exx call farseg1 ld a,iyl ld (hl),a ; place at s1 call incfar exx and a jr nz,strcpy1 ex af,af' ld ($04d1),a out ($d1),a ; rebind segment 1 ld l,(ix+4) ld h,(ix+5) ld e,(ix+6) ; EHL=s1 ret z88dk-1.8.ds1/libsrc/farz88/strings/strdup_far.c0000644000175000017500000000066207267325734021135 0ustar tygrystygrys/* * z88dk Standard library * * char *strdup(s1) * Duplicate a string in memory * * This requires linking with a malloc library * * $Id: strdup_far.c,v 1.3 2001/04/18 14:59:40 stefano Exp $ */ #define FARDATA 1 #include #include far char *strdup_far(far char *orig) { far char *ptr; int len; len=strlen(orig); len++; ptr=malloc( len ); if (ptr) { strcpy(ptr,orig); } return (ptr); } z88dk-1.8.ds1/libsrc/farz88/strings/strlen_far.asm0000644000175000017500000000133507267325734021457 0ustar tygrystygrys; strlen function for use with far pointers ; 31/3/00 GWL ; ; $Id: strlen_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; LIB farseg1,incfar XLIB strlen_far ;int strlen(far *s) ; finds length of s .strlen_far pop hl pop bc pop de ; EBC=far pointer push de push bc push hl ld a,($04d1) ex af,af' ; save seg 1 binding ld ix,0 ; our counter call farseg1 ; bind to segment 1, with address in HL .strlen1 ld a,(hl) ; check for string end and a jr z,strlenend inc ix ; increment counter call incfar jr strlen1 .strlenend ex af,af' ld ($04d1),a out ($d1),a ; rebind segment 1 push ix pop hl ; HL=length ret z88dk-1.8.ds1/libsrc/farz88/strings/strlwr_far.asm0000644000175000017500000000140207267325734021500 0ustar tygrystygrys; strlwr function for use with far pointers ; 1/4/00 GWL ; ; $Id: strlwr_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; LIB farseg1,incfar XLIB strlwr_far ;far *strlwr(far *s) ; converts s to lowercase .strlwr_far pop hl pop bc pop de ; EBC=far pointer push de push bc push hl ld a,($04d1) ex af,af' ; save seg 1 binding call farseg1 ; bind to segment 1, with address in HL .strlwr1 ld a,(hl) and a jr z,strlwrend cp 'A' jr c,strlwr2 cp 'Z'+1 jr nc,strlwr2 or 32 ld (hl),a .strlwr2 call incfar jr strlwr1 .strlwrend ex af,af' ld ($04d1),a out ($d1),a ; rebind segment 1 pop hl pop bc pop de ; get EBC=pointer again push de push bc jp (hl) ; save 1 byte returning! z88dk-1.8.ds1/libsrc/farz88/strings/strncat_far.asm0000644000175000017500000000300007267325734021615 0ustar tygrystygrys; strncat function for use with far pointers ; 31/3/00 GWL ; ; $Id: strncat_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; LIB farseg1,incfar XLIB strncat_far ;far *strncat(far *s1,far *s2,int n) ; concatenates s2 onto the end of s1 (at most n chars) & null-terminates .strncat_far ld ix,2 add ix,sp ld c,(ix+2) ld b,(ix+3) ld e,(ix+4) ; E'B'C'=s2 exx ld c,(ix+6) ld b,(ix+7) ld e,(ix+8) ; EBC=s1 ld a,($04d1) ex af,af' ; save seg 1 binding ld l,(ix+0) ld h,(ix+1) push ix push hl pop ix ; IX=n call farseg1 ; start with s1 jr startfind .findend call incfar .startfind ld a,(hl) ; char from s1 and a jr nz,findend exx ; switch to s2 .catloop ld a,ixl or ixh jr z,strncat2 ; on if copied n chars already call farseg1 ld a,(hl) ; char from s2 ld iyl,a call incfar exx call farseg1 ld a,iyl ld (hl),a ; place in s1 call incfar exx dec ix and a jr nz,catloop jr strncat3 .strncat2 exx call farseg1 ld (hl),0 ; null-terminate s1 .strncat3 pop ix ex af,af' ld ($04d1),a out ($d1),a ; rebind segment 1 ld l,(ix+6) ld h,(ix+7) ld e,(ix+8) ; EHL=s1 ret z88dk-1.8.ds1/libsrc/farz88/strings/strncpy_far.asm0000644000175000017500000000261107267325734021650 0ustar tygrystygrys; strncpy function for use with far pointers ; 31/3/00 GWL ; ; $Id: strncpy_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; LIB farseg1,incfar XLIB strncpy_far ;far *strncpy(far *s1,far *s2,int n) ; copies s2 to s1 for exactly n chars, padding with nulls or truncating .strncpy_far ld ix,2 add ix,sp ld c,(ix+6) ld b,(ix+7) ld e,(ix+8) ; E'B'C'=s1 exx ld c,(ix+2) ld b,(ix+3) ld e,(ix+4) ; EBC=s2 ld a,($04d1) ex af,af' ; save seg 1 binding ld l,(ix+0) ld h,(ix+1) ; HL=n push ix push hl pop ix ; IX=n .strncpy1 ld a,ixl or ixh jr z,strncpy3 ; on if copied n chars call farseg1 ld a,(hl) ; char from s2 ld iyl,a call incfar exx call farseg1 ld a,iyl ld (hl),a ; place at s1 call incfar exx dec ix and a jr nz,strncpy1 ; Now we have reached the end of s2, so pad s1 with nulls (already bound in) exx .strncpy2 ld a,ixl or ixh jr z,strncpy3 ; on if copied n chars ld (hl),0 call incfar dec ix jr strncpy2 .strncpy3 pop ix ex af,af' ld ($04d1),a out ($d1),a ; rebind segment 1 ld l,(ix+6) ld h,(ix+7) ld e,(ix+8) ; EHL=s1 ret z88dk-1.8.ds1/libsrc/farz88/strings/strrchr_far.asm0000644000175000017500000000157407267325734021644 0ustar tygrystygrys; strrchr function for use with far pointers ; 31/3/00 GWL ; ; $Id: strrchr_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; LIB farseg1,incfar XLIB strrchr_far ;far *strrchr(far *s,int c) ; finds pointer to last occurrence of c in s (or NULL if not found) .strrchr_far ld e,0 ld h,e ld l,e exx ; E'H'L'=NULL pointer, if char not found pop hl pop iy ; IYl=char pop bc pop de ; EBC=far pointer push de push bc push iy push hl ld a,($04d1) ex af,af' ; save seg 1 binding call farseg1 ; bind to segment 1, with address in HL .strrchr1 ld a,(hl) cp iyl jr nz,strrchr2 ; on if not found character push bc push de exx pop de pop hl ; store position of occurrence (EHL) exx .strrchr2 call incfar and a jr nz,strrchr1 exx ; EHL=pointer to last, or NULL ex af,af' ld ($04d1),a out ($d1),a ; rebind segment 1 ret z88dk-1.8.ds1/libsrc/farz88/strings/strupr_far.asm0000644000175000017500000000140407267325734021504 0ustar tygrystygrys; strupr function for use with far pointers ; 1/4/00 GWL ; ; $Id: strupr_far.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; LIB farseg1,incfar XLIB strupr_far ;far *strupr(far *s) ; converts s to uppercase .strupr_far pop hl pop bc pop de ; EBC=far pointer push de push bc push hl ld a,($04d1) ex af,af' ; save seg 1 binding call farseg1 ; bind to segment 1, with address in HL .strupr1 ld a,(hl) and a jr z,struprend cp 'a' jr c,strupr2 cp 'z'+1 jr nc,strupr2 and 223 ld (hl),a .strupr2 call incfar jr strupr1 .struprend ex af,af' ld ($04d1),a out ($d1),a ; rebind segment 1 pop hl pop bc pop de ; get EBC=pointer again push de push bc jp (hl) ; save 1 byte returning! z88dk-1.8.ds1/libsrc/fcntl/0000755000175000017500000000000010765202715015075 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/cpc/0000755000175000017500000000000010765202715015642 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/cpc/close.c0000644000175000017500000000104207730372263017114 0ustar tygrystygrys/* * Part of the library for fcntlt * * int close(int fd) * * ----- * $Id: close.c,v 1.1 2003/09/12 16:30:43 dom Exp $ */ #include #include "cpcfcntl.h" /* Place cpcfile to avoid weird reference problems within z80asm */ cpc_fd cpcfile; int close(int fd) { if ( fd == 0 ) { /* Reading */ if ( cpc_closein() ) { cpcfile.in_used = 0; return 0; } } else if ( fd == 1 ) { /* Writing */ if ( cpc_closeout() ) { cpcfile.out_used = 0; return 0; } } return -1; /* Unknown file/couldn't close */ } z88dk-1.8.ds1/libsrc/fcntl/cpc/cpc_closein.asm0000644000175000017500000000043610650475166020635 0ustar tygrystygrys; ; CPC fcntl Library ; ; Donated by **_warp6_** ; ; $Id: cpc_closein.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ XLIB cpc_closein INCLUDE "#cpcfirm.def" .cpc_closein call firmware defw cas_in_close ld hl,1 ret c ld hl,-1 ret z88dk-1.8.ds1/libsrc/fcntl/cpc/cpc_closeout.asm0000644000175000017500000000044210650475166021033 0ustar tygrystygrys; ; CPC fcntl Library ; ; Donated by **_warp6_** ; ; $Id: cpc_closeout.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ XLIB cpc_closeout INCLUDE "#cpcfirm.def" .cpc_closeout call firmware defw cas_out_close ld hl,1 ret c ld hl,-1 ret z88dk-1.8.ds1/libsrc/fcntl/cpc/cpc_openin.c0000644000175000017500000000056110650475166020132 0ustar tygrystygrys/* * Part of the library for fcntlt * * Open a CPC file for reading * ----- * $Id: cpc_openin.c,v 1.2 2007/07/21 21:28:22 dom Exp $ */ #include "cpcfcntl.h" int cpc_openin(char *name, int len, char *buf) { #asm INCLUDE "#cpcfirm.def" LIB cpc_setup_open call cpc_setup_open call firmware defw cas_in_open ld hl,1 ret c ld hl,-1 #endasm } z88dk-1.8.ds1/libsrc/fcntl/cpc/cpc_openout.c0000644000175000017500000000056410650475166020336 0ustar tygrystygrys/* * Part of the library for fcntlt * * Open a CPC file for reading * ----- * $Id: cpc_openout.c,v 1.2 2007/07/21 21:28:22 dom Exp $ */ #include "cpcfcntl.h" int cpc_openout(char *name, int len, char *buf) { #asm INCLUDE "#cpcfirm.def" LIB cpc_setup_open call cpc_setup_open call firmware defw cas_out_open ld hl,1 ret c ld hl,-1 #endasm } z88dk-1.8.ds1/libsrc/fcntl/cpc/cpc_setup_open.asm0000644000175000017500000000053307730372263021357 0ustar tygrystygrys; ; CPC fcntl Routines ; Donated by **_warp6_** ; ; $Id: cpc_setup_open.asm,v 1.1 2003/09/12 16:30:43 dom Exp $ ; XLIB cpc_setup_open ; We enter with sp + 4 = buffer, sp + 6 = lengthm sp + 8 = filename .cpc_setup_open ld ix,4 add ix,sp ld e,(ix+0) ld d,(ix+1) ld b,(ix+2) ld l,(ix+4) ld h,(ix+5) ret z88dk-1.8.ds1/libsrc/fcntl/cpc/cpcfcntl.h0000644000175000017500000000115507730372263017615 0ustar tygrystygrys/* * Internal library header file for CPC fcntl routines * * Routines donated by **_warp6_** * * $Id: cpcfcntl.h,v 1.1 2003/09/12 16:30:43 dom Exp $ */ #ifndef __FCNTL_CPCFCNTL_H__ #define __FCNTL_CPCFCNTL_H__ #include typedef struct { u8_t in_used; u8_t out_used; char in_buf[2048]; char out_buf[2048]; } cpc_fd; extern cpc_fd cpcfile; extern int __LIB__ cpc_openin(char *name, int namelen,char *buf); extern int __LIB__ cpc_openout(char *name, int namelen,char *buf); extern int __LIB__ cpc_closein(); extern int __LIB__ cpc_closeout(); #endif /* __FCNTL_CPCFCNTL_H__ */ z88dk-1.8.ds1/libsrc/fcntl/cpc/Makefile0000644000175000017500000000073310763607622017311 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.3 2008/03/05 20:35:46 dom Exp $ include ../../Make.config CFILES = \ close.c \ cpc_openin.c \ cpc_openout.c \ open.c \ open_z88.c \ read.c \ write.c \ writebyte.c \ readbyte.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) cpc_fcntl: $(OBJECTS) .c.o: zcc +cpc $(CFLAGS) -D__CPC__ $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* *.i $(AFILES) z88dk-1.8.ds1/libsrc/fcntl/cpc/open.c0000644000175000017500000000105007730372263016747 0ustar tygrystygrys/* * Part of the library for fcntlt * * int open(char *name,int access, mode_t mode) * * djm 27/4/99 * * Access is either * * O_RDONLY = 0 * O_WRONLY = 1 Starts afresh?!?!? * O_APPEND = 256 * * All others are ignored(!) * * ----- * $Id: open.c,v 1.1 2003/09/12 16:30:43 dom Exp $ */ #include /* Or is it unistd.h, who knows! */ int open(far char *name, int flags, mode_t mode) { char buffer[10]; /* Buffer for expansion */ return (open_z88(name,flags,mode,buffer,9)); } z88dk-1.8.ds1/libsrc/fcntl/cpc/open_z88.c0000644000175000017500000000217307730372263017467 0ustar tygrystygrys/* * Part of the library for fcntl * * int open(char *name,int access, mode_t mode) * * Access (flags) is either * * O_RDONLY = 0 * O_WRONLY = 1 * * All others are ignored(!) - i.e. mode is ignored * * The CPC only supports one file for reading and one file writing * at a time * * ----- * $Id: open_z88.c,v 1.1 2003/09/12 16:30:43 dom Exp $ */ #include #include #include "cpcfcntl.h" int open_z88(far char *name, int flags, mode_t mode, char *buf, size_t len) { /* Copy the name across */ strncpy(buf,name,len); buf[len-1] = 0; switch ( flags ) { case O_RDONLY: if ( cpcfile.in_used ) return -1; if ( cpc_openin(name,strlen(name),cpcfile.in_buf) ) { cpcfile.in_used = 1; return 0; /* File descriptor 0 is read */ } return -1; /* Other wise just error */ case O_WRONLY: if ( cpcfile.out_used ) return -1; if ( cpc_openout(name,strlen(name),cpcfile.out_buf) ) { cpcfile.out_used = 1; return 1; /* File descriptor 1 is write */ } return -1; /* Otherwise just error */ } return -1; /* No other modes supported */ } z88dk-1.8.ds1/libsrc/fcntl/cpc/read.c0000644000175000017500000000067107730372263016731 0ustar tygrystygrys/* * Part of the library for fcntl * * size_t read(int fd,void *ptr, size_t len) * * ----- * $Id: read.c,v 1.1 2003/09/12 16:30:43 dom Exp $ */ #include #include size_t read(int fd, void *ptr, size_t len) { int i; if ( fd != 0 ) { /* It's not the write descriptor */ return -1; } for ( i = 0; i < len ; i++ ) { if ( ( ptr[i] = readbyte(fd) ) == -1 ) { return i; } } return i; } z88dk-1.8.ds1/libsrc/fcntl/cpc/readbyte.c0000644000175000017500000000104710650475166017614 0ustar tygrystygrys/* * Low level reading routines for CPC * * writebyte(int fd, int c) - Read byte from file * * * ----- * $Id: readbyte.c,v 1.2 2007/07/21 21:28:22 dom Exp $ */ #include #include int __FASTCALL__ readbyte(int fd) { if ( fd != 0 ) /* Check to see if this is the read file */ return EOF; #asm INCLUDE "#cpcfirm.def" call firmware defw cas_in_char ccf ld l,a ld h,0 jr nc,read_ok ld hl,EOF .read_ok ; Need this label since this function is __FASTCALL__ #endasm } z88dk-1.8.ds1/libsrc/fcntl/cpc/write.c0000644000175000017500000000066707730372263017155 0ustar tygrystygrys/* * Part of the library for fcntl * * size_t write(int fd,void *ptr, size_t len) * * ----- * $Id: write.c,v 1.1 2003/09/12 16:30:43 dom Exp $ */ #include #include size_t write(int fd, void *ptr, size_t len) { int i; if ( fd != 1 ) { /* It's not the write descriptor */ return -1; } for ( i = 0; i < len ; i++ ) { if ( writebyte(fd,ptr[i]) == -1 ) { return i; } } return i; } z88dk-1.8.ds1/libsrc/fcntl/cpc/writebyte.c0000644000175000017500000000115510650475166020033 0ustar tygrystygrys/* * Low level reading routines for CPC * * writebyte(int fd, int c) - Read byte from file * * * ----- * $Id: writebyte.c,v 1.2 2007/07/21 21:28:22 dom Exp $ */ #include #include int writebyte(int fd, int byte) { if ( fd != 1 ) /* Check to see if this is the write file */ return EOF; #asm INCLUDE "#cpcfirm.def" pop bc pop hl ;byte pop de ;file handle (ignore it) push de push hl push bc ld a,l push af call firmware defw cas_out_char pop af ld l,a ld h,0 ret c ;was written ok ld hl,EOF #endasm } z88dk-1.8.ds1/libsrc/fcntl/cpm/0000755000175000017500000000000010765202715015654 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/cpm/_putoffset.c0000644000175000017500000000051507425070420020172 0ustar tygrystygrys/* * Write the file offset into the FCB * * 27/1/2002 - djm * * $Id: _putoffset.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include void _putoffset(unsigned char *where,long offset) { where[0] = ((int)offset) & 0xFF; where[1] = ((int)(offset >> 8 )) & 0xFF; where[2] = ((int)(offset >> 16)) & 0xFF; } z88dk-1.8.ds1/libsrc/fcntl/cpm/bdos.c0000644000175000017500000000044207425070420016742 0ustar tygrystygrys/* * Call a CPM BDOS routine * * $Id: bdos.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include int bdos(int func,int arg) { #asm ld hl,2 add hl,sp ld e,(hl) ;arg inc hl ld d,(hl) inc hl ld c,(hl) ;func call 5 ld l,a rla ;make -ve if error sbc a,a ld h,a #endasm } z88dk-1.8.ds1/libsrc/fcntl/cpm/close.c0000644000175000017500000000072507425070420017124 0ustar tygrystygrys/* * Close a file * * 27/1/2002 - djm * * $Id: close.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include #include int close(int fd) { struct fcb *fc; unsigned char uid; if ( fd >= MAXFILE ) return -1; fc = &_fcb[fd]; uid = getuid(); /* Get our uid, keep safe */ setuid(fc->uid); /* Set it to that of the file */ if ( fc->use ) bdos(CPM_CLS,fc); fc->use = 0; setuid(uid); return 0; } z88dk-1.8.ds1/libsrc/fcntl/cpm/creat.c0000644000175000017500000000123507425070420017112 0ustar tygrystygrys/* * Create a file * * 27/1/2002 - djm * * Based on Hitech C library (as usual) * * $Id: creat.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include #include #include int creat(far char *nam, mode_t mode) { struct fcb *fc; char *name; int fd; unsigned char pad,uid; name = nam; if ( ( fc = getfcb() ) == NULL ) return -1; uid = getuid(); if ( setfcb(fc,name) == 0 ) { remove(name); setuid(fc->uid); if ( bdos(CPM_MAKE,fc) == -1 ) { setuid(uid); fc->use = 0; return -1; } setuid(uid); fc->use = U_WRITE; } fd = fc - &_fcb[0]; return fd; } z88dk-1.8.ds1/libsrc/fcntl/cpm/getfcb.c0000644000175000017500000000060007425070420017241 0ustar tygrystygrys/* * Get a free File Control Block * * 27/1/2002 - djm * * $Id: getfcb.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include #include struct fcb *getfcb(void) { struct fcb *fcb; for ( fcb = _fcb ; fcb < &_fcb[MAXFILE]; fcb++ ) { if ( fcb->use == 0 ) { fcb->use = U_READ; fcb->rwptr = 0; return fcb; } } return NULL; } z88dk-1.8.ds1/libsrc/fcntl/cpm/Makefile0000644000175000017500000000075310763607623017326 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.5 2008/03/05 20:35:46 dom Exp $ include ../../Make.config CFILES = \ _putoffset.c \ bdos.c \ close.c \ creat.c \ getfcb.c \ open.c \ open_z88.c \ parsefcb.c \ read.c \ readbyte.c \ remove.c \ setfcb.c \ write.c \ writebyte.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) z88_fcntl: $(OBJECTS) .c.o: zcc +cpm $(CFLAGS) $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* *~ *.i $(AFILES) z88dk-1.8.ds1/libsrc/fcntl/cpm/open.c0000644000175000017500000000111707425070420016754 0ustar tygrystygrys/* * Part of the library for fcntlt * * int open(char *name,int access, mode_t mode) * * djm 27/4/99 * * Access is either * * O_RDONLY = 0 * O_WRONLY = 1 Starts afresh?!?!? * O_APPEND = 256 * * All others are ignored(!) * * ----- * $Id: open.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include #include /* Or is it unistd.h, who knows! */ int open(far char *name, int flags, mode_t mode) { int fd; char buffer[10]; /* Buffer for expansion */ return ( open_z88(name,flags,mode,buffer,9) ); } z88dk-1.8.ds1/libsrc/fcntl/cpm/open_z88.c0000644000175000017500000000207207460607073017477 0ustar tygrystygrys/* * Open a file * * 27/1/2002 - djm * * We don't bother filling up the explicitname (yet...) * * $Id: open_z88.c,v 1.2 2002/04/21 19:08:43 dom Exp $ */ #include #include #include int open_z88(far char *nam, int mode, mode_t flags, char *outbuf, size_t extlen) { struct fcb *fc; unsigned char uid,pad; int fd; char *name = nam; if ( ++mode > U_RDWR ) mode = U_RDWR; if ( ( fc = getfcb() ) == NULL ) { return -1; } if ( setfcb(fc,name) == 0 ) { /* We had a real file, not a device */ if ( mode == U_READ && bdos(CPM_VERS,0) >= 0x30 ) fc->name[5] |= 0x80; /* read only mode */ uid = getuid(); setuid(fc->uid); if ( bdos(CPM_OPN,fc) == -1 ) { clearfcb(fc); setuid(uid); if ( mode > U_READ ) { /* If returned error and writer then create */ fd = creat(name,0); if ( fd == -1 ) return -1; fc = _fcb[fd]; fc->use = mode; return fd; } return -1; /* An error */ } setuid(uid); fc->use = mode; } fd = (fc - &_fcb[0]); return fd; } z88dk-1.8.ds1/libsrc/fcntl/cpm/parsefcb.c0000644000175000017500000000322707425070420017604 0ustar tygrystygrys/* * Set the FCB parameters to the supplied name pt 1 * This bit deals with userarea, device and filename * * 27/1/2002 - djm * * $Id: parsefcb.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include #include #include #include void parsefcb(struct fcb *fc, unsigned char *name) { unsigned char *ptr; unsigned char c; fc->drive = 0; /* Default drive */ fc->uid = getuid(); /* Set the userid */ ptr = name; while ( isdigit(*ptr) ) /* Find the end of the user number */ ptr++; if ( name != ptr && *ptr == ':' ) { /* uid has to end in colon */ fc->uid = atoi(name); name = ++ptr; } if ( *name && name[1] == ':' ) { /* Found a drive specifier */ fc->drive = toupper(*name) - 'A' + 1; name += 2; /* Skip over drive letter & colon */ } /* Now copy the name */ ptr = fc->name; /* Copy the name across upto the '.' or a '*' */ while ( *name != '.' && *name != '*' && *name > ' ' && ptr < &fc->name[8] ) *ptr++ = toupper(*name++); /* Now fill up to the first 8, with either a ? or space */ if ( *name == '*' ) c = '?'; else c = ' '; while ( ptr < &fc->name[8] ) { *ptr++ = c; } /* Loop till we get to the extension */ while ( *name && *name++ != '.' ) continue; /* Now fill in the extension */ while ( *name > ' ' && *name != '*' && ptr < &fc->ext[8] ) *ptr++ = toupper(*name++); /* Now fill up the extension, with either a ? or space */ if ( *name == '*' ) c = '?'; else c = ' '; while ( ptr < &fc->ext[3] ) *ptr++ = c; fc->extent = fc->next_record = 0; } z88dk-1.8.ds1/libsrc/fcntl/cpm/read.c0000644000175000017500000000277707425070420016743 0ustar tygrystygrys/* * Read from a file * * 27/1/2002 - djm * * * $Id: read.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include #include #include #include unsigned int read(int fd, void *buf, size_t len) { char buffer[SECSIZE+2]; unsigned char uid; struct fcb *fc; int cnt,size,offset; if ( fd >= MAXFILE ) return -1; fc = &_fcb[fd]; switch ( fc->use ) { #ifdef DEVICES case U_RDR: /* Reader device */ cnt = len; while( len ) { len--; if((*buf++ = (bdos(CPM_RRDR) & 0x7f)) == '\n') break; } return cnt - len; case U_CON: if( len > SECSIZE) len = SECSIZE; buffer[0] = len; bdos(CPM_RCOB, buffer); cnt = buffer[1]; if(cnt < len) { bdos(CPM_WCON, '\n'); buffer[cnt+2] = '\n'; cnt++; } memcpy(buf,&buffer[2], cnt); return cnt; #endif case U_READ: case U_RDWR: uid = getuid(); cnt = len; while ( len ) { setuid(fc->uid); offset = fc->rwptr%SECSIZE; if ( ( size = SECSIZE - offset ) > len ) size = len; _putoffset(fc->ranrec,fc->rwptr/SECSIZE); if ( size == SECSIZE ) { bdos(CPM_SDMA,buf); if ( bdos(CPM_RRAN,fc) ) return -1; } else { bdos(CPM_SDMA,buffer); if ( bdos(CPM_RRAN,fc) ) { return -1; } memcpy(buf,buffer+offset,size); } buf += size; fc->rwptr += size; len -= size; setuid(uid); } setuid(uid); return cnt-len; default: return -1; } } z88dk-1.8.ds1/libsrc/fcntl/cpm/readbyte.c0000644000175000017500000000042007744601477017626 0ustar tygrystygrys/* * Read a single byte from a file * * 27/1/2002 - djm * * $Id: readbyte.c,v 1.2 2003/10/19 21:33:51 dom Exp $ */ #include int readbyte(int fd) { unsigned char buffer; if ( read(fd,&buffer,1) == -1 ) return_c -1; return_nc buffer; } z88dk-1.8.ds1/libsrc/fcntl/cpm/README0000644000175000017500000000037507425070420016534 0ustar tygrystygrysCPM Disc access routines These routines are a port of the Hitech C routines. They've been modified to work within the z88dk stdio framework and seem to quite well within the tests that I've made. There is no distinction between binary and text files. z88dk-1.8.ds1/libsrc/fcntl/cpm/remove.c0000644000175000017500000000066607425070420017320 0ustar tygrystygrys/* * Remove a file from the system * * Based on Hitech C as usual * * $Id: remove.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include #include #include int remove(char *name) { struct fcb fc; int retval; unsigned char uid,pad; if ( setfcb(fc,name) ) return 0; uid = getuid(); setuid(fc.uid); retval = bdos(CPM_DEL,&fc); setuid(uid); return retval; } z88dk-1.8.ds1/libsrc/fcntl/cpm/setfcb.c0000644000175000017500000000123207425070420017257 0ustar tygrystygrys/* * Set the FCB parameters to the supplied name pt 1 * * 27/1/2002 - djm * * $Id: setfcb.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include #include #define NUM_DEVNAMES 4 #define DEVNAME_LEN 4 static char devnames[] = "CON:RDR:PUN:LST:"; int setfcb( struct fcb *fc, unsigned char *name) { int i,j; while ( isspace(*name)) /* Skip over any initial space */ name++; #ifdef DEVICES /* Check for devices */ for ( i = 0; i < NUM_DEVNAMES; i++ ) { if ( strnicmp(name,devnames + (i * NUM_DEVNAMES ),DEVNAME_LEN) ) { fc->use = i + U_CON; return 1; } } #endif parsefcb(fc,name); return 0; } z88dk-1.8.ds1/libsrc/fcntl/cpm/write.c0000644000175000017500000000300507425070420017143 0ustar tygrystygrys/* * Read from a file * * 27/1/2002 - djm * * * $Id: write.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include #include #include #include #include unsigned int write(int fd, void *buf, size_t len) { char buffer[SECSIZE+2]; unsigned char uid; struct fcb *fc; int cnt,size,offset; if ( fd >= MAXFILE ) return -1; fc = &_fcb[fd]; cnt = len; offset = CPM_WCON; /* Double use of variable */ switch ( fc->use ) { #ifdef DEVICES case U_PUN: while ( len-- ) { bdos(CPM_WPUN,*buf++); } return cnt; case U_LST: offset = CPM_WLST; case U_CON: while ( len-- ) { bdos(offset,*buf++); } return cnd; #endif case U_WRITE: case U_RDWR: uid = getuid(); while ( len ) { setuid(fc->uid); offset = fc->rwptr%SECSIZE; if ( (size = SECSIZE-offset) > len ) size = len; _putoffset(fc->ranrec,fc->rwptr/SECSIZE); if ( size == SECSIZE ) { bdos(CPM_SDMA,buf); } else { /* Not the required size, read in the extent */ bdos(CPM_SDMA,buffer); /* Blank out the buffer to indicate EOF */ buffer[0] = 26; /* ^Z */ memcpy(buffer+1,buffer,SECSIZE-1); bdos(CPM_RRAN,fc); memcpy(buffer+offset,buf,size); } if ( bdos(CPM_WRAN,fc) ) { setuid(uid); return -1; /* Not sure about this.. */ } buf += size; fc->rwptr += size; len -= size; setuid(uid); } setuid(uid); return cnt-len; default: return -1; } } z88dk-1.8.ds1/libsrc/fcntl/cpm/writebyte.c0000644000175000017500000000033007425070420020025 0ustar tygrystygrys/* * Write a single byte to disc * * 27/1/2002 - djm * * $Id: writebyte.c,v 1.1 2002/01/27 21:28:48 dom Exp $ */ #include int writebyte(int fd, int byte) { return ( write(fd,&byte,1) ); } z88dk-1.8.ds1/libsrc/fcntl/dummy/0000755000175000017500000000000010765202715016230 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/dummy/close.asm0000644000175000017500000000020507267325734020046 0ustar tygrystygrys; Dummy function to keep rest of libs happy ; ; $Id: close.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB close .close ret z88dk-1.8.ds1/libsrc/fcntl/dummy/creat.asm0000644000175000017500000000022107273540111020016 0ustar tygrystygrys; Dummy function to keep rest of libs happy ; ; $Id: creat.asm,v 1.3 2001/05/01 13:55:21 dom Exp $ ; XLIB creat .creat ld hl,-1 ;error ret z88dk-1.8.ds1/libsrc/fcntl/dummy/fdgetpos.asm0000644000175000017500000000016607273540111020543 0ustar tygrystygrys; ; $Id: fdgetpos.asm,v 1.1 2001/05/01 13:55:21 dom Exp $ XLIB fdgetpos .fdgetpos ld hl,1 ;non zero is error ret z88dk-1.8.ds1/libsrc/fcntl/dummy/fdtell.asm0000644000175000017500000000017007273540111020175 0ustar tygrystygrys; $Id: fdtell.asm,v 1.1 2001/05/01 13:55:21 dom Exp $ XLIB fdtell .fdtell ld hl,-1 ;return -1 ld d,h ld e,l ret z88dk-1.8.ds1/libsrc/fcntl/dummy/lseek.asm0000644000175000017500000000017307273540111020031 0ustar tygrystygrys; $Id: lseek.asm,v 1.1 2001/05/01 13:55:21 dom Exp $ XLIB lseek .lseek ld hl,1 ;non zero is error ld d,h ld e,l ret z88dk-1.8.ds1/libsrc/fcntl/dummy/Makefile0000644000175000017500000000037410762226754017702 0ustar tygrystygrys# $Id: Makefile,v 1.8 2008/03/01 10:20:28 aralbrec Exp $ include ../../Make.config all: @echo '' @echo '---> Building NDOS library <---' @echo '' $(LIBLINKER) -x../../$(OUTPUT_DIRECTORY)/ndos @ndoslist clean: $(RM) *.sym *.map zcc_opt.def *.o* z88dk-1.8.ds1/libsrc/fcntl/dummy/ndoslist0000644000175000017500000000013407273540111020003 0ustar tygrystygrysclose creat fdgetpos fdtell lseek open open_z88 read readbyte remove rename write writebyte z88dk-1.8.ds1/libsrc/fcntl/dummy/open.asm0000644000175000017500000000021707273540111017666 0ustar tygrystygrys; Dummy function to keep rest of libs happy ; ; $Id: open.asm,v 1.3 2001/05/01 13:55:21 dom Exp $ ; XLIB open .open ld hl,-1 ;error ret z88dk-1.8.ds1/libsrc/fcntl/dummy/open_z88.asm0000644000175000017500000000021607267325734020415 0ustar tygrystygrys; Dummy function to keep rest of libs happy ; ; $Id: open_z88.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB open_z88 .open_z88 ret z88dk-1.8.ds1/libsrc/fcntl/dummy/read.asm0000644000175000017500000000017607273540111017644 0ustar tygrystygrys; Dummy function to keep rest of libs happy ; ; $Id: read.asm,v 1.1 2001/05/01 13:55:21 dom Exp $ ; XLIB read .read ret z88dk-1.8.ds1/libsrc/fcntl/dummy/readbyte.asm0000644000175000017500000000021607267325734020542 0ustar tygrystygrys; Dummy function to keep rest of libs happy ; ; $Id: readbyte.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB readbyte .readbyte ret z88dk-1.8.ds1/libsrc/fcntl/dummy/README0000644000175000017500000000013407267325734017120 0ustar tygrystygrys$Id: README,v 1.2 2001/04/18 14:59:40 stefano Exp $ Dummy fns to keep the stdio libs happy z88dk-1.8.ds1/libsrc/fcntl/dummy/remove.asm0000644000175000017500000000010207273540111020213 0ustar tygrystygrys; Dummy file libs ; XLIB remove .remove ld hl,-1 ;error ret z88dk-1.8.ds1/libsrc/fcntl/dummy/rename.asm0000644000175000017500000000010207273540111020165 0ustar tygrystygrys; Dummy file libs ; XLIB rename .rename ld hl,-1 ;error ret z88dk-1.8.ds1/libsrc/fcntl/dummy/write.asm0000644000175000017500000000020107273540111020050 0ustar tygrystygrys; Dummy function to keep rest of libs happy ; ; $Id: write.asm,v 1.1 2001/05/01 13:55:21 dom Exp $ ; XLIB write .write ret z88dk-1.8.ds1/libsrc/fcntl/dummy/writebyte.asm0000644000175000017500000000022107267325734020755 0ustar tygrystygrys; Dummy function to keep rest of libs happy ; ; $Id: writebyte.asm,v 1.2 2001/04/18 14:59:40 stefano Exp $ ; XLIB writebyte .writebyte ret z88dk-1.8.ds1/libsrc/fcntl/Makefile0000644000175000017500000000161610630555201016531 0ustar tygrystygrys# $Id: Makefile,v 1.15 2007/06/03 15:13:05 stefano Exp $ lcpc: cd cpc ; $(MAKE) ; cd .. lz88: cd z88 ; $(MAKE) z88_fcntl ; cd .. lzx: cd spectrum ; $(MAKE) ; cd .. cd dummy ; $(MAKE) ; cd .. lnewbrain: @echo '' @echo '---> Building NewBrain File library <---' @echo '' cd newbrain ; $(MAKE) ; cd .. lcpm: @echo '' @echo '---> Building CP/M File library <---' @echo '' cd cpm ; $(MAKE) ; cd .. lpps: @echo '' @echo '---> Building P.P.Sprinter File library <---' @echo '' cd sprinter ; $(MAKE) ; cd .. lzxvgs: cd zxvgs ; $(MAKE) ; cd .. lcpcold: cd cpc ; $(MAKE) ; cd .. cd dummy ; $(MAKE) ; cd .. clean: cd cpm ; $(MAKE) clean ; cd .. cd dummy ; $(MAKE) clean ; cd .. cd spectrum ; $(MAKE) clean ; cd .. cd newbrain ; $(MAKE) clean ; cd .. cd sprinter ; $(MAKE) clean ; cd .. cd z88 ; $(MAKE) clean ; cd .. cd zxvgs ; $(MAKE) clean ; cd .. cd cpc ; $(MAKE) clean ; cd .. z88dk-1.8.ds1/libsrc/fcntl/newbrain/0000755000175000017500000000000010765202715016702 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/newbrain/close.asm0000644000175000017500000000121610630555202020502 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 29/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; close an open file ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; int close(int handle); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: close.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB close LIB nbhandl LIB nb_close .close pop bc pop hl push hl push bc push hl call nb_close pop hl ld de,100 ; we use stream numbers startimg from 100 add hl,de ld de,nbhandl xor a add hl,de ld (hl),a ; free flag for handle ld hl,0 ret z88dk-1.8.ds1/libsrc/fcntl/newbrain/creat.asm0000644000175000017500000000117110630555202020473 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 29/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; Create a file ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; int creat(far char *name, mode_t mode); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: creat.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB creat LIB open LIB close .creat pop bc pop hl push hl push bc push bc push bc push hl call open pop bc pop bc pop bc ld a,h or l cp 255 ; -1 => error ? ret z push hl call close pop hl ld hl,0 ret z88dk-1.8.ds1/libsrc/fcntl/newbrain/fdgetpos.asm0000644000175000017500000000036610630555202021215 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 30/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; ; $Id: fdgetpos.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ XLIB fdgetpos .fdgetpos ld hl,-1 ret z88dk-1.8.ds1/libsrc/fcntl/newbrain/fdtell.asm0000644000175000017500000000040210630555202020643 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 30/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; ; $Id: fdtell.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ XLIB fdtell .fdtell ld hl,-1 ld d,h ld e,l ret z88dk-1.8.ds1/libsrc/fcntl/newbrain/lseek.asm0000644000175000017500000000042010630555202020474 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 30/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; ; $Id: lseek.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ XLIB lseek .lseek ld hl,-1 ;non zero is error ld d,h ld e,l ret z88dk-1.8.ds1/libsrc/fcntl/newbrain/Makefile0000644000175000017500000000051310633257400020334 0ustar tygrystygrys# # Makefile for the Grundy NewBrain fcntl driver # # $Id: Makefile,v 1.3 2007/06/11 14:41:04 stefano Exp $ include ../../Make.config all: open_z88.o read.o remove.o rename.o $(LIBLINKER) -x../../$(OUTPUT_DIRECTORY)/nbdrv @nbflst .c.o: zcc +newbrain $(CFLAGS) $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* z88dk-1.8.ds1/libsrc/fcntl/newbrain/nbflst0000644000175000017500000000014410630555202020105 0ustar tygrystygrysnbhandl close creat fdgetpos fdtell lseek open open_z88 read readbyte remove rename write writebyte z88dk-1.8.ds1/libsrc/fcntl/newbrain/nbhandl.asm0000644000175000017500000000062210630555202021003 0ustar tygrystygrys; ; NewBrain driver support file, used by "open" and "close" ; ; Stefano - 29/5/2007 ; ; $Id: nbhandl.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ XLIB nbhandl ; handles: ; 10 files open at once should be enough. ; we use stream numbers startimg from 100 ; ; 100 101 102 103 104 105 106 107 108 109 .nbhandl defb 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 255 z88dk-1.8.ds1/libsrc/fcntl/newbrain/open.asm0000644000175000017500000000310310631471703020337 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 29/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; open a file ; ; it reads the default store device in NB_DEV2 ($13) ; WARNING: might not work in paged memory mode ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; int open(char *name, int flags, mode_t mode); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: open.asm,v 1.2 2007/06/06 08:43:47 stefano Exp $ ; XLIB open LIB nbhandl LIB nb_open LIB nb_close .open ld ix,2 add ix,sp ld b,0 ld hl,nbhandl .hloop ld a,(hl) cp 255 jr nz,notlast ld hl,-1 ; error, no more free handles ret .notlast and a jr z,hfound inc hl inc b jr hloop .hfound inc a ld (hl),a ld c,b ld b,0 ld hl,100 add hl,bc push hl call nb_close ; close if already open pop hl ld a,(ix+2) ; get flags and a ld d,a ld e,$32 ; read mode (code for 'openin' ZCALL) jr z,open_it ld e,$33 ; write mode (code for 'openout' ZCALL) ; dec a ; jr z,open_it ;.open_abort ; ld hl,-1 ; invalid mode ; scf ; ret ; nb_open( int mode, int stream, int device, int port, char *paramstr ); .open_it push de ; mode (Read or Write) push hl ; stream -> handle ld hl,($13) ; NB_DEV2 .. push hl ; ..(default storage device: tape 1/2, disk, etc..) ld bc,1 push bc ; port 1 ld l,(ix+4) ld h,(ix+5) ; file name to paramstr push hl call nb_open ld a,l ; keep result pop hl ; pointer to fname pop bc ; port pop hl ; device pop hl ; file handle pop de and a ret z ld hl,-1 ; open error ! ret z88dk-1.8.ds1/libsrc/fcntl/newbrain/open_z88.c0000644000175000017500000000056510630555202020517 0ustar tygrystygrys/* * Took "as is" fron the Dominic's files * * $Id: open_z88.c,v 1.1 2007/06/03 15:13:06 stefano Exp $ */ #include #include //#include int open_z88(far char *name, int flags, mode_t mode, char *buf,int len) { int hand; hand = open(name,flags,mode); if ( hand != -1 ) { strncpy(buf,(near char *)name,len); } return (hand); } z88dk-1.8.ds1/libsrc/fcntl/newbrain/read.c0000644000175000017500000000056610630555202017761 0ustar tygrystygrys/* * Part of the library for fcntl * * size_t read(int fd,void *ptr, size_t len) * * ----- * $Id: read.c,v 1.1 2007/06/03 15:13:06 stefano Exp $ */ #include #include size_t read(int fd, void *ptr, size_t len) { int i; for ( i = 0; i < len ; i++ ) { if ( ( ptr[i] = readbyte(fd) ) == -1 ) { return i; } } return i; } z88dk-1.8.ds1/libsrc/fcntl/newbrain/readbyte.asm0000644000175000017500000000072110630555202021174 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 30/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; fcntl input function ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; int __LIB__ __FASTCALL__ readbyte(int handle); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: readbyte.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB readbyte LIB nb_getc .readbyte jp nb_getc z88dk-1.8.ds1/libsrc/fcntl/newbrain/remove.c0000644000175000017500000000141610633172457020350 0ustar tygrystygrys/* Grundy Newbrain Specific libraries Stefano Bodrato - 30/05/2007 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Remove a file (or many files if an ambigous filename is given) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int remove(char *name); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $Id: remove.c,v 1.1 2007/06/11 07:09:35 stefano Exp $ */ #include #include int remove(char *name) { /* Open the directory device on stream 15 */ nb_open( OUTP, 15, DEV_SDISCIO, 0, "" ); /* send 'ERASE' command (0) to directory device */ nb_puts( 15, "0" ); /* pass file name or file mask */ nb_puts( 15, name ); /* */ nb_puts( 15, "\n" ); nb_close( 15 ); return (0); } z88dk-1.8.ds1/libsrc/fcntl/newbrain/rename.c0000644000175000017500000000147610633172457020330 0ustar tygrystygrys/* Grundy Newbrain Specific libraries Stefano Bodrato - 30/05/2007 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Rename a file - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int rename(char *s, char *d); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $Id: rename.c,v 1.1 2007/06/11 07:09:35 stefano Exp $ */ #include #include int rename(char *oldname, char *newname) { /* Open the directory device on stream 15 */ nb_open( OUTP, 15, DEV_SDISCIO, 0, "" ); /* send 'RENAME' command (1) to directory device */ nb_puts( 15, "1" ); /* pass file name or file mask */ nb_puts( 15, oldname ); nb_puts( 15, " " ); nb_puts( 15, newname ); /* */ nb_puts( 15, "\n" ); nb_close( 15 ); return (0); } z88dk-1.8.ds1/libsrc/fcntl/newbrain/write.asm0000644000175000017500000000070610630555202020532 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 30/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; Write a data block ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; size_t write(int fd,void *ptr, size_t len) ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: write.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ XLIB write LIB nb_putblock .write jp nb_putblock z88dk-1.8.ds1/libsrc/fcntl/newbrain/writebyte.asm0000644000175000017500000000072610630555202021420 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 30/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; Write a byte by the BASIC driver ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; int writebyte(int handle, int byte) ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: writebyte.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ XLIB writebyte LIB nb_putc .writebyte jp nb_putc z88dk-1.8.ds1/libsrc/fcntl/README0000644000175000017500000000024507267325734015770 0ustar tygrystygrys$Id: README,v 1.2 2001/04/18 14:59:40 stefano Exp $ fcntl functions These functions handle file i/o and the ilk and are *very* machine specific (suprise suprise!) z88dk-1.8.ds1/libsrc/fcntl/spectrum/0000755000175000017500000000000010765202715016737 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/spectrum/Makefile0000644000175000017500000000072610700451034020371 0ustar tygrystygrys# # $Id: Makefile,v 1.6 2007/10/02 14:13:48 stefano Exp $ all: @echo '' @echo '---> Building +3 File library <---' @echo '' cd plus3 ; $(MAKE) ; cd .. @echo '' @echo '---> Building ZX Microdrive File library <---' @echo '' cd microdrive ; $(MAKE) @echo '' @echo '---> Building ZX BASIC driver library <---' @echo '' cd zxbasdrv ; $(MAKE) clean: cd plus3 ; $(MAKE) clean ; cd .. cd microdrive ; $(MAKE) clean ; cd .. cd zxbasdrv ; $(MAKE) clean ; cd .. z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/0000755000175000017500000000000010765202715021102 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/close.c0000755000175000017500000000105310211125554022344 0ustar tygrystygrys/* * Close a file on Microdrive * Stefano Bodrato - Feb. 2005 * * int close(int handle) * closes file and frees memory * * $Id: close.c,v 1.2 2005/03/01 17:50:36 stefano Exp $ */ #include #include //#include #include int close(int handle) { /* DEBUG - experiments to see how the M_CHAN structure survived struct M_CHAN * if1_file; if1_file = (char *) handle; printf ("-- closing '%s' - %u --",if1_getname( (char *) if1_file->hdname ), handle); */ free(handle); } z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/lseek.c0000755000175000017500000000237410205324351022350 0ustar tygrystygrys/* * long lseek(int fd, long posn, int whence) * * Stefano Bodrato - Feb. 2005 * Needs optimizations: always re-reads the record * * 0 SEEK_SET from start of file * 1 SEEK_CUR from current position * 2 SEEK_END from end of file (always -ve) * * $Id: lseek.c,v 1.1 2005/02/18 08:35:53 stefano Exp $ */ #include #include #include long lseek(int handle, long posn, int whence) { struct M_CHAN *if1_file; int if1_filestatus; long position; //unsigned char mychar; if1_file = (char *) handle; switch (whence) { case SEEK_SET: if1_load_record(if1_file->drive, if1_file->name, posn / 512, if1_file); if1_file->position=posn; break; case SEEK_CUR: position = if1_file->position + posn; lseek(handle, position, SEEK_SET); break; case SEEK_END: if1_filestatus = if1_load_record(if1_file->drive, if1_file->name, 0, if1_file); // Move up to end of file while ((if1_file->recflg && 1) == 0) if1_filestatus = if1_load_record(if1_file->drive, if1_file->name, ++if1_file->record, if1_file); // now get the latest position and add the offest position = if1_file->record * 512 + if1_file->reclen + posn; lseek(handle, position, SEEK_SET); break; } return (if1_file->position); } z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/Makefile0000755000175000017500000000051710630724403022542 0ustar tygrystygrys# # Makefile for ZX Microdrive file support # # $Id: Makefile,v 1.6 2007/06/04 05:54:11 stefano Exp $ include ../../../Make.config all: open.o open_z88.o close.o readbyte.o remove.o rename.o lseek.o tell.o $(LIBLINKER) -x../../../$(OUTPUT_DIRECTORY)/zxmdv @mdvlist .c.o: zcc +zx $(CFLAGS) $*.c clean: $(RM) *.o* zcc_opt.def z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/mdvlist0000755000175000017500000000010010211373771022476 0ustar tygrystygrysclose lseek open open_z88 readbyte remove rename tell writebyte z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/open.c0000755000175000017500000000325710212015511022200 0ustar tygrystygrys/* * Open a file on Microdrive * Stefano Bodrato - Jan. 2005 * * int open(char *name, int flags, mode_t mode) * returns handle to file * * * Access is either * * O_RDONLY = 0 * O_WRONLY = 1 Starts afresh?!?!? * O_APPEND = 256 * * $Id: open.c,v 1.3 2005/03/04 08:24:41 stefano Exp $ */ #include #include //#include #include int open(far char *name, int flags, mode_t mode) { int if1_filestatus; struct M_CHAN *if1_file; //if (if1_file = malloc(sizeof(struct M_CHAN)) == 0) // return (-1); if1_file = malloc(sizeof(struct M_CHAN)); if (if1_file == 0) return (-1); if1_filestatus = if1_load_record(1, (char *)name, 0, if1_file); switch (mode) { case O_RDONLY: if (if1_filestatus == -1) { // FILE NOT FOUND free(if1_file); return(-1); } /* DEBUGGING: "hdname" could be useful to check if the disk has been changed printf("\nread only : %u - %s\n",if1_file, if1_getname( (char *) ((if1_file)->name)) ); printf ("--%s--",if1_getname( (char*) ((if1_file)->hdname)) ); */ // RESET FILE COUNTER (if1_file)->position=0; (if1_file)->flags=flags; (if1_file)->mode=mode; return(if1_file); break; case O_WRONLY: if (if1_filestatus != -1) { //printf("\nfile already exists\n"); free(if1_file); return(-1); } return(-1); // not still implemented break; case O_APPEND: if (if1_filestatus == -1) { // FILE NOT FOUND free(if1_file); return(-1); } (if1_file)->position=0; (if1_file)->flags=flags; (if1_file)->mode=mode; lseek((if1_file), 0, SEEK_END); break; } return(-1); } z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/open_z88.c0000755000175000017500000000056310211125554022716 0ustar tygrystygrys/* * Took "as is" fron the Dominic's files * * $Id: open_z88.c,v 1.2 2005/03/01 17:50:36 stefano Exp $ */ #include #include #include int open_z88(far char *name, int flags, mode_t mode, char *buf,int len) { int hand; hand = open(name,flags,mode); if ( hand != -1 ) { strncpy(buf,(near char *)name,len); } return (hand); } z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/readbyte.c0000755000175000017500000000225610211125555023045 0ustar tygrystygrys/* * Read byte from file in Microdrive * * Stefano Bodrato - Feb. 2005 * * * Not user callable - internal LIB routine * * Enter with de = filehandle * * $Id: readbyte.c,v 1.2 2005/03/01 17:50:37 stefano Exp $ */ //#include // "stdio.h" contains definition for EOF #include #include int __FASTCALL__ readbyte(int handle) { struct M_CHAN *if1_file; int if1_filestatus; //unsigned char mychar; if1_file = (char *) handle; //printf ("-- reading '%s' - %u --",if1_getname( (char *) if1_file->hdname ), handle); if ( (int) (if1_file->position / 512) > if1_file->record ) { //DEBUG: //printf ("\nNext record in file: %u ",if1_file->record + 1); // EOF flag set ? if (if1_file->recflg && 1) return (EOF); // No, load next record if1_filestatus = if1_load_record(if1_file->drive, if1_file->name, ++if1_file->record, if1_file); //DEBUG: //printf (" sector: %u len: %u\n",if1_filestatus,if1_file->reclen); if (if1_filestatus == -1) return (EOF); } if ( ((int) (if1_file->position) % 512) >= if1_file->reclen ) return EOF; return ( (unsigned char *) *(if1_file->data + ( (int)(if1_file->position++) % 512)) ); } z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/remove.c0000755000175000017500000000044210211125555022536 0ustar tygrystygrys/* * Remove file from Microdrive * fixed on first drive, for now. * * Stefano Bodrato - Feb. 2005 * * $Id: remove.c,v 1.2 2005/03/01 17:50:37 stefano Exp $ */ //#include #include #include int remove(char *name) { if1_remove_file (1, name); } z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/rename.c0000755000175000017500000000165610211125555022520 0ustar tygrystygrys/* * Rename a file on Microdrive * * Stefano Bodrato - Oct. 2004 * * $Id: rename.c,v 1.3 2005/03/01 17:50:37 stefano Exp $ */ #include #include int rename(char *oldname, char *newname) { int blkcount, currblock; struct M_CHAN mybuf; // check if "newname" already exists if (if1_load_record (1, newname, 0, mybuf) != -1 ) return (-1); // load first file record and check for its existence if ((currblock = if1_load_record (1, oldname, 0, mybuf)) == -1 ) return (-1); /* now rename every file record we skip the record no. 255 to avoid loops */ for (blkcount=1; blkcount < 255; blkcount++) { if1_setname(newname,&mybuf->recname[0]); if (if1_write_sector (1, currblock, mybuf) == -1) return (-1); currblock = if1_load_record (1, oldname, blkcount, mybuf); if (currblock == -1) return 0; } return (0); } z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/tell.c0000755000175000017500000000043310211125555022201 0ustar tygrystygrys/* * long tell(int handle); * * Stefano Bodrato - Feb. 2005 * * $Id: tell.c,v 1.2 2005/03/01 17:50:37 stefano Exp $ */ #include #include long tell(int handle) { struct M_CHAN *if1_file; if1_file = (char *) handle; return (if1_file->position); } z88dk-1.8.ds1/libsrc/fcntl/spectrum/microdrive/writebyte.asm0000755000175000017500000000026010211373775023624 0ustar tygrystygrys; ; Placeholder for writebyte ; ; Stefano - 2/3/2005 ; ; $Id: writebyte.asm,v 1.1 2005/03/02 17:29:33 stefano Exp $ XLIB writebyte .writebyte ld hl,-1 ld d,h ld e,l ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/0000755000175000017500000000000010765202715020005 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/close.c0000644000175000017500000000060507742246247021270 0ustar tygrystygrys/* * Close a file (+3 DOS) * * 18/3/2000 djm * * $Id: close.c,v 1.3 2003/10/12 12:44:23 dom Exp $ */ #include #include int close(int handle) { #asm INCLUDE "#p3dos.def" XREF dodos pop bc pop hl push hl push bc ld b,l push hl ld iy,DOS_CLOSE call dodos pop de ld hl,-1 ;error! ret nc ;error ex de,hl call freehand ld hl,0 #endasm } z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/dodos.asm0000644000175000017500000000160507273540111021614 0ustar tygrystygrys; A couple of routines for +3 library ; Routine to call +3DOS Routines. Located in startup ; code to ensure we don't get paged out ; (These routines have to be below 49152) ; ; djm 17/3/2000 (after the manual!) ; ; $Id: dodos.asm,v 1.1 2001/05/01 13:55:21 dom Exp $ XDEF dodos .dodos push af push bc ld a,7 ld bc,32765 di ld (23388),a out (c),a ei pop bc pop af call cjumpiy push af push bc ld a,16 ld bc,32765 di ld (23388),a out (c),a ei pop bc pop af ret .cjumpiy jp (iy) ; ; Short routine to set up a +3 DOS header so files ; Can be accessed from BASIC, we set to type code ; load address 0 and length supplied ; ; Entry: b = file handle ; hl = file length .setheader ld iy,setheader_r call dodos ret .setheader_r push hl call 271 ;DOS_RED_HEAD pop hl ld (ix+0),3 ;COODE ld (ix+1),l ;Length ld (ix+2),h ld (ix+3),0 ;Load address ld (ix+4),0 ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/fabandon.c0000644000175000017500000000075007741511136021723 0ustar tygrystygrys/* * Abandon a file (+3 DOS) * * 30/4/2001 djm * * $Id: fabandon.c,v 1.2 2003/10/10 11:05:02 dom Exp $ */ #include #include void fabandon(FILE *fp) { fabandon1(fp->desc.fd); fp->desc.fd=0; fp->flags=0; fp->ungetc=0; } int fabandon1(int fd) { #asm INCLUDE "#p3dos.def" XREF dodos pop bc pop hl push hl push bc ld b,l push bc ld iy,DOS_ABANDON call dodos pop de ld hl,-1 ;error! ret nc ;error ex de,hl call freehand ld hl,0 #endasm } z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/fdgetpos.asm0000644000175000017500000000112507742626674022340 0ustar tygrystygrys; ; int fdgetpos(int fd, long *dump) ; ; Return position in file ; ; This returns longs even though there's no real need to do so ; ; $Id: fdgetpos.asm,v 1.2 2003/10/13 22:57:00 dom Exp $ XLIB fdgetpos INCLUDE "#p3dos.def" LIB l_plong XREF dodos .fdgetpos pop hl ;ret address pop de ;where to store it pop bc ;lower 8 is file handle push bc pop de push hl ld b,c push de ;save store location ld iy,DOS_GET_POSITION call dodos pop bc ;get store location back jr nc,fdgetpos_store ld hl,-1 ret .fdgetpos_store ld d,0 ;clear upper byte call l_plong ld hl,0 ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/fdtell.asm0000644000175000017500000000055207741511136021763 0ustar tygrystygrys; ; long fdtell(int fd) ; ; Return position in file ; ; Not written as yet! ; ; $Id: fdtell.asm,v 1.3 2003/10/10 11:05:02 dom Exp $ XLIB fdtell INCLUDE "#p3dos.def" XREF dodos .fdtell pop hl ;ret address pop bc ;lower 8 is file handle push bc push hl ld b,c ld iy,DOS_GET_POSITION call dodos ld d,0 ret c ld hl,-1 ld d,h ld e,l ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/findhand.c0000644000175000017500000000127507615522604021733 0ustar tygrystygrys/* * Routine to select a file number to open a file with * * +3DOS has 15 available file handles and we *have* * to specify which one we want * * djm 17/3/2000 * * $Id: findhand.c,v 1.2 2003/01/28 15:45:08 dom Exp $ */ #include /* One bit per file */ int hand_status = 3; int findhand() { #asm ld de,1 ld c,0 ld hl,(_hand_status) ld b,16 .loop srl h ;Shift flags one bit right rr l jr nc,gotone and a rl e ;Shift mask one bit left rl d inc c ;Increment file number djnz loop ld hl,-1 ;No more! scf ret ; Weve found a free handle - hurrah! .gotone ld hl,(_hand_status) call l_or ;Mark as used ld (_hand_status),hl ld l,c ld h,0 and a ret #endasm } z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/freehand.c0000644000175000017500000000123007742246247021732 0ustar tygrystygrys/* * Routine to free a file handle * * +3DOS has 15 available file handles and we *have* * to specify that we which one we want * * (Internal library routine) * * djm 17/3/2000 * * $Id: freehand.c,v 1.2 2003/10/12 12:44:23 dom Exp $ */ #include /* One bit per file */ extern int hand_status; void freehand(int handle) { #asm ; Enter with hl holding filehandle ; Exit: b = file handle scf ex af,af ld de,65534 ld a,l .loop and a jr z,gotone ex af,af rl e rl d ex af,af dec a jr loop ; Weve found a free handle - hurrah! .gotone ld hl,(_hand_status) call l_and ;Mark as used ld (_hand_status),hl ld b,l ret #endasm } z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/lseek.asm0000644000175000017500000000031507273540111021604 0ustar tygrystygrys; ; long fdtell(int fd, long posn, int whence) ; ; Set position in file ; ; Not written as yet! ; ; $Id: lseek.asm,v 1.1 2001/05/01 13:55:21 dom Exp $ XLIB lseek .lseek ld hl,-1 ld d,h ld e,l ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/Makefile0000644000175000017500000000054510630724403021443 0ustar tygrystygrys# # Makefile for +3 file support # # $Id: Makefile,v 1.7 2007/06/04 05:54:11 stefano Exp $ include ../../../Make.config all: close.o fabandon.o findhand.o freehand.o open.o open_z88.o \ read.o readbyte.o write.o writebyte.o $(LIBLINKER) -x../../../$(OUTPUT_DIRECTORY)/p3 @p3list .c.o: zcc +zx $(CFLAGS) -DPLUS3 $*.c clean: $(RM) *.o* zcc_opt.def z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/open.c0000644000175000017500000000322007741511136021107 0ustar tygrystygrys/* * open() for +3DOS * * djm 17/3/2000 * * Access is either * * O_RDONLY = 0 * O_WRONLY = 1 Starts afresh?!?!? * O_APPEND = 256 * * +3 notes: * Open a file for reading - e=1 d=0 * Open a file for writing - e=4, d=2 (creat) * Open a file for append - e=2, d=2 * * $Id: open.c,v 1.4 2003/10/10 11:05:02 dom Exp $ */ #include /* Or is it unistd.h, who knows! */ #include int open(far char *name, int flags, mode_t mode) { #asm INCLUDE "#p3dos.def" XREF dodos ld ix,2 add ix,sp ld a,(ix+3) ;flags high and a jr nz,ck_append ld a,(ix+2) and a ld de,$0001 ;read mode jr z,open_it ld de,$0204 ;write mode dec a jr z,open_it .open_abort ld hl,-1 ;invalid mode scf ret .ck_append dec a jr nz,open_abort ld a,(ix+2) and a jr nz,open_abort ;cant have low byte set ld de,$0202 ;append mode .open_it push de call findhand pop de jr c,open_abort push hl ;save handle number ld b,l ;b=file number ld c,3 ;exclusive read/write - who cares? ; Offset the stack so we have somewhere to store our nobbled name ; - we need to replace the '\0' with a 255 ld hl,-20 add hl,sp ;hl now points to filename ld sp,hl push de ;save open mode push bc ;save file etc push hl ;save filename ld e,(ix+4) ;filename ld d,(ix+5) ld b,15 .copyloop ld a,(de) and a jr z,endcopy ld (hl),a inc hl inc de djnz copyloop .endcopy ld (hl),255 pop hl pop bc pop de ld iy,DOS_OPEN call dodos ex af,af ;save flags ld hl,20 ;repair the stack after our storage add hl,sp ld sp,hl ex af,af pop hl ;file number back jr nc,open_abort ;error #endasm } z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/open_z88.c0000644000175000017500000000057407273540111021624 0ustar tygrystygrys/* * Spectrum +3 file support * * djm 30/4/2001 * * $Id: open_z88.c,v 1.1 2001/05/01 13:55:21 dom Exp $ */ #include #include #include int open_z88(far char *name, int flags, mode_t mode, char *buf,int len) { int hand; hand = open(name,flags,mode); if ( hand != -1 ) { strncpy(buf,(near char *)name,len); } return (hand); } z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/p3list0000644000175000017500000000016107273540111021137 0ustar tygrystygrysclose fabandon fdgetpos fdtell findhand freehand lseek open open_z88 read readbyte remove rename write writebyte z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/read.c0000644000175000017500000000107107741772513021073 0ustar tygrystygrys/* * Read bytes from file (+3DOS) * * 18/3/2000 djm * * $Id: read.c,v 1.4 2003/10/11 12:19:23 dom Exp $ */ #include size_t read(int handle, void *buf, size_t len) { #asm INCLUDE "#p3dos.def" XREF dodos ld ix,0 add ix,sp ld e,(ix+2) ;len ld d,(ix+3) ld a,d or e jr nz,read1 ex de,hl ;len=0 return 0 ret .read1 ld l,(ix+4) ;buf ld h,(ix+5) ld b,(ix+6) ;handle ld c,0 ;page FIXME push de ld iy,DOS_READ call dodos pop hl ;bytes we wanted to write ret c ;It was okay, we read them all sbc hl,de ;gives number written #endasm } z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/readbyte.c0000644000175000017500000000073607742616716021771 0ustar tygrystygrys/* * Read byte from file (+3DOS) * * 18/3/2000 djm * * Not user callable - internal LIB routine * * Enter with de = filehandle * * $Id: readbyte.c,v 1.4 2003/10/13 21:49:02 dom Exp $ */ #include int __FASTCALL__ readbyte(int handle) { #asm INCLUDE "#p3dos.def" XREF dodos pop bc ;for FASTCALL parameter is pushed on entry push bc ld b,c ;file handle ld iy,DOS_BYTE_READ call dodos ld hl,-1 ;EOF ccf jr c,end ;error ld l,c ld h,0 .end #endasm } z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/README0000644000175000017500000000063307273540111020662 0ustar tygrystygrysThis directory contains the start of some +3 support The plan for spectrum disc systems is to have a different library for each - this library contains the core routines: spec_clib.lib then calls these routines This seems to be the easiest way of making things work on different machines easily... This library doesn't contain file positioning etc routines $Id: README,v 1.1 2001/05/01 13:55:21 dom Exp $ z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/remove.asm0000644000175000017500000000055007741511136022004 0ustar tygrystygrys; ; z88dk - Spectrum +3 stdio Library ; ; djm 10/4/2000 ; ; int remove(far char *name) ; ; Being on a +3 we ignore the far stuff ; ; $Id: remove.asm,v 1.2 2003/10/10 11:05:02 dom Exp $ XLIB remove XREF dodos INCLUDE "#p3dos.def" .remove pop bc pop hl ;filename push hl push bc ld iy,DOS_DELETE call dodos ld hl,0 ret c ;OK dec hl ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/rename.asm0000644000175000017500000000053607741511136021762 0ustar tygrystygrys ; ; z88dk - Spectrum +3 stdio Library ; ; djm 10/4/2000 ; ; int rename(char *source, char *dest) ; ; $Id: rename.asm,v 1.2 2003/10/10 11:05:02 dom Exp $ XLIB rename XREF dodos INCLUDE "#p3dos.def" .rename pop bc pop de ;new filename pop hl ;old push hl push de push bc ld iy,DOS_RENAME call dodos ld hl,0 ret c ;OK dec hl ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/write.c0000644000175000017500000000105507741511136021304 0ustar tygrystygrys/* * Read bytes from file (+3DOS) * * 18/3/2000 djm * * $Id: write.c,v 1.2 2003/10/10 11:05:02 dom Exp $ */ #include size_t write(int handle, void *buf, size_t len) { #asm INCLUDE "#p3dos.def" XREF dodos ld ix,0 add ix,sp ld e,(ix+2) ;len ld d,(ix+3) ld a,d or e jr nz,write1 ex de,hl ;len=0 return 0 ret .write1 ld l,(ix+4) ;buf ld h,(ix+5) ld b,(ix+6) ;handle ld c,0 ;page FIXME push de ld iy,DOS_WRITE call dodos pop hl ;bytes we wanted to write ret c ;it went okay sbc hl,de ;gives number written #endasm } z88dk-1.8.ds1/libsrc/fcntl/spectrum/plus3/writebyte.c0000644000175000017500000000103607741511136022167 0ustar tygrystygrys/* * Write byte to file (+3DOS) * * 18/3/2000 djm * * Not user callable - internal LIB routine * * Enter with de = filehandle * c = byte to write * * $Id: writebyte.c,v 1.3 2003/10/10 11:05:02 dom Exp $ */ #include int writebyte(int handle, int byte) { #asm INCLUDE "#p3dos.def" XREF dodos pop bc pop hl ;byte pop de ;handle push de push hl push bc ld c,l ;byte ld b,e ;file handle ld iy,DOS_BYTE_WRITE push bc ;keep byte call dodos pop bc ld hl,-1 ;EOF ccf ret c ;error ld l,c ld h,0 #endasm } z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/0000755000175000017500000000000010765202715020602 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/close.asm0000755000175000017500000000154510641013424022407 0ustar tygrystygrys; ; Close a file by the BASIC driver ; NOTE: We don't set a drive number, here ; ; Stefano - 5/7/2006 ; ; int close(int handle) ; ; $Id: close.asm,v 1.4 2007/06/28 20:16:20 stefano Exp $ XLIB close LIB zxhandl LIB zx_setint LIB zx_goto ; BASIC variable names for numeric values .svar defb 'S',0 .close pop hl pop bc push bc push hl ld a,c cp 3 jr z,islpt ld hl,svar push hl ; BASIC variable S push bc ; file handle (stream #) call zx_setint pop de pop hl ld hl,zxhandl xor a add hl,de ld (hl),a ; free flag for handle ; note: here we could prevent the "special" ; stream numbers from being closed ld hl,7550 ; BASIC routine for "close" .goto_basic call zx_goto ld hl,0 ret ; If we had stream #3 then jump here.. it is a printer device .islpt ld bc,7750 ; BASIC routine for "close printer device" jr goto_basic z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/creat.asm0000755000175000017500000000064310457246176022417 0ustar tygrystygrys; ; Create a file by the BASIC driver (open then close) ; ; Stefano - 5/7/2006 ; ; int creat(far char *name, mode_t mode); ; ; $Id: creat.asm,v 1.1 2006/07/18 21:02:54 stefano Exp $ XLIB creat LIB open LIB close .creat pop bc pop hl push hl push bc push bc push bc push hl call open pop bc pop bc pop bc ld a,h or l cp 255 ; -1 => error ? ret z push hl call close pop hl ld hl,0 ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/fdgetpos.asm0000755000175000017500000000023410457246176023130 0ustar tygrystygrys; ; fdgetpos: forget it ! ; ; Stefano - 5/7/2006 ; ; ; $Id: fdgetpos.asm,v 1.1 2006/07/18 21:02:54 stefano Exp $ XLIB fdgetpos .fdgetpos ld hl,-1 ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/fdtell.asm0000755000175000017500000000025310457246176022570 0ustar tygrystygrys; ; fdtell: ..see fdgetpos ! ; ; Stefano - 5/7/2006 ; ; ; $Id: fdtell.asm,v 1.1 2006/07/18 21:02:54 stefano Exp $ XLIB fdtell .fdtell ld hl,-1 ld d,h ld e,l ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/lseek.asm0000755000175000017500000000030310457246176022415 0ustar tygrystygrys; ; lseek: ..see fdgetpos and fdtell ! ; ; Stefano - 5/7/2006 ; ; ; $Id: lseek.asm,v 1.1 2006/07/18 21:02:54 stefano Exp $ XLIB lseek .lseek ld hl,-1 ;non zero is error ld d,h ld e,l ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/Makefile0000755000175000017500000000054510630724403022243 0ustar tygrystygrys# # Makefile for the ZX BASIC driver # (basic driven hardware abstraction layer) # # $Id: Makefile,v 1.3 2007/06/04 05:54:11 stefano Exp $ include ../../../Make.config all: open_z88.o read.o write.o $(LIBLINKER) -x../../../$(OUTPUT_DIRECTORY)/zxbasdrv @zxbdlst .c.o: zcc +zx $(CFLAGS) $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/open.asm0000755000175000017500000000270110641013424022236 0ustar tygrystygrys; ; Open a file by the BASIC driver ; ; Stefano - 5/7/2006 ; ; int open(char *name, int flags, mode_t mode) ; ; $Id: open.asm,v 1.4 2007/06/28 20:16:20 stefano Exp $ XLIB open LIB zxhandl LIB zx_setint LIB zx_goto LIB zxgetfname ; BASIC variable names for numeric values .fvar defb 'F',0 .svar defb 'S',0 .open ld hl,2 add hl,sp inc hl inc hl push hl ld de,fvar ; BASIC variable F push de ld b,(hl) ; mode flag inc hl ld c,(hl) push bc call zx_setint pop bc pop bc pop hl inc hl inc hl call zxgetfname ; HL is pointing to file name cp 16 ; drive "P:" ? jr z,islpt ; if so, it is a printer ! ld b,0 ld hl,zxhandl .hloop ld a,(hl) cp 255 jr nz,notlast ld hl,-1 ; error, no more free handles ret .notlast and a jr z,hfound inc hl inc b jr hloop .hfound inc a ld (hl),a ld c,b ld b,0 ld hl,svar ; BASIC variable S push hl push bc ; file handle call zx_setint pop bc pop hl push bc ; save file handle ; BASIC routine for "open" ld hl,7500 ; now it is __FASTCALL__ call zx_goto pop hl ; file handle push hl ld a,l add a,a add a,$16 ld l,a ld h,$5c ld e,(hl) inc hl ld d,(hl) ld a,d or e pop hl ; file handle ret nz ld hl,-1 ; stream isn't open: file not found ! ret ; Drive "P::" is a unix style device for printer ; We call BASIC to init the #3 stream .islpt ld hl,7700 ; BASIC routine for "init printer device" call zx_goto ld hl,3 ; force stream #3 as file handle ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/open_z88.c0000755000175000017500000000056310457246176022436 0ustar tygrystygrys/* * Took "as is" fron the Dominic's files * * $Id: open_z88.c,v 1.1 2006/07/18 21:02:54 stefano Exp $ */ #include #include #include int open_z88(far char *name, int flags, mode_t mode, char *buf,int len) { int hand; hand = open(name,flags,mode); if ( hand != -1 ) { strncpy(buf,(near char *)name,len); } return (hand); } z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/read.c0000755000175000017500000000056610630555202021664 0ustar tygrystygrys/* * Part of the library for fcntl * * size_t read(int fd,void *ptr, size_t len) * * ----- * $Id: read.c,v 1.2 2007/06/03 15:13:06 stefano Exp $ */ #include #include size_t read(int fd, void *ptr, size_t len) { int i; for ( i = 0; i < len ; i++ ) { if ( ( ptr[i] = readbyte(fd) ) == -1 ) { return i; } } return i; } z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/readbyte.asm0000755000175000017500000000200210641013424023066 0ustar tygrystygrys; ; Read a byte by the BASIC driver ; It is based on the INPUT-AD ROM routines, designed to get a char ; from the current stream. We trap errors too, because it happens ; that the shadow roms prefer to stop directly when an EOF is reached. ; ; Stefano - 5/7/2006 ; ; int __LIB__ __FASTCALL__ readbyte(int handle) ; ; $Id: readbyte.asm,v 1.3 2007/06/28 20:16:20 stefano Exp $ XLIB readbyte .readbyte ld a,l call $1601 ld bc,($5c3d) push bc ; save original ERR_SP ld bc,error push bc ld ($5c3d),sp ; update error handling routine .again call $15e6 ; INPUT-AD ccf ; we adapt the carry condition to the Z88DK requirements ld h,0 ld l,a jr nc,gotchar jr z,again ; No new char present.. try again ; We'll fall here rarely, I think ld hl,-1 ; EOF .gotchar pop bc pop bc ld ($5c3d),bc ; restore orginal ERR_SP ret ; Errors ? Probably it's an EOF ! .error pop bc ld ($5c3d),bc ; restore orginal ERR_SP ld (iy+0),255 ; reset ERR_NR ld (iy+124),0 ; clear FLAGS3 scf ccf ld hl,-1 ; EOF ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/remove.asm0000755000175000017500000000046710641013424022601 0ustar tygrystygrys; ; Delete a file by the BASIC driver ; ; Stefano - 5/7/2006 ; ; int remove(char *name) ; ; $Id: remove.asm,v 1.3 2007/06/28 20:16:20 stefano Exp $ XLIB remove LIB zx_goto LIB zxgetfname .remove pop bc pop hl push hl push bc call zxgetfname ld hl,7900 ; BASIC routine for "erase" jp zx_goto z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/rename.asm0000755000175000017500000000104010641013424022537 0ustar tygrystygrys; ; Rename a file by the BASIC driver ; NOTE: We don't set a drive number, here ; ; Stefano - 5/7/2006 ; ; specify drive no. in old drive ; ; int rename(char *oldname, char *newname) ; ; $Id: rename.asm,v 1.3 2007/06/28 20:16:20 stefano Exp $ XLIB rename LIB zx_setstr LIB zx_goto LIB zxgetfname .rename pop bc pop de pop hl push hl push de push bc push de call zxgetfname ; HL points to old name and drive specification ld h,0 ld l,'O' ; O$ call zx_setstr pop de ld hl,7950 ; BASIC routine for "rename" jp zx_goto z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/write.c0000755000175000017500000000056410630555202022101 0ustar tygrystygrys/* * Part of the library for fcntl * * size_t write(int fd,void *ptr, size_t len) * * ----- * $Id: write.c,v 1.2 2007/06/03 15:13:06 stefano Exp $ */ #include #include size_t write(int fd, void *ptr, size_t len) { int i; for ( i = 0; i < len ; i++ ) { if ( writebyte(fd,ptr[i]) == -1 ) { return i; } } return i; } z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/writebyte.asm0000755000175000017500000000123610641013424023315 0ustar tygrystygrys; ; Write a byte by the BASIC driver ; ; Stefano - 5/7/2006 ; ; int writebyte(int handle, int byte) ; ; $Id: writebyte.asm,v 1.3 2007/06/28 20:16:20 stefano Exp $ XLIB writebyte .writebyte pop bc pop de pop hl push hl push de push bc ld bc,($5c3d) push bc ; save original ERR_SP ld bc,error push bc ld ($5c3d),sp ; update error handling routine push de ld a,l ; stream # (handle) call $1601 pop de ld a,e push af rst 16 pop af ld h,0 ld l,a pop bc pop bc ld ($5c3d),bc ; restore orginal ERR_SP ret .error pop bc ld ($5c3d),bc ; restore orginal ERR_SP ld (iy+0),255 ; reset ERR_NR ld (iy+124),0 ; clear FLAGS3 ld hl,-1 ; EOF ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/zx_hardcopy.asm0000755000175000017500000000040610641013424023627 0ustar tygrystygrys; ; Just enter BASIC at the "Hardcopy" line ; ; Stefano - 12/7/2006 ; ; void zx_hardcopy() ; ; $Id: zx_hardcopy.asm,v 1.3 2007/06/28 20:16:20 stefano Exp $ XLIB zx_hardcopy LIB zx_goto .zx_hardcopy ld hl,7800 ; BASIC routine for "hardcopy" jp zx_goto z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/zx_load_block.asm0000644000175000017500000000154410642375563024130 0ustar tygrystygrys; ; Load a whole file by the BASIC driver ; ; Stefano - 28/06/2007 ; ; int zx_load_block(char *name, void *addr, size_t len) ; ; $Id: zx_load_block.asm,v 1.1 2007/07/03 07:32:03 stefano Exp $ XLIB zx_load_block LIB zx_setint LIB zx_goto LIB zxgetfname ; BASIC variable name .avar defb 'A',0 .lvar defb 'L',0 .zx_load_block pop af pop bc pop hl pop de push de push hl push bc push af push hl push bc ld hl,lvar ; BASIC variable L push hl push de ; size call zx_setint pop de pop hl pop bc ld hl,avar ; BASIC variable A push hl push bc ; ptr to address call zx_setint pop bc pop hl call zxgetfname ; HL is pointing to file name pop hl ;7600 - LOAD block ;a=address or 0 if unspecified ;l=length or 0 if unspecified ;d=drive number ;n$=file name ld hl,7600 call zx_goto ld a,l ld hl,0 and a ret z dec hl ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/zx_save_block.asm0000644000175000017500000000147310642375563024150 0ustar tygrystygrys; ; Load a whole file by the BASIC driver ; ; Stefano - 28/06/2007 ; ; int zx_save_block(char *name, void *addr, size_t len) ; ; $Id: zx_save_block.asm,v 1.1 2007/07/03 07:32:03 stefano Exp $ XLIB zx_save_block LIB zx_setint LIB zx_goto LIB zxgetfname ; BASIC variable name .avar defb 'A',0 .lvar defb 'L',0 .zx_save_block pop af pop bc pop hl pop de push de push hl push bc push af push hl push bc ld hl,lvar ; BASIC variable L push hl push de ; size call zx_setint pop de pop hl pop bc ld hl,avar ; BASIC variable A push hl push bc ; ptr to address call zx_setint pop bc pop hl call zxgetfname ; HL is pointing to file name pop hl ;7650 - SAVE block ;a=addess ;l=length ;d=drive number ;n$=file name ld hl,7650 call zx_goto ld a,l ld hl,0 and a ret z dec hl ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/zxbdlst0000755000175000017500000000022610642375563022230 0ustar tygrystygryszxhandl close creat fdgetpos fdtell lseek open open_z88 read readbyte remove rename write writebyte zx_load_block zx_save_block zx_hardcopy zxgetfnamez88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/zxgetfname.asm0000755000175000017500000000226310457246176023471 0ustar tygrystygrys; ; Init BASIC variables for file name and drive number ; ; Stefano - 13/7/2006 ; ; Internal use only. ; To be called with HL pointing to the file name; ; This routine will eventually strip the header and update ; the 'D' BASIC variable with the drive number. ; N$ will always hold the file name ; ; $Id: zxgetfname.asm,v 1.1 2006/07/18 21:02:54 stefano Exp $ XLIB zxgetfname LIB zx_setint LIB zx_setstr ; BASIC variable names for numeric values .dvar defb 'D',0 .zxgetfname ld e,(hl) ; pointer to file name inc hl ld d,(hl) inc de ld a,(de) cp ':' ; is a drive specified ? dec de jr nz,default ld a,(de) cp 59 jr nc,nonum sub 48 jr wasnum .nonum and 95 ; to upper sub 64 ; now 'A' = drive 1, etc.. .wasnum inc de ; now skip the first 2 chars ('a:' or similar) inc de jr nodefault .default ld a,1 ; force default: first drive .nodefault ld b,0 ld c,a push af ; keep the "drive number", can be useful ;o) push de ld hl,dvar ; BASIC variable 'D' push hl push bc call zx_setint pop bc pop hl pop de jr drvnum .drvnum ld h,0 ld l,'N' ; n$ push hl push de call zx_setstr pop hl pop bc pop af ; drive number (to check if printer, etc) ret z88dk-1.8.ds1/libsrc/fcntl/spectrum/zxbasdrv/zxhandl.asm0000755000175000017500000000073510457246177022774 0ustar tygrystygrys; ; BASIC driver support file, used by "open" and "close" ; ; Stefano - 5/7/2006 ; ; $Id: zxhandl.asm,v 1.1 2006/07/18 21:02:55 stefano Exp $ XLIB zxhandl ; handles: list of used streams, we keep #14 an #15 reserved, ; 10 files open at once should be enough. ; #3 is used for printer, #1 and #2 are used by BASIC ; ; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 .zxhandl defb 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 255 z88dk-1.8.ds1/libsrc/fcntl/sprinter/0000755000175000017500000000000010765202715016743 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/sprinter/close.c0000644000175000017500000000070407547121567020226 0ustar tygrystygrys/* * Part of the library for fcntlt * * int close(int fd) * * djm 27/4/99 * * Close a file descriptor, pretty well identical to * fclose from the other stuff * * ----- * $Id: close.c,v 1.1 2002/10/03 20:07:19 dom Exp $ */ #include int close(int fd) { #asm pop bc pop hl push hl push bc ld a,l ld c,$12 ;CLOSE rst $10 ld hl,0 ret nc dec hl #endasm } z88dk-1.8.ds1/libsrc/fcntl/sprinter/creat.c0000644000175000017500000000077607547121567020230 0ustar tygrystygrys/* * Part of the library for fcntlt * * int creat(char *name,mode_t mode) * * djm 27/4/99 * * ----- * $Id: creat.c,v 1.1 2002/10/03 20:07:19 dom Exp $ */ #include /* Or is it unistd.h, who knows! */ int creat(far char *name, mode_t mode) { #asm ld ix,0 add ix,sp ld l,(ix+4) ;lower 16 of filename ld h,(ix+5) xor a ;normal file ld c,$0b ;CREAT NEW FILE rst $10 ld hl,-1 ret c ld a,l ld h,0 #endasm } z88dk-1.8.ds1/libsrc/fcntl/sprinter/fdgetpos.asm0000644000175000017500000000113107547121570021257 0ustar tygrystygrys; Sprinter fcntl library ; ; $Id: fdgetpos.asm,v 1.1 2002/10/03 20:07:20 dom Exp $ ; XLIB fdgetpos ;int fgetpos(int fd, long *dump) ; ;Dumps in dump the file position, and returns 0 if all went well .fdgetpos pop bc pop de ;dump pop hl ;fd push hl push de push bc push de ;save it for later ld a,l ld hl,0 ld ix,0 ld b,1 ;from current position ld c,$15 ;MOVE_FP rst $10 pop de ;where to store it jr nc,fdgetpos_ret ld hl,-1 ret .fdgetpos_ret ex de,hl ld (hl),e inc hl ld (hl),d inc hl push ix pop de ld (hl),e inc hl ld (hl),d ld hl,0 ;all ok ret z88dk-1.8.ds1/libsrc/fcntl/sprinter/fdtell.asm0000644000175000017500000000061407547121570020723 0ustar tygrystygrys; Sprinter fcntl library ; ; $Id: fdtell.asm,v 1.1 2002/10/03 20:07:20 dom Exp $ ; XLIB fdtell ;int fdtell(int fd) ; ;Dumps in dump the file position, and returns 0 if all went well .fdtell pop bc pop hl ;fd push hl push bc ld a,l ld hl,0 ld ix,0 ld b,1 ;from current position ld c,$15 ;MOVE_FP rst $10 push ix pop de ret nc ;was ok ld hl,-1 ld de,-1 ret z88dk-1.8.ds1/libsrc/fcntl/sprinter/getcwd.c0000644000175000017500000000115107566770174020400 0ustar tygrystygrys/* * Part of the library for fcntlt * * char *getcwd(char *buf, size_t size); * * djm 27/4/99 * * Close a file descriptor, pretty well identical to * fclose from the other stuff * * ----- * $Id: getcwd.c,v 1.1 2002/11/20 20:28:44 dom Exp $ */ #include #include #include char *getcwd(char *buf,size_t size) { static char mybuf[256]; if ( ( getwd(mybuf) ) == NULL ) { return NULL; } /* Extension to POSIX - incompatible with glibc */ if ( buf == NULL ) return mybuf; strncpy(buf,mybuf,size-1); mybuf[size-1] = 0; return buf; } z88dk-1.8.ds1/libsrc/fcntl/sprinter/getwd.asm0000644000175000017500000000044307566770174020576 0ustar tygrystygrys; Sprinter fcntl library ; ; $Id: getwd.asm,v 1.1 2002/11/20 20:28:44 dom Exp $ ; XLIB getwd ;int getwd(char *buf); ; NB buf must be at least 256 bytes .getwd pop bc pop hl push hl push bc push hl ld c,$1E ;CURDIR rst $10 pop hl ret nc ld hl,0 ;error ret z88dk-1.8.ds1/libsrc/fcntl/sprinter/lseek.c0000644000175000017500000000145507565164352020227 0ustar tygrystygrys/* * Part of the library for fcntlt * * long lseek(int fd,long posn, int whence) * * djm 27/4/99 * * whence= * * 0 SEEK_SET from start of file * 1 SEEK_CUR from current position * 2 SEEK_END from end of file (always -ve) * * ----- * $Id: lseek.c,v 1.2 2002/11/15 12:30:34 dom Exp $ */ #include /* Or is it unistd.h, who knows! */ long lseek(int fd, long posn, int whence) { #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld b,(ix+2) ;whence ld e,(ix+4) ;file position ld d,(ix+5) ld l,(ix+6) ;needs to go into ix at some point ld h,(ix+7) ld a,(ix+8) ;fd push de pop ix ld c,$15 ;MOVE_FP rst $10 jr nc,lseek_ret ld hl,-1 ld de,-1 ret .lseek_ret push ix pop de #endasm } z88dk-1.8.ds1/libsrc/fcntl/sprinter/Makefile0000644000175000017500000000073010763607627020414 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.5 2008/03/05 20:35:46 dom Exp $ include ../../Make.config CFILES = \ close.c \ creat.c \ lseek.c \ open.c \ open_z88.c \ read.c \ write.c \ writebyte.c \ readbyte.c \ getcwd.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) z88_fcntl: $(OBJECTS) .c.o: zcc +pps $(CFLAGS) $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* *.i $(AFILES) z88dk-1.8.ds1/libsrc/fcntl/sprinter/mkdir.asm0000644000175000017500000000042007566770174020565 0ustar tygrystygrys; Sprinter fcntl library ; ; $Id: mkdir.asm,v 1.1 2002/11/20 20:28:44 dom Exp $ ; XLIB mkdir ;int mkdir(char *path, mode_t mode) .mkdir pop bc pop de pop hl push hl push de push bc ld c,$1B ;MKDIR rst $10 ld hl,0 ret nc dec hl ;-1 ret z88dk-1.8.ds1/libsrc/fcntl/sprinter/open.c0000644000175000017500000000104007547121570020046 0ustar tygrystygrys/* * Part of the library for fcntlt * * int open(char *name,int access, mode_t mode) * * djm 3/10/2002 * * Flags is one of: O_RDONLY, O_WRONLY, O_RDWR * Or'd with any of: O_CREAT, O_TRUNC, O_APPEND * * All others are ignored(!) * * ----- * $Id: open.c,v 1.1 2002/10/03 20:07:20 dom Exp $ */ #include /* Or is it unistd.h, who knows! */ int open(far char *name, int flags, mode_t mode) { char buffer[10]; /* Buffer for expansion */ return (open_z88(name,flags,mode,buffer,9)); } z88dk-1.8.ds1/libsrc/fcntl/sprinter/open_z88.c0000644000175000017500000000232307547121570020564 0ustar tygrystygrys/* * Part of the library for fcntl * * int open(char *name,int access, mode_t mode) * * djm 27/4/99 * * Access is either * * Flags is one of: O_RDONLY, O_WRONLY, O_RDWR * Or'd with any of: O_CREAT, O_TRUNC, O_APPEND * * All others are ignored(!) - i.e. mode is ignored * * djm 24/3/2000 - Takes a buffer for expanded filename * * ----- * $Id: open_z88.c,v 1.1 2002/10/03 20:07:20 dom Exp $ */ #include /* Or is it unistd.h, who knows! */ int open_z88(far char *name, int flags, mode_t mode, char *buf, size_t len) { #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld l,(ix+10) ;lower 16 of filename ld h,(ix+11) ld e,(ix+4) ld d,(ix+5) ld c,(ix+2) ld b,(ix+3) ; Copy the filename across .open_loop ld a,b or c jr z,open_loopexit ld a,(hl) ld (de),a and a jr z,open_loopexit inc hl inc de dec bc jr open_loop .open_loopexit ld l,(ix+10) ld h,(ix+11) ld a,(ix+8) ld c,1 and a ;O_RDONLY jr z,open_forreal ld c,2 dec a ;O_WRONLY jr z,open_forreal ld c,0 dec a ;O_RDWR .open_forreal ld a,c ld c,$11 ;OPEN rst $10 ld hl,-1 ret c ld l,a ld h,0 #endasm } z88dk-1.8.ds1/libsrc/fcntl/sprinter/read.c0000644000175000017500000000147707547121570020036 0ustar tygrystygrys/* * Part of the library for fcntlt * * size_t read(int fd,void *ptr, size_t len) * * djm 27/4/99 * * Close a file descriptor, pretty well identical to * fclose from the other stuff * * ----- * $Id: read.c,v 1.1 2002/10/03 20:07:20 dom Exp $ */ #include #include size_t read(int fd, void *ptr, size_t len) { #asm ld ix,2 add ix,sp ld e,(ix+0) ;len ld d,(ix+1) ld l,(ix+2) ;ptr ld h,(ix+3) ld a,(ix+4) ;fd ; Its not entirely clear what happens in the system call (estex.cpp ; isnt much help), we will assume that de always contains the ; number of bytes read ld c,$13 ;READ rst $10 ex de,hl ret nc ;we did some reading ld hl,-1 ;error #endasm } z88dk-1.8.ds1/libsrc/fcntl/sprinter/readbyte.c0000644000175000017500000000075607727704034020723 0ustar tygrystygrys/* * Sprinter fcntl library * * readbyte(fd) - Read byte from file * * ----- * $Id: readbyte.c,v 1.2 2003/09/10 20:22:52 dom Exp $ */ #include #include int __FASTCALL__ readbyte(int fd) { #asm pop de ;get fd push de ;restore fd push de ;make somespace ld hl,0 add hl,sp ld a,e ;fd now in e ld de,1 ;length to read ld c,$13 ;READ rst $10 pop de ;e holds the read value ld hl,-1 ret c ;error, return EOF ld l,e ld h,0 #endasm } z88dk-1.8.ds1/libsrc/fcntl/sprinter/remove.asm0000644000175000017500000000054707727704034020755 0ustar tygrystygrys; Sprinter fcntl library ; ; $Id: remove.asm,v 1.2 2003/09/10 20:22:52 dom Exp $ ; XLIB remove ;int remove(char *name) .remove pop de pop hl ;dest filename push hl push de ld c,$0E ;DELETE rst $10 ld hl,0 ret nc dec hl ;=1 ret z88dk-1.8.ds1/libsrc/fcntl/sprinter/rename.asm0000644000175000017500000000066607727704034020731 0ustar tygrystygrys; Sprinter fcntl library ; ; $Id: rename.asm,v 1.2 2003/09/10 20:22:52 dom Exp $ ; XLIB rename ;int rename(char *s1,char *s2) ;on stack: ;return address,s2,s1 ;s1=orig filename, s2=dest filename .rename pop bc pop de ;dest filename pop hl ;orig filename push hl push de push bc ld c,$10 ;REANAME rst $10 ld hl,0 ret nc dec hl ret z88dk-1.8.ds1/libsrc/fcntl/sprinter/rmdir.asm0000644000175000017500000000042007566770174020574 0ustar tygrystygrys; Sprinter fcntl library ; ; $Id: rmdir.asm,v 1.1 2002/11/20 20:28:44 dom Exp $ ; XLIB rmdir ;int rmdir(char *path, mode_t mode) .rmdir pop bc pop de pop hl push hl push de push bc ld c,$1C ;RMDIR rst $10 ld hl,0 ret nc dec hl ;-1 ret z88dk-1.8.ds1/libsrc/fcntl/sprinter/write.c0000644000175000017500000000133007547121570020241 0ustar tygrystygrys/* * Part of the library for fcntl * * size_t write(int fd,void *ptr, size_t len) * * djm 27/4/99 * * Close a file descriptor, pretty well identical to * fclose from the other stuff * * ----- * $Id: write.c,v 1.1 2002/10/03 20:07:20 dom Exp $ */ #include #include size_t write(int fd, void *ptr, size_t len) { #asm INCLUDE "#fileio.def" ld ix,2 add ix,sp ld e,(ix+0) ;len ld d,(ix+1) ld l,(ix+2) ;ptr ld h,(ix+3) ld a,(ix+4) ;fd ld c,$14 ;WRITE ; Making the same assumptions as read() rst $10 ex de,hl ret nc ld hl,-1 #endasm } z88dk-1.8.ds1/libsrc/fcntl/sprinter/writebyte.c0000644000175000017500000000077407727704034021142 0ustar tygrystygrys/* * Sprinter fcntl library * * writebyte(int fd, int c) - Read byte from file * * ----- * $Id: writebyte.c,v 1.2 2003/09/10 20:22:52 dom Exp $ */ #include #include int writebyte(int fd, int byte) { #asm ld ix,2 add ix,sp ld a,(ix+2) ;fd push ix pop hl ld de,1 ld c,$14 ;WRITE push hl rst $10 pop hl ld hl,-1 pop de ret c ;error! ld a,(de) ;success, return with value written ld l,a ld h,0 #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/0000755000175000017500000000000010765202715015526 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/z88/brotherdor.c0000644000175000017500000000072407267325734020061 0ustar tygrystygrys/* * Close a DOR * * void brotherdor(int handle, char *type) * * Returns son of current dor (old dor invalid) * * djm 13/3/2000 * * ----- * $Id: brotherdor.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include int brotherdor(int handle, char *type) { #asm INCLUDE "#dor.def" pop de pop ix push ix push de ld a,DR_Sib call_oz(os_dor) pop de pop hl ld (hl),a ;store minor type push hl push de push ix pop hl ;return SON dor #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/close.c0000644000175000017500000000123007267325734017005 0ustar tygrystygrys/* * Part of the library for fcntlt * * int close(int fd) * * djm 27/4/99 * * Close a file descriptor, pretty well identical to * fclose from the other stuff * * ----- * $Id: close.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include int close(int fd) { #asm INCLUDE "#fileio.def" pop bc pop hl push hl push bc ld a,h or l jr nz,l_close1 .l_close0 ld hl,-1 ret .l_close1 push hl pop ix call_oz(gn_cl) jr c,l_close0 ld hl,0 #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/closedor.c0000644000175000017500000000044407267325734017520 0ustar tygrystygrys/* * Close a DOR * * void closedor(int handle) * * djm 13/3/2000 * * ----- * $Id: closedor.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include void closedor(int handle) { #asm INCLUDE "#dor.def" pop de pop ix push ix push de ld a,DR_Fre call_oz(os_dor) #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/creat.c0000644000175000017500000000214607267325734017005 0ustar tygrystygrys/* * Part of the library for fcntlt * * int creat(char *name,mode_t mode) * * djm 27/4/99 * * ----- * $Id: creat.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include /* Or is it unistd.h, who knows! */ int creat(far char *name, mode_t mode) { #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld e,(ix+4) ;lower 16 of filename ld d,(ix+5) ld b,(ix+6) ;bank for filename ld a,2 ;write starts from the start?!?!? ld hl,-10 add hl,sp ld sp,hl ex de,hl ;swap where to expand and filename over ld c,10 ;maximum length of expanded filename call_oz(gn_opf) ex af,af ld hl,10 add hl,sp ld sp,hl ;restore our stack (we did nothing to it!) ex af,af ld hl,-1 ret c ;open error push ix ;get filedescriptor in ix into hl pop hl #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/deletedor.c0000644000175000017500000000044707267325734017660 0ustar tygrystygrys/* * Close a DOR * * void deletedor(int handle) * * djm 13/3/2000 * * ----- * $Id: deletedor.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include void deletedor(int handle) { #asm INCLUDE "#dor.def" pop de pop ix push ix push de ld a,DR_Del call_oz(os_dor) #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/fdgetpos.asm0000644000175000017500000000153207742626771020061 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; ; 11/3/99 djm ***UNTESTED*** ; ; ; $Id: fdgetpos.asm,v 1.2 2003/10/13 22:58:01 dom Exp $ ; INCLUDE "#fileio.def" XLIB fdgetpos ;int fgetpos(int fd, long *dump) ; ;Dumps in dump the file position, and returns 0 if all went well .fdgetpos pop bc pop de ;dump pop ix ;fd push ix push de push bc push de ;store dumping place ld a,fa_ptr call_oz(os_frm) pop hl ;dumping place jr c,fdgetpos_error ld (hl),c ;store the file posn now inc hl ld (hl),b inc hl ld (hl),e inc hl ld (hl),d ld hl,0 ;no errors ret .fdgetpos_error ld hl,-1 ret z88dk-1.8.ds1/libsrc/fcntl/z88/fdtell.asm0000644000175000017500000000115007730052561017477 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; ; 11/3/99 djm ***UNTESTED*** ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; ; ; $Id: fdtell.asm,v 1.2 2003/09/11 10:58:57 dom Exp $ ; INCLUDE "#fileio.def" XLIB fdtell ;long fdtell(int fd) .fdtell pop bc ;ret pop ix ;fd push ix push bc ld a,fa_ptr call_oz(os_frm) push bc ;get the var into our preferred regs pop hl ret nc ;Error, return with -1 ld hl,65535 ld d,h ld e,l ret z88dk-1.8.ds1/libsrc/fcntl/z88/lseek.c0000644000175000017500000000453307267325734017014 0ustar tygrystygrys/* * Part of the library for fcntlt * * long lseek(int fd,long posn, int whence) * * djm 27/4/99 * * whence= * * 0 SEEK_SET from start of file * 1 SEEK_CUR from current position * 2 SEEK_END from end of file (always -ve) * * ----- * $Id: lseek.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include /* Or is it unistd.h, who knows! */ long lseek(int fd, long posn, int whence) { #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld a,(ix+2) ;whence ld e,(ix+8) ld d,(ix+9) ;fd and a jp nz,l_offset ; SEEK_SET, set from start of file ld hl,4 add hl,sp ;points to posn(vector) push de pop ix ld a,FA_PTR call_oz(os_fwm) .l_exit ld hl,-1 ;load hlde with -1L ld de,-1 ret c ;error ; Get the position of the file, use frm to do it ld a,fa_ptr call_oz(os_frm) ;must succeed if we get this far! ld l,c ;hl=bc ld h,b ret .l_offset cp 2 ;check to see if in range ccf jr c,l_exit ; SEEK_CUR, SEEK_END set from current position ; Rather conveniently the values wanted by OZ coincide with UNIX ; values! So just leave a as it is! ; ; - Read the current file positon/eof position ; - Add the value to the one we want ; - Set file position ; - jp l_exit call_oz(os_frm) .l_offsetcont jr c,l_exit ;exit with -1 ld l,c ld h,b exx ;keep debc safe ld hl,7 ;pick up required position add hl,sp ld d,(hl) dec hl ld e,(hl) dec hl ld a,(hl) dec hl ld l,(hl) ld h,a push de ;push (requirement of l_long_add) push hl exx call l_long_add ;dehl=new position push de push hl ld hl,0 add hl,sp ld a,FA_PTR call_oz(os_fwm) pop bc ;discard stored length pop bc jr l_exit #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/Makefile0000644000175000017500000000113510763607630017171 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.7 2008/03/05 20:35:46 dom Exp $ include ../../Make.config CFILES = \ close.c \ creat.c \ lseek.c \ open.c \ open_z88.c \ nropen.c \ read.c \ write.c \ writebyte.c \ readbyte.c \ stat.c \ opendor.c \ readdor.c \ closedor.c \ writedor.c \ deletedor.c \ sondor.c \ brotherdor.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) z88_fcntl: $(OBJECTS) .c.o: zcc +z88 $(CFLAGS) $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* *.i $(AFILES) z88dk-1.8.ds1/libsrc/fcntl/z88/nropen.c0000644000175000017500000000254507267325734017213 0ustar tygrystygrys/* * Part of the library for fcntl * * int nropen(char *name,int access, mode_t mode) * * djm 27/4/99 * * Access is either * * O_RDONLY = 0 * O_WRONLY = 1 Starts afresh?!?!? * O_APPEND = 256 * * All others are ignored(!) - i.e. mode is ignored * * We open a file with a near filespec - good for devices * since they don't have the startup code * * djm 15/4/2000 * * ----- * $Id: nropen.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include /* Or is it unistd.h, who knows! */ int nropen(char *name, int flags, mode_t mode, char *buf, size_t len) { #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld l,(ix+10) ;lower 16 of filename ld h,(ix+11) ld b,0 ld a,(ix+8) ;access flags ld c,(ix+9) ;top 8 of flags bit 0,c ;append! jr z,l_open1 ld a,2 ;OZ append mode-1 .l_open1 inc a ;convert from UNIX mode to OZ flags ld e,(ix+4) ;buf ld d,(ix+5) ld c,(ix+2) ;maximum length of expanded filename call_oz(gn_opf) ld hl,-1 ret c ;open error push ix ;get filedescriptor in ix into hl pop hl #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/open.c0000644000175000017500000000105407267325734016645 0ustar tygrystygrys/* * Part of the library for fcntlt * * int open(char *name,int access, mode_t mode) * * djm 27/4/99 * * Access is either * * O_RDONLY = 0 * O_WRONLY = 1 Starts afresh?!?!? * O_APPEND = 256 * * All others are ignored(!) * * ----- * $Id: open.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include /* Or is it unistd.h, who knows! */ int open(far char *name, int flags, mode_t mode) { char buffer[10]; /* Buffer for expansion */ return (open_z88(name,flags,mode,buffer,9)); } z88dk-1.8.ds1/libsrc/fcntl/z88/open_z88.c0000644000175000017500000000276007267325734017363 0ustar tygrystygrys/* * Part of the library for fcntl * * int open(char *name,int access, mode_t mode) * * djm 27/4/99 * * Access is either * * O_RDONLY = 0 * O_WRONLY = 1 Starts afresh?!?!? * O_APPEND = 256 * * All others are ignored(!) - i.e. mode is ignored * * djm 24/3/2000 - Takes a buffer for expanded filename * * ----- * $Id: open_z88.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include /* Or is it unistd.h, who knows! */ int open_z88(far char *name, int flags, mode_t mode, char *buf, size_t len) { #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld l,(ix+10) ;lower 16 of filename ld h,(ix+11) ld e,(ix+12) ;bank for filename ld d,0 push de push hl call _cpfar2near ;in crt0 code so can be null fn ;returns hl with buffer in near mem ;fixes the stack as well ld b,0 ld a,(ix+8) ;access flags ld c,(ix+9) ;top 8 of flags bit 0,c ;append! jr z,l_open1 ld a,2 ;OZ append mode-1 .l_open1 inc a ;convert from UNIX mode to OZ flags ld e,(ix+4) ;buf ld d,(ix+5) ld c,(ix+2) ;maximum length of expanded filename call_oz(gn_opf) ld hl,-1 ret c ;open error push ix ;get filedescriptor in ix into hl pop hl #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/opendor.c0000644000175000017500000000154207267325734017354 0ustar tygrystygrys/* * Open a file DOR to enable getting of stats * * djm 13/3/2000 - Hacked from fopen * * ----- * $Id: opendor.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include int opendor(char *filename) { #asm INCLUDE "#fileio.def" ;Create some room on the stack for the filename to be expanded into.. pop bc pop de ;filename push de push bc ld hl,-10 add hl,sp ld sp,hl ex de,hl ;de=buffer, hl=filename ld c,8 ;max chars to expand.. ld a,OP_DOR ;Open as DOR ld b,0 ;absolute page call_oz(gn_opf) ex af,af ;keep our flags! ld hl,10 add hl,sp ld sp,hl ;restore our stack (we did nothing to it!) push ix pop hl ex af,af ;exit we carry set for failure ret nc ld hl,0 #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/read.c0000644000175000017500000000161707267325734016624 0ustar tygrystygrys/* * Part of the library for fcntlt * * size_t read(int fd,void *ptr, size_t len) * * djm 27/4/99 * * Close a file descriptor, pretty well identical to * fclose from the other stuff * * ----- * $Id: read.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include #include size_t read(int fd, void *ptr, size_t len) { #asm INCLUDE "#fileio.def" ld ix,2 add ix,sp ld c,(ix+0) ;len ld b,(ix+1) ld e,(ix+2) ;ptr ld d,(ix+3) ld l,(ix+4) ;fd ld h,(ix+5) push hl pop ix push bc ld hl,0 ;move from file to memory (hl=0, de=addr) call_oz(os_mv) ;exits with bc=bytes not read pop hl and a sbc hl,bc #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/readbyte.c0000644000175000017500000000101107736631203017464 0ustar tygrystygrys/* * Low level reading routines for Small C+ Z88 * * readbyte(fd) - Read byte from file * * Preserve tabs!! * * ----- * $Id: readbyte.c,v 1.3 2003/10/01 20:01:07 dom Exp $ */ #include #include int __FASTCALL__ readbyte(int fd) { #asm INCLUDE "#fileio.def" pop ix ; On entry to FASTCALL function, the parameter ; is pushed onto the stack call_oz(os_gb) ld hl,-1 ;EOF ret c ld l,a ld h,0 push hl #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/readdor.c0000644000175000017500000000103007454063571017312 0ustar tygrystygrys/* * Read a member of a dor * * readdor(int handle,char type,char len,void *buf) * * djm 13/3/2000 * * ----- * $Id: readdor.c,v 1.3 2002/04/07 15:36:25 dom Exp $ */ #include void readdor(int handle, char type, char len, void *buf) { #asm INCLUDE "#dor.def" ld iy,0 ;Use iy as framepointer for ease add iy,sp ld e,(iy+2) ;buffer ld d,(iy+3) ld c,(iy+4) ;length ld b,(iy+6) ;type ld l,(iy+8) ;dor handle ld h,(iy+9) push hl pop ix ;os_dor wants it in ix ld a,DR_Rd ;read dor call_oz(os_dor) #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/README0000644000175000017500000000052407267325734016421 0ustar tygrystygrys$Id: README,v 1.2 2001/04/18 14:59:40 stefano Exp $ These files are heavily z88 specific Eventually it is hoped to move all Z88 specific io functions to this directory and rename it machine_z88 Also in here are DOR manipulation routines (they are defined in z88.h) - these should really cope with errors but I'm too lazy at the moment... z88dk-1.8.ds1/libsrc/fcntl/z88/remove.asm0000644000175000017500000000132207273540111017516 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; 30 September 1998 ** UNTESTED ** ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; This doesn't check for validity of filename at all. ; ; 27/4/99 Now takes a far char *name ; ; 15/4/2000 Takes a near again (can change but effort!) ; ; ; $Id: remove.asm,v 1.1 2001/05/01 13:55:21 dom Exp $ ; INCLUDE "#fileio.def" INCLUDE "#stdio.def" XLIB remove ;int remove(char *name) .remove pop de pop hl ;dest filename push hl push de ld b,0 call_oz(gn_del) ld hl,0 ret nc dec hl ;=1 ret z88dk-1.8.ds1/libsrc/fcntl/z88/rename.asm0000644000175000017500000000135607273540111017477 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; 30 September 1998 ** UNTESTED ** ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; This doesn't check for validity of filename at all. ; ; $Id: rename.asm,v 1.1 2001/05/01 13:55:21 dom Exp $ ; INCLUDE "#fileio.def" INCLUDE "#stdio.def" XLIB rename ;int rename(char *s1,char *s2) ;on stack: ;return address,s2,s1 ;s1=orig filename, s2=dest filename .rename pop bc pop de ;dest filename pop hl ;orig filename push hl push de push bc call_oz(gn_ren) ld hl,0 ret nc dec hl ;=1 ret z88dk-1.8.ds1/libsrc/fcntl/z88/sondor.c0000644000175000017500000000071107267325734017207 0ustar tygrystygrys/* * Close a DOR * * void sondor(int handle, char *type) * * Returns son of current dor (old dor invalid) * * djm 13/3/2000 * * ----- * $Id: sondor.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include int sondor(int handle, char *type) { #asm INCLUDE "#dor.def" pop de pop ix push ix push de ld a,DR_Son call_oz(os_dor) pop de pop hl ld (hl),a ;store minor type push hl push de push ix pop hl ;return SON dor #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/stat.c0000644000175000017500000000312707454063571016656 0ustar tygrystygrys/* * int stat(char *filename, struct stat *buf) * * Return information about a file * * djm 13/3/2000 * * Just a tad z88 specific! * * ----- * $Id: stat.c,v 1.4 2002/04/07 15:36:25 dom Exp $ */ #include #include #include #include /* Size of a z88 block */ #define BLKSIZE 64 #define JD0101970 2440588 time_t doepoch(long days, long sec) { days-=JD0101970; /* sub 1970 */ days*=86400; /* into seconds */ return (days+sec); } int stat(char *filename, struct stat *buf) { int flags; long time; long date; int dor; char buffer[8]; /* Buffer for reading times */ if ( (dor=opendor(filename)) ==0) return -1; /* To figure out if we have a dir or a file we try to * read the extent..if we fail then it wasn't a regular * file */ flags=0777; /* rwxrwxrwx */ readdor(dor,'X',4,&buf->st_size); iferror { buf->st_size=512L; /* Std dir size(!) */ flags+=0040000; } buffer[0]=0; readdor(dor,'U',6,buffer); /* Read Update time */ closedor(dor); time = date = 0; memcpy(&time,buffer,3); memcpy(&date,buffer+3,3); /* I don't like this, but it seems best way to do it */ buf->st_ctime=buf->st_mtime=buf->st_atime=doepoch(date,time/100L); buf->st_mode=flags; /* Now fill in some other things (aka faking!)*/ buf->st_blksize=BLKSIZE; buf->st_blocks=buf->st_size/(long)BLKSIZE; /* UID & GID stuff */ buf->st_gid=0; buf->st_uid=0; /* Device stuff */ buf->st_dev=1; buf->st_rdev=0; /* Inode - try to make unique..maybe time will be sufficiently so*/ buf->st_ino=buf->st_ctime; /* Links */ buf->st_nlink=0; return(0); } z88dk-1.8.ds1/libsrc/fcntl/z88/write.c0000644000175000017500000000162007267325734017035 0ustar tygrystygrys/* * Part of the library for fcntl * * size_t write(int fd,void *ptr, size_t len) * * djm 27/4/99 * * Close a file descriptor, pretty well identical to * fclose from the other stuff * * ----- * $Id: write.c,v 1.2 2001/04/18 14:59:40 stefano Exp $ */ #include #include size_t write(int fd, void *ptr, size_t len) { #asm INCLUDE "#fileio.def" ld ix,2 add ix,sp ld c,(ix+0) ;len ld b,(ix+1) ld l,(ix+2) ;ptr ld h,(ix+3) ld e,(ix+4) ;fd ld d,(ix+5) push de pop ix push bc ld de,0 ;move from memory to file (de=0,hl=addr) call_oz(os_mv) ;exits with bc=bytes not read pop hl and a sbc hl,bc #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/writebyte.c0000644000175000017500000000103307736631203017707 0ustar tygrystygrys/* * Low level reading routines for Small C+ Z88 * * writebyte(int fd, int c) - Read byte from file * * djm 4/5/99 * * ----- * $Id: writebyte.c,v 1.3 2003/10/01 20:01:07 dom Exp $ */ #include #include int writebyte(int fd, int byte) { #asm INCLUDE "#fileio.def" pop bc pop hl ;byte pop ix ;file handle push ix push hl push bc ld a,l push af call_oz(os_pb) pop af ld hl,-1 ;EOF ret c ld l,a ld h,0 #endasm } z88dk-1.8.ds1/libsrc/fcntl/z88/writedor.c0000644000175000017500000000103307454063571017534 0ustar tygrystygrys/* * Read a member of a dor * * writedor(int handle,char type,char len,void *buf) * * djm 13/3/2000 * * ----- * $Id: writedor.c,v 1.3 2002/04/07 15:36:25 dom Exp $ */ #include void writedor(int handle, char type, char len, void *buf) { #asm INCLUDE "#dor.def" ld iy,0 ;Use iy as framepointer for ease add iy,sp ld e,(iy+2) ;buffer ld d,(iy+3) ld c,(iy+4) ;length ld b,(iy+6) ;type ld l,(iy+8) ;dor handle ld h,(iy+9) push hl pop ix ;os_dor wants it in ix ld a,DR_Wr ;read dor call_oz(os_dor) #endasm } z88dk-1.8.ds1/libsrc/fcntl/zxvgs/0000755000175000017500000000000010765202715016256 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/fcntl/zxvgs/close.asm0000644000175000017500000000031407505335363020067 0ustar tygrystygrys;int close(int handle) ;returns 0 if OK ; ; $Id: close.asm,v 1.1 2002/06/23 12:11:31 dom Exp $ ; XLIB close .close POP BC ;ret POP DE PUSH DE PUSH BC RST 8 DEFB $D0 AND $7F LD L,A LD H,0 RET z88dk-1.8.ds1/libsrc/fcntl/zxvgs/fdgetpos.asm0000644000175000017500000000031707505335363020600 0ustar tygrystygrys;int close(int handle) ;returns 0 if OK ; ; $Id: fdgetpos.asm,v 1.1 2002/06/23 12:11:31 dom Exp $ ; XLIB close .close POP BC ;ret POP DE PUSH DE PUSH BC RST 8 DEFB $D0 AND $7F LD L,A LD H,0 RET z88dk-1.8.ds1/libsrc/fcntl/zxvgs/fdtell.asm0000644000175000017500000000044407505335363020240 0ustar tygrystygrys;long fdtell(int fd) ;returns position in file ; ; $Id: fdtell.asm,v 1.1 2002/06/23 12:11:31 dom Exp $ ; XLIB fdtell .fdtell POP BC ;ret POP DE PUSH DE PUSH BC RST 8 DEFB $D8 AND $7F LD D,A RET Z ;Error, return with -1 LD HL,-1 ;load hlde with -1L LD E,L LD D,H RET ;error z88dk-1.8.ds1/libsrc/fcntl/zxvgs/lseek.asm0000644000175000017500000000124507505335363020071 0ustar tygrystygrys;long lseek(int fd, long posn, int whence) ;returns ; ;whence= ; 0 SEEK_SET from start of file ; 1 SEEK_CUR from current position ; 2 SEEK_END from end of file (always -ve) ; ; $Id: lseek.asm,v 1.1 2002/06/23 12:11:31 dom Exp $ ; XLIB lseek .lseek LD IX,0 ADD IX,SP LD B,(IX+2) ;whence - range not tested DEC B LD D,(IX+9) ;fd LD E,(IX+6) LD H,(IX+5) LD L,(IX+4) RST 8 DEFB $D9 AND $7F JR NZ,l_exit ;doubtful code ; Get the position of the file RST 8 ;this returns the present pointer DEFB $D8 ;or return the old one??? AND $7F JR NZ,l_exit ;end of doubtful code LD D,A ;zero RET .l_exit LD HL,-1 ;load hlde with -1L LD E,L LD D,H RET ;error z88dk-1.8.ds1/libsrc/fcntl/zxvgs/Makefile0000755000175000017500000000032110445312212017702 0ustar tygrystygrys# # Makefile for ZXVGS file support # # $Id: Makefile,v 1.3 2006/06/18 17:59:38 dom Exp $ include ../../Make.config all: open_z88.o .c.o: zcc +zx $(CFLAGS) -DZXVGS $*.c clean: $(RM) *.o* zcc_opt.def z88dk-1.8.ds1/libsrc/fcntl/zxvgs/open.asm0000644000175000017500000000205307505335363017725 0ustar tygrystygrys;int open(far char *name, int flags, mode_t mode) ;returns handle to file ; ; Access is either ; ; O_RDONLY = 0 ; O_WRONLY = 1 Starts afresh?!?!? ; O_APPEND = 256 ; ;no sense to test number of opened files - the limit is 255... ;usually one is opened... ; ; $Id: open.asm,v 1.1 2002/06/23 12:11:31 dom Exp $ ; XLIB open .open LD IX,0 ADD IX,SP LD E,(IX+6) ;filename LD D,(IX+7) LD A,(IX+3) ;mode high AND A JR NZ,ck_append LD A,(IX+2) AND A JR Z,open_rd DEC A JR Z,open_wr .open_abort LD HL,-1 ;invalid mode or open error SCF RET .ck_append DEC A JR NZ,open_abort LD A,(IX+2) AND A JR NZ,open_abort ;cant have low byte set RST 8 DEFB $D2 ;read/write LD HL,0 LD E,L LD B,1 ;0 from end of file RST 8 DEFB $D9 ;seek AND $7F JR Z,open_ok .open_close RST 8 DEFB $D0 ;always must be closed JR open_abort .open_wr RST 8 DEFB $D2 JR open_ok .open_rd RST 8 DEFB $D1 ;returns error, when file not found... AND $7F JR NZ,open_close .open_ok LD H,D ;return handle, L has no meaning ; SCF ;ZX+3 returns SCF - what for? RET z88dk-1.8.ds1/libsrc/fcntl/zxvgs/open_z88.c0000644000175000017500000000050407505335363020077 0ustar tygrystygrys/* * $Id: open_z88.c,v 1.1 2002/06/23 12:11:31 dom Exp $ */ #include #include #include int open_z88(far char *name, int flags, mode_t mode, char *buf,int len) { int hand; hand = open(name,flags,mode); if ( hand != -1 ) { strncpy(buf,(near char *)name,len); } return (hand); } z88dk-1.8.ds1/libsrc/fcntl/zxvgs/read.asm0000644000175000017500000000047407505335363017704 0ustar tygrystygrys;size_t read(int fd, void *ptr, size_t len) ;returns number of written bytes ; ; $Id: read.asm,v 1.1 2002/06/23 12:11:31 dom Exp $ ; XLIB read .read LD IX,2 ADD IX,SP LD C,(IX+0) ;len LD B,(IX+1) LD L,(IX+2) ;ptr LD H,(IX+3) LD D,(IX+5) ;fd RST 8 DEFB $D4 ;exits with BC=bytes read LD L,C LD H,B RET z88dk-1.8.ds1/libsrc/fcntl/zxvgs/readbyte.asm0000644000175000017500000000100207505343272020552 0ustar tygrystygrys;int __FASTCALL__ readbyte(int handle) ;returns read byte ; ;ZXVGS buffers bytes, when drives a disk interface. ;In case of cable (TMX, UPB), the byte is transmitted each time... ; ; $Id: readbyte.asm,v 1.2 2002/06/23 13:01:46 dom Exp $ ; XLIB readbyte .readbyte LD D,H ;handle to D LD HL,0 PUSH HL ADD HL,SP ;pointer to byte LD BC,1 ;one byte to read RST 8 DEFB $D4 ;exits with BC=bytes read DEC C ;can be 1 (OK) or 0 (error) POP HL ;contains this byte RET Z LD L,C ;HL=-1L here LD H,C RET z88dk-1.8.ds1/libsrc/fcntl/zxvgs/remove.asm0000644000175000017500000000033307505335363020260 0ustar tygrystygrys;int remove(far char *name) ;returns 0 when OK ; ; $Id: remove.asm,v 1.1 2002/06/23 12:11:31 dom Exp $ ; XLIB remove .remove POP BC POP DE ;filename PUSH DE PUSH BC RST 8 DEFB $CB AND $7F LD L,A LD H,0 RET z88dk-1.8.ds1/libsrc/fcntl/zxvgs/rename.asm0000644000175000017500000000045307505335363020235 0ustar tygrystygrys;int rename(char *source, char *dest) ;returns 0 when OK ; ; $Id: rename.asm,v 1.1 2002/06/23 12:11:31 dom Exp $ ; XLIB rename .rename POP BC POP HL ;new filename POP DE ;old PUSH DE PUSH HL PUSH BC RST 8 DEFB $CE ;also can move file to another path/disk... AND $7F LD L,A LD H,0 RET z88dk-1.8.ds1/libsrc/fcntl/zxvgs/write.asm0000644000175000017500000000050307505335363020114 0ustar tygrystygrys;size_t write(int fd, void *ptr, size_t len) ;returns number of written bytes ; ; $Id: write.asm,v 1.1 2002/06/23 12:11:31 dom Exp $ ; XLIB write .write LD IX,2 ADD IX,SP LD C,(IX+0) ;len LD B,(IX+1) LD L,(IX+2) ;ptr LD H,(IX+3) LD D,(IX+5) ;fd RST 8 DEFB $D5 ;exits with BC=bytes written LD L,C LD H,B RET z88dk-1.8.ds1/libsrc/fcntl/zxvgs/writebyte.asm0000644000175000017500000000067707505335363021014 0ustar tygrystygrys;int writebyte(int handle, int byte) ;returns 0 when OK ; ;ZXVGS buffers bytes, when drives a disk interface. ;In case of cable (TMX, UPB), the byte is transmitted each time... ; ; $Id: writebyte.asm,v 1.1 2002/06/23 12:11:31 dom Exp $ ; XLIB writebyte .writebyte LD HL,2 ADD HL,SP ;pointer to byte LD D,(IX+3) ;fd LD BC,1 ;one byte RST 8 DEFB $D5 ;exits with BC=bytes written DEC BC ;can be 1 (OK) or 0 (error) LD L,C LD H,B RET z88dk-1.8.ds1/libsrc/games/0000755000175000017500000000000010765202715015063 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/games/ace/0000755000175000017500000000000010765202715015613 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/games/ace/bit_close.asm0000644000175000017500000000032007457364560020266 0ustar tygrystygrys; $Id: bit_close.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Jupiter ACE 1 bit sound functions stub ; ; void bit_close(); ; ; Stefano Bodrato - 18/10/2001 ; XLIB bit_close .bit_close ret z88dk-1.8.ds1/libsrc/games/ace/bit_close_ei.asm0000644000175000017500000000036407457364560020753 0ustar tygrystygrys; $Id: bit_close_ei.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Jupiter ACE 1 bit sound functions ; ; (Close sound) and restore interrupts ; ; Stefano Bodrato - 18/10/2001 ; XLIB bit_close_ei .bit_close_ei ei ret z88dk-1.8.ds1/libsrc/games/ace/bit_open.asm0000644000175000017500000000031307457364560020124 0ustar tygrystygrys; $Id: bit_open.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Jupiter ACE 1 bit sound functions stub ; ; void bit_open(); ; ; Stefano Bodrato - 18/10/2001 ; XLIB bit_open .bit_open ret z88dk-1.8.ds1/libsrc/games/ace/bit_open_di.asm0000644000175000017500000000040407457364560020601 0ustar tygrystygrys; $Id: bit_open_di.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Jupiter ACE 1 bit sound functions ; ; (Open sound port) and disable interrupts for exact timing ; ; Stefano Bodrato - 28/9/2001 ; XLIB bit_open_di .bit_open_di di ret z88dk-1.8.ds1/libsrc/games/aquarius/0000755000175000017500000000000010765202715016715 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/games/aquarius/bit_close.asm0000644000175000017500000000032207457364560021372 0ustar tygrystygrys; $Id: bit_close.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Mattel Aquarius 1 bit sound functions stub ; ; void bit_close(); ; ; Stefano Bodrato - Dec 2001 ; XLIB bit_close .bit_close ret z88dk-1.8.ds1/libsrc/games/aquarius/bit_close_ei.asm0000644000175000017500000000036607457364560022057 0ustar tygrystygrys; $Id: bit_close_ei.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Mattel Aquarius 1 bit sound functions ; ; (Close sound) and restore interrupts ; ; Stefano Bodrato - Dec 2001 ; XLIB bit_close_ei .bit_close_ei ei ret z88dk-1.8.ds1/libsrc/games/aquarius/bit_open.asm0000644000175000017500000000031507457364560021230 0ustar tygrystygrys; $Id: bit_open.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Mattel Aquarius 1 bit sound functions stub ; ; void bit_open(); ; ; Stefano Bodrato - Dec 2001 ; XLIB bit_open .bit_open ret z88dk-1.8.ds1/libsrc/games/aquarius/bit_open_di.asm0000644000175000017500000000040707457364560021706 0ustar tygrystygrys; $Id: bit_open_di.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Mattel Aquarius 1 bit sound functions ; ; (Open sound port) and disable interrupts for exact timing ; ; Stefano Bodrato - Dec 2001 ; XLIB bit_open_di .bit_open_di di ret z88dk-1.8.ds1/libsrc/games/beeper.asm0000644000175000017500000000222207457364557017046 0ustar tygrystygrys; $Id: beeper.asm,v 1.2 2002/04/17 21:30:23 dom Exp $ ; ; Generic 1 bit sound functions ; XLIB beeper INCLUDE "games/games.inc" LIB bit_open_di LIB bit_close_ei ; ; Ported by Dominic Morris ; Adapted by Stefano Bodrato ; ; Entry as for Spectrum beeper routine!! ; ; Direct transfer, of code..no point commenting really ; .beeper ld a,l srl l srl l cpl and 3 ld c,a ld b,0 ld ix,beixp3 add ix,bc call bit_open_di .beixp3 nop nop nop inc b inc c .behllp dec c jr nz,behllp ld c,$3F dec b jp nz,behllp xor sndbit_mask out (sndbit_port),a ld b,h ld c,a bit sndbit_bit,a ;if o/p go again! jr nz,be_again ld a,d or e jr z,be_end ld a,c ld c,l dec de jp (ix) .be_again ld c,l inc c jp (ix) .be_end jp bit_close_ei z88dk-1.8.ds1/libsrc/games/bit_beep.asm0000644000175000017500000000054007457364557017356 0ustar tygrystygrys; $Id: bit_beep.asm,v 1.2 2002/04/17 21:30:23 dom Exp $ ; ; 1 bit sound functions ; ; void bit_beep(int duration, int period); ; XLIB bit_beep LIB beeper ; ; Stub by Stefano Bodrato - 8/10/2001 ; .bit_beep pop bc pop hl pop de push de push hl push bc jp beeper z88dk-1.8.ds1/libsrc/games/bit_click.asm0000644000175000017500000000055707457364557017540 0ustar tygrystygrys; $Id: bit_click.asm,v 1.2 2002/04/17 21:30:23 dom Exp $ ; ; Generic 1 bit sound functions ; ; void bit_click(); ; ; Stefano Bodrato - 2/10/2001 ; XLIB bit_click INCLUDE "games/games.inc" XREF snd_tick .bit_click ld a,(snd_tick) xor sndbit_mask out (sndbit_port),a ld (snd_tick),a ret z88dk-1.8.ds1/libsrc/games/bit_frequency.c0000644000175000017500000000114207457364557020105 0ustar tygrystygrys/* ; $Id: bit_frequency.c,v 1.2 2002/04/17 21:30:23 dom Exp $ ; ; Generic 1 bit sound functions ; Beeps the right frequency ; ; Stefano Bodrato 8/10/2001 ; 261.625565290 C 277.182631135 C# 293.664768100 D 311.126983881 D# 329.627557039 E 349.228231549 F 369.994422674 F# 391.995436072 G 415.304697513 G# 440.000000000 A 466.163761616 A# 493.883301378 B */ #include bit_frequency(float duration, float frequency) { bit_beep ( (int) (frequency*duration), (int) ((BEEP_TSTATES/frequency)-29.5) ); } z88dk-1.8.ds1/libsrc/games/bit_fx.asm0000644000175000017500000001170010434671714017041 0ustar tygrystygrys; $Id: bit_fx.asm,v 1.4 2006/05/23 20:42:52 stefano Exp $ ; ; Generic platform sound effects module. ; ; Original code by Dominic Morris ; Adapted by Stefano Bodrato ; ;>Z88 sounds..hopefully!! ;>Works..kinda nice to hear the z88 sing..now for music! ;>djm June 1998 ;> ;>This is quite a crude module, $4B0 isn't restored by most routines ;>due to the fact that it is usually in the 00xxxxxx state when we ;>get there XLIB bit_fx INCLUDE "games/games.inc" LIB beeper LIB bit_open LIB bit_open_di LIB bit_close LIB bit_close_ei ;Sound routine..enter in with e holding the desired effect! .bit_fx pop bc pop de push de push bc ld a,e cp 8 ret nc add a,a ld e,a ld d,0 ld hl,table add hl,de ld a,(hl) inc hl ld h,(hl) ld l,a jp (hl) .table defw fx2 ; effect #0 defw fx5 defw fx6 defw zap0 defw zap1 defw clackson defw zap3 defw warpcall ; effect #7 ;Strange squeak hl=300,de=2 ;Game up hl=300,de=10 inc de ;-like a PACMAN sound .fx6 ld b,1 .fx6_1 push bc ld hl,300 ld de,10 .fx6_2 push hl push de call beeper pop de pop hl ; inc de ;if added in makes different sound.. ld bc,10 and a sbc hl,bc jr nc,fx6_2 pop bc djnz fx6_1 ret ;Use during key defines? .fx2 call bit_open_di ld e,150 .fx2_1 out (sndbit_port),a xor sndbit_mask ld b,e .fx2_2 djnz fx2_2 inc e jr nz,fx2_1 jp bit_close_ei ;Laser repeat sound .fx5 ld b,1 .fx5_1 push bc ld hl,1200 ld de,6 .fx5_2 push hl push de call beeper pop de pop hl ld bc,100 and a sbc hl,bc jr nc,fx5_2 pop bc djnz fx5_1 ret ;Eating sound .zap0 call bit_open_di ld h,4 .zap0_1 ld b,(hl) dec hl .zap0_2 djnz zap0_2 out (sndbit_port),a xor sndbit_mask ex af,af ld a,h or l jr z,zap0_3 ex af,af jr zap0_1 .zap0_3 jp bit_close_ei ;Clackson sound .clackson call bit_open_di .clackson_LENGHT ld b,90 ld c,sndbit_port .clackson_loop dec h jr nz,clackson_jump xor sndbit_mask out (c),a .clackson_FR_1 ld h,230 .clackson_jump dec l jr nz,clackson_loop xor sndbit_mask out (c),a .clackson_FR_2 ld l,255 djnz clackson_loop call bit_close_ei ret ;Beep thing .zap3 call bit_open_di .zap3_1 push bc xor sndbit_mask out (sndbit_port),a push af xor a sub b ld b,a pop af .zap3_2 nop djnz zap3_2 xor sndbit_mask out (sndbit_port),a pop bc push bc .zap3_3 nop djnz zap3_3 pop bc djnz zap3_1 jp bit_close_ei ;Sound for warp .warpcall ld hl,1600 ld (warps+1),hl ld hl,-800 ld (warps1+1),hl ld hl,-100 ld (warps2+1),hl ld b,20 .warpcall1 push bc call warps pop bc djnz warpcall1 ret .warps ld hl,1600 ld de,6 call beeper .warps1 ld hl,-800 .warps2 ld de,-100 and a sbc hl,de ld (warps1+1),hl jr nz,warps3 ld de,100 ld (warps2+1),de .warps3 ex de,hl ld hl,1600 add hl,de ld (warps+1),hl ret ;Our old squelch... .zap1 call bit_open ld b,0 .zap1_1 push bc xor sndbit_mask ;oscillate between high and low bits... out (sndbit_port),a .zap1_2 nop nop djnz zap1_2 pop bc djnz zap1_1 jp bit_close z88dk-1.8.ds1/libsrc/games/bit_fx2.asm0000755000175000017500000001661410434671714017137 0ustar tygrystygrys; $Id: bit_fx2.asm,v 1.2 2006/05/23 20:42:52 stefano Exp $ ; ; Generic platform sound effects module. ; Alternate sound library by Stefano Bodrato ; XLIB bit_fx2 INCLUDE "games/games.inc" LIB bit_open LIB bit_open_di LIB bit_close LIB bit_close_ei .bit_fx2 pop bc pop de push de push bc ld a,e cp 8 ret nc add a,a ld e,a ld d,0 ld hl,table add hl,de ld a,(hl) inc hl ld h,(hl) ld l,a jp (hl) .table defw DeepSpace ; effect #0 defw SSpace2 defw TSpace defw Clackson2 defw TSpace2 defw TSpace3 ; effect #5 defw Squoink defw explosion ;Space sound .DeepSpace call bit_open_di .DS_LENGHT ld b,100 ld c,sndbit_port .ds_loop dec h jr nz,ds_jump xor sndbit_mask out (c),a push bc ld b,250 .loosetime1 djnz loosetime1 pop bc xor sndbit_mask out (c),a .ds_FR_1 ;ld h,230 ld h,254 .ds_jump dec l jr nz,ds_loop xor sndbit_mask out (c),a push bc ld b,200 .loosetime2 djnz loosetime2 pop bc xor sndbit_mask out (c),a .ds_FR_2 ld l,255 djnz ds_loop call bit_close_ei ret ;Dual note with fuzzy addedd .SSpace2 call bit_open_di .SS_LENGHT ld b,100 ld c,sndbit_port .ss_loop dec h jr nz,ss_jump push hl push af ld a,sndbit_mask ld h,0 and (hl) ld l,a pop af xor l out (c),a pop hl xor sndbit_mask out (c),a .ss_FR_1 ld h,230 .ss_jump dec l jr nz,ss_loop xor sndbit_mask out (c),a .ss_FR_2 ld l,255 djnz ss_loop call bit_close_ei ret ;Dual note with LOT of fuzzy addedd .TSpace call bit_open_di .TS_LENGHT ld b,100 ld c,sndbit_port .ts_loop dec h jr nz,ts_jump push hl push af ld a,sndbit_mask ld h,0 and (hl) ld l,a pop af xor l out (c),a pop hl xor sndbit_mask out (c),a .ts_FR_1 ld h,130 .ts_jump dec l jr nz,ts_loop push hl push af ld a,sndbit_mask ld l,h ld h,0 and (hl) ld l,a pop af xor l out (c),a pop hl xor sndbit_mask out (c),a .ts_FR_2 ld l,155 djnz ts_loop call bit_close_ei ret .Clackson2 call bit_open_di .CS_LENGHT ld b,200 ld c,sndbit_port .cs_loop dec h jr nz,cs_jump xor sndbit_mask out (c),a push bc ld b,250 .cswait1 djnz cswait1 pop bc xor sndbit_mask out (c),a .cs_FR_1 ld h,230 .cs_jump inc l jr nz,cs_loop xor sndbit_mask out (c),a push bc ld b,200 .cswait2 djnz cswait2 pop bc xor sndbit_mask out (c),a .cs_FR_2 ld l,0 djnz cs_loop call bit_close_ei ret .TSpace2 ld a,230 ld (t2_FR_1+1),a xor a ld (t2_FR_2+1),a call bit_open_di .T2_LENGHT ld b,200 ld c,sndbit_port .t2_loop dec h jr nz,t2_jump xor sndbit_mask out (c),a push bc ld b,250 .wait1 djnz wait1 pop bc xor sndbit_mask out (c),a .t2_FR_1 ld h,230 .t2_jump inc l jr nz,t2_loop push af ld a,(t2_FR_2+1) inc a ld (t2_FR_2+1),a pop af xor sndbit_mask out (c),a push bc ld b,200 .wait2 djnz wait2 pop bc xor sndbit_mask out (c),a .t2_FR_2 ld l,0 djnz t2_loop call bit_close_ei ret .TSpace3 ld a,230 ld (u2_FR_1+1),a xor a ld (u2_FR_2+1),a call bit_open_di .U2_LENGHT ld b,200 ld c,sndbit_port .u2_loop dec h jr nz,u2_jump push af ld a,(u2_FR_1+1) inc a ld (u2_FR_1+1),a pop af xor sndbit_mask out (c),a .u2_FR_1 ld h,50 .u2_jump inc l jr nz,u2_loop push af ld a,(u2_FR_2+1) inc a ld (u2_FR_2+1),a pop af xor sndbit_mask out (c),a .u2_FR_2 ld l,0 djnz u2_loop call bit_close_ei ret .Squoink ld a,230 ld (qi_FR_1+1),a xor a ld (qi_FR_2+1),a call bit_open_di .qi_LENGHT ld b,200 ld c,sndbit_port .qi_loop dec h jr nz,qi_jump push af ld a,(qi_FR_1+1) dec a ld (qi_FR_1+1),a pop af xor sndbit_mask out (c),a .qi_FR_1 ld h,50 .qi_jump inc l jr nz,qi_loop push af ld a,(qi_FR_2+1) inc a ld (qi_FR_2+1),a pop af xor sndbit_mask out (c),a .qi_FR_2 ld l,0 djnz qi_loop call bit_close_ei ret .explosion call bit_open_di ld hl,1 .expl push hl push af ld a,sndbit_mask ld h,0 and (hl) ld l,a pop af xor l out (sndbit_port),a pop hl push af ld b,h ld c,l .dly dec bc ld a,b or c jr nz,dly pop af inc hl bit 1,h jr z,expl call bit_close_ei ret z88dk-1.8.ds1/libsrc/games/bit_fx3.asm0000755000175000017500000001267210434671714017140 0ustar tygrystygrys; $Id: bit_fx3.asm,v 1.1 2006/05/23 20:42:52 stefano Exp $ ; ; Generic platform sound effects module. ; Alternate sound library by Stefano Bodrato ; XLIB bit_fx3 INCLUDE "games/games.inc" LIB bit_open LIB bit_open_di LIB bit_close LIB bit_close_ei .bit_fx3 pop bc pop de push de push bc ld a,e cp 8 ret nc add a,a ld e,a ld d,0 ld hl,table add hl,de ld a,(hl) inc hl ld h,(hl) ld l,a jp (hl) .table defw blirp2 ; effect #0 defw blirp defw coff ; effect #2 defw blurp defw descending defw ascending defw descending2 defw fx7 ; effect #7 .blirp call bit_open_di ld b,255 .expl push af ld a,sndbit_mask ld h,0 ld l,b and (hl) ld l,a pop af xor l out (sndbit_port),a push bc .dly nop djnz dly pop bc push af ld a,sndbit_mask ld h,0 ld l,b and (hl) ld l,a pop af xor l out (sndbit_port),a push bc push af ld a,255 sub b ld b,a pop af .dly2 nop djnz dly2 pop bc djnz expl call bit_close_ei ret .blirp2 call bit_open_di ld b,100 .blrp push af ld a,sndbit_mask ld h,0 ld l,b and (hl) ld l,a pop af xor l out (sndbit_port),a push bc push af ld a,255 sub b ld b,a pop af .dlyb nop djnz dlyb pop bc xor sndbit_mask out (sndbit_port),a push bc .dlya nop djnz dlya pop bc djnz blrp call bit_close_ei ret ; Steam engine .coff call bit_open_di ld hl,0 .coff2 push af ld a,sndbit_mask and (hl) ld b,a pop af xor b out (sndbit_port),a ld b,(hl) .cdly djnz cdly inc hl bit 7,l jr z,coff2 call bit_close_ei ret .blurp call bit_open_di ld b,255 .blurp2 push af ld a,sndbit_mask ld h,0 ld l,b and (hl) ld l,a pop af xor l out (sndbit_port),a push af ld a,(hl) .dblurp dec a jr nz,dblurp pop af djnz blurp2 call bit_close_ei ret ; descending buzzing noise .descending call bit_open_di ld hl,1000 .desc1 push hl ld b,16 .desc2 rl l rl h jr nc,desc3 xor sndbit_mask out (sndbit_port),a .desc3 ld e,5 .desc4 dec e jr nz,desc4 djnz desc2 pop hl dec hl ld c,a ld a,h or l ld a,c jr nz,desc1 call bit_close_ei ret ; ascending buzzing noise .ascending call bit_open_di ld hl,1023 .hdesc1 push hl ld b,16 .hdesc2 rl l rl h jr nc,hdesc3 xor sndbit_mask out (sndbit_port),a .hdesc3 djnz hdesc2 pop hl dec hl ld c,a ld a,h or l ld a,c jr nz,hdesc1 call bit_close_ei ret ; descending buzzing noise #2 .descending2 call bit_open_di ld hl,1023 .asc1 push hl ld b,16 .asc2 rl l rl h jr c,asc3 xor sndbit_mask out (sndbit_port),a .asc3 djnz asc2 pop hl dec hl ld c,a ld a,h or l ld a,c jr nz,asc1 call bit_close_ei ret ; noise #7 .fx7 call bit_open_di ld hl,4000 .fx71 push hl push af ld a,sndbit_mask and l ld l,a pop af xor l out (sndbit_port),a pop hl dec hl ld c,a ld a,h or l ld a,c jr nz,fx71 call bit_close_ei ret z88dk-1.8.ds1/libsrc/games/bit_fx4.asm0000755000175000017500000001126310434671714017134 0ustar tygrystygrys; $Id: bit_fx4.asm,v 1.1 2006/05/23 20:42:52 stefano Exp $ ; ; Generic platform sound effects module. ; ; Library #4 by Stefano Bodrato ; XLIB bit_fx4 INCLUDE "games/games.inc" LIB beeper LIB bit_open LIB bit_open_di LIB bit_close LIB bit_close_ei LIB bit_click ;Sound routine..enter in with e holding the desired effect! .bit_fx4 pop bc pop de push de push bc ld a,e cp 8 ret nc add a,a ld e,a ld d,0 ld hl,table add hl,de ld a,(hl) inc hl ld h,(hl) ld l,a jp (hl) .table defw fx1 ; effect #0 defw fx2 defw fx3 defw fx4 defw fx5 defw fx6 defw fx7 defw fx8 ; Strange squeak .fx1 ld b,1 .fx1_1 push bc ld hl,600 ld de,2 .fx1_2 push hl push de call beeper pop de pop hl push hl push de ld bc,400 sbc hl,bc ld l,c ld h,b call beeper pop de pop hl ld bc,40 and a sbc hl,bc jr nc,fx1_2 pop bc djnz fx1_1 ret ; Sort of "audio tape rewind" effect .fx2 ld hl,1024 .fx2_1 ld de,1 push hl push de ld a,55 xor l ld l,a call beeper pop de pop hl dec hl ld a,h or l jr nz,fx2_1 ret ; FX3 effect .fx3 ld hl,30 ld de,1 .fx3_1 push hl push de call beeper ld hl,600 ld de,1 call beeper pop de pop hl dec hl inc de ld a,h or l jr nz,fx3_1 ret ; FX4 effect .fx4 ld hl,1124 ld de,1 .fx4_1 push hl push de call beeper pop de pop hl push hl push de ld bc,900 sbc hl,bc call beeper pop de pop hl inc hl ld a,l and a jr nz,fx4_1 ret ; Strange descending squeak ; FX5 effect .fx5 ld hl,200 ld de,1 .fx5_1 push hl push de call beeper pop de pop hl push hl push de ld bc,180 sbc hl,bc call beeper pop de pop hl push hl push de call beeper pop de pop hl inc hl inc de ld a,l and a jr nz,fx5_1 ret ; FX6 effect .fx6 ld hl,300 ld de,1 .fx6_1 push hl push de call beeper pop de pop hl push hl push de ld bc,200 sbc hl,bc call beeper pop de pop hl inc hl inc de ld a,l and 50 jr nz,fx6_1 ret ; FX7 effect .fx7 ld hl,1000 ld de,1 .fx7_1 push hl push de call beeper pop de pop hl push hl push de ld bc,200 sbc hl,bc call beeper pop de pop hl dec hl ld a,l and 50 jr nz,fx7_1 ret ; FX8 effect .fx8 ld hl,100 ld de,1 .fx8_1 push hl push de call beeper pop de pop hl call bit_open_di call bit_click call bit_close_ei push hl push de ld bc,50 .fx8_2 djnz fx8_2 pop de pop hl call bit_open_di call bit_click call bit_close_ei inc hl ld a,l and 50 jr nz,fx8_1 ret z88dk-1.8.ds1/libsrc/games/bit_play.c0000644000175000017500000000320007457364557017046 0ustar tygrystygrys/* ; $Id: bit_play.c,v 1.3 2002/04/17 21:30:23 dom Exp $ ; ; Generic 1 bit sound functions ; play a melody (integer approx to optimize speed and size) ; ; Stefano Bodrato 11/10/2001 ; ; Syntax: "TONE(#/b)(+/-)(duration)" ; Sample: ; bit_play("C8DEb4DC8"); ; bit_play("C8DEb4DC8"); ; bit_play("Eb8FGG"); ; bit_play("Eb8FGG"); ; bit_play("G8Ab4G8FEb4DC"); ; bit_play("G8Ab4G8FEb4DC"); ; bit_play("C8G-C"); ; bit_play("C8G-C"); */ #include bit_play(unsigned char melody[]) { int sound; int duration=2; while ( *melody != 0 ) { switch (*melody++) { case 'C': if (*melody=='#') { sound=277; melody++; } else sound=262; break; case 'D': if (*melody=='#') { sound=311; melody++; } else if (*melody=='b') { sound=277; melody++; } else sound=294; break; case 'E': if (*melody=='b') { sound=311; melody++; } else sound=330; break; case 'F': if (*melody=='#') { sound=370; melody++; } else sound=349; break; case 'G': if (*melody=='#') { sound=415; melody++; } else if (*melody=='b') { sound=370; melody++; } else sound=392; break; case 'A': if (*melody=='#') { sound=466; melody++; } else if (*melody=='b') { sound=415; melody++; } else sound=440; break; case 'B': if (*melody=='b') { sound=466; melody++; } else sound=494; break; case '+': sound*=2; break; case '-': sound/=2; } if (*melody>'0' && *melody<='9') duration=(*melody++)-48; if ((*melody >= 'A' && *melody <= 'H') || *melody==0) bit_beep ( (double)(sound*duration)/12., (BEEP_TSTATES/(double)sound)-30. ); } } z88dk-1.8.ds1/libsrc/games/bit_synth.asm0000755000175000017500000000470710434671714017605 0ustar tygrystygrys; $Id: bit_synth.asm,v 1.1 2006/05/23 20:42:52 stefano Exp $ ; ; void bit_synth(int duration, int frequency1, int frequency2, int frequency3, int frequency4); ; ; Generic platform sound library. ; synthetizer - this is a sort of "quad sound" routine. ; It is based on 4 separate counters and a delay. ; Depending on the parameters being passed it is able to play ; on two audible voices, to generate sound effects and to play ; with a single voice having odd waveforms. ; ; The parameters are passed with a self modifying code trick :o( ; This routine shouldn't stay in contended memory locations !! ; XLIB bit_synth INCLUDE "games/games.inc" LIB bit_open_di LIB bit_close_ei .bit_synth ld ix,2 add ix,sp ld a,(ix+8) ld (LEN+1),a ld a,(ix+6) and a jr z,FR1_blank ld (FR_1+1),a ld a,sndbit_mask .FR1_blank ld (FR1_tick+1),a ld a,(ix+4) and a jr z,FR2_blank ld (FR_2+1),a ld a,sndbit_mask .FR2_blank ld (FR2_tick+1),a ld a,(ix+2) and a jr z,FR3_blank ld (FR_3+1),a ld a,sndbit_mask .FR3_blank ld (FR1_tick+1),a ld a,(ix+0) and a jr z,FR4_blank ld (FR_4+1),a ld a,sndbit_mask .FR4_blank ld (FR1_tick+1),a call bit_open_di ld h,1 ld l,h ld d,h ld e,h .LEN ld b,50 .loop ld c,4 .loop2 dec h jr nz,jump .FR1_tick xor sndbit_mask out (sndbit_port),a .FR_1 ld h,80 .jump dec l jr nz,jump2 .FR2_tick xor sndbit_mask out (sndbit_port),a .FR_2 ld l,81 .jump2 dec d jr nz,jump3 .FR3_tick xor sndbit_mask out (sndbit_port),a .FR_3 ld d,162 .jump3 dec e jr nz,loop2 .FR4_tick xor sndbit_mask out (sndbit_port),a .FR_4 ld e,163 dec c jr nz,loop2 djnz loop call bit_close_ei ret z88dk-1.8.ds1/libsrc/games/games.inc0000644000175000017500000000241410725024477016656 0ustar tygrystygrys; ; Game functions parameters ; ; Written by Stefano Bodrato 1/10/2001 ; based on the Dominic's sound routines ; ; ; $Id: games.inc,v 1.8 2007/12/03 16:05:19 stefano Exp $ ; IF FORzx defc sndbit_port = 254 defc sndbit_bit = 4 defc sndbit_mask = 16 ; (2^sndbit_bit) ENDIF IF FORmsx defc sndbit_port = 170 defc sndbit_bit = 7 defc sndbit_mask = 158 ; bit 7 (key click) and 5 (tape) ENDIF IF FORsam defc sndbit_port = 254 defc sndbit_bit = 4 defc sndbit_mask = 16 ; (2^sndbit_bit) ENDIF IF FORz88 defc sndbit_port = $B0 defc sndbit_bit = 6 defc sndbit_mask = 64 ENDIF IF FORjupiter defc sndbit_port = $FE defc sndbit_bit = 0 defc sndbit_mask = 1 ENDIF IF FORaquarius defc sndbit_port = $FC defc sndbit_bit = 0 defc sndbit_mask = 1 ENDIF IF FORti82 defc sndbit_port = 0 defc sndbit_bit = 2 defc sndbit_mask = @00111100 ENDIF IF FORti83 defc sndbit_port = 0 defc sndbit_bit = 0 defc sndbit_mask = 3 ENDIF IF FORti83p defc sndbit_port = 0 defc sndbit_bit = 0 defc sndbit_mask = 3 ENDIF IF FORti85 defc sndbit_port = 7 defc sndbit_bit = 2 defc sndbit_mask = @00111100 ENDIF IF FORti86 defc sndbit_port = 7 defc sndbit_bit = 2 defc sndbit_mask = @00111100 ENDIF z88dk-1.8.ds1/libsrc/games/joystick.asm0000644000175000017500000000205407457364557017446 0ustar tygrystygrys; ; Generic game device library ; Stefano Bodrato - 20/8/2001 ; ; $Id: joystick.asm,v 1.2 2002/04/17 21:30:23 dom Exp $ ; XLIB joystick LIB getk .joystick ld ix,0 add ix,sp ld a,(ix+2) cp 1 ; Stick emulation 1 (qaop-mn) jr nz,j_no1 call getk ld a,l ld l,0 or @00100000 ; TO_LOWER cp 'm' jr nz,no_fire1 set 4,l jr j_done .no_fire1 cp 'n' jr nz,no_fire2 set 5,l jr j_done .no_fire2 cp 'q' jr nz,no_up set 3,l jr j_done .no_up cp 'a' jr nz,no_down set 2,l jr j_done .no_down cp 'o' jr nz,no_left set 1,l jr j_done .no_left cp 'p' jr nz,no_right set 0,l .no_right jr j_done .j_no1 cp 2 ; Stick emulation 2 (8246-05) jr nz,j_no2 call getk ld a,l ld l,0 cp '0' jr nz,no_fire1_a set 4,l jr j_done .no_fire1_a cp '5' jr nz,no_fire2_a set 5,l jr j_done .no_fire2_a cp '8' jr nz,no_up_a set 3,l jr j_done .no_up_a cp '2' jr nz,no_down_a set 2,l jr j_done .no_down_a cp '4' jr nz,no_left_a set 1,l jr j_done .no_left_a cp '6' jr nz,no_right_a set 0,l .no_right_a jr j_done .j_no2 xor a .j_done ret z88dk-1.8.ds1/libsrc/games/Makefile0000644000175000017500000000165110763607640016532 0ustar tygrystygrys# $Id: Makefile,v 1.11 2008/03/05 20:35:46 dom Exp $ include ../Make.config lz88: zcc +z88 $(CFLAGS) -DZ88 bit_frequency.c zcc +z88 $(CFLAGS) -DZ88 bit_play.c lzx: zcc +zx $(CFLAGS) -DSPECTRUM bit_frequency.c zcc +zx $(CFLAGS) -DSPECTRUM bit_play.c lticalc: zcc +ti82 $(CFLAGS) -DTICALC bit_frequency.c zcc +ti82 $(CFLAGS) -DTICALC bit_play.c # I'm not sure on the OZ700 clock.. let's assume it is equal to the TI calculators one loz: zcc +ozansi $(CFLAGS) -DTICALC bit_frequency.c zcc +ozansi $(CFLAGS) -DTICALC bit_play.c lace: zcc +aceansi $(CFLAGS) -DACE bit_frequency.c zcc +aceansi $(CFLAGS) -DACE bit_play.c laquarius: zcc +aquarius $(CFLAGS) -DAQUARIUS bit_frequency.c zcc +aquarius $(CFLAGS) -DAQUARIUS bit_play.c lmsx: zcc +msx $(CFLAGS) -DMSX bit_frequency.c zcc +msx $(CFLAGS) -DMSX bit_play.c clean: $(RM) *.sym *.map zcc_opt.def *.o* $(RM) ace/*.o aquarius/*.o msx/*.o sam/*.o spectrum/*.o z88/*.o z88dk-1.8.ds1/libsrc/games/msx/0000755000175000017500000000000010765202715015672 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/games/msx/bit_close.asm0000755000175000017500000000032110725024477020341 0ustar tygrystygrys; $Id: bit_close.asm,v 1.1 2007/12/03 16:05:19 stefano Exp $ ; ; MSX bit sound functions ; ; void bit_close(); ; ; Stefano Bodrato - 3/12/2007 ; XLIB bit_close .bit_close ei ret z88dk-1.8.ds1/libsrc/games/msx/bit_close_ei.asm0000755000175000017500000000035310725024477021023 0ustar tygrystygrys; $Id: bit_close_ei.asm,v 1.1 2007/12/03 16:05:19 stefano Exp $ ; ; MSX bit sound functions ; ; Close sound and restore interrupts ; ; Stefano Bodrato - 3/12/2007 ; XLIB bit_close_ei .bit_close_ei ei ret z88dk-1.8.ds1/libsrc/games/msx/bit_open.asm0000755000175000017500000000117710725024477020207 0ustar tygrystygrys; $Id: bit_open.asm,v 1.1 2007/12/03 16:05:19 stefano Exp $ ; ; MSX bit sound functions ; ; void bit_open(); ; ; Stefano Bodrato - 3/12/2007 ; XLIB bit_open XREF snd_tick ;Port 0AAh, PPI Port C - Keyboard Row,LED,Cassette (Read/Write) ; Bit Name Expl. ; 0-3 KB0-3 Keyboard line (0-8 on SV738 X'Press) ; 4 CASON Cassette motor relay (0=On, 1=Off) ; 5 CASW Cassette audio out (Pulse) ; 6 CAPS CAPS-LOCK lamp (0=On, 1=Off) ; 7 SOUND Keyboard klick bit (Pulse) .bit_open ld a,@11110000 ld (snd_tick),a ret z88dk-1.8.ds1/libsrc/games/msx/bit_open_di.asm0000755000175000017500000000127010725024477020655 0ustar tygrystygrys; $Id: bit_open_di.asm,v 1.1 2007/12/03 16:05:19 stefano Exp $ ; ; MSX bit sound functions ; ; Open sound and disable interrupts for exact timing ; ; Stefano Bodrato - 3/12/2007 ; XLIB bit_open_di XREF snd_tick ;Port 0AAh, PPI Port C - Keyboard Row,LED,Cassette (Read/Write) ; Bit Name Expl. ; 0-3 KB0-3 Keyboard line (0-8 on SV738 X'Press) ; 4 CASON Cassette motor relay (0=On, 1=Off) ; 5 CASW Cassette audio out (Pulse) ; 6 CAPS CAPS-LOCK lamp (0=On, 1=Off) ; 7 SOUND Keyboard klick bit (Pulse) .bit_open_di di ld a,@11110000 ld (snd_tick),a ret z88dk-1.8.ds1/libsrc/games/msx/joystick.asm0000755000175000017500000000221410725024477020240 0ustar tygrystygrys; ; Game device library for the MSX ; Stefano Bodrato - 3/12/2007 ; ; $Id: joystick.asm,v 1.1 2007/12/03 16:05:19 stefano Exp $ ; XLIB joystick LIB msxbios LIB getk .joystick pop hl pop de push de push hl ld a,e dec a jr nz,nokeystick call getk ld a,l ld l,0 or @00100000 ; TO_LOWER cp 'm' jr nz,no_fire1 set 4,l jr j_done .no_fire1 cp 'n' jr nz,no_fire2 set 5,l jr j_done .no_fire2 cp 'q' jr nz,no_up set 3,l jr j_done .no_up cp 'a' jr nz,no_down set 2,l jr j_done .no_down cp 'o' jr nz,no_left set 1,l jr j_done .no_left cp 'p' jr nz,no_right set 0,l .no_right .j_done ret .nokeystick dec a jr nz,nostck1 ld a,$df ; 11011111 ld (loc1+1),a ld a,$4c ; 01001100 ld (loc2+1),a jr joyst .nostck1 ld a,$af ; 10101111 ld (loc1+1),a ld a,$03 ; 00000011 ld (loc2+1),a .joyst di ld a,$0f out ($0a),a in a,($a2) .loc1 and $df .loc2 or $4c out ($a1),a ld a,$0e out ($a0),a in a,($a2) ei ; Bit #: 76 5 4 3210 ; || | | |||| ; Name: 10 TRG2 TRG1 RLDU ld l,0 ld h,l rra ; UP rl l rra ; DOWN rl l ; L rra rl l rra rl l rra rl l rra rl l ret z88dk-1.8.ds1/libsrc/games/sam/0000755000175000017500000000000010765202715015643 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/games/sam/beeper.asm0000755000175000017500000000310407617701571017616 0ustar tygrystygrys; $Id: beeper.asm,v 1.1 2003/02/04 09:10:17 stefano Exp $ ; ; ZX Spectrum 1 bit sound functions ; ; Stefano Bodrato - 28/9/2001 ; XLIB beeper ; ; Spectrum beeper routine!! ; HL=duration ; DE=frequency ; ; Comments got from: http://www.wearmouth.demon.co.uk/scsra.htm ; ---------------------------------------------------------------- ; ; Outputs a square wave of given duration and frequency ; to the loudspeaker. ; Enter with: DE = #cycles - 1 ; HL = tone period as described next ; ; The tone period is measured in T states and consists of ; three parts: a coarse part (H register), a medium part ; (bits 7..2 of L) and a fine part (bits 1..0 of L) which ; contribute to the waveform timing as follows: ; ; coarse medium fine ; duration of low = 118 + 1024*H + 16*(L>>2) + 4*(L&0x3) ; duration of hi = 118 + 1024*H + 16*(L>>2) + 4*(L&0x3) ; Tp = tone period = 236 + 2048*H + 32*(L>>2) + 8*(L&0x3) ; = 236 + 2048*H + 8*L = 236 + 8*HL ; ; As an example, to output five seconds of middle C (261.624 Hz): ; (a) Tone period = 1/261.624 = 3.822ms ; (b) Tone period in T-States = 3.822ms*fCPU = 13378 ; where fCPU = clock frequency of the CPU = 3.5MHz ; (c) Find H and L for desired tone period: ; HL = (Tp - 236) / 8 = (13378 - 236) / 8 = 1643 = 0x066B ; (d) Tone duration in cycles = 5s/3.822ms = 1308 cycles ; DE = 1308 - 1 = 0x051B ; ; The resulting waveform has a duty ratio of exactly 50%. ; ; ---------------------------------------------------------------- .beeper jp $016F z88dk-1.8.ds1/libsrc/games/sam/bit_close.asm0000755000175000017500000000033307617701571020320 0ustar tygrystygrys; $Id: bit_close.asm,v 1.1 2003/02/04 09:10:17 stefano Exp $ ; ; ZX Spectrum 1 bit sound functions ; ; void bit_click(); ; ; Stefano Bodrato - 28/9/2001 ; XLIB bit_close .bit_close ei ret z88dk-1.8.ds1/libsrc/games/sam/bit_close_ei.asm0000755000175000017500000000036507617701571021002 0ustar tygrystygrys; $Id: bit_close_ei.asm,v 1.1 2003/02/04 09:10:17 stefano Exp $ ; ; ZX Spectrum 1 bit sound functions ; ; Close sound and restore interrupts ; ; Stefano Bodrato - 28/9/2001 ; XLIB bit_close_ei .bit_close_ei ei ret z88dk-1.8.ds1/libsrc/games/sam/bit_open.asm0000755000175000017500000000052307617701572020156 0ustar tygrystygrys; $Id: bit_open.asm,v 1.1 2003/02/04 09:10:18 stefano Exp $ ; ; ZX Spectrum 1 bit sound functions ; ; void bit_open(); ; ; Stefano Bodrato - 28/9/2001 ; XLIB bit_open XREF snd_tick .bit_open ld a,(23624) rrca rrca rrca or 8 ld (snd_tick),a ret z88dk-1.8.ds1/libsrc/games/sam/bit_open_di.asm0000755000175000017500000000062207617701572020632 0ustar tygrystygrys; $Id: bit_open_di.asm,v 1.1 2003/02/04 09:10:18 stefano Exp $ ; ; ZX Spectrum 1 bit sound functions ; ; Open sound and disable interrupts for exact timing ; ; Stefano Bodrato - 28/9/2001 ; XLIB bit_open_di LIB bit_open XREF snd_tick .bit_open_di di jp bit_open ; ld a,(23624) ; rrca ; rrca ; rrca ; or 8 ; ld (snd_tick),a ; ret z88dk-1.8.ds1/libsrc/games/spectrum/0000755000175000017500000000000010765202715016725 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/games/spectrum/beeper.asm0000644000175000017500000000307607457364560020712 0ustar tygrystygrys; $Id: beeper.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; ZX Spectrum 1 bit sound functions ; ; Stefano Bodrato - 28/9/2001 ; XLIB beeper ; ; Spectrum beeper routine!! ; HL=duration ; DE=frequency ; ; Comments got from: http://www.wearmouth.demon.co.uk/scsra.htm ; ---------------------------------------------------------------- ; ; Outputs a square wave of given duration and frequency ; to the loudspeaker. ; Enter with: DE = #cycles - 1 ; HL = tone period as described next ; ; The tone period is measured in T states and consists of ; three parts: a coarse part (H register), a medium part ; (bits 7..2 of L) and a fine part (bits 1..0 of L) which ; contribute to the waveform timing as follows: ; ; coarse medium fine ; duration of low = 118 + 1024*H + 16*(L>>2) + 4*(L&0x3) ; duration of hi = 118 + 1024*H + 16*(L>>2) + 4*(L&0x3) ; Tp = tone period = 236 + 2048*H + 32*(L>>2) + 8*(L&0x3) ; = 236 + 2048*H + 8*L = 236 + 8*HL ; ; As an example, to output five seconds of middle C (261.624 Hz): ; (a) Tone period = 1/261.624 = 3.822ms ; (b) Tone period in T-States = 3.822ms*fCPU = 13378 ; where fCPU = clock frequency of the CPU = 3.5MHz ; (c) Find H and L for desired tone period: ; HL = (Tp - 236) / 8 = (13378 - 236) / 8 = 1643 = 0x066B ; (d) Tone duration in cycles = 5s/3.822ms = 1308 cycles ; DE = 1308 - 1 = 0x051B ; ; The resulting waveform has a duty ratio of exactly 50%. ; ; ---------------------------------------------------------------- .beeper jp 949 z88dk-1.8.ds1/libsrc/games/spectrum/bit_close.asm0000644000175000017500000000032707457364560021407 0ustar tygrystygrys; $Id: bit_close.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; ZX Spectrum 1 bit sound functions ; ; void bit_click(); ; ; Stefano Bodrato - 28/9/2001 ; XLIB bit_close .bit_close ei ret z88dk-1.8.ds1/libsrc/games/spectrum/bit_close_ei.asm0000644000175000017500000000036107457364560022062 0ustar tygrystygrys; $Id: bit_close_ei.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; ZX Spectrum 1 bit sound functions ; ; Close sound and restore interrupts ; ; Stefano Bodrato - 28/9/2001 ; XLIB bit_close_ei .bit_close_ei ei ret z88dk-1.8.ds1/libsrc/games/spectrum/bit_open.asm0000644000175000017500000000051707457364560021244 0ustar tygrystygrys; $Id: bit_open.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; ZX Spectrum 1 bit sound functions ; ; void bit_open(); ; ; Stefano Bodrato - 28/9/2001 ; XLIB bit_open XREF snd_tick .bit_open ld a,(23624) rrca rrca rrca or 8 ld (snd_tick),a ret z88dk-1.8.ds1/libsrc/games/spectrum/bit_open_di.asm0000644000175000017500000000060707457364560021720 0ustar tygrystygrys; $Id: bit_open_di.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; ZX Spectrum 1 bit sound functions ; ; Open sound and disable interrupts for exact timing ; ; Stefano Bodrato - 28/9/2001 ; XLIB bit_open_di XREF snd_tick .bit_open_di di ld a,(23624) rrca rrca rrca or 8 ld (snd_tick),a ret z88dk-1.8.ds1/libsrc/games/spectrum/joystick.asm0000644000175000017500000000207707457364560021307 0ustar tygrystygrys; ; Game device library for the ZX Spectrum ; Stefano Bodrato - 20/8/2001 ; ; $Id: joystick.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; XLIB joystick .joystick ld ix,0 add ix,sp ld a,(ix+2) cp 1 ; Kempston Joystick jr nz,j_no1 in a,(31) jp j_done .j_no1 cp 2 ; Sinclair 1 jr nz,j_no2 ld bc,61438 in a,(c) xor @00011111 ld l,a xor a rr l rla rr l rla rr l rla rr l rr l rla rl l rla jr j_done .j_no2 cp 3 ; Sinclair 2 jr nz,j_no3 ld bc,63486 in a,(c) xor @00011111 ld l,a and @00011100 ld h,a xor a rr l rla rr l rla or h jr j_done .j_no3 cp 4 ; Cursor KEYS jr nz,j_no4 ld bc,$F7FE in a,(c) rla rla rla xor 128 ld h,a ld b,$EF in a,(c) xor @00011111 ld l,a rra and 1 ; "fire2" rr l ; "fire1" rla rr l ld e,l ; save the "right" bit rr l rr l ; "up" rla rr l ; "down" rla rl h ; "left" rla rr e ; "right" rla jr j_done .j_no4 cp 5 ; Fuller (untested!) jr nz,j_no5 in a,(127) ld l,0 rra rl l rra rl l rra rl l rra rl l rla and 16 or l jr j_done .j_no5 xor a .j_done ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/games/ticalc/0000755000175000017500000000000010765202715016322 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/games/ticalc/bit_close.asm0000644000175000017500000000034207457364560021001 0ustar tygrystygrys; $Id: bit_close.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; TI calculator "Infrared port" 1 bit sound functions stub ; ; void bit_close(); ; ; Stefano Bodrato - 24/10/2001 ; XLIB bit_close .bit_close ret z88dk-1.8.ds1/libsrc/games/ticalc/bit_close_ei.asm0000644000175000017500000000041307457364560021455 0ustar tygrystygrys; $Id: bit_close_ei.asm,v 1.3 2002/04/17 21:30:24 dom Exp $ ; ; TI calculator "Infrared port" 1 bit sound functions stub ; ; (Close sound) and restore interrupts ; ; Stefano Bodrato - 24/10/2001 ; XLIB bit_close_ei XREF tiei .bit_close_ei ei ret z88dk-1.8.ds1/libsrc/games/ticalc/bit_open.asm0000644000175000017500000000076707457364560020650 0ustar tygrystygrys; $Id: bit_open.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; TI calculator "Infrared port" 1 bit sound functions stub ; ; void bit_open(); ; ; Stefano Bodrato - 24/10/2001 ; XLIB bit_open .bit_open IF FORti82 ld a,@11000000 ; Set W1 and R1 out (0),a ld a,@11010100 ENDIF IF FORti83 ld a,@11010000 ENDIF IF FORti85 ld a,@11000000 out (7),a ENDIF IF FORti86 ld a,@11000000 out (7),a ENDIF ret z88dk-1.8.ds1/libsrc/games/ticalc/bit_open_di.asm0000644000175000017500000000107407457364560021314 0ustar tygrystygrys; $Id: bit_open_di.asm,v 1.3 2002/04/17 21:30:24 dom Exp $ ; ; TI calculator "Infrared port" 1 bit sound functions stub ; ; (Open sound port) and disable interrupts for exact timing ; ; Stefano Bodrato - 24/10/2001 ; XLIB bit_open_di XREF tidi .bit_open_di di IF FORti82 ld a,@11000000 ; Set W1 and R1 out (0),a ld a,@11010100 ENDIF IF FORti83 ld a,@11010000 ENDIF IF FORti85 ld a,@11000000 out (7),a ENDIF IF FORti86 ld a,@11000000 out (7),a ENDIF ret z88dk-1.8.ds1/libsrc/games/ticalc/joystick.asm0000644000175000017500000000237507457364560020705 0ustar tygrystygrys; ; Game device library for the TI calculators ; Stefano Bodrato - 21/8/2001 ; Henk Poley - 03/9/2001 ; ; $Id: joystick.asm,v 1.4 2002/04/17 21:30:24 dom Exp $ ; XLIB joystick .joystick pop af ; pop bc ; game device push bc ; push af ; ;xor a ; ;cp b ; Test high-byte (should be zero) ;jr nz,error ; ld hl,-1 ; HL = 'ERROR' dec c ; Test if device 1 is requested jr z,device1 ; .error ret .device1 ; H = -1 inc l ; L = 0 inc c ; C = 1 out (c),h ; Reset keypad (out (1),$FF) ld a,$BF ; Enable group 7 out (1),a ; in a,(1) ; and @00100000 ; [2nd] pressed ? jr nz,nofire1 ; if zero, then [2nd] was pressed inc l ; L = @00000001 .nofire1 ;out (c),h ; ld a,$DF ; Enable group 6 out (1),a ; in a,(1) ; and @10000000 ; [Alpha] pressed ? jr nz,nofire2 ; if zero, then [Alpha] set 1,l ; L = @0000001x .nofire2 out (c),h ; ld a,$FE ; Enable group 1 out (1),a ; in a,(1) ; cpl ; rl l ; space for the [up] bit rra ; [down] bit -> Carry rl l ; L <- Carry rra ; [left] bit -> Carry rl l ; L <- Carry rra ; [right] bit -> Carry rl l ; L <- Carry rra ; [up] bit -> Carry jr nc,j_done ; Test Carry, if set... set 3,l ; then, set bit 3 in L .j_done ; else, return inc h ; H = 0 ret z88dk-1.8.ds1/libsrc/games/z88/0000755000175000017500000000000010765202715015514 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/games/z88/beeper.asm0000644000175000017500000000223607457364560017476 0ustar tygrystygrys; $Id: beeper.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Z88 1 bit sound functions ; XLIB beeper INCLUDE "#interrpt.def" ; ; Entry as for Spectrum beeper routine!! ; ; Ported by Dominic Morris ; Direct transfer, of code..no point commenting really ; .beeper call oz_di push af ld a,l srl l srl l cpl and 3 ld c,a ld b,0 ld ix,beixp3 add ix,bc ;OZ stuff here.. ld a,($4B0) and 63 ld ($4B0),a out ($B0),a .beixp3 nop nop nop inc b inc c .behllp dec c jr nz,behllp ld c,$3F dec b jp nz,behllp xor 64 out ($B0),a ld b,h ld c,a bit 6,a ;if o/p go again! jr nz,be_again ld a,d or e jr z,be_end ld a,c ld c,l dec de jp (ix) .be_again ld c,l inc c jp (ix) .be_end pop af jp oz_ei z88dk-1.8.ds1/libsrc/games/z88/bit_close.asm0000644000175000017500000000047007457364560020175 0ustar tygrystygrys; $Id: bit_close.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Z88 1 bit sound functions ; ; void bit_close(); ; ; Stefano Bodrato - 28/9/2001 ; Based on the Dominic Morris' code ; XLIB bit_close INCLUDE "#interrpt.def" XREF snd_asave .bit_close ld a,(snd_asave) ret z88dk-1.8.ds1/libsrc/games/z88/bit_close_ei.asm0000644000175000017500000000054707457364560020657 0ustar tygrystygrys; $Id: bit_close_ei.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Z88 1 bit sound functions ; ; Close sound and restore interrupts ; ; Stefano Bodrato - 28/9/2001 ; Based on the Dominic Morris' code ; XLIB bit_close_ei INCLUDE "#interrpt.def" XREF snd_asave .bit_close_ei ld a,(snd_asave) call oz_ei ret z88dk-1.8.ds1/libsrc/games/z88/bit_open.asm0000644000175000017500000000067607457364560020041 0ustar tygrystygrys; $Id: bit_open.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Z88 1 bit sound functions ; ; void bit_open(); ; ; Stefano Bodrato - 28/9/2001 ; Based on the Dominic Morris' code ; XLIB bit_open INCLUDE "#interrpt.def" XREF snd_asave XREF snd_tick .bit_open ld (snd_asave),a ld a,($4B0) and 63 ld ($4B0),a out ($B0),a ld (snd_tick),a ret z88dk-1.8.ds1/libsrc/games/z88/bit_open_di.asm0000644000175000017500000000100307457364560020476 0ustar tygrystygrys; $Id: bit_open_di.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; ; Z88 1 bit sound functions ; ; Open sound port and disable interrupts for exact timing ; ; Stefano Bodrato - 28/9/2001 ; Based on the Dominic Morris' code ; XLIB bit_open_di INCLUDE "#interrpt.def" XREF snd_asave XREF snd_tick .bit_open_di call oz_di ld (snd_asave),a ld a,($4B0) and 63 ld ($4B0),a out ($B0),a ld (snd_tick),a ret z88dk-1.8.ds1/libsrc/games/zxvgs/0000755000175000017500000000000010765202715016244 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/games/zxvgs/joystick.asm0000644000175000017500000000104007457364560020613 0ustar tygrystygrys; ; Game device library for the ZX Spectrum ; Stefano Bodrato - 20/8/2001 ; ; $Id: joystick.asm,v 1.2 2002/04/17 21:30:24 dom Exp $ ; INCLUDE "#zxvgs.def" XLIB joystick .joystick ld ix,0 add ix,sp ld a,(ix+2) cp 1 ; Joystick 0 jr nz,j_no1 rst 8 defb ZXVGS_J0 jp j_done .j_no1 cp 2 ; Joystick 1 jr nz,j_no2 rst 8 defb ZXVGS_J1 jr j_done .j_no2 cp 3 ; Joystick 2 jr nz,j_no3 rst 8 defb ZXVGS_J2 jr j_done .j_no3 cp 4 ; Joystick 3 jr nz,j_no4 rst 8 defb ZXVGS_J3 .j_no4 xor a .j_done ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/genmath/0000755000175000017500000000000010765202715015412 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/genmath/acos.c0000644000175000017500000000036307423075611016505 0ustar tygrystygrys/* * acos(x) * * -1 < x < 1 * * Undefined results otherwise * * $Id: acos.c,v 1.2 2002/01/21 20:35:21 dom Exp $ */ #include #include extern double _halfpi; double acos(double x) { return ( _halfpi - asin(x) ); } z88dk-1.8.ds1/libsrc/genmath/addhalf.asm0000644000175000017500000000026607423075611017503 0ustar tygrystygrys; Small C+ Math Library ; General "fudging routine" XLIB addhalf LIB hladd .addhalf ld hl,half jp hladd .HALF DEFB 0,0,0,0,0,$80 ;0.5 z88dk-1.8.ds1/libsrc/genmath/amax.asm0000644000175000017500000000054407423075611017045 0ustar tygrystygrys; Small C+ Math Library XLIB amax LIB ldbchl LIB compare LIB ldfabc ; ; amax(a,b) returns the greater of a and b .AMAX LD HL,8 ;offset for 1st argument ADD HL,SP CALL LDBCHL ;bcixde := 1st argument CALL COMPARE JP M,LDFABC RET z88dk-1.8.ds1/libsrc/genmath/amin.asm0000644000175000017500000000041207423075611017035 0ustar tygrystygrys; Small C+ Math Library XLIB amin LIB ldbchl LIB compare LIB ldfabc ; ; amin(a,b) .aMIN LD HL,8 ADD HL,SP CALL LDBCHL CALL COMPARE JP P,LDFABC RET z88dk-1.8.ds1/libsrc/genmath/asin.c0000644000175000017500000000045507422607545016522 0ustar tygrystygrys/* * asin(x) * * -1 < x < 1 * * Undefined results otherwise * * $Id: asin.c,v 1.1 2002/01/20 18:41:41 dom Exp $ */ #include #include double asin(double x) { double y; #if 0 if ( x > 1. || -x >1. ) return 0. #endif y = atan(x/(1.+sqrt(1.-(x*x)))); return y + y; } z88dk-1.8.ds1/libsrc/genmath/atan.asm0000644000175000017500000000272207423075611017042 0ustar tygrystygrys; Small C+ Maths Routines ; ; transcendental floating point routines ; XLIB atan LIB evenpol LIB hlsub LIB odd LIB sgn LIB fdiv XREF dload XREF fa XDEF __halfpi XDEF __pi .__PI DEFB $22,$A2,$DA,$0F,$49,$82 ;pi .__HALFPI DEFB $22,$A2,$DA,$0F,$49,$81 ; pi/2 ;double atan(double val) .atan CALL SGN CALL M,ODD ;negate argument & answer LD A,(FA+5) CP $81 JR C,ATAN5 ;c => argument less than 1 LD BC,$8100 ;1.0 LD IX,0 LD D,C LD E,C CALL FDIV ld hl,hlsub push hl .ATAN5 LD HL,ATNCOEF CALL EVENPOL LD HL,__HALFPI ;may use for subtraction ret ; .ATNCOEF defb 13 ;hmmm? $13? defb $14, $7,$BA,$FE,$62,$75 defb $51,$16,$CE,$D8,$D6,$78 defb $4C,$BD,$7D,$D1,$3E,$7A defb $1, $CB,$23,$C4,$D7,$7B defb $DC,$3A,$A, $17,$34,$7C defb $36,$C1,$A3,$81,$F7,$7C defb $EB,$16,$61,$AE,$19,$7D defb $5D,$78,$8F,$60,$B9,$7D defb $A2,$44,$12,$72,$63,$7D defb $16,$62,$FB,$47,$92,$7E defb $C0,$F0,$BF,$CC,$4C,$7E defb $7E,$8E,$AA,$AA,$AA,$7F defb $F6,$FF,$FF,$FF,$7F,$80 z88dk-1.8.ds1/libsrc/genmath/atan2.c0000644000175000017500000000060407423075611016563 0ustar tygrystygrys#include #include #include "float.h" extern double _pi; extern double _halfpi; /* arc tangent of y/x */ double atan2(y,x) double x, y ; { double a; if (fabs(x) >= fabs(y)) { a = atan(y/x) ; if (x < 0.0) { if (y >= 0.0) a += _pi ; else a -= _pi ; } } else { a = -atan(x/y) ; if (y < 0.0) a -= _halfpi ; else a += _halfpi ; } return a ; } z88dk-1.8.ds1/libsrc/genmath/atof.c0000644000175000017500000000370407424642021016507 0ustar tygrystygrys/* * Atof (generic routine) * * Don't recompile cos we get a label clash! */ #include #include #include #include /* decimal to (double) binary conversion */ double atof(s) unsigned char s[]; /* s points to a character string */ { double sum, /* the partial result */ scale; /* scale factor for the next digit */ double ten; unsigned char *start, /* copy if input pointer */ *end, /* points to end of number */ c; /* character from input line */ int minus, /* nonzero if number is negative */ dot, /* nonzero if *s is decimal point */ decimal; /* nonzero if decimal point found */ ten = 10.; if ( *s == '-' ) { minus = 1 ; ++s ; } else minus = 0 ; start = s ; decimal = 0 ; /* no decimal point seen yet */ while( (dot=(*s=='.')) || isdigit(*s) ) { if ( dot ) ++decimal ; ++s ; /* scan to end of string */ } end = s ; sum = 0. ; /* initialize answer */ if ( decimal ) { /* handle digits to right of decimal */ --s ; while ( *s != '.' ) sum = ( sum + ((double)( *(s--) - '0' )) ) / 10. ; } scale = 1. ; /* initialize scale factor */ while ( --s >= start ) { /* handle remaining digits */ sum += scale * ((double)( *s-'0' )) ; scale *= 10. ; } c = *end++ ; if( tolower(c)=='e' ) { /* interpret exponent */ int neg ; /* nonzero if exp negative */ int expon ; /* absolute value of exp */ int k ; /* mask */ neg = expon = 0 ; if ( *end == '-' ) { /* negative exponent */ neg = 1 ; ++end ; } while(1) { /* read an integer */ if ( (c=*end++) >= '0' ) { if ( c <= '9' ) { expon = expon * 10 + c - '0' ; continue ; } } break; } if ( expon > 38 ) { #if 0 puts("overflow") ; #endif expon = 0 ; } k = 32 ; /* set one bit in mask */ scale = 1. ; while(k) { scale *= scale; if ( k & expon ) scale *= ten ; k >>= 1 ; } if(neg) sum /= scale; else sum *= scale; } if (minus) sum = -sum ; return sum ; } z88dk-1.8.ds1/libsrc/genmath/ceil.asm0000644000175000017500000000031407423075612017027 0ustar tygrystygrys; Small C+ Math Library ; ceil(x) XLIB ceil LIB floor LIB odd ; return -(floor(-x)) .CEIL CALL ODD jp floor z88dk-1.8.ds1/libsrc/genmath/compare.asm0000644000175000017500000000277107423075612017552 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; set flags per FA - ( bc ix de ) ; ; $Id: compare.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB compare LIB sgn XREF setflgs XREF fa .COMPARE LD A,B OR A JP Z,SGN ;bc ix de = 0, so ; sign of FA is result CALL SGN LD A,C JP Z,SETFLGS ;FA = 0, so sign of ; -(bc ix de) is result LD HL,FA+4 XOR (HL) LD A,C JP M,SETFLGS ;operands have opposite ; signs, so result is sign ; of -(bc ix de) CALL CPFRAC RRA ;recover cy bit XOR C ;reverse sign if numbers are negative JP SETFLGS .CPFRAC INC HL ;compare bc ix de to (HL) LD A,B CP (HL) RET NZ DEC HL LD A,C CP (HL) RET NZ DEC HL DEFB $DD LD A,H CP (HL) RET NZ DEC HL DEFB $DD LD A,L CP (HL) RET NZ DEC HL LD A,D CP (HL) RET NZ DEC HL LD A,E SUB (HL) RET NZ POP HL ;return zero to program RET ;that called "COMPARE" z88dk-1.8.ds1/libsrc/genmath/cos.asm0000644000175000017500000000072207423075612016702 0ustar tygrystygrys; Small C+ Maths Routines ; ; transcendental floating point routines ; XLIB cos LIB sin LIB hladd XREF __halfpi ;double cos(double val) ;Looks odd, but don't worry..value is already in FA - no need for stack ; ; transcendental functions: sin, cos, tan ; .COS LD HL,HALFPI ;local copy.. CALL HLADD jp sin .halfpi DEFB $22,$A2,$DA,$0F,$49,$81 ; pi/2 z88dk-1.8.ds1/libsrc/genmath/cosh.c0000644000175000017500000000021007130401722016472 0ustar tygrystygrys#include #include #include "float.h" double cosh(x) double x; { double e; e = exp(x) ; return 0.5*(e+1.0/e) ; } z88dk-1.8.ds1/libsrc/genmath/dadd.asm0000644000175000017500000000030607423075612017010 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; ; $Id: dadd.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB dadd LIB fadd .dadd pop hl pop de pop ix pop bc push hl jp fadd z88dk-1.8.ds1/libsrc/genmath/dcompar.asm0000644000175000017500000000076410703704554017550 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; common routine for double precision comparisons ; ; $Id: dcompar.asm,v 1.2 2007/10/12 14:49:16 stefano Exp $: XLIB dcompar LIB compare .dcompar POP HL ;save 1st return addr POP AF ;save 2nd return addr POP DE ;get number to compare POP IX POP BC PUSH AF ;replace 2nd addr PUSH HL ;replace 1st addr, fall into... jp compare z88dk-1.8.ds1/libsrc/genmath/ddiv.asm0000644000175000017500000000033007423075612017037 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; ; ; $Id: ddiv.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB ddiv LIB fdiv .ddiv pop hl ;ret address pop de pop ix pop bc push hl jp fdiv z88dk-1.8.ds1/libsrc/genmath/deq.asm0000644000175000017500000000033107423075612016663 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; TOS >= FA ; ; $Id: deq.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB deq LIB dcompar LIB f_yes LIB f_no .deq call dcompar jp z,f_yes jp f_no z88dk-1.8.ds1/libsrc/genmath/dge.asm0000644000175000017500000000034507423075612016656 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; TOS >= FA ; ; $Id: dge.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB dge LIB dcompar LIB f_yes LIB f_no .dge call dcompar jp z,f_yes jp p,f_no jp f_yes z88dk-1.8.ds1/libsrc/genmath/dgt.asm0000644000175000017500000000034407423075612016674 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; TOS >= FA ; ; $Id: dgt.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB dgt LIB dcompar LIB f_yes LIB f_no .dgt call dcompar jp z,f_no jp p,f_no jp f_yes z88dk-1.8.ds1/libsrc/genmath/div1.asm0000644000175000017500000000032507423075612016760 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; ; $Id: div1.asm,v 1.1 2002/01/21 20:35:22 dom Exp $ XLIB div1 LIB fdiv .DIV1 POP BC POP IX POP DE jp FDIV z88dk-1.8.ds1/libsrc/genmath/div14.asm0000644000175000017500000000156507423075612017053 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Find exponent for product (l=0) or quotient(l=ff) ; ; $Id: div14.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB div14 LIB unpack LIB norm4 XREF FA .DIV14 LD A,B OR A JR Z,DIV20 LD A,L ;get product/quotient flag LD HL,FA+5 XOR (HL) ;get +-FA exponent ADD A,B ;find and... LD B,A ;...load new exponent RRA XOR B LD A,B JP P,DIV18 ADD A,$80 LD (HL),A Jr Z,div14_1 CALL UNPACK ;restore hidden bits & compare signs LD (HL),A ;save difference of signs DEC HL ;point to MSB of fraction RET .div14_1 pop hl ret .div18 or a .div20 pop hl jp p,norm4 ret ;jp oflow z88dk-1.8.ds1/libsrc/genmath/dleq.asm0000644000175000017500000000035007423075612017040 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; TOS >= FA ; ; $Id: dleq.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB dleq LIB dcompar LIB f_yes LIB f_no .dleq call dcompar jp z,f_yes jp p,f_yes jp f_no z88dk-1.8.ds1/libsrc/genmath/dlt.asm0000644000175000017500000000034407423075612016701 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; TOS >= FA ; ; $Id: dlt.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB dlt LIB dcompar LIB f_yes LIB f_no .dlt call dcompar jp z,f_no jp p,f_yes jp f_no z88dk-1.8.ds1/libsrc/genmath/dmul.asm0000644000175000017500000000033007423075612017052 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; ; ; $Id: dmul.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB dmul LIB fmul .dmul pop hl ;ret address pop de pop ix pop bc push hl jp fmul z88dk-1.8.ds1/libsrc/genmath/dne.asm0000644000175000017500000000033207423075612016661 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; TOS >= FA ; ; $Id: dne.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB dne LIB dcompar LIB f_yes LIB f_no .dne call dcompar jp nz,f_yes jp f_no z88dk-1.8.ds1/libsrc/genmath/dsub.asm0000644000175000017500000000036407423075612017055 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; ; $Id: dsub.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB dsub LIB minusfa LIB fadd .dsub call minusfa pop hl ;return address pop de pop ix pop bc push hl jp fadd z88dk-1.8.ds1/libsrc/genmath/dswap.asm0000644000175000017500000000100007423075612017222 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Exchange FA with top of stack (under ret address) ; ; $Id: dswap.asm,v 1.1 2002/01/21 20:35:22 dom Exp $ XLIB dswap LIB ldfabc XREF dpush .DSWAP POP HL ;return addr POP DE POP IX POP BC EXX ;protect the values CALL DPUSH ;push FA EXX ;recover the values PUSH HL ;replace return addr, fall into... jp ldfabc z88dk-1.8.ds1/libsrc/genmath/evenpol.asm0000644000175000017500000000077707423075612017600 0ustar tygrystygrys; Small C+ Math Library XLIB evenpol LIB poly LIB pushfa LIB ldbcfa LIB fmul ; ; transcendental floating point routines: polynomial evaluation ; .EVENPOL CALL PUSHFA ; LD DE,L265F ; PUSH DE PUSH HL CALL LDBCFA CALL FMUL POP HL call poly ; .L265F POP BC POP IX POP DE JP FMUL ; z88dk-1.8.ds1/libsrc/genmath/exp.asm0000644000175000017500000000273307423075612016716 0ustar tygrystygrys; Small C+ Math Library ; exp(x) ; FIXME: norm4 XLIB exp LIB sgn LIB floor LIB poly LIB fmul LIB pushfa LIB norm4 XREF fa LIB fsub ; ; transcendental functions: exp ; .EXP LD BC,$8138 ;1.442695041 LD IX,$AA3B LD DE,$295C CALL FMUL LD A,(FA+5) CP $88 JP NC,DIV17 CALL PUSHFA CALL FLOOR POP BC POP IX POP DE PUSH AF CALL FSUB LD HL,EXPCOEF CALL POLY LD HL,FA+5 POP AF OR A JP M,EXP5 ADD A,(HL) DEFB 1 ;"ignore next 2 bytes" .EXP5 ADD A,(HL) CCF LD (HL),A RET NC JP DIV17 .div17 call sgn cpl or a pop hl jp p,norm4 ret ;jp oflow ; .EXPCOEF defb 10 defb $CC,$D5,$45,$56,$15,$6A defb $CF,$37,$A0,$92,$27,$6D defb $F5,$95,$EE,$93,$00,$71 defb $D0,$FC,$A7,$78,$21,$74 defb $B1,$21,$82,$C4,$2E,$77 defb $82,$58,$58,$95,$1D,$7A defb $6D,$CB,$46,$58,$63,$7C defb $E9,$FB,$EF,$FD,$75,$7E defb $D2,$F7,$17,$72,$31,$80 defb 0,0,0,0,0,$81 z88dk-1.8.ds1/libsrc/genmath/f_no.asm0000644000175000017500000000025307423075612017036 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Return true ; ; $Id: f_no.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB f_no .f_no ld hl,0 and a ret z88dk-1.8.ds1/libsrc/genmath/f_yes.asm0000644000175000017500000000025507423075612017224 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Return true ; ; $Id: f_yes.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB f_yes .f_yes ld hl,1 scf ret z88dk-1.8.ds1/libsrc/genmath/fabs.asm0000644000175000017500000000034507423075612017032 0ustar tygrystygrys; Small C+ Math Library ; fabs(x) XLIB fabs LIB minusfa LIB sgn XREF fa ; .FABS CALL SGN RET P jp minusfa z88dk-1.8.ds1/libsrc/genmath/fadd.asm0000644000175000017500000000425007423075612017014 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Add bc ix de to FA ; ; $Id: fadd.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB fadd LIB ldbcfa LIB ldfabc LIB norma LIB unpack LIB rshift LIB pack LIB fradd XREF rsh8 XREF fa .FADD LD A,B OR A RET Z ;z => number to be added is zero LD A,(FA+5) OR A JP Z,LDFABC ;z => accumulator is zero, ; just load number SUB B JR NC,ADD2 ;nc => accumulator has larger number NEG ;reverse accumulator & bc ix de... EXX PUSH IX CALL LDBCFA EXX EX (SP),IX CALL LDFABC EXX POP IX ;...end of reversing .ADD2 CP $29 RET NC ;nc => addition makes no change PUSH AF ;save difference of exponents CALL UNPACK ;restore hidden bit & compare signs LD H,A ;save difference in signs POP AF ;recall difference of exponents CALL RSHIFT ;shift c ix de b right by (a) OR H LD HL,FA JP P,ADD4 ;p => opposite signs, must subtract CALL FRADD ;c ix de += FA JP NC,PACK ;nc => adding caused no carry INC HL INC (HL) ;increment exponent ret z ; JP Z,OFLOW LD L,1 CALL RSH8 ;shift c ix de b right by 1 JP PACK ;round, hide msb, & load into FA ; .ADD4 XOR A ;negate b... SUB B LD B,A LD A,(HL) ;c ix de -= FA... SBC A,E LD E,A INC HL LD A,(HL) SBC A,D LD D,A INC HL LD A,(HL) DEFB $DD SBC A,L DEFB $DD LD L,A INC HL LD A,(HL) DEFB $DD SBC A,H DEFB $DD LD H,A INC HL LD A,(HL) SBC A,C LD C,A ;...end of subtraction, fall into... jp norma z88dk-1.8.ds1/libsrc/genmath/fdiv.asm0000644000175000017500000000610707423075612017051 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; divide bc ix de by FA, leave result in FA ; ; $Id: fdiv.asm,v 1.1 2002/01/21 20:35:22 dom Exp $ XLIB fdiv LIB sgn LIB div14 LIB pack2 LIB norm4 XREF FA XREF EXTRA .fdiv call sgn ret z ;dividing by zero.. LD L,$FF ;"quotient" flag CALL DIV14 ;find quotient exponent PUSH IY INC (HL) INC (HL) DEC HL PUSH HL ; c' h'l' d'e' (divisor) = FA... EXX POP HL LD C,(HL) DEC HL LD D,(HL) DEC HL LD E,(HL) DEC HL LD A,(HL) DEC HL LD L,(HL) LD H,A EX DE,HL EXX LD B,C ; b iy hl (dividend) = c ix de... EX DE,HL PUSH IX POP IY XOR A ; c ix de (quotient) = 0... LD C,A LD D,A LD E,A LD IX,0 LD (EXTRA),A .DIV2 PUSH HL ;save b iy hl in case the subtraction PUSH IY ; proves to be unnecessary PUSH BC PUSH HL ; EXTRA b iy hl (dividend) -= LD A,B ; c' h'l' d'e' (divisor)... EXX EX (SP),HL OR A SBC HL,DE EX (SP),HL EX DE,HL PUSH IY EX (SP),HL SBC HL,DE EX (SP),HL POP IY EX DE,HL SBC A,C EXX POP HL LD B,A LD A,(EXTRA) SBC A,0 CCF JR NC,DIV4 ; nc => subtraction caused carry LD (EXTRA),A POP AF ;discard saved value of dividend... POP AF POP AF SCF JR DIV6 .DIV4 POP BC ;restore dividend... POP IY POP HL ; .DIV6 INC C DEC C RRA JP M,DIV12 RLA ;shift c ix de a (quotient) left by 1... RL E RL D EX AF,AF' ;(these 6 lines are adc ix,ix...) ADD IX,IX EX AF,AF' JR NC,DIV8 INC IX .DIV8 EX AF,AF' RL C ;...end of c ix de a shifting ADD HL,HL ;shift EXTRA b iy hl left by 1... EX AF,AF' ADD IY,IY EX AF,AF' JR NC,DIV9 INC IY .DIV9 EX AF,AF' RL B LD A,(EXTRA) RLA LD (EXTRA),A ;...end of EXTRA b iy hl shifting LD A,C ;test c ix de... OR D OR E DEFB $DD OR H DEFB $DD OR L ;...end of c ix de testing JR NZ,DIV2 ;nz => dividend nonzero PUSH HL LD HL,FA+5 DEC (HL) POP HL JR NZ,DIV2 ret ;overflow? ; JR OFLOW2 ; .DIV12 POP IY JP PACK2 z88dk-1.8.ds1/libsrc/genmath/float.asm0000644000175000017500000000153507424634755017240 0ustar tygrystygrys; Generic Z80 Floating point routines ; For Small C+ compiler XLIB float LIB norm LIB l_long_neg XDEF float1 XREF fasign XREF fa ; ; convert the integer in hl to ; a floating point number in FA ; ; This routine will need to be rewritten slightly to handle ; long ints..hopefully fairly OKish.. .float LD A,d ;fetch MSB .float1 CPL ;reverse sign bit LD (FASIGN),A ;save sign (msb) RLA ;move sign into cy JR C,FL4 ;c => nonnegative number call l_long_neg ; fp number is c ix de b .FL4 ld c,d ld ixh,e ld a,h ld ixl,a ld d,l ld e,0 ld b,e LD A,32+128 LD (FA+5),A ;preset exponent JP NORM ;go normalize c ix de b z88dk-1.8.ds1/libsrc/genmath/floor.asm0000644000175000017500000000142607423075612017241 0ustar tygrystygrys; Small C+ Math Library ; ceil(x) XLIB floor LIB int2 LIB norma XREF fa ; ; return largest integer not greater than .FLOOR LD HL,FA+5 LD A,(HL) ;fetch exponent CP $A8 LD A,(FA) RET NC ;nc => binary point is right of lsb LD A,(HL) CALL INT2 LD (HL),$A8 ;place binary pt at end of fraction LD A,E PUSH AF LD A,C RLA CALL NORMA POP AF RET ; ;Huh..dunno what this is doing here.. ; LD HL,FA+5 ; LD (HL),$A8 ; INC HL ; LD (HL),$80 ; LD A,C ; RLA ; JP NORMA z88dk-1.8.ds1/libsrc/genmath/fmod.asm0000644000175000017500000000245207423075612017045 0ustar tygrystygrys; ; ; Generic Maths Library ; ; Small C+ Library ; ; Found this one about 7/12/98 djm ; ; Don't know if it works correctly..let me know! XLIB fmod LIB pushfa LIB fdiv LIB floor LIB fsub LIB fmul ; ; fmod(z,x) = z-x*floor(z/x) ; if x>0 then 0 <= fmod(z,x) < x ; if x<0 then x < fmod(z,x) <= 0 ; .FMOD POP HL ;return addr POP DE ;discard next number POP DE ; (already in FA) POP DE POP DE ;fetch next number POP IX ; (1st operand, or "z") POP BC PUSH DE ;restore stack PUSH DE PUSH DE PUSH DE PUSH DE PUSH DE PUSH HL ;replace return addr PUSH DE ;save another copy of z PUSH IX PUSH BC CALL PUSHFA ;save a copy of 2nd operand ("x") CALL FDIV ;z/x CALL FLOOR ;floor(z/x) POP BC POP IX POP DE CALL FMUL ;x*floor(z/x) POP BC POP IX POP DE ; to find mod(z,x)=z-x*floor(z/x), fall into... jp FSUB z88dk-1.8.ds1/libsrc/genmath/fmul.asm0000644000175000017500000000536607423075612017072 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Multiply fa y bc ix de ; ; $Id: fmul.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB fmul LIB sgn LIB div14 LIB norm XREF fa .FMUL CALL SGN RET Z ; z => accumulator has zero LD L,0 ;"product" flag CALL DIV14 ;find exponent of product LD A,C ;c' h'l' d'e' (multiplicand) = c ix de... PUSH DE EXX LD C,A POP DE PUSH IX POP HL EXX ;...end of multiplicand loading LD BC,0 ; c ix de b (product) = 0... LD D,B LD E,B LD IX,0 LD HL,NORM ; push addr of normalize routine PUSH HL LD HL,MULLOOP ; push addr of top of loop PUSH HL ; (5 iterations wanted, PUSH HL ; once per byte of fraction) PUSH HL PUSH HL LD HL,FA ;point to LSB .MULLOOP LD A,(HL) ;get next byte of multiplier INC HL OR A JR NZ,MUL2 ; z => next 8 bits of multiplier are 0 LD B,E ;shift c ix de b right by 8... LD E,D DEFB $DD LD D,L EX AF,AF' DEFB $DD LD A,H DEFB $DD LD L,A EX AF,AF' DEFB $DD LD H,C LD C,A ;...end of shifting RET ;go to top of loop or NORM ; .MUL2 PUSH HL ;save multiplier pointer EX DE,HL LD E,8 ;8 iterations (once per bit) .MUL4 RRA ;rotate a multiplier bit into cy LD D,A LD A,C JR NC,MUL6 ; nc => no addition needed PUSH HL ; c ix hl (product) += EXX ; c' h'l' d'e' (multiplicand) EX (SP),HL ADD HL,DE EX (SP),HL EX DE,HL PUSH IX EX (SP),HL ADC HL,DE EX (SP),HL POP IX EX DE,HL ADC A,C EXX POP HL ; .MUL6 RRA ;shift c ix hl b (product) right by 1... LD C,A DEFB $DD LD A,H RRA DEFB $DD LD H,A DEFB $DD LD A,L RRA DEFB $DD LD L,A RR H RR L RR B ;...end of shifting DEC E LD A,D JR NZ,MUL4 ; z => 8 iterations complete EX DE,HL .MUL8 POP HL ;recover multiplier pointer RET ;go to top of loop or NORM z88dk-1.8.ds1/libsrc/genmath/fradd.asm0000644000175000017500000000121407423075612017173 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; fraction add c ix de += (hl) ; ; $Id: fradd.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB fradd .FRADD LD A,(HL) ADD A,E LD E,A INC HL LD A,(HL) ADC A,D LD D,A INC HL LD A,(HL) DEFB $DD ADC A,L DEFB $DD LD L,A INC HL LD A,(HL) DEFB $DD ADC A,H DEFB $DD LD H,A INC HL LD A,(HL) ADC A,C LD C,A RET z88dk-1.8.ds1/libsrc/genmath/fsub.asm0000644000175000017500000000027207423075612017055 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; ; $Id: fsub.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB fsub LIB minusfa LIB fadd .fsub call minusfa jp fadd z88dk-1.8.ds1/libsrc/genmath/ftoa.c0000644000175000017500000000311307423333547016512 0ustar tygrystygrys/* convert double number to string (f format) */ #include #include #include /* * These two functions are already listed in z80_crt0.hdr so we * have to do a nasty kludge around them */ void ftoa(x,f,str) double x; /* the number to be converted */ int f; /* number of digits to follow decimal point */ char *str; /* output string */ { double scale; /* scale factor */ int i, /* copy of f, and # digits before decimal point */ d; /* a digit */ if( x < 0.0 ) { *str++ = '-' ; x = -x ; } i = f ; scale = 2.0 ; while ( i-- ) scale *= 10.0 ; x += 1.0 / scale ; /* count places before decimal & scale the number */ i = 0 ; scale = 1.0 ; while ( x >= scale ) { scale *= 10.0 ; i++ ; } if ( i == 0 ) *str++ = '0'; while ( i-- ) { /* output digits before decimal */ scale = floor(0.5 + scale * 0.1 ) ; d = ( x / scale ) ; *str++ = d + '0' ; x -= (double)d * scale ; } if ( f <= 0 ) { *str = 0; return ; } *str++ = '.' ; while ( f-- ) { /* output digits after decimal */ x *= 10.0 ; d = x; *str++ = d + '0' ; x -= d ; } *str = 0; } z88dk-1.8.ds1/libsrc/genmath/ftoe.c0000644000175000017500000000440207423075612016514 0ustar tygrystygrys/* e format conversion * For generic printf */ #include #include #include /* * These two functions are already listed in z80_crt0.hdr so we * have to do a nasty kludge around them */ void ftoe(x,prec,str) double x ; /* number to be converted */ int prec ; /* # digits after decimal place */ char *str ; /* output string */ { double scale; /* scale factor */ int i, /* counter */ d, /* a digit */ expon; /* exponent */ scale = 1.0 ; /* scale = 10 ** prec */ i = prec ; while ( i-- ) scale *= 10.0 ; if ( x == 0.0 ) { expon = 0 ; scale *= 10.0 ; } else { expon = prec ; if ( x < 0.0 ) { *str++ = '-' ; x = -x ; } if ( x > scale ) { /* need: scale= scale ) { x /= 10.0 ; ++expon ; } } else { while ( x < scale ) { x *= 10.0 ; --expon ; } scale *= 10.0 ; } /* at this point, .1*scale <= x < scale */ x += 0.5 ; /* round */ if ( x >= scale ) { x /= 10.0 ; ++expon ; } } i = 0 ; while ( i <= prec ) { scale = floor( 0.5 + scale * 0.1 ) ; /* now, scale <= x < 10*scale */ d = ( x / scale ) ; *str++ = d + '0' ; x -= (d * scale) ; if ( i++ ) continue ; *str++ = '.' ; } *str++ = 'e' ; if ( expon < 0 ) { *str++ = '-' ; expon = -expon ; } if(expon>9) *str++ = '0' + expon/10 ; *str++ = '0' + expon % 10 ; *str = 0; } z88dk-1.8.ds1/libsrc/genmath/genlist0000644000175000017500000000064207724152067017011 0ustar tygrystygrysacos addhalf amax amin asin atan atan2 atof ceil compare cos cosh.c dadd dcompar ddiv deq dge dgt div1 div14 dleq dlt dmul dne dsub dswap evenpol exp f_no f_yes fabs fadd fdiv float floor fmod fmul fradd fsub ftoa.c ftoe.c hladd hlsub ifix incr int2 ldbcfa ldbchl ldfabc log log10 minusbc minusfa norm norm4 norma odd pack pack2 poly pow pushfa rand rshift seed sgn sin sinh sqrt tan tanh ufloat unpack init_floatpack z88dk-1.8.ds1/libsrc/genmath/hladd.asm0000644000175000017500000000031507423075612017170 0ustar tygrystygrys; Small C+ Math Library ; General "fudging routine" XLIB hladd LIB ldbchl LIB fadd ; .HLADD CALL LDBCHL JP FADD z88dk-1.8.ds1/libsrc/genmath/hlsub.asm0000644000175000017500000000030707423075612017232 0ustar tygrystygrys; Small C+ Math Library ; General "fudging routine" XLIB hlsub LIB ldbchl LIB fsub ; .HLSUB CALL LDBCHL JP FSUB ; z88dk-1.8.ds1/libsrc/genmath/ifix.asm0000644000175000017500000000267007424637640017067 0ustar tygrystygrys; Small C+ Math Library XLIB ifix LIB floor LIB l_long_neg XREF fa ; ; convert the floating point number in FA ; to an integer in hl (rounds toward negative numbers) ; ; This routine will need to be rewritten to handle longs .IFIX CALL FLOOR ;take floor first LD HL,0 ;initialize the result ld d,l ld e,l LD A,(FA+5) ;get the exponent LD B,A ; and save it OR A RET Z ;z => number was zero LD de,(FA+3) ;get most significant bits ld hl,(fa+1) LD C,d ;save sign bit (msb) LD A,B ;get exponent again CP $80+32 JP M,IFIX5 ;m => fabs(fa) < 32768 ret ; IF 0 ret nz ;would be overflow LD A,d CP $80 ret nz ;overflow.. LD A,L OR A RET ;return -32768. (overflow) ENDIF ; .IFIX5 SET 7,d ;restore hidden bit .IFIX6 SRL d ;shift right (0 fill) rr e rr h RR L ;shift right (cy fill) INC A CP 32+$80 JR NZ,IFIX6 ;nz => haven't shifted enough RL C RET NC ;nc => positive number jp l_long_neg ;negate z88dk-1.8.ds1/libsrc/genmath/incr.asm0000644000175000017500000000107107423075612017047 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; increment c ix de ; ; $Id: incr.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB incr .INCR INC E ;increment c ix de RET NZ INC D RET NZ DEFB $DD INC L RET NZ DEFB $DD INC H RET NZ INC C RET NZ ;z => carry LD C,$80 ;set high order bit INC (HL) ; and increment exponent RET NZ ret ; JP OFLOW z88dk-1.8.ds1/libsrc/genmath/init_floatpack.asm0000644000175000017500000001563407724152067021121 0ustar tygrystygrys; ; CPC Maths Routines ; ; August 2003 **_|warp6|_** ; ; $Id: init_floatpack.asm,v 1.1 2003/08/30 16:43:35 dom Exp $ ; INCLUDE "#cpcfp.def" XLIB init_floatpack ; All the library routines that we have to change LIB atan LIB cos LIB dadd LIB ddiv LIB deg LIB deq LIB dge LIB dgt LIB dleq LIB dlt LIB dmul LIB dne LIB dsub LIB exp LIB float LIB floor LIB fprand LIB ifix LIB log10 LIB log LIB minusfa LIB pi LIB pow10 LIB pow LIB rad LIB sin LIB sqrt LIB tan ; The actual place where we have to change things XREF atanc XREF cosc XREF daddc XREF ddivc XREF degc XREF deqc XREF dgec XREF dgtc XREF dleqc XREF dltc XREF dmulc XREF dnec XREF dsubc XREF expc XREF floatc XREF floorc XREF floorc2 XREF fprandc XREF ifixc XREF log10c XREF logc XREF minusfac XREF pic XREF pow10c XREF powc XREF radc XREF sinc XREF skelc XREF sqrtc XREF tanc ; Now, a hack around z80asm - we have to reference the .lib labels to get ; them into scope. Ideally we'd go (libroutine+offset), but the offset may ; change at some point and this is arguable the simplest way to do it ; ; We save space by only using defb - this overflow, but no harm done there defb atan defb cos defb dadd defb ddiv defb deg defb deq defb dge defb dgt defb dleq defb dlt defb dmul defb dne defb dsub defb exp defb float defb floor defb fprand defb ifix defb log10 defb log defb minusfa defb pi defb pow10 defb pow defb rad defb sin defb sqrt defb tan .init_cpcfloat ld hl,$BD65 ld a,(hl) cp 158 jp z,init_cpc464float cp 200 jp z,init_cpc664float ret .init_cpc464float ld hl,CPCFP464_FLO_ATAN ld (atanc+1),hl ld hl,CPCFP464_FLO_COS ld (cosc+1),hl ld hl,CPCFP464_FLO_ADD ld (daddc+1),hl ld hl,CPCFP464_FLO_DIV ld (ddivc+1),hl ld hl,CPCFP464_FLO_DEG_RAD ld (degc+1),hl ld (radc+1),hl ld hl,CPCFP464_FLO_CMP ld (deqc+1),hl ld (dgec+1),hl ld (dgtc+1),hl ld (dleqc+1),hl ld (dltc+1),hl ld (dnec+1),hl ld hl,CPCFP464_FLO_MUL ld (dmulc+1),hl ld hl,CPCFP464_FLO_REV_SUB ld (dsubc+1),hl ld hl,CPCFP464_FLO_EXP ld (expc+1),hl ld hl,CPCFP464_INT_2_FLO ld (floatc+1),hl ld hl,CPCFP464_FLO_BINFIX ld (floorc+1),hl ld hl,CPCFP464_BIN_2_FLO ld (floorc2+1),hl ld hl,CPCFP464_FLO_RND ld (fprandc+1),hl ld hl,CPCFP464_FLO_2_INT ld (ifixc+1),hl ld hl,CPCFP464_FLO_LOG10 ld (log10c+1),hl ld hl,CPCFP464_FLO_LOG ld (logc+1),hl ld hl,CPCFP464_FLO_INV_SGN ld (minusfac+1),hl ld hl,CPCFP464_FLO_PI ld (pic+1),hl ld hl,CPCFP464_FLO_POW10 ld (pow10c+1),hl ld hl,CPCFP464_FLO_POW ld (powc+1),hl ld hl,CPCFP464_FLO_SIN ld (sinc+1),hl ld hl,CPCFP464_FLO_SQRT ld (sqrtc+1),hl ld hl,CPCFP464_FLO_TAN ld (tanc+1),hl ret .init_cpc664float ld hl,CPCFP664_FLO_ATAN ld (atanc+1),hl ld hl,CPCFP664_FLO_COS ld (cosc+1),hl ld hl,CPCFP664_FLO_ADD ld (daddc+1),hl ld hl,CPCFP664_FLO_DIV ld (ddivc+1),hl ld hl,CPCFP664_FLO_DEG_RAD ld (degc+1),hl ld (radc+1),hl ld hl,CPCFP664_FLO_CMP ld (deqc+1),hl ld (dgec+1),hl ld (dgtc+1),hl ld (dleqc+1),hl ld (dltc+1),hl ld (dnec+1),hl ld hl,CPCFP664_FLO_MUL ld (dmulc+1),hl ld hl,CPCFP664_FLO_REV_SUB ld (dsubc+1),hl ld hl,CPCFP664_FLO_EXP ld (expc+1),hl ld hl,CPCFP664_INT_2_FLO ld (floatc+1),hl ld hl,CPCFP664_FLO_BINFIX ld (floorc+1),hl ld hl,CPCFP664_BIN_2_FLO ld (floorc2+1),hl ld hl,CPCFP664_FLO_RND ld (fprandc+1),hl ld hl,CPCFP664_FLO_2_INT ld (ifixc+1),hl ld hl,CPCFP664_FLO_LOG10 ld (log10c+1),hl ld hl,CPCFP664_FLO_LOG ld (logc+1),hl ld hl,CPCFP664_FLO_INV_SGN ld (minusfac+1),hl ld hl,CPCFP664_FLO_PI ld (pic+1),hl ld hl,CPCFP664_FLO_POW10 ld (pow10c+1),hl ld hl,CPCFP664_FLO_POW ld (powc+1),hl ld hl,CPCFP664_FLO_SIN ld (sinc+1),hl ld hl,CPCFP664_FLO_SQRT ld (sqrtc+1),hl ld hl,CPCFP664_FLO_TAN ld (tanc+1),hl ret z88dk-1.8.ds1/libsrc/genmath/int2.asm0000644000175000017500000000250207423075612016770 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; ??? ; ; $Id: int2.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB int2 LIB rshift LIB incr LIB ldbcfa LIB minusbc LIB unpack .INT2 LD B,A ;if a==0, return with bc ix de = 0... LD C,A LD D,A LD E,A DEFB $DD LD H,A DEFB $DD LD L,A OR A RET Z PUSH HL CALL LDBCFA ;copy FA into bc ix de, CALL UNPACK ; restore hidden bits XOR (HL) LD H,A ;put sign in msb of h JP P,INT4 ;p => positive number DEC DE ;decrement c ix de... LD A,D AND E INC A JR NZ,INT4 DEC IX DEFB $DD LD A,H DEFB $DD AND L INC A JR NZ,INT4 DEC C ;...end of c ix de decrementing ; .INT4 LD A,$A8 ;shift c ix de right so bits to SUB B ; the right of the binary point CALL RSHIFT ; are discarded LD A,H RLA CALL C,INCR ;c => negative, increment c ix de LD B,0 CALL C,MINUSBC ;negate the fraction c ix de POP HL RET z88dk-1.8.ds1/libsrc/genmath/ldbcfa.asm0000644000175000017500000000026507423075612017333 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; bc ix de = FA XLIB ldbcfa XREF fa .LDBCFA LD DE,(FA) LD IX,(FA+2) LD BC,(FA+4) RET z88dk-1.8.ds1/libsrc/genmath/ldbchl.asm0000644000175000017500000000064507423075612017352 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; bc ix de = (hl) XLIB ldbchl .ldbchl ld e,(hl) inc hl ld d,(hl) inc hl ld c,(hl) defb $dd ld l,c inc hl ld c,(hl) defb $dd ld h,c inc hl ld c,(hl) inc hl ld b,(hl) inc hl ret z88dk-1.8.ds1/libsrc/genmath/ldfabc.asm0000644000175000017500000000026407423075612017332 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; FA = bc ix de XLIB ldfabc XREF fa .LDFABC LD (FA),DE LD (FA+2),IX LD (FA+4),BC RET z88dk-1.8.ds1/libsrc/genmath/log.asm0000644000175000017500000000445707423075612016710 0ustar tygrystygrys; Small C+ Math functions XLIB log LIB hlsub LIB evenpol LIB sgn LIB fdiv LIB fmul LIB fadd LIB norma LIB pushfa XREF fa XREF fasign ; ; transcendental functions: log ; ; .L0F2E DEFB 0 ; .ONE DEFW 0 DEFW 0 DEFW $8100 ; .LOGCOEF defb 6 defb $23,$85,$AC,$C3,$11,$7F defb $53,$CB,$9E,$B7,$23,$7F defb $CC,$FE,$A6,$0D,$53,$7F defb $CB,$5C,$60,$BB,$13,$80 defb $DD,$E3,$4E,$38,$76,$80 defb $5C,$29,$3B,$AA,$38,$82 ; .LOG CALL SGN OR A ret pe ;urk!.. LD HL,FA+5 LD A,(HL) LD BC,$8035 ; 1/sqrt(2) LD IX,$04F3 LD DE,$33FA SUB B PUSH AF LD (HL),B PUSH DE PUSH IX PUSH BC CALL FADD POP BC POP IX POP DE INC B CALL FDIV LD HL,ONE CALL HLSUB LD HL,LOGCOEF CALL EVENPOL LD BC,$8080 ; -0.5 LD IX,0 LD DE,0 CALL FADD POP AF CALL L247E LD BC,$8031 ; ln(2) LD IX,$7217 LD DE,$F7D2 JP FMUL ; ; ; don't know what this is, it seems to be part of log() ; .L247E CALL PUSHFA CALL L27EC POP BC POP IX POP DE JP FADD ; ; .L27EC LD B,$88 ; 128. LD DE,0 .L27F1 LD HL,FA+5 LD C,A PUSH DE POP IX LD DE,0 LD (HL),B ;store exponent LD B,0 INC HL LD (HL),$80 ;store minus sign RLA JP NORMA ; EX DE,HL XOR A LD B,$98 JR L27F1 LD B,C .L280C LD D,B LD E,0 LD HL,L0F2E LD (HL),E LD B,$90 JR L27F1 LD B,A XOR A JR L280C ; z88dk-1.8.ds1/libsrc/genmath/log10.asm0000644000175000017500000000040707423075612017040 0ustar tygrystygrys; Small C+ Math Library XLIB log10 LIB log LIB fmul ; .LOG10 CALL LOG LD BC,$7F5E ; 1/ln(10) LD IX,$5BD8 LD DE,$A938 JP FMUL z88dk-1.8.ds1/libsrc/genmath/Makefile0000644000175000017500000000075310763607652017066 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # $Id: Makefile,v 1.21 2008/03/05 20:35:46 dom Exp $ # include ../Make.config CFILES = \ acos.c \ asin.c \ atan2.c \ atof.c \ cosh.c \ ftoa.c \ ftoe.c \ pow.c \ sinh.c \ tanh.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: genmath genmath: $(OBJECTS) $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/gen_math @genlist .c.o: zcc +test $(CFLAGS) $*.c clean: $(RM) *.o* *.sym *.map *.err zcc_opt.def *.i $(AFILES) z88dk-1.8.ds1/libsrc/genmath/minusbc.asm0000644000175000017500000000133007423075612017552 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Complement FASIGN and negate the fraction c ix de b ; ; $Id: minusbc.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB minusbc XREF fasign .MINUSBC LD HL,FASIGN LD A,(HL) CPL LD (HL),A XOR A LD L,A LD H,A SUB B LD B,A LD A,L SBC HL,DE EX DE,HL LD L,A DEFB $DD SBC A,L DEFB $DD LD L,A LD A,L DEFB $DD SBC A,H DEFB $DD LD H,A LD A,L SBC A,C LD C,A RET z88dk-1.8.ds1/libsrc/genmath/minusfa.asm0000644000175000017500000000037607130401722017553 0ustar tygrystygrys; Small C+ Math Library - Support routine ; Negate a floating point number XLIB minusfa XREF fa .MINUSFA LD HL,FA+4 LD A,(HL) XOR $80 LD (HL),A RET z88dk-1.8.ds1/libsrc/genmath/norm.asm0000644000175000017500000000313107423075612017066 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Normalise 48bit number in c ix de b ; current exponent in fa+5 ; Result -> fa +5 ; ; $Id: norm.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB norm LIB pack LIB norm4 XREF fa .NORM LD L,B LD H,E XOR A .NORM2 LD B,A LD A,C OR A JR NZ,NORM12 ;nz => 7 or fewer shifts needed ; shift c ix d hl left by one byte DEFB $DD LD C,H DEFB $DD LD A,L DEFB $DD LD H,A DEFB $DD LD L,D XOR A LD D,H LD H,L LD L,A ;...end of shifting ; LD A,B SUB 8 ;adjust exponent CP $D0 JR NZ,NORM2 jp norm4 ; .NORM8 DEC B ; shift c ix d hl left one bit... ADD HL,HL RL D EX AF,AF' ADD IX,IX EX AF,AF' JR NC,NORM10 INC IX .NORM10 EX AF,AF' RL C ;...end of shifting ; .NORM12 JP P,NORM8 ;p => high order bit still zero LD A,B ; move number to c ix de b LD E,H LD B,L OR A JP Z,PACK ;z => exponent unchanged LD HL,FA+5 ;update exponent ADD A,(HL) LD (HL),A Jp NC,NORM4 ;nc => underflow (set to 0) RET Z ;z => underflow (leave as 0) jp pack z88dk-1.8.ds1/libsrc/genmath/norm4.asm0000644000175000017500000000044007423075612017152 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Normalise 48bit number in c ix de b ; current exponent in fa+5 ; Result -> fa +5 ; ; $Id: norm4.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB norm4 XREF fa .NORM4 XOR A .NORM6 LD (FA+5),A RET z88dk-1.8.ds1/libsrc/genmath/norma.asm0000644000175000017500000000056007423075612017232 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; ; $Id: norma.asm,v 1.1 2002/01/21 20:35:22 dom Exp $ XLIB norma LIB minusbc LIB norm ; reverse sign if necessary (cy set) and normalize ; (sign reversal necessary because we're using ; sign-magnitude representation rather than ; twos-complement) .norma call c,minusbc jp norm z88dk-1.8.ds1/libsrc/genmath/odd.asm0000644000175000017500000000063007130401722016650 0ustar tygrystygrys; Small C+ Math Library - Support routine ; Negate a fp number push address XLIB odd LIB minusfa ; ; negate FA, and push address of MINUSFA ; called to evaluate functions f(x) when the argument is ; negative and f() satisfies f(-x)=-f(x) .ODD CALL MINUSFA LD HL,MINUSFA EX (SP),HL JP (HL) ; z88dk-1.8.ds1/libsrc/genmath/pack.asm0000644000175000017500000000026007423075612017031 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; ; $Id: pack.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB pack LIB pack2 .PACK LD A,B jp pack2 z88dk-1.8.ds1/libsrc/genmath/pack2.asm0000644000175000017500000000101607423075612017113 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; ; $Id: pack2.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB pack2 LIB ldfabc LIB incr XREF fa .PACK2 LD HL,FA+5 ;round c ix de b to 40 bits OR A CALL M,INCR LD B,(HL) ;load exponent INC HL LD A,(HL) ;recover sign AND $80 ;mask out all but sign XOR C ;add to high LD C,A ; order byte JP LDFABC ;place answer in FA z88dk-1.8.ds1/libsrc/genmath/poly.asm0000644000175000017500000000134107423075612017077 0ustar tygrystygrys; Small C+ Math Library ; More polynomial evaluation XLIB poly LIB pushfa LIB ldbchl LIB fadd LIB fmul XREF dload ; .POLY CALL PUSHFA LD A,(HL) INC HL CALL DLOAD DEFB $FE ;"ignore next byte" .POL3 POP AF POP BC POP IX POP DE DEC A RET Z PUSH DE PUSH IX PUSH BC PUSH AF PUSH HL CALL FMUL POP HL CALL LDBCHL PUSH HL CALL FADD POP HL JR POL3 ; z88dk-1.8.ds1/libsrc/genmath/pow.c0000644000175000017500000000023507130401722016352 0ustar tygrystygrys#include #include /* * transcendental functions: pow */ double pow(x,y) /* x to the power y */ double x,y; { return exp(log(x)*y); } z88dk-1.8.ds1/libsrc/genmath/pushfa.asm0000644000175000017500000000067607423075612017414 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Push FA onto the stack ; ; $Id: pushfa.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB pushfa XDEF pushf2 XREF fa .pushfa ex de,hl .pushf2 ld hl,(fa) ex (sp),hl push hl ld hl,(fa+2) ex (sp),hl push hl ld hl,(fa+4) ex (sp),hl push hl ex de,hl ret z88dk-1.8.ds1/libsrc/genmath/rand.asm0000644000175000017500000000166107423075612017045 0ustar tygrystygrys; Small C+ Math package ; ; ; Generic rand() function XLIB fprand LIB fmul lIB fadd LIB ldbcfa LIB norm XREF fp_seed XREF dload XREF fa XREF fasign XREF dstore .fpRAND LD HL,fp_SEED CALL DLOAD LD BC,$9835 ; 11879545. LD IX,$447A LD DE,0 CALL FMUL LD BC,$6828 ; 3.92767775e-8 LD IX,$B146 LD DE,0 CALL FADD CALL LDBCFA LD A,E LD E,C LD C,A LD HL,FASIGN LD (HL),$80 DEC HL LD B,(HL) LD (HL),$80 CALL NORM LD HL,fp_SEED JP DSTORE z88dk-1.8.ds1/libsrc/genmath/rshift.asm0000644000175000017500000000216407423075612017417 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Shift c ix de b right by a ; ; $Id: rshift.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB rshift XDEF rsh8 .RSHIFT LD B,0 .RSH2 SUB 8 JR C,RSH4 ;c => 7 or fewer shifts remain LD B,E ;shift c ix de b right by 8... LD E,D DEFB $DD LD D,L EX AF,AF' DEFB $DD LD A,H DEFB $DD LD L,A EX AF,AF' DEFB $DD LD H,C LD C,0 ;...end of shifting JR RSH2 ; .RSH4 ADD A,9 LD L,A .RSH6 XOR A DEC L RET Z ;z => requested shift is complete LD A,C .RSH8 RRA ;shift c ix de b right by one... LD C,A DEFB $DD LD A,H RRA DEFB $DD LD H,A DEFB $DD LD A,L RRA DEFB $DD LD L,A RR D RR E RR B ;...end of shifting JR RSH6 z88dk-1.8.ds1/libsrc/genmath/seed.asm0000644000175000017500000000035407130401722017025 0ustar tygrystygrys; ; Small C+ Generic Math Library ; ; Set the floating point seed ; ; XLIB fpseed XREF dstore XREF fp_seed .fpseed ld hl,fp_seed jp dstore z88dk-1.8.ds1/libsrc/genmath/sgn.asm0000644000175000017500000000063707423075612016712 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; set z and Z flags per fa ; ; $Id: sgn.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB sgn XDEF setflgs XREF fa .SGN LD A,(FA+5) OR A RET Z LD A,(FA+4) DEFB $FE ;"ignore next byte" .SETFLGS CPL RLA SBC A,A RET NZ INC A RET z88dk-1.8.ds1/libsrc/genmath/sin.asm0000644000175000017500000000312207423075612016704 0ustar tygrystygrys; Small C+ Maths Routines ; ; transcendental floating point routines ; XLIB sin LIB hlsub LIB hladd LIB addhalf LIB evenpol LIB floor LIB pushfa LIB ldfabc LIB fsub LIB sgn LIB minusfa LIB fdiv ;double sin(double val) ;Looks odd, but don't worry..value is already in FA - no need for stack .SIN CALL PUSHFA LD BC,$8349 ;6.283185308... = 2*pi LD IX,$0FDA LD DE,$A222 CALL LDFABC POP BC POP IX POP DE CALL FDIV CALL PUSHFA CALL FLOOR POP BC POP IX POP DE CALL FSUB LD HL,KWARTER CALL HLSUB CALL SGN SCF JP P,SIN5 CALL ADDHALF CALL SGN OR A .SIN5 PUSH AF CALL P,MINUSFA LD HL,KWARTER CALL HLADD POP AF CALL NC,MINUSFA LD HL,SINCOEF JP EVENPOL ; .KWARTER defw 0 defw 0 defw $7F00 .SINCOEF defb 7 defb $90,$BA,$34,$76,$6A,$82 defb $E4,$E9,$E7,$4B,$F1,$84 defb $B1,$4F,$7F,$3B,$28,$86 defb $31,$B6,$64,$69,$99,$87 defb $E4,$36,$E3,$35,$23,$87 defb $24,$31,$E7,$5D,$A5,$86 defb $21,$A2,$DA,$0F,$49,$83 z88dk-1.8.ds1/libsrc/genmath/sinh.c0000644000175000017500000000021007130401722016477 0ustar tygrystygrys#include #include #include "float.h" double sinh(x) double x; { double e; e = exp(x) ; return 0.5*(e-1.0/e) ; } z88dk-1.8.ds1/libsrc/genmath/sqrt.asm0000644000175000017500000000564107423075612017114 0ustar tygrystygrys; Small C+ Math Library ; sqrt(a) function, compiled C..hence the size! ; Compiled using some inline optimizations (gchar etc) ; Fine tuned by hand...so don't recompile! ; Tuned to: only keep one zero constant ; Pointer stuff made nicer.. ; ; But still not working! INCLUDE "#stdio.def" XLIB sqrt XREF dload XREF dpush XREF dstore XREF dldpsh LIB l_pint LIB l_gint LIB l_sxt LIB ddiv LIB dadd LIB dleq LIB dlt .sqrt ld hl,-12 add hl,sp ld sp,hl ld hl,14 add hl,sp ; call dload, dpush -> dldpsh call dldpsh ld hl,i_1+0 call dload call dleq ld a,h or l jp z,i_2 ld hl,i_1+0 call dload ld hl,12 add hl,sp ld sp,hl ret .i_2 ld hl,4 add hl,sp push hl ld hl,16 add hl,sp pop de call l_pint ld hl,6 add hl,sp pop de pop bc push hl push de ld hl,6 add hl,sp push hl ld hl,i_1+6 call dload pop hl call dstore ;Fetch second into off stack optimized pop bc pop hl push hl push bc ld de,5 add hl,de push hl ld hl,6 add hl,sp call l_gint ld de,5 add hl,de ld a,(hl) call l_sxt ;sign extend rr h rr l ld a,l xor 64 pop hl ld (hl),a ld hl,7 pop bc push hl .i_4 ;Decrement int at top of stack (from j--) pop hl dec hl push hl ld a,h or l jp z,i_5 ld hl,6 add hl,sp push hl ;extra ; call dload, dpush -> dldpsh call dldpsh ld hl,22 ;x add hl,sp ; call dload, dpush -> dldpsh call dldpsh ld hl,20 ;extra add hl,sp call dload call ddiv ;x/extra call dadd ;extra+fa pop hl call dstore ;divide by two pop bc pop hl push hl push bc ld de,5 add hl,de dec (hl) jp i_4 .i_5 ld hl,6 add hl,sp call dload ld hl,12 add hl,sp ld sp,hl ret .i_1 defb 0,0,0,0,0,0 defb 18,-125,-64,-54,65,-128 z88dk-1.8.ds1/libsrc/genmath/sqrt.c0000644000175000017500000000112207130401722016532 0ustar tygrystygrys #include double sqrt(x) double x; { double extra; /* current approximate root */ unsigned char *px; /* points to x */ unsigned char *pextra; /* points to extra */ int i; /* loop counter */ if (x == 0.0) return 0.0 ; if (x < 0.0) return 0.0 ; px = &x ; pextra = &extra ; /* set the pointers */ extra = 0.707 ; /* initialize fraction at sqrt(.5) */ pextra[5] = (px[5]>>1)^64 ; /* answer exponent is half of "x" exponent */ i = 7 ; /* 5 iterations of Newton's algorithm */ while (--i) { extra += x/extra ; --pextra[5] ; /* /2 */ } return extra ; } z88dk-1.8.ds1/libsrc/genmath/tan.asm0000644000175000017500000000114207423075612016675 0ustar tygrystygrys; Small C+ Maths Routines ; ; transcendental floating point routines ; XLIB tan LIB sin LIB cos LIB ldfabc LIB pushfa XREF pushf2 LIB div1 ;double tan(double val) ;Looks odd, but don't worry..value is already in FA - no need for stack ; .TAN CALL PUSHFA CALL SIN POP BC POP IX POP DE CALL PUSHF2 EX DE,HL CALL LDFABC CALL COS JP DIV1 z88dk-1.8.ds1/libsrc/genmath/tanh.c0000644000175000017500000000021307130401722016473 0ustar tygrystygrys#include #include #include "float.h" double tanh(double x) { double e; e = exp(x) ; return (e-1.0/e)/(e+1.0/e) ; } z88dk-1.8.ds1/libsrc/genmath/ufloat.asm0000644000175000017500000000060107423075612017404 0ustar tygrystygrys; Generic Small C+ Floating point library ; Converts integer in hl to fp number XLIB ufloat LIB float XREF float1 ; ; convert the integer in hl to (unsigned routine) ; a floating point number in FA ; .ufloat xor a ;signify no sign jp float1 defw float z88dk-1.8.ds1/libsrc/genmath/unpack.asm0000644000175000017500000000150307423075612017375 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; Unpack FP number ; ; $Id: unpack.asm,v 1.1 2002/01/21 20:35:22 dom Exp $: XLIB unpack XREF fa .UNPACK LD HL,FA+4 LD A,(HL) ;get MSB of fraction RLCA ;rotate sign bit into lsb SCF ;set carry RRA ;rotate sign bit into cy, cy into msb LD (HL),A ;restore MSB (with hidden bit restored) CCF ;complement sign bit... RRA INC HL INC HL LD (HL),A ;...and save in msb of FASIGN LD A,C ;similarly, get sign bit of bc ix de... RLCA SCF RRA LD C,A ;...restore hidden bit... RRA XOR (HL) ;...and compare with sign of FA. RET z88dk-1.8.ds1/libsrc/gfx81.lst0000755000175000017500000000113610701457175015456 0ustar tygrystygrysgraphics/circle graphics/zx81/clg graphics/clga graphics/clrarea graphics/dcircle2 graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner2 graphics/lscroll graphics/plot graphics/zx81/plotpixl graphics/zx81/respixl graphics/zx81/xorpixl graphics/putsprite3 graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy graphics/xorborder graphics/xorplot graphics/setxy graphics/zx81/swapgfxbk graphics/drawbox z88dk-1.8.ds1/libsrc/gfx81hr.lst0000755000175000017500000000154510710126720016001 0ustar tygrystygrysgraphics/circle graphics/zx81/hr/clg graphics/clga graphics/clrarea graphics/dcircle2 graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner2 graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy graphics/fill graphics/dfill2 graphics/getsprite graphics/putsprite graphics/bksave graphics/bkrestore graphics/zx81/hr/pixladdr graphics/zx81/swapgfxbk graphics/xorborder graphics/xorpixl graphics/xorplot graphics/gray/g_circle graphics/gray/zx81/g_clg graphics/gray/g_draw graphics/gray/g_drawb graphics/gray/g_drawr graphics/gray/g_page graphics/gray/grpage graphics/gray/g_plot graphics/gray/g_point z88dk-1.8.ds1/libsrc/graphics/0000755000175000017500000000000010765202715015567 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/abc80/0000755000175000017500000000000010765202715016464 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/abc80/clsgraph.asm0000755000175000017500000000105510547236116020775 0ustar tygrystygrys; ; ABC80 Graphics Functions ; ; clg () -- clear screen and init graphics ; ; routine found in "grafik.asm" ; by Bengt Holgersson - 1986-03-13 22.58.30 ; ; imported by Stefano Bodrato - 29/12/2006 :o) ; ; ; $Id: clsgraph.asm,v 1.1 2007/01/04 17:41:34 stefano Exp $ ; XLIB cleargraphics .cleargraphics ld ix,884 ld b,24 grloop: push bc ld l,(ix+0) ld h,(ix+1) ld (hl),23 inc hl ld (hl),32 ld d,h ld e,l inc de ld a,(590) dec a ld b,0 ld c,a ldir inc ix inc ix pop bc djnz grloop ret z88dk-1.8.ds1/libsrc/graphics/abc80/pixel.asm0000755000175000017500000000135710547236116020320 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; routine found in "grafik.asm" ; by Bengt Holgersson - 1986-03-13 22.58.30 ; ; imported by Stefano Bodrato - 29/12/2006 :o) ; ; ; Plot/unplot/invert pixel at (x,y) coordinate. ; ; ; $Id: pixel.asm,v 1.1 2007/01/04 17:41:34 stefano Exp $ ; XLIB pixel XDEF pixmode XREF COORDS .pixel ld d,l ld e,h inc e inc e ld a,e cp 2 ret c ld (COORDS),hl push bc ld b,0 ld h,b ld c,d ld l,e ld a,(22eeh) cp 124 ld a,e jr z,old call 22ech jr setit .old call 22eeh .setit jr c,doret .pixmode or (hl) ; <- nop or 32 ld (hl),a .doret pop bc ret z88dk-1.8.ds1/libsrc/graphics/ace/0000755000175000017500000000000010765202715016317 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/ace/clsgraph.asm0000644000175000017500000000074507275543374020645 0ustar tygrystygrys XLIB cleargraphics XREF base_graphics ; ; $Id: clsgraph.asm,v 1.1 2001/05/07 16:02:04 stefano Exp $ ; ; ****************************************************************** ; ; Clear graphics area ; ; Jupiter ACE version. ; Emulated 96x64 resolution (TI82/TI83) with 64x48 dots. ; ; (x=x*2/3; y=y*3/4) ; ; .cleargraphics push bc push de push hl ld hl,$2400 ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,32*24 ldir pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/graphics/ace/plotpixl.asm0000644000175000017500000000322707461021035020671 0ustar tygrystygrys XLIB plotpixel LIB pixeladdress XREF COORDS ; ; $Id: plotpixl.asm,v 1.3 2002/04/22 14:45:49 stefano Exp $ ; ; ****************************************************************** ; ; Plot pixel at (x,y) coordinate. ; ; Jupiter ACE version. ; Emulated 96x64 resolution (TI82/TI83) with 64x48 dots. ; ; (x=x*2/3; y=y*3/4) ; ; .plotpixel ld a,h cp 96 ret nc ld a,l ;cp maxy cp 64 ret nc ; y0 out of range ld (COORDS),hl push bc add a,l ; y=y*3/4 add a,l srl a srl a ld c,a ld b,0 ; x=x*2/3 ;sll h sla h ld a,h .subtract inc b sub 3 jr nc,subtract dec b push bc srl b srl c ld hl,$2400 ; inc hl ld a,c ld c,b ; !! and a jr z,r_zero ld b,a ld de,32 .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol ; dec a ; dec a cp 8 jr c,islow ; recode graph symbol to binary -> 0..F cp 128 jr c,ischar ld a,143 ;ld a,128+10 sub (hl) ;xor a;;;; jr islow .ischar xor a ; .. force to blank sym .islow ex (sp),hl ; save char address <=> restore x,y ld b,a ld a,1 ; the bit we want to draw bit 0,h jr nz,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow or b ; inc a ; inc a cp 8 ; Now back from binary to jr c,losym ; graph symbols. ld b,a ld a,15 sub b add a,128 ; ld b,a ; ld a,128+10 ; sub b .losym pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/ace/respixl.asm0000644000175000017500000000314107461021036020500 0ustar tygrystygrys XLIB respixel XREF COORDS ; ; $Id: respixl.asm,v 1.4 2002/04/22 14:45:50 stefano Exp $ ; ; ****************************************************************** ; ; Erases pixel at (x,y) coordinate. ; ; ZX 81 version. ; Emulated 96x64 resolution (TI82/TI83) with 64x48 dots. ; ; (x=x*2/3; y=y*3/4) ; ; .respixel ld a,h cp 96 ret nc ld a,l ;cp maxy cp 64 ret nc ; y0 out of range ld (COORDS),hl push bc add a,l ; y=y*3/4 add a,l srl a srl a ld c,a ld b,0 ; x=x*2/3 ;sll h sla h ld a,h .subtract inc b sub 3 jr nc,subtract dec b push bc srl b srl c ld hl,(16396) inc hl ld a,c ld c,b ; !! ld de,33 ; 32+1. Every text line ends with an HALT and a jr z,r_zero ld b,a .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol cp 8 jr c,islow ; recode graph symbol to binary -> 0..F ld a,143 sub (hl) .islow ex (sp),hl ; save char address <=> restore x,y cp 16 ; Just to be sure: jr c,issym ; if it isn't a symbol... xor a ; .. force to blank sym .issym ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow cpl and b cp 8 ; Now back from binary to jr c,hisym ; graph symbols. ld b,a ld a,15 sub b add a,128 .hisym pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/ace/xorpixl.asm0000644000175000017500000000313207461021036020517 0ustar tygrystygrys XLIB xorpixel XREF COORDS ; ; $Id: xorpixl.asm,v 1.4 2002/04/22 14:45:50 stefano Exp $ ; ; ****************************************************************** ; ; Inverts pixel at (x,y) coordinate. ; ; ZX 81 version. ; Emulated 96x64 resolution (TI82/TI83) with 64x48 dots. ; ; (x=x*2/3; y=y*3/4) ; ; .xorpixel ld a,h cp 96 ret nc ld a,l ;cp maxy cp 64 ret nc ; y0 out of range ld (COORDS),hl push bc add a,l ; y=y*3/4 add a,l srl a srl a ld c,a ld b,0 ; x=x*2/3 ;sll h sla h ld a,h .subtract inc b sub 3 jr nc,subtract dec b push bc srl b srl c ld hl,(16396) inc hl ld a,c ld c,b ; !! ld de,33 ; 32+1. Every text line ends with an HALT and a jr z,r_zero ld b,a .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol cp 8 jr c,islow ; recode graph symbol to binary -> 0..F ld a,143 sub (hl) .islow ex (sp),hl ; save char address <=> restore x,y cp 16 ; Just to be sure: jr c,issym ; if it isn't a symbol... xor a ; .. force to blank sym .issym ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow xor b cp 8 ; Now back from binary to jr c,hisym ; graph symbols. ld b,a ld a,15 sub b add a,128 .hisym pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/aquarius/0000755000175000017500000000000010765202715017421 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/aquarius/textpixl.asm0000644000175000017500000000062007427464041022005 0ustar tygrystygrys; ; ; Support char table (pseudo graph symbols) for the Mattel Aquarius ; Sequence: blank, top-left, top-right, top-half, bottom-left, left-half, etc.. ; ; $Id: textpixl.asm,v 1.2 2002/02/04 10:53:21 stefano Exp $ ; ; XLIB textpixl .textpixl defb 32, 29, 27, 175 defb 28, 181, 182, 191 defb 26, 30, 234, 239 defb 31, 253, 254, 255 z88dk-1.8.ds1/libsrc/graphics/aquarius/textpixl6.asm0000755000175000017500000000150410543320226022065 0ustar tygrystygrys; ; ; Support char table (pseudo graph symbols) for the Mattel Aquarius ; Version for the 2x3 graphics symbols ; Sequence: blank, top-left, top-right, top-half, medium-left, top-left + medium-left, etc.. ; ; $Id: textpixl6.asm,v 1.1 2006/12/23 21:33:10 stefano Exp $ ; ; XLIB textpixl .textpixl defb 160, 161, 162 ,163, 164, 165, 166, 167 defb 168, 169, 170, 171, 172, 173, 174, 175 defb 176, 177, 178, 179, 180, 181, 182, 183 defb 184, 185, 186, 187, 188, 189, 190, 191 ; O# ; ## = 190 ; #O ; ## ; ## = 191 ; #O 31 ; OO ; OO = 224 ? (it is slightly thicker) ; O# ; #O ; OO = 225 ; O# 33 ; O# ; OO = 226 ; O# defb 215, 225, 226, 227, 228, 229, 230, 231 defb 232, 233, 234, 235, 236, 237, 238, 239 defb 240, 241, 242, 243, 244, 245, 246, 247 defb 248, 249, 250, 251, 252, 253, 254, 255 z88dk-1.8.ds1/libsrc/graphics/bkrestore.asm0000644000175000017500000000124507443162506020275 0ustar tygrystygrys; ; Fast background restore ; ; Generic version (just a bit slow) ; ; $Id: bkrestore.asm,v 1.5 2002/03/11 17:11:34 stefano Exp $ ; XLIB bkrestore LIB pixeladdress .bkrestore ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix ld h,(ix+2) ld l,(ix+3) push hl call pixeladdress pop hl ld a,(ix+0) ld b,(ix+1) dec a srl a srl a srl a inc a inc a ; INT ((Xsize-1)/8+2) ld (rbytes+1),a .bkrestores push bc .rbytes ld b,0 .rloop ld a,(ix+4) ld (de),a inc de inc ix djnz rloop inc l push hl call pixeladdress pop hl pop bc djnz bkrestores ret z88dk-1.8.ds1/libsrc/graphics/bksave.asm0000644000175000017500000000150607443162506017550 0ustar tygrystygrys; ; Fast background save ; ; Generic version (just a bit slow) ; ; $Id: bksave.asm,v 1.4 2002/03/11 17:11:34 stefano Exp $ ; XLIB bksave LIB pixeladdress .bksave ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords ld h,d ; current x coordinate ld l,e ; current y coordinate ld (ix+2),h ld (ix+3),l push hl call pixeladdress pop hl ld a,(ix+0) ld b,(ix+1) dec a srl a srl a srl a inc a inc a ; INT ((Xsize-1)/8+2) ld (rbytes+1),a .bksaves push bc .rbytes ld b,0 .rloop ld a,(de) ld (ix+4),a inc de inc ix djnz rloop inc l push hl call pixeladdress pop hl pop bc djnz bksaves ret z88dk-1.8.ds1/libsrc/graphics/c128/0000755000175000017500000000000010765202715016244 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/c128/textpixl.asm0000644000175000017500000000061607426524075020640 0ustar tygrystygrys; ; ; Support char table (pseudo graph symbols) for the Commodore 128 ; Sequence: blank, top-left, top-right, top-half, bottom-left, left-half, etc.. ; ; $Id: textpixl.asm,v 1.2 2002/02/01 14:37:49 stefano Exp $ ; ; XLIB textpixl .textpixl defb 32, 126, 124, 98+128 defb 123, 97, 255, 108+128 defb 108, 127, 97+128, 123+128 defb 98, 124+128, 126+128, 32+128 z88dk-1.8.ds1/libsrc/graphics/circle.asm0000644000175000017500000000122107267312341017526 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: circle.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ;Usage: circle(struct *pixels) XLIB circle LIB draw_circle LIB plotpixel LIB swapgfxbk XREF swapgfxbk1 .circle ld ix,0 add ix,sp ld e,(ix+2) ;skip ld d,(ix+4) ;radius ld c,(ix+6) ;y ld b,(ix+8) ;x ld ix,plotpixel call swapgfxbk call draw_circle jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/clg.asm0000644000175000017500000000072207267312341017037 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: clg.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; XLIB clg LIB swapgfxbk XREF swapgfxbk1 LIB cleargraphics .clg call swapgfxbk call cleargraphics jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/clga.asm0000644000175000017500000000105207452557764017215 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: clga.asm,v 1.4 2002/04/03 10:56:52 stefano Exp $ ; ;Usage: clga(struct *pixels) XLIB clga LIB swapgfxbk XREF swapgfxbk1 LIB cleararea .clga ld ix,0 add ix,sp ld c,(ix+2) ld b,(ix+4) ld l,(ix+6) ld h,(ix+8) call swapgfxbk call cleararea jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/closegfx.asm0000644000175000017500000000165107267312341020106 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: closegfx.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ;Usage: closegfx(struct *window) ; ;Close the map screen and restore memory map to normal INCLUDE "graphics/grafix.inc" /* Contains fn defs */ INCLUDE "#map.def" XLIB closegfx ; XREF oldozbank .closegfx pop bc pop ix ;y push ix push bc ;Restore old bindings ; ld a,(oldozbank) ; ld (map_bk),a ; out (map_bk-$400),a ld a,(ix+windnum) ld bc,mp_del call_oz(os_map) ld hl,0 ;NULL=success ret z88dk-1.8.ds1/libsrc/graphics/clrarea.asm0000644000175000017500000000077207450562472017716 0ustar tygrystygrys xlib cleararea lib respixel ; ; $Id: clrarea.asm,v 1.3 2002/03/28 09:41:14 stefano Exp $ ; ; *********************************************************************** ; ; Clear specified graphics area in map. ; Generic version ; ; Stefano Bodrato - March 2002 ; ; ; IN: HL = (x,y) ; BC = (width,heigth) ; .cleararea push hl push bc .rowloop push hl push de push bc call respixel pop bc pop de pop hl inc h djnz rowloop pop bc pop hl inc l dec c jr nz,cleararea ret z88dk-1.8.ds1/libsrc/graphics/clrarea2.asm0000755000175000017500000000523610765022562017775 0ustar tygrystygrys xlib cleararea lib pixeladdress lib leftbitmask, rightbitmask ; ; $Id: clrarea2.asm,v 1.2 2008/03/07 07:12:09 stefano Exp $ ; ; *********************************************************************** ; ; Clear specified graphics area in map. ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; Generic SMC version by Stefano Bodrato. ; ; ; ; IN: HL = (x,y) ; BC = (width,heigth) ; ; Registers changed after return: ; ......../IXIY same ; AFBCDEHL/.... different ; .adr0 defw 0 .cleararea ld (coord+1),hl ; SMC: remember y,x inc b push bc ; remember height push bc call pixeladdress ; adr0, bitpos0 = pixeladdress(x,y) ld (adr0),de call leftbitmask ld (bitmaskl1+1),a ; bitmask0 = LeftBitMask(bitpos0) ld (bitmaskl2+1),a ; bitmask0 = LeftBitMask(bitpos0) pop bc ld a,h add a,b dec a ld h,a push de push hl call pixeladdress ; adr1, bitpos1 = pixeladdress(x+width-1,y) pop hl call rightbitmask ld (bitmaskr1+1),a ; bitmask1 = LeftBitMask(bitpos0) ld (bitmaskr2+1),a ; bitmask1 = LeftBitMask(bitpos0) pop hl ex de,hl cp a sbc hl,de ; (adr1-adr0) srl l srl l srl l ld a,l ld (rowbytes1+1),a ld (rowbytes2+1),a ; rowbytes = (adr1-adr0) div 8, no. of bytes in row ; 0 means that area is within same address ; FOR h = 1 TO height .clear_height ld hl,(adr0) xor a .rowbytes1 cp 0 ; if rowbytes = 0 jr nz, clear_row ; area is within one byte... ld a,(hl) .bitmaskl1 and 0 ; preserve bits of leftmost side of byte ld b,a ld a,(hl) .bitmaskr1 and 0 ld c,a xor a ; clear byte or b ; merge preserved bits of left side or c ; merge preserve bits of right side ld (hl),a ; (offset) = byte jr clear_nextrow ; else .clear_row ; clear area is defined as rows of bytes ld a,(hl) .bitmaskl2 and 0 ; preserve only leftmost bits (outside of area) ld (hl),a ; (offset) = (offset) AND bitmask0 ld bc,8 add hl,bc ; offset += 8 .rowbytes2 ld b,0 ; r = rowbytes dec b ; --r jr z, row_cleared ; if ( r ) .clear_row_loop push bc ; do ld (hl),0 ; (offset) = 0 ld bc,8 add hl,bc ; offset += 8 pop bc djnz clear_row_loop ; while ( r-- != 0 ) .row_cleared ld a,(hl) ; byte = (adr1) .bitmaskr2 and 0 ld (hl),a ; preserve only rightmost side of byte (outside area) .clear_nextrow push de .coord ld hl,0 ; SMC -> y,x inc l ld (coord+1),hl ; SMC -> y,x call pixeladdress ld (adr0),de pop de .clear_next_h ;dec (height) ; END FOR h .height pop bc dec c ; height push bc jp nz, clear_height pop bc .end_cleararea ret z88dk-1.8.ds1/libsrc/graphics/clsgraph.asm0000644000175000017500000000131407267312341020073 0ustar tygrystygrys INCLUDE "graphics/grafix.inc" XLIB cleargraphics XREF base_graphics ; ; $Id: clsgraph.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ; ****************************************************************** ; ; Clear graphics area, i.e. reset all bits in graphics ; window (256x64 pixels) ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; Registers changed after return: ; a.bcdehl/ixiy same ; .f....../.... different ; .cleargraphics push bc push de push hl ld hl,(base_graphics) ; base of graphics area ld (hl),0 ld d,h ld e,1 ; de = base_graphics+1 ld bc,maxx*maxy/8-1 ldir ; reset graphics window (2K) pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/graphics/cpc/0000755000175000017500000000000010765202715016334 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/cpc/clg.asm0000644000175000017500000000103510650475166017607 0ustar tygrystygrys; ; Clear Graphics Screen ; ; Amstrad CPC version by Stefano Bodrato 15/6/2001 ; ; ; $Id: clg.asm,v 1.5 2007/07/21 21:28:22 dom Exp $ ; XLIB clg INCLUDE "#cpcfirm.def" INCLUDE "graphics/grafix.inc" ; Possible colors: 0 (blue), 1 (yellow), 2 (cyan), 3 (red) ; ; .clg ld a,bcolor call firmware defw gra_set_paper ld a,fcolor call firmware defw gra_set_pen call firmware defw scr_clear ret z88dk-1.8.ds1/libsrc/graphics/cpc/draw.asm0000755000175000017500000000216110650475166020003 0ustar tygrystygrys; ; Amstrad CPC Graphics Functions ; ; by Stefano Bodrato - Jul 2004 ; ; Draw a line between two points ; ; $Id: draw.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; ;&BBC0 - GRA MOVE ABSOLUTE - Move to an absolute position ; ;Entry: ; ;DE = X coordinate ;HL = y coordinate ;&BBF6 - GRA LINE ABSOLUTE - Draw a line to an absolute position ; ;Entry: ; ;DE = X coordinate of endpoint ;HL = Y coordinate of endpoint ; XLIB draw INCLUDE "#cpcfirm.def" INCLUDE "graphics/grafix.inc" .draw ld ix,0 add ix,sp push ix ld e,(ix+6) ;y0 ld d,(ix+7) ld hl,maxy sbc hl,de ld e,(ix+8) ;x0 ld d,(ix+9) and a ; double size (?) rl l rl h and a rl e rl d call firmware defw gra_move_absolute pop ix ld e,(ix+2) ;y1 ld d,(ix+3) ld hl,maxy sbc hl,de ld e,(ix+4) ;x1 ld d,(ix+5) and a ; double size (?) rl l rl h and a rl e rl d call firmware defw gra_line_absolute ret z88dk-1.8.ds1/libsrc/graphics/cpc/drawr.asm0000755000175000017500000000137110650475166020167 0ustar tygrystygrys; ; Amstrad CPC Graphics Functions ; ; by Stefano Bodrato - Jul 2004 ; ; ; $Id: drawr.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; ;Usage: drawr(struct *pixels) ;&BBF6 - GRA LINE ABSOLUTE - Draw a line to an absolute position ; ;Entry: ; ;DE = X coordinate of endpoint ;HL = Y coordinate of endpoint ; XLIB drawr INCLUDE "#cpcfirm.def" INCLUDE "graphics/grafix.inc" .drawr ld ix,0 add ix,sp ld e,(ix+2) ;y1 ld d,(ix+3) ld hl,maxy sbc hl,de ld e,(ix+4) ;x1 ld d,(ix+5) and a ; double size (?) rl l rl h and a rl e rl d call firmware defw gra_line_absolute ret z88dk-1.8.ds1/libsrc/graphics/cpc/fill.asm0000755000175000017500000000364110650475166020000 0ustar tygrystygrys; ; Z88DK Graphics Functions - Small C+ stubs ; ; Fill - Stefano Bodrato ; ; ;198 &BD52 GRA FILL ; Action: Fills an area of the screen starting from the current ; graphics position and extending until it reaches either ; the edge of the window or a pixel set to the PEN ; Entry: A holds a PEN to fill with, HL holds the address of the ; buffer, and DE holds the length of the buffer ; Exit: If the area was filled properly, then Carry is true; if ; the area was not filled, then Carry is false; in either ; case, A, BC, DE, HL and the other flags are corrupt, ; and all others are preserved ; Notes: The buffer is used to store complex areas to fill, ; which are remembered and filled when the basic shape ; has been done; each entry in the buffer uses seven ; bytes and so the more complex the shape the larger the ; buffer; if it runs out of space to store these complex ; areas, it will fill what it can and then return with ; Carry false ; ; ; $Id: fill.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; ;Usage: fill(struct *pixel) XLIB fill INCLUDE "#cpcfirm.def" INCLUDE "graphics/grafix.inc" .fill ld ix,0 add ix,sp ld e,(ix+2) ld d,(ix+3) ld hl,maxy sbc hl,de ld e,(ix+4) ld d,(ix+5) and a ; double size (?) rl l rl h and a rl e rl d call firmware defw gra_move_absolute ld a,fcolor ld hl,-3192 ; create the buffer on stack add hl,sp ld sp,hl ld d,h ld e,l call firmware defw gra_fill ; 664/6128 only ld hl,3192 ; restore the stack pointer add hl,sp ld sp,hl ret z88dk-1.8.ds1/libsrc/graphics/cpc/pixladdr.asm0000644000175000017500000000302710650475166020654 0ustar tygrystygrys XLIB pixeladdress INCLUDE "#cpcfirm.def" INCLUDE "graphics/grafix.inc" ; ; $Id: pixladdr.asm,v 1.6 2007/07/21 21:28:22 dom Exp $ ; ; ****************************************************************** ; ; Get absolute pixel address in map of virtual (x,y) coordinate. ; ; in: hl = (x,y) coordinate of pixel (h,l) ; ; out: de = address of pixel byte ; a = bit number of byte where pixel is to be placed ; fz = 1 if bit number is 0 of pixel position ; ; registers changed after return: ; ......hl/ixiy same ; afbcde../.... different ; ; We use the Amstrad ROM function ; ;095 &BC1D SCR DOT POSITION ; Action: Gets the memory address of a pixel at a specified ; screen position ; Entry: DE contains the base X-coordinate of the pixel, and HL ; contains the base Y-coordinate ; Exit: HL contains the memory address of the pixel, C contains ; the bit mask for this pixel, B contains the number of ; pixels stored in a byte minus 1, AF and DE are corrupt, ; and all others are preserved XDEF grayaltpage .pixeladdress push bc ld a,maxy sub l ld d,0 ld e,h ld h,d ld l,a call firmware defw scr_dot_position ld d,h ld e,l ld a,c ld c,-1 .loopa inc c rra jr nc,loopa ld a,c .grayaltpage nop pop bc ret z88dk-1.8.ds1/libsrc/graphics/cpc/plot.asm0000755000175000017500000000136410650475166020030 0ustar tygrystygrys; ; Amstrad CPC Graphics Functions ; ; by Stefano Bodrato - Jul 2004 ; ; ; $Id: plot.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; ;Usage: plot(struct *pixel) ;&BBEA - GRA PLOT ABSOLUTE - Plot a point at an absolute position ; ;Entry: ; ;DE = X coordinate relative to user origin ;HL = Y coordinate relative to user origin XLIB plot INCLUDE "#cpcfirm.def" INCLUDE "graphics/grafix.inc" .plot ld ix,0 add ix,sp ld e,(ix+2) ld d,(ix+3) ld hl,maxy sbc hl,de ld e,(ix+4) ld d,(ix+5) and a ; double size (?) rl l rl h and a rl e rl d call firmware defw gra_plot_absolute ret z88dk-1.8.ds1/libsrc/graphics/cpc/putsprite3.asm0000755000175000017500000000624210650475166021174 0ustar tygrystygrys; ; Sprite Rendering Routine - Amstrad CPC version ; original code by Patrick Davidson (TI 85) ; modified by Stefano Bodrato - Jul 2004 ; ; Sept 2003 - Stefano: Fixed bug for sprites wider than 8. ; ; Much More Generic version ; Uses plotpixel, respixel and xorpixel ; ; This is a variant, even slower, of putsprite3. ; It is based on the BIOS calls, so it should be more flexible and compact. ; The XOR mode is totally untested. ; ; ; $Id: putsprite3.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; XLIB putsprite INCLUDE "#cpcfirm.def" INCLUDE "graphics/grafix.inc" ; coords: h,l (vert-horz) ; sprite: (ix) .putsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl inc hl ld a,(hl) ; and/or/xor mode ; 166 - and ; 182 - or ; 174 - xor cp 166 ; and(hl) opcode jr nz,noand push de ld a,bcolor call firmware defw gra_set_pen pop de jr modeset .noand cp 174 ; xor(hl) opcode jr nz,modeset ; Probably we have an "OR" push de ld a,1 ; XOR call firmware defw scr_access pop de .modeset ld h,d ld l,e ld a,(ix+0) ; Width ld b,(ix+1) ; Height .oloopx push bc ;Save # of rows push af ;ld b,a ;Load width ld b,0 ; Better, start from zero !! ld c,(ix+2) ;Load one line of image .iloopx sla c ;Test leftmost pixel jr nc,noplotx ;See if a plot is needed pop af push af push hl push bc push de ld a,h add a,b ld h,a ld a,maxy sub l ld e,h ld h,0 ld d,h ld l,a ;ld h,0 ;ld d,h ;ld e,a and a ; double size (?) rl l rl h and a rl e rl d call firmware defw gra_plot_absolute pop de pop bc pop hl .noplotx inc b ; witdh counter pop af push af cp b ; end of row ? jr nz,noblkx inc ix ld c,(ix+2) ;Load next byte of image jr noblockx .noblkx ld a,b ; next byte in row ? ;dec a and a jr z,iloopx and 7 jr nz,iloopx .blockx inc ix ld c,(ix+2) ;Load next byte of image jr iloopx .noblockx inc l pop af pop bc ;Restore data djnz oloopx ld a,fcolor ;Restore fore color call firmware defw gra_set_pen ld a,0 ; FORCE mode (OR) call firmware defw scr_access ret z88dk-1.8.ds1/libsrc/graphics/cpc/swapgfxbk.asm0000644000175000017500000000067110070533460021027 0ustar tygrystygrys; ; Page the graphics bank in/out - used by all gfx functions ; Doesn't really page on the Amstrad CPC. ; ; ; $Id: swapgfxbk.asm,v 1.4 2004/06/30 12:50:56 stefano Exp $ ; ; There might be something to put here; it looks like the ; alternate registers and/or the index registers have to be ; handled carefully ; XLIB swapgfxbk XDEF swapgfxbk1 .swapgfxbk ;di ;ret .swapgfxbk1 ;ei ret z88dk-1.8.ds1/libsrc/graphics/cpc/undraw.asm0000755000175000017500000000105210650475166020344 0ustar tygrystygrys; ; Amstrad CPC Graphics Functions ; ; by Stefano Bodrato - Jul 2004 ; ; ; $Id: undraw.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; XLIB undraw LIB draw INCLUDE "#cpcfirm.def" INCLUDE "graphics/grafix.inc" .hlsave defw 0 .undraw ld a,bcolor call firmware defw gra_set_pen pop hl ld (hlsave),hl call draw ld hl,(hlsave) push hl ld a,fcolor call firmware defw gra_set_pen ret z88dk-1.8.ds1/libsrc/graphics/cpc/undrawr.asm0000755000175000017500000000107410650475166020532 0ustar tygrystygrys; ; Amstrad CPC Graphics Functions ; ; by Stefano Bodrato - Jul 2004 ; ; ; $Id: undrawr.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; XLIB undrawr LIB drawr INCLUDE "#cpcfirm.def" INCLUDE "graphics/grafix.inc" .hlsave defw 0 .undrawr ld a,bcolor call firmware defw gra_set_pen pop hl ld (hlsave),hl call drawr ld hl,(hlsave) push hl ld a,fcolor call firmware defw gra_set_pen ret z88dk-1.8.ds1/libsrc/graphics/cpc/unplot.asm0000755000175000017500000000162610650475166020374 0ustar tygrystygrys; ; Amstrad CPC Graphics Functions ; ; by Stefano Bodrato - Jul 2004 ; ; ; $Id: unplot.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; ;Usage: unplot(struct *pixel) ;&BBEA - GRA PLOT ABSOLUTE - Plot a point at an absolute position ; ;Entry: ; ;DE = X coordinate relative to user origin ;HL = Y coordinate relative to user origin XLIB unplot INCLUDE "#cpcfirm.def" INCLUDE "graphics/grafix.inc" .unplot ld a,bcolor call firmware defw gra_set_pen ld ix,0 add ix,sp ld e,(ix+2) ld d,(ix+3) ld hl,maxy sbc hl,de ld e,(ix+4) ld d,(ix+5) and a ; double size (?) rl l rl h and a rl e rl d call firmware defw gra_plot_absolute ld a,fcolor call firmware defw gra_set_pen ret z88dk-1.8.ds1/libsrc/graphics/dcircle.asm0000644000175000017500000000613007267312341017676 0ustar tygrystygrys; Z88 Small C+ Graphics Functions ; Draw a circle on the Z88 map ; Adapted from my Spectrum Routine ; (C) 1995-1998 D.J.Morris ; ; $Id: dcircle.asm,v 1.2 2001/04/18 13:21:37 stefano Exp $ ; XLIB draw_circle DEFVARS 0 { x0 ds.b 1 y0 ds.b 1 radius ds.b 1 scale ds.b 1 cx ds.b 1 da ds.b 1 } ;iy points to table on stack (above) ;Entry: ; b=x0 c=y0, d=radius, e=scale factor ; ix=plot routine .draw_circle ld iy,-6 ;create buffer on stack add iy,sp ld sp,iy ld (iy+x0),b ld (iy+y0),c ld (iy+radius),d ld (iy+scale),e ;step factor - usually 1 call l9900 ld hl,6 add hl,sp ld sp,hl ret ;Line 9900 .l9900 ld (iy+cx),0 srl d ld (iy+da),d ;Line 9905 .l9905 ld a,(iy+cx) cp (iy+radius) ret nc ;Line 9910 ld a,(iy+da) and a jp p,l9915 add a,(iy+radius) ld (iy+da),a ld a,(iy+radius) sub (iy+scale) ld (iy+radius),a ;Line 9915 .l9915 ld a,(iy+da) dec a sub (iy+cx) ld (iy+da),a .l9920 ld a,(iy+y0) add a,(iy+radius) ld l,a ex af,af' ld a,(iy+x0) add a,(iy+cx) ld h,a call doplot ex af,af' ld l,a ld a,(iy+x0) sub (iy+cx) ld h,a call doplot ld a,(iy+y0) sub (iy+radius) ld l,a ex af,af' ld a,(iy+x0) add a,(iy+cx) ld h,a call doplot ex af,af' ld l,a ld a,(iy+x0) sub (iy+cx) ld h,a call doplot ;Line 9925 ld a,(iy+y0) add a,(iy+cx) ld l,a ex af,af' ld a,(iy+x0) add a,(iy+radius) ld h,a call doplot ex af,af' ld l,a ld a,(iy+x0) sub (iy+radius) ld h,a call doplot ld a,(iy+y0) sub (iy+cx) ld l,a ex af,af' ld a,(iy+x0) add a,(iy+radius) ld h,a call doplot ex af,af' ld l,a ld a,(iy+x0) sub (iy+radius) ld h,a call doplot ;Line 9930 ld a,(iy+cx) add a,(iy+scale) ld (iy+cx),a jp l9905 ;Entry to my plot is the same as for the z88 plot - very convenient! .doplot ret c jp (ix) z88dk-1.8.ds1/libsrc/graphics/dcircle2.asm0000644000175000017500000000742110675670074017773 0ustar tygrystygrys; Z88 Small C+ Graphics Functions ; Draw a circle on the Z88 map ; Adapted from my Spectrum Routine ; (C) 1995-1998 D.J.Morris ; ; ZX81 version ; Non IY dependent (self modifying code) ; A' isn't used ; ; $Id: dcircle2.asm,v 1.4 2007/09/24 08:07:24 stefano Exp $ ; XLIB draw_circle DEFVARS 0 { x0 ds.b 1 y0 ds.b 1 radius ds.b 1 scale ds.b 1 cx ds.b 1 da ds.b 1 } .asave defb 0 ;ix points to table on stack (above) ;Entry: ; b=x0 c=y0, d=radius, e=scale factor ; ix=plot routine .draw_circle ld (plt+1),ix ld ix,-6 ;create buffer on stack add ix,sp ld sp,ix ld (ix+x0),b ld (ix+y0),c ld (ix+radius),d ld (ix+scale),e ;step factor - usually 1 call l9900 ld hl,6 add hl,sp ld sp,hl ret ;Line 9900 .l9900 ld (ix+cx),0 srl d ld (ix+da),d ;Line 9905 .l9905 ld a,(ix+cx) cp (ix+radius) ret nc ;Line 9910 ld a,(ix+da) and a jp p,l9915 add a,(ix+radius) ld (ix+da),a ld a,(ix+radius) sub (ix+scale) ld (ix+radius),a ;Line 9915 .l9915 ld a,(ix+da) dec a sub (ix+cx) ld (ix+da),a .l9920 ld a,(ix+y0) add a,(ix+radius) ld l,a ld a,(asave) push af ld a,l ld (asave),a pop af ld a,(ix+x0) add a,(ix+cx) ld h,a call doplot push af ld a,(asave) ld l,a pop af ld (asave),a ld a,(ix+x0) sub (ix+cx) ld h,a call doplot ld a,(ix+y0) sub (ix+radius) ld l,a ld a,(asave) push af ld a,l ld (asave),a pop af ld a,(ix+x0) add a,(ix+cx) ld h,a call doplot push af ld a,(asave) ld l,a pop af ld (asave),a ld a,(ix+x0) sub (ix+cx) ld h,a call doplot ;Line 9925 ld a,(ix+y0) add a,(ix+cx) ld l,a ld a,(asave) push af ld a,l ld (asave),a pop af ld a,(ix+x0) add a,(ix+radius) ld h,a call doplot push af ld a,(asave) ld l,a pop af ld (asave),a ld a,(ix+x0) sub (ix+radius) ld h,a call doplot ld a,(ix+y0) sub (ix+cx) ld l,a ld a,(asave) push af ld a,l ld (asave),a pop af ld a,(ix+x0) add a,(ix+radius) ld h,a call doplot push af ld a,(asave) ld l,a pop af ld (asave),a ld a,(ix+x0) sub (ix+radius) ld h,a call doplot ;Line 9930 ld a,(ix+cx) add a,(ix+scale) ld (ix+cx),a jp l9905 ;Entry to my plot is the same as for the z88 plot - very convenient! .doplot ret c .plt jp 0 z88dk-1.8.ds1/libsrc/graphics/dfill.asm0000644000175000017500000000421307457364560017376 0ustar tygrystygrys; Z88DK Small C+ Graphics Functions ; Fills a screen area ; Original code by Massimo Morra (Thanks!) ; Ported by Stefano Bodrato ; ; Feb 2000 - Platform dependent stack usage ; Stack usage should be maxy*8 (512 bytes for the Z88) ; ; Since some platform (expecially the TI83) has very little stack space, ; we undersize it; this will cause a crash if a big area is filled. ; ; $Id: dfill.asm,v 1.6 2002/04/17 21:30:24 dom Exp $ ; INCLUDE "graphics/grafix.inc" XLIB do_fill LIB pixeladdress LIB plotpixel .spsave defw 0 ;ix points to the table on stack (above) ;Entry: ; d=x0 e=y0 .do_fill ld hl,-maxy*3 ; create buffer 1 on stack add hl,sp ; The stack size depends on the display height. ld sp,hl ; The worst case is when we paint a blank push hl ; display starting from the center. pop ix ld (hl),d inc hl ld (hl),e inc hl ld (hl),255 ld hl,-maxy*3 ; create buffer 2 on stack add hl,sp ld sp,hl .loop push ix push hl call cfill pop ix pop hl ex af,af ; Restore the Z flag push af ex af,af pop af jr nz,loop ld hl,maxy*6 ; restore the stack pointer (parm*2) add hl,sp ld sp,hl ret .cfill sub a,a ; Reset the Z flag ex af,af ; and save it .next ld a,(ix+0) cp 255 ; stopper ? ret z ; return ld b,a ld c,(ix+1) push bc or a jr z,l1 dec b call doplot pop bc push bc .l1 ld a,b cp maxy-1 jr z,l2 inc b call doplot pop bc push bc .l2 ld a,c or a jr z,l3 dec c call doplot .l3 pop bc ld a,c cp maxx-1 jr z,l4 inc c call doplot .l4 inc ix inc ix jr next .doplot push bc ld (hl),255 push hl ld l,b ld h,c call pixeladdress ; bc must be saved by pixeladdress ! pop hl xor 7 ld b,a inc b push bc ld a,(de) .shift rlca djnz shift and 1 pop bc jr z,dontret pop de ret .dontret inc a .doset rrca djnz doset ld b,a ld a,(de) or b ; Z flag set... ld (de),a pop bc ld (hl),b inc hl ld (hl),c inc hl ld (hl),255 ex af,af ; Save the Z flag xor a ret z88dk-1.8.ds1/libsrc/graphics/dfill2.asm0000644000175000017500000000443510675670074017462 0ustar tygrystygrys; Z88DK Small C+ Graphics Functions ; Fills a screen area ; Original code by Massimo Morra (Thanks!) ; Ported by Stefano Bodrato ; ; Feb 2000 - Platform dependent stack usage ; Stack usage should be maxy*8 (512 bytes for the Z88) ; ; Since some platform (expecially the TI83) has very little stack space, ; we undersize it; this will cause a crash if a big area is filled. ; ; - THIS SMC VERSION DOESN'T MAKE USE OF ALTERNATE REGISTERS - ; ; $Id: dfill2.asm,v 1.1 2007/09/24 08:07:24 stefano Exp $ ; INCLUDE "graphics/grafix.inc" XLIB do_fill LIB pixeladdress LIB plotpixel .spsave defw 0 ;ix points to the table on stack (above) ;Entry: ; d=x0 e=y0 .do_fill ld hl,-maxy*3 ; create buffer 1 on stack add hl,sp ; The stack size depends on the display height. ld sp,hl ; The worst case is when we paint a blank push hl ; display starting from the center. pop ix ld (hl),d inc hl ld (hl),e inc hl ld (hl),255 ld hl,-maxy*3 ; create buffer 2 on stack add hl,sp ld sp,hl .loop push ix push hl call cfill pop ix pop hl .asave ld a,0 and a ;;ex af,af ; Restore the Z flag ;;push af ;;ex af,af ;;pop af jr nz,loop ld hl,maxy*6 ; restore the stack pointer (parm*2) add hl,sp ld sp,hl ret .cfill ;sub a,a ; Reset the Z flag ;ex af,af ; and save it xor a ld (asave+1),a .next ld a,(ix+0) cp 255 ; stopper ? ret z ; return ld b,a ld c,(ix+1) push bc or a jr z,l1 dec b call doplot pop bc push bc .l1 ld a,b cp maxy-1 jr z,l2 inc b call doplot pop bc push bc .l2 ld a,c or a jr z,l3 dec c call doplot .l3 pop bc ld a,c cp maxx-1 jr z,l4 inc c call doplot .l4 inc ix inc ix jr next .doplot push bc ld (hl),255 push hl ld l,b ld h,c call pixeladdress ; bc must be saved by pixeladdress ! pop hl xor 7 ld b,a inc b push bc ld a,(de) .shift rlca djnz shift and 1 pop bc jr z,dontret pop de ret .dontret inc a .doset rrca djnz doset ld b,a ld a,(de) or b ; Z flag set... ld (asave+1),a ld (de),a pop bc ld (hl),b inc hl ld (hl),c inc hl ld (hl),255 ;ex af,af ; Save the Z flag xor a ret z88dk-1.8.ds1/libsrc/graphics/draw.asm0000644000175000017500000000122407457364560017240 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: draw.asm,v 1.6 2002/04/17 21:30:24 dom Exp $ ; XLIB draw LIB swapgfxbk XREF swapgfxbk1 LIB line LIB plotpixel .draw ld ix,0 add ix,sp ld l,(ix+6) ;y0 ld h,(ix+8) ;x0 ld e,(ix+2) ;y1 ld d,(ix+4) ;x1 call swapgfxbk push hl push de call plotpixel pop de pop hl ld ix,plotpixel call line jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/drawb.asm0000644000175000017500000000112107452557764017403 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: drawb.asm,v 1.4 2002/04/03 10:56:52 stefano Exp $ ; XLIB drawb LIB drawbox LIB plotpixel LIB swapgfxbk XREF swapgfxbk1 .drawb ld ix,0 add ix,sp ld c,(ix+2) ld b,(ix+4) ld l,(ix+6) ld h,(ix+8) ld ix,plotpixel call swapgfxbk call drawbox jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/drawbox.asm0000644000175000017500000000223407450574701017744 0ustar tygrystygrys xlib drawbox lib plotpixel ; ; $Id: drawbox.asm,v 1.4 2002/03/28 11:08:49 stefano Exp $ ; ; *********************************************************************** ; ; Clear specified graphics area in map. ; Generic version ; ; Stefano Bodrato - March 2002 ; ; ; IN: HL = (x,y) ; BC = (width,heigth) ; .drawbox push bc push hl ; -- Vertical lines -- push hl ld a,h add a,b ret c ; overflow ? dec a ld h,a pop de .rowloop push bc push hl push de ld de, p_RET1 push de jp (ix) ; execute PLOT at (h,l) .p_RET1 pop de pop hl inc l ex de,hl push hl push de ld de, p_RET2 push de jp (ix) ; execute PLOT at (h,l) .p_RET2 pop de pop hl inc l ex de,hl pop bc dec c jr nz,rowloop pop hl pop bc ; -- Horizontal lines -- push hl ld a,l add a,c ret c ; overflow ? dec a ld l,a pop de .vrowloop push bc push hl push de ld de, p_RET3 push de jp (ix) ; execute PLOT at (h,l) .p_RET3 pop de pop hl inc h ex de,hl push hl push de ld de, p_RET4 push de jp (ix) ; execute PLOT at (h,l) .p_RET4 pop de pop hl inc h ex de,hl pop bc djnz vrowloop ret z88dk-1.8.ds1/libsrc/graphics/drawr.asm0000644000175000017500000000120607267312341017407 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: drawr.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ;Usage: drawr(struct *pixels) XLIB drawr LIB swapgfxbk XREF swapgfxbk1 LIB line_r LIB plotpixel .drawr ld ix,0 add ix,sp ld e,(ix+2) ;py ld d,(ix+3) ld l,(ix+4) ;px ld h,(ix+5) ld ix,plotpixel call swapgfxbk call line_r jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/fill.asm0000644000175000017500000000073107267312341017220 0ustar tygrystygrys; ; Z88DK Graphics Functions - Small C+ stubs ; ; Fill stub - Stefano Bodrato 11/6/2000 ; ; ; $Id: fill.asm,v 1.2 2001/04/18 13:21:37 stefano Exp $ ; ;Usage: fill(struct *pixel) XLIB fill LIB do_fill LIB swapgfxbk XREF swapgfxbk1 .fill ld ix,0 add ix,sp ld d,(ix+2) ;y ld e,(ix+4) ;x call swapgfxbk call do_fill jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/getsprite.asm0000644000175000017500000000272307457364560020316 0ustar tygrystygrys; ; Getsprite - Picks up a sprite from display with the given size ; by Stefano Bodrato - Jan 2001 ; Apr 2002 - Fixed. (Long time, I know...) ; ; The original putsprite code is by Patrick Davidson (TI 85) ; ; Generic version (just a bit slow) ; ; ; $Id: getsprite.asm,v 1.6 2002/04/17 21:30:24 dom Exp $ ; XLIB getsprite LIB pixeladdress LIB swapgfxbk XREF swapgfxbk1 INCLUDE "graphics/grafix.inc" ; coords: d,e (vert-horz) ; sprite: (ix) .actcoord defw 0 .getsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ; sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords ld h,d ld l,e ld (actcoord),hl ; save current coordinates call swapgfxbk call pixeladdress xor 7 ld (_smc+1),a ld h,d ld l,e ld e,(ix+0) ld b,(ix+1) dec e srl e srl e srl e inc e ; INT ((width-1)/8+1) ._oloop push bc ;Save # of rows push de ;Save # of bytes per row ._iloop2 ld a,(hl) inc hl ld d,(hl) ._smc ld b,1 ;Load pixel position inc b dec b jr z,zpos ._iloop rl d rl a djnz _iloop .zpos ld (ix+2),a inc ix dec e jr nz,_iloop2 ; --------- push de ld hl,(actcoord) inc l ld (actcoord),hl call pixeladdress ld h,d ld l,e pop de ; --------- pop de pop bc ;Restore data djnz _oloop jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/grafix.inc0000644000175000017500000000451110731746267017553 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubbs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; Define for graphics and other standard library functions ; ; ; $Id: grafix.inc,v 1.15 2007/12/18 13:35:51 stefano Exp $ ; IF FORti82 DEFINE gotgfx defc row_bytes = 12 defc maxx = 96 defc maxy = 64 ENDIF IF FORti83 DEFINE gotgfx defc row_bytes = 12 defc maxx = 96 defc maxy = 64 ENDIF IF FORti83p DEFINE gotgfx defc row_bytes = 12 defc maxx = 96 defc maxy = 64 ENDIF IF FORti85 DEFINE gotgfx defc row_bytes = 16 defc maxx = 128 defc maxy = 64 ENDIF IF FORti86 DEFINE gotgfx defc row_bytes = 16 defc maxx = 128 defc maxy = 64 ENDIF IF FORvz DEFINE gotgfx defc maxx = 128 defc maxy = 64 ENDIF IF FORzx81 DEFINE gotgfx defc maxx = 64 defc maxy = 48 ENDIF IF FORzx81hr64 DEFINE gotgfx defc maxx = 256 defc maxy = 64 ENDIF IF FORzx81hr192 DEFINE gotgfx defc maxx = 256 defc maxy = 192 ENDIF IF FORjupiter DEFINE gotgfx defc maxx = 96 ; emulated (64 real dots) defc maxy = 64 ; emulated (48 real dots) ENDIF IF FORzx DEFINE gotgfx defc maxx = 256 defc maxy = 192 ENDIF IF FORcpc DEFINE gotgfx defc maxx = 256 defc maxy = 192 defc bcolor = 0 defc fcolor = 2 defc row_bytes = 64 ENDIF IF FORmsx DEFINE gotgfx defc maxx = 256 defc maxy = 192 defc fcolor = 15 ENDIF IF FORsam DEFINE gotgfx defc maxx = 256 defc maxy = 192 ENDIF IF FORoz DEFINE gotgfx defc row_bytes = 30 defc maxx = 239 defc maxy = 80 ENDIF IF FORnascom DEFINE gotgfx defc maxx = 96 defc maxy = 48 ENDIF IF FORc128 DEFINE gotgfx defc maxx = 80 defc maxy = 50 ENDIF IF FORaquarius DEFINE gotgfx defc maxx = 80 defc maxy = 72 ENDIF IF FORz88 DEFINE gotgfx defc maxx = 256 defc maxy = 64 IF !APPZ88 defc map_seg = 192 defc map_bk = $4D3 ELSE defc map_seg = 64 defc map_bk = $4D1 ENDIF ENDIF ; Catch all to sort things out IF !gotgfx defc maxx = 256 defc maxy = 192 ELSE UNDEFINE gotgfx ENDIF ; Structure for open window struct *window DEFVARS 0 { windnum ds.b 1 wind_x ds.b 1 wind_y ds.b 1 wind_w ds.b 1 ;width/map width wind_d ds.b 1 ; type ds.b 1 ; graph ds.b 1 ;0=text 1=graphics } z88dk-1.8.ds1/libsrc/graphics/graphics0000644000175000017500000000011507130401722017276 0ustar tygrystygrysdraw undraw drawr undrawr drawb undrawb plot unplot lscroll rscroll clg clga z88dk-1.8.ds1/libsrc/graphics/gray/0000755000175000017500000000000010765202715016531 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/gray/cpc/0000755000175000017500000000000010765202715017276 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/gray/cpc/g_clg.asm0000755000175000017500000000051610070533461021052 0ustar tygrystygrys; ; Amstrad CPC pseudo-Gray Library Functions ; ; Written by Stefano Bodrato - June 2004 ; ; $Id: g_clg.asm,v 1.1 2004/06/30 12:50:57 stefano Exp $ ; ; ;Usage: g_clg(GrayLevel) XLIB g_clg .g_clg ld ix,0 add ix,sp ld a,(ix+2) ;GrayLevel call $BBE4 ;jp $BC14 jp $BBDB z88dk-1.8.ds1/libsrc/graphics/gray/cpc/grpage.asm0000755000175000017500000000075310070533461021247 0ustar tygrystygrys; ; Amstrad CPC pseudo-Gray Library Functions ; ; Written by Stefano Bodrato - June 2004 ; ; $Id: grpage.asm,v 1.1 2004/06/30 12:50:57 stefano Exp $ ; ; ; A trick to be used with the dafault graph functions ; ; IN: A=Page Number (0/1) ; all registers are saved XLIB graypage XREF base_graphics XREF grayaltpage .graypage and a jr nz,flippage ld a,0 ; NOP ld (grayaltpage),a ret .flippage ld a,$17 ; RLA ld (grayaltpage),a ret z88dk-1.8.ds1/libsrc/graphics/gray/g_circle.asm0000644000175000017500000000164107267312342021005 0ustar tygrystygrys; ; TI Gray Library Functions ; ; Written by Stefano Bodrato - Mar 2001 ; ; ; $Id: g_circle.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ;Usage: g_circle(int x, int y, int radius, int skip, int GrayLevel) XLIB g_circle LIB draw_circle LIB plotpixel LIB respixel LIB graypage .g_circle ld ix,0 add ix,sp ld a,(ix+2) ;GrayLevel ld e,(ix+4) ;skip ld d,(ix+6) ;radius ld c,(ix+8) ;y ld b,(ix+10) ;x push af xor a call graypage pop af ld ix,plotpixel rra jr nc,set1 ld ix,respixel .set1 push af push de push bc call draw_circle pop bc pop de pop af push af ld a,1 call graypage pop af ld ix,plotpixel rra jr nc,set2 ld ix,respixel .set2 jp draw_circle z88dk-1.8.ds1/libsrc/graphics/gray/g_clg.asm0000644000175000017500000000064207457364561020324 0ustar tygrystygrys; ; TI Gray Library Functions ; ; Written by Stefano Bodrato - Mar 2001 ; ; ; $Id: g_clg.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; ;Usage: g_clg() INCLUDE "graphics/grafix.inc" /* Contains fn defs */ XLIB g_clg XREF graybit1 XREF graybit2 .g_clg ld hl,(graybit1) call cls ld hl,(graybit2) .cls ld (hl),0 ld d,h ld e,l inc de ld bc,row_bytes*64-1 ldir ret z88dk-1.8.ds1/libsrc/graphics/gray/g_draw.asm0000644000175000017500000000157007267312342020502 0ustar tygrystygrys; ; TI Gray Library Functions ; ; Written by Stefano Bodrato - Mar 2001 ; ; ; $Id: g_draw.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ;Usage: g_draw(int x1, int y1, int x2, int y2, int GrayLevel) XLIB g_draw LIB line LIB plotpixel LIB respixel LIB graypage .g_draw ld ix,0 add ix,sp ld a,(ix+2) ;GrayLevel ld e,(ix+4) ;y1 ld d,(ix+6) ;x1 ld l,(ix+8) ;y0 ld h,(ix+10) ;x0 push af xor a call graypage pop af ld ix,plotpixel rra jr nc,set1 ld ix,respixel .set1 push af push hl push de call line pop de pop hl pop af push af ld a,1 call graypage pop af ld ix,plotpixel rra jr nc,set2 ld ix,respixel .set2 jp line z88dk-1.8.ds1/libsrc/graphics/gray/g_drawb.asm0000644000175000017500000000161407267312342020643 0ustar tygrystygrys; ; TI Gray Library Functions ; ; Written by Stefano Bodrato - Mar 2001 ; ; ; $Id: g_drawb.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ;Usage: g_drawb(int tlx, int tly, int width, int height, int GrayLevel); XLIB g_drawb LIB drawbox LIB plotpixel LIB respixel LIB graypage .g_drawb ld ix,0 add ix,sp ld a,(ix+2) ;GrayLevel ld b,(ix+4) ;H ld c,(ix+6) ;W ld l,(ix+8) ;y ld h,(ix+10) ;x push af xor a call graypage pop af ld ix,plotpixel rra jr nc,set1 ld ix,respixel .set1 push af push hl push bc call drawbox pop bc pop hl pop af push af ld a,1 call graypage pop af ld ix,plotpixel rra jr nc,set2 ld ix,respixel .set2 jp drawbox z88dk-1.8.ds1/libsrc/graphics/gray/g_drawr.asm0000644000175000017500000000166407267312342020670 0ustar tygrystygrys; ; TI Gray Library Functions ; ; Written by Stefano Bodrato - Mar 2001 ; ; ; $Id: g_drawr.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ;Usage: g_drawr(int px, int py, int GrayLevel) XLIB g_drawr XREF COORDS LIB line_r LIB plotpixel LIB respixel LIB graypage .g_drawr ld ix,0 add ix,sp ld a,(ix+2) ;GrayLevel ld e,(ix+4) ;py ld d,(ix+5) ld l,(ix+6) ;px ld h,(ix+7) ld bc,(COORDS) push bc push af xor a call graypage pop af ld ix,plotpixel rra jr nc,set1 ld ix,respixel .set1 push af push hl push de call line_r pop de pop hl pop af pop bc ld (COORDS),bc push af ld a,1 call graypage pop af ld ix,plotpixel rra jr nc,set2 ld ix,respixel .set2 jp line_r z88dk-1.8.ds1/libsrc/graphics/gray/g_page.asm0000644000175000017500000000050507267312342020456 0ustar tygrystygrys; ; TI Gray Library Functions ; ; Written by Stefano Bodrato - Mar 2001 ; ; $Id: g_page.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ; A trick to be used with the dafault graph functions ; ; Usage: g_page(int page) ; XLIB g_page LIB graypage .g_page ld ix,0 add ix,sp ld a,(ix+2) jp graypage z88dk-1.8.ds1/libsrc/graphics/gray/g_plot.asm0000644000175000017500000000123207267312342020516 0ustar tygrystygrys; ; TI Gray Library Functions ; ; Written by Stefano Bodrato - Mar 2001 ; ; ; $Id: g_plot.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ;Usage: g_plot(int x, int y, int GrayLevel) XLIB g_plot LIB plotpixel LIB respixel LIB graypage .g_plot ld ix,0 add ix,sp ld a,(ix+2) ;GrayLevel ld l,(ix+4) ;y ld h,(ix+6) ;x push af xor a call graypage pop af rra jr nc,set1 push af push hl call respixel pop hl pop af jr page2 .set1 push af push hl call plotpixel pop hl pop af .page2 push af ld a,1 call graypage pop af rra jp nc,plotpixel jp respixel z88dk-1.8.ds1/libsrc/graphics/gray/g_point.asm0000644000175000017500000000125007267312342020671 0ustar tygrystygrys; ; TI Gray Library Functions ; ; Written by Stefano Bodrato - Mar 2001 ; ; ; $Id: g_point.asm,v 1.2 2001/04/18 13:21:38 stefano Exp $ ; ;Usage: g_point(int px, int py) XLIB g_point LIB pointxy LIB graypage .g_point ld ix,0 add ix,sp ld l,(ix+2) ld h,(ix+4) xor a call graypage push hl call pointxy pop hl ld bc,0 jr nz,jpover1 inc c .jpover1 push bc ld a,1 call graypage call pointxy pop hl jr nz,jpover2 rl l inc l .jpover2 ret z88dk-1.8.ds1/libsrc/graphics/gray/grpage.asm0000644000175000017500000000101107267312342020472 0ustar tygrystygrys; ; TI Gray Library Functions ; ; Written by Stefano Bodrato - Mar 2001 ; ; $Id: grpage.asm,v 1.2 2001/04/18 13:21:38 stefano Exp $ ; ; ; A trick to be used with the dafault graph functions ; ; IN: A=Page Number (0/1) ; all registers are saved XLIB graypage XREF base_graphics XREF graybit1 XREF graybit2 .graypage push hl and a jr nz,flippage ld hl,(graybit1) ld (base_graphics),hl pop hl ret .flippage ld hl,(graybit2) ld (base_graphics),hl pop hl ret z88dk-1.8.ds1/libsrc/graphics/gray/ticalc/0000755000175000017500000000000010765202715017770 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/gray/ticalc/g_clg.asm0000644000175000017500000000116107457364561021560 0ustar tygrystygrys; ; TI Gray Library Functions ; ; Written by Stefano Bodrato - Mar 2001 ; ; ; $Id: g_clg.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; ;Usage: g_clg(GrayLevel) INCLUDE "graphics/grafix.inc" /* Contains fn defs */ XLIB g_clg XREF graybit1 XREF graybit2 .g_clg ld ix,0 add ix,sp ld a,(ix+2) ;GrayLevel ld hl,(graybit1) rra jr nc,lbl1 push af ld a,0 call cls pop af jr lbl2 .lbl1 push af ld a,255 call cls pop af .lbl2 ld hl,(graybit2) rra ld a,0 jr c,lbl3 ld a,255 .lbl3 .cls ld (hl),a ld d,h ld e,l inc de ld bc,row_bytes*64-1 ldir ret z88dk-1.8.ds1/libsrc/graphics/gray/zx81/0000755000175000017500000000000010765202715017343 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/gray/zx81/g_clg.asm0000644000175000017500000000122410710126720021106 0ustar tygrystygrys; ; ZX 81 pseudo-Gray Library Functions ; ; Written by Stefano Bodrato - Oct 2007 ; ; $Id: g_clg.asm,v 1.1 2007/10/25 14:53:04 stefano Exp $ ; ; ;Usage: g_clg(GrayLevel) XLIB g_clg XREF base_graphics XREF graybit1 XREF graybit2 .g_clg pop hl pop bc ld a,c ;GrayLevel push bc push hl ld hl,(graybit1) rra jr nc,lbl1 push af ld a,0 call cls pop af jr lbl2 .lbl1 push af ld a,255 call cls pop af .lbl2 ld hl,(graybit2) rra ld a,0 jr c,lbl3 ld a,255 .lbl3 .cls ld (hl),a ld d,h ld e,l inc de ld bc,2047 ldir ret z88dk-1.8.ds1/libsrc/graphics/jupiter/0000755000175000017500000000000010765202715017251 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/lbitmask.asm0000644000175000017500000000132407267312341020077 0ustar tygrystygrys xlib leftbitmask ; ; $Id: lbitmask.asm,v 1.2 2001/04/18 13:21:37 stefano Exp $ ; ; ************************************************************************ ; ; Get left bitmask for left side of byte ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; IN: A = bitposition ; ; OUT: A = bitmask at left side of bit position of byte ; ; Example: ; IN: A = 3 ; OUT: A = @11110000 (bit 7 - 4 as mask) ; ; registers chnaged after return: ; ..bcdehl/ixiy same ; af....../.... different ; .leftbitmask xor 7 ; 7-bitpos ret z ; no bitmask to preserve... push bc ld b,a xor a .left_bitmask_loop scf rra ; create left bitmask djnz left_bitmask_loop pop bc ret z88dk-1.8.ds1/libsrc/graphics/lftscrol.asm0000644000175000017500000001255707267312341020133 0ustar tygrystygrys xlib scroll_left lib pixeladdress lib leftbitmask, rightbitmask ; ; $Id: lftscrol.asm,v 1.2 2001/04/18 13:21:37 stefano Exp $ ; ; *********************************************************************** ; ; Scroll specified graphics area leftward horisontally ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; IN: HL = (x,y) ; BC = (width,heigth) ; A = scroll distance, 1 to 8 pixels. ; ; Variables on stack; ix pointer to base of variables: ; (ix+0) scroll distance ; (ix+1) y ; (ix+2) height ; (ix+3,4) adr0 ; (ix+5,6) adr1 ; (ix+7) bitmask0 bitmask for leftmost byte of pixel row ; (ix+8) bitmask1 bitmask for rightmost byte of pixel row ; (ix+9) rowbytes number of bytes in pixel row to scroll ; (ix+10) lastbyte ; ; OUT: None. (graphics area is scrolled) ; ; Registers changed after return: ; ......../IXIY same ; AFBCDEHL/.... different ; .scroll_left push ix push iy ld de,0 ex de,hl add hl,sp ex de,hl ld ix,-11 add ix,sp ; ix points at base of variables ld sp,ix ; local variable area created push de ; remember pointer to original ix, iy ld (ix+0),a ; remember scroll distance ld (ix+1),l ; remember y ld (ix+2),c ; remember height push bc call PixelAddress ; adr0, bitpos0 = PixelAddress(x,y) ld (ix+3),e ld (ix+4),d call leftbitmask ld (ix+7),a ; bitmask0 = LeftBitMask(bitpos0) pop bc ld a,h add a,b dec a ld h,a push de call PixelAddress ; adr1, bitpos1 = PixelAddress(x+width-1,y) ld (ix+5),e ld (ix+6),d call rightbitmask ld (ix+8),a ; bitmask1 = LeftBitMask(bitpos0) pop hl ex de,hl cp a sbc hl,de ; (adr1-adr0) srl l srl l srl l ld (ix+9),l ; rowbytes = (adr1-adr0) div 8, no. of bytes in row ; 0 means that scroll area is within same address ; FOR h = 1 TO height .scroll_l_height ld iy,0 ; offset=0 ld e,(ix+3) ld d,(ix+4) ; DE = adr0 ld a,(de) ; byte = (adr0) ld h,a ld l,0 xor a cp (ix+9) ; if rowbytes = 0 jr nz, scrollrow_left ; scroll area is within one byte... ld b,(ix+0) call scrollleft ; byte = Scrollleft(byte,0,scrolldist) ld b,h ld l,(ix+7) ld a,l cpl ; NOT bitmask0 and b ld b,a ; byte = byte AND (NOT bitmask0) ld h,(ix+8) ld a,h cpl ; NOT bitmask1 and b ; byte = byte AND (NOT bitmask1) ld b,a ld a,(de) and l ld l,a ; byte0 = (adr0) AND bitmask0 ld a,(de) and h ; byte1 = (adr0) AND bitmask1 or b ; byte = byte OR byte1 or l ; byte = byte OR byte0 ld (de),a ; (adr0) = byte jr leftscroll_nextrow .scrollrow_left ; else push de ; scroll area is defined as row of bytes ld e,(ix+5) ld d,(ix+6) ld a,(de) ld (ix+10),a ; lastbyte = (adr1) ld b,a ld a,(ix+8) ; bitmask1 cpl and b ; (adr1) = (adr1) AND (NOT bitmask1) ld (de),a ; - preserve only bits within scroll area pop de ; - the other bits are restored after scroll push iy add iy,de ld l,(iy+8) ; (adr0+8) pop iy ld b,(ix+0) call scrollleft ; byte = Scrollleft(byte,(adr0+8),scrolldist) ld b,h ld a,(ix+7) cpl ; NOT bitmask0 and b ld b,a ; byte = byte AND (NOT bitmask0) ld c,(ix+7) ; bitmask0 ld a,(de) ; byte0 = (adr0) and c ; byte0 = byte0 AND bitmask0 or b ld (de),a ; (adr0) = byte0 OR byte ld bc,8 add iy,bc ; offset += 8 ld b,(ix+9) ; r = rowbytes .scroll_row_left_loop dec b ; while ( --r != 0 ) jr z, endrow_left push bc push iy ; DE = adr0 add iy,de ; adr0+offset ld b,(ix+0) ; scrolldist ld h,(iy+0) ; (adr0+offset) ld l,(iy+8) ; (adr0+offset+8) call scrollleft ; byte = Scrollleft( (adr0+offset),(adr0+offset+8),scrolldist) ld (iy+0),h ; (adr0+offset) = byte pop iy ld bc,8 add iy,bc ; offset += 8 pop bc jr scroll_row_left_loop .endrow_left ld e,(ix+5) ld d,(ix+6) ; adr1, addr of last byte in row to scroll ld a,(de) ; byte = (adr1) ld h,a ld l,0 ld b,(ix+0) call scrollleft ; byte = Scrollleft( (adr1),0,scrolldist) ld a,(ix+8) and (ix+10) ; lastbyte = lastbyte AND bitmask1 : clear scroll area or h ; mask in what has been scrolled, the rest is outside scroll area. ld (de),a ; (adr1) = byte OR lastbyte, last byte of row completed. ; endif .leftscroll_nextrow inc (ix+1) ; inc y ld a,(ix+1) and @00000111 ; if y MOD 8 <> 0 jr z, leftscroll_newline .inc_l_row inc (ix+3) ; inc adr0 inc (ix+5) ; inc adr1 jr leftscroll_next_h ; else .leftscroll_newline ld a,(ix+3) add a,256-7 ld (ix+3),a inc (ix+4) ; adr0 += 256 ld a,(ix+5) add a,256-7 ld (ix+5),a inc (ix+6) ; adr1 += 256 .leftscroll_next_h dec (ix+2) ; END FOR h jp nz, scroll_l_height .end_scroll_left pop hl ld sp,hl ; pointer to original ix, iy pop iy pop ix ret ; ************************************************************************ ; ; Scroll bytes left, b1 into b0, total of B pixels ; ; IN: H = b0 ; L = b1 ; B = scroll distance, 1 to 8 pixels. ; ; OUT: H = scrolled byte ; .ScrollLeft add hl,hl djnz scrollleft ret z88dk-1.8.ds1/libsrc/graphics/line.asm0000644000175000017500000000453007267312341017222 0ustar tygrystygrys INCLUDE "graphics/grafix.inc" XLIB Line LIB Line_r XREF COORDS ; ; $Id: line.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ; ****************************************************************************** ; ; Draw a pixel line from (x0,y0) defined (H,L) - the starting point coordinate, ; to the end point (x1,y1). ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; The routine checks the range of specified coordinates which is the boundaries ; of the graphics area (256x64 pixels). ; If a boundary error occurs the routine exits automatically. This may be ; useful if you are trying to draw a line longer than allowed or outside the ; graphics borders. Only the visible part will be drawn. ; ; Ths standard origin (0,0) is at the top left corner. ; ; The plot routine is defined by an address pointer in IX. ; This routine converts the absolute coordinates to a relative distance as (dx,dy) ; defining (COORDS) with (x0,y0) and a distance in (dx,dy). The drawing is then ; executed by Line_r ; ; IN: HL = (x0,y0) - x0 range is 0 to 255, y0 range is 0 to 63. ; DE = (x1,y1) - x1 range is 0 to 255, y1 range is 0 to 63. ; IX = pointer to plot routine that uses HL = (x,y) of plot coordinate. ; ; OUT: None. ; ; Registers changed after return: ; ..BCDEHL/IXIY/af...... same ; AF....../..../..bcdehl different ; .Line push de push hl IF maxx <> 256 ld a,h cp maxx jr nc, exit_line ; x0 coordinate out of range ld a,d cp maxx jr nc, exit_line ; x1 coordinate out of range ENDIF ld a,l cp maxy jr nc, exit_line ; y0 coordinate out of range ld a,e cp maxy jr nc, exit_line ; y1 coordinate out of range ld (COORDS),hl ; the starting point is now default push hl push de ld l,h ; L = x0 ld h,d ; H = x1 call distance ; x1 - x0 horisontal distance in HL pop de ex (sp),hl ; L = y0 ld h,e ; H = y1 call distance ; y1 - y0 vertical distance in HL pop de ex de,hl ; h.dist. = HL, v.dist. = DE call Line_r ; draw line... .exit_line pop hl pop de ret ; *************************************************************************** ; ; calculate distance ; IN: H = destination point ; L = source point ; ; OUT: h - l distance in HL ; .distance ld a,h sub l ld l,a ld h,0 ret nc ld h,-1 ret z88dk-1.8.ds1/libsrc/graphics/liner.asm0000644000175000017500000001226607267312341017411 0ustar tygrystygrys INCLUDE "graphics/grafix.inc" XLIB Line_r XREF COORDS ; ; $Id: liner.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ; ****************************************************************************** ; ; Draw a pixel line from (x0,y0) defined in (COORDS) - the current plot ; coordinate, to the relative distance points (x0+x,y0+y). ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; The (COORDS+0) pointer contains the current y coordinate, (COORDS+1) the ; current x coordinate. The main program should reset the (COORDS) variables ; before using line drawing. ; ; The routine checks the range of specified coordinates which is the ; boundaries of the graphics area (256x64 pixels). ; If a boundary error occurs the routine exits automatically. This may be ; useful if you are trying to draw a line longer than allowed. Only the ; visible part will be drawn. ; ; The hardware graphics memory is organized as (0,0) in the top left corner. ; ; The plot routine is defined by an address pointer in IX. ; ; IN: HL = move relative x horisontal points (maximum +/- 255). ; DE = move relative y vertical points (maximum +/- 255). ; IX = pointer to plot routine that uses HL = (x,y) of plot coordinate. ; ; OUT: None. ; ; Registers used by routine: ; N : B, loop counter ; i : line balance variable ; x : H/L, horisontal, vertical distance variables ; y : H/L, horisontal, vertical distance variables ; (x0,y0) : (h,l) ; direc_x : d, horisontal step increment ; direc_y : e, vertical step increment ; ddx : b, horisontal step increment ; ddy : c, vertical step increment ; ; DE, A work registers. ; ; The algorithm in pseudo-code: ; ; direc_x = SGN x: direc_y = SGN y ; x = ABS x: y = ABS y ; ; if x >= y ; if x+y=0 then return ; H = x ; L = y ; ddx = direc_x ; ddy = 0 ; else ; H = y ; L = x ; ddx = 0 ; ddy = direc_y ; endif ; ; B = H ; i = INT(B/2) ; FOR N=B TO 1 STEP -1 ; i = i + L ; if i < H ; ix = ddx ; iy = ddy ; else ; i = i - H ; ix = direc_x ; iy = direc_y ; endif ; x0 = x0 + ix ; y0 = y0 + iy ; plot (x0,y0) ; NEXT N ; ; ; Registers changed after return: ; ..BCDEHL/IXIY/af...... same ; AF....../..../..bcdehl different ; .Line_r push bc push de ; preserve relative vertical distance push hl ; preserve relative horisontal distance push de push hl exx pop hl ; get relative horisontal movement call sgn ld d,a ; direc_x = SGN(x) installed call abs ld b,l ; x = ABS(x) pop hl ; get relative vertical movement call sgn ld e,a ; direc_y = SGN(y) installed call abs ld c,l ; y = ABS(y) push bc exx pop hl ; H = absolute x dist., L = absolute y distance ld a,h cp l jr c, x_smaller_y ; if x >= y or h ; if x+y = 0 jr z, exit_draw ; return exx ; else ld b,d ; ddx = direc_x ld c,0 ; ddy = 0 exx jr init_drawloop ; else .x_smaller_y ld a,h ld h,l ; H = y ld l,a L = x exx ld b,0 ; ddx = 0 ld c,e ; ddy = direc_y exx .init_drawloop ld b,h ld c,h ; B = H srl c ; i = INT(B/2) ; FOR N=B TO 1 STEP -1 .drawloop ld a,c add a,l jr c, i_greater ; i + L > 255 (i > H) cp h jr nc, i_greater ; if i < H ld c,a ; i = i + L exx push bc ; ix = ddx: iy = ddy exx jr check_plot ; else .i_greater sub h ; i = i - H ld c,a exx push de ; ix = direc_x: iy = direc_y exx ; endif .check_plot ex (sp),hl ; preserve H,L distances on stack ex de,hl ; D,E = ix, iy ld hl,(COORDS) ld a,l add a,e ; ld l,a ; y0 = y0 + iy (y0 is checked by plot) ld a,d inc a add a,h jr c, check_range ; check out of range jr z, range_error ; Fz=1 & Fc=0 denotes x0 < 0 jr plot_point .check_range jr nz, range_error ; Fz=0 & Fc=1 denotes x0 > 255 .plot_point dec a ld h,a ; x0 = x0 + ix ld de, plot_RET push de ; hl = (x0,y0)... jp (ix) ; execute PLOT at (x0,y0) .plot_RET pop hl ; restore H,L distances... djnz drawloop ; NEXT N jr exit_draw .range_error pop hl ; remove H,L distances... .exit_draw pop hl ; restore relative horisontal distance pop de ; restore relative vertical distance pop bc ret ; ****************************************************************************** ; ; SGN (Signum value) of 16 bit signed integer. ; ; IN: HL = integer ; OUT: A = result: 0,1,-1 (if zero, positive, negative) ; ; Registers changed after return: ; ..BCDEHL/IXIY same ; AF....../.... different ; .SGN ld a,h or l ret z ; integer is zero, return 0... bit 7,h jr nz, negative_int ld a,1 ret .negative_int ld a,-1 ret ; ****************************************************************************** ; ; ABS (Absolute value) of 16 bit signed integer. ; ; IN: HL = integer ; OUT: HL = converted integer ; ; Registers changed after return: ; A.BCDE../IXIY same ; .F....HL/.... different ; .ABS bit 7,h ret z ; integer is positive... push de ex de,hl ld hl,0 cp a ; Fc = 0, may not be used... sbc hl,de ; convert negative integer pop de ret z88dk-1.8.ds1/libsrc/graphics/liner2.asm0000755000175000017500000001560310073456745017502 0ustar tygrystygrys INCLUDE "graphics/grafix.inc" XLIB Line_r XREF COORDS ; ; $Id: liner2.asm,v 1.1 2004/07/09 08:57:09 stefano Exp $ ; ; ...SLLLOOOW Variant by Stefano Bodrato ; with the alternate registers left untouched ; ****************************************************************************** ; ; Draw a pixel line from (x0,y0) defined in (COORDS) - the current plot ; coordinate, to the relative distance points (x0+x,y0+y). ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; The (COORDS+0) pointer contains the current y coordinate, (COORDS+1) the ; current x coordinate. The main program should reset the (COORDS) variables ; before using line drawing. ; ; The routine checks the range of specified coordinates which is the ; boundaries of the graphics area (256x64 pixels). ; If a boundary error occurs the routine exits automatically. This may be ; useful if you are trying to draw a line longer than allowed. Only the ; visible part will be drawn. ; ; The hardware graphics memory is organized as (0,0) in the top left corner. ; ; The plot routine is defined by an address pointer in IX. ; ; IN: HL = move relative x horisontal points (maximum +/- 255). ; DE = move relative y vertical points (maximum +/- 255). ; IX = pointer to plot routine that uses HL = (x,y) of plot coordinate. ; ; OUT: None. ; ; Registers used by routine: ; N : B, loop counter ; i : line balance variable ; x : H/L, horisontal, vertical distance variables ; y : H/L, horisontal, vertical distance variables ; (x0,y0) : (h,l) ; direc_x : d, horisontal step increment ; direc_y : e, vertical step increment ; ddx : b, horisontal step increment ; ddy : c, vertical step increment ; ; DE, A work registers. ; ; The algorithm in pseudo-code: ; ; direc_x = SGN x: direc_y = SGN y ; x = ABS x: y = ABS y ; ; if x >= y ; if x+y=0 then return ; H = x ; L = y ; ddx = direc_x ; ddy = 0 ; else ; H = y ; L = x ; ddx = 0 ; ddy = direc_y ; endif ; ; B = H ; i = INT(B/2) ; FOR N=B TO 1 STEP -1 ; i = i + L ; if i < H ; ix = ddx ; iy = ddy ; else ; i = i - H ; ix = direc_x ; iy = direc_y ; endif ; x0 = x0 + ix ; y0 = y0 + iy ; plot (x0,y0) ; NEXT N ; ; ; Registers changed after return: ; ..BCDEHL/IXIY/af...... same ; AF....../..../..bcdehl different ; .Line_r push bc push de ; preserve relative vertical distance push hl ; preserve relative horisontal distance push de push hl ;exx push bc push de ld bc,(bc1save) ld de,(de1save) pop hl ld (de1save),hl pop hl ld (bc1save),hl pop hl ; get relative horisontal movement call sgn ld d,a ; direc_x = SGN(x) installed call abs ld b,l ; x = ABS(x) pop hl ; get relative vertical movement call sgn ld e,a ; direc_y = SGN(y) installed call abs ld c,l ; y = ABS(y) push bc ;exx push bc push de ld bc,(bc1save) ld de,(de1save) pop hl ld (de1save),hl pop hl ld (bc1save),hl pop hl ; H = absolute x dist., L = absolute y distance ld a,h cp l jr c, x_smaller_y ; if x >= y or h ; if x+y = 0 jp z, exit_draw ; return ;exx ; else push hl push bc push de ld bc,(bc1save) ld de,(de1save) pop hl ld (de1save),hl pop hl ld (bc1save),hl pop hl ld b,d ; ddx = direc_x ld c,0 ; ddy = 0 ;exx push hl push bc push de ld bc,(bc1save) ld de,(de1save) pop hl ld (de1save),hl pop hl ld (bc1save),hl pop hl jr init_drawloop ; else .x_smaller_y ld a,h ld h,l ; H = y ld l,a L = x ;exx push hl push bc push de ld bc,(bc1save) ld de,(de1save) pop hl ld (de1save),hl pop hl ld (bc1save),hl pop hl ld b,0 ; ddx = 0 ld c,e ; ddy = direc_y ;exx push hl push bc push de ld bc,(bc1save) ld de,(de1save) pop hl ld (de1save),hl pop hl ld (bc1save),hl pop hl .init_drawloop ld b,h ld c,h ; B = H srl c ; i = INT(B/2) ; FOR N=B TO 1 STEP -1 .drawloop ld a,c add a,l jr c, i_greater ; i + L > 255 (i > H) cp h jr nc, i_greater ; if i < H ld c,a ; i = i + L ;exx push hl push bc push de ld bc,(bc1save) ld de,(de1save) pop hl ld (de1save),hl pop hl ld (bc1save),hl pop hl push bc ; ix = ddx: iy = ddy ;exx push hl push bc push de ld bc,(bc1save) ld de,(de1save) pop hl ld (de1save),hl pop hl ld (bc1save),hl pop hl jr check_plot ; else .i_greater sub h ; i = i - H ld c,a ;exx push hl push bc push de ld bc,(bc1save) ld de,(de1save) pop hl ld (de1save),hl pop hl ld (bc1save),hl pop hl push de ; ix = direc_x: iy = direc_y ;exx ; endif push hl push bc push de ld bc,(bc1save) ld de,(de1save) pop hl ld (de1save),hl pop hl ld (bc1save),hl pop hl .check_plot ex (sp),hl ; preserve H,L distances on stack ex de,hl ; D,E = ix, iy ld hl,(COORDS) ld a,l add a,e ; ld l,a ; y0 = y0 + iy (y0 is checked by plot) ld a,d inc a add a,h jr c, check_range ; check out of range jr z, range_error ; Fz=1 & Fc=0 denotes x0 < 0 jr plot_point .check_range jr nz, range_error ; Fz=0 & Fc=1 denotes x0 > 255 .plot_point dec a ld h,a ; x0 = x0 + ix ld de, plot_RET push de ; hl = (x0,y0)... jp (ix) ; execute PLOT at (x0,y0) .plot_RET pop hl ; restore H,L distances... djnz drawloop ; NEXT N jr exit_draw .range_error pop hl ; remove H,L distances... .exit_draw pop hl ; restore relative horisontal distance pop de ; restore relative vertical distance pop bc ret ; ****************************************************************************** ; ; SGN (Signum value) of 16 bit signed integer. ; ; IN: HL = integer ; OUT: A = result: 0,1,-1 (if zero, positive, negative) ; ; Registers changed after return: ; ..BCDEHL/IXIY same ; AF....../.... different ; .SGN ld a,h or l ret z ; integer is zero, return 0... bit 7,h jr nz, negative_int ld a,1 ret .negative_int ld a,-1 ret ; ****************************************************************************** ; ; ABS (Absolute value) of 16 bit signed integer. ; ; IN: HL = integer ; OUT: HL = converted integer ; ; Registers changed after return: ; A.BCDE../IXIY same ; .F....HL/.... different ; .ABS bit 7,h ret z ; integer is positive... push de ex de,hl ld hl,0 cp a ; Fc = 0, may not be used... sbc hl,de ; convert negative integer pop de ret .bc1save defw 0 .de1save defw 0z88dk-1.8.ds1/libsrc/graphics/lscroll.asm0000644000175000017500000000072107267312341017743 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: lscroll.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ;Usage: lscroll(struct *pixels) XLIB lscroll LIB scroll_left .lscroll ld ix,0 add ix,sp ld a,(ix+2) ld c,(ix+4) ld b,(ix+6) ld l,(ix+8) ld h,(ix+10) jp scroll_left z88dk-1.8.ds1/libsrc/graphics/Makefile0000644000175000017500000000103410732671607017231 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.12 2007/12/21 08:04:23 stefano Exp $ all: cd x11 ; $(MAKE) ; cd .. clean: $(RM) *.o $(RM) 8080/*.o $(RM) abc80/*.o $(RM) ace/*.o $(RM) aquarius/*.o $(RM) c128/*.o $(RM) cpc/*.o $(RM) gray/*.o $(RM) gray/ticalc/*.o $(RM) gray/cpc/*.o $(RM) msx/*.o $(RM) mz/*.o $(RM) nascom/*.o $(RM) oz/*.o $(RM) sam/*.o $(RM) spectrum/*.o $(RM) text/*.o $(RM) text6/*.o $(RM) ticalc/*.o $(RM) vz200/*.o $(RM) z88/*.o $(RM) zx81/*.o $(RM) zx81/hr/*.o z88dk-1.8.ds1/libsrc/graphics/msx/0000755000175000017500000000000010765202715016376 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/msx/clg.asm0000755000175000017500000000054010731706063017645 0ustar tygrystygrys; ; Clear Graphics Screen ; ; MSX version by Stefano Bodrato, December 2007 ; ; $Id: clg.asm,v 1.1 2007/12/18 09:00:35 stefano Exp $ ; XLIB clg LIB msxbios INCLUDE "#msxbios.def" INCLUDE "graphics/grafix.inc" .clg ld ix,CHGMOD ld a,2 ; set graphics mode call msxbios ld ix,CLS jp msxbios z88dk-1.8.ds1/libsrc/graphics/msx/fill.asm0000755000175000017500000000150210731706073020026 0ustar tygrystygrys; ; MSX basic graphics routines ; by Stefano Bodrato, December 2007 ; ; ; $Id: fill.asm,v 1.1 2007/12/18 09:00:43 stefano Exp $ ; ;Usage: fill(struct *pixel) XLIB fill INCLUDE "graphics/grafix.inc" LIB msxextrom LIB msxbasic INCLUDE "#msxbasic.def" LIB msx_breakoff LIB msx_breakon .fill ld ix,0 add ix,sp ld a,(ix+2) cp maxy ;check range for y ret nc ld l,(ix+4) ;x ld h,0 ld d,h ld e,a ;y ld (GRPACX),hl ld (GRPACY),de push hl push de ld a,fcolor ld (ATRBYT),a ; set fill color ld (BRDATR),a ; set border color ;ld hl,-2048 ;add hl,sp ;ld (STREND),hl pop de ; set y pop bc ; set x call msx_breakoff ld a,(SCRMOD) cp 4+1 jr c,pnt_old ld ix,N_PAINT call msxextrom jr pnt_done pnt_old: ld ix,O_PAINT call msxbasic pnt_done: jp msx_breakon z88dk-1.8.ds1/libsrc/graphics/msx/plotpixl.asm0000755000175000017500000000120310731706074020752 0ustar tygrystygrys; ; MSX basic graphics routines ; by Stefano Bodrato, December 2007 ; XLIB plotpixel XREF COORDS INCLUDE "graphics/grafix.inc" LIB msxbasic INCLUDE "#msxbasic.def" ; ; $Id: plotpixl.asm,v 1.1 2007/12/18 09:00:44 stefano Exp $ ; ; ****************************************************************** ; ; Plot pixel at (x,y) coordinate. ; ; ; registers changed after return: ; ..bc..../ixiy same ; af..dehl/.... different ; .plotpixel ld a,l cp maxy ret nc ; y0 out of range push bc push ix ld (COORDS),hl ld b,0 ld c,h ld (GRPACX),bc ld d,b ld e,l ld (GRPACY),de ld ix,DOPSET call msxbasic pop ix pop bc ret z88dk-1.8.ds1/libsrc/graphics/msx/pointxy.asm0000755000175000017500000000165310731706074020622 0ustar tygrystygrys; ; MSX basic graphics routines ; by Stefano Bodrato, December 2007 ; XLIB pointxy INCLUDE "graphics/grafix.inc" LIB msxbios INCLUDE "#msxbios.def" ; ; $Id: pointxy.asm,v 1.1 2007/12/18 09:00:44 stefano Exp $ ; ; ****************************************************************** ; ; Check if pixel at (x,y) coordinate is set or not. ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; (0,0) origin is defined as the top left corner. ; ; in: hl = (x,y) coordinate of pixel to test ; out: Fz = 0, if pixel is set, otherwise Fz = 1. ; ; registers changed after return: ; ..bcdehl/ixiy same ; af....../.... different ; .pointxy ld a,l cp maxy ret nc ; y out of range push bc push de push hl push ix ld b,0 ld c,h ; BC = x ld d,b ld e,l ; DE = y ld ix,SCALXY call msxbios ld ix,MAPXY call msxbios ld ix,READC call msxbios cp fcolor pop ix pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/graphics/msx/respixl.asm0000755000175000017500000000134710731706074020576 0ustar tygrystygrys; ; MSX basic graphics routines ; by Stefano Bodrato, December 2007 ; XLIB respixel XREF COORDS INCLUDE "graphics/grafix.inc" LIB msxbasic INCLUDE "#msxbasic.def" ; ; $Id: respixl.asm,v 1.1 2007/12/18 09:00:44 stefano Exp $ ; ; ****************************************************************** ; ; Clear pixel at (x,y) coordinate. ; ; ; .respixel ld a,l cp maxy ret nc ; y0 out of range push bc push ix ld (COORDS),hl ld b,0 ld c,h ld (GRPACX),bc ld d,b ld e,l ld (GRPACY),de ld hl,0F3E9h ; fore color ld a,(hl) push af ld a,(0F3EBh) ; border (for bck color) ;;ld a,bcolor ld (hl),a ld (ATRBYT),a push hl ld ix,DOPSET call msxbasic pop hl pop af ld (hl),a ld (ATRBYT),a pop ix pop bc ret z88dk-1.8.ds1/libsrc/graphics/msx/swapgfxbk.asm0000755000175000017500000000044510731706074021102 0ustar tygrystygrys; ; Page the graphics bank in/out - used by all gfx functions ; Doesn't really page on the MSX. ; ; ; $Id: swapgfxbk.asm,v 1.1 2007/12/18 09:00:44 stefano Exp $ ; XLIB swapgfxbk XDEF swapgfxbk1 .swapgfxbk ;di ;ret .swapgfxbk1 ;ei ret z88dk-1.8.ds1/libsrc/graphics/msx/xorpixl.asm0000755000175000017500000000050310731706075020607 0ustar tygrystygrys XLIB xorpixel XREF COORDS ; ; $Id: xorpixl.asm,v 1.1 2007/12/18 09:00:45 stefano Exp $ ; ; ****************************************************************** ; ; XORs pixel at (x,y) coordinate. ; ; LIB pointxy LIB plotpixel LIB respixel .xorpixel push hl call pointxy pop hl jp nz,plotpixel jp respixel z88dk-1.8.ds1/libsrc/graphics/multipoint.asm0000644000175000017500000000244210661324041020467 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Stefano Bodrato 19/7/2007 ; ; ; $Id: multipoint.asm,v 1.1 2007/08/17 13:52:33 stefano Exp $ ; ;Usage: multipoint(int vh, int length, struct *pixel) ;pick a vertical or horizontal bit bar, up to 16 bits long XLIB multipoint LIB pointxy LIB swapgfxbk LIB swapgfxbk1 .multipoint ld ix,0 add ix,sp ld l,(ix+2) ld h,(ix+4) ld b,(ix+6) call swapgfxbk ld de,0 bit 0,(ix+8) jr z,horizontal .vertical sla e rl d call pointxy jr z,jv inc de .jv inc l djnz vertical jr exit .horizontal sla e rl d call pointxy jr z,jh inc de .jh inc h djnz horizontal .exit call swapgfxbk1 ld h,d ld l,e ret z88dk-1.8.ds1/libsrc/graphics/mz/0000755000175000017500000000000010765202715016215 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/mz/clsgraph.asm0000644000175000017500000000062407421602501020514 0ustar tygrystygrys XLIB cleargraphics XREF base_graphics ; ; $Id: clsgraph.asm,v 1.1 2002/01/17 17:09:21 stefano Exp $ ; ; ****************************************************************** ; ; Clear graphics area ; ; Sharp MZ version. ; 80x50 rez. ; .cleargraphics ld hl,$D000 ld (hl),0 ;' ' ld d,h ld e,l inc de ld bc,40*25 ldir ld hl,$D800 ld (hl),$70 ld d,h ld e,l inc de ld bc,40*25 ldir ret z88dk-1.8.ds1/libsrc/graphics/mz/plotpixl.asm0000644000175000017500000000203607425743301020573 0ustar tygrystygrys XLIB plotpixel XREF COORDS ; ; $Id: plotpixl.asm,v 1.2 2002/01/30 10:11:13 stefano Exp $ ; ; ****************************************************************** ; ; Plot pixel at (x,y) coordinate. ; ; Sharp MZ version. ; ; 80x50 rez. ; ; .plotpixel ld a,h cp 80 ret nc ld a,l ;cp maxy cp 50 ret nc ; y0 out of range ld (COORDS),hl push bc ld c,a ld b,h push bc srl b srl c ld hl,$D000 ; inc hl ld a,c ld c,b ; !! and a jr z,r_zero ld b,a ld de,40 .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol ;sub $f0 and $f ex (sp),hl ; save char address <=> restore x,y ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow or b or $f0 pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/mz/pointxy.asm0000644000175000017500000000205510670242110020417 0ustar tygrystygrys XLIB pointxy XREF COORDS ; ; $Id: pointxy.asm,v 1.1 2007/09/07 12:30:00 stefano Exp $ ; ; ****************************************************************** ; ; Get pixel at (x,y) coordinate. ; ; Sharp MZ version. ; ; 80x50 rez. ; ; .pointxy ld a,h cp 80 ret nc ld a,l ;cp maxy cp 50 ret nc ; y0 out of range push bc push de push hl ld (COORDS),hl ;push bc ld c,a ld b,h push bc srl b srl c ld hl,$D000 ; inc hl ld a,c ld c,b ; !! and a jr z,r_zero ld b,a ld de,40 .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol ;sub $f0 and $f ex (sp),hl ; save char address <=> restore x,y ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow and b pop bc pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/graphics/mz/respixl.asm0000644000175000017500000000204207457364561020417 0ustar tygrystygrys XLIB respixel XREF COORDS ; ; $Id: respixl.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ ; ; ****************************************************************** ; ; Erases pixel at (x,y) coordinate. ; ; Sharp MZ version. ; ; 80x50 rez. ; ; .respixel ld a,h cp 80 ret nc ld a,l ;cp maxy cp 50 ret nc ; y0 out of range ld (COORDS),hl push bc ld c,a ld b,h push bc srl b srl c ld hl,$D000 ; inc hl ld a,c ld c,b ; !! and a jr z,r_zero ld b,a ld de,40 .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol ;sub $f0 and $f ex (sp),hl ; save char address <=> restore x,y ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow cpl and b or $f0 pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/mz/xorpixl.asm0000644000175000017500000000203507457364561020440 0ustar tygrystygrys XLIB xorpixel XREF COORDS ; ; $Id: xorpixl.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ ; ; ****************************************************************** ; ; Inverts pixel at (x,y) coordinate. ; ; Sharp MZ version. ; ; 80x50 rez. ; ; .xorpixel ld a,h cp 80 ret nc ld a,l ;cp maxy cp 50 ret nc ; y0 out of range ld (COORDS),hl push bc ld c,a ld b,h push bc srl b srl c ld hl,$D000 ; inc hl ld a,c ld c,b ; !! and a jr z,r_zero ld b,a ld de,40 .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol ;sub $f0 and $f ex (sp),hl ; save char address <=> restore x,y ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow xor b or $f0 pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/nascom/0000755000175000017500000000000010765202715017047 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/nascom/clsgraph.asm0000755000175000017500000000042710545004044021351 0ustar tygrystygrys; ; NASCOM Graphics Functions ; ; cls () -- clear screen ; ; Stefano Bodrato - June 2003 ; ; ; $Id: clsgraph.asm,v 1.1 2006/12/28 18:08:36 stefano Exp $ ; XLIB cleargraphics LIB ansi_cls .cleargraphics jp ansi_cls z88dk-1.8.ds1/libsrc/graphics/nascom/plotpixl.asm0000755000175000017500000000370210550503414021421 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 19/12/2006 ; ; ; Plot pixel at (x,y) coordinate. ; ; ; $Id: plotpixl.asm,v 1.2 2007/01/08 18:01:48 stefano Exp $ ; INCLUDE "graphics/text6/textgfx.inc" XLIB plotpixel LIB textpixl LIB div3 XREF COORDS XREF base_graphics .plotpixel ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range dec a dec a ld (COORDS),hl push bc ld c,a ; y ld b,h ; x push bc ld hl,div3 ld d,0 ld e,c inc e add hl,de ld a,(hl) ld c,a ; y/3 srl b ; x/2 ld a,c ld c,b ; !! ;--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ld hl,0BCAh ld b,a ; keep y/3 and a jr z,r_zero ld hl,$80a dec a jr z,r_zero ld de,64 .r_loop add hl,de dec a jr nz,r_loop .r_zero ld d,0 ld e,c add hl,de ;--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ld a,(hl) ; get current symbol from screen ld e,a ; ..and its copy push hl ; char address push bc ; keep y/3 ld hl,textpixl ld e,0 ld b,64 ; whole symbol table size .ckmap cp (hl) ; compare symbol with the one in map jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop bc ; restore y/3 in b pop hl ; char address ex (sp),hl ; save char address <=> restore x,y (y=h, x=l) ld c,a ; keep the symbol ld a,l inc a inc a sub b sub b sub b ; we get the remainder of y/3 ld l,a ld a,1 ; the pixel we want to draw jr z,iszero bit 0,l jr nz,is1 add a,a add a,a .is1 add a,a add a,a .iszero bit 0,h jr z,evenrow add a,a ; move down the bit .evenrow or c ld hl,textpixl ld d,0 ld e,a add hl,de ld a,(hl) pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/nascom/pointxy.asm0000644000175000017500000000366310670242110021257 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 05/09/2007 ; ; ; Get pixel at (x,y) coordinate. ; ; ; $Id: pointxy.asm,v 1.1 2007/09/07 12:30:00 stefano Exp $ ; INCLUDE "graphics/text6/textgfx.inc" XLIB pointxy LIB textpixl LIB div3 XREF COORDS XREF base_graphics .pointxy ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range dec a dec a push bc push de push hl ld (COORDS),hl ;push bc ld c,a ; y ld b,h ; x push bc ld hl,div3 ld d,0 ld e,c inc e add hl,de ld a,(hl) ld c,a ; y/3 srl b ; x/2 ld a,c ld c,b ; !! ;--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ld hl,0BCAh ld b,a ; keep y/3 and a jr z,r_zero ld hl,$80a dec a jr z,r_zero ld de,64 .r_loop add hl,de dec a jr nz,r_loop .r_zero ld d,0 ld e,c add hl,de ;--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ld a,(hl) ; get current symbol from screen ld e,a ; ..and its copy push hl ; char address push bc ; keep y/3 ld hl,textpixl ld e,0 ld b,64 ; whole symbol table size .ckmap cp (hl) ; compare symbol with the one in map jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop bc ; restore y/3 in b pop hl ; char address ex (sp),hl ; save char address <=> restore x,y (y=h, x=l) ld c,a ; keep the symbol ld a,l inc a inc a sub b sub b sub b ; we get the remainder of y/3 ld l,a ld a,1 ; the pixel we want to draw jr z,iszero bit 0,l jr nz,is1 add a,a add a,a .is1 add a,a add a,a .iszero bit 0,h jr z,evenrow add a,a ; move down the bit .evenrow and c pop bc pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/graphics/nascom/respixl.asm0000755000175000017500000000367710550503414021247 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 19/12/2006 ; ; ; Reset pixel at (x,y) coordinate. ; ; ; $Id: respixl.asm,v 1.2 2007/01/08 18:01:48 stefano Exp $ ; INCLUDE "graphics/text6/textgfx.inc" XLIB respixel LIB textpixl LIB div3 XREF COORDS XREF base_graphics .respixel ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range dec a dec a ld (COORDS),hl push bc ld c,a ; y ld b,h ; x push bc ld hl,div3 ld d,0 ld e,c inc e adc hl,de ld a,(hl) ld c,a ; y/3 srl b ; x/2 ld a,c ld c,b ; !! ;--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ld hl,0BCAh ld b,a ; keep y/3 and a jr z,r_zero ld hl,$80a dec a jr z,r_zero ld de,64 .r_loop add hl,de dec a jr nz,r_loop .r_zero ld e,c add hl,de ;--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ld a,(hl) ; get current symbol from screen ld e,a ; ..and its copy push hl ; char address push bc ; keep y/3 ld hl,textpixl ld e,0 ld b,64 ; whole symbol table size .ckmap cp (hl) ; compare symbol with the one in map jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop bc ; restore y/3 in b pop hl ; char address ex (sp),hl ; save char address <=> restore x,y (y=h, x=l) ld c,a ; keep the symbol ld a,l inc a inc a sub b sub b sub b ; we get the remainder of y/3 ld l,a ld a,1 ; the pixel we want to draw jr z,iszero bit 0,l jr nz,is1 add a,a add a,a .is1 add a,a add a,a .iszero bit 0,h jr z,evenrow add a,a ; move down the bit .evenrow cpl and c ld hl,textpixl ld d,0 ld e,a add hl,de ld a,(hl) pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/nascom/swapgfxbk.asm0000755000175000017500000000046607677047335021573 0ustar tygrystygrys; ; NASCOM Graphics Functions ; ; swapgfxbk () -- foo routine for fake swapping ; ; Stefano Bodrato - June 2003 ; ; ; $Id: swapgfxbk.asm,v 1.1 2003/06/27 14:04:13 stefano Exp $ ; XLIB swapgfxbk XDEF swapgfxbk1 .swapgfxbk ret .swapgfxbk1 ret z88dk-1.8.ds1/libsrc/graphics/nascom/textpixl6.asm0000755000175000017500000000126310545004044021514 0ustar tygrystygrys; ; ; Support char table (pseudo graph symbols) for the Mattel Aquarius ; Version for the 2x3 graphics symbols ; Sequence: blank, top-left, top-right, top-half, medium-left, top-left + medium-left, etc.. ; ; $Id: textpixl6.asm,v 1.1 2006/12/28 18:08:36 stefano Exp $ ; ; XLIB textpixl .textpixl defb $C0, $C1, $C8, $C9, $C2, $C3, $CA, $CB defb $D0, $D1, $D8, $D9, $D2, $D3, $DA, $DB defb $C4, $C5, $CC, $CD, $C6, $C7, $CE, $CF defb $D4, $D5, $DC, $DD, $D6, $D7, $DE, $DF defb $E0, $E1, $E8, $E9, $E2, $E3, $EA, $EB defb $F0, $F1, $F8, $F9, $F2, $F3, $FA, $FB defb $E4, $E5, $EC, $ED, $E6, $E7, $EE, $EF defb $F4, $F5, $FC, $FD, $F6, $F7, $FE, $FF z88dk-1.8.ds1/libsrc/graphics/nascom/xorpixl.asm0000755000175000017500000000367110550503414021260 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 19/12/2006 ; ; ; Invert pixel at (x,y) coordinate. ; ; ; $Id: xorpixl.asm,v 1.2 2007/01/08 18:01:48 stefano Exp $ ; INCLUDE "graphics/text6/textgfx.inc" XLIB xorpixel LIB textpixl LIB div3 XREF COORDS XREF base_graphics .xorpixel ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range dec a dec a ld (COORDS),hl push bc ld c,a ; y ld b,h ; x push bc ld hl,div3 ld d,0 ld e,c inc e adc hl,de ld a,(hl) ld c,a ; y/3 srl b ; x/2 ld a,c ld c,b ; !! ;--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ld hl,0BCAh ld b,a ; keep y/3 and a jr z,r_zero ld hl,$80a dec a jr z,r_zero ld de,64 .r_loop add hl,de dec a jr nz,r_loop .r_zero ld e,c add hl,de ;--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ld a,(hl) ; get current symbol from screen ld e,a ; ..and its copy push hl ; char address push bc ; keep y/3 ld hl,textpixl ld e,0 ld b,64 ; whole symbol table size .ckmap cp (hl) ; compare symbol with the one in map jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop bc ; restore y/3 in b pop hl ; char address ex (sp),hl ; save char address <=> restore x,y (y=h, x=l) ld c,a ; keep the symbol ld a,l inc a inc a sub b sub b sub b ; we get the remainder of y/3 ld l,a ld a,1 ; the pixel we want to draw jr z,iszero bit 0,l jr nz,is1 add a,a add a,a .is1 add a,a add a,a .iszero bit 0,h jr z,evenrow add a,a ; move down the bit .evenrow xor c ld hl,textpixl ld d,0 ld e,a add hl,de ld a,(hl) pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/oz/0000755000175000017500000000000010765202715016217 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/oz/clg.asm0000644000175000017500000000057207662702243017475 0ustar tygrystygrys; ; Sharp OZ family port (graphics routines) ; Stefano Bodrato - Aug 2002 ; ; ; Clear the graph. screen ; ; ; $Id: clg.asm,v 1.3 2003/05/21 13:52:35 stefano Exp $ ; XLIB clg XREF base_graphics LIB swapgfxbk XREF swapgfxbk1 .clg call swapgfxbk ld hl,(base_graphics) ld d,h ld e,l inc de ld bc,2400-1 xor a ld (hl),a ldir jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/oz/pixladdr.asm0000644000175000017500000000173307566714367020554 0ustar tygrystygrys; ; Sharp OZ family port (graphics routines) ; Stefano Bodrato - Aug 2002 ; XLIB pixeladdress INCLUDE "graphics/grafix.inc" XREF base_graphics ; ; $Id: pixladdr.asm,v 1.1 2002/11/20 14:15:19 stefano Exp $ ; ; ****************************************************************** ; ; Get absolute pixel address in map of virtual (x,y) coordinate. ; ; in: hl = (x,y) coordinate of pixel (h,l) ; ; out: de = address of pixel byte ; a = bit number of byte where pixel is to be placed ; fz = 1 if bit number is 0 of pixel position ; ; registers changed after return: ; ......hl/ixiy same ; afbcde../.... different ; .pixeladdress push bc ld a,h push af srl a srl a srl a ld c,a ; c=int(x/8) ld h,0 add hl,hl ld d,h ld e,l add hl,hl add hl,hl add hl,hl add hl,hl sbc hl,de ; y * 30 ld de,(base_graphics) add hl,de ld b,0 add hl,bc ld d,h ld e,l pop af pop bc and @00000111 ; a = x mod 8 ret z88dk-1.8.ds1/libsrc/graphics/oz/putsprite.asm0000644000175000017500000000722307567116023020766 0ustar tygrystygrys; ; Sharp OZ family port (graphics routines) ; Stefano Bodrato - Aug 2002 ; ; ; Sprite Rendering Routine ; original code by Patrick Davidson (TI 85) ; modified by Stefano Bodrato - Aug 2002 ; XLIB putsprite LIB pixeladdress LIB swapgfxbk XREF swapgfxbk1 INCLUDE "graphics/grafix.inc" ; ; $Id: putsprite.asm,v 1.2 2002/11/21 08:40:51 stefano Exp $ ; ; coords: d,e (vert-horz) ; sprite: (ix) .offsets_table defb 1,2,4,8,16,32,64,128 .putsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl inc hl ld a,(hl) ; and/or/xor mode ld (ortype+1),a ; Self modifying code ld (ortype2+1),a ; Self modifying code inc hl ld a,(hl) ld (ortype),a ; Self modifying code ld (ortype2),a ; Self modifying code ld h,d ld l,e call swapgfxbk call pixeladdress ;xor 7 ld hl,offsets_table ld c,a ld b,0 add hl,bc ld a,(hl) ld (wsmc1+1),a ld (wsmc2+1),a ld (_smc1+1),a ld h,d ld l,e ld a,(ix+0) cp 9 jr nc,putspritew ld d,(ix+0) ld b,(ix+1) ._oloop push bc ;Save # of rows push hl ;Save screen address ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix ._smc1 ld a,1 ;Load pixel mask ._iloop sla c ;Test leftmost pixel jr nc,_noplot ;See if a plot is needed ld e,a .ortype nop ; changed into nop / cpl nop ; changed into and/or/xor (hl) ld (hl),a ld a,e ._noplot rlca jr nc,_notedge ;Test if edge of byte reached inc hl ;Go to next byte ._notedge djnz _iloop pop hl ;Restore address ld bc,row_bytes ;Go to next line add hl,bc pop bc ;Restore data djnz _oloop ;ret jp swapgfxbk1 .putspritew ld d,(ix+0) ld b,(ix+1) .woloop push bc ;Save # of rows push hl ;Save screen address ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix .wsmc1 ld a,1 ;Load pixel mask .wiloop sla c ;Test leftmost pixel jr nc,wnoplot ;See if a plot is needed ld e,a .ortype2 nop ; changed into nop / cpl nop ; changed into and/or/xor (hl) ld (hl),a ld a,e .wnoplot rlca jr nc,wnotedge ;Test if edge of byte reached inc hl ;Go to next byte .wnotedge .wsmc2 cp 1 jr z,wover_1 djnz wiloop pop hl ;Restore address ld bc,row_bytes ;Go to next line add hl,bc pop bc ;Restore data djnz woloop ;ret jp swapgfxbk1 .wover_1 ld c,(ix+2) inc ix djnz wiloop dec ix pop hl ld bc,row_bytes add hl,bc pop bc djnz woloop ;ret jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/oz/swapgfxbk.asm0000644000175000017500000000123607742732603020724 0ustar tygrystygrys; ; Sharp OZ family port (graphics routines) ; Stefano Bodrato - Aug 2002 ; ; Page the graphics bank in/out - used by all gfx functions ; Simply does a swap... ; ; ; $Id: swapgfxbk.asm,v 1.2 2003/10/14 08:36:19 stefano Exp $ ; XLIB swapgfxbk XDEF swapgfxbk1 XREF ozactivepage ;.iysave defw 0 .swapgfxbk push bc ld bc,(ozactivepage) ld a,c out (3),a ld a,b out (4),a pop bc ; ld (iysave),iy ret .swapgfxbk1 ld a,7 out (3),a ld a,4 out (4),a ;; page in proper second page ; ld iy,(iysave) ret z88dk-1.8.ds1/libsrc/graphics/plot.asm0000644000175000017500000000103507267312341017246 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: plot.asm,v 1.4 2001/04/18 13:21:37 stefano Exp $ ; ;Usage: plot(struct *pixel) XLIB plot LIB swapgfxbk LIB swapgfxbk1 LIB plotpixel .plot ld ix,0 add ix,sp ld l,(ix+2) ld h,(ix+4) call swapgfxbk call plotpixel jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/plotpixl.asm0000644000175000017500000000155307267312341020150 0ustar tygrystygrys INCLUDE "graphics/grafix.inc" XLIB plotpixel LIB pixeladdress XREF COORDS ; ; $Id: plotpixl.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ; ****************************************************************** ; ; Plot pixel at (x,y) coordinate. ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; The (0,0) origin is placed at the top left corner. ; ; in: hl = (x,y) coordinate of pixel (h,l) ; ; registers changed after return: ; ..bc..../ixiy same ; af..dehl/.... different ; .plotpixel IF maxx <> 256 ld a,h cp maxx ret nc ENDIF ld a,l cp maxy ret nc ; y0 out of range ld (COORDS),hl push bc call pixeladdress ld b,a ld a,1 jr z, or_pixel ; pixel is at bit 0... .plot_position rlca djnz plot_position .or_pixel ex de,hl or (hl) ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/plotpixl_smc.asm0000755000175000017500000000053210547236116021011 0ustar tygrystygrys; ; Generic graphics routines ; Self modifying code version ; ; Stefano Bodrato - 4/1/2007 ; ; ; Plot pixel at (x,y) coordinate. ; ; ; $Id: plotpixl_smc.asm,v 1.1 2007/01/04 17:41:34 stefano Exp $ ; XLIB plotpixel LIB pixel XREF pixmode .plotpixel push hl ld hl,182 ; OR (HL) ld (pixmode),hl pop hl jp pixel z88dk-1.8.ds1/libsrc/graphics/point.asm0000644000175000017500000000146310661324041017416 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: point.asm,v 1.4 2007/08/17 13:52:33 stefano Exp $ ; ;Usage: point(struct *pixel) ;Result is true/false XLIB point LIB pointxy LIB swapgfxbk LIB swapgfxbk1 .point ld ix,0 add ix,sp ld l,(ix+2) ld h,(ix+4) call swapgfxbk call pointxy push af call swapgfxbk1 pop af ld hl,1 ret nz ;pixel set dec hl ret z88dk-1.8.ds1/libsrc/graphics/pointxy.asm0000644000175000017500000000165207267312341020007 0ustar tygrystygrys INCLUDE "graphics/grafix.inc" XLIB pointxy LIB pixeladdress ; ; $Id: pointxy.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ; ****************************************************************** ; ; Check if pixel at (x,y) coordinate is set or not. ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; (0,0) origin is defined as the top left corner. ; ; in: hl = (x,y) coordinate of pixel to test ; out: Fz = 0, if pixel is set, otherwise Fz = 1. ; ; registers changed after return: ; ..bcdehl/ixiy same ; af....../.... different ; .pointxy IF maxx <> 256 ld a,h cp maxx ret nc ENDIF ld a,l cp maxy ret nc ; y0 out of range push bc push de push hl call pixeladdress ld b,a ld a,1 jr z, test_pixel ; pixel is at bit 0... .pixel_position rlca djnz pixel_position .test_pixel ex de,hl and (hl) pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/graphics/putsprite.asm0000644000175000017500000000736107457562726020356 0ustar tygrystygrys; ; Sprite Rendering Routine ; original code by Patrick Davidson (TI 85) ; modified by Stefano Bodrato - Jan 2001 ; ; Generic version (just a bit slow) ; ; ; $Id: putsprite.asm,v 1.6 2002/04/18 15:27:18 stefano Exp $ ; XLIB putsprite LIB pixeladdress LIB swapgfxbk XREF swapgfxbk1 INCLUDE "graphics/grafix.inc" ; coords: d,e (vert-horz) ; sprite: (ix) .offsets_table defb 1,2,4,8,16,32,64,128 .actcoord defw 0 .putsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ; sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl inc hl ld a,(hl) ; and/or/xor mode ld (ortype+1),a ; Self modifying code ld (ortype2+1),a ; Self modifying code inc hl ld a,(hl) ld (ortype),a ; Self modifying code ld (ortype2),a ; Self modifying code ld h,d ld l,e ld (actcoord),hl ; save current coordinates call swapgfxbk call pixeladdress ld hl,offsets_table ld c,a ld b,0 add hl,bc ld a,(hl) ld (wsmc1+1),a ld (wsmc2+1),a ld (_smc1+1),a ld h,d ld l,e ld a,(ix+0) cp 9 jr nc,putspritew ld d,(ix+0) ld b,(ix+1) ._oloop push bc ;Save # of rows ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix ._smc1 ld a,1 ;Load pixel mask ._iloop sla c ;Test leftmost pixel jr nc,_noplot ;See if a plot is needed ld e,a .ortype nop ; changed into nop / cpl nop ; changed into and/or/xor (hl) ld (hl),a ld a,e ._noplot rrca jr nc,_notedge ;Test if edge of byte reached inc hl ;Go to next byte ._notedge djnz _iloop ; --------- push de ld hl,(actcoord) inc l ld (actcoord),hl call pixeladdress ld h,d ld l,e pop de ; --------- pop bc ;Restore data djnz _oloop jp swapgfxbk1 .putspritew ld d,(ix+0) ld b,(ix+1) .woloop push bc ;Save # of rows ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix .wsmc1 ld a,1 ;Load pixel mask .wiloop sla c ;Test leftmost pixel jr nc,wnoplot ;See if a plot is needed ld e,a .ortype2 nop ; changed into nop / cpl nop ; changed into and/or/xor (hl) ld (hl),a ld a,e .wnoplot rrca jr nc,wnotedge ;Test if edge of byte reached inc hl ;Go to next byte .wnotedge .wsmc2 cp 1 jr z,wover_1 djnz wiloop ; --------- push de ld hl,(actcoord) inc l ld (actcoord),hl call pixeladdress ld h,d ld l,e pop de ; --------- pop bc ;Restore data djnz woloop jp swapgfxbk1 .wover_1 ld c,(ix+2) inc ix djnz wiloop dec ix ; --------- push de ld hl,(actcoord) inc l ld (actcoord),hl call pixeladdress ld h,d ld l,e pop de ; --------- pop bc djnz woloop jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/putsprite2.asm0000644000175000017500000000642307733574614020432 0ustar tygrystygrys; ; Sprite Rendering Routine ; original code by Patrick Davidson (TI 85) ; modified by Stefano Bodrato - Jan 2001 ; ; Sept 2003 - Stefano: Fixed bug for sprites wider than 8. ; ; Much More Generic version ; Uses plotpixel, respixel and xorpixel ; ; ; $Id: putsprite2.asm,v 1.4 2003/09/22 13:30:52 stefano Exp $ ; XLIB putsprite LIB plotpixel LIB respixel LIB xorpixel ; coords: h,l (vert-horz) ; sprite: (ix) .putsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl inc hl ld a,(hl) ; and/or/xor mode ld h,d ld l,e cp 166 ; and(hl) opcode jr z,doand cp 182 ; or(hl) opcode jr z,door ; 182 - or ; 174 - xor .doxor ld a,(ix+0) ; Width ld b,(ix+1) ; Height .oloopx push bc ;Save # of rows push af ;ld b,a ;Load width ld b,0 ; Better, start from zero !! ld c,(ix+2) ;Load one line of image .iloopx sla c ;Test leftmost pixel jr nc,noplotx ;See if a plot is needed pop af push af push hl ;push bc ; this should be done by the called routine push de ld a,h add a,b ld h,a call xorpixel pop de ;pop bc pop hl .noplotx inc b ; witdh counter pop af push af cp b ; end of row ? jr nz,noblkx inc ix ld c,(ix+2) ;Load next byte of image jr noblockx .noblkx ld a,b ; next byte in row ? ;dec a and a jr z,iloopx and 7 jr nz,iloopx .blockx inc ix ld c,(ix+2) ;Load next byte of image jr iloopx .noblockx inc l pop af pop bc ;Restore data djnz oloopx ret .doand ld a,(ix+0) ; Width ld b,(ix+1) ; Height .oloopa push bc ;Save # of rows push af ;ld b,a ;Load width ld b,0 ; Better, start from zero !! ld c,(ix+2) ;Load one line of image .iloopa sla c ;Test leftmost pixel jr nc,noplota ;See if a plot is needed pop af push af push hl ;push bc ; this should be done by the called routine push de ld a,h add a,b ld h,a call respixel pop de ;pop bc pop hl .noplota inc b ; witdh counter pop af push af cp b ; end of row ? jr nz,noblka inc ix ld c,(ix+2) ;Load next byte of image jr noblocka .noblka ld a,b ; next byte in row ? ;dec a and a jr z,iloopa and 7 jr nz,iloopa .blocka inc ix ld c,(ix+2) ;Load next byte of image jr iloopa .noblocka inc l pop af pop bc ;Restore data djnz oloopa ret .door ld a,(ix+0) ; Width ld b,(ix+1) ; Height .oloopo push bc ;Save # of rows push af ;ld b,a ;Load width ld b,0 ; Better, start from zero !! ld c,(ix+2) ;Load one line of image .iloopo sla c ;Test leftmost pixel jr nc,noploto ;See if a plot is needed pop af push af push hl ;push bc ; this should be done by the called routine push de ld a,h add a,b ld h,a call plotpixel pop de ;pop bc pop hl .noploto inc b ; witdh counter pop af push af cp b ; end of row ? jr nz,noblko inc ix ld c,(ix+2) ;Load next byte of image jr noblocko .noblko ld a,b ; next byte in row ? ;dec a and a jr z,iloopo and 7 jr nz,iloopo .blocko inc ix ld c,(ix+2) ;Load next byte of image jr iloopo .noblocko ;djnz iloopo inc l pop af pop bc ;Restore data djnz oloopo ret z88dk-1.8.ds1/libsrc/graphics/putsprite3.asm0000755000175000017500000000357207733574614020440 0ustar tygrystygrys; ; Sprite Rendering Routine ; original code by Patrick Davidson (TI 85) ; modified by Stefano Bodrato - Jan 2001 ; ; Sept 2003 - Stefano: Fixed bug for sprites wider than 8. ; ; Much More Generic version ; Uses plotpixel, respixel and xorpixel ; ; ** putsprite3 is a thin version with a Self Modifying Code trick ** ; ; ; $Id: putsprite3.asm,v 1.1 2003/09/22 13:30:52 stefano Exp $ ; XLIB putsprite LIB plotpixel LIB respixel LIB xorpixel ; coords: h,l (vert-horz) ; sprite: (ix) .putsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl inc hl ld a,(hl) ; and/or/xor mode cp 166 ; and(hl) opcode jr nz,nodoand ld hl,respixel ld (called+1),hl jr doxor .nodoand cp 182 ; or(hl) opcode jr nz,nodoor ld hl,plotpixel ld (called+1),hl jr doxor ; 182 - or ; 174 - xor .nodoor ld hl,xorpixel ld (called+1),hl .doxor ld h,d ld l,e ld a,(ix+0) ; Width ld b,(ix+1) ; Height .oloopx push bc ;Save # of rows push af ;ld b,a ;Load width ld b,0 ; Better, start from zero !! ld c,(ix+2) ;Load one line of image .iloopx sla c ;Test leftmost pixel jr nc,noplotx ;See if a plot is needed pop af push af push hl ;push bc ; this should be done by the called routine push de ld a,h add a,b ld h,a .called call xorpixel pop de ;pop bc pop hl .noplotx inc b ; witdh counter pop af push af cp b ; end of row ? jr nz,noblkx inc ix ld c,(ix+2) ;Load next byte of image jr noblockx .noblkx ld a,b ; next byte in row ? ;dec a and a jr z,iloopx and 7 jr nz,iloopx .blockx inc ix ld c,(ix+2) ;Load next byte of image jr iloopx .noblockx inc l pop af pop bc ;Restore data djnz oloopx ret z88dk-1.8.ds1/libsrc/graphics/putsprite_smc.asm0000755000175000017500000000305110547236116021174 0ustar tygrystygrys; ; ; Generic graphics routines ; Self modifying code version ; ; Stefano Bodrato - 4/1/2007 ; ; ; Sprite Rendering Routine ; original code by Patrick Davidson (TI 85) ; ; ; $Id: putsprite_smc.asm,v 1.1 2007/01/04 17:41:34 stefano Exp $ ; XLIB putsprite LIB pixel XREF pixmode ; coords: h,l (vert-horz) ; sprite: (ix) .putsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl ;inc hl ld a,(hl) ; and/or/xor mode inc hl ld l,(hl) ld h,a ld (pixmode),hl ld h,d ld l,e ld a,(ix+0) ; Width ld b,(ix+1) ; Height .oloop push bc ;Save # of rows push af ;ld b,a ;Load width ld b,0 ; Better, start from zero !! ld c,(ix+2) ;Load one line of image .iloop sla c ;Test leftmost pixel jr nc,noplot ;See if a plot is needed pop af push af push hl ;push bc ; this should be done by the called routine push de ld a,h add a,b ld h,a call pixel pop de ;pop bc pop hl .noplot inc b ; witdh counter pop af push af cp b ; end of row ? jr nz,noblk inc ix ld c,(ix+2) ;Load next byte of image jr noblock .noblk ld a,b ; next byte in row ? ;dec a and a jr z,iloop and 7 jr nz,iloop .block inc ix ld c,(ix+2) ;Load next byte of image jr iloop .noblock inc l pop af pop bc ;Restore data djnz oloop ret z88dk-1.8.ds1/libsrc/graphics/rbitmask.asm0000644000175000017500000000137207267312341020110 0ustar tygrystygrys xlib rightbitmask ; ; $Id: rbitmask.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ; ************************************************************************ ; ; Get right bitmask for rigth side of byte to preserve during clear ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; IN: A = bitposition ; ; OUT: A = bitmask at right side of bit position of byte ; ; Example: ; IN: A = 6 ; OUT: A = @00111111 (bit 5 - 0 as mask) ; ; registers changed after return: ; ..bcdehl/ixiy same ; af....../.... different ; .rightbitmask cp 0 ; 7-bitpos ret z ; no bitmask to preserve... push bc ld b,a xor a .right_bitmask_loop scf rla ; create right bitmask djnz right_bitmask_loop pop bc ret z88dk-1.8.ds1/libsrc/graphics/README0000644000175000017500000000050607267312341016450 0ustar tygrystygrys$Id: README,v 1.2 2001/04/18 13:21:37 stefano Exp $ Changed the (0:0) origin to top-left (hardware) to port easily the stuff. The Z88 uses the window and closegfx commands that aren't supported with the other ports. Spectrum, ZX81, VZ200/300, Jupiter ACE and TI calculators are supported with all the others gfx commands. z88dk-1.8.ds1/libsrc/graphics/respixl.asm0000644000175000017500000000144407267312341017762 0ustar tygrystygrys INCLUDE "graphics/grafix.inc" XLIB respixel LIB pixeladdress XREF COORDS ; ; $Id: respixl.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ; ****************************************************************** ; ; Reset pixel at (x,y) coordinate ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; in: hl = (x,y) coordinate of pixel (h,l) ; ; registers changed after return: ; ..bc..../ixiy same ; af..dehl/.... different ; .respixel IF maxx <> 256 ld a,h cp maxx ret nc ENDIF ld a,l cp maxy ret nc ; y0 out of range ld (COORDS),hl push bc call pixeladdress ld b,a ld a,1 jr z, reset_pixel .reset_position rlca djnz reset_position .reset_pixel ex de,hl cpl and (hl) ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/respixl_smc.asm0000755000175000017500000000054010547236116020623 0ustar tygrystygrys; ; Generic graphics routines ; Self modifying code version ; ; Stefano Bodrato - 4/1/2007 ; ; ; Reset pixel at (x,y) coordinate. ; ; ; $Id: respixl_smc.asm,v 1.1 2007/01/04 17:41:34 stefano Exp $ ; XLIB respixel LIB pixel XREF pixmode .respixel push hl ld hl,0A62Fh ; CPL - AND (HL) ld (pixmode),hl pop hl jp pixel z88dk-1.8.ds1/libsrc/graphics/rscroll.asm0000644000175000017500000000066207267312341017755 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: rscroll.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; XLIB rscroll LIB scroll_right .rscroll ld ix,0 add ix,sp ld a,(ix+2) ld c,(ix+4) ld b,(ix+6) ld l,(ix+8) ld h,(ix+10) jp scroll_right z88dk-1.8.ds1/libsrc/graphics/sam/0000755000175000017500000000000010765202715016347 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/sam/swapgfxbk.asm0000644000175000017500000000144607443162506021054 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; SAM Coup version by Frode Tenneb ; ; Page the graphics bank in/out - used by all gfx functions ; Simply does a swap... ; ; ; $Id: swapgfxbk.asm,v 1.1 2002/03/11 17:11:34 stefano Exp $ ; ; registers changed after return: ; ..bcdejl/..iy same ; af....../ix.. different ; NB! Mad hack! I hope that iy is not used for anything else around. XLIB swapgfxbk XDEF swapgfxbk1 .swapgfxbk di pop iy ld (swapsp1+1),sp ld (accu+1),a in a,(250) ld (swapgfxbk1+1),a ld a,($5a78) // in a,(252) and @00011111 dec a out (250),a .accu ld a,0 ld sp,32768 jp (iy) .swapgfxbk1 ld a,0 out (250),a .swapsp1 ld sp,0 ei ret z88dk-1.8.ds1/libsrc/graphics/setxy.asm0000644000175000017500000000123207267312341017443 0ustar tygrystygrys INCLUDE "graphics/grafix.inc" XLIB setxy XREF COORDS ; ; $Id: setxy.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; ; ****************************************************************** ; ; Move current pixel coordinate to (x0,y0). Only legal coordinates ; are accepted. ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; X-range is always legal (0-255). Y-range must be 0 - 63. ; ; in: hl = (x,y) coordinate ; ; registers changed after return: ; ..bcdehl/ixiy same ; af....../.... different ; .setxy IF maxx <> 256 ld a,h cp maxx ret nc ENDIF ld a,l cp maxy ret nc ; out of range... ld (COORDS),hl ret z88dk-1.8.ds1/libsrc/graphics/spectrum/0000755000175000017500000000000010765202715017431 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/spectrum/bkrestore.asm0000644000175000017500000000173207443162506022140 0ustar tygrystygrys; ; Fast background restore ; ; ZX Spectrum version (speeded up with a row table) ; ; $Id: bkrestore.asm,v 1.2 2002/03/11 17:11:34 stefano Exp $ ; XLIB bkrestore LIB zx_rowtab .bkrestore ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix ld d,(ix+2) ld e,(ix+3) ld a,d ld d,0 ld hl,zx_rowtab add hl,de add hl,de ld (actrow+1),hl ; save row table position ld e,(hl) inc hl ld h,(hl) ld l,e push af srl a srl a srl a ld (actcol+1),a ld e,a pop af add hl,de ld a,(ix+0) ld b,(ix+1) dec a srl a srl a srl a inc a inc a ; INT ((Xsize-1)/8+2) ld (rbytes+1),a di .bkrestores push bc .rbytes ld b,0 .rloop ld a,(ix+4) ld (hl),a inc hl inc ix djnz rloop ; --------- .actrow ld hl,0 inc hl inc hl ld (actrow+1),hl ld b,(hl) inc hl ld h,(hl) ld l,b .actcol ld bc,0 add hl,bc ; --------- pop bc djnz bkrestores ei ret z88dk-1.8.ds1/libsrc/graphics/spectrum/bksave.asm0000644000175000017500000000207507443162506021414 0ustar tygrystygrys; ; Fast background save ; ; ZX Spectrum version (speeded up with a row table) ; ; $Id: bksave.asm,v 1.2 2002/03/11 17:11:34 stefano Exp $ ; XLIB bksave LIB zx_rowtab .actrow defw 0 .actcol defw 0 .bksave ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords ld (ix+2),d ld (ix+3),e ld a,d ld d,0 ld hl,zx_rowtab add hl,de add hl,de ld (actrow),hl ; save row table position ld e,(hl) inc hl ld h,(hl) ld l,e ld e,a srl e srl e srl e ld (actcol),de add hl,de ld a,(ix+0) ld b,(ix+1) dec a srl a srl a srl a inc a inc a ; INT ((Xsize-1)/8+2) ld (rbytes+1),a .bksaves push bc .rbytes ld b,0 .rloop ld a,(hl) ld (ix+4),a inc hl inc ix djnz rloop ; --------- ld hl,(actrow) inc hl inc hl ld (actrow),hl ld b,(hl) inc hl ld h,(hl) ld l,b ld bc,(actcol) add hl,bc ; --------- pop bc djnz bksaves ret z88dk-1.8.ds1/libsrc/graphics/spectrum/clg.asm0000644000175000017500000000060710551246427020704 0ustar tygrystygrys; ; Fast CLS for the Speccy ; Stefano - 10/1/2007 ; ; ; $Id: clg.asm,v 1.2 2007/01/10 20:31:19 stefano Exp $ ; XLIB clg .clg ld hl,0 ld d,h ld e,h ld b,h add hl,sp ld sp,16384+6144 .clgloop push de push de push de push de push de push de push de push de push de push de push de push de djnz clgloop ld sp,hl ret z88dk-1.8.ds1/libsrc/graphics/spectrum/pixladdr.asm0000644000175000017500000000241707457364561021762 0ustar tygrystygrys XLIB pixeladdress INCLUDE "graphics/grafix.inc" XREF base_graphics ; ; $Id: pixladdr.asm,v 1.5 2002/04/17 21:30:25 dom Exp $ ; ; ****************************************************************** ; ; Get absolute pixel address in map of virtual (x,y) coordinate. ; ; in: hl = (x,y) coordinate of pixel (h,l) ; ; out: de = address of pixel byte ; a = bit number of byte where pixel is to be placed ; fz = 1 if bit number is 0 of pixel position ; ; registers changed after return: ; ......hl/ixiy same ; afbcde../.... different ; .pixeladdress ;; Ported from the ZX ROM PIXEL-ADD routine ; Direct ROM call ; better not to use it: ; ld b,l ; maybe someone wants to ; ld c,h ; make a ROM :-) ; call 8880 ; call 8881 ; xor @00000111 ; ld d,h ; ld e,l ; ret LD C,H LD A,L LD B,A AND A RRA SCF ; Set Carry Flag RRA AND A RRA XOR B AND @11111000 XOR B LD D,A LD A,C RLCA RLCA RLCA XOR B AND @11000111 XOR B RLCA RLCA LD E,A LD A,C AND @00000111 XOR @00000111 RET z88dk-1.8.ds1/libsrc/graphics/spectrum/pixladdr2.asm0000644000175000017500000000162407457364561022043 0ustar tygrystygrys XLIB pixeladdress LIB zx_rowtab INCLUDE "graphics/grafix.inc" ; ; $Id: pixladdr2.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ ; ; ****************************************************************** ; ; Table based version - Stefano 19/2/2002 ; Seems to have exactly the same speed of pixladdr.asm ; ; Get absolute pixel address in map of virtual (x,y) coordinate. ; ; in: hl = (x,y) coordinate of pixel (h,l) ; ; out: de = address of pixel byte ; a = bit number of byte where pixel is to be placed ; fz = 1 if bit number is 0 of pixel position ; ; registers changed after return: ; ..bc..../ixiy same ; af..dehl/.... different ; .pixeladdress ld a,h ld d,0 ld e,l ld hl,zx_rowtab add hl,de add hl,de ld e,(hl) inc hl ld h,(hl) ld l,e ld e,a srl e srl e srl e add hl,de ld d,h ld e,l AND @00000111 XOR @00000111 RET z88dk-1.8.ds1/libsrc/graphics/spectrum/putsprite.asm0000644000175000017500000000747207457364561022220 0ustar tygrystygrys; ; Sprite Rendering Routine ; original code by Patrick Davidson (TI 85) ; modified by Stefano Bodrato - Jan 2001 ; ; ZX Spectrum version (speeded up with a row table) ; ; ; $Id: putsprite.asm,v 1.3 2002/04/17 21:30:25 dom Exp $ ; XLIB putsprite LIB zx_rowtab INCLUDE "graphics/grafix.inc" ; coords: d,e (vert-horz) ; sprite: (ix) .offsets_table defb 128,64,32,16,8,4,2,1 .putsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ; sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl inc hl ld a,(hl) ; and/or/xor mode ld (ortype+1),a ; Self modifying code ld (ortype2+1),a ; Self modifying code inc hl ld a,(hl) ld (ortype),a ; Self modifying code ld (ortype2),a ; Self modifying code ld a,d ld d,0 ld hl,zx_rowtab add hl,de add hl,de ld (actrow+1),hl ; save row table position ld (actrow1+1),hl ld (actrow2+1),hl ld e,(hl) inc hl ld h,(hl) ld l,e push af srl a srl a srl a ld (actcol+1),a ld (actcol1+1),a ld (actcol2+1),a ld e,a pop af add hl,de push hl AND @00000111 ld hl,offsets_table ld c,a ld b,0 add hl,bc ld a,(hl) ld (wsmc1+1),a ld (wsmc2+1),a ld (_smc1+1),a pop hl ld a,(ix+0) cp 9 jr nc,putspritew di ld d,(ix+0) ld b,(ix+1) ._oloop push bc ;Save # of rows ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix ._smc1 ld a,1 ;Load pixel mask ._iloop sla c ;Test leftmost pixel jr nc,_noplot ;See if a plot is needed ld e,a .ortype nop ; changed into nop / cpl nop ; changed into and/or/xor (hl) ld (hl),a ld a,e ._noplot rrca jr nc,_notedge ;Test if edge of byte reached inc hl ;Go to next byte ._notedge djnz _iloop ; --------- .actrow ld hl,0 inc hl inc hl ld (actrow+1),hl ld b,(hl) inc hl ld h,(hl) ld l,b .actcol ld bc,0 add hl,bc ; --------- pop bc ;Restore data djnz _oloop ei ret .putspritew di ld d,(ix+0) ld b,(ix+1) .woloop push bc ;Save # of rows ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix .wsmc1 ld a,1 ;Load pixel mask .wiloop sla c ;Test leftmost pixel jr nc,wnoplot ;See if a plot is needed ld e,a .ortype2 nop ; changed into nop / cpl nop ; changed into and/or/xor (hl) ld (hl),a ld a,e .wnoplot rrca jr nc,wnotedge ;Test if edge of byte reached inc hl ;Go to next byte .wnotedge .wsmc2 cp 1 jr z,wover_1 djnz wiloop ; --------- .actrow1 ld hl,0 inc hl inc hl ld (actrow1+1),hl ld b,(hl) inc hl ld h,(hl) ld l,b .actcol1 ld bc,0 add hl,bc ; --------- pop bc ;Restore data djnz woloop ei ret .wover_1 ld c,(ix+2) inc ix djnz wiloop dec ix ; --------- .actrow2 ld hl,0 inc hl inc hl ld (actrow2+1),hl ld b,(hl) inc hl ld h,(hl) ld l,b .actcol2 ld bc,0 add hl,bc ; --------- pop bc djnz woloop ei ret z88dk-1.8.ds1/libsrc/graphics/spectrum/rowtab.asm0000644000175000017500000000576407457364561021461 0ustar tygrystygrys XLIB zx_rowtab INCLUDE "graphics/grafix.inc" ; ; $Id: rowtab.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ ; ; Screen row addresses table ; by Enrico Maria Giordano .zx_rowtab DEFW 4000H DEFW 4100H DEFW 4200H DEFW 4300H DEFW 4400H DEFW 4500H DEFW 4600H DEFW 4700H DEFW 4020H DEFW 4120H DEFW 4220H DEFW 4320H DEFW 4420H DEFW 4520H DEFW 4620H DEFW 4720H DEFW 4040H DEFW 4140H DEFW 4240H DEFW 4340H DEFW 4440H DEFW 4540H DEFW 4640H DEFW 4740H DEFW 4060H DEFW 4160H DEFW 4260H DEFW 4360H DEFW 4460H DEFW 4560H DEFW 4660H DEFW 4760H DEFW 4080H DEFW 4180H DEFW 4280H DEFW 4380H DEFW 4480H DEFW 4580H DEFW 4680H DEFW 4780H DEFW 40A0H DEFW 41A0H DEFW 42A0H DEFW 43A0H DEFW 44A0H DEFW 45A0H DEFW 46A0H DEFW 47A0H DEFW 40C0H DEFW 41C0H DEFW 42C0H DEFW 43C0H DEFW 44C0H DEFW 45C0H DEFW 46C0H DEFW 47C0H DEFW 40E0H DEFW 41E0H DEFW 42E0H DEFW 43E0H DEFW 44E0H DEFW 45E0H DEFW 46E0H DEFW 47E0H DEFW 4800H DEFW 4900H DEFW 4A00H DEFW 4B00H DEFW 4C00H DEFW 4D00H DEFW 4E00H DEFW 4F00H DEFW 4820H DEFW 4920H DEFW 4A20H DEFW 4B20H DEFW 4C20H DEFW 4D20H DEFW 4E20H DEFW 4F20H DEFW 4840H DEFW 4940H DEFW 4A40H DEFW 4B40H DEFW 4C40H DEFW 4D40H DEFW 4E40H DEFW 4F40H DEFW 4860H DEFW 4960H DEFW 4A60H DEFW 4B60H DEFW 4C60H DEFW 4D60H DEFW 4E60H DEFW 4F60H DEFW 4880H DEFW 4980H DEFW 4A80H DEFW 4B80H DEFW 4C80H DEFW 4D80H DEFW 4E80H DEFW 4F80H DEFW 48A0H DEFW 49A0H DEFW 4AA0H DEFW 4BA0H DEFW 4CA0H DEFW 4DA0H DEFW 4EA0H DEFW 4FA0H DEFW 48C0H DEFW 49C0H DEFW 4AC0H DEFW 4BC0H DEFW 4CC0H DEFW 4DC0H DEFW 4EC0H DEFW 4FC0H DEFW 48E0H DEFW 49E0H DEFW 4AE0H DEFW 4BE0H DEFW 4CE0H DEFW 4DE0H DEFW 4EE0H DEFW 4FE0H DEFW 5000H DEFW 5100H DEFW 5200H DEFW 5300H DEFW 5400H DEFW 5500H DEFW 5600H DEFW 5700H DEFW 5020H DEFW 5120H DEFW 5220H DEFW 5320H DEFW 5420H DEFW 5520H DEFW 5620H DEFW 5720H DEFW 5040H DEFW 5140H DEFW 5240H DEFW 5340H DEFW 5440H DEFW 5540H DEFW 5640H DEFW 5740H DEFW 5060H DEFW 5160H DEFW 5260H DEFW 5360H DEFW 5460H DEFW 5560H DEFW 5660H DEFW 5760H DEFW 5080H DEFW 5180H DEFW 5280H DEFW 5380H DEFW 5480H DEFW 5580H DEFW 5680H DEFW 5780H DEFW 50A0H DEFW 51A0H DEFW 52A0H DEFW 53A0H DEFW 54A0H DEFW 55A0H DEFW 56A0H DEFW 57A0H DEFW 50C0H DEFW 51C0H DEFW 52C0H DEFW 53C0H DEFW 54C0H DEFW 55C0H DEFW 56C0H DEFW 57C0H DEFW 50E0H DEFW 51E0H DEFW 52E0H DEFW 53E0H DEFW 54E0H DEFW 55E0H DEFW 56E0H DEFW 57E0H z88dk-1.8.ds1/libsrc/graphics/spectrum/swapgfxbk.asm0000644000175000017500000000071107267312342022127 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 15/10/98 ; ; ; Page the graphics bank in/out - used by all gfx functions ; Simply does a swap... ; ; ; $Id: swapgfxbk.asm,v 1.2 2001/04/18 13:21:38 stefano Exp $ ; XLIB swapgfxbk XDEF swapgfxbk1 .swapgfxbk di ret .swapgfxbk1 ld iy,23610 ei ret z88dk-1.8.ds1/libsrc/graphics/swapgfxbk_foo.asm0000755000175000017500000000046210547236116021135 0ustar tygrystygrys; ; Graphics Functions ; ; swapgfxbk () -- foo routine for fake swapping ; ; Stefano Bodrato - Jan 2007 ; ; ; $Id: swapgfxbk_foo.asm,v 1.1 2007/01/04 17:41:34 stefano Exp $ ; XLIB swapgfxbk XDEF swapgfxbk1 .swapgfxbk ret .swapgfxbk1 ret z88dk-1.8.ds1/libsrc/graphics/text/0000755000175000017500000000000010765202715016553 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/text/clsgraph.asm0000644000175000017500000000064310540040627021054 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; ; Written by Stefano Bodrato 30/01/2002 ; ; ; Clears graph screen. ; ; ; $Id: clsgraph.asm,v 1.3 2006/12/13 18:08:23 stefano Exp $ ; INCLUDE "graphics/text/textgfx.inc" XLIB cleargraphics XREF base_graphics .cleargraphics ld hl,(base_graphics) ld d,h ld e,l inc de ld bc,(maxx/2)*(maxy/2) ld (hl),blankch ldir ret z88dk-1.8.ds1/libsrc/graphics/text/plotpixl.asm0000644000175000017500000000241507426524075021140 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; ; Written by Stefano Bodrato 30/01/2002 ; ; ; Plot pixel at (x,y) coordinate. ; ; ; $Id: plotpixl.asm,v 1.2 2002/02/01 14:37:49 stefano Exp $ ; INCLUDE "graphics/text/textgfx.inc" XLIB plotpixel LIB textpixl XREF COORDS XREF base_graphics .plotpixel ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range ld (COORDS),hl push bc ld c,a ld b,h push bc srl b srl c ld hl,(base_graphics) ld a,c ld c,b ; !! and a jr z,r_zero ld b,a ld de,maxx/2 .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol ld e,a push hl ld hl,textpixl ld e,0 ld b,16 .ckmap cp (hl) jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop hl ex (sp),hl ; save char address <=> restore x,y ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow or b ld hl,textpixl ld d,0 ld e,a add hl,de ld a,(hl) pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/text/pointxy.asm0000644000175000017500000000237710675670424021006 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; ; Written by Stefano Bodrato 07/09/2007 ; ; ; Get pixel at (x,y) coordinate. ; ; ; $Id: pointxy.asm,v 1.1 2007/09/24 08:11:00 stefano Exp $ ; INCLUDE "graphics/text/textgfx.inc" XLIB pointxy LIB textpixl XREF COORDS XREF base_graphics .pointxy ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range push bc push de push hl ld (COORDS),hl ;push bc ld c,a ld b,h push bc srl b srl c ld hl,(base_graphics) ld a,c ld c,b ; !! and a jr z,r_zero ld b,a ld de,maxx/2 .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol ld e,a push hl ld hl,textpixl ld e,0 ld b,16 .ckmap cp (hl) jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop hl ex (sp),hl ; save char address <=> restore x,y ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow and b pop bc pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/graphics/text/respixl.asm0000644000175000017500000000241607426524075020754 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; ; Written by Stefano Bodrato 30/01/2002 ; ; ; Erases pixel at (x,y) coordinate. ; ; ; $Id: respixl.asm,v 1.2 2002/02/01 14:37:49 stefano Exp $ ; INCLUDE "graphics/text/textgfx.inc" XLIB respixel LIB textpixl XREF COORDS XREF base_graphics .respixel ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range ld (COORDS),hl push bc ld c,a ld b,h push bc srl b srl c ld hl,(base_graphics) ld a,c ld c,b ; !! and a jr z,r_zero ld b,a ld de,maxx/2 .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol ld e,a push hl ld hl,textpixl ld e,0 ld b,16 .ckmap cp (hl) jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop hl ex (sp),hl ; save char address <=> restore x,y ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow cpl and b ld hl,textpixl ld d,0 ld e,a add hl,de ld a,(hl) pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/text/swapgfxbk.asm0000644000175000017500000000052707426524075021263 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; ; Written by Stefano Bodrato 01/02/2002 ; ; ; Dummy gfx paging for text mode. ; ; ; $Id: swapgfxbk.asm,v 1.1 2002/02/01 14:37:49 stefano Exp $ ; XLIB swapgfxbk XDEF swapgfxbk1 .swapgfxbk .swapgfxbk1 ret z88dk-1.8.ds1/libsrc/graphics/text/textgfx.inc0000644000175000017500000000077707457364561020766 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; ; Written by Stefano Bodrato 30/01/2002 ; ; ; Define for graphics and other standard library functions ; ; ; $Id: textgfx.inc,v 1.3 2002/04/17 21:30:25 dom Exp $ ; IF FORc128 DEFINE gotgfx defc maxx = 80 defc maxy = 50 defc blankch = 32 ENDIF IF FORaquarius DEFINE gotgfx defc maxx = 80 defc maxy = 48 defc blankch = 32 ENDIF IF !gotgfx defc maxx = 80 defc maxy = 48 defc blankch = 32 ELSE UNDEFINE gotgfx ENDIF z88dk-1.8.ds1/libsrc/graphics/text/xorpixl.asm0000644000175000017500000000241607426524076020774 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; ; Written by Stefano Bodrato 30/01/2002 ; ; ; Inverts pixel at (x,y) coordinate. ; ; ; $Id: xorpixl.asm,v 1.2 2002/02/01 14:37:50 stefano Exp $ ; INCLUDE "graphics/text/textgfx.inc" XLIB xorpixel LIB textpixl XREF COORDS XREF base_graphics .xorpixel ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range ld (COORDS),hl push bc ld c,a ld b,h push bc srl b srl c ld hl,(base_graphics) ld a,c ld c,b ; !! and a jr z,r_zero ld b,a ld de,maxx/2 .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol ld e,a push hl ld hl,textpixl ld e,0 ld b,16 .ckmap cp (hl) jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop hl ex (sp),hl ; save char address <=> restore x,y ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow xor b ld hl,textpixl ld d,0 ld e,a add hl,de ld a,(hl) pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/text6/0000755000175000017500000000000010765202715016641 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/text6/clsgraph.asm0000755000175000017500000000073310543320226021144 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 19/12/2006 ; ; ; Clears graph screen. ; ; ; $Id: clsgraph.asm,v 1.1 2006/12/23 21:33:10 stefano Exp $ ; INCLUDE "graphics/text6/textgfx.inc" XLIB cleargraphics XREF base_graphics .cleargraphics ld hl,(base_graphics) ld bc,maxx*maxy/6-1 .clean ld (hl),blankch inc hl dec bc ld a,b or c jr nz,clean ret z88dk-1.8.ds1/libsrc/graphics/text6/div3.asm0000755000175000017500000000166610545004044020213 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 14/12/2006 ; ; ; Divide by three lookup table ; ; ; $Id: div3.asm,v 1.2 2006/12/28 18:08:36 stefano Exp $ ; XLIB div3 .div3 ; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 defb 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5 ; 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 defb 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10,11 ; 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 defb 11,11,12,12,12,13,13,13,14,14,14,15,15,15,16,16 ; 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 defb 16,17,17,17,18,18,18,19,19,19,20,20,20,21,21,21 ; 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 defb 22,22,22,23,23,23,24,24,24,25,25,25,26,26,26,27 ;## TL TR ;## ML MR ;## BL BR ; ;POS: X/2, Y/3 ; ;Bit: X mod 2, Y mod 3z88dk-1.8.ds1/libsrc/graphics/text6/plotpixl.asm0000755000175000017500000000345310543320226021216 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 19/12/2006 ; ; ; Plot pixel at (x,y) coordinate. ; ; ; $Id: plotpixl.asm,v 1.1 2006/12/23 21:33:10 stefano Exp $ ; INCLUDE "graphics/text6/textgfx.inc" XLIB plotpixel LIB textpixl LIB div3 XREF COORDS XREF base_graphics .plotpixel ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range inc a ld (COORDS),hl push bc ld c,a ; y ld b,h ; x push bc ld hl,div3 ld d,0 ld e,c adc hl,de ld a,(hl) ld c,a ; y/3 srl b ; x/2 ld hl,(base_graphics) ld a,c ld c,b ; !! and a ld de,maxx/2 sbc hl,de jr z,r_zero ld b,a .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld b,a ; keep y/3 ld e,c add hl,de ld a,(hl) ; get current symbol from screen ld e,a ; ..and its copy push hl ; char address push bc ; keep y/3 ld hl,textpixl ld e,0 ld b,64 ; whole symbol table size .ckmap cp (hl) ; compare symbol with the one in map jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop bc ; restore y/3 in b pop hl ; char address ex (sp),hl ; save char address <=> restore x,y (y=h, x=l) ld c,a ; keep the symbol ld a,l inc a inc a sub b sub b sub b ; we get the remainder of y/3 ld l,a ld a,1 ; the pixel we want to draw jr z,iszero bit 0,l jr nz,is1 add a,a add a,a .is1 add a,a add a,a .iszero bit 0,h jr z,evenrow add a,a ; move down the bit .evenrow or c ld hl,textpixl ld d,0 ld e,a add hl,de ld a,(hl) pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/text6/pointxy.asm0000644000175000017500000000362510667543604021071 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 05/09/2007 ; ; ; Get pixel at (x,y) coordinate. ; ; ; $Id: pointxy.asm,v 1.1 2007/09/05 15:13:08 stefano Exp $ ; INCLUDE "graphics/text6/textgfx.inc" XLIB pointxy LIB textpixl LIB div3 XREF COORDS XREF base_graphics .pointxy ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range inc a push bc push de push hl ld (COORDS),hl ;push bc ld c,a ; y ld b,h ; x push bc ld hl,div3 ld d,0 ld e,c adc hl,de ld a,(hl) ld c,a ; y/3 srl b ; x/2 ld hl,(base_graphics) ld a,c ld c,b ; !! and a ld de,maxx/2 sbc hl,de jr z,r_zero ld b,a .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld b,a ; keep y/3 ld e,c add hl,de ld a,(hl) ; get current symbol from screen ld e,a ; ..and its copy push hl ; char address push bc ; keep y/3 ld hl,textpixl ld e,0 ld b,64 ; whole symbol table size .ckmap cp (hl) ; compare symbol with the one in map jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop bc ; restore y/3 in b pop hl ; char address ex (sp),hl ; save char address <=> restore x,y (y=h, x=l) ld c,a ; keep the symbol ld a,l inc a inc a sub b sub b sub b ; we get the remainder of y/3 ld l,a ld a,1 ; the pixel we want to draw jr z,iszero bit 0,l jr nz,is1 add a,a add a,a .is1 add a,a add a,a .iszero bit 0,h jr z,evenrow add a,a ; move down the bit .evenrow and c ;or c ;ld hl,textpixl ;ld d,0 ;ld e,a ;add hl,de ;ld a,(hl) ;pop hl ;ld (hl),a pop bc pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/graphics/text6/respixl.asm0000755000175000017500000000346110543320226021030 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 19/12/2006 ; ; ; Reset pixel at (x,y) coordinate. ; ; ; $Id: respixl.asm,v 1.1 2006/12/23 21:33:10 stefano Exp $ ; INCLUDE "graphics/text6/textgfx.inc" XLIB respixel LIB textpixl LIB div3 XREF COORDS XREF base_graphics .respixel ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range inc a ld (COORDS),hl push bc ld c,a ; y ld b,h ; x push bc ld hl,div3 ld d,0 ld e,c adc hl,de ld a,(hl) ld c,a ; y/3 srl b ; x/2 ld hl,(base_graphics) ld a,c ld c,b ; !! and a ld de,maxx/2 sbc hl,de jr z,r_zero ld b,a .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld b,a ; keep y/3 ld e,c add hl,de ld a,(hl) ; get current symbol from screen ld e,a ; ..and its copy push hl ; char address push bc ; keep y/3 ld hl,textpixl ld e,0 ld b,64 ; whole symbol table size .ckmap cp (hl) ; compare symbol with the one in map jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop bc ; restore y/3 in b pop hl ; char address ex (sp),hl ; save char address <=> restore x,y (y=h, x=l) ld c,a ; keep the symbol ld a,l inc a inc a sub b sub b sub b ; we get the remainder of y/3 ld l,a ld a,1 ; the pixel we want to draw jr z,iszero bit 0,l jr nz,is1 add a,a add a,a .is1 add a,a add a,a .iszero bit 0,h jr z,evenrow add a,a ; move down the bit .evenrow cpl and c ld hl,textpixl ld d,0 ld e,a add hl,de ld a,(hl) pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/text6/swapgfxbk.asm0000755000175000017500000000057610543320226021342 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 19/12/2006 ; ; ; Dummy gfx paging for text mode. ; ; ; $Id: swapgfxbk.asm,v 1.1 2006/12/23 21:33:10 stefano Exp $ ; XLIB swapgfxbk XDEF swapgfxbk1 .swapgfxbk .swapgfxbk1 ret z88dk-1.8.ds1/libsrc/graphics/text6/textgfx.inc0000755000175000017500000000075110545004044021022 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 13/12/2006 ; ; ; $Id: textgfx.inc,v 1.2 2006/12/28 18:08:36 stefano Exp $ ; IF FORaquarius DEFINE gotgfx defc maxx = 80 defc maxy = 72 defc blankch = 160 ENDIF IF FORnascom DEFINE gotgfx defc maxx = 96 defc maxy = 48 defc blankch = $C0 ENDIF IF !gotgfx defc maxx = 80 defc maxy = 72 defc blankch = 32 ELSE UNDEFINE gotgfx ENDIF z88dk-1.8.ds1/libsrc/graphics/text6/xorpixl.asm0000755000175000017500000000345310543320226021050 0ustar tygrystygrys; ; Generic pseudo graphics routines for text-only platforms ; Version for the 2x3 graphics symbols ; ; Written by Stefano Bodrato 19/12/2006 ; ; ; Invert pixel at (x,y) coordinate. ; ; ; $Id: xorpixl.asm,v 1.1 2006/12/23 21:33:10 stefano Exp $ ; INCLUDE "graphics/text6/textgfx.inc" XLIB xorpixel LIB textpixl LIB div3 XREF COORDS XREF base_graphics .xorpixel ld a,h cp maxx ret nc ld a,l cp maxy ret nc ; y0 out of range inc a ld (COORDS),hl push bc ld c,a ; y ld b,h ; x push bc ld hl,div3 ld d,0 ld e,c adc hl,de ld a,(hl) ld c,a ; y/3 srl b ; x/2 ld hl,(base_graphics) ld a,c ld c,b ; !! and a ld de,maxx/2 sbc hl,de jr z,r_zero ld b,a .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld b,a ; keep y/3 ld e,c add hl,de ld a,(hl) ; get current symbol from screen ld e,a ; ..and its copy push hl ; char address push bc ; keep y/3 ld hl,textpixl ld e,0 ld b,64 ; whole symbol table size .ckmap cp (hl) ; compare symbol with the one in map jr z,chfound inc hl inc e djnz ckmap ld e,0 .chfound ld a,e pop bc ; restore y/3 in b pop hl ; char address ex (sp),hl ; save char address <=> restore x,y (y=h, x=l) ld c,a ; keep the symbol ld a,l inc a inc a sub b sub b sub b ; we get the remainder of y/3 ld l,a ld a,1 ; the pixel we want to draw jr z,iszero bit 0,l jr nz,is1 add a,a add a,a .is1 add a,a add a,a .iszero bit 0,h jr z,evenrow add a,a ; move down the bit .evenrow xor c ld hl,textpixl ld d,0 ld e,a add hl,de ld a,(hl) pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/ticalc/0000755000175000017500000000000010765202715017026 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/ticalc/bkrestore.asm0000644000175000017500000000133507457364561021546 0ustar tygrystygrys; ; Fast background restore ; ; TI calculators version ; ; ; $Id: bkrestore.asm,v 1.6 2002/04/17 21:30:25 dom Exp $ ; XLIB bkrestore XREF cpygraph LIB pixeladdress INCLUDE "graphics/grafix.inc" .bkrestore ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix ld h,(ix+2) ; restore sprite position ld l,(ix+3) ld a,(ix+0) ld b,(ix+1) dec a srl a srl a srl a inc a inc a ; INT ((Xsize-1)/8+2) ld (rbytes+1),a ._sloop push bc push hl .rbytes ld b,0 .rloop ld a,(ix+4) ld (hl),a inc hl inc ix djnz rloop pop hl ld bc,row_bytes ;Go to next line add hl,bc pop bc djnz _sloop jp cpygraph z88dk-1.8.ds1/libsrc/graphics/ticalc/bksave.asm0000644000175000017500000000156207457364561021023 0ustar tygrystygrys; ; Fast background save ; ; TI calculators version ; ; ; $Id: bksave.asm,v 1.5 2002/04/17 21:30:25 dom Exp $ ; XLIB bksave LIB pixeladdress INCLUDE "graphics/grafix.inc" .bksave ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords ld h,d ld l,e call pixeladdress xor 7 ld h,d ld l,e ld (ix+2),h ; we save the current sprite position ld (ix+3),l ld a,(ix+0) ld b,(ix+1) dec a srl a srl a srl a inc a inc a ; INT ((Xsize-1)/8+2) ld (rbytes+1),a ._sloop push bc push hl .rbytes ld b,0 .rloop ld a,(hl) ld (ix+4),a inc hl inc ix djnz rloop pop hl ld bc,row_bytes ;Go to next line add hl,bc pop bc djnz _sloop ret z88dk-1.8.ds1/libsrc/graphics/ticalc/clg.asm0000644000175000017500000000064507267312342020303 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; TI Calc version by Stefano Bodrato Mar - 2000 ; ; ; $Id: clg.asm,v 1.2 2001/04/18 13:21:38 stefano Exp $ ; INCLUDE "graphics/grafix.inc" /* Contains fn defs */ XLIB clg XREF base_graphics XREF cpygraph .clg ld hl,(base_graphics) ld (hl),0 ld d,h ld e,l inc de ld bc,row_bytes*64-1 ldir jp cpygraph ; Copy GRAPH_MEM to LCD, then return z88dk-1.8.ds1/libsrc/graphics/ticalc/closegfx.asm0000644000175000017500000000064607457364561021364 0ustar tygrystygrys; ; Graphics for the TI82 ; By Stefano Bodrato - Dec. 2000 ; ; CLOSEGFX - wait for keypress ; ; ; $Id: closegfx.asm,v 1.3 2002/04/17 21:30:25 dom Exp $ ; XLIB closegfx .closegfx IF FORti82 ; This is called before scrolling: we wait for any keypress .kloop ;halt ; Power saving (?? maybe. It worked on ti86) ld hl,$8004 bit 2,(hl) jr z,kloop ENDIF IF FORti83 .kloop call $4CFE and a jr z,kloop ENDIF ret z88dk-1.8.ds1/libsrc/graphics/ticalc/pixladdr.asm0000644000175000017500000000176007457364561021357 0ustar tygrystygrys XLIB pixeladdress INCLUDE "graphics/grafix.inc" XREF base_graphics ; ; $Id: pixladdr.asm,v 1.6 2002/04/17 21:30:25 dom Exp $ ; ; ****************************************************************** ; ; Get absolute pixel address in map of virtual (x,y) coordinate. ; ; TI Calculator version ; ; addr=base+12*y+int(x/8) ; .pixeladdress push bc ld a,h push af srl a srl a srl a ld c,a ; c=int(x/8) ;ld b,l ld h,0 ; TI 82, 83 and 83+ screens are 12 bytes wide IF FORti82 ld d,h ld e,l add hl,de add hl,de ENDIF IF FORti83 ld d,h ld e,l add hl,de add hl,de ENDIF IF FORti83p ld d,h ld e,l add hl,de add hl,de ENDIF ; TI 85 and TI86 screens are 16 bytes wide IF FORti85 add hl,hl add hl,hl ENDIF IF FORti86 add hl,hl add hl,hl ENDIF add hl,hl add hl,hl ld de,(base_graphics) add hl,de ld b,0 add hl,bc ld d,h ld e,l pop af pop bc and @00000111 ; a = x mod 8 xor @00000111 ; a = 7 - a ret z88dk-1.8.ds1/libsrc/graphics/ticalc/putsprite.asm0000644000175000017500000000702707457364561021611 0ustar tygrystygrys; ; Sprite Rendering Routine ; original code by Patrick Davidson (TI 85) ; modified by Stefano Bodrato - Jan 2001 ; XLIB putsprite XREF cpygraph LIB pixeladdress INCLUDE "graphics/grafix.inc" ; ; $Id: putsprite.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; ; coords: d,e (vert-horz) ; sprite: (ix) .offsets_table defb 128,64,32,16,8,4,2,1 .putsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl inc hl ld a,(hl) ; and/or/xor mode ld (ortype+1),a ; Self modifying code ld (ortype2+1),a ; Self modifying code inc hl ld a,(hl) ld (ortype),a ; Self modifying code ld (ortype2),a ; Self modifying code ld h,d ld l,e call pixeladdress xor 7 ld hl,offsets_table ld c,a ld b,0 add hl,bc ld a,(hl) ld (wsmc1+1),a ld (wsmc2+1),a ld (_smc1+1),a ld h,d ld l,e ld a,(ix+0) cp 9 jr nc,putspritew ld d,(ix+0) ld b,(ix+1) ._oloop push bc ;Save # of rows push hl ;Save screen address ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix ._smc1 ld a,1 ;Load pixel mask ._iloop sla c ;Test leftmost pixel jr nc,_noplot ;See if a plot is needed ld e,a .ortype nop ; changed into nop / cpl nop ; changed into and/or/xor (hl) ld (hl),a ld a,e ._noplot rrca jr nc,_notedge ;Test if edge of byte reached inc hl ;Go to next byte ._notedge djnz _iloop pop hl ;Restore address ld bc,row_bytes ;Go to next line add hl,bc pop bc ;Restore data djnz _oloop ;ret jp cpygraph .putspritew ld d,(ix+0) ld b,(ix+1) .woloop push bc ;Save # of rows push hl ;Save screen address ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix .wsmc1 ld a,1 ;Load pixel mask .wiloop sla c ;Test leftmost pixel jr nc,wnoplot ;See if a plot is needed ld e,a .ortype2 nop ; changed into nop / cpl nop ; changed into and/or/xor (hl) ld (hl),a ld a,e .wnoplot rrca jr nc,wnotedge ;Test if edge of byte reached inc hl ;Go to next byte .wnotedge .wsmc2 cp 1 jr z,wover_1 djnz wiloop pop hl ;Restore address ld bc,row_bytes ;Go to next line add hl,bc pop bc ;Restore data djnz woloop ;ret jp cpygraph .wover_1 ld c,(ix+2) inc ix djnz wiloop dec ix pop hl ld bc,row_bytes add hl,bc pop bc djnz woloop ;ret jp cpygraph z88dk-1.8.ds1/libsrc/graphics/ticalc/swapgfxbk.asm0000644000175000017500000000107607457364561021544 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Page the graphics bank in/out - used by all gfx functions ; Simply does a swap... ; ; TI calcs: Copy GRAPH MEM to LCD when finished. ; By Stefano Bodrato - Dec. 2000 ; ; ; $Id: swapgfxbk.asm,v 1.7 2002/04/17 21:30:25 dom Exp $ ; XLIB swapgfxbk XDEF swapgfxbk1 XREF cpygraph .swapgfxbk ret .swapgfxbk1 push hl push de push bc call cpygraph ; Copy GRAPH_MEM to LCD, then return pop bc pop de pop hl ret z88dk-1.8.ds1/libsrc/graphics/uncircle.asm0000644000175000017500000000116507267312341020100 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: uncircle.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; XLIB uncircle LIB draw_circle LIB respixel LIB swapgfxbk XREF swapgfxbk1 .uncircle ld ix,0 add ix,sp ld e,(ix+2) ;skip ld d,(ix+4) ;radius ld c,(ix+6) ;y ld b,(ix+8) ;x ld ix,respixel call swapgfxbk call draw_circle jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/undraw.asm0000644000175000017500000000115407267312341017572 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: undraw.asm,v 1.3 2001/04/18 13:21:37 stefano Exp $ ; XLIB undraw LIB swapgfxbk XREF swapgfxbk1 LIB line LIB respixel .undraw ld ix,0 add ix,sp ld e,(ix+2) ;y1 ld d,(ix+4) ;x1 ld l,(ix+6) ;y0 ld h,(ix+8) ;x0 ld ix,respixel call swapgfxbk call line jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/undrawb.asm0000644000175000017500000000114407267312342017734 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: undrawb.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; XLIB undrawb LIB drawbox LIB respixel LIB swapgfxbk XREF swapgfxbk1 .undrawb ld ix,0 add ix,sp ld b,(ix+2) ld c,(ix+4) ld l,(ix+6) ld h,(ix+8) ld ix,respixel call swapgfxbk call drawbox jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/undrawr.asm0000644000175000017500000000120607267312342017753 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: undrawr.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ;Usage: undrawr(struct *pixels) XLIB undrawr LIB swapgfxbk XREF swapgfxbk1 LIB line_r LIB respixel .undrawr ld ix,0 add ix,sp ld e,(ix+2) ld d,(ix+3) ld l,(ix+4) ld h,(ix+5) ld ix,respixel call swapgfxbk call line_r jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/unplot.asm0000644000175000017500000000100007267312342017602 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: unplot.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ;Usage: plot(struct *pixel) XLIB unplot LIB swapgfxbk LIB respixel .unplot ld ix,0 add ix,sp ld l,(ix+2) ld h,(ix+4) call swapgfxbk call respixel jp swapgfxbk z88dk-1.8.ds1/libsrc/graphics/unused/0000755000175000017500000000000010765202715017072 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/unused/font.asm0000644000175000017500000000017307267312342020544 0ustar tygrystygrys; ; Font for the Z88 scr ; ; ; $Id: font.asm,v 1.2 2001/04/18 13:21:38 stefano Exp $ ; XLIB font INCLUDE "font.bin" z88dk-1.8.ds1/libsrc/graphics/unused/prfont.asm0000644000175000017500000000101707267312342021104 0ustar tygrystygrys; ; Print using 8x8 font to the Map ; ; ; $Id: prfont.asm,v 1.2 2001/04/18 13:21:38 stefano Exp $ ; XLIB mapchar LIB swapgfxbk XREF base_graphics ;Dump an 8x8 character to the screen ;Entry: hl=character address ; d=y ; e=x ;Each map row consists of 256 bytes, each character is unique so can just ;copy.. .mapchar call swapgfxbk ex de,hl ld a,l sla a sla a sla a ld l,a ld bc,(base_graphics) add hl,bc ex de,hl ldi ldi ldi ldi ldi ldi ldi ldi call swapgfxbk ret z88dk-1.8.ds1/libsrc/graphics/unused/sprite.asm0000644000175000017500000000114207267312342021101 0ustar tygrystygrys; ; Print using 8x8 font to the Map ; ; ; $Id: sprite.asm,v 1.2 2001/04/18 13:21:38 stefano Exp $ ; XLIB sprite LIB swapgfxbk XREF base_graphics ;Print a 16x16 sprite to the screen - sprites stored as characters.. ;Entry: hl=sprite address ; d=y ; e=x ;Each map row consists of 256 bytes, each character is unique so can just ;copy.. .sprite call swapgfxbk ex de,hl ld a,l sla a sla a sla a ld l,a ld bc,(base_graphics) add hl,bc ex de,hl ;hl=sprite, de=map address ld bc,16 ldir ex de,hl ld bc,256-16 add hl,bc ex de,hl ld bc,16 ldir call swapgfxbk ret z88dk-1.8.ds1/libsrc/graphics/vz200/0000755000175000017500000000000010765202715016450 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/vz200/bkrestore.asm0000644000175000017500000000223407457364561021167 0ustar tygrystygrys; ; Fast background restore ; ; VZ200/300 version ; ; ; $Id: bkrestore.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; XLIB bkrestore LIB pixeladdress .bkrestore ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix ld h,(ix+2) ; restore sprite position ld l,(ix+3) ld a,(ix+0) ld b,(ix+1) cp 9 jr nc,bkrestore ._sloop push bc push hl ld a,(ix+4) and @10101010 ld (hl),a inc hl ld a,(ix+4) and @01010101 rla ld (hl),a inc hl ld a,(ix+5) and @10101010 ld (hl),a inc hl ld a,(ix+5) and @01010101 rla ld (hl),a inc hl inc ix inc ix pop hl ld bc,32 ;Go to next line add hl,bc pop bc djnz _sloop ret .bkrestorew push bc ld a,(ix+4) and @10101010 ld (hl),a inc hl ld a,(ix+4) and @01010101 rla ld (hl),a inc hl ld a,(ix+5) and @10101010 ld (hl),a inc hl ld a,(ix+5) and @01010101 rla ld (hl),a inc hl ld a,(ix+6) and @10101010 ld (hl),a inc hl ld a,(ix+6) and @01010101 rla ld (hl),a inc ix inc ix inc ix pop hl ld bc,32 ;Go to next line add hl,bc pop bc djnz bkrestorew ret z88dk-1.8.ds1/libsrc/graphics/vz200/bksave.asm0000644000175000017500000000256607457364561020452 0ustar tygrystygrys; ; Fast background save ; ; VZ200/300 version ; ; ; $Id: bksave.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; XLIB bksave LIB pixeladdress .bksave ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords ld h,d ld l,e call pixeladdress xor 7 ld h,d ld l,e ld (ix+2),h ; we save the current sprite position ld (ix+3),l ld a,(ix+0) ld b,(ix+1) cp 9 jr nc,bksavew ._sloop push bc push hl ld a,(hl) and @10101010 ld (ix+4),a inc hl ld a,(hl) rra and @01010101 or (ix+4) ld (ix+4),a inc hl ld a,(hl) and @10101010 ld (ix+5),a inc hl ld a,(hl) rra and @01010101 or (ix+5) ld (ix+5),a inc hl inc ix inc ix pop hl ld bc,32 ;Go to next line add hl,bc pop bc djnz _sloop ret .bksavew push bc push hl ld a,(hl) and @10101010 ld (ix+4),a inc hl ld a,(hl) rra and @01010101 or (ix+4) ld (ix+4),a inc hl ld a,(hl) and @10101010 ld (ix+5),a inc hl ld a,(hl) rra and @01010101 or (ix+5) ld (ix+5),a inc hl ld a,(hl) and @10101010 ld (ix+6),a inc hl ld a,(hl) rra and @01010101 or (ix+6) ld (ix+6),a inc ix inc ix inc ix pop hl ld bc,32 ;Go to next line add hl,bc pop bc djnz bksavew ret z88dk-1.8.ds1/libsrc/graphics/vz200/clsgraph.asm0000644000175000017500000000135507736254620020767 0ustar tygrystygrys XLIB cleargraphics XREF base_graphics ; ; $Id: clsgraph.asm,v 1.3 2003/09/30 10:23:12 stefano Exp $ ; ; ****************************************************************** ; ; Clear graphics area, i.e. reset all bits and sets graphics mode ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ported by Stefano Bodrato ; ; Registers changed after return: ; a.bcdehl/ixiy same ; .f....../.... different ; .cleargraphics push bc push de push hl ld a,8 ld (6800h),a ; force graph mode ld hl,(base_graphics) ; base of graphics area ld (hl),0 ld d,h ld e,1 ; de = base_graphics+1 ld bc,128*64/4-1 ldir ; reset graphics window (2K) pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/graphics/vz200/gfxlist_vz0000644000175000017500000000036507130401723020566 0ustar tygrystygryscircle clg clga clrarea vz\clsgraph closegfx dcircle draw drawb drawr lbitmask lftscrol line liner lscroll vz\pixladdr plot plotpixl point pointxy rbitmask respixl rscroll vz\swapgfxbk uncircle undraw undrawb undrawr unplot window drawbox setxy z88dk-1.8.ds1/libsrc/graphics/vz200/pixladdr.asm0000644000175000017500000000153607457364561021002 0ustar tygrystygrys XLIB pixeladdress XREF base_graphics ; ; $Id: pixladdr.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; ; ****************************************************************** ; ; Get absolute pixel address in map of virtual (x,y) coordinate. ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; ****************************************************************** ; ; VZ200/300 version By Stefano Bodrato ; ; The VZ screen size is 128x64 ; We draw blue dots over green display (UGH!) ; ; .pixeladdress push hl ld a,h push af rra rra and @00111111 ld b,l ld hl,(base_graphics) ; pointer to base of graphics area ld l,a ld de,32 .adder add hl,de djnz adder ld d,h ld e,l pop af pop hl rla and @00000110 ; a = x mod 8 xor @00000111 ; a = 7 - a ret z88dk-1.8.ds1/libsrc/graphics/vz200/putsprite.asm0000644000175000017500000000677107457364561021240 0ustar tygrystygrys; ; Sprite Rendering Routine ; original code by Patrick Davidson (TI 85) ; modified by Stefano Bodrato - Jan 2001 ; ; VZ200/300 version ; ; ; $Id: putsprite.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; XLIB putsprite XREF cpygraph LIB pixeladdress ; coords: d,e (vert-horz) ; sprite: (ix) .offsets_table defb 128,64,32,16,8,4,2,1 .putsprite ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ;sprite address push de pop ix inc hl ld e,(hl) inc hl inc hl ld d,(hl) ; x and y coords inc hl inc hl ld a,(hl) ; and/or/xor mode ld (ortype+1),a ; Self modifying code ld (ortype2+1),a ; Self modifying code inc hl ld a,(hl) ld (ortype),a ; Self modifying code ld (ortype2),a ; Self modifying code ld h,d ld l,e call pixeladdress xor 7 ld hl,offsets_table ld c,a ld b,0 add hl,bc ld a,(hl) ld (wsmc1+1),a ld (wsmc2+1),a ld (_smc1+1),a ld h,d ld l,e ld a,(ix+0) cp 9 jr nc,putspritew ld d,(ix+0) ld b,(ix+1) ._oloop push bc ;Save # of rows push hl ;Save screen address ld b,d ;Load width ld c,(ix+2) ;Load one line of image inc ix ._smc1 ld a,1 ;Load pixel mask ._iloop sla c ;Test leftmost pixel jr nc,_noplot ;See if a plot is needed ld e,a .ortype nop ; changed into nop / cpl nop ; changed into and/or/xor (hl) ld (hl),a ld a,e ._noplot rrca rrca jr nc,_notedge ;Test if edge of byte reached inc hl ;Go to next byte ._notedge djnz _iloop pop hl ;Restore address ld bc,32 ;Go to next line add hl,bc pop bc ;Restore data djnz _oloop ret .putspritew ld d,(ix+0) ld b,(ix+1) .woloop push bc ;Save # of rows push hl ;Save screen address ld b,d ;Load width push de ld c,(ix+2) ;Load one line of image inc ix ld d,2 .wsmc1 ld a,1 .wiloop sla c ;Test leftmost pixel jr nc,wnoplot ;See if a plot is needed ld e,a .ortype2 nop ; changed into nop / cpl nop ; changed into and/or/xor (hl) ld (hl),a ld a,e .wnoplot rrca rrca jr nc,wnotedge ;Test if edge of byte reached inc hl ;Go to next byte .wnotedge .wsmc2 cp 1 jr nz,nowover_1 dec d jr z,wover_1 .nowover_1 djnz wiloop pop de pop hl ;Restore address ld bc,32 ;Go to next line add hl,bc pop bc ;Restore data djnz woloop ret .wover_1 ld c,(ix+2) inc ix djnz wiloop dec ix pop hl ld bc,32 add hl,bc pop bc djnz woloop ret z88dk-1.8.ds1/libsrc/graphics/vz200/swapgfxbk.asm0000644000175000017500000000067407267312342021156 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 15/10/98 ; ; ; Page the graphics bank in/out - used by all gfx functions ; Simply does a swap... ; ; ; $Id: swapgfxbk.asm,v 1.2 2001/04/18 13:21:38 stefano Exp $ ; XLIB swapgfxbk XDEF swapgfxbk1 .swapgfxbk .swapgfxbk1 ret z88dk-1.8.ds1/libsrc/graphics/window.asm0000644000175000017500000000553407267312342017610 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 30/9/98 ; ; ; $Id: window.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ; This function will open a window of any type (graphics/text) ; on the Z88 screen, graphics flag states gfx or text ; ;Usage: window(struct *windst) ; ;These are offset by 32 as per usual on a z88. ; ;struct window { ; char windnumber; ; char x; ; char y; ; char width; ; char depth; ; char type; ; char graphics; 0=text, 1=graphics ;} ; INCLUDE "graphics/grafix.inc" /* Contains fn defs */ INCLUDE "#stdio.def" INCLUDE "#map.def" INCLUDE "#screen.def" XLIB window XREF base_graphics XREF gfx_bank .window pop bc pop ix push ix push bc ;ix is address of struct.. ld a,(ix+graph) and a jr nz,opengfx ld hl,initwind call_oz(gn_sop) push ix pop hl call_oz(gn_sop) ld hl,0 ;All good, return NULL ret .initwind defb 1,'7','#',0 .opengfx ld l,(ix+wind_w) ld h,0 ld a,l and a ld a,(ix+windnum) ;window number ld bc,mp_def ;define map based on pipedream jr z,opengfx1 ld bc,mp_gra ;user width .opengfx1 call_oz(os_map) ;opened the window ld hl,1 ret c ;error, return TRUE ;Now get the address of the map ld b,0 ld hl,0 ; dummy address ld a,sc_hr0 call_oz(os_sci) ; get base address of map area (hires0) push bc push hl call_oz(os_sci) ; (and re-write original address) pop hl pop bc ;Page in the map page so it's always there..errkk! ; ld a,(map_bk) ; ld (oldozbank),a ld a,b ld (gfx_bank),a ; ld (map_bk),a ; out (map_bk-$400),a ld a,h and 63 ;mask to bank or map_seg ;mask to segment map_seg ld h,a ld (base_graphics),hl ld hl,0 ;NULL=good ret z88dk-1.8.ds1/libsrc/graphics/x11/0000755000175000017500000000000010765202715016200 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/x11/_xfindchar.c0000755000175000017500000000140610732671607020461 0ustar tygrystygrys/* Minimal Xlib port - Internal functions Return a pointer to the graphics definition of the given char (ASCII code - 32) Stefano Bodrato, 5/3/2007 $Id: _xfindchar.c,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #define _BUILDING_X #include char *_xfindchar (char c, char *font) { #asm pop de ; ret address pop hl ; char *font pop bc ; char c push bc push hl push de ld a,c and a jr z,gotchar next_char: ld a,(hl) and a jr nz,no_end ld hl,-1 ret no_end: inc hl dec a srl a srl a srl a ld b,a and a ; set flag ld a,(hl) inc hl ld e,a ld d,0 add hl,de ; flag is left unchanged jr z,noloop byteloop: add hl,de djnz byteloop noloop: dec c jr nz,next_char gotchar: #endasm } z88dk-1.8.ds1/libsrc/graphics/x11/_xfputc.c0000755000175000017500000000165610732671607020033 0ustar tygrystygrys/* Minimal Xlib port - Internal functions Proportional printing Stefano Bodrato, 5/3/2007 $Id: _xfputc.c,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #define _BUILDING_X #include #include void _xfputc (char c, char *font, Bool bold) { if (c==12) { clg(); _x_proportional = _y_proportional = 0; return; } if (c==13) { _x_proportional = 0; //_y_proportional += 8; // compact _y_proportional += 9; // normal line spacing return; } if ((_xchar_proportional = _xfindchar( (char) (c - 32), (char *) font)) == -1) return; if (_x_proportional + _xchar_proportional[0] >= DisplayWidth(0, 0)) _xfputc (13, font, bold); putsprite (SPR_OR, _x_proportional, _y_proportional, _xchar_proportional); if (bold) putsprite (SPR_OR, ++_x_proportional, _y_proportional, _xchar_proportional); _x_proportional += _xchar_proportional[0]; } z88dk-1.8.ds1/libsrc/graphics/x11/blackpixel.c0000755000175000017500000000035010732671607020467 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: blackpixel.c,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #define _BUILDING_X #include int BlackPixel(Display *display, int screen) { return 1; } z88dk-1.8.ds1/libsrc/graphics/x11/defaultdepth.c0000755000175000017500000000035510732671607021027 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: defaultdepth.c,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #define _BUILDING_X #include int DefaultDepth(Display *display,int screen) { return 2; } z88dk-1.8.ds1/libsrc/graphics/x11/defaultscreen.c0000755000175000017500000000034210732671607021176 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 6/3/2007 $Id: defaultscreen.c,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #define _BUILDING_X #include int DefaultScreen(Display *display) { return 1; } z88dk-1.8.ds1/libsrc/graphics/x11/displayheight.c0000755000175000017500000000043110732671607021207 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 6/3/2007 $Id: displayheight.c,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #define _BUILDING_X #include int DisplayHeight(Display *display,int screen) { #asm INCLUDE "../grafix.inc" ld hl,maxy #endasm } z88dk-1.8.ds1/libsrc/graphics/x11/displaywidth.c0000755000175000017500000000042710732671607021063 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 6/3/2007 $Id: displaywidth.c,v 1.1 2007/12/21 08:04:23 stefano Exp $ */ #define _BUILDING_X #include int DisplayWidth(Display *display,int screen) { #asm INCLUDE "../grafix.inc" ld hl,maxx #endasm } z88dk-1.8.ds1/libsrc/graphics/x11/Makefile0000755000175000017500000000034410763607667017661 0ustar tygrystygrys# # Makefile for X-Motif graphics emulation # # $Id: Makefile,v 1.2 2008/03/05 20:35:46 dom Exp $ include ../../Make.config all: zcc +test $(CFLAGS) *.c $(LIBLINKER) -x../../x11.lib @x11.lst clean: $(RM) *.o* zcc_opt.def z88dk-1.8.ds1/libsrc/graphics/x11/rootwindow.c0000755000175000017500000000034710732671610020564 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 6/3/2007 $Id: rootwindow.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include int RootWindow(Display *display,int screen) { return 1; } z88dk-1.8.ds1/libsrc/graphics/x11/whitepixel.c0000755000175000017500000000035010732671610020525 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: whitepixel.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include int WhitePixel(Display *display, int screen) { return 0; } z88dk-1.8.ds1/libsrc/graphics/x11/x11.lst0000755000175000017500000000077610732671610017350 0ustar tygrystygrysblackpixel defaultdepth defaultscreen displayheight displaywidth rootwindow whitepixel xchecktypedevent xcheckwindowevent xclearwindow xclosedisplay xcreatebitmapfromdata xcreategc xcreatesimplewindow xdestroywindow xdisplayname xdrawline xdrawpoint xdrawrectangle xdrawstring xflush xfreegc xloadqueryfont xmapwindow xnextevent xopendisplay xselectinput xsetdashes xsetfont xsetforeground xsetlineattributes xsetstandardproperties xtextwidth xunloadfont _xfindchar _xfputc z88dk-1.8.ds1/libsrc/graphics/x11/xchecktypedevent.c0000755000175000017500000000037310732671610021725 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xchecktypedevent.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include int XCheckTypedEvent(Display *display, int type, int event) { return 0; } z88dk-1.8.ds1/libsrc/graphics/x11/xcheckwindowevent.c0000755000175000017500000000040610732671610022104 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xcheckwindowevent.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include Bool XCheckWindowEvent(Display *display, Window win, int event_mask, int event) { } z88dk-1.8.ds1/libsrc/graphics/x11/xclearwindow.c0000755000175000017500000000100110732671610021043 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xclearwindow.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include #include void XClearWindow(Display *display, Drawable win, GC gc, int x, int y, int width, int height, Bool exposures) { struct _XWIN *mywin; mywin = (char *) win; // If "exposures" is set, an Expose event should be generated clga(mywin->a_x+x,mywin->a_y+y,width,height); if (exposures == True) _x_must_expose = 1; } z88dk-1.8.ds1/libsrc/graphics/x11/xclosedisplay.c0000755000175000017500000000032510732671610021230 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xclosedisplay.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include void XCloseDisplay(Display *display) { } z88dk-1.8.ds1/libsrc/graphics/x11/xcreatebitmapfromdata.c0000755000175000017500000000146710732671610022723 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xcreatebitmapfromdata.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include char _XBitmap[34]; // only space for an icon, for now Pixmap XCreateBitmapFromData(Display *display, Drawable win, char *bits, int width, int height) { char mychar; _XBitmap[0]=(char)width; _XBitmap[1]=(char)height; _X_int3 = width>>3; for (_X_int1=0; _X_int1 #endif #define _BUILDING_X #include GC Xcommon_mygc; struct GC *XCreateGC(Display *display, Drawable win, int valuemask, int values) { #ifdef _DEBUG_ printf (" CreateGC: %u ", Xcommon_mygc); #endif return Xcommon_mygc; } /* GC XCreateGC(display, d, valuemask, values) Display *display; Drawable d; unsigned long valuemask; XGCValues *values; */ z88dk-1.8.ds1/libsrc/graphics/x11/xcreatesimplewindow.c0000755000175000017500000000650610732671610022451 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xcreatesimplewindow.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define ALTGUI #define _BUILDING_X #include #include #define TITLE_AREA 9 #ifdef ALTGUI char topleft[] = { 4,4, 0x30, 0x40, 0x80, 0x80 }; char topleft_mask[] = { 4,4, 0x30, 0x70, 0xF0, 0xF0 }; char topright[] = { 4,4, 0xC0, 0x20, 0x10, 0x10 }; char topright_mask[] = { 4,4, 0xC0, 0xE0, 0xF0, 0xF0 }; char bottomleft[] = { 4,4, 0x80, 0x80, 0x40, 0x30 }; char bottomleft_mask[] = { 4,4, 0xF0, 0xF0, 0x70, 0x30 }; char bottomright[] = { 4,4, 0x10, 0x10, 0x20, 0xC0 }; char bottomright_mask[] = { 4,4, 0xF0, 0xF0, 0xE0, 0xC0 }; #endif struct _XWIN mywin; Window XCreateSimpleWindow(Display *display, Window rootwindow, int x, int y, int width, int height, int border_width, int forecolor, int backcolor) { width = width + 4; height = height + TITLE_AREA + 4; /* win->back=malloc( 4+(width/8+1 + (win->flags & WIN_SHADOW)) * (height+(win->flags & WIN_SHADOW)) ); sprintf(win->back, "%c%c",width+(win->flags & WIN_SHADOW),height+(win->flags & WIN_SHADOW) ); bksave(x,y,win->back); */ #ifdef ALTGUI if (border_width > 3) //if ((win->flags & WIN_SHADOW) > 0) { putsprite(spr_or,x+width-2,y+5,topright_mask); putsprite(spr_or,x+width-2,y+height-2,bottomright_mask); putsprite(spr_or,x+5,y+height-2,bottomleft_mask); for (_X_int1=-1; _X_int1<4; _X_int1++) { //horizontal shadow draw(x+9,y+height-1+_X_int1,x+width-3,y+height-1+_X_int1); //vertical shadow draw(x+width-1+_X_int1,y+9,x+width-1+_X_int1,y+height-3); } } clga(x, y+5, width, height-10); clga(x+5, y, width-10, height); putsprite(spr_mask,x+1,y+1,topleft_mask); putsprite(spr_or,x+1,y+1,topleft); putsprite(spr_mask,x+width-5,y+1,topright_mask); putsprite(spr_or,x+width-5,y+1,topright); putsprite(spr_mask,x+1,y+height-5,bottomleft_mask); putsprite(spr_or,x+1,y+height-5,bottomleft); putsprite(spr_mask,x+width-5,y+height-5,bottomright_mask); putsprite(spr_or,x+width-5,y+height-5,bottomright); draw(x+5,y,x+width-6,y); draw(x+5,y+height-1,x+width-6,y+height-1); draw(x,y+5,x,y+height-6); draw(x+width-1,y+5,x+width-1,y+height-6); //xorborder(x, y, width, height); //draw(x,y+5,x,y-10); //draw(x,y+5,x,y-10); #else if (border_width >= 1) mywin->full_width = width; if (border_width > 3) //if ((win->flags & WIN_SHADOW) > 0) { mywin->full_width = width + 4; for (_X_int1=1; _X_int1<4; _X_int1++) drawb (x+4,y+4,width-_X_int1,height-_X_int1); } clga(x, y, width, height); //if ((win->flags & WIN_BORDER) > 0) if (border_width >= 1) drawb(x, y, width, height); //if (border_width = 1) // xorborder(x, y, width, height); #endif //_X_int1=y + mywin->y_offset + 10; draw(x, y+TITLE_AREA, x + width, y+TITLE_AREA); mywin->x = x; mywin->y = y; mywin->width = width-4; mywin->height = height-TITLE_AREA-4; mywin->a_x = x+2; mywin->a_y = y+TITLE_AREA+2; mywin->full_height = height; return mywin; } z88dk-1.8.ds1/libsrc/graphics/x11/xdestroywindow.c0000755000175000017500000000034310732671610021456 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 14/3/2007 $Id: xdestroywindow.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include int XDestroyWindow(Display *display, Window win) { } z88dk-1.8.ds1/libsrc/graphics/x11/xdisplayname.c0000755000175000017500000000036210732671610021044 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xdisplayname.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include char *XDisplayName(char *display_name) { return ("127.0.0.1:0.0"); } z88dk-1.8.ds1/libsrc/graphics/x11/xdrawline.c0000755000175000017500000000061310732671610020342 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xdrawline.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include #include void XDrawLine(Display *display, Drawable win, GC gc, int x1, int y1, int x2, int y2) { struct _XWIN *mywin; mywin = (char *) win; draw(mywin->a_x+x1,mywin->a_y+y1,mywin->a_x+x2,mywin->a_y+y2); } z88dk-1.8.ds1/libsrc/graphics/x11/xdrawpoint.c0000755000175000017500000000053510732671610020547 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xdrawpoint.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include #include void XDrawPoint(Display *display, Drawable win, GC gc, int x, int y) { struct _XWIN *mywin; mywin = (char *) win; plot(mywin->a_x+x,mywin->a_y+y); } z88dk-1.8.ds1/libsrc/graphics/x11/xdrawrectangle.c0000755000175000017500000000061210732671610021356 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xdrawrectangle.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include #include void XDrawRectangle(Display *display, Drawable win, GC gc, int x, int y, int width, int height) { struct _XWIN *mywin; mywin = (char *) win; drawb(mywin->a_x+x,mywin->a_y+y,width,height); } z88dk-1.8.ds1/libsrc/graphics/x11/xdrawstring.c0000755000175000017500000000162210732671610020722 0ustar tygrystygrys/* Minimal Xlib port void XDrawString(int display, Drawable win, int gc, int x, int y, char *text, int textlen) Stefano Bodrato, 5/3/2007 $Id: xdrawstring.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include #ifdef _DEBUG_ #include #endif void XDrawString(Display *display, Drawable win, GC *gc, int x, int y, char *text, int textlen) { struct _XWIN *mywin; mywin = (char *) win; // ======= I have absolutely no idea on why this is necessary ! ======= gc = *gc; // ==================================================================== #ifdef _DEBUG_ printf (" Drawstring; pick in gc: %u ... ", gc); printf (" Font ptr: %u ", gc->values.font); #endif _x_proportional = mywin->a_x + x; _y_proportional = mywin->a_y + y; for (_X_int1=0; _X_int1values.font, False)); } z88dk-1.8.ds1/libsrc/graphics/x11/xflush.c0000755000175000017500000000030710732671610017656 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 14/3/2007 $Id: xflush.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include int XFlush(Display *display) { } z88dk-1.8.ds1/libsrc/graphics/x11/xfreegc.c0000755000175000017500000000032210732671610017765 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xfreegc.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include void XFreeGC(Display *display, GC gc) { } z88dk-1.8.ds1/libsrc/graphics/x11/xloadqueryfont.c0000755000175000017500000003451510732671610021441 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xloadqueryfont.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #ifdef _DEBUG_ #include #endif #define __HAVESEED #include #define _BUILDING_X #include char _Xsmallfont[] = { 3, 1, 0, 2, 6, 0x80 , 0x80 , 0x80 , 0x80 , 0x00 , 0x80 , 4, 2, 0xA0 , 0xA0 , 7, 6, 0x48 , 0xFC , 0x48 , 0x48 , 0xFC , 0x48 , 6, 6, 0x70 , 0xA0 , 0x70 , 0x28 , 0xF0 , 0x20 , 5, 5, 0x00 , 0x90 , 0x20 , 0x40 , 0x90 , 7, 6, 0x20 , 0x50 , 0x20 , 0x54 , 0x88 , 0x74 , 2, 2, 0x80 , 0x80 , 3, 6, 0x40 , 0x80 , 0x80 , 0x80 , 0x80 , 0x40 , 4, 6, 0x40 , 0x20 , 0x20 , 0x20 , 0x20 , 0x40 , 4, 5, 0x00 , 0x40 , 0xE0 , 0x40 , 0xA0 , 4, 4, 0x00 , 0x40 , 0xE0 , 0x40 , 3, 7, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x40 , 0x80 , 4, 3, 0x00 , 0x00 , 0xE0 , 2, 6, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x80 , 5, 5, 0x00 , 0x10 , 0x20 , 0x40 , 0x80 , // Numbers 5, 6, 0x60 , 0x90 , 0x90 , 0x90 , 0x90 , 0x60 , 4, 6, 0x40 , 0xC0 , 0x40 , 0x40 , 0x40 , 0xE0 , 5, 6, 0x60 , 0x90 , 0x10 , 0x60 , 0x80 , 0xF0 , 5, 6, 0x60 , 0x90 , 0x20 , 0x10 , 0x90 , 0x60 , 6, 6, 0x10 , 0x30 , 0x50 , 0x90 , 0xF8 , 0x10 , 5, 6, 0xF0 , 0x80 , 0xE0 , 0x10 , 0x90 , 0x60 , 5, 6, 0x70 , 0x80 , 0xE0 , 0x90 , 0x90 , 0x60 , 5, 6, 0xF0 , 0x10 , 0x20 , 0x20 , 0x40 , 0x40 , 5, 6, 0x60 , 0x90 , 0x60 , 0x90 , 0x90 , 0x60 , 5, 6, 0x60 , 0x90 , 0x90 , 0x70 , 0x10 , 0xE0 , // Symbols //2, 5, 0x00 , 0x80 , 0x00 , 0x00 , 0x80 , //3, 7, 0x00 , 0x40 , 0x00 , 0x00 , 0x00 , 0x40 , 0x80 , 2, 6, 0x00 , 0x00 , 0x80 , 0x00 , 0x00 , 0x80 , 3, 7, 0x00 , 0x00 , 0x40 , 0x00 , 0x00 , 0x40 , 0x80 , 4, 6, 0x00 , 0x20 , 0x40 , 0x80 , 0x40 , 0x20 , 4, 5, 0x00 , 0x00 , 0xE0 , 0x00 , 0xE0 , 4, 6, 0x00 , 0x80 , 0x40 , 0x20 , 0x40 , 0x80 , 5, 6, 0x60 , 0x90 , 0x20 , 0x40 , 0x00 , 0x40 , 7, 6, 0x78 , 0x84 , 0x34 , 0x54 , 0x54 , 0x38 , // Upper Case 5, 6, 0x60 , 0x90 , 0x90 , 0xF0 , 0x90 , 0x90 , 5, 6, 0xE0 , 0x90 , 0xE0 , 0x90 , 0x90 , 0xE0 , 5, 6, 0x70 , 0x80 , 0x80 , 0x80 , 0x80 , 0x70 , 5, 6, 0xC0 , 0xA0 , 0x90 , 0x90 , 0x90 , 0xE0 , 5, 6, 0xF0 , 0x80 , 0xE0 , 0x80 , 0x80 , 0xF0 , 5, 6, 0xF0 , 0x80 , 0xE0 , 0x80 , 0x80 , 0x80 , 5, 6, 0x70 , 0x80 , 0x80 , 0xB0 , 0x90 , 0x60 , 5, 6, 0x90 , 0x90 , 0xF0 , 0x90 , 0x90 , 0x90 , 4, 6, 0xE0 , 0x40 , 0x40 , 0x40 , 0x40 , 0xE0 , //2, 6, 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 5, 6, 0x10 , 0x10 , 0x10 , 0x90 , 0x90 , 0x60 , 5, 6, 0x90 , 0xA0 , 0xC0 , 0xA0 , 0x90 , 0x90 , 5, 6, 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0xF0 , 6, 6, 0x88 , 0xD8 , 0xA8 , 0x88 , 0x88 , 0x88 , //6, 6, 0x88 , 0xC8 , 0xA8 , 0x98 , 0x88 , 0x88 , 5, 6, 0x90 , 0xD0 , 0xB0 , 0x90 , 0x90 , 0x90 , 5, 6, 0x60 , 0x90 , 0x90 , 0x90 , 0x90 , 0x60 , 5, 6, 0xE0 , 0x90 , 0x90 , 0xE0 , 0x80 , 0x80 , 6, 6, 0x70 , 0x88 , 0x88 , 0xA8 , 0x90 , 0x68 , 5, 6, 0xE0 , 0x90 , 0x90 , 0xE0 , 0x90 , 0x90 , 5, 6, 0x60 , 0x80 , 0x60 , 0x10 , 0x10 , 0xE0 , 6, 6, 0xF8 , 0x20 , 0x20 , 0x20 , 0x20 , 0x20 , 5, 6, 0x90 , 0x90 , 0x90 , 0x90 , 0x90 , 0x60 , 6, 6, 0x88 , 0x88 , 0x50 , 0x50 , 0x20 , 0x20 , 8, 6, 0x82 , 0x82 , 0x54 , 0x54 , 0x28 , 0x28 , //6, 6, 0x88 , 0x50 , 0x20 , 0x20 , 0x50 , 0x88 , //6, 6, 0x88 , 0x50 , 0x20 , 0x20 , 0x40 , 0x80 , //6, 6, 0xF8 , 0x10 , 0x20 , 0x20 , 0x40 , 0xF8 , 5, 6, 0x90 , 0x90 , 0x20 , 0x40 , 0x90 , 0x90 , 5, 6, 0x90 , 0x90 , 0x50 , 0x20 , 0x40 , 0x80 , 5, 6, 0xF0 , 0x10 , 0x20 , 0x40 , 0x80 , 0xF0 , // Symbols 3, 6, 0xC0 , 0x80 , 0x80 , 0x80 , 0x80 , 0xC0 , 5, 5, 0x00 , 0x80 , 0x40 , 0x20 , 0x10 , 4, 6, 0x60 , 0x20 , 0x20 , 0x20 , 0x20 , 0x60 , 4, 2, 0x40 , 0xA0 , 4, 7, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xF0 , 3, 2, 0x80 , 0x40 , // Lower Case 3, 6, 0x00 , 0x00 , 0x80 , 0x40 , 0xC0 , 0xC0 , 4, 6, 0x80 , 0x80 , 0xC0 , 0xA0 , 0xA0 , 0x40 , 3, 6, 0x00 , 0x00 , 0x40 , 0x80 , 0x80 , 0x40 , 4, 6, 0x20 , 0x20 , 0x60 , 0xA0 , 0xA0 , 0x40 , 4, 6, 0x00 , 0x00 , 0x40 , 0xE0 , 0x80 , 0x40 , 3, 6, 0x40 , 0x80 , 0xC0 , 0x80 , 0x80 , 0x80 , 4, 7, 0x00 , 0x00 , 0x40 , 0xA0 , 0x60 , 0x20 , 0xC0 , 4, 6, 0x80 , 0x80 , 0x80 , 0xC0 , 0xA0 , 0xA0 , 2, 6, 0x00 , 0x80 , 0x00 , 0x80 , 0x80 , 0x80 , //3, 7, 0x00 , 0x00 , 0x40 , 0x00 , 0x40 , 0x40 , 0x80 , // smaller 'I' 3, 7, 0x00 , 0x40 , 0x00 , 0x40 , 0x40 , 0x40 , 0x80 , 4, 6, 0x80 , 0x80 , 0xA0 , 0xC0 , 0xA0 , 0xA0 , 2, 6, 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 6, 6, 0x00 , 0x00 , 0xD0 , 0xA8 , 0xA8 , 0xA8 , 4, 6, 0x00 , 0x00 , 0xC0 , 0xA0 , 0xA0 , 0xA0 , 4, 6, 0x00 , 0x00 , 0x40 , 0xA0 , 0xA0 , 0x40 , 4, 7, 0x00 , 0x00 , 0xC0 , 0xA0 , 0xC0 , 0x80 , 0x80 , 4, 7, 0x00 , 0x00 , 0x60 , 0xA0 , 0x60 , 0x20 , 0x20 , 4, 6, 0x00 , 0x00 , 0xC0 , 0xA0 , 0x80 , 0x80 , 4, 6, 0x00 , 0x00 , 0x60 , 0x80 , 0x20 , 0xC0 , 3, 6, 0x80 , 0xC0 , 0x80 , 0x80 , 0x80 , 0x40 , 4, 6, 0x00 , 0x00 , 0xA0 , 0xA0 , 0xA0 , 0x60 , 4, 6, 0x00 , 0x00 , 0xA0 , 0xA0 , 0x40 , 0x40 , 6, 6, 0x00 , 0x00 , 0x88 , 0x88 , 0xA8 , 0x50 , 4, 6, 0x00 , 0x00 , 0xA0 , 0x40 , 0x40 , 0xA0 , 5, 7, 0x00 , 0x00 , 0x90 , 0x50 , 0x20 , 0x40 , 0x80 , 4, 6, 0x00 , 0x00 , 0xE0 , 0x20 , 0x80 , 0xE0 , // Symbols 4, 6, 0x60 , 0x40 , 0x80 , 0x40 , 0x40 , 0x60 , 3, 6, 0x40 , 0x40 , 0x40 , 0x40 , 0x40 , 0x40 , 5, 6, 0x60 , 0x20 , 0x10 , 0x20 , 0x20 , 0x60 , 5, 2, 0x50 , 0xA0 , 0 }; char _Xmidfont[] = { 3, 1, 0, 2, 9, 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x00 , 0x00 , 0x80 , 4, 3, 0xA0 , 0xA0 , 0xA0 , 8, 8, 0x00 , 0x44 , 0xFE , 0x44 , 0x44 , 0x44 , 0xFE , 0x44 , 6, 9, 0x20 , 0x70 , 0xA0 , 0xA0 , 0x70 , 0x28 , 0x28 , 0xF0 , 0x20 , 8, 9, 0x00 , 0x44 , 0xA8 , 0x48 , 0x10 , 0x10 , 0x24 , 0x2A , 0x44 , 10, 9, 0x18 , 0x00 , 0x24 , 0x00 , 0x28 , 0x00 , 0x10 , 0x00 , 0x2C , 0x00 , 0x42 , 0x80 , 0x81 , 0x00 , 0x42 , 0x80 , 0x3C , 0x00, 2, 2, 0x80 , 0x80 , 5, 10, 0x30 , 0x40 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x40 , 0x30 , 6, 10, 0x60 , 0x10 , 0x08 , 0x08 , 0x08 , 0x08 , 0x08 , 0x08 , 0x10 , 0x60 , 8, 8, 0x00 , 0x44 , 0x28 , 0x10 , 0xFE , 0x10 , 0x28 , 0x44 , 8, 8, 0x00 , 0x10 , 0x10 , 0x10 , 0xFE , 0x10 , 0x10 , 0x10 , 4, 10, 0x00 , 0x00 , 0x00 , 0x00 , 0x0C , 0x00 , 0x00 , 0x40 , 0x40 , 0x80 , 7, 8, 0x00 , 0x00 , 0x00 , 0x00 , 0xFC , 0x00 , 0x00 , 0x00 , 3, 9, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x80 , 8, 8, 0x00 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 , // Numbers 7, 9, 0x38 , 0x44 , 0x84 , 0x84 , 0x84 , 0x84 , 0x84 , 0x84 , 0x78 , 5, 9, 0x20 , 0x60 , 0xA0 , 0x20 , 0x20 , 0x20 , 0x20 , 0x20 , 0x20 , 7, 9, 0x78 , 0x84 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 , 0xFC , 7, 9, 0x78 , 0x84 , 0x04 , 0x08 , 0x30 , 0x08 , 0x04 , 0x84 , 0x78 , 8, 9, 0x18 , 0x28 , 0x28 , 0x48 , 0x48 , 0x88 , 0xFE , 0x08 , 0x08 , 7, 9, 0xFC , 0x80 , 0x80 , 0xF8 , 0x04 , 0x04 , 0x04 , 0x84 , 0x78 , 7, 9, 0x3C , 0x40 , 0x80 , 0xB8 , 0xC4 , 0x84 , 0x84 , 0x84 , 0x78 , 7, 9, 0xFC , 0x04 , 0x08 , 0x08 , 0x10 , 0x10 , 0x20 , 0x20 , 0x40 , 7, 9, 0x38 , 0x44 , 0x84 , 0x84 , 0x78 , 0x84 , 0x84 , 0x84 , 0x78 , 7, 9, 0x38 , 0x44 , 0x84 , 0x84 , 0x7C , 0x04 , 0x04 , 0x84 , 0x78 , // Symbols 2, 8, 0x00 , 0x00 , 0x00 , 0x80 , 0x00 , 0x00 , 0x00 , 0x80 , 3, 9, 0x00 , 0x00 , 0x00 , 0x40 , 0x00 , 0x00 , 0x40 , 0x40 , 0x80 , 5, 8, 0x00 , 0x10 , 0x20 , 0x40 , 0x80 , 0x40 , 0x20 , 0x10 , 5, 7, 0x00 , 0x00 , 0xF0 , 0x00 , 0x00 , 0x00 , 0xF0 , 5, 8, 0x00 , 0x80 , 0x40 , 0x20 , 0x10 , 0x20 , 0x40 , 0x80 , 7, 9, 0x78 , 0x84 , 0x04 , 0x08 , 0x10 , 0x20 , 0x20 , 0x00 , 0x20 , 11, 9, 0x1E , 0x00 , 0x21 , 0x00 , 0x40 , 0x80 , 0x80 , 0x40 , 0x86 , 0x40 , 0x8A , 0x40 , 0x92 , 0x40 , 0x92 , 0x80 , 0x4F , 0x00 , // Upper Case 10, 9, 0x08 , 0x00 , 0x14 , 0x00 , 0x14 , 0x00 , 0x22 , 0x00 , 0x22 , 0x00 , 0x7F , 0x00 , 0x41 , 0x00 , 0x80 , 0x80 , 0x80 , 0x80 , 8, 9, 0xF8 , 0x84 , 0x82 , 0x82 , 0xFC , 0x82 , 0x82 , 0x82 , 0xFC , 8, 9, 0x3C , 0x42 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x42 , 0x3C , 8, 9, 0xF0 , 0x88 , 0x84 , 0x82 , 0x82 , 0x82 , 0x82 , 0x82 , 0xFC , 8, 9, 0xFE , 0x80 , 0x80 , 0x80 , 0xF0 , 0x80 , 0x80 , 0x80 , 0xFE , 8, 9, 0xFE , 0x80 , 0x80 , 0x80 , 0xF0 , 0x80 , 0x80 , 0x80 , 0x80 , 9, 9, 0x3C , 0x00 , 0x42 , 0x00 , 0x80 , 0x00 , 0x80 , 0x00 , 0x80 , 0x00 , 0x87 , 0x00 , 0x81 , 0x00 , 0x42 , 0x00 , 0x3C , 0x00 , 8, 9, 0x82 , 0x82 , 0x82 , 0x82 , 0xFE , 0x82 , 0x82 , 0x82 , 0x82 , 4, 9, 0xE0 , 0x40 , 0x40 , 0x40 , 0x40 , 0x40 , 0x40 , 0x40 , 0xE0 , 9, 9, 0x07 , 0x00 , 0x02 , 0x00 , 0x02 , 0x00 , 0x02 , 0x00 , 0x02 , 0x00 , 0x82 , 0x00 , 0x82 , 0x00 , 0x44 , 0x00 , 0x38 , 0x00 , 8, 9, 0x82 , 0x84 , 0x88 , 0x90 , 0xE0 , 0x90 , 0x88 , 0x84 , 0x82 , 8, 9, 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0xFE , 10, 9, 0x80 , 0x80 , 0xC1 , 0x80 , 0xA2 , 0x80 , 0x94 , 0x80 , 0x88 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 8, 9, 0x82 , 0xC2 , 0xA2 , 0x92 , 0x8A , 0x86 , 0x82 , 0x82 , 0x82 , 9, 9, 0x3C , 0x00 , 0x42 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x42 , 0x00 , 0x3C , 0x00 , 8, 9, 0xF8 , 0x84 , 0x82 , 0x82 , 0xFC , 0x80 , 0x80 , 0x80 , 0x80 , 9, 9, 0x3C , 0x00 , 0x42 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x99 , 0x00 , 0x85 , 0x00 , 0x42 , 0x00 , 0x3D , 0x00 , 8, 9, 0xF8 , 0x84 , 0x82 , 0x82 , 0xE4 , 0x98 , 0x84 , 0x82 , 0x82 , 8, 9, 0x7C , 0x80 , 0x80 , 0x78 , 0x04 , 0x02 , 0x02 , 0x04 , 0xF8 , 8, 9, 0xFE , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 9, 9, 0x81 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x81 , 0x00 , 0x42 , 0x00 , 0x3C , 0x00 , 10, 9, 0x80 , 0x80 , 0x80 , 0x80 , 0x41 , 0x00 , 0x41 , 0x00 , 0x22 , 0x00 , 0x22 , 0x00 , 0x14 , 0x00 , 0x14 , 0x00 , 0x08 , 0x00 , 14, 9, 0x80 , 0x08 , 0x80 , 0x08 , 0x45 , 0x10 , 0x45 , 0x10 , 0x22 , 0x20 , 0x22 , 0x20 , 0x15 , 0x40 , 0x15 , 0x40 , 0x08 , 0x80 , 10, 9, 0x80 , 0x80 , 0x41 , 0x00 , 0x22 , 0x00 , 0x14 , 0x00 , 0x08 , 0x00 , 0x14 , 0x00 , 0x22 , 0x00 , 0x41 , 0x00 , 0x80 , 0x80 , 10, 9, 0x80 , 0x80 , 0x41 , 0x00 , 0x22 , 0x00 , 0x14 , 0x00 , 0x08 , 0x00 , 0x10 , 0x00 , 0x20 , 0x00 , 0x40 , 0x00 , 0x80 , 0x00 , 10, 9, 0xFF , 0x80 , 0x01 , 0x00 , 0x02 , 0x00 , 0x04 , 0x00 , 0x08 , 0x00 , 0x10 , 0x00 , 0x20 , 0x00 , 0x40 , 0x00 , 0xFF , 0x80 , // Symbols 4, 10, 0xE0 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0xE0 , 11, 10, 0x80 , 0x00 , 0x40 , 0x00 , 0x20 , 0x00 , 0x10 , 0x00 , 0x08 , 0x00 , 0x04 , 0x00 , 0x02 , 0x00 , 0x01 , 0x00 , 0x00 , 0x80 , 0x00 , 0x40 , 5, 10, 0x70 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x70 , 6, 10, 0x20 , 0x50 , 0x88 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 7, 10, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xFE , 3, 8, 0x80 , 0x80 , 0x40 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , // Lower Case 6, 9, 0x00 , 0x00 , 0x00 , 0x70 , 0x08 , 0x68 , 0x88 , 0x88 , 0x78 , 6, 9, 0x80 , 0x80 , 0x80 , 0xB0 , 0xC8 , 0x88 , 0x88 , 0x88 , 0xF0 , 7, 9, 0x00 , 0x00 , 0x00 , 0x38 , 0x44 , 0x80 , 0x80 , 0x84 , 0x78 , 6, 9, 0x08 , 0x08 , 0x08 , 0x68 , 0x98 , 0x88 , 0x88 , 0x88 , 0x78 , 6, 9, 0x00 , 0x00 , 0x00 , 0x70 , 0x88 , 0x88 , 0xF0 , 0x80 , 0x78 , 4, 9, 0x60 , 0x80 , 0x80 , 0xC0 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 6, 12, 0x00 , 0x00 , 0x00 , 0x30 , 0x48 , 0x88 , 0x88 , 0x88 , 0x78 , 0x08 , 0x08 , 0x70 , 6, 9, 0x80 , 0x80 , 0x80 , 0xB0 , 0xC8 , 0x88 , 0x88 , 0x88 , 0x88 , 2, 9, 0x00 , 0x80 , 0x00 , 0xB0 , 0x88 , 0x88 , 0x88 , 0x88 , 0x88 , 4, 11, 0x20 , 0x00 , 0x00 , 0x20 , 0x20 , 0x20 , 0x20 , 0x20 , 0x20 , 0xA0 , 0x40 , 6, 9, 0x80 , 0x80 , 0x80 , 0x90 , 0xA0 , 0xC0 , 0xA0 , 0x90 , 0x88 , 2, 9, 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 10, 9, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xB3 , 0x00 , 0xCC , 0x80 , 0x88 , 0x80 , 0x88 , 0x80 , 0x88 , 0x80 , 0x88 , 0x80 , 6, 9, 0x00 , 0x00 , 0x00 , 0xB0 , 0xC8 , 0x88 , 0x88 , 0x88 , 0x88 , 7, 9, 0x00 , 0x00 , 0x00 , 0x38 , 0x44 , 0x84 , 0x84 , 0x84 , 0x78 , 6, 13, 0x00 , 0x00 , 0x00 , 0xB0 , 0xC8 , 0x88 , 0x88 , 0x88 , 0xF0 , 0x80 , 0x80 , 0x80 , 0x80 , 6, 13, 0x00 , 0x00 , 0x00 , 0x68 , 0x98 , 0x88 , 0x88 , 0x88 , 0x78 , 0x08 , 0x08 , 0x08 , 0x08 , 6, 9, 0x00 , 0x00 , 0x00 , 0xB0 , 0xC8 , 0x80 , 0x80 , 0x80 , 0x80 , 7, 9, 0x00 , 0x00 , 0x00 , 0x70 , 0x80 , 0x70 , 0x08 , 0x08 , 0xF0 , 4, 9, 0x80 , 0x80 , 0xE0 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x60 , 6, 9, 0x00 , 0x00 , 0x00 , 0x88 , 0x88 , 0x88 , 0x88 , 0x98 , 0x68 , 6, 9, 0x00 , 0x00 , 0x00 , 0x88 , 0x88 , 0x88 , 0x50 , 0x50 , 0x20 , 10, 9, 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x80 , 0x80 , 0x80 , 0x80 , 0x88 , 0x80 , 0x49 , 0x00 , 0x55 , 0x00 , 0x22 , 0x00 , 7, 9, 0x00 , 0x00 , 0x00 , 0x84 , 0x48 , 0x20 , 0x10 , 0x48 , 0x84 , 7, 9, 0x00 , 0x00 , 0x00 , 0x84 , 0x48 , 0x50 , 0x20 , 0x40 , 0x80 , 7, 9, 0x00 , 0x00 , 0x00 , 0xFC , 0x08 , 0x10 , 0x20 , 0x40 , 0xFC , // Symbols 5, 11, 0x30 , 0x40 , 0x40 , 0x20 , 0x20 , 0xC0 , 0x20 , 0x20 , 0x40 , 0x40 , 0x30 , 2, 10, 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 0x80 , 6, 11, 0x60 , 0x10 , 0x10 , 0x20 , 0x20 , 0x18 , 0x20 , 0x20 , 0x10 , 0x10 , 0x60 , 7, 10, 0x00 , 0x64 , 0x98 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 24, 25, 0x00 , 0x00 , 0x00 , 0x0F , 0xFF , 0xF0 , 0x08 , 0x00 , 0x10 , 0x0F , 0xFF , 0xF0 , 0x02 , 0x00 , 0x40 , 0x02 , 0x00 , 0x40 , 0x02 , 0x8A , 0xC0 , 0x01 , 0x55 , 0x80 , 0x01 , 0xAA , 0x80 , 0x00 , 0xD5 , 0x00 , 0x00 , 0x6A , 0x00 , 0x00 , 0x34 , 0x00 , 0x00 , 0x2C , 0x00 , 0x00 , 0x34 , 0x00 , 0x00 , 0x42 , 0x00 , 0x00 , 0x91 , 0x00 , 0x01 , 0x00 , 0x80 , 0x01 , 0x10 , 0x80 , 0x02 , 0x00 , 0x40 , 0x02 , 0x10 , 0x40 , 0x02 , 0x28 , 0x40 , 0x0F , 0xFF , 0xF0, 0 }; /* Ultra simplified font mgmt - we have 2 fonts only for every request only ASCII-7 characters are supported. */ XFontStruct Xcommon_myfont; XFontStruct XLoadQueryFont(Display *display, char *fontname) { int fsize; fsize = atoi(fontname); //XFontStruct *myfont; //printf (".. %u ..", XFontStruct->fid); //printf (".. %u ..", sizeof (myfont)); //myfont = malloc (sizeof (struct XFontStruct)); //if (myfont == 0) return (NULL); if ( fsize >= 12 ) { Xcommon_myfont->fid = _Xmidfont; Xcommon_myfont->max_bounds.ascent = 0; Xcommon_myfont->max_bounds.descent = fsize + 3; } else { Xcommon_myfont->fid = _Xsmallfont; Xcommon_myfont->max_bounds.ascent = 0; Xcommon_myfont->max_bounds.descent = fsize + 3; } #ifdef _DEBUG_ printf (" LoadQueryFont:%u ", Xcommon_myfont->fid); #endif return Xcommon_myfont; } /* Font XLoadFont(int display, char *name) { } */ z88dk-1.8.ds1/libsrc/graphics/x11/xmapwindow.c0000755000175000017500000000033710732671610020545 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xmapwindow.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include void XMapWindow(Display *display, Window win) { } z88dk-1.8.ds1/libsrc/graphics/x11/xnextevent.c0000755000175000017500000000057210732671610020561 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 15/3/2007 $Id: xnextevent.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include #include void XNextEvent(Display *display, int *event) { if (_x_must_expose == 1) { _x_must_expose = 0; *event = Expose; return; } if (getk() != 0) *event = KeyPress; } z88dk-1.8.ds1/libsrc/graphics/x11/xopendisplay.c0000755000175000017500000000041510732671610021064 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xopendisplay.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include #include struct _XDisplay*XOpenDisplay(char *display_name) { clg(); return 1; } z88dk-1.8.ds1/libsrc/graphics/x11/xselectinput.c0000755000175000017500000000036110732671610021074 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xselectinput.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include void XSelectInput(Display *display, Window win, int event_mask) { } z88dk-1.8.ds1/libsrc/graphics/x11/xsetdashes.c0000755000175000017500000000041110732671610020514 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xsetdashes.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include void XSetDashes(Display *display, GC gc, int dash_offset, int dash_list, int list_length) { } z88dk-1.8.ds1/libsrc/graphics/x11/xsetfont.c0000755000175000017500000000071510732671610020222 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xsetfont.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #ifdef _DEBUG_ #include #endif #define _BUILDING_X #include void XSetFont(Display *display, GC mygc, Font font) { //GC mygc; //*mygc=*gc; mygc->values.font = font; #ifdef _DEBUG_ printf (" Setting font: %u in GC %u ", font, mygc); printf (" Font set: %u ", mygc->values.font); #endif } z88dk-1.8.ds1/libsrc/graphics/x11/xsetforeground.c0000755000175000017500000000035310732671610021424 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 6/3/2007 $Id: xsetforeground.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include void XSetForeground(Display *display, GC gc, int color) { } z88dk-1.8.ds1/libsrc/graphics/x11/xsetlineattributes.c0000755000175000017500000000044710732671610022314 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 6/3/2007 $Id: xsetlineattributes.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include void XSetLineAttributes(Display *display, GC gc, int line_width, int line_style, int cap_style, int join_style) { } z88dk-1.8.ds1/libsrc/graphics/x11/xsetstandardproperties.c0000755000175000017500000000171410732671610023171 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 14/3/2007 $Id: xsetstandardproperties.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include #include extern char *_Xsmallfont; void XSetStandardProperties(Display *display, Window win, char *window_name, char *icon_name, char *icon_pixmap, char *argv, int argc, int size_hints) { struct _XWIN *mywin; mywin = (char *) win; mywin->title = window_name; mywin->icon = icon_pixmap; _x_proportional = mywin->x + 8; _y_proportional = mywin->y + 2; for (_X_int1=0; (window_name[_X_int1] != 0 ) && (_x_proportional < (mywin->a_x + mywin->width)); _xfputc(window_name[_X_int1++], &_Xsmallfont, True)); if (icon_pixmap != NULL) { //Limit icon size if (icon_pixmap[1]>9) icon_pixmap[1]=9; // We suppose we have a small icon (16x16) putsprite (SPR_OR, mywin->x + mywin->width - 2 - icon_pixmap[0], mywin->y, icon_pixmap); } } z88dk-1.8.ds1/libsrc/graphics/x11/xtextwidth.c0000755000175000017500000000112710732671610020562 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xtextwidth.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #ifdef _DEBUG_ #include #endif #define _BUILDING_X #include int XTextWidth(XFontStruct *font_struct, char *string, int count) { #ifdef _DEBUG_ printf (" Using font %u - ",font_struct->fid); #endif _X_int2=0; for (_X_int1=0; _X_int1fid)) != -1) _X_int2 = _X_int2 + _xchar_proportional[0]; } return _X_int2; } z88dk-1.8.ds1/libsrc/graphics/x11/xunloadfont.c0000755000175000017500000000040310732671610020703 0ustar tygrystygrys/* Minimal Xlib port Stefano Bodrato, 5/3/2007 $Id: xunloadfont.c,v 1.1 2007/12/21 08:04:24 stefano Exp $ */ #define _BUILDING_X #include #include void XUnloadFont(Display *display, Font font) { //free(font); } z88dk-1.8.ds1/libsrc/graphics/xorborder.asm0000644000175000017500000000174307452557764020324 0ustar tygrystygrys XLIB xorborder LIB xorpixel LIB swapgfxbk XREF swapgfxbk1 ; ; $Id: xorborder.asm,v 1.3 2002/04/03 10:56:52 stefano Exp $ ; ; *********************************************************************** ; ; XORs a dotted box. Useful for GUIs. ; Generic version ; ; Stefano Bodrato - March 2002 ; ; ; IN: HL = (x,y) ; BC = (width,heigth) ; .xorborder call swapgfxbk ld ix,0 add ix,sp ld c,(ix+2) ld b,(ix+4) ld l,(ix+6) ld h,(ix+8) push bc push hl ; -- Vertical lines -- push hl ld a,h add a,b ret c ; overflow ? dec a ld h,a pop de .rowloop push bc inc l ex de,hl push hl push de call xorpixel pop de pop hl inc l pop bc dec c jr nz,rowloop pop hl pop bc ; -- Horizontal lines -- push hl ld a,l add a,c ret c ; overflow ? dec a ld l,a pop de .vrowloop push bc push hl push de call xorpixel pop de pop hl inc h ex de,hl inc h pop bc djnz vrowloop jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/xorpixl.asm0000644000175000017500000000210507450562472020002 0ustar tygrystygrys INCLUDE "graphics/grafix.inc" XLIB xorpixel LIB pixeladdress XREF COORDS ; ; $Id: xorpixl.asm,v 1.3 2002/03/28 09:41:14 stefano Exp $ ; ; ****************************************************************** ; ; Plot pixel at (x,y) coordinate. ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; The (0,0) origin is placed at the bottom left corner. ; ; in: hl = (x,y) coordinate of pixel (h,l) ; ; registers changed after return: ; ..bc..../ixiy same ; af..dehl/.... different ; ; ****************************************************************** ; ; XOR added by Stefano Bodrato (Feb 2001) ; ; ************** ; .xorpixel ld a,l cp 64 ret nc ; y0 out of range ld (COORDS),hl ld a,l IF forZ88 ; xor @00111111 ; (0,0) is hardware (0,63) ENDIF IF forVZ ; xor @00111111 ; (0,0) is hardware (0,63) ENDIF push bc ld l,a call pixeladdress ld b,a ld a,1 jr z, xor_pixel ; pixel is at bit 0... .plot_position rlca djnz plot_position .xor_pixel ex de,hl xor (hl) ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/xorpixl_smc.asm0000755000175000017500000000053110547236116020642 0ustar tygrystygrys; ; Generic graphics routines ; Self modifying code version ; ; Stefano Bodrato - 4/1/2007 ; ; ; Invert pixel at (x,y) coordinate. ; ; ; $Id: xorpixl_smc.asm,v 1.1 2007/01/04 17:41:34 stefano Exp $ ; XLIB xorpixel LIB pixel XREF pixmode .xorpixel push hl ld hl,174 ; XOR (HL) ld (pixmode),hl pop hl jp pixel z88dk-1.8.ds1/libsrc/graphics/xorplot.asm0000644000175000017500000000067707450562472020020 0ustar tygrystygrys; ; Z88DK Graphics Functions - Small C+ stubs ; ; $Id: xorplot.asm,v 1.1 2002/03/28 09:41:14 stefano Exp $ ; ;Usage: xorplot(struct *pixel) XLIB xorplot LIB swapgfxbk LIB swapgfxbk1 LIB xorpixel .xorplot ld ix,0 add ix,sp ld l,(ix+2) ld h,(ix+4) call swapgfxbk call xorpixel jp swapgfxbk1 z88dk-1.8.ds1/libsrc/graphics/z88/0000755000175000017500000000000010765202715016220 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/z88/clrarea.asm0000644000175000017500000000632507450562472020347 0ustar tygrystygrys xlib cleararea lib pixeladdress lib leftbitmask, rightbitmask ; ; $Id: clrarea.asm,v 1.1 2002/03/28 09:41:14 stefano Exp $ ; ; *********************************************************************** ; ; Clear specified graphics area in map. ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; ; IN: HL = (x,y) ; BC = (width,heigth) ; ; Variables on stack; ix pointer to base of variables: ; ; (ix+0) y ; (ix+1) height ; (ix+2,3) adr0 ; ; (ix+4) bitmask0 bitmask for leftmost byte of pixel row ; (ix+5) bitmask1 bitmask for rightmost byte of pixel row ; (ix+6) rowbytes number of bytes in pixel row to clear ; ; OUT: None. (graphics area is scrolled) ; ; Registers changed after return: ; ......../IXIY same ; AFBCDEHL/.... different ; .cleararea push ix push iy ld de,0 ex de,hl add hl,sp ex de,hl ld ix,-7 add ix,sp ; ix points at base of variables ld sp,ix ; local variable area created push de ; remember pointer to original ix, iy ld (ix+0),l ; remember y ld (ix+1),c ; remember height push bc call PixelAddress ; adr0, bitpos0 = PixelAddress(x,y) ld (ix+2),e ld (ix+3),d call leftbitmask ld (ix+4),a ; bitmask0 = LeftBitMask(bitpos0) pop bc ld a,h add a,b dec a ld h,a push de call PixelAddress ; adr1, bitpos1 = PixelAddress(x+width-1,y) call rightbitmask ld (ix+5),a ; bitmask1 = LeftBitMask(bitpos0) pop hl ex de,hl cp a sbc hl,de ; (adr1-adr0) srl l srl l srl l ld (ix+6),l ; rowbytes = (adr1-adr0) div 8, no. of bytes in row ; 0 means that area is within same address ; FOR h = 1 TO height .clear_height ld l,(ix+2) ld h,(ix+3) ; offset = adr0 xor a cp (ix+6) ; if rowbytes = 0 jr nz, clear_row ; area is within one byte... ld a,(hl) and (ix+4) ; preserve bits of leftmost side of byte ld b,a ld a,(hl) and (ix+5) ld c,a xor a ; clear byte or b ; merge preserved bits of left side or c ; merge preserve bits of right side ld (hl),a ; (offset) = byte jr clear_nextrow ; else .clear_row ; clear area is defined as rows of bytes ld a,(hl) and (ix+4) ; preserve only leftmost bits (outside of area) ld (hl),a ; (offset) = (offset) AND bitmask0 ld bc,8 add hl,bc ; offset += 8 ld b,(ix+6) ; r = rowbytes dec b ; --r jr z, row_cleared ; if ( r ) .clear_row_loop push bc ; do ld (hl),0 ; (offset) = 0 ld bc,8 add hl,bc ; offset += 8 pop bc djnz clear_row_loop ; while ( r-- != 0 ) .row_cleared ld a,(hl) ; byte = (adr1) and (ix+5) ld (hl),a ; preserve only rightmost side of byte (outside area) .clear_nextrow inc (ix+0) ; inc y ld a,(ix+0) and @00000111 ; if y MOD 8 <> 0 jr z, clear_newline inc (ix+2) ; inc adr0 jr clear_next_h ; else .clear_newline ld a,(ix+2) add a,256-7 ld (ix+2),a inc (ix+3) ; adr0 += 256 (address of start of row) .clear_next_h dec (ix+1) ; END FOR h jp nz, clear_height .end_cleararea pop hl ld sp,hl ; pointer to original ix, iy pop iy pop ix ret z88dk-1.8.ds1/libsrc/graphics/z88/pixladdr.asm0000644000175000017500000000212607267312342020533 0ustar tygrystygrys XLIB pixeladdress XREF base_graphics ; ; $Id: pixladdr.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ; ****************************************************************** ; ; Get absolute pixel address in map of virtual (x,y) coordinate. ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; in: hl = (x,y) coordinate of pixel (h,l) ; ; out: de = address of pixel byte ; a = bit number of byte where pixel is to be placed ; fz = 1 if bit number is 0 of pixel position ; ; registers changed after return: ; ......hl/ixiy same ; afbcde../.... different ; .pixeladdress ld b,l srl b srl b srl b ; linedist = y div 8 * 256 ld a,h and @11111000 ; rowdist = x div 8 * 8 ld c,a ; bc = linedist + rowdist ld a,l and @00000111 ; coldist = y mod 8 ld de,(base_graphics) ; pointer to base of graphics area ld e,a ; coldist = graphicsarea + coldist ld a,h ex de,hl add hl,bc ; bytepos = linedist + rowdist + coldist ex de,hl and @00000111 ; a = x mod 8 xor @00000111 ; a = 7 - a ret ENDIF z88dk-1.8.ds1/libsrc/graphics/z88/swapgfxbk.asm0000644000175000017500000000153207425077444020727 0ustar tygrystygrys; ; Z88 Graphics Functions - Small C+ stubs ; ; Written around the Interlogic Standard Library ; ; Stubs Written by D Morris - 15/10/98 ; ; ; Page the graphics bank in/out - used by all gfx functions ; Simply does a swap... ; ; $Id: swapgfxbk.asm,v 1.4 2002/01/27 22:28:52 dom Exp $ ; XLIB swapgfxbk XREF gfx_bank XDEF swapgfxbk1 INCLUDE "graphics/grafix.inc" .swapgfxbk .swapgfxbk1 push hl push de ld hl,map_bk ;$4Dx ld e,(hl) ld a,(gfx_bank) ;in crt0 ld (hl),a out (map_bk-$400),a ld a,e ld (gfx_bank),a pop de pop hl ret z88dk-1.8.ds1/libsrc/graphics/zx81/0000755000175000017500000000000010765202715016401 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/zx81/clg.asm0000755000175000017500000000050110701245014017634 0ustar tygrystygrys XLIB clg ; ; $Id: clg.asm,v 1.2 2007/10/04 20:16:12 stefano Exp $ ; ; ****************************************************************** ; ; Clear graphics area, ; ; In text mode we can just happily call the ROM ; ; Registers changed after return: ; a.bcdehl/ixiy same ; .f....../.... different ; .clg jp 2602 z88dk-1.8.ds1/libsrc/graphics/zx81/clsgraph.asm0000644000175000017500000000100507267312342020703 0ustar tygrystygrys XLIB cleargraphics XREF base_graphics ; ; $Id: clsgraph.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $ ; ; ****************************************************************** ; ; Clear graphics area, i.e. reset all bits in graphics ; window (256x64 pixels) ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; Registers changed after return: ; a.bcdehl/ixiy same ; .f....../.... different ; .cleargraphics push bc push de push hl call 2602 pop hl pop de pop bc ret z88dk-1.8.ds1/libsrc/graphics/zx81/hr/0000755000175000017500000000000010765202715017012 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/graphics/zx81/hr/clg.asm0000755000175000017500000000070610701245014020254 0ustar tygrystygrys;-------------------------------------------------------------- ; This code comes from the 'HRG_Tool' ; by Matthias Swatosch ;-------------------------------------------------------------- ; ; Fast CLS for hi-rez ZX81 ; ; Stefano - Sept.2007 ; This version works on the first 64 lines only ; ; ; $Id: clg.asm,v 1.2 2007/10/04 20:16:12 stefano Exp $ ; XLIB clg LIB _clg_hr .clg jp _clg_hrz88dk-1.8.ds1/libsrc/graphics/zx81/hr/pixladdr.asm0000755000175000017500000000211310701140137021310 0ustar tygrystygrys;-------------------------------------------------------------- ; Part of this code comes from the 'HRG_Tool' ; by Matthias Swatosch ;-------------------------------------------------------------- XLIB pixeladdress XREF base_graphics ; ; $Id: pixladdr.asm,v 1.1 2007/10/04 10:28:47 stefano Exp $ ; ; ****************************************************************** ; ; Get absolute pixel address in map of virtual (x,y) coordinate. ; ; in: hl = (x,y) coordinate of pixel (h,l) ; ; out: de = address of pixel byte ; a = bit number of byte where pixel is to be placed ; fz = 1 if bit number is 0 of pixel position ; ; registers changed after return: ; ......hl/ixiy same ; afbcde../.... different ; .pixeladdress push hl ; add y-times the nuber of bytes per line (32) ; or just multiply y by 32 and the add ld d,0 ld e,l ld c,h or a rl e rl d or a rl e rl d or a rl e rl d or a rl e rl d or a rl e rl d ld hl,(base_graphics) add hl,de ; add x divided by 8 or a srl c srl c srl c ld b,0 add hl,bc ex de,hl pop hl ld a,h and 7 xor 7 ret z88dk-1.8.ds1/libsrc/graphics/zx81/plotpixl.asm0000644000175000017500000000256310701140137020751 0ustar tygrystygrys XLIB plotpixel XREF COORDS ; ; $Id: plotpixl.asm,v 1.8 2007/10/04 10:28:47 stefano Exp $ ; ; ****************************************************************** ; ; Plot pixel at (x,y) coordinate. ; ; ZX 81 version. ; 64x48 dots. ; ; .plotpixel ld a,h cp 64 ret nc ld a,l ;cp maxy cp 48 ret nc ; y0 out of range ld (COORDS),hl push bc ld c,l ld b,h push bc srl b srl c ld hl,(16396) inc hl ld a,c ld c,b ; !! ld de,33 ; 32+1. Every text line ends with an HALT and a jr z,r_zero ld b,a .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol cp 8 jr c,islow ; recode graph symbol to binary -> 0..F ld a,143 sub (hl) .islow ex (sp),hl ; save char address <=> restore x,y cp 16 ; Just to be sure: jr c,issym ; if it isn't a symbol... xor a ; .. force to blank sym .issym ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow or b cp 8 ; Now back from binary to jr c,hisym ; graph symbols. ld b,a ld a,15 sub b add a,128 .hisym pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/zx81/pointxy.asm0000755000175000017500000000233310701140137020606 0ustar tygrystygrys XLIB pointxy XREF COORDS ; ; $Id: pointxy.asm,v 1.1 2007/10/04 10:28:47 stefano Exp $ ; ; ****************************************************************** ; ; Get pixel at (x,y) coordinate. ; ; ZX 81 version. ; 64x48 dots. ; ; .pointxy ld a,h cp 64 ret nc ld a,l ;cp maxy cp 48 ret nc ; y0 out of range ld (COORDS),hl push bc ld c,l ld b,h ;push bc srl b srl c ld hl,(16396) inc hl ld a,c ld c,b ; !! ld de,33 ; 32+1. Every text line ends with an HALT and a jr z,r_zero ld b,a .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol cp 8 jr c,islow ; recode graph symbol to binary -> 0..F ld a,143 sub (hl) .islow ex (sp),hl ; save char address <=> restore x,y cp 16 ; Just to be sure: jr c,issym ; if it isn't a symbol... xor a ; .. force to blank sym .issym ld b,a ld a,1 ; the bit we want to draw bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow and b pop bc ret z88dk-1.8.ds1/libsrc/graphics/zx81/respixl.asm0000644000175000017500000000260610701140137020562 0ustar tygrystygrys XLIB respixel XREF COORDS ; ; $Id: respixl.asm,v 1.4 2007/10/04 10:28:47 stefano Exp $ ; ; ****************************************************************** ; ; Clears pixel at (x,y) coordinate. ; ; ZX 81 version. ; 64x48 dots. ; ; .respixel ld a,h cp 64 ret nc ld a,l ;cp maxy cp 48 ret nc ; y0 out of range ld (COORDS),hl push bc ld c,l ld b,h push bc srl b srl c ld hl,(16396) inc hl ;ld a,b ld a,c ld c,b ; !! ld de,33 ; 32+1. Every text line ends with an HALT and a jr z,r_zero ld b,a .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol cp 8 jr c,islow ; recode graph symbol to binary -> 0..F ld a,143 sub (hl) .islow ex (sp),hl ; save char address <=> restore x,y cp 16 ; Just to be sure: jr c,issym ; if it isn't a symbol... xor a ; .. force to blank sym .issym ld b,a ld a,1 ; the bit we want to clear bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow cpl and b cp 8 ; Now back from binary to jr c,hisym ; graph symbols. ld b,a ld a,15 sub b add a,128 .hisym pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/graphics/zx81/swapgfxbk.asm0000644000175000017500000000063710701140137021072 0ustar tygrystygrys; ; ZX81 Graphics Functions - Small C+ stubs ; ; ZX 81 version By Stefano Bodrato ; ; $Id: swapgfxbk.asm,v 1.7 2007/10/04 10:28:47 stefano Exp $ ; XLIB swapgfxbk XDEF swapgfxbk1 ;XREF save81 ;XREF restore81 .swapgfxbk ;jp $2E7 ;setfast ret ;jp save81 .swapgfxbk1 ; This will become IY when swapped ! ld ix,16384 ;jp $207 ret ;jp restore81 z88dk-1.8.ds1/libsrc/graphics/zx81/xorpixl.asm0000644000175000017500000000257210701140137020603 0ustar tygrystygrys XLIB xorpixel XREF COORDS ; ; $Id: xorpixl.asm,v 1.4 2007/10/04 10:28:47 stefano Exp $ ; ; ****************************************************************** ; ; XORs pixel at (x,y) coordinate. ; ; ZX 81 version. ; 64x48 dots. ; .xorpixel ld a,h cp 64 ret nc ld a,l ;cp maxy cp 48 ret nc ; y0 out of range ld (COORDS),hl push bc ld c,l ld b,h push bc srl b srl c ld hl,(16396) inc hl ;ld a,b ld a,c ld c,b ; !! ld de,33 ; 32+1. Every text line ends with an HALT and a jr z,r_zero ld b,a .r_loop add hl,de djnz r_loop .r_zero ; hl = char address ld e,c add hl,de ld a,(hl) ; get current symbol cp 8 jr c,islow ; recode graph symbol to binary -> 0..F ld a,143 sub (hl) .islow ex (sp),hl ; save char address <=> restore x,y cp 16 ; Just to be sure: jr c,issym ; if it isn't a symbol... xor a ; .. force to blank sym .issym ld b,a ld a,1 ; the bit we want to XOR bit 0,h jr z,iseven add a,a ; move right the bit .iseven bit 0,l jr z,evenrow add a,a add a,a ; move down the bit .evenrow xor b cp 8 ; Now back from binary to jr c,hisym ; graph symbols. ld b,a ld a,15 sub b add a,128 .hisym pop hl ld (hl),a pop bc ret z88dk-1.8.ds1/libsrc/im2/0000755000175000017500000000000010765202715014456 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/im2/im2.lst0000644000175000017500000000045410756163330015673 0ustar tygrystygrysim2_CreateGenericISR im2_CreateGenericISR_callee im2_CreateGenericISRLight im2_CreateGenericISRLight_callee im2_EmptyISR im2_Init im2_InstallISR im2_InstallISR_callee im2_RegHookFirst im2_RegHookFirst_callee im2_RegHookLast im2_RegHookLast_callee im2_RemoveHook im2_RemoveHook_callee IM2CreateCommon z88dk-1.8.ds1/libsrc/im2/im2_CreateGenericISR.asm0000644000175000017500000000047110577177144021017 0ustar tygrystygrys; CALLER linkage for function pointers XLIB im2_CreateGenericISR LIB im2_CreateGenericISR_callee XREF ASMDISP_IM2_CREATEGENERICISR_CALLEE .im2_CreateGenericISR pop hl pop de pop bc push bc push de push hl ld a,c jp im2_CreateGenericISR_callee + ASMDISP_IM2_CREATEGENERICISR_CALLEE z88dk-1.8.ds1/libsrc/im2/im2_CreateGenericISR_callee.asm0000644000175000017500000000220410577177144022320 0ustar tygrystygrys; void __CALLEE__ *im2_CreateGenericISR_callee(uchar numhooks, void *addr) ; 04.2004 aralbrec XLIB im2_CreateGenericISR_callee XDEF ASMDISP_IM2_CREATEGENERICISR_CALLEE LIB IM2CreateCommon .im2_CreateGenericISR_callee pop hl pop de pop bc push hl ld a,c .asmentry ; enter: a = maximum number of hooks ; de = RAM address to copy ISR to ; exit : hl = address just past ISR ; uses : af, bc, de, hl .IM2CreateGenericISR ld hl,GenericISR jp IM2CreateCommon .GenericISR call pushreg .position ld bc,runhooks-position add hl,bc call runhooks jp popreg .runhooks ld e,(hl) inc hl ld d,(hl) inc hl ld a,d or e ret z push hl ex de,hl call JPHL pop hl ret c jp runhooks .popreg pop iy pop ix pop hl pop de pop bc pop af exx ex af,af' pop de pop bc pop af pop hl ei reti .pushreg ex (sp),hl push af push bc push de exx ex af,af' push af push bc push de push hl push ix push iy exx .JPHL jp (hl) DEFC ASMDISP_IM2_CREATEGENERICISR_CALLEE = asmentry - im2_CreateGenericISR_callee z88dk-1.8.ds1/libsrc/im2/im2_CreateGenericISRLight.asm0000644000175000017500000000052410577177144022006 0ustar tygrystygrys; CALLER linkage for function pointers XLIB im2_CreateGenericISRLight LIB im2_CreateGenericISRLight_callee XREF ASMDISP_IM2_CREATEGENERICISRLIGHT_CALLEE .im2_CreateGenericISRLight pop hl pop de pop bc push bc push de push hl ld a,c jp im2_CreateGenericISRLight_callee + ASMDISP_IM2_CREATEGENERICISRLIGHT_CALLEE z88dk-1.8.ds1/libsrc/im2/im2_CreateGenericISRLight_callee.asm0000644000175000017500000000200710577177144023311 0ustar tygrystygrys; void __CALLEE__ *im2_CreateGenericISRLight_callee(uchar numhooks, void *addr) ; 10.2005 aralbrec XLIB im2_CreateGenericISRLight_callee XDEF ASMDISP_IM2_CREATEGENERICISRLIGHT_CALLEE LIB IM2CreateCommon .im2_CreateGenericISRLight_callee pop hl pop de pop bc push hl ld a,c .asmentry ; enter: a = maximum number of hooks ; de = RAM address to copy ISR to ; exit : hl = address just past ISR ; uses : af, bc, de, hl .IM2CreateGenericISRLight ld hl,GenericISRLight jp IM2CreateCommon .GenericISRLight call pushreg .position ld bc,runhooks-position add hl,bc call runhooks jp popreg .runhooks ld e,(hl) inc hl ld d,(hl) inc hl ld a,d or e ret z push hl ex de,hl call JPHL pop hl ret c jp runhooks .popreg pop de pop bc pop af pop hl ei reti .pushreg ex (sp),hl push af push bc push de .JPHL jp (hl) DEFC ASMDISP_IM2_CREATEGENERICISRLIGHT_CALLEE = asmentry - im2_CreateGenericISRLight_callee z88dk-1.8.ds1/libsrc/im2/im2_EmptyISR.asm0000644000175000017500000000022410302466571017400 0ustar tygrystygrys; 04.2004 aralbrec XLIB im2_EmptyISR ; A do-nothing ISR routine that can be used as the ; default when initializing. .im2_EmptyISR ei reti z88dk-1.8.ds1/libsrc/im2/im2_Init.asm0000644000175000017500000000027310756163330016633 0ustar tygrystygrys; void __FASTCALL__ im2_Init_callee(void *tableaddr) ; 04.2004, 02.2008 aralbrec XLIB im2_Init .im2_Init ; enter : hl = address of im2 vector table ld a,h ld i,a im 2 ret z88dk-1.8.ds1/libsrc/im2/im2_InstallISR.asm0000644000175000017500000000041310553131576017712 0ustar tygrystygrys; CALLER linkage for function pointers XLIB im2_InstallISR LIB im2_InstallISR_callee XREF ASMDISP_IM2_INSTALLISR_CALLEE .im2_InstallISR pop af pop de pop hl push hl push de push af jp im2_InstallISR_callee + ASMDISP_IM2_INSTALLISR_CALLEE z88dk-1.8.ds1/libsrc/im2/im2_InstallISR_callee.asm0000644000175000017500000000106410577177144021231 0ustar tygrystygrys; void __CALLEE__ *im2_InstallISR_callee(uchar vector, void *isr) ; 04.2004 aralbrec XLIB im2_InstallISR_callee XDEF ASMDISP_IM2_INSTALLISR_CALLEE .im2_InstallISR_callee pop hl pop de ex (sp),hl .asmentry ; enter: l = vector to install on (even by convention) ; de = new ISR address ; exit : hl = old ISR address ; uses : af, de, hl .IM2InstallISR ld a,i ld h,a ld a,(hl) ld (hl),e ld e,a inc hl ld a,(hl) ld (hl),d ld d,a ex de,hl ret DEFC ASMDISP_IM2_INSTALLISR_CALLEE = asmentry - im2_InstallISR_callee z88dk-1.8.ds1/libsrc/im2/im2_RegHookFirst.asm0000644000175000017500000000042410553131576020276 0ustar tygrystygrys; CALLER linkage for function pointers XLIB im2_RegHookFirst LIB im2_RegHookFirst_callee XREF ASMDISP_IM2_REGHOOKFIRST_CALLEE .im2_RegHookFirst pop bc pop de pop hl push hl push de push bc jp im2_RegHookFirst_callee + ASMDISP_IM2_REGHOOKFIRST_CALLEE z88dk-1.8.ds1/libsrc/im2/im2_RegHookFirst_callee.asm0000644000175000017500000000160110577177144021610 0ustar tygrystygrys; void __CALLEE__ im2_RegHookFirst_callee(uchar vector, void *hook) ; 04.2004 aralbrec XLIB im2_RegHookFirst_callee XDEF ASMDISP_IM2_REGHOOKFIRST_CALLEE XREF _im2_hookDisp .im2_RegHookFirst_callee pop hl pop de ex (sp),hl .asmentry ; enter: de = address of hook (subroutine) ; l = interrupt vector where generic ISR is installed ; used : af, bc, de, hl .IM2RegHookFirst ld a,i ld h,a ld c,(hl) inc hl ld b,(hl) ld hl,_im2_hookDisp - 1 add hl,bc ; hl points at hooks list-1 .loop inc hl ld c,(hl) ld (hl),e inc hl ld a,(hl) ; ac = old first hook ld (hl),d ; insert new first hook ld d,a or c ret z ; if old==NULL, done insertion ld e,c ; de = old hook = new hook to insert jp loop DEFC ASMDISP_IM2_REGHOOKFIRST_CALLEE = asmentry - im2_RegHookFirst_callee z88dk-1.8.ds1/libsrc/im2/im2_RegHookLast.asm0000644000175000017500000000041610553131576020113 0ustar tygrystygrys; CALLER linkage for function pointers XLIB im2_RegHookLast LIB im2_RegHookLast_callee XREF ASMDISP_IM2_REGHOOKLAST_CALLEE .im2_RegHookLast pop bc pop de pop hl push hl push de push bc jp im2_RegHookLast_callee + ASMDISP_IM2_REGHOOKLAST_CALLEE z88dk-1.8.ds1/libsrc/im2/im2_RegHookLast_callee.asm0000644000175000017500000000133610577177144021431 0ustar tygrystygrys; void __CALLEE__ im2_RegHookLast_callee(uchar vector, void *hook) ; 04.2004 aralbrec XLIB im2_RegHookLast_callee XDEF ASMDISP_IM2_REGHOOKLAST_CALLEE XREF _im2_hookDisp .im2_RegHookLast_callee pop hl pop de ex (sp),hl .asmentry ; enter: de = address of hook (subroutine) ; l = interrupt vector where Generic ISR is installed ; used : af, bc, hl .IM2RegHookLast ld a,i ld h,a ld c,(hl) inc hl ld b,(hl) ld hl,_im2_hookDisp - 1 add hl,bc ; hl points at hooks list-1 .loop inc hl ld a,(hl) inc hl or (hl) jp nz, loop ld (hl),d ; found empty slot dec hl ld (hl),e ret DEFC ASMDISP_IM2_REGHOOKLAST_CALLEE = asmentry - im2_RegHookLast_callee z88dk-1.8.ds1/libsrc/im2/im2_RemoveHook.asm0000644000175000017500000000040310553132326017775 0ustar tygrystygrys; CALLER linkage for function pointers XLIB im2_RemoveHook LIB im2_RemoveHook_callee XREF ASMDISP_REMOVEHOOK_CALLEE .im2_RemoveHook pop bc pop de pop hl push hl push de push bc jp im2_RemoveHook_callee + ASMDISP_REMOVEHOOK_CALLEE z88dk-1.8.ds1/libsrc/im2/im2_RemoveHook_callee.asm0000644000175000017500000000055610577177144021330 0ustar tygrystygrys; int __CALLEE__ im2_RemoveHook_callee(uchar vector, void *hook) ; 04.2004 aralbrec XLIB im2_RemoveHook_callee XDEF ASMDISP_IM2_REMOVEHOOK_CALLEE LIB IM2RemoveHook .im2_RemoveHook_callee pop hl pop de ex (sp),hl .asmentry call IM2RemoveHook ld hl,0 ret nc inc l ret DEFC ASMDISP_IM2_REMOVEHOOK_CALLEE = asmentry - im2_RemoveHook_callee z88dk-1.8.ds1/libsrc/im2/IM2CreateCommon.asm0000644000175000017500000000036210553132326020040 0ustar tygrystygrys XLIB IM2CreateCommon XDEF _im2_hookDisp .IM2CreateCommon ld bc,_im2_hookDisp ldir add a,a inc a ld c,a ld l,e ld h,d inc de ld (hl),0 ldir ex de,hl ret DEFC _im2_hookDisp = 13 ; runhooks - GenericISR z88dk-1.8.ds1/libsrc/im2/IM2RemoveHook.asm0000644000175000017500000000145110553132326017542 0ustar tygrystygrys ; 04.2004 aralbrec XLIB IM2RemoveHook XREF _im2_hookDisp ; enter: de = address of hook (subroutine) ; l = interrupt vector where Generic ISR is installed ; used : af, bc, de, hl ; exit : carry = hook found and removed ; no carry = hook not found .IM2RemoveHook ld a,i ld h,a ld c,(hl) inc hl ld b,(hl) ld hl,_im2_hookDisp - 1 add hl,bc ; hl points at hooks list-1 .search inc hl ld c,(hl) inc hl ld b,(hl) ; bc = a hook address ld a,b or c ret z ; ret nc, failed to find it ld a,c cp e jp nz, search ld a,b cp d jp nz, search ld e,l ; found hook so remove it ld d,h dec de inc hl .remove ld a,(hl) ldi or (hl) ldi jp nz, remove scf ret z88dk-1.8.ds1/libsrc/im2/Makefile0000644000175000017500000000027110630724403016110 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../Make.config all: $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/im2 @im2.lst clean: $(RM) *.o* *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/input/0000755000175000017500000000000010765202715015126 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/input/cpc/0000755000175000017500000000000010765202715015673 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/input/cpc.lst0000644000175000017500000000000010601045536016400 0ustar tygrystygrysz88dk-1.8.ds1/libsrc/input/Makefile0000644000175000017500000000026410762337674016602 0ustar tygrystygrys# # Makefile for platform specific input routines # # $Id: Makefile,v 1.2 2008/03/01 20:42:36 aralbrec Exp $ include ../Make.config clean: $(RM) spectrum/*.o* $(RM) zx81/*.o* z88dk-1.8.ds1/libsrc/input/README0000644000175000017500000000066010316364526016011 0ustar tygrystygrysThese functions are machine-dependent and are therefore compiled into each target machine's standard library. The lst files here list all functions for each machine but the contents of these files are copied into the machine-specific lst files found in the libsrc directory. Eg: spectrum.lst lists the functions implemented for the ZX spectrum target. Its contents are copied into zx.lst and zxansi.lst in the libsrc directory. z88dk-1.8.ds1/libsrc/input/spectrum/0000755000175000017500000000000010765202715016770 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/input/spectrum/in_GetKey.asm0000644000175000017500000000263710601045536021353 0ustar tygrystygrys; uint in_GetKey(void) ; 09.2005 aralbrec ; Scans the keyboard and returns an ascii code representing a ; single keypress. Operates as a state machine. First ; it debounces a key by ignoring it until a minimum time ; "_in_KeyDebounce" (byte) has passed. The key will be registered ; and then it will wait until the key has been pressed for a period ; "_in_KeyStartRepeat" (byte). The key will again be registered and ; then repeated thereafter with period "_in_KeyRepeatPeriod" (byte). ; If more than one key is pressed, no key is registered and the ; state machine returns to the debounce state. Time intervals ; depend on how often GetKey is called. XLIB in_GetKey LIB in_Inkey, in_GetKeyReset XREF _in_KeyDebounce, _in_KeyStartRepeat, _in_KeyRepeatPeriod XREF _in_KbdState ; exit : carry = no key registered (and HL=0) ; else HL = ascii code of key pressed ; uses : AF,BC,DE,HL .in_GetKey call in_Inkey ; hl = ascii code & carry if no key jp c, in_GetKeyReset ld a,(_in_KbdState) dec a jr nz, nokey ld a,(_in_KbdState + 1) dec a jp m, debounce jp z, startrepeat .repeat ld a,(_in_KeyRepeatPeriod) ld (_in_KbdState),a ret .debounce ld a,(_in_KeyStartRepeat) ld e,a ld d,1 ld (_in_KbdState),de ret .startrepeat ld a,(_in_KeyRepeatPeriod) ld e,a ld d,2 ld (_in_KbdState),de ret .nokey ld (_in_KbdState),a ld hl,0 scf ret z88dk-1.8.ds1/libsrc/input/spectrum/in_GetKeyReset.asm0000644000175000017500000000030510316364526022352 0ustar tygrystygrys; void in_GetKeyReset(void) ; 09.2005 aralbrec XLIB in_GetKeyReset XREF _in_KeyDebounce, _in_KbdState .in_GetKeyReset ld a,(_in_KeyDebounce) ld e,a ld d,0 ld (_in_KbdState),de ret z88dk-1.8.ds1/libsrc/input/spectrum/in_Inkey.asm0000644000175000017500000000311410601045536021231 0ustar tygrystygrys; uint in_Inkey(void) ; 09.2005 aralbrec ; Read current state of keyboard but only return ; keypress if a single key is pressed. XLIB in_Inkey LIB in_keytranstbl ; exit : carry set and HL = 0 for no keys registered ; else HL = ASCII character code ; uses : AF,BC,DE,HL .in_Inkey ld de,0 ld bc,$fefe in a,(c) or $e1 cp $ff jr nz, keyhitA ld e,5 ld b,$fd in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,10 ld b,$fb in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,15 ld b,$f7 in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,20 ld b,$ef in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,25 ld b,$df in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,30 ld b,$bf in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,35 ld b,$7f in a,(c) or $e2 cp $ff ld c,a jr nz, keyhitB .nokey ld hl,0 scf ret .keyhitA ld c,a ld a,b cpl or $81 in a,($fe) or $e0 cp $ff jr nz, nokey ld a,$7f in a,($fe) or $e2 cp $ff jr nz, nokey .keyhitB ld b,0 ld hl,rowtbl-$e0 add hl,bc ld a,(hl) cp 5 jr nc, nokey add a,e ld e,a ld hl,in_keytranstbl add hl,de ld a,$fe in a,($fe) and $01 jr nz, nocaps ld e,40 add hl,de .nocaps ld a,$7f in a,($fe) and $02 jr nz, nosym ld e,80 add hl,de .nosym ld l,(hl) ld h,0 ret .rowtbl defb 255,255,255,255,255,255,255 defb 255,255,255,255,255,255,255,255 defb 4,255,255,255,255,255,255 defb 255,3,255,255,255,2,255,1 defb 0,255 z88dk-1.8.ds1/libsrc/input/spectrum/in_JoyFuller.asm0000644000175000017500000000027510323327434022073 0ustar tygrystygrys; uint in_JoyFuller(void) ; 2002 aralbrec XLIB in_JoyFuller ; exit : A = HL= F000RLDU active high ; uses : AF,HL .in_JoyFuller in a,($7f) cpl and $8f ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/input/spectrum/in_JoyKempston.asm0000644000175000017500000000070410601045536022436 0ustar tygrystygrys; uint in_JoyKempston(void) ; 2002 aralbrec XLIB in_JoyKempston ; exit : HL = F000RLDU active high ; uses : AF,DE,HL .in_JoyKempston in a,($1f) cpl and $1f ld e,a ld d,0 ld hl,kemptbl add hl,de ld l,(hl) ld h,d ret .kemptbl defb $8f,$87,$8b,$83 defb $82,$8a,$86,$8e defb $81,$89,$85,$8d defb $8c,$84,$88,$80 defb $0f,$07,$0b,$03 defb $0d,$05,$09,$01 defb $0e,$06,$0a,$02 defb $02,$04,$08,$00 z88dk-1.8.ds1/libsrc/input/spectrum/in_JoyKeyboard.asm0000644000175000017500000000143410763607673022416 0ustar tygrystygrys; uint __FASTCALL__ in_JoyKeyboard(struct in_UDK *) ; 2002 aralbrec XLIB in_JoyKeyboard .in_JoyKeyboard ; enter : HL = struct in_UDK *, a 10-byte table containing 5 scan ; codes for fire,right,left,down,up in that order ; exit : HL = F000RLDU active high ; uses : AF,DE,HL ld de,0 ld a,(hl) in a,($fe) inc hl and (hl) jr nz, nofire set 7,e .nofire inc hl ld a,(hl) in a,($fe) inc hl and (hl) jr nz, noright set 3,e .noright inc hl ld a,(hl) in a,($fe) inc hl and (hl) jr nz, noleft set 2,e .noleft inc hl ld a,(hl) in a,($fe) inc hl and (hl) jr nz, nodown set 1,e .nodown inc hl ld a,(hl) in a,($fe) inc hl and (hl) jr nz, noup set 0,e .noup ex de,hl ret z88dk-1.8.ds1/libsrc/input/spectrum/in_JoySinclair1.asm0000644000175000017500000000071410323327434022465 0ustar tygrystygrys; uint in_JoySinclair1(void) ; 2002 aralbrec XLIB in_JoySinclair1 ; exit : HL = F000RLDU active high ; uses : AF,DE,HL .in_JoySinclair1 ld a,$ef in a,($fe) and $1f ld e,a ld d,0 ld hl,sinc1tbl add hl,de ld l,(hl) ld h,d ret .sinc1tbl defb $8f,$0f,$8e,$0e defb $8d,$0d,$8c,$0c defb $87,$07,$86,$06 defb $85,$05,$84,$04 defb $8b,$0b,$8a,$0a defb $89,$09,$88,$08 defb $83,$03,$82,$02 defb $81,$01,$80,$00 z88dk-1.8.ds1/libsrc/input/spectrum/in_JoySinclair2.asm0000644000175000017500000000071410323327434022466 0ustar tygrystygrys; uint in_JoySinclair2(void) ; 2002 aralbrec XLIB in_JoySinclair2 ; exit : HL = F000RLDU active high ; uses : AF,DE,HL .in_JoySinclair2 ld a,$f7 in a,($fe) and $1f ld e,a ld d,0 ld hl,sinc2tbl add hl,de ld l,(hl) ld h,d ret .sinc2tbl defb $8f,$8b,$87,$83 defb $8d,$89,$85,$81 defb $8e,$8a,$86,$82 defb $8c,$88,$84,$80 defb $0f,$0b,$07,$03 defb $0d,$09,$05,$01 defb $0e,$0a,$06,$02 defb $0c,$08,$04,$00 z88dk-1.8.ds1/libsrc/input/spectrum/in_JoyTimex1.asm0000644000175000017500000000155010323327434022006 0ustar tygrystygrys; uint in_JoyTimex1(void) ; 2002 aralbrec XLIB in_JoyTimex1 ; exit : A = HL = F000RLDU active high ; uses : AF,HL ; WARNING: farts around with the AY registers -- might ; conflict with an AY sound routine in an interrupt - ; haven't decided what to do about this yet. If you ; have an AY player in an interrupt you can either ; disable interrupts while reading Timex joysticks ; (and risk missing a beat) or sync joystick reads ; with interrupts, eg by putting joystick reads ; into the interrupt routine. .in_JoyTimex1 ld a,7 out ($f5),a ; select R7 on AY chip in a,($f6) ; read R7 and $bf ; bit 6 = 0 selects i/o port A read out ($f6),a ld a,14 out ($f5),a ; select R14, attached to i/o port A ld a,2 ; left joystick in a,($f6) cpl and $8f ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/input/spectrum/in_JoyTimex2.asm0000644000175000017500000000155110323327434022010 0ustar tygrystygrys; uint in_JoyTimex2(void) ; 2002 aralbrec XLIB in_JoyTimex2 ; exit : A = HL = F000RLDU active high ; uses : AF,HL ; WARNING: farts around with the AY registers -- might ; conflict with an AY sound routine in an interrupt - ; haven't decided what to do about this yet. If you ; have an AY player in an interrupt you can either ; disable interrupts while reading Timex joysticks ; (and risk missing a beat) or sync joystick reads ; with interrupts, eg by putting joystick reads ; into the interrupt routine. .in_JoyTimex2 ld a,7 out ($f5),a ; select R7 on AY chip in a,($f6) ; read R7 and $bf ; bit 6 = 0 selects i/o port A read out ($f6),a ld a,14 out ($f5),a ; select R14, attached to i/o port A ld a,1 ; right joystick in a,($f6) cpl and $8f ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/input/spectrum/in_KeyPressed.asm0000644000175000017500000000141310316364526022236 0ustar tygrystygrys; uint in_KeyPressed(uint scancode) ; 09.2005 aralbrec XLIB in_KeyPressed ; Determines if a key is pressed using the scan code ; returned by in_LookupKey. ; enter : l = scan row ; h = key mask ; exit : carry = key is pressed & HL = 1 ; no carry = key not pressed & HL = 0 ; used : AF,BC,HL .in_KeyPressed bit 7,h jp z, nocaps ld a,$fe ; check on CAPS key in a,($fe) and $01 jr nz, fail ; CAPS not pressed .nocaps bit 6,h jp z, nosym ld a,$7f ; check on SYM SHIFT in a,($fe) and $02 jr nz, fail ; SYM not pressed .nosym ld a,h and $1f ld b,l ld c,$fe in b,(c) and b jr nz, fail ; key not pressed ld hl,1 scf ret .fail ld hl,0 ret z88dk-1.8.ds1/libsrc/input/spectrum/in_keytranstbl.asm0000644000175000017500000000405010316364526022522 0ustar tygrystygrys ; This table translates key presses into ascii codes. ; Also used by 'GetKey' and 'LookupKey'. An effort has been made for ; this key translation table to emulate a PC keyboard with the 'CTRL' ; key represented by CAPS SHIFT + SYM SHIFT. XLIB in_keytranstbl .in_keytranstbl defb 255,'z','x','c','v' ; CAPS SHIFT, Z, X, C, V defb 'a','s','d','f','g' ; A, S, D, F, G defb 'q','w','e','r','t' ; Q, W, E, R, T defb '1','2','3','4','5' ; 1, 2, 3, 4, 5 defb '0','9','8','7','6' ; 0, 9, 8, 7, 6 defb 'p','o','i','u','y' ; P, O, I, U, Y defb 13,'l','k','j','h' ; ENTER, L, K, J, H defb ' ',255,'m','n','b' ; SPACE, SYM SHIFT, M, N, B ; the following are CAPS SHIFTed defb 255,'Z','X','C','V' ; CAPS SHIFT, Z, X, C, V defb 'A','S','D','F','G' ; A, S, D, F, G defb 'Q','W','E','R','T' ; Q, W, E, R, T defb 7,0,128,129,8 ; 1, 2, 3, 4, 5 defb 12,8,9,11,10 ; 0, 9, 8, 7, 6 defb 'P','O','I','U','Y' ; P, O, I, U, Y defb 13,'L','K','J','H' ; ENTER, L, K, J, H defb ' ',255,'M','N','B' ; SPACE, SYM SHIFT, M, N, B ; the following are SYM SHIFTed defb 255,':',96,'?','/' ; CAPS SHIFT, Z, X, C, V defb '~','|',92,'{','}' ; A, S, D, F, G defb 131,132,133,'<','>' ; Q, W, E, R, T defb '!','@','#','$','%' ; 1, 2, 3, 4, 5 defb '_',')','(',39,'&' ; 0, 9, 8, 7, 6 defb 34,';',130,']','[' ; P, O, I, U, Y defb 13,'=','+','-','^' ; ENTER, L, K, J, H defb ' ',255,'.',',','*' ; SPACE, SYM SHIFT, M, N, B ; the following are CAPS SHIFTed and SYM SHIFTed ("CTRL" key) defb 255,26,24,3,22 ; CAPS SHIFT, Z, X, C, V defb 1,19,4,6,7 ; A, S, D, F, G defb 17,23,5,18,20 ; Q, W, E, R, T defb 27,28,29,30,31 ; 1, 2, 3, 4, 5 defb 127,255,134,'`',135 ; 0, 9, 8, 7, 6 defb 16,15,9,21,25 ; P, O, I, U, Y defb 13,12,11,10,8 ; ENTER, L, K, J, H defb ' ',255,13,14,2 ; SPACE, SYM SHIFT, M, N, B z88dk-1.8.ds1/libsrc/input/spectrum/in_LookupKey.asm0000644000175000017500000000305710603602504022076 0ustar tygrystygrys; uint in_LookupKey(uchar c) ; 09.2005 aralbrec XLIB in_LookupKey LIB in_keytranstbl ; Given the ascii code of a character, returns the scan row and mask ; corresponding to the key that needs to be pressed to generate the ; character. Eg: Calling LookupKey with character 'a' will return ; '$fd' for key row and '$01' for the mask. You could then check to ; see if the key is pressed with the following bit of code: ; ; ld a,$fd ; in a,($fe) ; and $01 ; jr z, a_is_pressed ; ; The mask returned will have bit 7 set and bit 6 set to ; indicate if CAPS, SYM SHIFTS also have to be pressed to generate the ; ascii code, respectively. ; enter: L = ascii character code ; exit : carry set & HL=0 if ascii code not found ; else: L = scan row, H = mask ; bit 7 of H set if CAPS needs to be pressed ; bit 6 of H set if SYM SHIFT needs to be pressed ; uses : AF,BC,HL ; The 16-bit value returned is a scan code understood by ; in_KeyPressed. .in_LookupKey ld a,l ld hl,in_keytranstbl ld bc,160 cpir jr nz, notfound ld a,159 sub c ; A = position in table of ascii code ld l,b ld h,b cp 80 jr c, nosymshift sub 80 set 6,h .nosymshift cp 40 jr c, nocapshift sub 40 set 7,h .nocapshift .div5loop inc b sub 5 jp nc, div5loop .donedivide add a,6 ; A = bit position + 1, B = row + 1 ld l,$7f .rowlp rlc l djnz rowlp ld b,a ld a,$80 .masklp rlca djnz masklp or h ld h,a ret .notfound ld hl,0 scf ret z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseAMX.asm0000644000175000017500000000055310601045536021614 0ustar tygrystygrys; void in_MouseAMX(uchar *buttons, uint *xcoord, uint *ycoord) ; CALLER linkage for function pointers XLIB in_MouseAMX LIB INMouseAMX .in_MouseAMX call INMouseAMX pop de pop hl ld (hl),a inc hl xor a ld (hl),a pop hl ld (hl),b inc hl ld (hl),a pop hl ld (hl),c push hl push hl push hl ex de,hl jp (hl) z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseAMX_callee.asm0000644000175000017500000000052210601045536023115 0ustar tygrystygrys; void __CALLEE__ in_MouseAMX_callee(uchar *buttons, uint *xcoord, uint *ycoord) ; 09.2005 aralbrec XLIB in_MouseAMX_callee LIB INMouseAMX .in_MouseAMX_callee call INMouseAMX pop de pop hl ld (hl),a inc hl xor a ld (hl),a pop hl ld (hl),b inc hl ld (hl),a pop hl ld (hl),c ex de,hl jp (hl) z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseAMXInit.asm0000644000175000017500000000052010601045536022432 0ustar tygrystygrys; void in_MouseAMXInit(uchar xvector, uchar yvector) ; CALLER linkage for function pointers XLIB in_MouseAMXInit LIB in_MouseAMXInit_callee XREF ASMDISP_IN_MOUSEAMXINIT_CALLEE .in_MouseAMXInit pop hl pop bc pop de push de push bc push hl ld b,e jp in_MouseAMXInit_callee + ASMDISP_IN_MOUSEAMXINIT_CALLEE z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseAMXInit_callee.asm0000644000175000017500000001003310601045536023737 0ustar tygrystygrys; void __CALLEE__ in_MouseAMXInit_callee(uchar xvector, uchar yvector) ; 09.2005 aralbrec ; References: ; 1. http://www.breezer.demon.co.uk/spec/tech/hware.html ; Has an excerpt of the Z80 Emulator's documentation on the AMX Mouse. ; Information is incorrect about mouse buttons. Used the Spectaculator ; emulator as reference for button behaviour. ; 2. "Z80 Data Book," Mostek Microcomputer Corporation, August 1978. ; Technical documentation of the Z80 PIO Chip. ; The AMX mouse is interfaced to the Spectrum using a Z80 PIO chip ; configured in input mode. Port A of the chip is associated ; with X movement and port B is associated with Y movement. The ; mouse interface will generate an interrupt on port A or port B ; each time it is moved a distance of "one mickey" in the X or ; Y direction respectively. It is the program's job to field ; these interrupts and update internal state representing the ; mouse's absolute position. Once an interrupt has occurred, ; reading the data port (A or B) will return 0 (positive) or ; 1 (negative) to indicate movement direction. ; Port Addresses: ; ; (Mapped to PIO chip) ; $1f Data Port A ; $3f Data Port B ; $5f Control Port A ; $7f Control Port B ; ; (Separate from PIO chip) ; $df State of three mouse buttons: bit 7 = left, bit 6 = right, ; bit 5 = middle, all active low. The mouse buttons are not ; debounced and/or are open collector. The former adds random transitions ; around a mouse press / depress and the latter adds random transitions ; when the mouse is left unpressed, caused by ULA attribute bytes on ; a floating bus. You must take this into consideration when getting ; a reliable read of the mouse buttons' state. ; ; Note that the AMX Mouse interface conflicts with the Kempston ; joystick interface ($1f), the Disciple disk interface ($1f) and ; the Multiface ($3f). XLIB in_MouseAMXInit_callee XDEF ASMDISP_IN_MOUSEAMXINIT_CALLEE LIB im2_InstallISR_callee XREF ASMDISP_IM2_INSTALLISR_CALLEE XREF _in_AMXdeltaX, _in_AMXdeltaY XREF _in_AMXcoordX, _in_AMXcoordY .in_MouseAMXInit_callee pop hl pop bc ex (sp),hl ld b,l .asmentry ; enter: B = im 2 vector for X interrupts (even, 0..254) ; C = im 2 vector for Y interrupts (even, 0..254) ; uses : AF,DE,HL ; exit : installs interrupt service routines to field AMX ints, ; initializes mouse position to (0,0) and sets default ; mouse deltas to one pixel. ; note : 1) disable interrupts prior to calling ; 2) uses im2.lib to register interrupt service routines ld l,b ld de,XInterrupt call im2_InstallISR_callee + ASMDISP_IM2INSTALLISR_CALLEE ld l,c ld de,YInterrupt call im2_InstallISR_callee + ASMDISP_IM2INSTALLISR_CALLEE ld a,b out ($5f),a ; PIO vector for X ld a,$97 out ($5f),a ; PIO enable interrupt generation for X ld a,$4f out ($5f),a ; PIO select input mode for X ld a,c out ($7f),a ; PIO vector for Y ld a,$97 out ($7f),a ; PIO enable interrupt generation for Y ld a,$4f out ($7f),a ; PIO select input mode for Y ld hl,$0100 ld (_in_AMXdeltaX),hl ld (_in_AMXdeltaY),hl ld h,0 ld (_in_AMXcoordX),hl ld (_in_AMXcoordY),hl ret ; interrupt service routines .XInterrupt push af push de push hl ld de,(_in_AMXdeltaX) ld hl,(_in_AMXcoordX) in a,($1f) or a jr z,posx sbc hl,de jp nc, contx ld hl,0 jp contx .posx add hl,de jp nc, contx ld hl,$ffff .contx ld (_in_AMXcoordX),hl pop hl pop de pop af ei reti .YInterrupt push af push de push hl ld de,(_in_AMXdeltaY) ld hl,(_in_AMXcoordY) in a,($3f) or a jr z,posy add hl,de jp nc, conty ld hl,$ffff jp conty .posy sbc hl,de jp nc, conty ld hl,0 .conty ld (_in_AMXcoordY),hl pop hl pop de pop af ei reti DEFC ASMDISP_IN_MOUSEAMXINIT_CALLEE = asmentry - in_MouseAMXInit_callee z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseAMXSetPos.asm0000644000175000017500000000051410601045536022747 0ustar tygrystygrys; void in_MouseAMXSetPos(uint xcoord, uint ycoord) ; CALLER linkage for function pointers XLIB in_MouseAMXSetPos LIB in_MouseAMXSetPos_callee XREF CDISP_IN_MOUSEAMXSETPOS_CALLEE .in_MouseAMXSetPos pop de pop bc pop hl push hl push bc push de jp in_MouseAMXSetPos_callee + CDISP_IN_MOUSEAMXSETPOS_CALLEE z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseAMXSetPos_callee.asm0000644000175000017500000000144110601045536024254 0ustar tygrystygrys; void __CALLEE__ in_MouseAMXSetPos_callee(uint xcoord, uint ycoord) ; 09.2005 aralbrec XLIB in_MouseAMXSetPos_callee XDEF ASMDISP_IN_MOUSEAMXSETPOS_CALLEE XDEF CDISP_IN_MOUSEAMXSETPOS_CALLEE XREF _in_AMXcoordX, _in_AMXcoordY .in_MouseAMXSetPos_callee pop hl pop bc ex (sp),hl .centry ; bc = ycoord ; hl = xcoord ld a,b or a jr z, correcty ld a,c cp 191 jp c, yok .correcty ld a,191 .yok ld b,a ld a,h or a jp z, xok ld l,255 .xok ld c,l .asmentry ; enter: C = x coord 0..255 ; B = y coord 0..191 ld a,c ld (_in_AMXcoordX + 1),a ld a,b ld (_in_AMXcoordY + 1),a ret DEFC ASMDISP_IN_MOUSEAMXSETPOS_CALLEE = asmentry - in_MouseAMXSetPos_callee DEFC CDISP_IN_MOUSEAMXSETPOS_CALLEE = centry - in_MouseAMXSetPos_callee z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseKemp.asm0000644000175000017500000000056410601045536022065 0ustar tygrystygrys; void in_MouseKemp(uchar *buttons, uint *xcoord, uint *ycoord) ; CALLER linkage for function pointers XLIB in_MouseKemp LIB INMouseKemp .in_MouseKemp call INMouseKemp pop de pop hl ld (hl),a inc hl xor a ld (hl),a pop hl ld (hl),b inc hl ld (hl),a pop hl ld (hl),c push hl push hl push hl ex de,hl jp (hl) z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseKemp_callee.asm0000644000175000017500000000052710601045536023371 0ustar tygrystygrys; void __CALLEE__ in_MouseKemp_callee(uchar *buttons, uint *xcoord, uint *ycoord) ; 09.2005 aralbrec XLIB in_MouseKemp_callee LIB INMouseKemp .in_MouseKemp_callee call INMouseKemp pop de pop hl ld (hl),a inc hl xor a ld (hl),a pop hl ld (hl),b inc hl ld (hl),a pop hl ld (hl),c ex de,hl jp (hl) z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseKempInit.asm0000644000175000017500000000057110601045536022707 0ustar tygrystygrys; void in_MouseKempInit(void) ; 09.2005 aralbrec ; mainly for symmetry with AMX mouse functions XLIB in_MouseKempInit LIB INMouseKemp XREF _in_KempcoordX, _in_KempcoordY ; just set initial coordinates to (0,0) ; uses : AF .in_MouseKempInit call INMouseKemp ; to zero out current delta xor a ld (_in_KempcoordX),a ld (_in_KempcoordY),a ret z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseKempSetPos.asm0000644000175000017500000000047710601045536023226 0ustar tygrystygrys; void in_MouseKempSetPos(uint xcoord, uint ycoord) ; 09.2005 aralbrec XLIB in_MouseKempSetPos LIB in_MouseKempSetPos_callee XREF CDISP_IN_MOUSEKEMPSETPOS_CALLEE .in_MouseKempSetPos pop de pop bc pop hl push hl push bc push de jp in_MouseKempSetPos_callee + CDISP_IN_MOUSEKEMPSETPOS_CALLEE z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseKempSetPos_callee.asm0000644000175000017500000000161710601046222024521 0ustar tygrystygrys; void __CALLEE__ in_MouseKempSetPos_callee(uint xcoord, uint ycoord) ; 09.2005 aralbrec XLIB in_MouseKempSetPos_callee XDEF ASMDISP_IN_MOUSEKEMPSETPOS_CALLEE XDEF CDISP_IN_MOUSEKEMPSETPOS_CALLEE LIB INMouseKemp XREF _in_KempcoordX, _in_KempcoordY .in_MouseKempSetPos_callee pop hl pop bc ex (sp),hl .centry ; bc = ycoord ; hl = xcoord ld a,b or a jr z, correcty ld a,c cp 191 jp c, yok .correcty ld a,191 .yok ld b,a ld a,h or a jp z, xok ld l,255 .xok ld c,l .asmentry ; enter: C = x coord 0..255 ; B = y coord 0..191 push bc call INMouseKemp ; zero out any existing delta pop bc ld a,c ld (_in_KempcoordX),a ld a,b ld (_in_KempcoordY),a ret DEFC ASMDISP_IN_MOUSEKEMPSETPOS_CALLEE = asmentry - in_MouseKempSetPos_callee DEFC CDISP_IN_MOUSEKEMPSETPOS_CALLEE = centry - in_MouseKempSetPos_callee z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseSim.asm0000644000175000017500000000071010601045536021712 0ustar tygrystygrys; void in_MouseSim(struct in_UDM *u, uchar *buttons, uint *xcoord, uint *ycoord) ; CALLER linkage for function pointers XLIB in_MouseSim LIB INMouseSim .in_MouseSim ld hl,8 add hl,sp ld a,(hl) inc hl ld h,(hl) ld l,a call INMouseSim pop de pop hl ld (hl),a inc hl xor a ld (hl),a pop hl ld (hl),b inc hl ld (hl),a pop hl ld (hl),c push hl push hl push hl ex de,hl jp (hl) z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseSim_callee.asm0000644000175000017500000000067410601045537023231 0ustar tygrystygrys; void __CALLEE__ in_MouseSim_callee(struct in_UDM *u, uchar *buttons, uint *xcoord, uint *ycoord) ; 09.2005 aralbrec XLIB in_MouseSim_callee LIB INMouseSim .in_MouseSim_callee ld hl,8 add hl,sp ld a,(hl) inc hl ld h,(hl) ld l,a call INMouseSim pop de pop hl ld (hl),a inc hl xor a ld (hl),a pop hl ld (hl),b inc hl ld (hl),a pop hl ld (hl),c pop hl ex de,hl jp (hl) z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseSimInit.asm0000644000175000017500000000034310601045536022540 0ustar tygrystygrys; void in_MouseSimInit(struct in_UDM *u) ; CALLER linkage for function pointers XLIB in_MouseSimInit LIB in_MouseSimInit_fastcall .in_MouseSimInit pop de pop hl push hl push de jp in_MouseSimInit_fastcall z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseSimInit_fastcall.asm0000644000175000017500000000055610601045536024417 0ustar tygrystygrys; void __FASTCALL__ in_MouseSimInit_fastcall(struct in_UDM *u) ; 09.2005 aralbrec ; mainly for symmetry with AMX mouse functions XLIB in_MouseSimInit_fastcall LIB l_setmem .in_MouseSimInit_fastcall ; just set initial coordinates to (0,0) and reset state machine ; enter: HL = struct in_UDM * ; uses : AF,DE,HL ld de,6 add hl,de xor a jp l_setmem-11 z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseSimSetPos.asm0000644000175000017500000000061410601045536023053 0ustar tygrystygrys; void in_MouseSimSetPos(struct in_UDM *u, uint xcoord, uint ycoord) ; CALLER linkage for function pointers XLIB in_MouseSimSetPos LIB in_MouseSimSetPos_callee XREF ASMDISP_IN_MOUSESIMSETPOS_CALLEE .in_MouseSimSetPos pop af pop bc pop de pop hl push hl push de push bc push af ld b,c ld c,e jp in_MouseSimSetPos_callee + ASMDISP_IN_MOUSESIMSETPOS_CALLEE z88dk-1.8.ds1/libsrc/input/spectrum/in_MouseSimSetPos_callee.asm0000644000175000017500000000111110601045536024351 0ustar tygrystygrys; void __CALLEE__ in_MouseSimSetPos_callee(struct in_UDM *u, uint xcoord, uint ycoord) ; 09.2005 aralbrec XLIB in_MouseSimSetPos_callee XDEF ASMDISP_IN_MOUSESIMSETPOS_CALLEE LIB l_setmem .in_MouseSimSetPos_callee pop hl pop bc ld b,c pop de ld c,e ex (sp),hl .asmentry ; enter: C = x coord 0..255 ; B = y coord 0..191 ; HL = struct in_UDM * ld de,6 add hl,de xor a call l_setmem-5 inc hl ld (hl),b inc hl ld (hl),a inc hl ld (hl),c ret DEFC ASMDISP_IN_MOUSESIMSETPOS_CALLEE = asmentry - in_MouseSimSetPos_callee z88dk-1.8.ds1/libsrc/input/spectrum/in_Pause.asm0000644000175000017500000000145310641307747021244 0ustar tygrystygrys; uint in_Pause(uint ticks) ; 09.2005 aralbrec XLIB in_Pause LIB in_WaitForNoKey, in_WaitForKey, delay ; Waits a period of time measured in milliseconds and exits ; early if a key is pressed ; ; enter: HL = time to wait in ms, if 0 waits forever until key pressed ; exit : carry = exit early because of keypress with HL = time remaining ; no carry = exit after time passed ; uses : AF,BC,DE,HL .in_Pause ld a,h or l jr z, waitforkey ld c,l ld b,h .loop ; wait 1ms then sample keyboard, in loop ; at 3.5MHz, 1ms = 3500 T states ld hl,3500 - 67 call delay ; wait exactly HL t-states dec bc ld a,b or c ret z xor a in a,($fe) and 31 cp 31 jr z, loop scf ret .waitforkey call in_WaitForNoKey jp in_WaitForKey z88dk-1.8.ds1/libsrc/input/spectrum/in_Wait.asm0000644000175000017500000000065010632621277021066 0ustar tygrystygrys; void in_Wait(uint ticks) ; 09.2005 aralbrec XLIB in_Wait LIB delay ; Waits a period of time measured in milliseconds. ; ; enter : HL = time to wait in ms ; used : AF,BC,DE,HL .in_Wait ; wait 1ms in loop controlled by HL ; at 3.5MHz, 1ms = 3500 T states ld c,l ld b,h .loop ld hl,3500 - 34 call delay ; wait exactly HL t-states dec bc ld a,b or c jp nz, loop ret z88dk-1.8.ds1/libsrc/input/spectrum/in_WaitForKey.asm0000644000175000017500000000024710316364526022210 0ustar tygrystygrys; void in_WaitForKey(void) ; 09.2005 aralbrec XLIB in_WaitForKey ; uses : AF .in_WaitForKey xor a in a,($fe) and 31 cp 31 jr z, in_WaitForKey ret z88dk-1.8.ds1/libsrc/input/spectrum/in_WaitForNoKey.asm0000644000175000017500000000026110316364526022501 0ustar tygrystygrys; void in_WaitForNoKey(void) ; 09.2005 aralbrec XLIB in_WaitForNoKey ; uses : AF .in_WaitForNoKey xor a in a,($fe) and $1f cp 31 jr nz, in_WaitForNoKey ret z88dk-1.8.ds1/libsrc/input/spectrum/INMouseAMX.asm0000644000175000017500000000165610323327434021363 0ustar tygrystygrys; Read AMX Mouse ; 08.2003 aralbrec XLIB INMouseAMX XREF _in_AMXcoordX, _in_AMXcoordY ; exit : C = button state 00000MRL active high ; B = X coordinate (0..255) ; A = Y coordinate (0..191) ; uses : AF,BC,HL .INMouseAMX ld c,$1f in a,($df) ; mouse button state will randomly or c ; fluctuate except when the mouse ld c,a ; buttons are really pressed! in a,($df) ; let's hope reading the buttons or c ; five times is enough ld c,a in a,($df) or c ld c,a in a,($df) or c ld c,a in a,($df) or c rlca rlca rlca and $07 add a,buttbl % 256 ld l,a ld h,buttbl / 256 jr nc, noinc inc h .noinc ld c,(hl) ; c = button state ld a,(_in_AMXcoordX + 1) ld b,a ld a,(_in_AMXcoordY + 1) cp 192 ret c ld a,191 ld (_in_AMXcoordY + 1),a ret .buttbl defb $07, $03, $05, $01, $06, $02, $04, $00 z88dk-1.8.ds1/libsrc/input/spectrum/INMouseKemp.asm0000644000175000017500000000237110323327434021625 0ustar tygrystygrys; Read Kempston Mouse ; 08.2003 aralbrec ; based on Chris Cowley's Kempston Mouse ; driver for Spectrum Basic (2003) XLIB INMouseKemp XREF _in_KempcoordX, _in_KempcoordY XREF _in_KemprawX, _in_KemprawY ; exit : C = button state 000000RL active high ; B = X coordinate (0..255) ; A = Y coordinate (0..191) ; uses : AF,BC,E .INMouseKemp ld a,(_in_KempcoordX) ld b,a ld a,(_in_KemprawX) ld e,a ld a,$fb in a,($df) ld (_in_KemprawX),a sub e ; A = delta X jp pe, overflowX ; kill the X movement if overflow jp m, negdx .posdx add a,b jr nc, Xok ld a,255 jp Xok .negdx add a,b jp po, Xok xor a .Xok ld (_in_KempcoordX),a ld b,a .overflowX .dobuts ld a,$fa in a,($df) and $03 ld c,a rla srl c or $fc or c cpl ld c,a ; c = buttons 000000RL active high .doY ld a,(_in_KemprawY) ld e,a ld a,$ff in a,($df) ld (_in_KemprawY),a sub e ld e,a ; E = delta Y ld a,(_in_KempcoordY) sub e cp 192 jr c, Yok add a,e ; Y moved off screen, were we close to top or bottom? cp 96 ld a,191 jr nc, Yok xor a .Yok ld (_in_KempcoordY),a ret z88dk-1.8.ds1/libsrc/input/spectrum/INMouseSim.asm0000644000175000017500000000730010623254611021455 0ustar tygrystygrys; Simulates a Mouse using Joystick Functions ; 06.2003, 09.2005 aralbrec XLIB INMouseSim LIB l_jpix ; enter: HL = struct in_UDM * ; exit : C = button state 11111MRL active low ; B = X coordinate (0..255) ; A = Y coordinate (0..191) ; used : AF,BC,DE,HL,AF',IX ; note : last maxcount in struct in_UDM must be 255 .INMouseSim ld e,(hl) inc hl ld d,(hl) ; DE = struct in_UDK * inc hl ld a,(hl) ld ixl,a inc hl ld a,(hl) ld ixh,a ; IX = joystick function pointer inc hl push hl push de ex de,hl call l_jpix ; read joystick with optional parameter on stack, in HL pop de ld a,l and $0f jp z, nomovement ld a,l ex af,af ; A' = F000RLDU active high pop hl ; HL = &in_UDM.delta ld e,(hl) inc hl ld d,(hl) ; DE = base address of delta array inc hl ld a,(hl) ; A = state = current index into delta array inc hl ; HL = &in_UDM.count ld c,a add a,a add a,a add a,c add a,e ld e,a jr nc, noinc inc d .noinc ; DE = &delta[state] inc (hl) ; increase current count jp nz, not255 ld (hl),255 jp samestate .not255 ld a,(de) ; A = max count for this state cp (hl) jp nc, samestate ld (hl),0 ; clear current count to zero dec hl inc (hl) ; advance to next state inc hl .samestate ; HL = &in_UDM.count, DE = &delta[state], A' = F111RLDU active low inc hl ; HL = &in_UDM.y inc de ; DE = delta[state].dy ex de,hl ld c,(hl) inc hl ld b,(hl) inc hl push bc ; stack = dx ld c,(hl) inc hl ld b,(hl) ; BC = dy ex de,hl ld e,(hl) inc hl ld d,(hl) ex de,hl ; DE = &in_UDM.y + 1b, HL = y .up ex af,af ; A = F000RLDU active high rrca jr nc, down rrca ; swallow down, only doing up or a sbc hl,bc jp nc, endvertical ld hl,0 jp endvertical .down rrca jr nc, endvertical add hl,bc ex af,af ld a,h cp 192 jr nc, notoutofrange ld h,191 .notoutofrange ex af,af .endvertical ; A = ??F000RL ex de,hl ; DE = new Y, HL = &in_UDM.y + 1b ld (hl),d dec hl ld (hl),e inc hl inc hl ld e,(hl) inc hl ld d,(hl) ex de,hl ; HL = x, DE = &in_UDM.x + 1b pop bc ; BC = dx .left rrca jr nc,right rrca ; swallow right or a sbc hl,bc jp nc, endhorizontal ld hl,0 jp endhorizontal .right rrca jr nc, endhorizontal add hl,bc jp nc, endhorizontal ld hl,$ffff .endhorizontal ; A = ????F000 ex de,hl ; DE = new x, HL = &in_UDM.x + 1b ld (hl),d dec hl ld (hl),e dec hl ; hl = in_UDM.y + 1b ld b,d ; B = x coord 0..255 and $08 ld c,0 jr z, nofire inc c .nofire ; C = mouse button state ld a,(hl) ; A = y coord 0..191 ret .nomovement ld a,l ; A = F000RLDU active high pop hl ; HL = &in_UDM.delta inc hl inc hl ld (hl),0 ; state = 0 inc hl ld (hl),0 ; count = 0 ld c,0 rla rl c ; C = 0000000L active high inc hl inc hl ld a,(hl) ; A = y coord cp 192 jr nc, notout ld a,191 ld (hl),a .notout inc hl inc hl ld b,(hl) ; B = x coord ret z88dk-1.8.ds1/libsrc/input/spectrum.lst0000644000175000017500000000216010763607672017524 0ustar tygrystygrysinput/spectrum/in_GetKey input/spectrum/in_GetKeyReset input/spectrum/in_Inkey input/spectrum/in_JoyFuller input/spectrum/in_JoyKempston input/spectrum/in_JoyKeyboard input/spectrum/in_JoySinclair1 input/spectrum/in_JoySinclair2 input/spectrum/in_JoyTimex1 input/spectrum/in_JoyTimex2 input/spectrum/in_KeyPressed input/spectrum/in_keytranstbl input/spectrum/in_LookupKey input/spectrum/in_MouseAMX input/spectrum/in_MouseAMX_callee input/spectrum/in_MouseAMXInit input/spectrum/in_MouseAMXInit_callee input/spectrum/in_MouseAMXSetPos input/spectrum/in_MouseAMXSetPos_callee input/spectrum/in_MouseKemp input/spectrum/in_MouseKemp_callee input/spectrum/in_MouseKempInit input/spectrum/in_MouseKempSetPos input/spectrum/in_MouseKempSetPos_callee input/spectrum/in_MouseSim input/spectrum/in_MouseSim_callee input/spectrum/in_MouseSimInit input/spectrum/in_MouseSimInit_fastcall input/spectrum/in_MouseSimSetPos input/spectrum/in_MouseSimSetPos_callee input/spectrum/in_Pause input/spectrum/in_Wait input/spectrum/in_WaitForKey input/spectrum/in_WaitForNoKey input/spectrum/INMouseAMX input/spectrum/INMouseKemp input/spectrum/INMouseSim z88dk-1.8.ds1/libsrc/input/zx81/0000755000175000017500000000000010765202715015740 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/input/zx81/in_Inkey.asm0000644000175000017500000000267110762224363020215 0ustar tygrystygrys; uint in_Inkey(void) ; 02.2008 aralbrec ; Read current state of keyboard but only return ; keypress if a single key is pressed. XLIB in_Inkey LIB in_keytranstbl ; exit : carry set and HL = 0 for no keys registered ; else HL = ASCII character code ; uses : AF,BC,DE,HL .in_Inkey ld de,0 ld bc,$fefe in a,(c) or $e1 cp $ff jr nz, keyhitA ld e,5 ld b,$fd in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,10 ld b,$fb in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,15 ld b,$f7 in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,20 ld b,$ef in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,25 ld b,$df in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,30 ld b,$bf in a,(c) or $e0 cp $ff jr nz, keyhitA ld e,35 ld b,$7f in a,(c) or $e0 cp $ff ld c,a jr nz, keyhitB .nokey ld hl,0 scf ret .keyhitA ld c,a ld a,b cpl or $01 in a,($fe) or $e0 cp $ff jr nz, nokey .keyhitB ld b,0 ld hl,rowtbl-$e0 add hl,bc ld a,(hl) cp 5 jr nc, nokey add a,e ld e,a ld hl,in_keytranstbl add hl,de ld a,$fe in a,($fe) and $01 jr nz, noshift ld e,40 add hl,de .noshift ld l,(hl) ld h,0 ret .rowtbl defb 255,255,255,255,255,255,255 defb 255,255,255,255,255,255,255,255 defb 4,255,255,255,255,255,255 defb 255,3,255,255,255,2,255,1 defb 0,255 z88dk-1.8.ds1/libsrc/input/zx81/in_KeyPressed.asm0000644000175000017500000000117110762224363021206 0ustar tygrystygrys; uint in_KeyPressed(uint scancode) ; 02.2008 aralbrec XLIB in_KeyPressed ; Determines if a key is pressed using the scan code ; returned by in_LookupKey. ; enter : l = scan row ; h = key mask ; exit : carry = key is pressed & HL = 1 ; no carry = key not pressed & HL = 0 ; used : AF,BC,HL .in_KeyPressed bit 7,h jp z, nocaps ld a,$fe ; check on CAPS key in a,($fe) and $01 jr nz, fail ; CAPS not pressed .nocaps ld a,h and $1f ld b,l ld c,$fe in b,(c) and b jr nz, fail ; key not pressed ld hl,1 scf ret .fail ld hl,0 ret z88dk-1.8.ds1/libsrc/input/zx81/in_keytranstbl.asm0000644000175000017500000000206510762224363021475 0ustar tygrystygrys ; This table translates key presses into ascii codes. ; Also used by 'GetKey' and 'LookupKey'. ; I would like to add lower case letters too but not ; sure how to go about it with just one shift key XLIB in_keytranstbl .in_keytranstbl ; unshifted defb 255,'Z','X','C','V' ; SHIFT, Z, X, C, V defb 'A','S','D','F','G' ; A, S, D, F, G defb 'Q','W','E','R','T' ; Q, W, E, R, T defb '1','2','3','4','5' ; 1, 2, 3, 4, 5 defb '0','9','8','7','6' ; 0, 9, 8, 7, 6 defb 'P','O','I','U','Y' ; P, O, I, U, Y defb 13,'L','K','J','H' ; ENTER, L, K, J, H defb ' ','.','M','N','B' ; SPACE, ., M, N, B ; shifted defb 255,':',';','?','/' ; SHIFT, Z, X, C, V defb '~','|',92,'{','}' ; A, S, D, F, G defb 131,132,133,18,20 ; Q, W, E, R, T defb 27,28,29,30,8 ; 1, 2, 3, 4, 5 defb 12,8,9,11,10 ; 0, 9, 8, 7, 6 defb 34,')','(','$',25 ; P, O, I, U, Y defb 13,'=','+','-','^' ; ENTER, L, K, J, H defb 96,',','>','<','*' ; SPACE, ., M, N, B z88dk-1.8.ds1/libsrc/input/zx81/in_LookupKey.asm0000644000175000017500000000260010762224363021050 0ustar tygrystygrys; uint in_LookupKey(uchar c) ; 02.2008 aralbrec XLIB in_LookupKey LIB in_keytranstbl ; Given the ascii code of a character, returns the scan row and mask ; corresponding to the key that needs to be pressed to generate the ; character. Eg: Calling LookupKey with character 'A' will return ; '$fd' for key row and '$01' for the mask. You could then check to ; see if the key is pressed with the following bit of code: ; ; ld a,$fd ; in a,($fe) ; and $01 ; jr z, a_is_pressed ; ; The mask returned will have bit 7 set to indicate if SHIFT also has ; to be pressed to generate the ascii code. ; enter: L = ascii character code ; exit : carry set & HL=0 if ascii code not found ; else: L = scan row, H = mask ; bit 7 of H set if SHIFT needs to be pressed ; uses : AF,BC,HL ; The 16-bit value returned is a scan code understood by ; in_KeyPressed. .in_LookupKey ld a,l ld hl,in_keytranstbl ld bc,80 cpir jr nz, notfound ld a,79 sub c ; A = position in table of ascii code ld l,b ld h,b cp 40 jr c, noshift sub 40 set 7,h .noshift .div5loop inc b sub 5 jp nc, div5loop .donedivide add a,6 ; A = bit position + 1, B = row + 1 ld l,$7f .rowlp rlc l djnz rowlp ld b,a ld a,$80 .masklp rlca djnz masklp or h ld h,a ret .notfound ld hl,0 scf ret z88dk-1.8.ds1/libsrc/input/zx81/INMouseSim.asm0000644000175000017500000000726010762224363020437 0ustar tygrystygrys; Simulates a Mouse using Joystick Functions ; 02.2008 aralbrec XLIB INMouseSim LIB l_jpix ; enter: HL = struct in_UDM * ; exit : C = button state 11111MRL active low ; B = X coordinate (0..255) ; A = Y coordinate (0..191) ; used : AF,BC,DE,HL,IX ; note : last maxcount in struct in_UDM must be 255 .INMouseSim ld e,(hl) inc hl ld d,(hl) ; DE = struct in_UDK * inc hl ld a,(hl) ld ixl,a inc hl ld a,(hl) ld ixh,a ; IX = joystick function pointer inc hl push hl push de ex de,hl call l_jpix ; read joystick with optional parameter on stack, in HL pop de ld a,l and $0f jp z, nomovement ld a,l pop hl ; HL = &in_UDM.delta push af ; A' = F000RLDU active high ld e,(hl) inc hl ld d,(hl) ; DE = base address of delta array inc hl ld a,(hl) ; A = state = current index into delta array inc hl ; HL = &in_UDM.count ld c,a add a,a add a,a add a,c add a,e ld e,a jr nc, noinc inc d .noinc ; DE = &delta[state] inc (hl) ; increase current count jp nz, not255 ld (hl),255 jp samestate .not255 ld a,(de) ; A = max count for this state cp (hl) jp nc, samestate ld (hl),0 ; clear current count to zero dec hl inc (hl) ; advance to next state inc hl .samestate ; HL = &in_UDM.count, DE = &delta[state], A' = F111RLDU active low inc hl ; HL = &in_UDM.y inc de ; DE = delta[state].dy ex de,hl ld c,(hl) inc hl ld b,(hl) inc hl pop af ; A = F000RLDU active high push bc ; stack = dx ld c,(hl) inc hl ld b,(hl) ; BC = dy ex de,hl ld e,(hl) inc hl ld d,(hl) ex de,hl ; DE = &in_UDM.y + 1b, HL = y .up rrca jr nc, down rrca ; swallow down, only doing up or a sbc hl,bc jp nc, endvertical ld hl,0 jp endvertical .down rrca jr nc, endvertical add hl,bc push af ld a,h cp 192 jr nc, notoutofrange ld h,191 .notoutofrange pop af .endvertical ; A = ??F000RL ex de,hl ; DE = new Y, HL = &in_UDM.y + 1b ld (hl),d dec hl ld (hl),e inc hl inc hl ld e,(hl) inc hl ld d,(hl) ex de,hl ; HL = x, DE = &in_UDM.x + 1b pop bc ; BC = dx .left rrca jr nc,right rrca ; swallow right or a sbc hl,bc jp nc, endhorizontal ld hl,0 jp endhorizontal .right rrca jr nc, endhorizontal add hl,bc jp nc, endhorizontal ld hl,$ffff .endhorizontal ; A = ????F000 ex de,hl ; DE = new x, HL = &in_UDM.x + 1b ld (hl),d dec hl ld (hl),e dec hl ; hl = in_UDM.y + 1b ld b,d ; B = x coord 0..255 and $08 ld c,0 jr z, nofire inc c .nofire ; C = mouse button state ld a,(hl) ; A = y coord 0..191 ret .nomovement ld a,l ; A = F000RLDU active high pop hl ; HL = &in_UDM.delta inc hl inc hl ld (hl),0 ; state = 0 inc hl ld (hl),0 ; count = 0 ld c,0 rla rl c ; C = 0000000L active high inc hl inc hl ld a,(hl) ; A = y coord cp 192 jr nc, notout ld a,191 ld (hl),a .notout inc hl inc hl ld b,(hl) ; B = x coord ret z88dk-1.8.ds1/libsrc/input/zx81.lst0000644000175000017500000000100210763607672016466 0ustar tygrystygrysinput/spectrum/in_GetKey input/spectrum/in_GetKeyReset input/zx81/in_Inkey input/spectrum/in_JoyKeyboard input/zx81/in_KeyPressed input/zx81/in_keytranstbl input/zx81/in_LookupKey input/spectrum/in_MouseSim input/spectrum/in_MouseSim_callee input/spectrum/in_MouseSimInit input/spectrum/in_MouseSimInit_fastcall input/spectrum/in_MouseSimSetPos input/spectrum/in_MouseSimSetPos_callee input/spectrum/in_Pause input/spectrum/in_Wait input/spectrum/in_WaitForKey input/spectrum/in_WaitForNoKey input/zx81/INMouseSim z88dk-1.8.ds1/libsrc/m5.lst0000644000175000017500000000541010712620314015023 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/m5/fgetc_cons stdio/fgets_cons stdio/m5/getk stdio/puts_cons stdio/m5/fputc_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf printflike/ltoa_any z88dk-1.8.ds1/libsrc/Make.config0000644000175000017500000000251510762270413016033 0ustar tygrystygrys# Allow us to switch assembler/compiler flags relatively easily # Directory where the .lst files are located LISTFILE_DIRECTORY=. # Directory that the .lib files should be placed in OUTPUT_DIRECTORY=. #USE_MPM=1 ifdef USE_MPM LIBLINKER = mpm -I$(Z80_OZFILES) -d -ns -nm -Mo ASSEMBLER = mpm -I$(Z80_OZFILES) CFLAGS = -mpm else LIBLINKER = z80asm -d -ns -nm -Mo ASSEMBLER = z80asm endif CFLAGS = -vn -make-lib -Wn43 # ZX Ansi display driver; valid presets are: # 24,28,32,36,40,42,51,64,80,85,128, # ROM24.ROM28,ROM32,ROM36. #ZXCOLS = 64 ifeq ($(ZXCOLS),128) COLDEFS = -DPACKEDFONT -DA128COL endif ifeq ($(ZXCOLS),85) COLDEFS = -DPACKEDFONT -DA85COL endif ifeq ($(ZXCOLS),80) COLDEFS = -DPACKEDFONT -DA80COL endif ifeq ($(ZXCOLS),64) COLDEFS = -DPACKEDFONT -DA64COL endif ifeq ($(ZXCOLS),51) COLDEFS = -DA51COL endif ifeq ($(ZXCOLS),42) COLDEFS = -DA42COL endif ifeq ($(ZXCOLS),40) COLDEFS = -DA40COL endif ifeq ($(ZXCOLS),36) COLDEFS = -DA36COL endif ifeq ($(ZXCOLS),32) COLDEFS = -DA32COL endif ifeq ($(ZXCOLS),28) COLDEFS = -DA28COL endif ifeq ($(ZXCOLS),24) COLDEFS = -DA24COL endif ifeq ($(ZXCOLS),ROM36) COLDEFS = -DA36COL -DROMFONT endif ifeq ($(ZXCOLS),ROM32) COLDEFS = -DA32COL -DROMFONT endif ifeq ($(ZXCOLS),ROM28) COLDEFS = -DA28COL -DROMFONT endif ifeq ($(ZXCOLS),ROM24) COLDEFS = -DA24COL -DROMFONT endif COLDEFS ?= -DPACKEDFONT -DA64COL z88dk-1.8.ds1/libsrc/Makefile0000644000175000017500000010161510763607576015447 0ustar tygrystygrys# # Ah, that'd be nice, a library makefile! # # Problems? Contact the person to blame(!) above the section # for the library # # $Id: Makefile,v 1.111 2008/03/04 11:31:10 aralbrec Exp $ include Make.config # LIBRARIES not built by the global list below: # - SP1 (build depends on customization and machine target, "make sp1" for options) all: genlibs z88libs tilibs zxlibs \ debug.lib \ nc_clib.lib vz_clib.lib vzansi_clib.lib \ abc80_clib.lib abc80ansi_clib.lib abc800_clib.lib \ aceansi_clib.lib aquarius_clib.lib aquansi_clib.lib \ cpc_clib.lib cpcansi_clib.lib cpcfs.lib cpc_math.lib cpcgray.lib \ cpm_clib.lib c128ansi_clib.lib \ m5_clib.lib msx_clib.lib mz_clib.lib mzansi_clib.lib \ nascom_clib.lib nasansi_clib.lib newbrain_clib.lib \ ozansi_clib.lib rex_clib.lib rcmx000_clib.lib \ svi_clib.lib sam_clib.lib samansi_clib.lib \ pps_clib.lib ppsansi_clib.lib embedded_clib.lib \ test_clib.lib sms_clib.lib \ zx81libs genlibs: gen_math.lib malloc.lib z80_crt0.lib ndos.lib adt.lib balloc.lib \ im2.lib rect.lib algorithm.lib z88libs: z88_math.lib z88.lib z88_clib.lib net.lib z88net_clib.lib farz88.lib \ z88ansi_clib.lib gfx.lib tilibs: ti82ansi_clib.lib ti82_clib.lib ti83ansi_clib.lib ti83_clib.lib \ ti83pansi_clib.lib ti83p_clib.lib ti85ansi_clib.lib ti85_clib.lib \ ti86ansi_clib.lib ti86_clib.lib \ tigray82.lib tigray83.lib tigray83p.lib tigray85.lib tigray86.lib zxlibs: ts2068_clib.lib zx_clib.lib zxan_clib.lib ts2068an_clib.lib zxvgs.lib mzx.lib mzx_tiny.lib zx81libs: zx81_clib.lib zx81ansi_clib.lib gfx81.lib gfx81hr64.lib gfx81hr192.lib m81.lib m81_tiny.lib # moving external shell scripts to makefile to make life easy on # the windows platform devs (ie Me :-) -- gamesdeps.sh, gfxdeps.sh, tideps.sh # short script to sort out games dependencies gamesdeps: $(RM) -f games/*.o # short script to sort out gfx dependencies gfxdeps: $(RM) -f graphics/*.o $(RM) -f graphics/ticalc/*.o $(RM) -f graphics/gray/*.o $(RM) -f graphics/gray/ticalc/*.o $(RM) -f graphics/spectrum/*.o $(RM) -f graphics/z88/*.o $(RM) -f graphics/text/*.o $(RM) -f graphics/text6/*.o cd graphics ; $(MAKE) ; cd .. # short script to sort out ticalc dependencies tideps: $(RM) -f stdio/ticalc/*.o $(RM) -f stdio/ansi/ticalc/*.o $(RM) -f games/*.o $(RM) -f games/ticalc/*.o $(RM) -f graphics/*.o $(RM) -f graphics/ticalc/*.o $(RM) -f graphics/gray/*.o $(RM) -f graphics/gray/ticalc/*.o zx81deps: $(RM) -f strings/*.o $(RM) -f stdlib/*.o $(RM) -f stdio/*.o $(RM) -f stdio/ansi/zx81/*.o $(RM) -f input/spectrum/*.o $(RM) -f input/zx81/*.o $(RM) -f games/*.o $(RM) -f graphics/*.o $(RM) -f graphics/zx81/*.o $(RM) -f graphics/zx81/hr/*.o $(RM) -f graphics/gray/*.o # interesting algorithms - aralbrec algorithm.lib: @echo '' @echo '--- Building Algorithm Library ---' @echo '' cd algorithm ; $(MAKE) ; cd .. # rectangles, intervals and points - aralbrec rect.lib: @echo '' @echo '--- Building Rectangles Library ---' @echo '' cd rect ; $(MAKE) ; cd .. # abstract data types library - aralbrec adt.lib: @echo '' @echo '--- Building Abstract Data Types Library ---' @echo '' cd adt ; $(MAKE) ; cd .. # block memory allocator - aralbrec balloc.lib: @echo '' @echo '--- Building Block Memory Allocator Library ---' @echo '' cd balloc ; $(MAKE) ; cd .. # interrupt mode 2 library - aralbrec im2.lib: @echo '' @echo '--- Building IM 2 Library ---' @echo '' cd im2 ; $(MAKE) ; cd .. # Garry's z88 far library - garry (probably dom now) farz88.lib: @echo '' @echo '--- Building Z88 Far Malloc Library ---' @echo '' cd farz88 ; $(MAKE) ; cd .. # Generic maths build - dom gen_math.lib: @echo '' @echo '--- Building Z80 Generic Maths Library ---' @echo '' cd genmath; $(MAKE) ; cd .. # Z88 maths build - dom z88_math.lib: @echo '' @echo '--- Building Z88 Maths Library ---' @echo '' cd z88math; $(MAKE) ; cd .. # Graphics library (for both app and basic - diff libs though!) - dom gfx.lib: @echo '' @echo '--- Building Z88 BASIC gfx Library ---' @echo '' $(MAKE) gfxdeps $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/gfx -DFORz88 @$(LISTFILE_DIRECTORY)/z88gfx.lst $(MAKE) gfxdeps $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/gfxapp -DAPPZ88 -DFORz88 @$(LISTFILE_DIRECTORY)/z88gfx.lst # simple malloc library - dom # adding multiple heaps and realloc - aralbrec malloc.lib: @echo '' @echo '--- Building Near Malloc Library ---' @echo '' cd malloc ; $(MAKE) ; cd .. ndos.lib: cd fcntl/dummy ; $(MAKE) ; cd ../.. # Startup code (such as division etc) common to all z80s - dom z80_crt0.lib: @echo '' @echo '--- Building Z80 crt0 Library ---' @echo '' cd z80_crt0s ; $(MAKE) ; cd .. # Z88DK DEBUG utilities debug.lib: @echo '' @echo '--- Building DEBUG Library ---' @echo '' cd debug ; $(MAKE) ; cd .. # Custom z88 routines for application - dom z88.lib: @echo '' @echo '--- Building Z88 Custom Library ---' @echo '' cd z88 ; $(MAKE) ; cd .. # ZSock API (wrappers to package calls) - dom net.lib: @echo '' @echo '--- Building Z88 ZSock Library ---' @echo '' cd net ; $(MAKE) ; cd .. # z88 library - dom z88_clib.lib: @echo '' @echo '--- Building Z88 Library ---' @echo '' cd fcntl ; $(MAKE) lz88 ; cd .. cd stdio ; $(MAKE) lz88 ; cd .. cd stdlib ; $(MAKE) lz88 ; cd .. cd strings ; $(MAKE) ; cd .. cd printflike ; $(MAKE) ; cd .. cd time ; $(MAKE) lz88 ; cd .. cd rs232 ; $(MAKE) lz88 ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lz88 ; cd .. $(LIBLINKER) -DFORz88 -x$(OUTPUT_DIRECTORY)/z88_clib @$(LISTFILE_DIRECTORY)/z88.lst # z88 ansi library - dom z88ansi_clib.lib: @echo '' @echo '--- Building Z88 ANSI Library ---' @echo '' cd fcntl ; $(MAKE) lz88 ; cd .. cd stdio ; $(MAKE) lz88 ; cd .. cd stdlib ; $(MAKE) lz88 ; cd .. cd strings ; $(MAKE) ; cd .. cd printflike ; $(MAKE) ; cd .. cd time ; $(MAKE) lz88 ; cd .. cd rs232 ; $(MAKE) lz88 ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/z88ansi_clib @$(LISTFILE_DIRECTORY)/z88ansi.lst # Network stdio - dom z88net_clib.lib: @echo '' @echo '--- Building Z88 Network Aware Library ---' @echo '' cd fcntl ; $(MAKE) lz88 ; cd .. cd stdio ; $(MAKE) lz88net ; cd .. cd stdlib ; $(MAKE) lz88 ; cd .. cd strings ; $(MAKE) ; cd .. cd printflike ; $(MAKE) ; cd .. cd time ; $(MAKE) lz88 ; cd .. cd rs232 ; $(MAKE) lz88 ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/z88net_clib @$(LISTFILE_DIRECTORY)/z88net.lst # 64/32 column library for ZX Spectrum - dom/stefano zx_clib.lib: @echo '' @echo '--- Building ZX Spectrum Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) lzx ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd fcntl ; $(MAKE) lzx ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. cd time ; $(MAKE) lzx ; cd .. cd rs232 ; $(MAKE) lzx ; cd .. $(MAKE) gamesdeps cd spectrum ; $(MAKE) ; cd .. cd games ; $(MAKE) lzx ; cd .. $(LIBLINKER) -DFORzx -x$(OUTPUT_DIRECTORY)/zx_clib @$(LISTFILE_DIRECTORY)/zx.lst # 64/32 column library for TS2068 - dom/stefano/alvin ts2068_clib.lib: @echo '' @echo '--- Building TS2068 (Spectrum clone) Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) lzx ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd fcntl ; $(MAKE) lzx ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. cd time ; $(MAKE) lzx ; cd .. cd rs232 ; $(MAKE) lzx ; cd .. $(MAKE) gamesdeps cd spectrum ; $(MAKE) ; cd .. cd games ; $(MAKE) lzx ; cd .. $(LIBLINKER) -DFORzx -x$(OUTPUT_DIRECTORY)/ts2068_clib @$(LISTFILE_DIRECTORY)/ts2068.lst # ZXVGS - yarek zxvgs.lib: @echo '' @echo '--- Building ZXVGS Library ---' @echo '' cd fcntl ; $(MAKE) lzxvgs ; cd .. cd zxvgs; $(MAKE) ; cd .. $(LIBLINKER) -DFORzx -x$(OUTPUT_DIRECTORY)/zxvgs @$(LISTFILE_DIRECTORY)/zxvgs.lst # ZX Spectrum maths library - Stefano mzx.lib: @echo '' @echo '--- Building ZX Spectrum Maths Library ---' @echo '' cd zxmath ; $(MAKE) mzx ; cd .. mzx_tiny.lib: @echo '' @echo '--- Building ZX Spectrum Tiny Maths Library ---' @echo '' cd zxmath ; $(MAKE) mzx_tiny ; cd .. # vt100 for sprinter - dom ppsansi_clib.lib: @echo '' @echo '--- Building Sprinter Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) lzx ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd fcntl ; $(MAKE) lpps ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. cd time ; $(MAKE) lpps ; cd .. cd rs232 ; $(MAKE) lzx ; cd .. $(MAKE) gamesdeps cd spectrum ; $(MAKE) ; cd .. cd games ; $(MAKE) lzx ; cd .. $(LIBLINKER) -DFORzx -x$(OUTPUT_DIRECTORY)/ppsansi_clib @$(LISTFILE_DIRECTORY)/ppsansi.lst # Native for sprinter - dom pps_clib.lib: @echo '' @echo '--- Building Sprinter Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) lzx ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd fcntl ; $(MAKE) lpps ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. cd time ; $(MAKE) lpps ; cd .. cd rs232 ; $(MAKE) lzx ; cd .. $(MAKE) gamesdeps cd spectrum ; $(MAKE) lzx ; cd .. cd games ; $(MAKE) lzx ; cd .. $(LIBLINKER) -DFORzx -x$(OUTPUT_DIRECTORY)/pps_clib @$(LISTFILE_DIRECTORY)/pps.lst # vt100 C lib for spectrum - stefano/dom # use -DROMFONT for a tiny 36 columns mode # or -DPACKEDFONT for tiny 64->85 column modes zxan_clib.lib: @echo '' @echo '--- Building ZX Spectrum ANSI Library ---' @echo '' $(RM) stdio/ansi/spectrum/f_ansi_char.o $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) lzx ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd fcntl ; $(MAKE) lzx ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. cd time ; $(MAKE) lzx ; cd .. cd rs232 ; $(MAKE) lzx ; cd .. $(MAKE) gamesdeps cd spectrum ; $(MAKE) ; cd .. cd games ; $(MAKE) lzx ; cd .. $(LIBLINKER) -DFORzx $(COLDEFS) -x$(OUTPUT_DIRECTORY)/zxan_clib @$(LISTFILE_DIRECTORY)/zxansi.lst # vt100 C lib for TS2068 - stefano/dom # use -DROMFONT for a tiny 36 columns mode # or -DPACKEDFONT for tiny 64->85 column modes ts2068an_clib.lib: @echo '' @echo '--- Building TS2068 (Spectrum clone) ANSI Library ---' @echo '' $(RM) stdio/ansi/spectrum/f_ansi_char.o $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) lzx ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd fcntl ; $(MAKE) lzx ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. cd time ; $(MAKE) lzx ; cd .. cd rs232 ; $(MAKE) lzx ; cd .. $(MAKE) gamesdeps cd spectrum ; $(MAKE) ; cd .. cd games ; $(MAKE) lzx ; cd .. $(LIBLINKER) -DFORzx $(COLDEFS) -x$(OUTPUT_DIRECTORY)/ts2068an_clib @$(LISTFILE_DIRECTORY)/ts2068an.lst # Untested C lib for NC100 machines - dom nc_clib.lib: @echo '' @echo '--- Building Amstrad NC100 Library ---' @echo '' cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/nc_clib @$(LISTFILE_DIRECTORY)/nc100.lst # VZ200/300 lib - Stefano vz_clib.lib: @echo '' @echo '--- Building VZ200/300 Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORvz -x$(OUTPUT_DIRECTORY)/vz_clib @$(LISTFILE_DIRECTORY)/vz200.lst # VZ200 ansi lib - Stefano vzansi_clib.lib: @echo '' @echo '--- Building VZ200/300 ANSI Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORvz -x$(OUTPUT_DIRECTORY)/vzansi_clib @$(LISTFILE_DIRECTORY)/vzansi.lst # ZX81 lib - Stefano zx81_clib.lib: @echo '' @echo '--- Building ZX81 Library ---' @echo '' $(MAKE) zx81deps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic_iy ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -IXIY -DFORzx81 -x$(OUTPUT_DIRECTORY)/zx81_clib @$(LISTFILE_DIRECTORY)/zx81.lst $(MAKE) zx81deps # ZX81 ansi lib - Stefano zx81ansi_clib.lib: @echo '' @echo '--- Building ZX81 ANSI Library ---' @echo '' $(MAKE) zx81deps $(RM) stdio/ansi/zx81/f_ansi_char.o cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic_iy ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -IXIY -DFORzx81 $(COLDEFS) -x$(OUTPUT_DIRECTORY)/zx81ansi_clib @$(LISTFILE_DIRECTORY)/zx81ansi.lst $(MAKE) zx81deps # ZX81 std graphics lib - Stefano gfx81.lib: @echo '' @echo '--- Building ZX81 Standard Graphics Library ---' @echo '' $(MAKE) zx81deps $(LIBLINKER) -IXIY -DFORzx81 -x$(OUTPUT_DIRECTORY)/gfx81 @$(LISTFILE_DIRECTORY)/gfx81.lst $(MAKE) zx81deps # ZX81 HR graphics lib - Stefano gfx81hr64.lib: @echo '' @echo '--- Building ZX81 High Resolution Library (64 rows) ---' @echo '' $(MAKE) zx81deps $(LIBLINKER) -IXIY -DFORzx81hr64 -x$(OUTPUT_DIRECTORY)/gfx81hr64 @$(LISTFILE_DIRECTORY)/gfx81hr.lst $(MAKE) zx81deps gfx81hr192.lib: @echo '' @echo '--- Building ZX81 High Resolution Library (192 rows) ---' @echo '' $(MAKE) zx81deps $(LIBLINKER) -IXIY -DFORzx81hr192 -x$(OUTPUT_DIRECTORY)/gfx81hr192 @$(LISTFILE_DIRECTORY)/gfx81hr.lst $(MAKE) zx81deps # ZX81 maths library - Stefano m81.lib: @echo '' @echo '--- Building ZX 81 Maths Library ---' @echo '' cd zxmath ; $(MAKE) m81 ; cd .. m81_tiny.lib: @echo '' @echo '--- Building ZX 81 Tiny Maths Library ---' @echo '' cd zxmath ; $(MAKE) m81_tiny ; cd .. # Texas Instrument's calculators: - stefano/henk # almost the same lib code with different -D flag set # that's why we force most of the lib code to be rebuilt (tideps.sh) ti82ansi_clib.lib: @echo '' @echo '--- Building TI82 ANSI Library ---' @echo '' $(MAKE) tideps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lticalc ; cd .. $(LIBLINKER) -DFORti82 -DPACKEDFONT -x$(OUTPUT_DIRECTORY)/ti82ansi_clib @$(LISTFILE_DIRECTORY)/ticansi.lst ti82_clib.lib: @echo '' @echo '--- Building TI82 Library ---' @echo '' $(MAKE) tideps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lticalc ; cd .. $(LIBLINKER) -DFORti82 -x$(OUTPUT_DIRECTORY)/ti82_clib @$(LISTFILE_DIRECTORY)/ticalc.lst tigray82.lib: @echo '' @echo '--- Building TI82 Grey Library ---' @echo '' $(MAKE) tideps $(LIBLINKER) -DFORti82 -x$(OUTPUT_DIRECTORY)/tigray82 @$(LISTFILE_DIRECTORY)/tigray.lst ti83ansi_clib.lib: @echo '' @echo '--- Building TI83 ANSI Library ---' @echo '' $(MAKE) tideps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lticalc ; cd .. $(LIBLINKER) -DFORti83 -DPACKEDFONT -x$(OUTPUT_DIRECTORY)/ti83ansi_clib @$(LISTFILE_DIRECTORY)/ticansi.lst ti83_clib.lib: @echo '' @echo '--- Building TI83 Library ---' @echo '' $(MAKE) tideps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lticalc ; cd .. $(LIBLINKER) -DFORti83 -x$(OUTPUT_DIRECTORY)/ti83_clib @$(LISTFILE_DIRECTORY)/ticalc.lst tigray83.lib: @echo '' @echo '--- Building TI83 Grey Library ---' @echo '' $(MAKE) tideps $(LIBLINKER) -DFORti83 -x$(OUTPUT_DIRECTORY)/tigray83 @$(LISTFILE_DIRECTORY)/tigray.lst ti83pansi_clib.lib: @echo '' @echo '--- Building TI83+ ANSI Library ---' @echo '' $(MAKE) tideps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lticalc ; cd .. $(LIBLINKER) -DFORti83p -DPACKEDFONT -x$(OUTPUT_DIRECTORY)/ti83pansi_clib @$(LISTFILE_DIRECTORY)/ticansi.lst ti83p_clib.lib: @echo '' @echo '--- Building TI83+ Library ---' @echo '' $(MAKE) tideps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lticalc ; cd .. $(LIBLINKER) -DFORti83p -x$(OUTPUT_DIRECTORY)/ti83p_clib @$(LISTFILE_DIRECTORY)/ticalc.lst tigray83p.lib: @echo '' @echo '--- Building TI83+ Grey Library ---' @echo '' $(MAKE) tideps $(LIBLINKER) -DFORti83p -x$(OUTPUT_DIRECTORY)/tigray83p @$(LISTFILE_DIRECTORY)/tigray.lst ti85ansi_clib.lib: @echo '' @echo '--- Building TI85 ANSI Library ---' @echo '' $(MAKE) tideps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lticalc ; cd .. $(LIBLINKER) -DFORti85 -DPACKEDFONT -x$(OUTPUT_DIRECTORY)/ti85ansi_clib @$(LISTFILE_DIRECTORY)/ticansi.lst ti85_clib.lib: @echo '' @echo '--- Building TI85 Library ---' @echo '' $(MAKE) tideps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lticalc ; cd .. $(LIBLINKER) -DFORti85 -x$(OUTPUT_DIRECTORY)/ti85_clib @$(LISTFILE_DIRECTORY)/ticalc.lst tigray85.lib: @echo '' @echo '--- Building TI85 Grey Library ---' @echo '' $(MAKE) tideps $(LIBLINKER) -DFORti85 -x$(OUTPUT_DIRECTORY)/tigray85 @$(LISTFILE_DIRECTORY)/tigray.lst ti86ansi_clib.lib: @echo '' @echo '--- Building TI86 ANSI Library ---' @echo '' $(MAKE) tideps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lticalc ; cd .. $(LIBLINKER) -DFORti86 -DPACKEDFONT -x$(OUTPUT_DIRECTORY)/ti86ansi_clib @$(LISTFILE_DIRECTORY)/ticansi.lst ti86_clib.lib: @echo '' @echo '--- Building TI86 Library ---' @echo '' $(MAKE) tideps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lticalc ; cd .. $(LIBLINKER) -DFORti86 -x$(OUTPUT_DIRECTORY)/ti86_clib @$(LISTFILE_DIRECTORY)/ticalc.lst tigray86.lib: @echo '' @echo '--- Building TI86 Grey Library ---' @echo '' $(MAKE) tideps $(LIBLINKER) -DFORti86 -x$(OUTPUT_DIRECTORY)/tigray86 @$(LISTFILE_DIRECTORY)/tigray.lst # vt100 C lib for the Sharp OZ family - stefano # use -DPACKEDFONT for tiny 50->80 column modes ozansi_clib.lib: @echo '' @echo '--- Building Sharp OZ family ANSI Library ---' @echo '' $(RM) -f stdio/ansi/oz/f_ansi_char.o $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. cd oz ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) loz ; cd .. $(LIBLINKER) -DFORoz -DPACKEDFONT -x$(OUTPUT_DIRECTORY)/ozansi_clib @$(LISTFILE_DIRECTORY)/ozansi.lst # CPM lib - Stefano/dom cpm_clib.lib: @echo '' @echo '--- Building CP/M Library ---' @echo '' cd fcntl ; $(MAKE) lcpm ; cd .. cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) lcpm ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/cpm_clib @$(LISTFILE_DIRECTORY)/cpm.lst # Sharp MZ lib - Stefano mz_clib.lib: @echo '' @echo '--- Building Sharp MZ Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/mz_clib @$(LISTFILE_DIRECTORY)/mz.lst # Sharp MZ ansi lib - Stefano mzansi_clib.lib: @echo '' @echo '--- Building Sharp MZ ANSI Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/mzansi_clib @$(LISTFILE_DIRECTORY)/mzansi.lst # ABC80 library - Stefano abc80_clib.lib: @echo '' @echo '--- Building ABC80 Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/abc80_clib @$(LISTFILE_DIRECTORY)/abc80.lst # ABC80 ANSI library - Stefano abc80ansi_clib.lib: @echo '' @echo '--- Building ABC80 ANSI Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/abc80ansi_clib @$(LISTFILE_DIRECTORY)/abc80ansi.lst # ABC800 library - Stefano abc800_clib.lib: @echo '' @echo '--- Building ABC800 Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/abc800_clib @$(LISTFILE_DIRECTORY)/abc800.lst # Jupiter ACE library - Stefano aceansi_clib.lib: @echo '' @echo '--- Building Jupiter Ace ANSI Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lace ; cd .. $(LIBLINKER) -DFORjupiter -x$(OUTPUT_DIRECTORY)/aceansi_clib.lib @$(LISTFILE_DIRECTORY)/aceansi.lst # Mattel Aquarius library - Stefano aquarius_clib.lib: @echo '' @echo '--- Building Mattel Aquarius Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) laquarius ; cd .. $(LIBLINKER) -DFORaquarius -x$(OUTPUT_DIRECTORY)/aquarius_clib.lib @$(LISTFILE_DIRECTORY)/aquarius.lst # Mattel Aquarius ANSI library - Stefano aquansi_clib.lib: @echo '' @echo '--- Building Mattel Aquarius ANSI Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) laquarius ; cd .. $(LIBLINKER) -DFORaquarius -x$(OUTPUT_DIRECTORY)/aquansi_clib.lib @$(LISTFILE_DIRECTORY)/aquansi.lst # Xircom REX 6000 library - Dominic rex_clib.lib: @echo '' @echo '--- Building Xircom Rex Library ---' @echo '' cd strings; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd setjmp ; $(MAKE) ; cd .. cd rex ; $(MAKE) ; cd .. $(LIBLINKER) -DFORrex -x$(OUTPUT_DIRECTORY)/rex_clib.lib @$(LISTFILE_DIRECTORY)/rex6000.lst # Sam Coupe library - Stefano & Frode sam_clib.lib: @echo '' @echo '--- Building Sam Coupe Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lzx ; cd .. $(LIBLINKER) -DFORsam -x$(OUTPUT_DIRECTORY)/sam_clib @$(LISTFILE_DIRECTORY)/sam.lst # Sam Coupe library - Stefano & Frode samansi_clib.lib: @echo '' @echo '--- Building Sam Coupe ANSI Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lzx ; cd .. $(LIBLINKER) -DFORsam -x$(OUTPUT_DIRECTORY)/samansi_clib @$(LISTFILE_DIRECTORY)/samansi.lst # Spectravideo SVI library - Stefano svi_clib.lib: @echo '' @echo '--- Building Spectravideo Library ---' @echo '' cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORsvi -x$(OUTPUT_DIRECTORY)/svi_clib @$(LISTFILE_DIRECTORY)/svi.lst # MSX library - Stefano msx_clib.lib: @echo '' @echo '--- Building MSX Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(MAKE) gamesdeps cd games ; $(MAKE) lmsx ; cd .. $(LIBLINKER) -DFORmsx -x$(OUTPUT_DIRECTORY)/msx_clib @$(LISTFILE_DIRECTORY)/msx.lst # NASCOM library - Stefano nascom_clib.lib: @echo '' @echo '--- Building NASCOM Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORnascom -x$(OUTPUT_DIRECTORY)/nascom_clib @$(LISTFILE_DIRECTORY)/nascom.lst nasansi_clib.lib: @echo '' @echo '--- Building NASCOM ANSI Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORnascom -x$(OUTPUT_DIRECTORY)/nasansi_clib @$(LISTFILE_DIRECTORY)/nasansi.lst # SORD M5 library - Stefano m5_clib.lib: @echo '' @echo '--- Building SORD M5 Library ---' @echo '' cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORm5 -x$(OUTPUT_DIRECTORY)/m5_clib @$(LISTFILE_DIRECTORY)/m5.lst # Amstrad CPC library - Stefano cpc_clib.lib: @echo '' @echo '--- Building Amstrad CPC Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORcpc -x$(OUTPUT_DIRECTORY)/cpc_clib @$(LISTFILE_DIRECTORY)/cpc.lst cpcansi_clib.lib: @echo '' @echo '--- Building Amstrad CPC ANSI Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORcpc -x$(OUTPUT_DIRECTORY)/cpcansi_clib @$(LISTFILE_DIRECTORY)/cpcansi.lst cpcgray.lib: @echo '' @echo '--- Building CPC Pseudo Grey Library ---' @echo '' $(LIBLINKER) -DFORcpc -x$(OUTPUT_DIRECTORY)/cpcgray @$(LISTFILE_DIRECTORY)/cpcgray.lst cpcfs.lib: @echo '' @echo '--- Building Amstrad CPC fcntl Library ---' @echo '' cd fcntl ; $(MAKE) lcpc ; cd .. $(LIBLINKER) -DFORcpc -x$(OUTPUT_DIRECTORY)/cpcfs @$(LISTFILE_DIRECTORY)/cpcfs.lst # Amstrad CPC maths libraries - Dom cpc_math.lib: @echo '' @echo '--- Building Amstrad CPC Maths Libraries ---' @echo '' cd cpcmath ; $(MAKE) ; cd .. # Commodore 128 (Z80 mode) library - Stefano c128ansi_clib.lib: @echo '' @echo '--- Building Commodore 128 ANSI Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORc128 -x$(OUTPUT_DIRECTORY)/c128ansi_clib @$(LISTFILE_DIRECTORY)/c128ansi.lst # Grundy NewBrain library - Stefano newbrain_clib.lib: @echo '' @echo '--- Building Grundy NewBrain Library ---' @echo '' $(MAKE) gfxdeps cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) generic ; cd .. cd fcntl ; $(MAKE) lnewbrain ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd time ; $(MAKE) lnewbrain ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORnewbrain -x$(OUTPUT_DIRECTORY)/newbrain_clib @$(LISTFILE_DIRECTORY)/newbrain.lst $(LIBLINKER) -DFORnewbrain -x$(OUTPUT_DIRECTORY)/nbcpm_clib @$(LISTFILE_DIRECTORY)/nbcpm.lst # RCM2/3000 lib rcmx000_clib.lib: @echo '' @echo '--- Building RCM2/3000 Library ---' @echo '' make -C strings clean all cd stdlib ; $(MAKE) gen cd stdio ; $(MAKE) gen cd printflike ; $(MAKE) cd setjmp ; $(MAKE) cd assert ; $(MAKE) z80asm -RCMX000 -d -ns -nm -Mo -DFORrcmx000 -x$(OUTPUT_DIRECTORY)/rcmx000_clib @$(LISTFILE_DIRECTORY)/rcmx000.lst # embedded target - contributed by Daniel Wallner embedded_clib.lib: @echo '' @echo '--- Building Embedded (ns16450) Library ---' @echo '' cd strings ; $(MAKE) ; cd .. cd stdlib ; $(MAKE) gen ; cd .. cd stdio ; $(MAKE) gen ; cd .. cd printflike ; $(MAKE) ; cd .. cd setjmp ; $(MAKE) ; cd .. cd assert ; $(MAKE) ; cd .. $(LIBLINKER) -DFORembedded -x$(OUTPUT_DIRECTORY)/embedded_clib @$(LISTFILE_DIRECTORY)/embedded.lst # Sega Master system - contributed by Haroldo O. Pinheiro sms_clib.lib: @echo '' @echo '--- Building Sega Master System Library ---' @echo '' $(MAKE) -C strings $(MAKE) -C stdlib $(MAKE) -C stdio $(MAKE) -C printflike $(MAKE) -C setjmp $(MAKE) -C assert $(LIBLINKER) -DFORsms -x$(OUTPUT_DIRECTORY)/sms_clib @$(LISTFILE_DIRECTORY)/sms.lst # Test platform - dom test_clib.lib: @echo '' @echo '--- Building Test System Library ---' @echo '' $(MAKE) -C strings $(MAKE) -C stdlib $(MAKE) -C stdio $(MAKE) -C printflike $(MAKE) -C setjmp $(MAKE) -C assert $(LIBLINKER) -x$(OUTPUT_DIRECTORY)/test_clib @$(LISTFILE_DIRECTORY)/test.lst # SP1 sprite library - aralbrec sp1: @echo @echo SP1 Software Sprite Engine @echo @echo Prior to building the library you can customize several @echo parameters such as display size, memory map, etc by editing @echo the file "customize.asm" found in {z88dk}/libsrc/sprites/software/sp1/{target} @echo Otherwise the defaults will be used. @echo @echo You must specify a target machine to build the library. @echo Only one version of the library can exist at a time. @echo @echo make sp1-spectrum (256x192 pixel, 32x24 attribute) @echo make sp1-ts2068hr (512x192 pixel monochrome) @echo make sp1-zx81hr (256x192 pixel monochrome) @echo @echo make sp1-clean (recommended prior to building) @echo sp1-spectrum: cd sprites/software/sp1 ; $(MAKE) sp1-spectrum; cd ../../.. sp1-ts2068hr: cd sprites/software/sp1 ; $(MAKE) sp1-ts2068hr; cd ../../.. sp1-zx81hr: cd sprites/software/sp1 ; $(MAKE) sp1-zx81hr; cd ../../.. sp1-clean: cd sprites/software/sp1 ; $(MAKE) clean; cd ../../.. clean: cd assert ; $(MAKE) clean ; cd .. cd ctype ; $(MAKE) clean ; cd .. cd farz88 ; $(MAKE) clean ; cd .. cd fcntl ; $(MAKE) clean ; cd .. cd genmath ; $(MAKE) clean ; cd .. cd graphics ; $(MAKE) clean ; cd .. cd malloc ; $(MAKE) clean ; cd .. cd net ; $(MAKE) clean ; cd .. cd printflike ; $(MAKE) clean ; cd .. cd rex ; $(MAKE) clean ; cd .. cd rs232 ; $(MAKE) clean ; cd .. cd setjmp ; $(MAKE) clean ; cd .. cd spectrum ; $(MAKE) clean ; cd .. cd stdio ; $(MAKE) clean ; cd .. cd stdlib ; $(MAKE) clean ; cd .. cd strings ; $(MAKE) clean ; cd .. cd time ; $(MAKE) clean ; cd .. cd z80_crt0s; $(MAKE) clean ; cd .. cd z88 ; $(MAKE) clean ; cd .. cd z88math ; $(MAKE) clean ; cd .. cd zxvgs ; $(MAKE) clean ; cd .. $(RM) *.lib cd games ; $(MAKE) clean ; cd .. cd cpcmath ; $(MAKE) clean ; cd .. cd zxmath ; $(MAKE) clean ; cd .. cd adt ; $(MAKE) clean ; cd .. cd balloc ; $(MAKE) clean ; cd .. cd im2 ; $(MAKE) clean ; cd .. cd rect ; $(MAKE) clean ; cd .. cd algorithm ; $(MAKE) clean ; cd .. cd debug ; $(MAKE) clean ; cd .. cd oz ; $(MAKE) clean ; cd .. cd input ; $(MAKE) clean ; cd .. cd abc80 ; $(RM) *.o ; cd .. cd abc800 ; $(RM) *.o ; cd .. cd msx ; $(RM) *.o ; cd .. cd newbrain ; $(RM) *.o ; cd .. cd vz ; $(RM) *.o ; cd .. cd zx81 ; $(RM) *.o ; cd .. $(MAKE) -C sms clean cd sprites/software/sp1 ; $(MAKE) clean ; cd ../../.. install: cp $(OUTPUT_DIRECTORY)/*.lib ../lib/clibs z88dk-1.8.ds1/libsrc/malloc/0000755000175000017500000000000010765202715015236 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/malloc/calloc.asm0000644000175000017500000000040110552624631017167 0ustar tygrystygrys; CALLEE linkage for function pointers XLIB calloc LIB HeapCalloc_callee XREF _heap, ASMDISP_HEAPCALLOC_CALLEE .calloc pop bc pop de pop hl push hl push de push bc ld bc,_heap jp HeapCalloc_callee + ASMDISP_HEAPCALLOC_CALLEE z88dk-1.8.ds1/libsrc/malloc/calloc_callee.asm0000644000175000017500000000110010577177144020502 0ustar tygrystygrys; void __CALLEE__ *calloc_callee(unsigned int nobj, unsigned int size) ; 12.2006 aralbrec XLIB calloc_callee XREF ASMDISP_CALLOC_CALLEE LIB HeapCalloc_callee XREF _heap, ASMDISP_HEAPCALLOC_CALLEE .calloc pop hl pop de ex (sp),hl .asmentry ; enter : hl = number of objects ; de = size of each object ; exit : hl = address of memory block and carry set if successful ; else 0 and no carry if failed ; uses : af, bc, de, hl ld bc,_heap jp HeapCalloc_callee + ASMDISP_HEAPCALLOC_CALLEE DEFC ASMDISP_CALLOC_CALLEE = asmentry - calloc z88dk-1.8.ds1/libsrc/malloc/free.asm0000644000175000017500000000030310552624631016654 0ustar tygrystygrys; void __FASTCALL__ free(void *addr) ; 12.2006 aralbrec XLIB free LIB HeapFree_callee XREF _heap, ASMDISP_HEAPFREE_CALLEE .free ld de,_heap jp HeapFree_callee + ASMDISP_HEAPFREE_CALLEE z88dk-1.8.ds1/libsrc/malloc/HeapAlloc.asm0000644000175000017500000000035510552624631017572 0ustar tygrystygrys; CALLER linkage for function pointers XLIB HeapAlloc LIB HeapAlloc_callee XREF ASMDISP_HEAPALLOC_CALLEE .HeapAlloc pop de pop bc pop hl push hl push bc push de jp HeapAlloc_callee + ASMDISP_HEAPALLOC_CALLEE z88dk-1.8.ds1/libsrc/malloc/HeapAlloc_callee.asm0000644000175000017500000000703610577177144021113 0ustar tygrystygrys; void __CALLEE__ *HeapAlloc_callee(void *heap, unsigned int size) ; 12.2006 aralbrec XLIB HeapAlloc_callee XDEF ASMDISP_HEAPALLOC_CALLEE .HeapAlloc_callee pop hl pop bc ex (sp),hl .asmentry ; Allocate memory from the indicated heap. First fit algorithm. ; ; Each block in list of free blocks formatted like this: ; ; +----------------------+ ; | | ; +-- size (2 bytes) --+ ; | | ; +----------------------+ ; | | ; +-- next (2 bytes) --+ ; | | ; +----------------------+ ; | | ; | available bytes | ; | | ; +----------------------+ ; ; size includes the two bytes used for the next pointer but not ; the two bytes used for size. The allocated block will begin ; at the address of the next pointer, leaving the two bytes for ; size as overhead for each block. ; ; enter : hl = & heap pointer ; bc = request size in bytes ; exit : hl = address of memory block and carry set if successful ; else 0 and no carry if failed ; uses : af, bc, de, hl .MAHeapAlloc inc hl inc hl ld a,b ; requests must be at least 2 bytes or a jp nz, loop ld a,c cp 2 jp nc, loop ld c,2 .loop ; hl = & last block's next pointer ; bc = size ld a,(hl) inc hl push hl ; save & lagger's next + 1b ld h,(hl) ld l,a ; hl = & next block or h jr z, exit0 ; if no next block, return with hl=0 and nc for fail ; hl = & block ; bc = size ; stack = & lagger->next + 1b ld e,(hl) inc hl ld d,(hl) ex de,hl ; hl = block's size, de = & block + 1b sbc hl,bc ; is block size at least as big as requested? jr nc, foundblk ; if so branch to foundblk pop hl ; junk lagger on stack ex de,hl inc hl ; hl = & block->next jp loop ; try again with next block .foundblk ; bc = size ; de = & block + 1b ; hl = block's excess size ; stack = & lagger->next + 1b push bc ld bc,4 sbc hl,bc pop bc jr c, usewholeblk ; if too small to split, use whole block .splitblk ; bc = size ; de = & block + 1b ; hl = size remaining of block after allocation satisfied - 2 ; stack = & lagger->next + 1b inc hl inc hl ex de,hl ; de = size of remaining part of block dec hl ; hl = & block ld (hl),e ; write new block size inc hl ld (hl),d inc hl ; hl = & block->next add hl,de ; skip over part of block we're leaving behind ld (hl),c ; write the allocated block's size inc hl ld (hl),b inc hl ; hl = & allocated memory block pop de ; junk lagger scf ; indicate success ret .usewholeblk ; bc = size ; de = & block + 1b ; stack = & lagger->next + 1b inc de inc de ; de = & block->next + 1b pop hl ; hl = & lagger->next + 1b ex de,hl ldd ; write next block after this one into lagger's pointer ld a,(hl) ; hl = & allocated memory block = & block->next ld (de),a scf ; indicate success ret .exit0 pop de ; junk lagger on stack ret DEFC ASMDISP_HEAPALLOC_CALLEE = asmentry - HeapAlloc_callee z88dk-1.8.ds1/libsrc/malloc/HeapCalloc.asm0000644000175000017500000000041010552624631017725 0ustar tygrystygrys; CALLER linkage for function pointers XLIB HeapCalloc LIB HeapCalloc_callee XREF ASMDISP_HEAPCALLOC_CALLEE .HeapCalloc pop af pop de pop hl pop bc push bc push hl push de push af jp HeapCalloc_callee + ASMDISP_HEAPCALLOC_CALLEE z88dk-1.8.ds1/libsrc/malloc/HeapCalloc_callee.asm0000644000175000017500000000214710552624631021243 0ustar tygrystygrys; void __CALLEE__ *HeapCalloc_callee(void *heap, unsigned int nobj, unsigned int size) ; 12.2006 aralbrec XLIB HeapCalloc_callee XDEF ASMDISP_HEAPCALLOC_CALLEE LIB l_mult, HeapAlloc_callee XREF ASMDISP_HEAPALLOC_CALLEE .HeapCalloc_callee pop af pop de pop hl pop bc push af .asmentry ; Allocate memory from the indicated heap and clear it to zeroes ; ; enter : hl = number of objects ; de = size of each object ; bc = & heap pointer ; exit : hl = address of memory block and carry set if successful ; else 0 and no carry if failed ; uses : af, bc, de, hl .MAHeapCalloc push bc call l_mult ; hl = hl*de = total size of request ld c,l ld b,h pop hl push bc call HeapAlloc_callee + ASMDISP_HEAPALLOC_CALLEE pop bc ret nc ; ret if fail ld a,b or c jr z, out ld (hl),0 dec bc ld a,b or c jr z, out push hl ; zero memory block ld e,l ld d,h inc de ldir pop hl .out scf ret DEFC ASMDISP_HEAPCALLOC_CALLEE = asmentry - HeapCalloc_callee z88dk-1.8.ds1/libsrc/malloc/HeapCreate.asm0000644000175000017500000000040510547142363017740 0ustar tygrystygrys; void __FASTCALL__ HeapCreate(void *heap) ; 12.2006 aralbrec XLIB HeapCreate LIB l_setmem ; Just zero heap pointer to indicate empty heap. ; ; enter : hl = heap pointer ; uses : af, hl .HeapCreate xor a jp l_setmem - 7 ; four bytes: 2*4-1 z88dk-1.8.ds1/libsrc/malloc/HeapFree.asm0000644000175000017500000000034710552624631017422 0ustar tygrystygrys; CALLER linkage for function pointers XLIB HeapFree LIB HeapFree_callee XREF ASMDISP_HEAPFREE_CALLEE .HeapFree pop bc pop hl pop de push de push hl push bc jp HeapFree_callee + ASMDISP_HEAPFREE_CALLEE z88dk-1.8.ds1/libsrc/malloc/HeapFree_callee.asm0000644000175000017500000000701310552624631020724 0ustar tygrystygrys; void __CALLEE__ HeapFree_callee(void *heap, void *addr) ; 12.2006 aralbrec XLIB HeapFree_callee XDEF ASMDISP_HEAPFREE_CALLEE .HeapFree_callee pop bc pop hl pop de push bc .asmentry ; Return memory block to indicated heap. Available ; blocks must be kept sorted in increasing order by ; start address so that adjacent blocks can be merged. ; ; Not allowed to use IX,IY,EXX so a bit constrained. ; ; enter : de = & heap pointer ; hl = block address (+2) ; uses : af, bc, de, hl .MAHeapFree ld a,h or l ret z inc de inc de dec hl ld b,(hl) dec hl ld c,(hl) push hl add hl,bc inc hl inc hl ld c,l ld b,h ex de,hl ; hl = & lagger's next pointer ; bc = address following block to free ; stack = & block to free .loop ; hl = & lagger's next pointer ; bc = address following block to free ; stack = & block to free ld a,(hl) inc hl push hl ; save & lagger->next + 1b ld h,(hl) ld l,a ; hl = & next block or h ; if there is no next block... jr z, placeatend sbc hl,bc ; next block - address following block to free jr z, mergeontop jr nc, insertbefore adc hl,bc inc hl ; hl = & next block->next pop de ; junk lagger jp loop .insertbefore add hl,bc .placeatend ld c,l ld b,h pop hl ; bc = & next block ; hl = & lagger->next + 1b ; stack = & block to free jp checkformergebelow .mergeontop ; bc = & next block ; stack = & block to free, & lagger->next + 1b ld l,c ld h,b ld e,(hl) inc hl ld d,(hl) ; de = size of next block inc de inc de ; reclaim two bytes for next block's size parameter inc hl ld c,(hl) inc hl ld b,(hl) ; bc = & next block after merged blocks pop hl ex (sp),hl ; hl = & block to free, stack = & lagger->next + 1b ld a,(hl) ; add next block's size to merged block add a,e ld (hl),a inc hl ld a,(hl) adc a,d ld (hl),a dec hl ex (sp),hl .checkformergebelow ; bc = & next block after free ; hl = & lagger->next + 1b ; stack = & block to free dec hl ld e,l ld d,h ; de = & lagger->next dec hl ld a,(hl) dec hl ld l,(hl) ld h,a ; hl = size of lagger block add hl,de ; hl = byte past end of lagger block ex de,hl ex (sp),hl ex de,hl ; bc = & next block after free ; hl = byte past end of lagger block ; de = & block to free ; stack = & lagger->next sbc hl,de ; carry must be clear here pop hl jr z, mergebelow .nomergebelow ; bc = & next block after free ; de = & block to free ; hl = & lagger->next ld (hl),e inc hl ld (hl),d inc de inc de ex de,hl ld (hl),c inc hl ld (hl),b ret .mergebelow ; bc = & next block after free ; de = & block to free ; hl = & lagger->next ld (hl),c inc hl ld (hl),b ; write new next pointer for merged block dec hl ld a,(de) ld c,a inc de ld a,(de) ld b,a inc bc inc bc ; bc = size of block to merge + 2 for size parameter dec hl dec hl ld a,(hl) add a,c ld (hl),a inc hl ld a,(hl) adc a,b ld (hl),a ret DEFC ASMDISP_HEAPFREE_CALLEE = asmentry - HeapFree_callee z88dk-1.8.ds1/libsrc/malloc/HeapInfo.asm0000644000175000017500000000043410761366122017431 0ustar tygrystygrys; CALLER linkage for function pointers XLIB HeapInfo LIB MAHeapInfo .HeapInfo pop af pop hl push af call MAHeapInfo pop af pop hl ld (hl),c inc hl ld (hl),b pop hl ld (hl),e inc hl ld (hl),d push hl push hl push hl push af ret z88dk-1.8.ds1/libsrc/malloc/HeapInfo_callee.asm0000644000175000017500000000051710761366123020741 0ustar tygrystygrys; void __CALLEE__ HeapInfo_callee(unsigned int *total, unsigned int *largest, void *heap) ; 12.2006 aralbrec XLIB HeapInfo_callee LIB MAHeapInfo .HeapInfo_callee pop af pop hl push af call MAHeapInfo pop af pop hl ld (hl),c inc hl ld (hl),b pop hl ld (hl),e inc hl ld (hl),d push af ret z88dk-1.8.ds1/libsrc/malloc/HeapRealloc.asm0000644000175000017500000000041610552624631020117 0ustar tygrystygrys; CALLER linkage for function pointers XLIB HeapRealloc LIB HeapRealloc_callee XREF ASMDISP_HEAPREALLOC_CALLEE .HeapRealloc pop af pop bc pop hl pop de push de push hl push bc push af jp HeapRealloc_callee + ASMDISP_HEAPREALLOC_CALLEE z88dk-1.8.ds1/libsrc/malloc/HeapRealloc_callee.asm0000644000175000017500000000467410552624631021436 0ustar tygrystygrys; void __CALLEE__ HeapRealloc_callee(void *heap, void *p, unsigned int size) ; 12.2006 aralbrec XLIB HeapRealloc_callee XDEF ASMDISP_HEAPREALLOC_CALLEE LIB HeapAlloc_callee, HeapFree_callee XREF ASMDISP_HEAPALLOC_CALLEE, ASMDISP_HEAPFREE_CALLEE .HeapRealloc_callee pop af pop bc pop hl pop de push af .asmentry ; Grab a new memory block from the heap specified. ; Copy as much of the old block possible to ; the new memory block. If reallocation is not ; possible return 0 to indicate failure. ; ; enter : hl = old block address (+2) ; de = & heap pointer ; bc = new block size request ; exit : hl = address of memory block and carry set if successful ; else 0 and no carry (original block left as is) ; used : af, bc, de, hl ; ; Not allowed to use IX,IY,EXX which really constrains things. ; ; ** For now just attempts to allocate a new block of given size. ; Must revisit to investigate if the old block can be merged with ; any free blocks in the free list to form a bigger block. The ; ansi requirements for this function make it harder than it should ; be. .MAHeapRealloc ld a,h or l ret z ld a,b or a jp nz, sizeok ld a,c cp 2 jp nc, sizeok ld c,2 .sizeok push de push hl push bc ex de,hl call HeapAlloc_callee + ASMDISP_HEAPALLOC_CALLEE jr c, success .fail pop bc pop bc pop de ret .success ; hl = & new block (+2) ; stack = & heap, & old block (+2), new block size pop bc ; bc = new block size pop de ex de,hl ; de = & new block (+2), hl = & old block (+2) push hl dec hl ld a,(hl) dec hl ld l,(hl) ld h,a ; hl = size of old block or a sbc hl,bc ; old size - new size jr nc, usenewsize add hl,bc ld c,l ld b,h ; bc = old size .usenewsize ; bc = number of bytes to copy ; de = & new block (+2) ; stack = & heap, & old block (+2) pop hl push hl push de ldir ; copy old data block to new data block ; stack = & heap, & old block (+2), & new block (+2) pop hl pop de ex (sp),hl ex de,hl ; de = & heap, hl = & old block (+2) ; stack = & new block call HeapFree_callee + ASMDISP_HEAPFREE_CALLEE ; return old block to free list pop hl scf ret DEFC ASMDISP_HEAPREALLOC_CALLEE = asmentry - HeapRealloc_callee z88dk-1.8.ds1/libsrc/malloc/HeapSbrk.asm0000644000175000017500000000037410552624631017442 0ustar tygrystygrys; CALLER linkage for function pointers XLIB HeapSbrk LIB HeapSbrk_callee XREF ASMDISP_HEAPSBRK_CALLEE .HeapSbrk pop af pop bc pop hl pop de push de push hl push bc push af jp HeapSbrk_callee + ASMDISP_HEAPSBRK_CALLEE z88dk-1.8.ds1/libsrc/malloc/HeapSbrk_callee.asm0000644000175000017500000000160310552624631020743 0ustar tygrystygrys; void __CALLEE__ HeapSbrk_callee(void *heap, void *addr, unsigned int size) ; 12.2006 aralbrec XLIB HeapSbrk_callee XDEF ASMDISP_HEAPSBRK_CALLEE LIB HeapFree_callee XREF ASMDISP_HEAPFREE_CALLEE .HeapSbrk_callee pop af pop bc pop hl pop de push af .asmentry ; Add a block of memory to the specified heap. The ; block must be at least 4 bytes in size. Adding a ; block that overlaps with one already in the heap ; will wreck the heap. ; ; enter : de = heap pointer ; hl = address of available block ; bc = size of block in bytes >= 4 ; exit : block not added if too small ; uses : af, bc, de, hl .MAHeapSbrk ld a,b or a jr nz, sizeok ld a,c sub 4 ret c .sizeok dec bc dec bc ld (hl),c inc hl ld (hl),b inc hl jp HeapFree_callee + ASMDISP_HEAPFREE_CALLEE DEFC ASMDISP_HEAPSBRK_CALLEE = asmentry - HeapSbrk_callee z88dk-1.8.ds1/libsrc/malloc/MAHeapInfo.asm0000644000175000017500000000175710552624631017660 0ustar tygrystygrys XLIB MAHeapInfo .MAHeapInfo ; Return total amount of available memory in bytes ; and largest single block in indicated heap. ; ; enter : hl = & heap pointer ; exit : bc = largest single block size in bytes ; de = total available bytes in heap ; uses : af, bc, de, hl ld de,0 ; de = total available bytes in heap ld bc,0 ; bc = largest single block available inc hl inc hl .loop ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = & block or h ret z ; if no more blocks, all done ld a,(hl) inc hl push hl ; save & block->size + 1b ld h,(hl) ld l,a ; hl = block size sbc hl,bc add hl,bc jr c, notbigger ld c,l ld b,h ; bc = new largest block size .notbigger add hl,de ex de,hl ; de = add this block size into total bytes available pop hl inc hl jp loop z88dk-1.8.ds1/libsrc/malloc/Makefile0000644000175000017500000000045110714614446016700 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.19 2007/11/08 14:11:50 stefano Exp $ include ../Make.config default: $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/malloc @malllist clean: cd strings ; $(RM) *.o* ; cd .. $(RM) *.o* *.sym *.map *~ *.err zcc_opt.def *.i z88dk-1.8.ds1/libsrc/malloc/mallinfo.asm0000644000175000017500000000022210552624631017534 0ustar tygrystygrys; CALLER linkage for function pointers XLIB mallinfo LIB HeapInfo XREF _heap .mallinfo ld hl,_heap ex (sp),hl push hl jp HeapInfo z88dk-1.8.ds1/libsrc/malloc/mallinfo_callee.asm0000644000175000017500000000035110552624631021044 0ustar tygrystygrys; void __CALLEE__ mallinfo_callee(unsigned int *total, unsigned int *largest) ; 12.2006 aralbrec XLIB mallinfo_callee LIB HeapInfo_callee XREF _heap .mallinfo_callee ld hl,_heap ex (sp),hl push hl jp HeapInfo_callee z88dk-1.8.ds1/libsrc/malloc/mallinit.asm0000644000175000017500000000024610552624631017552 0ustar tygrystygrys; void mallinit(void) ; 12.2006 aralbrec XLIB mallinit LIB l_setmem XREF _heap .mallinit xor a ld hl,_heap jp l_setmem - 7 ; four bytes: 2*4-1 z88dk-1.8.ds1/libsrc/malloc/malllist0000644000175000017500000000046210552624631017003 0ustar tygrystygryscalloc calloc_callee free HeapAlloc HeapAlloc_callee HeapCalloc HeapCalloc_callee HeapCreate HeapFree HeapFree_callee HeapInfo HeapInfo_callee HeapRealloc HeapRealloc_callee HeapSbrk HeapSbrk_callee MAHeapInfo mallinfo mallinfo_callee mallinit malloc realloc realloc_callee sbrk sbrk_callee strings/strdup z88dk-1.8.ds1/libsrc/malloc/malloc.asm0000644000175000017500000000035210552624631017206 0ustar tygrystygrys; void __FASTCALL__ *malloc(unsigned int size) ; 12.2006 aralbrec XLIB malloc LIB HeapAlloc_callee XREF _heap, ASMDISP_HEAPALLOC_CALLEE .malloc ld c,l ld b,h ld hl,_heap jp HeapAlloc_callee + ASMDISP_HEAPALLOC_CALLEE z88dk-1.8.ds1/libsrc/malloc/realloc.asm0000644000175000017500000000034110552624631017356 0ustar tygrystygrys; CALLER linkage for function pointers XLIB realloc LIB realloc_callee XREF ASMDISP_REALLOC_CALLEE .realloc pop de pop bc pop hl push hl push bc push de jp realloc_callee + ASMDISP_REALLOC_CALLEE z88dk-1.8.ds1/libsrc/malloc/realloc_callee.asm0000644000175000017500000000064410577177144020702 0ustar tygrystygrys; void __CALLEE__ *realloc_callee(void *p, unsigned int size) ; 12.2006 aralbrec XLIB realloc_callee XDEF ASMDISP_REALLOC_CALLEE LIB HeapRealloc_callee XREF _heap, ASMDISP_HEAPREALLOC_CALLEE .realloc_callee pop hl pop bc ex (sp),hl .asmentry ; hl = void *p ; bc = size ld de,_heap jp HeapRealloc_CALLEE + ASMDISP_HEAPREALLOC_CALLEE DEFC ASMDISP_REALLOC_CALLEE = asmentry - realloc_callee z88dk-1.8.ds1/libsrc/malloc/sbrk.asm0000644000175000017500000000031710552624631016701 0ustar tygrystygrys; CALLER linkage for function pointers XLIB sbrk LIB sbrk_callee XREF ASMDISP_SBRK_CALLEE .sbrk pop de pop bc pop hl push hl push bc push de jp sbrk_callee + ASMDISP_SBRK_CALLEE z88dk-1.8.ds1/libsrc/malloc/sbrk_callee.asm0000644000175000017500000000065310577177144020222 0ustar tygrystygrys; void __CALLEE__ sbrk_callee(void *addr, unsigned int size) ; 12.2006 aralbrec XLIB sbrk_callee XDEF ASMDISP_SBRK_CALLEE LIB HeapSbrk_callee XREF _heap, ASMDISP_HEAPSBRK_CALLEE .sbrk_callee pop hl pop bc ex (sp),hl .asmentry ; bc = size of block in bytes >- 4 ; hl = address of block ld de,_heap jp HeapSbrk_callee + ASMDISP_HEAPSBRK_CALLEE DEFC ASMDISP_SBRK_CALLEE = asmentry - sbrk_callee z88dk-1.8.ds1/libsrc/malloc/strings/0000755000175000017500000000000010765202715016727 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/malloc/strings/strdup.asm0000644000175000017500000000131410552624631020750 0ustar tygrystygrys; ; z88dk Standard library ; ; char *strdup(s1) ; Duplicate a string in memory ; ; This requires linking with a malloc library ; ; char __FASTCALL *strdup(char *orig) ; 12.2006 aralbrec XLIB strdup LIB HeapAlloc_callee XREF _heap, ASMDISP_HEAPALLOC_CALLEE .strdup push hl ld bc,0 .sizeloop inc bc ld a,(hl) inc hl or a jp nz, sizeloop ld hl,_heap push bc call HeapAlloc_callee + ASMDISP_HEAPALLOC_CALLEE pop bc pop de ret nc ex de,hl push de ldir pop hl ret ; ;#include ;#include ; ; ;char *strdup(char *orig) ;{ ; char *ptr; ; ; ; ptr=malloc(strlen(orig) + 1); ; ; if (ptr) { ; strcpy(ptr,orig); ; } ; return (ptr); ;} z88dk-1.8.ds1/libsrc/msx/0000755000175000017500000000000010765202715014576 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/msx/msx_blank.asm0000755000175000017500000000043710726227173017267 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, 30/11/2007 ; ; void msx_blank(); ; ; Disable screen ; ; $Id: msx_blank.asm,v 1.2 2007/12/07 11:28:59 stefano Exp $ ; XLIB msx_blank LIB msxbios INCLUDE "#msxbios.def" msx_blank: ld ix,DISSCR jp msxbios z88dk-1.8.ds1/libsrc/msx/msx_break.asm0000755000175000017500000000066010730213552017251 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; int msx_break(); ; ; Checks if the Ctrl-STOP key is being pressed (1 = pressed, 0 = not pressed) ; ; ; $Id: msx_break.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB msx_break LIB msxbios INCLUDE "#msxbios.def" msx_break: ld ix,BREAKX call msxbios sbc a,a and 1 ; if pressed, BREAKX returns $FF ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/msx/msx_breakoff.asm0000755000175000017500000000057310731706075017757 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; void msx_breakoff(); ; ; Disable BREAK ; ; ; $Id: msx_breakoff.asm,v 1.1 2007/12/18 09:00:45 stefano Exp $ ; XLIB msx_breakoff XREF brksave INCLUDE "#msxbasic.def" msx_breakoff: ld hl,BASROM ; disable Control-STOP ld a,(hl) cp 1 ret z ld (brksave),a ld (hl),1 ret z88dk-1.8.ds1/libsrc/msx/msx_breakon.asm0000755000175000017500000000067610731706075017625 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; void msx_breakon(); ; ; Restore disabled BREAK ; ; ; $Id: msx_breakon.asm,v 1.1 2007/12/18 09:00:45 stefano Exp $ ; XLIB msx_breakon XREF brksave INCLUDE "#msxbasic.def" msx_breakon: ld hl,brksave ld a,(hl) cp 1 ret nz ; Already enabled ? ; Ok, we have something to restore ld (BASROM),a ld a,1 ; update the flag ld (hl),a ret z88dk-1.8.ds1/libsrc/msx/msx_clearkey.asm0000755000175000017500000000047410730213552017767 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; void msx_clearkey(); ; ; Clears the keyboard buffer ; ; $Id: msx_clearkey.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB msx_clearkey LIB msxbios INCLUDE "#msxbios.def" msx_clearkey: ld ix,KILBUF jp msxbios z88dk-1.8.ds1/libsrc/msx/msx_color.asm0000755000175000017500000000100010726227173017301 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, 29/11/2007 ; ; int msx_color(int foreground, int background, int border ); ; ; Change the MSX color attributes ; ; $Id: msx_color.asm,v 1.2 2007/12/07 11:28:59 stefano Exp $ ; XLIB msx_color LIB msxbios INCLUDE "#msxbios.def" msx_color: ld ix,0 add ix,sp ld a,(ix+2) ;border ld (0F3EBh),a ld a,(ix+4) ;background ld (0F3EAh),a ld a,(ix+6) ;foreground ld (0F3E9h),a ld a,(0FCAFh) ;SCRMOD ld ix,CHGCLR jp msxbios z88dk-1.8.ds1/libsrc/msx/msx_initpsg.asm0000755000175000017500000000050010730213552017633 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; int msx_initpsg(); ; ; Init the PSG (reset sound etc..) ; ; ; $Id: msx_initpsg.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB msx_initpsg LIB msxbios INCLUDE "#msxbios.def" msx_initpsg: ld ix,GICINI jp msxbios z88dk-1.8.ds1/libsrc/msx/msx_lpt.asm0000755000175000017500000000054510730213552016766 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; int msx_lpt(); ; ; Check if the line printer is ready (1=ready, 0 if not) ; ; $Id: msx_lpt.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB msx_lpt LIB msxbios INCLUDE "#msxbios.def" msx_lpt: ld ix,LPTSTT call msxbios ld hl,0 ret z inc l ret z88dk-1.8.ds1/libsrc/msx/msx_noblank.asm0000755000175000017500000000044610726227173017624 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, 30/11/2007 ; ; void msx_noblank(); ; ; Enable screen ; ; $Id: msx_noblank.asm,v 1.2 2007/12/07 11:28:59 stefano Exp $ ; XLIB msx_noblank LIB msxbios INCLUDE "#msxbios.def" msx_noblank: ld ix,ENASCR jp msxbios z88dk-1.8.ds1/libsrc/msx/msx_readpsg.asm0000755000175000017500000000055210730213552017612 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; int msx_readpsg(int regno); ; ; Read the specified PSG register ; ; ; $Id: msx_readpsg.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB msx_readpsg LIB msxbios INCLUDE "#msxbios.def" msx_readpsg: ld a,l ld ix,RDPSG call msxbios ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/msx/msx_screen.asm0000755000175000017500000000112210731706075017446 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, 12/12/2007 ; ; void msx_screen(int mode); ; ; Change the MSX screen mode; mode in HL (FASTCALL) ; ; $Id: msx_screen.asm,v 1.4 2007/12/18 09:00:45 stefano Exp $ ; XLIB msx_screen LIB msxbios LIB msxextrom INCLUDE "#msxbios.def" msx_screen: ld a,(0FAF8h) ; use EXBRSA to check if running on MSX1 and a ld a,l ; screen mode (FASTCALL parameter passing mode) jr z,screen_msx1 ; yes ld ix,01B5h ; CHGMDP: change screen mode and initialize palette jp msxextrom ; screen_msx1: ld ix,CHGMOD jp msxbios z88dk-1.8.ds1/libsrc/msx/msx_screenmode.asm0000755000175000017500000000050310731706076020316 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; int msx_screenmode(); ; ; Gets the current screen mode ; ; ; $Id: msx_screenmode.asm,v 1.1 2007/12/18 09:00:46 stefano Exp $ ; XLIB msx_screenmode INCLUDE "#msxbasic.def" msx_screenmode: ld a,(SCRMOD) ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/msx/msx_sound.asm0000755000175000017500000000064010730213552017313 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; int msx_sound(int reg, int val); ; ; Play a sound by PSG ; ; ; $Id: msx_sound.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB msx_sound LIB msxbios INCLUDE "#msxbios.def" msx_sound: pop hl pop de ; value in E pop bc push bc pop de pop hl ld a,c ; register number ld ix,WRTPSG jp msxbios z88dk-1.8.ds1/libsrc/msx/msx_text.asm0000755000175000017500000000043510726227173017162 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, 30/11/2007 ; ; int msx_text(); ; ; Switch to text mode ; ; $Id: msx_text.asm,v 1.2 2007/12/07 11:28:59 stefano Exp $ ; XLIB msx_text LIB msxbios INCLUDE "#msxbios.def" msx_text: ld ix,TOTEXT jp msxbios z88dk-1.8.ds1/libsrc/msx/msx_type.asm0000755000175000017500000000061610724730144017153 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, 08/11/2007 ; ; int msx_type(); ; ; The int result is 1 or two, depending on the MSX hardware being used ; ; $Id: msx_type.asm,v 1.2 2007/12/03 07:29:40 stefano Exp $ ; XLIB msx_type msx_type: ld a,($FAF8) ; running on MSX1? and a ld hl,1 jr z,is_msx1 ; yes inc l ; side effect: non zero FLAG if MSX2 is_msx1: ret z88dk-1.8.ds1/libsrc/msx/msx_vpeek.asm0000755000175000017500000000055210726227173017310 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, 29/11/2007 ; ; int msx_vpeek(int address); ; ; Read the MSX video memory ; ; $Id: msx_vpeek.asm,v 1.2 2007/12/07 11:28:59 stefano Exp $ ; XLIB msx_vpeek LIB msxbios INCLUDE "#msxbios.def" msx_vpeek: ; (FASTCALL) -> HL = address ld ix,RDVRM call msxbios ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/msx/msx_vpoke.asm0000755000175000017500000000064610726227173017326 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, 29/11/2007 ; ; void msx_vpoke(int address, int value); ; ; Write the MSX video memory ; ; $Id: msx_vpoke.asm,v 1.2 2007/12/07 11:28:59 stefano Exp $ ; XLIB msx_vpoke LIB msxbios INCLUDE "#msxbios.def" msx_vpoke: pop bc pop de pop hl push hl ; VRAM address push de ; value push bc ; RET address ld a,e ld ix,WRTVRM jp msxbios z88dk-1.8.ds1/libsrc/msx/msx_vram.asm0000755000175000017500000000067510724730144017144 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, 29/11/2007 ; ; int msx_vram(); ; ; Detects the VRAM size (in KB) ; ; $Id: msx_vram.asm,v 1.1 2007/12/03 07:29:40 stefano Exp $ ; XLIB msx_vram msx_vram: ld a,(0FAFCh) ; mode and 00000110b ; extract VRAM size ld hl,16 ; assume 16K (MSX1) ret z ; good assumption cp 00000010b ; 64K? ld l,64 ; assume so ret z ; good assumption add hl,hl ; 128K ret z88dk-1.8.ds1/libsrc/msx/msxbasic.asm0000755000175000017500000000057110730213552017110 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; Internal function, call a ROM BASIC subroutine ; ; ; $Id: msxbasic.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB msxbasic LIB msxrompage defc CALBAS = $0159 msxbasic: exx ex af,af' ; store all registers ld hl,CALBAS jp msxrompage z88dk-1.8.ds1/libsrc/msx/msxextrom.asm0000755000175000017500000000057210730213552017346 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; Internal function, call an EXTROM subroutine ; ; ; $Id: msxextrom.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB msxextrom LIB msxrompage defc EXTROM = $015f msxextrom: exx ex af,af' ; store all registers ld hl,EXTROM jp msxrompage z88dk-1.8.ds1/libsrc/msx/msxrompage.asm0000755000175000017500000000264610730213552017466 0ustar tygrystygrys; ; MSX specific routines ; by Stefano Bodrato, December 2007 ; ; Internal function, finalize the external ROM call ; (safe ROM PAGE-IN / CALL / PAGE-OUT for MSX2) ; This is the official method suggested by ASCII Corp ; ; These perhaps could be optimized when in non-MSXDOS environment. ; ; ; $Id: msxrompage.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB msxrompage LIB msxbios INCLUDE "#msxbios.def" defc H_NMI = $fdd6 msxrompage: push hl ld hl,$C300 push hl ; push NOP ; JP EXTROM push ix ld hl,$21DD push hl ; push LD IX, ld hl,$3333 push hl ; push INC SP; INC SP ld hl,0 add hl,sp ; HL = offset of routine ld a,$C3 ld (H_NMI),a ld (H_NMI+1),hl ; JP in NMI hook ex af,af' exx ; restore all registers ld ix,NMI call msxbios ; call NMI-hook via NMI entry in ROMBIOS ; NMI-hook will call SUBROM exx ex af,af' ; store all returned registers ld hl,10 add hl,sp ld sp,hl ; remove routine from stack ex af,af' exx ; restore all returned registers ret z88dk-1.8.ds1/libsrc/msx.lst0000644000175000017500000000215310763607577015340 0ustar tygrystygrysstdio/msx/fgetc_cons stdio/msx/getk stdio/msx/fputc_cons graphics/msx/clg graphics/clga graphics/clrarea graphics/circle graphics/dcircle2 graphics/draw graphics/drawb graphics/drawr graphics/line graphics/liner2 graphics/plot graphics/msx/plotpixl graphics/point graphics/msx/pointxy graphics/multipoint graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/msx/respixl graphics/unplot graphics/drawbox graphics/setxy graphics/msx/fill graphics/putsprite3 graphics/msx/swapgfxbk graphics/xorborder graphics/msx/xorpixl graphics/xorplot games/msx/joystick games/msx/bit_open games/msx/bit_open_di games/msx/bit_close games/msx/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/beeper msx/msx_blank msx/msx_break msx/msx_breakoff msx/msx_breakon msx/msx_clearkey msx/msx_color msx/msx_initpsg msx/msx_lpt msx/msx_noblank msx/msx_readpsg msx/msx_screen msx/msx_screenmode msx/msx_sound msx/msx_type msx/msx_text msx/msx_vpeek msx/msx_vpoke msx/msx_vram msx/msxbasic msx/msxextrom msx/msxrompage @z80.lst z88dk-1.8.ds1/libsrc/mz.lst0000644000175000017500000000655410712620314015142 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/mz/fgetc_cons stdio/fgets_cons stdio/mz/fputc_cons stdio/mz/getk stdio/puts_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/mz/plotpixl graphics/mz/respixl graphics/mz/xorpixl graphics/mz/clsgraph graphics/putsprite2 graphics/point graphics/mz/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorplot graphics/setxy graphics/vz200/swapgfxbk games/joystick printflike/ltoa_any z88dk-1.8.ds1/libsrc/mzansi.lst0000644000175000017500000000717610712620314016016 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/mz/fgetc_cons stdio/fgets_cons stdio/mz/getk stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/sharp-mz/f_ansi_attr stdio/ansi/sharp-mz/f_ansi_bel stdio/ansi/sharp-mz/f_ansi_char stdio/ansi/sharp-mz/f_ansi_cls stdio/ansi/sharp-mz/f_ansi_dline stdio/ansi/sharp-mz/f_ansi_scrollup stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/mz/plotpixl graphics/mz/respixl graphics/mz/xorpixl graphics/mz/clsgraph graphics/putsprite2 graphics/point graphics/mz/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorplot graphics/setxy graphics/vz200/swapgfxbk games/joystick printflike/ltoa_any z88dk-1.8.ds1/libsrc/nasansi.lst0000755000175000017500000000735610762272462016170 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/8080/fchkstd stdio/8080/fclose stdio/feof stdio/8080/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/8080/fputc stdio/8080/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/8080/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/8080/ungetc stdio/8080/fabandon stdio/nascom/fgetc_cons stdio/fgets_cons stdio/nascom/getk stdio/puts_cons stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/nascom/f_ansi_attr stdio/ansi/nascom/f_ansi_bel stdio/ansi/nascom/f_ansi_char stdio/ansi/nascom/f_ansi_cls stdio/ansi/generic/f_ansi_dline stdio/ansi/nascom/f_ansi_scrollup stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/nascom/textpixl6 graphics/nascom/plotpixl graphics/nascom/respixl graphics/nascom/xorpixl graphics/nascom/clsgraph graphics/nascom/swapgfxbk graphics/text6/div3 graphics/putsprite2 graphics/point graphics/nascom/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorplot graphics/setxy games/joystick printflike/ltoa_any z88dk-1.8.ds1/libsrc/nascom.lst0000755000175000017500000000700010712620314015762 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/8080/fchkstd stdio/8080/fclose stdio/feof stdio/8080/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/8080/fputc stdio/8080/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/8080/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/8080/ungetc stdio/8080/fabandon stdio/nascom/fgetc_cons stdio/fgets_cons stdio/nascom/getk stdio/puts_cons stdio/nascom/fputc_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/nascom/textpixl6 graphics/nascom/plotpixl graphics/nascom/respixl graphics/nascom/xorpixl graphics/nascom/clsgraph stdio/ansi/nascom/f_ansi_cls graphics/nascom/swapgfxbk graphics/text6/div3 graphics/putsprite2 graphics/point graphics/nascom/pointxy graphics/multipoint graphics/rbitmask graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorplot graphics/setxy games/joystick printflike/ltoa_any z88dk-1.8.ds1/libsrc/nbcpm.lst0000644000175000017500000000045410633260265015613 0ustar tygrystygrysnewbrain/cpmzcall newbrain/break_status newbrain/fputc_lcd newbrain/fputs_lcd newbrain/warm_reset newbrain/nb_open newbrain/nb_close newbrain/nb_clear newbrain/nb_getc newbrain/nb_gets newbrain/nb_getblock newbrain/nb_putc newbrain/nb_puts newbrain/nb_putblock newbrain/nb_putval time/newbrain/clock z88dk-1.8.ds1/libsrc/nc100.lst0000644000175000017500000000545310725453054015343 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/nc100/fgetc_cons stdio/fgets_cons stdio/nc100/fputc_cons stdio/nc100/getk stdio/puts_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf printflike/ltoa_any games/joystick z88dk-1.8.ds1/libsrc/net/0000755000175000017500000000000010765202715014555 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/net/deviceoffline.asm0000644000175000017500000000060607130401722020052 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: device_offline XLIB deviceoffline LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .deviceoffline call_pkg(tcp_offline) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,deviceoffline jp no_zsock z88dk-1.8.ds1/libsrc/net/deviceonline.asm0000644000175000017500000000060107130401722017707 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: device_online XLIB deviceonline LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .deviceonline call_pkg(tcp_online) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,deviceonline jp no_zsock z88dk-1.8.ds1/libsrc/net/get_networks.c0000644000175000017500000000063007357654003017437 0ustar tygrystygrys /* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include static struct data_entry ip_networks[] = { { "arpa", 10 ,0 }, { "arpanet", 10 ,0 }, { "loop", 127 , 0 }, { "loopback", 127 ,0 }, { 0, 0,0 } }; struct data_entry *get_networks() { return ip_networks; } z88dk-1.8.ds1/libsrc/net/get_protocols.c0000644000175000017500000000066307357654003017615 0ustar tygrystygrys /* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include static struct data_entry ip_protocols[] = { { "ip", 0, 0 }, { "icmp", 1, 0 }, // { "igmp", 2, 0 }, { "tcp", 6, 0 }, { "udp", 17,0 }, { 0, 0,0} }; struct data_entry *get_protocols() { return ip_protocols; } z88dk-1.8.ds1/libsrc/net/get_services.c0000644000175000017500000000136107357654003017410 0ustar tygrystygrys /* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include static struct data_entry ip_services[] = { { "echo", 7 ,prot_TCP }, { "qotd", 17 ,prot_TCP }, { "chargen", 19 ,prot_TCP }, { "ftp", 21 ,prot_TCP }, { "ftp-data", 20 ,prot_TCP }, { "telnet", 23 ,prot_TCP }, { "smtp", 25 ,prot_TCP }, { "tftp", 69 ,prot_UDP }, { "finger", 79 ,prot_TCP }, { "www", 80 ,prot_TCP }, { "pop-2", 109 ,prot_TCP }, { "pop-3", 110 ,prot_TCP }, { 0, 0,0 } }; struct data_entry *get_services() { return ip_services; } z88dk-1.8.ds1/libsrc/net/getdomainname.asm0000644000175000017500000000062507130401722020061 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: getdomainname XLIB getdomainname LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .getdomainname ld a,r_getdomainname call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,getdomainname jp no_zsock z88dk-1.8.ds1/libsrc/net/gethostaddr.asm0000644000175000017500000000061307130401722017556 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: gethostaddr XLIB gethostaddr LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .gethostaddr ld a,r_gethostaddr call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,gethostaddr jp no_zsock z88dk-1.8.ds1/libsrc/net/getnetbyname.c0000644000175000017500000000033607425022025017376 0ustar tygrystygrys/* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include int getnetbyname(char *name) { return_nc (getxxbyname(get_networks(),name)); } z88dk-1.8.ds1/libsrc/net/getnetbynumber.c0000644000175000017500000000043007425022025017741 0ustar tygrystygrys/* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include i8_t *getnetbynumber(port,store) tcpport_t port; u8_t *store; { return_nc (getxxbyport(get_networks(),port,store)); } z88dk-1.8.ds1/libsrc/net/getnetstat.asm0000644000175000017500000000060607130401722017432 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: getnetstat XLIB getnetstat LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .getnetstat ld a,r_getnetstat call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,getnetstat jp no_zsock z88dk-1.8.ds1/libsrc/net/getprotobyname.c0000644000175000017500000000034107425022025017747 0ustar tygrystygrys/* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include int getprotobyname(char *name) { return_nc (getxxbyname(get_protocols(),name)); } z88dk-1.8.ds1/libsrc/net/getprotobynumber.c0000644000175000017500000000043307425022025020321 0ustar tygrystygrys/* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include i8_t *getprotobynumber(port,store) tcpport_t port; u8_t *store; { return_nc (getxxbyport(get_protocols(),port,store)); } z88dk-1.8.ds1/libsrc/net/getservbyname.c0000644000175000017500000000033707425022025017570 0ustar tygrystygrys/* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include int getservbyname(char *name) { return_nc (getxxbyname(get_services(),name)); } z88dk-1.8.ds1/libsrc/net/getservbyport.c0000644000175000017500000000043007425022025017626 0ustar tygrystygrys/* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include char *getservbyport(port,store) tcpport_t port; u8_t *store; { return_nc (getxxbyport(get_services(),port,store)); } z88dk-1.8.ds1/libsrc/net/getservprotobyname.c0000644000175000017500000000066407425022025020657 0ustar tygrystygrys/* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include i8_t getservprotobyname(char *name ) { struct data_entry *search=get_services(); while (search->name) { if (!strcmp(search->name, name)) { return_nc search->protocol; } search++; } return_nc 0; } z88dk-1.8.ds1/libsrc/net/getservprotobyport.c0000644000175000017500000000067707425022025020727 0ustar tygrystygrys/* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include i8_t getservprotobyport(port ) tcpport_t port; { struct data_entry *search=get_services(); while (search->name) { if (search->port == port) { return_nc search->protocol; } search++; } return_nc 0; } z88dk-1.8.ds1/libsrc/net/getxxbyname.c0000644000175000017500000000070707357654003017264 0ustar tygrystygrys/* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include tcpport_t getxxbyname(struct data_entry *type, char *name ) { struct data_entry *search; search=type; while (search->name) { if (!strcmp(search->name, name)) { return search->port; } search++; } return 0; } z88dk-1.8.ds1/libsrc/net/getxxbyport.c0000644000175000017500000000120307357654003017320 0ustar tygrystygrys/* * ZSock C Library * * Part of the getxxbyXX series of functions * * (C) 6/10/2001 Dominic Morris */ #include char *getxxbyport(type, port, store_in ) struct data_entry *type; tcpport_t port; char *store_in; { struct data_entry *search; search=type; while (search->name) { if (search->port == port) { strcpy(store_in, search->name); return store_in; } search++; } /* Didnt find - just return the value */ sprintf(store_in, "%u", port); return store_in; } z88dk-1.8.ds1/libsrc/net/GoTCP.asm0000644000175000017500000000055207130401722016164 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: device_online XLIB GoTCP LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .GoTCP call_pkg(tcp_GoTCP) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,GoTCP jp no_zsock z88dk-1.8.ds1/libsrc/net/inet_addr.asm0000644000175000017500000000060107130401722017174 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: inet_addr XLIB inet_addr LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .inet_addr ld a,r_inet_addr call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,inet_addr jp no_zsock z88dk-1.8.ds1/libsrc/net/inet_ntoa.asm0000644000175000017500000000060107130401722017223 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: inet_ntoa XLIB inet_ntoa LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .inet_ntoa ld a,r_inet_ntoa call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,inet_ntoa jp no_zsock z88dk-1.8.ds1/libsrc/net/IPHeaderCheck.asm0000644000175000017500000000467607242745615017662 0ustar tygrystygrys; ; Do the checksum for an IP packet ; ; Assumes packet is fully built etc, fills in the appropriate field ; ; djm 12/2/2001 ; XLIB IPHeaderCheck ; void IPHeaderSum(ipheader_t *pkt) .IPHeaderCheck pop de pop hl push hl push de ld bc,10 add hl,bc xor a ld (hl),a inc hl ld (hl),a ; Set checksum to zero push hl scf sbc hl,bc ld a,(hl) and $0f rlca rlca ld c,a ld b,0 pop hl ld (hl),c dec hl ld (hl),b ret .FastCSum push hl push de ld a,c ld c,b ; swap b,c srl c rra ; adjust counter for words ld b,a ; (cb=#words) push af ; save cary for a single byte ld de,0 ; de=sum or c ; check for zero also clear carry jr z,FastCsum_2 ; Only one or less bytes inc c ld a,b or a jr z,FastCsum_1b .FastCsum_1 ; use counter c for outer loop ld a,(hl) inc hl adc a,d ld d,a ld a,(hl) inc hl adc a,e ld e,a djnz FastCsum_1 ; inner loop .FastCsum_1b dec c jr nz,FastCsum_1 ; outer loop ld a,d adc a,0 ld d,a ld a,e adc a,0 ld e,a ld a,d adc a,0 ld d,a .FastCsum_2 pop af ; check for single byte jr nc,FastCsum_3 ld a,(hl) add a,d ld d,a ld a,e adc a,0 ld e,a ld a,d adc a,0 ld d,a ld a,e adc a,0 ld e,a .FastCsum_3 ld a,d cpl ld b,a ld a,e cpl ld c,a pop de pop hl ret z88dk-1.8.ds1/libsrc/net/killdaemon.asm0000644000175000017500000000060607130401722017367 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: killdaemon XLIB killdaemon LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .killdaemon ld a,r_killdaemon call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,killdaemon jp no_zsock z88dk-1.8.ds1/libsrc/net/Makefile0000644000175000017500000000120310763607700016212 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../Make.config CFILES = \ get_networks.c \ get_protocols.c \ get_services.c \ getnetbyname.c \ getnetbynumber.c \ getprotobyname.c \ getprotobynumber.c \ getservbyname.c \ getservbyport.c \ getservprotobyname.c \ getservprotobyport.c \ getxxbyname.c \ getxxbyport.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: net net: $(OBJECTS) $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/net @zsock_list $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/netdev @zsockdev_list .c.o: zcc +z88 $(CFLAGS) $*.c clean: $(RM) *.obj *.sym *.map *.o* *.i zcc_opt.def $(AFILES) z88dk-1.8.ds1/libsrc/net/no_zsock.asm0000644000175000017500000000167710445303314017107 0ustar tygrystygrys; ; Routine called when there is no ; Zsock library/packages installed ; ; djm 12/2/2000 XLIB no_zsock LIB exit INCLUDE "#stdio.def" .no_zsock ld hl,message call_oz(gn_sop) call_oz(os_in) ld hl,0 jp exit .message defb 1,'7','#','3',32+7,32+1,32+34,32+7,131 ;dialogue box defb 1,'2','C','3',1,'4','+','T','U','R',1,'2','J','C' defb 1,'3','@',32,32 ;reset to (0,0) defm "ZSock Library Error" defb 1,'3','@',32,32 ,1,'2','A',32+34 ;keep settings for 10 defb 1,'7','#','3',32+8,32+3,32+32,32+5,128 ;dialogue box defb 1,'3','@',32,32,1,'2','J','C' defm "The ZSock shared library could not be opened" defb 13,10 defm "Please install both ZSock and Installer v2+" defb 13,10 defm "to use this program correctly" defb 13,10 defm "ZSock also requires 2 free banks to function" defb 13,10 defm "correctly - delete files if required" defb 13,10 defb 0 z88dk-1.8.ds1/libsrc/net/no_zsockdev.asm0000644000175000017500000000017507317325644017614 0ustar tygrystygrys; ; Routine called when there is no ; Zsock library/packages installed ; ; djm 7/2/2001 XLIB no_zsock .no_zsock ret z88dk-1.8.ds1/libsrc/net/resolve.asm0000644000175000017500000000056707130401722016735 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: resolve XLIB resolve LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .resolve ld a,r_resolve call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,resolve jp no_zsock z88dk-1.8.ds1/libsrc/net/reverse_addr_lookup.asm0000644000175000017500000000066307130401722021311 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: reverse_addr_lookup XLIB reverse_addr_lookup LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .reverse_addr_lookup ld a,r_reverse_addr_lookup call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,reverse_addr_lookup jp no_zsock z88dk-1.8.ds1/libsrc/net/sethostaddr.asm0000644000175000017500000000061307130401722017572 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sethostaddr XLIB sethostaddr LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sethostaddr ld a,r_sethostaddr call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sethostaddr jp no_zsock z88dk-1.8.ds1/libsrc/net/setnameservers.asm0000644000175000017500000000063207130401722020315 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: setnameservers XLIB setnameservers LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .setnameservers ld a,r_setnameservers call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,setnameservers jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_abort.asm0000644000175000017500000000060607130401722017376 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_abort XLIB sock_abort LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_abort ld a,r_sock_abort call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_abort jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_chktimeout.asm0000644000175000017500000000063707130401722020447 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_chktimeout XLIB sock_chktimeout LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_chktimeout ld a,r_sock_chktimeout call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_chktimeout jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_close.asm0000644000175000017500000000060607130401722017374 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_close XLIB sock_close LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_close ld a,r_sock_close call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_close jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_closed.asm0000644000175000017500000000061307130401722017536 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_closed XLIB sock_closed LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_closed ld a,r_sock_closed call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_closed jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_dataready.asm0000644000175000017500000000063207130401722020224 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_dataready XLIB sock_dataready LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_dataready ld a,r_sock_dataready call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_dataready jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_flush.asm0000644000175000017500000000060607130401722017410 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_flush XLIB sock_flush LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_flush ld a,r_sock_flush call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_flush jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_getinfo.asm0000644000175000017500000000062007357654003017733 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_getinfo XLIB sock_getinfo LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_getinfo ld a,r_sock_getinfo call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_getinfo jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_getptr.asm0000644000175000017500000000061307130401722017572 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_getptr XLIB sock_getptr LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_getptr ld a,r_sock_getptr call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_getptr jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_listen.asm0000644000175000017500000000061307130401722017563 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_listen XLIB sock_listen LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_listen ld a,r_sock_listen call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_listen jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_open.asm0000644000175000017500000000060107130401722017223 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_open XLIB sock_open LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_open ld a,r_sock_open call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_open jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_opened.asm0000644000175000017500000000061307130401722017537 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_opened XLIB sock_opened LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_opened ld a,r_sock_opened call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_opened jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_pair_listen.asm0000644000175000017500000000063707237752755020633 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_listen XLIB sock_pair_listen LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_pair_listen ld a,r_sock_pair_listen call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_pair_listen jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_putc.asm0000644000175000017500000000060107130401722017235 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_putc XLIB sock_putc LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_putc ld a,r_sock_putc call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_putc jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_puts.asm0000644000175000017500000000060107130401722017255 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_puts XLIB sock_puts LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_puts ld a,r_sock_puts call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_puts jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_read.asm0000644000175000017500000000060107130401722017175 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_read XLIB sock_read LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_read ld a,r_sock_read call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_read jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_recv.asm0000644000175000017500000000060107357654003017236 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_recv XLIB sock_recv LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_recv ld a,r_sock_recv call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_recv jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_sethandler.asm0000644000175000017500000000063707130401722020424 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_sethandler XLIB sock_sethandler LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_sethandler ld a,r_sock_sethandler call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_sethandler jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_setmode.asm0000644000175000017500000000062007130401722017723 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_setmode XLIB sock_setmode LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_setmode ld a,r_sock_setmode call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_setmode jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_setptr.asm0000644000175000017500000000061307130401722017606 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_setptr XLIB sock_setptr LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_setptr ld a,r_sock_setptr call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_setptr jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_setrsize.asm0000644000175000017500000000062507130401722020140 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_setrsize XLIB sock_setrsize LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_setrsize ld a,r_sock_setrsize call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_setrsize jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_setssize.asm0000644000175000017500000000062507317325644020160 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_setssize XLIB sock_setssize LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_setssize ld a,r_sock_setssize call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_setssize jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_settimeout.asm0000644000175000017500000000063707130401722020475 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_settimeout XLIB sock_settimeout LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_settimeout ld a,r_sock_settimeout call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_settimeout jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_settos.asm0000644000175000017500000000061307130401722017606 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_settos XLIB sock_settos LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_settos ld a,r_sock_settos call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_settos jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_setttl.asm0000644000175000017500000000061307130401722017604 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_setttl XLIB sock_setttl LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_setttl ld a,r_sock_setttl call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_setttl jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_shutdown.asm0000644000175000017500000000062507130401722020143 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_shutdown XLIB sock_shutdown LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_shutdown ld a,r_sock_shutdown call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_shutdown jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_waitclose.asm0000644000175000017500000000063207130401722020260 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_waitclose XLIB sock_waitclose LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_waitclose ld a,r_sock_waitclose call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_waitclose jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_waitopen.asm0000644000175000017500000000062507130401722020116 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_waitopen XLIB sock_waitopen LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_waitopen ld a,r_sock_waitopen call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_waitopen jp no_zsock z88dk-1.8.ds1/libsrc/net/sock_write.asm0000644000175000017500000000060607130401722017421 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: sock_write XLIB sock_write LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .sock_write ld a,r_sock_write call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,sock_write jp no_zsock z88dk-1.8.ds1/libsrc/net/tcp_calloc.asm0000644000175000017500000000060607130401722017353 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: tcp_calloc XLIB tcp_calloc LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .tcp_calloc ld a,r_tcp_calloc call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,tcp_calloc jp no_zsock z88dk-1.8.ds1/libsrc/net/tcp_catchall.asm0000644000175000017500000000063707130401722017675 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: tcp_regcatchall XLIB tcp_regcatchall LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .tcp_regcatchall ld a,r_tcp_regcatchall call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,tcp_regcatchall jp no_zsock z88dk-1.8.ds1/libsrc/net/tcp_chktimeout.asm0000644000175000017500000000063207130401722020271 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: tcp_chktimeout XLIB tcp_chktimeout LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .tcp_chktimeout ld a,r_tcp_chktimeout call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,tcp_chktimeout jp no_zsock z88dk-1.8.ds1/libsrc/net/tcp_free.asm0000644000175000017500000000057407130401722017043 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: tcp_free XLIB tcp_free LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .tcp_free ld a,r_tcp_free call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,tcp_free jp no_zsock z88dk-1.8.ds1/libsrc/net/tcp_malloc.asm0000644000175000017500000000060607130401722017365 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: tcp_malloc XLIB tcp_malloc LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .tcp_malloc ld a,r_tcp_malloc call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,tcp_malloc jp no_zsock z88dk-1.8.ds1/libsrc/net/tcp_pagein.asm0000644000175000017500000000056507130401722017365 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: user_pagein XLIB tcp_pagein LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .tcp_pagein call_pkg(tcp_pgin) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,tcp_pagein jp no_zsock z88dk-1.8.ds1/libsrc/net/tcp_pageout.asm0000644000175000017500000000070107130401722017556 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: tcp_pageout XLIB tcp_pageout LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .tcp_pageout pop de ;ret address pop hl ;l holds bank to page in push hl push de call_pkg(tcp_pgout) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,tcp_pageout jp no_zsock z88dk-1.8.ds1/libsrc/net/tcp_setctimeout.asm0000644000175000017500000000063707130401722020467 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: tcp_setctimeout XLIB tcp_setctimeout LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .tcp_setctimeout ld a,r_tcp_setctimeout call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,tcp_setctimeout jp no_zsock z88dk-1.8.ds1/libsrc/net/tcp_settimeout.asm0000644000175000017500000000063207130401722020317 0ustar tygrystygrys; ; This file is automatically generated ; ; Do not edit!!! ; ; djm 12/2/2000 ; ; ZSock Lib function: tcp_settimeout XLIB tcp_settimeout LIB no_zsock INCLUDE "#packages.def" INCLUDE "#zsock.def" .tcp_settimeout ld a,r_tcp_settimeout call_pkg(tcp_all) ret nc ; We failed..are we installed? cp rc_pnf scf ;signal error ret nz ;Internal error call_pkg(tcp_ayt) jr nc,tcp_settimeout jp no_zsock z88dk-1.8.ds1/libsrc/net/zsock_list0000644000175000017500000000140507357654003016670 0ustar tygrystygrysGoTCP deviceoffline deviceonline getdomainname gethostaddr getnetbyname getnetbynumber getnetstat getprotobyname getprotobynumber getservbyname getservbyport getservprotobyname getservprotobyport inet_addr inet_ntoa killdaemon no_zsock resolve reverse_addr_lookup sethostaddr setnameservers sock_abort sock_chktimeout sock_close sock_closed sock_dataready sock_flush sock_getptr sock_listen sock_open sock_opened sock_pair_listen sock_putc sock_puts sock_read sock_sethandler sock_setmode sock_setptr sock_setrsize sock_settos sock_setttl sock_settimeout sock_shutdown sock_waitopen sock_waitclose sock_write tcp_calloc tcp_catchall tcp_chktimeout tcp_free tcp_malloc tcp_pagein tcp_pageout tcp_setctimeout tcp_settimeout IPHeaderCheck sock_setssize sock_recv sock_getinfo z88dk-1.8.ds1/libsrc/net/zsockdev_list0000644000175000017500000000141007357654003017363 0ustar tygrystygrysGoTCP deviceoffline deviceonline getdomainname gethostaddr getnetbyname getnetbynumber getnetstat getprotobyname getprotobynumber getservbyname getservbyport getservprotobyname getservprotobyport inet_addr inet_ntoa killdaemon no_zsockdev resolve reverse_addr_lookup sethostaddr setnameservers sock_abort sock_chktimeout sock_close sock_closed sock_dataready sock_flush sock_getptr sock_listen sock_open sock_opened sock_pair_listen sock_putc sock_puts sock_read sock_sethandler sock_setmode sock_setptr sock_setrsize sock_settos sock_setttl sock_settimeout sock_shutdown sock_waitopen sock_waitclose sock_write tcp_calloc tcp_catchall tcp_chktimeout tcp_free tcp_malloc tcp_pagein tcp_pageout tcp_setctimeout tcp_settimeout IPHeaderCheck sock_setssize sock_recv sock_getinfo z88dk-1.8.ds1/libsrc/newbrain/0000755000175000017500000000000010765202715015574 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/newbrain/break_status.asm0000644000175000017500000000047210630555202020761 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 30/03/2007 ; ; ; Check if user pressed BREAK ; 1 if BREAK, otherwise 0 ; ; ; ; $Id: break_status.asm,v 1.2 2007/06/03 15:13:06 stefano Exp $ ; XLIB break_status .break_status rst 20h defb 36h ld hl,1 ret c dec hl ret z88dk-1.8.ds1/libsrc/newbrain/cpmzcall.asm0000644000175000017500000000103710630555202020075 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; This function is linked only in the CP/M extension version ; it calls the ROM functions via the CP/M facility ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; Used internally only ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: cpmzcall.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB ZCALL .ZCALL jp $f4fb ; CPMZCALL z88dk-1.8.ds1/libsrc/newbrain/fputc_lcd.asm0000755000175000017500000000061610630555202020240 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 30/03/2007 ; ; ; Print a character on LCD display ; ; ; ; $Id: fputc_lcd.asm,v 1.3 2007/06/03 15:13:06 stefano Exp $ ; XLIB fputc_lcd .fputc_lcd ld hl,2 add hl,sp ld e,(hl) ; char inc hl inc hl ld a,(hl) cp 16 ret nc ld a,77 sub (hl) ; pos 0..15 ld l,a ld h,0 ld a,e ld (hl),a ret z88dk-1.8.ds1/libsrc/newbrain/fputs_lcd.asm0000644000175000017500000000060710631740155020261 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 22/05/2007 ; ; ; Print a string on LCD display ; ; ; ; $Id: fputs_lcd.asm,v 1.2 2007/06/07 08:23:09 stefano Exp $ ; XLIB fputs_lcd LIB ZCALL .fputs_lcd pop bc pop hl push hl push bc ld de,77 ld b,15 .sloop ld a,(hl) and a ret z ld (de),a inc hl dec de djnz sloop ret z88dk-1.8.ds1/libsrc/newbrain/nb_clear.asm0000644000175000017500000000106510630555202020036 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; close all the streams ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; void nb_clear( ); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: nb_clear.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB nb_clear LIB nb_close .nb_clear ld a,0 .closelp ld h,0 ld l,a push af call nb_close pop af inc a and a jr nz,closelp ret z88dk-1.8.ds1/libsrc/newbrain/nb_close.asm0000644000175000017500000000105610630555202020055 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; closes a stream ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; void nb_close( int stream ); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: nb_close.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB nb_close LIB ZCALL .nb_close ; __FASTCALL__ mode, stream number is stored in HL ld e,l call ZCALL defb $34 ; ZCLOSE ret z88dk-1.8.ds1/libsrc/newbrain/nb_getblock.asm0000755000175000017500000000141010632271211020534 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; get a block from stream, return with the number of read bytes ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; int nb_getblock( int stream, char *bytes, int length ); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: nb_getblock.asm,v 1.2 2007/06/08 15:15:21 stefano Exp $ ; XLIB nb_getblock LIB ZCALL .nb_getblock ld ix,2 add ix,sp ld e,(ix+4) ; stream ld c,(ix+0) ; block length ld b,(ix+1) ld l,(ix+2) ; block location ld h,(ix+3) push bc call ZCALL defb $3c ; zblkin and a pop hl sbc hl,bc ret z88dk-1.8.ds1/libsrc/newbrain/nb_getc.asm0000644000175000017500000000113510630555202017670 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; get a char from stream ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; int nb_getc( int stream ); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: nb_getc.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB nb_getc LIB ZCALL .nb_getc ; __FASTCALL__ mode, stream number is stored in HL ld e,l call ZCALL defb $31 ; zinput ld hl,-1 ret c inc hl ld l,a ret z88dk-1.8.ds1/libsrc/newbrain/nb_gets.asm0000644000175000017500000000141210632271211017703 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 06/06/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - ; ; get a string from stream ; ; - - - - - - - - - - - - - - - - - - - - - ; ; char *nb_gets( int stream, char *bytes ); ; ; - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: nb_gets.asm,v 1.1 2007/06/08 15:15:21 stefano Exp $ ; XLIB nb_gets LIB ZCALL .nb_gets ld ix,2 add ix,sp ld e,(ix+2) ; stream ld l,(ix+0) ; block location ld h,(ix+1) push hl ld bc,255 ; read max 255 bytes call ZCALL defb $3c ; zblkin ld a,255 sub c ; number of read bytes ld e,a ld d,0 pop hl push hl add hl,de dec hl ; we overwrite the last ld (hl),d ; with zero pop hl ret z88dk-1.8.ds1/libsrc/newbrain/nb_open.asm0000644000175000017500000000162310630555202017711 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; int nb_open( int mode, int stream, int device, int port, char *paramstr ); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: nb_open.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB nb_open LIB ZCALL .nb_open ld ix,2 add ix,sp ld a,(ix+8) ; mode ld (openmode),a ld l,(ix+0) ; parameter string ld h,(ix+1) ;parameter string length count ld bc,0 push hl .strct ld a,(hl) and a jr z,strcount inc hl inc bc jr strct .strcount pop hl ld e,(ix+6) ; stream ld a,(ix+4) ; device ld d,(ix+2) ; port call ZCALL .openmode defb $0 ; zopenin = $32; zopenout = $33; ld hl,0 jp nc,noerror ld l,a ; return error code .noerror ret z88dk-1.8.ds1/libsrc/newbrain/nb_putblock.asm0000644000175000017500000000136110632271211020567 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; put a byte block to stream, return the number of written bytes ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; int nb_putblock( int stream, char *bytes, int length ); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: nb_putblock.asm,v 1.3 2007/06/08 15:15:21 stefano Exp $ ; XLIB nb_putblock LIB ZCALL .nb_putblock ld ix,2 add ix,sp ld e,(ix+4) ; stream ld c,(ix+0) ; block length ld b,(ix+1) ld l,(ix+2) ; block location ld h,(ix+3) call ZCALL defb $3d ; zblkout ld h,b ld l,c ret z88dk-1.8.ds1/libsrc/newbrain/nb_putc.asm0000644000175000017500000000110610630555202017717 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; put char to stream ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; void nb_putc( int stream, char byte ); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: nb_putc.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB nb_putc LIB ZCALL .nb_putc ld ix,2 add ix,sp ld a,(ix+0) ; byte ld e,(ix+2) ; stream call ZCALL defb $30 ; zoutput ret z88dk-1.8.ds1/libsrc/newbrain/nb_puts.asm0000644000175000017500000000135610630555202017746 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; put a string to stream ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; void nb_puts( int stream, char *text ); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: nb_puts.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB nb_puts LIB ZCALL .nb_puts ld ix,2 add ix,sp ld e,(ix+2) ; stream ld l,(ix+0) ; string ld h,(ix+1) ;parameter string length count ld bc,0 push hl .strct ld a,(hl) and a jr z,strcount inc hl inc bc jr strct .strcount pop hl call ZCALL defb $3d ; zblkout ret z88dk-1.8.ds1/libsrc/newbrain/nb_putval.asm0000644000175000017500000000143510630555202020264 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; put int value to stream, converting to float ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; void nb_putval( int stream, int value ); ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: nb_putval.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB nb_putval LIB ZCALL .fpstore defs 6 .nb_putval ld ix,2 add ix,sp ld e,(ix+0) ; value ld d,(ix+1) call ZCALL defb $28 ; zflt ld hl,fpstore push hl call ZCALL defb $2d ; zstf pop hl ld e,(ix+2) ; stream ld b,6 .outloop ld a,(hl) call ZCALL defb $30 ; zoutput djnz outloop ret z88dk-1.8.ds1/libsrc/newbrain/warm_reset.asm0000644000175000017500000000037210630555202020441 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 05/04/2007 ; ; ; warm reset: foolishly jump to BASIC entry ; ; ; ; $Id: warm_reset.asm,v 1.2 2007/06/03 15:13:06 stefano Exp $ ; XLIB warm_reset .warm_reset jp 49373 z88dk-1.8.ds1/libsrc/newbrain/zcall.asm0000644000175000017500000000102610630555202017373 0ustar tygrystygrys; ; Grundy Newbrain Specific libraries ; ; Stefano Bodrato - 19/05/2007 ; ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; This function is linked only in the non-CP/M version ; it calls the ROM functions via the standard rst entry ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; Used internally only ; ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ; ; $Id: zcall.asm,v 1.1 2007/06/03 15:13:06 stefano Exp $ ; XLIB ZCALL .ZCALL jp $20 ; ZCALL z88dk-1.8.ds1/libsrc/newbrain.lst0000755000175000017500000000613510725453054016330 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/newbrain/fgetc_cons stdio/fgets_cons stdio/newbrain/getk stdio/puts_cons stdio/newbrain/fputc_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf printflike/ltoa_any newbrain/zcall newbrain/break_status newbrain/fputc_lcd newbrain/fputs_lcd newbrain/warm_reset newbrain/nb_open newbrain/nb_close newbrain/nb_clear newbrain/nb_getc newbrain/nb_gets newbrain/nb_getblock newbrain/nb_putc newbrain/nb_puts newbrain/nb_putblock newbrain/nb_putval time/newbrain/clock games/joystick z88dk-1.8.ds1/libsrc/oz/0000755000175000017500000000000010765202715014417 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/emu/0000755000175000017500000000000010765202715015205 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/emu/ozgfx/0000755000175000017500000000000010765202715016342 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/emu/ozgfx/ozbox.asm0000755000175000017500000000125107747247131020216 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; void ozbox(int x, int y, int width, int height); ; ; ------ ; $Id: ozbox.asm,v 1.1 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozbox LIB swapgfxbk LIB swapgfxbk1 LIB drawbox LIB plotpixel ; yes, this costs some byte, but I preferred to ; leave ozpointcolor and ozplotpixel as they are. .ozbox ld ix,0 add ix,sp ld c,(ix+8) ld b,(ix+6) ld l,(ix+4) ld h,(ix+2) ld ix,plotpixel call swapgfxbk call drawbox jp swapgfxbk1 z88dk-1.8.ds1/libsrc/oz/emu/ozgfx/ozcircle.asm0000755000175000017500000000151107747247131020666 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; void ozcircle(int x,int y,byte r,byte color); ; ; ------ ; $Id: ozcircle.asm,v 1.1 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozcircle LIB swapgfxbk LIB swapgfxbk1 LIB draw_circle LIB ozplotpixel LIB ozpointcolor .ozcircle ld ix,0 add ix,sp ld a,(ix+2) and 4 push af call ozpointcolor ld e,1 ;skip ld d,(ix+4) ;radius ld c,(ix+6) ;y ld b,(ix+8) ;x ld ix,ozplotpixel call swapgfxbk pop af jr nz,filloop call draw_circle jp swapgfxbk1 .filloop push bc push de call draw_circle pop de pop bc dec d jr nz,filloop jp swapgfxbk1 z88dk-1.8.ds1/libsrc/oz/emu/ozgfx/ozfilledbox.asm0000755000175000017500000000163307747247131021402 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; void ozfilledbox(int x, int y, int width, int height); ; ; ------ ; $Id: ozfilledbox.asm,v 1.1 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozfilledbox LIB swapgfxbk LIB swapgfxbk1 LIB drawbox LIB ozplotpixel LIB ozpointcolor .ozfilledbox ld ix,0 add ix,sp call ozpointcolor ld c,(ix+4) ; height ld b,(ix+6) ; width ld l,(ix+8) ; y ld h,(ix+10) ; x ld ix,ozplotpixel call swapgfxbk ld a,c ld c,h ; BC - > horizontal parameters ld h,a .bloop2 push bc .bloop1 push hl ld a,b add c ld h,a ld de, plot_RET push de jp (ix) .plot_RET pop hl djnz bloop1 pop bc inc l dec h jr nz,bloop2 jp swapgfxbk1 z88dk-1.8.ds1/libsrc/oz/emu/ozgfx/ozgetpoint.asm0000755000175000017500000000116407747723147021270 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; int ozgetpoint(int x, int y); ; ; ------ ; $Id: ozgetpoint.asm,v 1.1 2003/10/29 11:37:11 stefano Exp $ ; XLIB ozgetpoint LIB pointxy LIB swapgfxbk .ozgetpoint ld ix,0 add ix,sp ld l,(ix+2) ld h,(ix+4) call swapgfxbk call pointxy ex af,af' call swapgfxbk ex af,af' ld hl,0 ret z ;pixel set inc hl ret z88dk-1.8.ds1/libsrc/oz/emu/ozgfx/ozhline.asm0000755000175000017500000000125507747723147020537 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; void ozhline(byte x,byte y,byte len,byte color) ; ; ------ ; $Id: ozhline.asm,v 1.2 2003/10/29 11:37:11 stefano Exp $ ; XLIB ozhline LIB swapgfxbk LIB swapgfxbk1 LIB line LIB ozplotpixel LIB ozpointcolor .ozhline ld ix,0 add ix,sp call ozpointcolor ld l,(ix+6) ;y0 ld h,(ix+8) ;x0 ld d,l ;y1 ld a,(ix+4) add h dec a ld e,a ;x1 (x0 + len-1) call swapgfxbk push hl push de call ozplotpixel pop de pop hl ld ix,ozplotpixel call line jp swapgfxbk1 z88dk-1.8.ds1/libsrc/oz/emu/ozgfx/ozline.asm0000755000175000017500000000127007747247131020356 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; void ozline(int x,int y,int x2,int y2,byte color); ; ; ------ ; $Id: ozline.asm,v 1.1 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozline LIB swapgfxbk LIB swapgfxbk1 LIB line LIB ozplotpixel LIB ozpointcolor .ozline ld ix,0 add ix,sp call ozpointcolor ld l,(ix+8) ;y0 ld h,(ix+10) ;x0 ld e,(ix+4) ;y1 ld d,(ix+6) ;x1 call swapgfxbk push hl push de call ozplotpixel pop de pop hl ld ix,ozplotpixel call line jp swapgfxbk1 z88dk-1.8.ds1/libsrc/oz/emu/ozgfx/ozplotpixel.asm0000755000175000017500000000134707747247131021454 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; ------ ; $Id: ozplotpixel.asm,v 1.1 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozplotpixel XDEF put_instr LIB pixeladdress XREF COORDS INCLUDE "../graphics/grafix.inc" ozplotpixel: IF maxx <> 256 ld a,h cp maxx jr nc,xyoverflow ENDIF ld a,l cp maxy jr nc,xyoverflow ld (COORDS),hl push bc call pixeladdress ld b,a ld a,1 jr z, put_pixel plot_position: rlca djnz plot_position put_pixel: ex de,hl put_instr: nop ; cpl nop or (hl) ; and (hl) xor (hl) ld (hl),a pop bc ret xyoverflow: ld hl,-1 ret z88dk-1.8.ds1/libsrc/oz/emu/ozgfx/ozpoint.asm0000755000175000017500000000103307747247131020555 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; int ozpoint(int x, int y, byte color); ; ; ------ ; $Id: ozpoint.asm,v 1.1 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozpoint LIB swapgfxbk LIB swapgfxbk1 LIB ozplotpixel LIB ozpointcolor .ozpoint ld ix,0 add ix,sp call ozpointcolor ld l,(ix+4) ld h,(ix+6) call swapgfxbk call ozplotpixel jp swapgfxbk1 z88dk-1.8.ds1/libsrc/oz/emu/ozgfx/ozpointcolor.asm0000755000175000017500000000140007747247131021612 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; "set color" self modifying code service routine ; sets the AND/OR/XOR mode ; 0 = white ; 1 = black ; 2 = xor ; ; ------ ; $Id: ozpointcolor.asm,v 1.1 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozpointcolor LIB ozplotpixel XREF put_instr .ozpointcolor ld a,(ix+2) ld hl,put_instr and 3 ;WHITE ? jr nz,nowhite ld a,$2f ;CPL ld (hl),a inc hl ld a,$a6 ;AND (HL) ld (hl),a ret .nowhite dec a ;BLACK ? jr nz,noblack ld (hl),a ;NOP inc hl ld a,$b6 ;OR (HL) ld (hl),a ret .noblack dec a ;XOR mode ? ret nz ;Mode 3 unknown ld (hl),a ;NOP inc hl ld a,$ae ;XOR (HL) ld (hl),a ret z88dk-1.8.ds1/libsrc/oz/emu/ozgfx/ozvline.asm0000755000175000017500000000132607747247131020546 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; void ozvline(byte x,byte y,byte len,byte color) ; ; ------ ; $Id: ozvline.asm,v 1.1 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozvline LIB swapgfxbk LIB swapgfxbk1 LIB line LIB ozplotpixel LIB ozpointcolor .ozvline ld ix,0 add ix,sp call ozpointcolor ld l,(ix+6) ;y0 ld h,(ix+8) ;x0 ld e,h ;x1 ld a,(ix+4) add l ld d,a ;y1 (y0 + len) call swapgfxbk push hl push de call ozplotpixel pop de pop hl ld ix,ozplotpixel call line jp swapgfxbk1 z88dk-1.8.ds1/libsrc/oz/lib3d/0000755000175000017500000000000010765202715015414 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/lib3d/div16384.asm0000755000175000017500000000077507747723147017337 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; int div16384(long value); ; divide by 16384 ; ; ------ ; $Id: div16384.asm,v 1.1 2003/10/29 11:37:11 stefano Exp $ ; XLIB div16384 div16384: pop bc pop de pop hl push hl push de push bc ;; HLDE holds value sla d rl l rl h sla d rl l rl h ret z88dk-1.8.ds1/libsrc/oz/lib3d/fsin.h0000755000175000017500000000060107747723147016541 0ustar tygrystygrys/* Integer sin functions taken from the lib3d library, OZ7xx DK by Hamilton, Green and Pruss isin and icos return a value from -16384 to +16384 */ extern int __LIB__ isin(unsigned degrees); /* input must be between 0 and 360 */ extern int __LIB__ icos(unsigned degrees); /* input must be between 0 and 360 */ extern int __LIB__ div16384(long value); /* divide by 16384 */ z88dk-1.8.ds1/libsrc/oz/lib3d/icos.asm0000755000175000017500000000101207747723147017065 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; int icos(unsigned degrees); ; input must be between 0 and 360 ; ; ------ ; $Id: icos.asm,v 1.1 2003/10/29 11:37:11 stefano Exp $ ; XLIB icos LIB isin XREF sin_start icos: pop de pop bc push bc push de ld hl,90 or a sbc hl,bc jp nc,sin_start ld bc,360 add hl,bc jp sin_start z88dk-1.8.ds1/libsrc/oz/lib3d/isin.asm0000755000175000017500000000506607747723147017107 0ustar tygrystygrys; ; OZ-7xx DK emulation layer for Z88DK ; by Stefano Bodrato - Oct. 2003 ; ; int isin(unsigned degrees); ; input must be between 0 and 360 ; returns value from -16384 to +16384 ; ; ------ ; $Id: isin.asm,v 1.1 2003/10/29 11:37:11 stefano Exp $ ; XLIB isin XDEF sin_start isin: pop de pop hl push hl push de sin_start: ld c,l ld b,h ;; save input ld de,181 or a sbc hl,de jr c,DontFlip ld hl,360 sbc hl,bc ;; no carry here ld c,l ld b,h ld a,1 jr Norm_0_180 DontFlip: ld l,c ld h,b xor a Norm_0_180: ;; degrees normalized between 0 and 180 in hl and in bc ;; sign of output in a ld de,90 or a sbc hl,de jr c,DontFlip2 ld hl,180 sbc hl,bc ;; carry is 0 here jr Norm_0_90 DontFlip2: ld l,c ld h,b Norm_0_90: ;; degrees normalized between 0 and 90 in hl and sign of answer is in a add hl,hl ld de,sin_table add hl,de ld e,(hl) inc hl ld d,(hl) ;; de=answer or a jr z,DontNegate ld hl,0 sbc hl,de ;; carry is 0 here ret DontNegate: ex de,hl ret sin_table: ;; generated by sintable.c defw 0 defw 285 defw 571 defw 857 defw 1142 defw 1427 defw 1712 defw 1996 defw 2280 defw 2563 defw 2845 defw 3126 defw 3406 defw 3685 defw 3963 defw 4240 defw 4516 defw 4790 defw 5062 defw 5334 defw 5603 defw 5871 defw 6137 defw 6401 defw 6663 defw 6924 defw 7182 defw 7438 defw 7691 defw 7943 defw 8191 defw 8438 defw 8682 defw 8923 defw 9161 defw 9397 defw 9630 defw 9860 defw 10086 defw 10310 defw 10531 defw 10748 defw 10963 defw 11173 defw 11381 defw 11585 defw 11785 defw 11982 defw 12175 defw 12365 defw 12550 defw 12732 defw 12910 defw 13084 defw 13254 defw 13420 defw 13582 defw 13740 defw 13894 defw 14043 defw 14188 defw 14329 defw 14466 defw 14598 defw 14725 defw 14848 defw 14967 defw 15081 defw 15190 defw 15295 defw 15395 defw 15491 defw 15582 defw 15668 defw 15749 defw 15825 defw 15897 defw 15964 defw 16025 defw 16082 defw 16135 defw 16182 defw 16224 defw 16261 defw 16294 defw 16321 defw 16344 defw 16361 defw 16374 defw 16381 defw 16384 z88dk-1.8.ds1/libsrc/oz/lib3d/Makefile0000755000175000017500000000030710763607702017062 0ustar tygrystygrys# # Makefile for OZ-7xx specific libraries - lib3d # # $Id: Makefile,v 1.3 2008/03/05 20:35:47 dom Exp $ include ../../Make.config all: zcc +ozansi $(CFLAGS) *.c clean: $(RM) *.o* zcc_opt.def z88dk-1.8.ds1/libsrc/oz/lib3d/ozcopyvector.c0000755000175000017500000000041207747723147020343 0ustar tygrystygrys/* lib3d.c Standard Wizard 3d and 4d math functions Copyright 2002, Mark Hamilton */ #include "lib3d.h" extern __LIB__ * memcpy(void *, void *, unsigned); ozcopyvector(Vector_t *dest, Vector_t *src) { memcpy(dest,src,sizeof(Vector_t)); } z88dk-1.8.ds1/libsrc/oz/lib3d/ozplotpoint.c0000755000175000017500000000064707747723147020210 0ustar tygrystygrys/* lib3d.c Standard Wizard 3d and 4d math functions Copyright 2002, Mark Hamilton */ #include "lib3d.h" ozplotpoint(Vector_t *v, Point_t *p) { Vector_t temp; /* flip x and y to rotate points 90 */ temp.x = v->y; temp.y = v->x; temp.z = v->z + 256; /* add a large number so it doesn't look too big */ /* add perspective */ p->x = temp.x * 256 / temp.z; p->y = temp.y * 256 / temp.z; } z88dk-1.8.ds1/libsrc/oz/lib3d/ozplotpointcam.c0000755000175000017500000000117307747723147020664 0ustar tygrystygrys/* lib3d.c Standard Wizard 3d and 4d math functions Copyright 2002, Mark Hamilton */ #include "lib3d.h" ozplotpointcam(Vector_t *v, Cam_t *c, Point_t *p) { static Vector_t temp; static Vector_t offset; temp.x = v->y; temp.y = v->x; temp.z = v->z + 256; offset.x = -c->x; offset.y = -c->y; offset.z = -c->z; ozrotatepointx(&temp, -c->pitch); ozrotatepointy(&temp, -c->roll); ozrotatepointz(&temp, -c->yaw); oztranslatevector(&temp, &offset); oztranslatevector(&temp, &offset); oztranslatevector(&temp, &offset); p->x = temp.x * 256 / temp.z; p->y = temp.y * 256 / temp.z; } z88dk-1.8.ds1/libsrc/oz/lib3d/ozrotatepointx.c0000755000175000017500000000053507747723147020714 0ustar tygrystygrys/* lib3d.c Standard Wizard 3d and 4d math functions Copyright 2002, Mark Hamilton */ #include "lib3d.h" ozrotatepointx(Vector_t *_v, int rot) { static long y, z; register Vector_t *v=_v; y = v->y; z = v->z; v->y = div16384(y * icos(rot) - z * isin(rot)); v->z = div16384(y * isin(rot) + z * icos(rot)); } z88dk-1.8.ds1/libsrc/oz/lib3d/ozrotatepointy.c0000755000175000017500000000053507747723147020715 0ustar tygrystygrys/* lib3d.c Standard Wizard 3d and 4d math functions Copyright 2002, Mark Hamilton */ #include "lib3d.h" ozrotatepointy(Vector_t *_v, int rot) { static long x, z; register Vector_t *v=_v; x = v->x; z = v->z; v->x = div16384(x * icos(rot) - z * isin(rot)); v->z = div16384(x * isin(rot) + z * icos(rot)); } z88dk-1.8.ds1/libsrc/oz/lib3d/ozrotatepointz.c0000755000175000017500000000053507747723147020716 0ustar tygrystygrys/* lib3d.c Standard Wizard 3d and 4d math functions Copyright 2002, Mark Hamilton */ #include "lib3d.h" ozrotatepointz(Vector_t *_v, int rot) { static long x, y; register Vector_t *v=_v; x = v->x; y = v->y; v->x = div16384(x * icos(rot) - y * isin(rot)); v->y = div16384(x * isin(rot) + y * icos(rot)); } z88dk-1.8.ds1/libsrc/oz/lib3d/oztranslatevector.c0000755000175000017500000000036007747723147021370 0ustar tygrystygrys/* lib3d.c Standard Wizard 3d and 4d math functions Copyright 2002, Mark Hamilton */ #include "lib3d.h" oztranslatevector(Vector_t *v, Vector_t *offset) { v->x += offset->x; v->y += offset->y; v->z += offset->z; } z88dk-1.8.ds1/libsrc/oz/lib3d.lst0000755000175000017500000000031007747723147016152 0ustar tygrystygrysmemcpy lib3d/icos lib3d/isin lib3d/div16384 lib3d/ozcopyvector lib3d/oztranslatevector lib3d/ozplotpoint lib3d/ozplotpointcam lib3d/ozrotatepointx lib3d/ozrotatepointy lib3d/ozrotatepointz z88dk-1.8.ds1/libsrc/oz/Makefile0000755000175000017500000000140310700451034016045 0ustar tygrystygrys# # Makefile for OZ-7xx specific libraries # # $Id: Makefile,v 1.11 2007/10/02 14:13:48 stefano Exp $ include ../Make.config all: $(RM) emu/ozgfx/*.o* cd oztime ; $(MAKE) ; cd .. cd ozinput ; $(MAKE) ; cd .. $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/ozextra -DFORoz -DOZDK @oz700.lst cd lib3d ; $(MAKE) ; cd .. $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/lib3d -DFORoz -DOZDK @lib3d.lst clean: cd lib3d ; $(MAKE) clean ; cd .. $(RM) *.o* zcc_opt.def ozextra.lib $(RM) emu/ozgfx/*.o* $(RM) ozinput/*.o* ozinput/zcc_opt.def $(RM) ozinterrupt/*.o* ozinterrupt/zcc_opt.def $(RM) ozmisc/*.o* ozmisc/zcc_opt.def $(RM) ozscreen/*.o* ozscreen/zcc_opt.def $(RM) oztime/*.o* oztime/zcc_opt.def $(RM) ozgfx/*.o* ozgfx/zcc_opt.def $(RM) ozserial/*.o* ozserial/zcc_opt.def z88dk-1.8.ds1/libsrc/oz/memcpy.asm0000755000175000017500000000147107747735211016431 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; memory copy routine ; memcpy(dest,src,count) ; ; ; ------ ; $Id: memcpy.asm,v 1.1 2003/10/29 13:03:05 stefano Exp $ ; XLIB memcpy ; ;blkcpy: memcpy: pop hl ld (retval+1),hl ; pop de ; pop hl ; pop bc pop bc pop hl pop de push de ;; save destination ld a,c or b jr z,NothingToDo ldir NothingToDo: ex (sp),hl ;; get destination pointer push hl push hl ;; fill up stack retval: jp 0 ;; ;retval equ $-2 ;; self-modifying return z88dk-1.8.ds1/libsrc/oz/oz700.lst0000755000175000017500000000347307747723147016051 0ustar tygrystygrysrestore_a000 ozcopy memcpy ozdetectmodel ozinput/ozclick ozinput/ozeditline ozinput/ozkbdon ozinput/ozkbdoff ozinput/ozkeyclear ozinput/ozkeyhit ozinput/ozkeyupper ozinput/ozkeylower ozinput/ozgetch ozinput/ozungetch ozinterrupt/ozcustomisr ozinterrupt/ozintwait ozinterrupt/serial_int ozinterrupt/ozsetisr ozinterrupt/ozinstisr ozmisc/ozgetautorun ozmisc/ozportin ozmisc/ozportout ozmisc/ozdelay ozmisc/ozexitto ozmisc/ozinitsound ozmisc/ozsound ozmisc/ozquiet ozscreen/ozsetcontrast ozscreen/ozgetcontrast ozscreen/ozblankscreen ozscreen/ozunblankscreen ozscreen/ozfast ozscreen/ozsetlight ozscreen/oztogglelight ozscreen/ozsetlcdstate oztime/oztime oztime/ozhour oztime/ozmin oztime/ozsec oztime/ozweekday oztime/ozday oztime/ozmonth oztime/ozyear oztime/oztimecompute ozgfx/ozdisplayputbyte ozgfx/ozdisplayorbyte ozgfx/ozdisplayandbyte ozgfx/ozsetfont ozgfx/ozgetfont ozgfx/ozputs ozgfx/ozfontpointers ozgfx/ozputch ozgfx/ozrestorescreen ozgfx/ozsavescreen ozgfx/ozscroll ozgfx/ozscrolldown ozgfx/ozscrollclear ozgfx/ozscrolllinesclear ozgfx/ozactivatedisplaypage ozgfx/ozdisplayactivepage ozgfx/ozgetactivepage ozgfx/ozgetdisplaypage ozgfx/ozsetactivepage ozgfx/ozsetdisplaypage ozgfx/ozswapactivedisplay ozgfx/ozputsprite ozserial/ozsnap ozserial/ozclearserialbuffer ozserial/ozgetrxhandshaking ozserial/ozsetrxhandshaking ozserial/ozserialgetc ozserial/ozserialin ozserial/ozserialout ozserial/ozserinton ozserial/ozserintoff ozserial/ozdatabits ozserial/ozstopbits ozserial/ozparity ozserial/ozsetbaud ozserial/ozgetbaud ozserial/ozsetlcr ozserial/ozgetlcr emu/ozgfx/ozbox emu/ozgfx/ozfilledbox emu/ozgfx/ozcircle emu/ozgfx/ozline emu/ozgfx/ozhline emu/ozgfx/ozvline emu/ozgfx/ozplotpixel emu/ozgfx/ozpoint emu/ozgfx/ozpointcolor emu/ozgfx/ozgetpoint z88dk-1.8.ds1/libsrc/oz/ozcopy.asm0000755000175000017500000000410207745264647016464 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; memory block copy routine ; ; ; ------ ; $Id: ozcopy.asm,v 1.1 2003/10/21 17:15:19 stefano Exp $ ; XLIB ozcopy defc load_address = 0ff02h ozcopy_init: push hl push de push bc ld hl,copy_routine ld de,load_address push de ld bc,end_copy_routine-copy_routine ldir pop de ld (ozcopy_jp_address+1),de pop bc pop de pop hl ;; jp load_address ;; copy from hl:firstpushed to de:secondpushed, length bc ozcopy: ozcopy_jp_address: jp ozcopy_init ;; copy from hl:firstpushed to de:secondpushed, length bc ;; relocatable and reentrant copy_routine: in a,(2) push af in a,(1) push af ;; save initial 8000 page in a,(4) push af in a,(3) push af ;; save initial a000 page dec hl dec hl dec hl dec hl ;; source page-4 ld a,l out (1),a ld a,h out (2),a ;; set source page ld a,e out (3),a ld a,d out (4),a ;; set destination page ld hl,10 add hl,sp ;; get destination offset ld e,(hl) inc hl ld a,(hl) ;; add 0a000h to offset add a,0a0h ld d,a inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ld a,h ;; add 08000h to offset add a,080h ld h,a ldir pop af out (3),a pop af out (4),a pop af out (1),a pop af out (2),a ret end_copy_routine: z88dk-1.8.ds1/libsrc/oz/ozdetectmodel.asm0000755000175000017500000000321307745264647020005 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; Detect the OZ model ; ;; ozmodel: ;; ;; bit 0: 0 if 700/730 and 1 if 750/770 ;; bit 1: 0 if <770 and 1 if 770 ;; bit 2: 0 if 7xxPC and 1 if 7xxM ; ; ------ ; $Id: ozdetectmodel.asm,v 1.1 2003/10/21 17:15:19 stefano Exp $ ; XLIB ozdetectmodel XREF ozmodel XREF s_filetypetable LIB restore_a000 ozdetectmodel: push bc push de call 07f94h ld (ozmodel),a ld a,0ch ld hl,0ab4fh ld de,String1 call compare4 jr nz,is730or750PC ;; we have either a 770 or a 730M/750M at this point ld a,0eh ;; we'll check where the font tables are ld hl,0a300h ld de,String2 call compare4 ;; z if 770; nz if 730M/750M ld e,2 jr z,setmodel ld e,4 setmodel: ld hl,ozmodel ld a,(hl) or e ld (hl),a jr Finish is730or750PC: ld a,88h ld (s_filetypetable),a Finish: ld a,(ozmodel) ld l,a pop de pop bc jp restore_a000 compare4: out (3),a xor a out (4),a ld b,4 top: ld a,(de) cp (hl) ret nz inc de inc hl djnz top ret String1: defb 89h,0c0h,19h,4dh String2: defm "PC_P" z88dk-1.8.ds1/libsrc/oz/ozgfx/0000755000175000017500000000000010765202715015554 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/ozgfx/ozactivatedisplaypage.asm0000755000175000017500000000077607745730252022675 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; Videmo memory page handling ; ; ; ------ ; $Id: ozactivatedisplaypage.asm,v 1.1 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozactivatedisplaypage XREF ozactivepage ozactivatedisplaypage: in a,(22h) ld (ozactivepage),a ; in a,(23h) ; and 0fh ; ld (ozactivepage+1),a ret z88dk-1.8.ds1/libsrc/oz/ozgfx/ozdisplayactivepage.asm0000755000175000017500000000074307745730252022342 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; Videmo memory page handling ; ; ; ------ ; $Id: ozdisplayactivepage.asm,v 1.1 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozdisplayactivepage XREF ozactivepage ozdisplayactivepage: ld a,(ozactivepage) out (22h),a ; ld a,(ozactivepage+1) ; out (23h),a ret z88dk-1.8.ds1/libsrc/oz/ozgfx/ozdisplayandbyte.asm0000755000175000017500000000203207745264650021655 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; put byte into the display at offset ; ; void ozdisplayandbyte(int offset, char byte); ; ; ; ------ ; $Id: ozdisplayandbyte.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozdisplayandbyte XREF ozactivepage ozdisplayandbyte: ld c,3 in e,(c) inc c in d,(c) ld hl,(ozactivepage) out (c),h dec c out (c),l pop hl ;; return address exx ;pop hl ;; offset ;pop bc ;; value pop bc ;; offset pop hl ;; value ld a,h add a,0a0h ld h,a ld a,(hl) and c ld (hl),a push bc push hl exx out (c),e inc c out (c),d jp (hl) z88dk-1.8.ds1/libsrc/oz/ozgfx/ozdisplayorbyte.asm0000755000175000017500000000202507745264650021535 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; put byte into the display at offset ; ; void ozdisplayorbyte(int offset, char byte); ; ; ; ------ ; $Id: ozdisplayorbyte.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozdisplayorbyte XREF ozactivepage ozdisplayorbyte: ld c,3 in e,(c) inc c in d,(c) ld hl,(ozactivepage) out (c),h dec c out (c),l pop hl ;; return address exx ;pop hl ;; offset ;pop bc ;; value pop bc ;; offset pop hl ;; value ld a,h add a,0a0h ld h,a ld a,(hl) or c ld (hl),a push bc push hl exx out (c),e inc c out (c),d jp (hl) z88dk-1.8.ds1/libsrc/oz/ozgfx/ozdisplayputbyte.asm0000755000175000017500000000175707745264650021740 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; put byte into the display at offset ; ; void ozdisplayputbyte(int offset, char byte); ; ; ; ------ ; $Id: ozdisplayputbyte.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozdisplayputbyte XREF ozactivepage ozdisplayputbyte: ld c,3 in e,(c) inc c in d,(c) ld hl,(ozactivepage) out (c),h dec c out (c),l pop hl ;; return address exx ;pop hl ;; offset ;pop bc ;; value pop bc ;; offset pop hl ;; value ld a,h add a,0a0h ld h,a ld (hl),c push bc push hl exx out (c),e inc c out (c),d jp (hl) z88dk-1.8.ds1/libsrc/oz/ozgfx/ozfontpointers.asm0000755000175000017500000000237407745264650021404 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; Font Pointers ; ; ------ ; $Id: ozfontpointers.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozfontpointers XDEF LowerFontPage1 XDEF LowerFontPage2 XDEF HigherFontPage1 XDEF HigherFontPage2 ozfontpointers: defw Font0 defw Font1 defw Font2 defw Font3 defw Font1 defw Font1 defw Font1 defw Font1 Font0: ;; PC_LARGE LowerFontPage2: defb 0eh defb 0 defw 0ab10h defw 0ab10h+310h defb 13 defb 0ffh Font1: ;; PC_PLANE: LowerFontPage1: defb 0eh defb 0 defw 0a000h defw 0a000h+310h defb 8 defb 0ffh Font2: ;; EO7LARGE HigherFontPage2: defb 0fh defb 0 defw 0ab10h defw 0ab10h+310h defb 13 defb 0ffh Font3: ;; EO7PLANE: HigherFontPage1: defb 0fh defb 0 defw 0a000h defw 0a000h+310h defb 8 defb 0ffh z88dk-1.8.ds1/libsrc/oz/ozgfx/ozgetactivepage.asm0000755000175000017500000000102207745730252021443 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; Videmo memory page handling ; ; ; ------ ; $Id: ozgetactivepage.asm,v 1.1 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozgetactivepage XREF ozactivepage ozgetactivepage: ld a,(ozactivepage) or a jr z,PageZero ld hl,1 ret PageZero: ld l,a ld h,a ; hl=0 ret z88dk-1.8.ds1/libsrc/oz/ozgfx/ozgetdisplaypage.asm0000755000175000017500000000076307745730252021650 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; Videmo memory page handling ; ; ; ------ ; $Id: ozgetdisplaypage.asm,v 1.1 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozgetdisplaypage ozgetdisplaypage: in a,(22h) or a jr z,PageZero ld hl,1 ret PageZero: ld l,a ld h,a ; hl=0 ret z88dk-1.8.ds1/libsrc/oz/ozgfx/ozgetfont.asm0000755000175000017500000000062007745264650020310 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; void ozgetfont(int font) ; ; ; ------ ; $Id: ozgetfont.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozgetfont XREF ScrCharSet ozgetfont: ld a,(ScrCharSet) ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/oz/ozgfx/ozputch.asm0000755000175000017500000000114407745264650017767 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; int ozputch (int x, int y, char c); ; ; ------ ; $Id: ozputch.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozputch LIB ozputs ozputchbuf: defb 0 ; Char to be printed defb 0 ; string terminator ozputch: ;ld hl,6 ld hl,2 add hl,sp ld a,(hl) ld (ozputchbuf),a ld bc,ozputchbuf ld (hl),c inc hl ld (hl),b jp ozputs z88dk-1.8.ds1/libsrc/oz/ozgfx/ozputs.asm0000755000175000017500000002432307745452122017634 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; int ozputs(int x, int y, char *string); ; ; ------ ; $Id: ozputs.asm,v 1.2 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozputs XDEF ozputsgetend LIB ozdetectmodel LIB restore_a000 LIB ozfontpointers XREF ozmodel XREF ozactivepage XDEF s_end_s_pointer XREF LowerFontPage1 XREF LowerFontPage2 XREF HigherFontPage1 XREF HigherFontPage2 XREF ScrCharSet ;; strlen equ 7f0ch ;; DisplayStringAt equ 7f4ch ;; Portable if ScrCharSet is portable ;; ozputsgetend: ;ld hl,0 ;; self-mod defb 33 s_end_s_pointer: defw 0 ; $end$pointer equ $-2 ;; ret DoInit: ld a,1 ld (init),a ld a,(ozmodel) xor 0ffh call z,ozdetectmodel ld a,(ozmodel) and 4 jr z,DidInit ;; not multilingual, so all is OK ld a,1eh ld (LowerFontPage1),a ld (LowerFontPage2),a inc a ld (HigherFontPage1),a ld (HigherFontPage2),a jr DidInit ; int ozputs(int x, int y, char *string); ozputs: ld a,(init) or a jr z,DoInit DidInit: ;;;yyll001122 push iy ld iy,2 add iy,sp push ix exx ld de,(ozactivepage) ;ld l,(iy+6) ;ld h,(iy+7) ; address of string ld l,(iy+2) ld h,(iy+3) ; address of string exx ld a,(ScrCharSet) and 7 add a,a ld d,0 ld e,a ld hl,ozfontpointers add hl,de ld e,(hl) inc hl ld d,(hl) push de pop ix ld a,(ix+0) ld (font_page+1),a ld a,(ix+1) ld (font_page_hi+1),a ld l,(ix+2) ld h,(ix+3) ld (font_len_offset+1),hl ld l,(ix+4) ld h,(ix+5) ld (font_offset+1),hl ld (font_offset_double+1),hl ld e,(ix+6) ;; height ld a,(ix+7) ;; charset mask ld (charset_mask+1),a ;ld a,(iy+5) ld a,(iy+5) or a jp nz,LengthOnly ld a,80 ;ld c,(iy+4) ld c,(iy+4) sub c ;; number of rows available jp c,LengthOnly jp z,LengthOnly cp e jp nc,HeightOK ld e,a HeightOK: ld a,e ld (height+1),a ld (height_double+2),a ;ld l,(iy+4) ld l,(iy+4) ld h,0 add hl,hl ld c,l ld b,h ; bc=2*y add hl,hl ; hl=4*y add hl,hl ; hl=8*y add hl,hl ; hl=16*y add hl,hl ; hl=32*y sbc hl,bc ; hl=30*y ld bc,0a000h add hl,bc push hl pop ix ; ix=screen-offset for y ;ld c,(iy+2) ; x-position ;ld b,(iy+3) ld c,(iy+6) ; x-position ld b,(iy+7) exx DoPrintLoop: ld a,(hl) ;; get character from string or a jp z,done charset_mask: and 0ffh ;charset_mask equ $-1 exx push bc ;; x-pos font_len_offset: ld hl,0000h ;; self modifying code ;font_len_offset equ $-2 ld c,a ld b,0 add hl,bc add hl,bc add hl,bc push hl pop iy ;; iy=font character record position ld a,(font_page+1) out (3),a ld a,(font_page_hi+1) out (4),a ld a,(hl) ; width ld l,a ld h,b ; h=0 as b=0 still pop bc ; x-position push bc ld e,c add hl,bc ld (EndXPos+1),hl ld bc,240 sbc hl,bc jp nc,DonePop2 cp 9 ; is width more than 8 jp nc,DoubleWidth ld l,a ; width ld h,b ; h=0 as b=0 still ;; hl=width ld bc,Masks add hl,bc ld d,(hl) ; mask for correct width ld a,e ; low byte of x-position ld e,0 and 7 ld (low_nibble+1),a jr z,EndRotMask ld b,a RotRightMask: rl d ;; carry is clear because of "or a" and "dec a" rl e djnz RotRightMask EndRotMask: ld a,d cpl ld (mask1+1),a ld a,e cpl ld (mask2+1),a ld l,(iy+1) ;; font position ld h,(iy+2) font_offset: ld bc,0000h ;; self-modifying code ;font_offset equ $-2 ;; add hl,bc ;; hl=position of font data for character push hl pop iy ;; iy=font data $end$pointer pop bc ;; x-position of start srl c srl c srl c ld b,0 push ix pop hl ;; hl=screen position add hl,bc height: ld c,00 ;; character row counter (self-modifying) ;height equ $-1 ;; InnerCharLoop: low_nibble: ld b,00 ;; self-modifying code ;low_nibble equ $-1 ;; font_page: ld a,0 ;; self-modifying code ;font_page equ $-1 out (3),a font_page_hi: ld a,0 ;font_page_hi equ $-1 out (4),a ld e,0 ld d,(iy+0) exx ld a,e out (3),a ld a,d out (4),a exx ld a,b or a jr z,NoCharacterShift ShiftByte: rl d rl e djnz ShiftByte NoCharacterShift: ld a,(hl) ;; get from screen mask1: and 00 ;; self-modifying code ;mask1 equ $-1 ;; or d ld (hl),a inc hl ld a,(hl) mask2: and 00 ;; self-modifying code ;mask2 equ $-1 ;; or e ld (hl),a ld de,29 add hl,de inc iy dec c jp nz,InnerCharLoop EndOfCharPut: EndXPos: ld bc,0000 ;; self-modifying code ;EndXPos equ $-2 ;; exx inc hl ld a,7 ;; restore original page out (3),a ld a,4 out (4),a jp DoPrintLoop done: ld (s_end_s_pointer),hl exx ld l,c ld h,b cleanup_page: pop ix pop iy jp restore_a000 DonePop2: pop hl ; x position exx ld (s_end_s_pointer),hl exx jr cleanup_page DoubleWidth: sub 8 ld l,a ; width-8 ld h,b ; h=0 as b=0 still ;; hl=width ld bc,Masks add hl,bc ld a,e ; low byte of x-position and 7 ld (low_nibble_double+1),a ld d,0ffh ld e,(hl) ; mask for correct width ld c,0 jr z,EndRotMask_double ld b,a RotRightMask_double: rl d ;; carry is clear because of "or a" and "dec a" rl e rl c djnz RotRightMask_double EndRotMask_double: ld a,d cpl ld (mask1_double+1),a ld a,e cpl ld (mask2_double+1),a ld a,c cpl ld (mask3_double+1),a ld l,(iy+1) ;; font position ld h,(iy+2) font_offset_double: ld bc,0000h ;; self-modifying code ;font_offset_double equ $-2 ;; add hl,bc ;; hl=position of font data for character push hl pop iy ;; iy=font data $end$pointer pop bc ;; x-position of start srl c srl c srl c ld b,0 push ix pop hl ;; hl=screen position add hl,bc push ix height_double: ;undoc_ix ;ld l,00 ;; ld ixl,00 : character row counter (self-modifying) ld ixl,0 ;height_double equ $-1 ;; InnerCharLoop_double: low_nibble_double: ld b,00 ;; self-modifying code ;low_nibble_double equ $-1 ;; ld a,(font_page+1) out (3),a ld a,(font_page_hi+1) out (4),a ld d,(iy+0) inc iy ld e,(iy+0) ld c,0 exx ld a,e out (3),a ld a,d out (4),a exx ld a,b or a jr z,NoCharacterShift_double ShiftByte_double: rl d rl e rl c djnz ShiftByte_double NoCharacterShift_double: ld a,(hl) ;; get from screen mask1_double: and 00 ;; self-modifying code ;; should be AND ;mask1_double equ $-1 ;; or d ld (hl),a inc hl ld a,(hl) mask2_double: and 00 ;; self-modifying code ;; should be AND ;mask2_double equ $-1 ;; or e ld (hl),a inc hl ld a,(hl) mask3_double: and 00 ;; self-modifying code ;; should be AND ;mask3_double equ $-1 ;; or c ld (hl),a ld de,28 add hl,de inc iy ;undoc_ix ;dec l dec ixl jp nz,InnerCharLoop_double pop ix jp EndOfCharPut LengthOnly: exx push hl exx pop de ld c,(iy+2) ; x-position ld b,(iy+3) DoCountLoop: ld a,(de) ;; get character from string or a jr z,doneCounting push bc ;; x-pos ld hl,(font_len_offset) ld c,a ld b,0 add hl,bc add hl,bc add hl,bc ld a,(font_page+1) out (3),a ld a,(font_page_hi+1) out (4),a ld a,(hl) ; width ld l,a ld h,b ; h=0 as b=0 still pop bc ; x-position add hl,bc ld c,l ld b,h inc de ld a,7 out (3),a ld a,4 out (4),a jp DoCountLoop doneCounting: ld l,c ld h,b jp cleanup_page Masks: defb 1,3,7,15,31,63,127,255 init: defs 1 z88dk-1.8.ds1/libsrc/oz/ozgfx/ozputs_direct.asm0000755000175000017500000002377307745264650021205 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; int ozputs(int x, int y, char *string);; ; ; ------ ; $Id: ozputs_direct.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozputs XDEF ozputsgetend LIB ozdetectmodel XREF ozmodel XREF ozactivepage XREF ozfontpointers XDEF s_end_s_pointer XREF restore_a000 XREF LowerFontPage1 XREF LowerFontPage2 XREF HigherFontPage1 XREF HigherFontPage2 XREF ScrCharSet ;; strlen equ 7f0ch ;; DisplayStringAt equ 7f4ch ;; Portable if ScrCharSet is portable ;; ozputsgetend: s_end_s_pointer: ;ld hl,0 ;; self-mod defb 33 defw 0 ; $end$pointer equ $-2 ;; ret DoInit: ld a,1 ld (init),a ld a,(ozmodel) xor 0ffh call z,ozdetectmodel ld a,(ozmodel) and 4 jr z,DidInit ;; not multilingual, so all is OK ld a,1eh ld (LowerFontPage1),a ld (LowerFontPage2),a inc a ld (HigherFontPage1),a ld (HigherFontPage2),a jr DidInit ; int ozputs(int x, int y, char *string); ozputs: ld a,(init) or a jr z,DoInit DidInit: push iy ld iy,2 add iy,sp push ix exx ld de,(ozactivepage) ld l,(iy+6) ld h,(iy+7) ; address of string exx ld a,(ScrCharSet) and 7 add a,a ld d,0 ld e,a ld hl,ozfontpointers add hl,de ld e,(hl) inc hl ld d,(hl) push de pop ix ld a,(ix+0) ld (font_page+1),a ld a,(ix+1) ld (font_page_hi+1),a ld l,(ix+2) ld h,(ix+3) ld (font_len_offset+1),hl ld l,(ix+4) ld h,(ix+5) ld (font_offset+1),hl ld (font_offset_double+1),hl ld e,(ix+6) ;; height ld a,(ix+7) ;; charset mask ld (charset_mask+1),a ld a,(iy+5) or a jp nz,LengthOnly ld a,80 ld c,(iy+4) sub c ;; number of rows available jp c,LengthOnly jp z,LengthOnly cp e jp nc,HeightOK ld e,a HeightOK: ld a,e ld (height+1),a ld (height_double+2),a ld l,(iy+4) ld h,0 add hl,hl ld c,l ld b,h ; bc=2*y add hl,hl ; hl=4*y add hl,hl ; hl=8*y add hl,hl ; hl=16*y add hl,hl ; hl=32*y sbc hl,bc ; hl=30*y ld bc,0a000h add hl,bc push hl pop ix ; ix=screen-offset for y ld c,(iy+2) ; x-position ld b,(iy+3) exx DoPrintLoop: ld a,(hl) ;; get character from string or a jp z,done charset_mask: and 0ffh ;charset_mask equ $-1 exx push bc ;; x-pos font_len_offset: ld hl,0000h ;; self modifying code ;font_len_offset equ $-2 ld c,a ld b,0 add hl,bc add hl,bc add hl,bc push hl pop iy ;; iy=font character record position ld a,(font_page+1) out (3),a ld a,(font_page_hi+1) out (4),a ld a,(hl) ; width ld l,a ld h,b ; h=0 as b=0 still pop bc ; x-position push bc ld e,c add hl,bc ld (EndXPos+1),hl ld bc,240 sbc hl,bc jp nc,DonePop2 cp 9 ; is width more than 8 jp nc,DoubleWidth ld l,a ; width ld h,b ; h=0 as b=0 still ;; hl=width ld bc,Masks add hl,bc ld d,(hl) ; mask for correct width ld a,e ; low byte of x-position ld e,0 and 7 ld (low_nibble+1),a jr z,EndRotMask ld b,a RotRightMask: rl d ;; carry is clear because of "or a" and "dec a" rl e djnz RotRightMask EndRotMask: ld a,d cpl ld (mask1+1),a ld a,e cpl ld (mask2+1),a ld l,(iy+1) ;; font position ld h,(iy+2) font_offset: ld bc,0000h ;; self-modifying code ;font_offset equ $-2 ;; add hl,bc ;; hl=position of font data for character push hl pop iy ;; iy=font data $end$pointer pop bc ;; x-position of start srl c srl c srl c ld b,0 push ix pop hl ;; hl=screen position add hl,bc height: ld c,00 ;; character row counter (self-modifying) ;height equ $-1 ;; InnerCharLoop: low_nibble: ld b,00 ;; self-modifying code ;low_nibble equ $-1 ;; font_page: ld a,0 ;; self-modifying code ;font_page equ $-1 out (3),a font_page_hi: ld a,0 ;font_page_hi equ $-1 out (4),a ld e,0 ld d,(iy+0) exx ld a,e out (3),a ld a,d out (4),a exx ld a,b or a jr z,NoCharacterShift ShiftByte: rl d rl e djnz ShiftByte NoCharacterShift: ld a,(hl) ;; get from screen mask1: and 00 ;; self-modifying code ;mask1 equ $-1 ;; or d ld (hl),a inc hl ld a,(hl) mask2: and 00 ;; self-modifying code ;mask2 equ $-1 ;; or e ld (hl),a ld de,29 add hl,de inc iy dec c jp nz,InnerCharLoop EndOfCharPut: EndXPos: ld bc,0000 ;; self-modifying code ;EndXPos equ $-2 ;; exx inc hl ld a,7 ;; restore original page out (3),a ld a,4 out (4),a jp DoPrintLoop done: ld (s_end_s_pointer),hl exx ld l,c ld h,b cleanup_page: pop ix pop iy jp restore_a000 DonePop2: pop hl ; x position exx ld (s_end_s_pointer),hl exx jr cleanup_page DoubleWidth: sub 8 ld l,a ; width-8 ld h,b ; h=0 as b=0 still ;; hl=width ld bc,Masks add hl,bc ld a,e ; low byte of x-position and 7 ld (low_nibble_double+1),a ld d,0ffh ld e,(hl) ; mask for correct width ld c,0 jr z,EndRotMask_double ld b,a RotRightMask_double: rl d ;; carry is clear because of "or a" and "dec a" rl e rl c djnz RotRightMask_double EndRotMask_double: ld a,d cpl ld (mask1_double+1),a ld a,e cpl ld (mask2_double+1),a ld a,c cpl ld (mask3_double+1),a ld l,(iy+1) ;; font position ld h,(iy+2) font_offset_double: ld bc,0000h ;; self-modifying code ;font_offset_double equ $-2 ;; add hl,bc ;; hl=position of font data for character push hl pop iy ;; iy=font data $end$pointer pop bc ;; x-position of start srl c srl c srl c ld b,0 push ix pop hl ;; hl=screen position add hl,bc push ix height_double: ;undoc_ix ;ld l,00 ;; ld ixl,00 : character row counter (self-modifying) ld ixl,0 ;height_double equ $-1 ;; InnerCharLoop_double: low_nibble_double: ld b,00 ;; self-modifying code ;low_nibble_double equ $-1 ;; ld a,(font_page+1) out (3),a ld a,(font_page_hi+1) out (4),a ld d,(iy+0) inc iy ld e,(iy+0) ld c,0 exx ld a,e out (3),a ld a,d out (4),a exx ld a,b or a jr z,NoCharacterShift_double ShiftByte_double: rl d rl e rl c djnz ShiftByte_double NoCharacterShift_double: ld a,(hl) ;; get from screen mask1_double: and 00 ;; self-modifying code ;; should be AND ;mask1_double equ $-1 ;; or d ld (hl),a inc hl ld a,(hl) mask2_double: and 00 ;; self-modifying code ;; should be AND ;mask2_double equ $-1 ;; or e ld (hl),a inc hl ld a,(hl) mask3_double: and 00 ;; self-modifying code ;; should be AND ;mask3_double equ $-1 ;; or c ld (hl),a ld de,28 add hl,de inc iy ;undoc_ix ;dec l dec ixl jp nz,InnerCharLoop_double pop ix jp EndOfCharPut LengthOnly: exx push hl exx pop de ld c,(iy+2) ; x-position ld b,(iy+3) DoCountLoop: ld a,(de) ;; get character from string or a jr z,doneCounting push bc ;; x-pos ld hl,(font_len_offset) ld c,a ld b,0 add hl,bc add hl,bc add hl,bc ld a,(font_page+1) out (3),a ld a,(font_page_hi+1) out (4),a ld a,(hl) ; width ld l,a ld h,b ; h=0 as b=0 still pop bc ; x-position add hl,bc ld c,l ld b,h inc de ld a,7 out (3),a ld a,4 out (4),a jp DoCountLoop doneCounting: ld l,c ld h,b jp cleanup_page Masks: defb 1,3,7,15,31,63,127,255 init: defs 1 z88dk-1.8.ds1/libsrc/oz/ozgfx/ozputsprite.asm0000755000175000017500000000577107747723147020720 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Alternate sprite library ; ; void ozputsprite (byte x,byte y,byte height,byte *sprite) ; ; except for C wrappers, code (c) 2001 Benjamin Green ; ; ; ; ------ ; $Id: ozputsprite.asm,v 1.1 2003/10/29 11:37:11 stefano Exp $ ; XLIB ozputsprite XREF ozactivepage ozputsprite: ld bc,TheSprite ;ld hl,6 ;add hl,sp ;ld a,(hl) ; height ld hl,4 add hl,sp ld a,(hl) ; height add a,a ret z cp 160 ret nc dec hl dec hl ; sprite ld e,(hl) ld (hl),c inc hl ld d,(hl) ld (hl),b ex de,hl ld e,c ld d,b ; de=TheSprite ld c,a ld b,0 ldir ;jp ___ozputsprite ___ozputsprite: ;; ___ozputsprite(byte x,byte y,byte height,byte *sprite) pop hl ld c,3 in e,(c) inc c in d,(c) ld bc,(ozactivepage) ld a,c out (3),a ld a,b out (4),a ld (ix_save+2),ix ld (iy_save+2),iy exx ;; save initial screen stuff ;pop de ; y ;pop bc ; x ;ld b,e ;call getscreenptr ;pop bc ; height ;ld b,c ;pop ix ; sprite pop ix ; sprite pop bc ; height pop bc ; x pop de ; y push bc push de ld b,e call getscreenptr pop de pop bc push bc ; clean up stack push bc push bc push bc di ;; in case we go off screen with transparent portion call putsprite ei exx ;; restore initial screen ix_save: ld ix,0 ;$ix_save equ $-2 iy_save: ld iy,0 ;$iy_save equ $-2 ld c,3 out (c),e inc c out (c),d jp (hl) ;; By Benjamin Green ; sprite format: ; (byte image, byte mask)*height ; image mask ; 0 0 = white ; 1 0 = black ; 0 1 = transparent ; 1 1 = invert putsprite: ; draws sprite (address IX, height B) at (address IY, bit A) ld c,a and a jp z,_aligned _yloop: push bc ld l,(ix+1) ld h,0FFh ld b,c scf _shl1: rl l rl h djnz _shl1 ld a,(iy+0) and l ld e,a ld a,(iy+1) and h ld d,a ld l,(ix+0) ld h,0 ld b,c _shl2: sla l rl h djnz _shl2 ld a,e xor l ld (iy+0),a ld a,d xor h ld (iy+1),a inc ix inc ix ld de,30 add iy,de pop bc djnz _yloop ret _aligned: ld de,30 _a_yloop: ld l,(ix+1) ld a,(iy+0) and l ld l,(ix+0) xor l ld (iy+0),a inc ix inc ix add iy,de djnz _a_yloop ret getscreenptr: ; converts (B,C) into screen location IY, bit offset A ;;push de ;;push hl ld h,0 ld l,c sla l ld d,h ld e,l add hl,hl add hl,hl add hl,hl add hl,hl ;;cp a sbc hl,de ld d,0A0h ; for page at A000 ld e,b srl e srl e srl e add hl,de push hl pop iy ld a,b and 7 ;;pop hl ;;pop de ret TheSprite: defs 160 z88dk-1.8.ds1/libsrc/oz/ozgfx/ozrestorescreen.asm0000755000175000017500000000075307745264650021534 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; ; ; ------ ; $Id: ozrestorescreen.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozrestorescreen XREF ozsccopy XREF ozactivepage .ozrestorescreen ld de,968h push de ld hl,0 push hl ld h,4 ;; l=0 still ld de,(ozactivepage) jp ozsccopy z88dk-1.8.ds1/libsrc/oz/ozgfx/ozsavescreen.asm0000755000175000017500000000113307745264650021000 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; ; ; ------ ; $Id: ozsavescreen.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozsavescreen ;LIB ozrestorescreen XDEF ozsccopy XREF ozactivepage LIB ozcopy ozsavescreen: ld de,0 push de ld hl,968h push hl ld hl,(ozactivepage) ld d,4 ;; e=0 still ozsccopy: ld bc,2400 call ozcopy pop hl pop hl ret z88dk-1.8.ds1/libsrc/oz/ozgfx/ozscroll.asm0000755000175000017500000000146307745264650020146 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; void ozscroll(unsigned numbytes); ; ; ; ------ ; $Id: ozscroll.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozscroll XREF ozactivepage LIB restore_a000 ozscroll: pop hl exx ld de,(ozactivepage) ld a,e out (3),a ld a,d out (4),a ld hl,0a000h pop bc push bc add hl,bc ex de,hl ld hl,2400 sbc hl,bc ld c,l ld b,h ;; length of move ex de,hl ld de,0a000h ldir call restore_a000 exx jp (hl) z88dk-1.8.ds1/libsrc/oz/ozgfx/ozscrollclear.asm0000755000175000017500000000125607745264650021155 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; void ozscrollclear(); ; ; ------ ; $Id: ozscrollclear.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozscrollclear XREF ozactivepage ozscrollclear: in a,(3) ld c,a in a,(4) ld b,a push bc ld bc,(ozactivepage) ld a,c out (3),a ld a,b out (4),a ld hl,0a000h+300 ld de,0a000h ld bc,2400-300 ldir ld de,300 xor a ld e,a ld hl,0a000h+2400-300 ld bc,300 rpt: ld (hl),e inc hl dec bc ld a,b or c jr nz,rpt pop bc ld a,c out (3),a ld a,b out (4),a ret z88dk-1.8.ds1/libsrc/oz/ozgfx/ozscrolldown.asm0000755000175000017500000000156307745264650021037 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; void ozscrolldown(unsigned numbytes); ; ; ; ------ ; $Id: ozscrolldown.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozscrolldown XREF ozactivepage LIB restore_a000 ozscrolldown: pop hl exx ld de,(ozactivepage) ld a,e out (3),a ld a,d out (4),a ld hl,0a000h+2400-1 pop bc push bc or a sbc hl,bc ex de,hl ld hl,2400 sbc hl,bc ld c,l ld b,h ;; length of move ex de,hl ld de,0a000h+2400-1 lddr call restore_a000 exx jp (hl) z88dk-1.8.ds1/libsrc/oz/ozgfx/ozscrolllinesclear.asm0000755000175000017500000000267407745264650022215 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; void ozscrolllinesclear(byte n); ; ; ------ ; $Id: ozscrolllinesclear.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozscrolllinesclear XREF ozactivepage ozscrolllinesclear: pop hl pop de push de push hl in a,(3) ld c,a in a,(4) ld b,a push bc ld bc,(ozactivepage) ld a,c out (3),a ld a,b out (4),a ;; multiply e by 30, and put in hl ld l,e ld h,0 add hl,hl ; hl=e*2 ld e,l ld d,h ; de=e*2 add hl,hl ; hl=e*4 add hl,hl ; hl=e*8 add hl,hl ; hl=e*16 add hl,hl ; hl=e*32 sbc hl,de ; hl=e*30 ld (num_to_clear+1),hl ld e,l ld d,h ld hl,2400 ;; carry should be clear sbc hl,de ld c,l ld b,h ;; bc=2400-num_to_clear ld hl,0a000h add hl,de ld de,0a000h ldir num_to_clear: ld de,300 ld c,e ld b,d ld hl,0a000h+2400 or a sbc hl,de xor a ld e,a rpt: ld (hl),e inc hl dec bc ld a,b or c jr nz,rpt pop bc ld a,c out (3),a ld a,b out (4),a ret z88dk-1.8.ds1/libsrc/oz/ozgfx/ozsetactivepage.asm0000755000175000017500000000131507745730252021464 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; Videmo memory page handling ; void ozsetactivepage(byte page) ; ; ; ------ ; $Id: ozsetactivepage.asm,v 1.1 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozsetactivepage XREF ozactivepage ozsetactivepage: pop hl pop bc push bc ld a,c or a jr nz,PageOne xor a ld (ozactivepage),a ;; assume high byte is 4 jp (hl) PageOne: ld a,4 ld (ozactivepage),a ;; assume high byte is 4 jp (hl) z88dk-1.8.ds1/libsrc/oz/ozgfx/ozsetdisplaypage.asm0000755000175000017500000000133007745730252021653 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; Videmo memory page handling ; ; ; ------ ; $Id: ozsetdisplaypage.asm,v 1.1 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozsetdisplaypage ozsetdisplaypage: pop hl pop bc push bc ld a,c or a jr nz,PageOneDisp xor a out (22h),a ; ld a,4 ; out (23h),a ;; removed as always 4 jp (hl) PageOneDisp: ld a,4 out (22h),a ; out (23h),a ;; removed as always 4 jp (hl) z88dk-1.8.ds1/libsrc/oz/ozgfx/ozsetfont.asm0000755000175000017500000000121307745264650020323 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; void ozsetfont(int font) ; ; ; ------ ; $Id: ozsetfont.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozsetfont ;XDEF ozfont XDEF ozfontniceheight XREF ScrCharSet ozsetfont: ;ozfont: ld hl,2 add hl,sp ld a,(hl) ld (ScrCharSet),a and 1 ld a,13 jr z,large ld a,10 large: ld (ozfontniceheight),a ret ozfontniceheight: defb 10 z88dk-1.8.ds1/libsrc/oz/ozgfx/ozswapactivedisplay.asm0000755000175000017500000000100307745730252022366 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; gfx functions ; ; Videmo memory page handling ; ; ; ------ ; $Id: ozswapactivedisplay.asm,v 1.1 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozswapactivedisplay XREF ozactivepage ozswapactivedisplay: ld hl,ozactivepage ld b,(hl) in a,(22h) ld (hl),a ld a,b out (22h),a ret z88dk-1.8.ds1/libsrc/oz/ozinput/0000755000175000017500000000000010765202715016127 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/ozinput/Makefile0000755000175000017500000000031110763607703017571 0ustar tygrystygrys# # Makefile for OZ-7xx specific libraries - ozinput # # $Id: Makefile,v 1.3 2008/03/05 20:35:47 dom Exp $ include ../../Make.config all: zcc +ozxansi $(CFLAGS) *.c clean: $(RM) *.o* zcc_opt.def z88dk-1.8.ds1/libsrc/oz/ozinput/ozclick.asm0000755000175000017500000000127507745264650020311 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; handles the click sound effect on keypress ; ; ------ ; $Id: ozclick.asm,v 1.1 2003/10/21 17:15:20 stefano Exp $ ; XLIB ozclick XDEF enable_click XREF ozclick_setting ozclick: ld hl,2 add hl,sp ld a,(hl) ld (ozclick_setting),a or a ret z enable_click: ld a,1 out (19h),a ld a,10 out (17h),a xor a out (18h),a ld a,2 out (16h),a ;; enable key click ret z88dk-1.8.ds1/libsrc/oz/ozinput/ozeditline.c0000755000175000017500000000674407745452122020462 0ustar tygrystygrys#include #include static byte x,y,pos,x0; static char *s; static byte height; static void xorcursor() { _ozvline(x,y,height,XOR); if(x>x0) _ozvline(x-1,y,height,XOR); else _ozvline(x+1,y,height,XOR); } static void setcursor(void) { static byte c; c=s[pos]; s[pos]=0; x=ozputs(x0,-1,s); s[pos]=c; } static void movecursor(void) { xorcursor(); setcursor(); xorcursor(); } //extern int __LIB__ ozeditline(byte _x0,byte y0,char *s0,byte slen,byte xlen) int ozeditline(byte _x0,byte y0,char *s0,byte slen,byte xlen) { static char c; static byte l1,l2; static unsigned k; static byte i; register char *p; switch(ozgetfont()) { case FONT_PC_NORMAL: case FONT_OZ_NORMAL: height=8; break; default: height=13; break; } x=x0=_x0; y=y0; if((int)x0+(int)xlen>239 || (int)y+(int)height>79) return OZEDITLINE_ERROR; xlen--; s=s0; pos=strlen(s0); if(pos>=slen) return OZEDITLINE_ERROR; ozputs(x0,y,s); setcursor(); xorcursor(); while(1) switch(k=getch()) { case KEY_MAIN: case KEY_SCHEDULE: case KEY_MEMO: case KEY_TELEPHONE: case KEY_POWER: case KEY_MYPROGRAMS: ozexitto(k); case KEY_BACKLIGHT: oztogglelight(); break; case KEY_LEFT: if(pos>0) { pos--; movecursor(); } break; case KEY_RIGHT: if(s[pos]) { pos++; movecursor(); } break; case KEY_LOWER_ESC: case KEY_UPPER_ESC: case 27: xorcursor(); return OZEDITLINE_CANCEL; case KEY_LOWER_ENTER: case KEY_UPPER_ENTER: case '\r': case '\n': xorcursor(); return strlen(s); case KEY_BACKSPACE: case KEY_BACKSPACE_16K: if(pos>0) { pos--; p=s+pos; c=*p; while(*p) { *p=p[1]; p++; } xorcursor(); l1=ozputs(x0,y,s); l2=ozputch(l1,-1,c); for(i=l1;ipos;i--) s[i]=s[i-1]; if(s[pos]==0) s[pos+1]=0; s[pos]=k; pos++; ozputs(x0,y,s); setcursor(); xorcursor(); } break; } } #if 0 main() { static char s[26]; s[0]=0; ozeditline(0,0,s,26,100); ozputs(10,10,s); ozgetch(); } #endif z88dk-1.8.ds1/libsrc/oz/ozinput/ozgetch.asm0000755000175000017500000000173007745730252020306 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; int ozgetch(); ; picks a char from keyboard buffer ; ; ; ------ ; $Id: ozgetch.asm,v 1.1 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozgetch2 ; renamed (will be redefined if used) XREF KeyBufGetPos XREF EnableKeyboard ozgetch2: ld hl,KeyBufGetPos ld de,EnableKeyboard jr WaitForKey WaitForKey0: dec hl halt WaitForKey: ld a,(de) and 0ffh-7 ld (de),a ld a,(hl) ;; KeyBufGetPos inc hl cp (hl) ;; KeyBufPutPos jr z,WaitForKey0 inc a cp 0ch jr c,dontzero xor a dontzero: ld c,a sla c ld b,0 inc hl ;; KeyboardBuffer add hl,bc ld c,(hl) inc hl ld h,(hl) ld l,c ld (KeyBufGetPos),a ret z88dk-1.8.ds1/libsrc/oz/ozinput/ozkbdoff.asm0000755000175000017500000000053007745506145020446 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; void ozkeyboardoff() ; ; ------ ; $Id: ozkbdoff.asm,v 1.1 2003/10/22 13:55:49 stefano Exp $ ; XLIB ozkbdoff ozkbdoff: in a,(7) or 1 out (7),a ret z88dk-1.8.ds1/libsrc/oz/ozinput/ozkbdon.asm0000755000175000017500000000052707745506145020316 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; void ozkeyboardon() ; ; ------ ; $Id: ozkbdon.asm,v 1.1 2003/10/22 13:55:49 stefano Exp $ ; XLIB ozkbdon ozkbdon: in a,(7) and 0feh out (7),a ret z88dk-1.8.ds1/libsrc/oz/ozinput/ozkeyclear.asm0000755000175000017500000000064007745506145021014 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; Keyboard routines ; ; ------ ; $Id: ozkeyclear.asm,v 1.1 2003/10/22 13:55:49 stefano Exp $ ; XLIB ozkeyclear XREF KeyBufPutPos ozkeyclear: ld hl,KeyBufPutPos ld a,(hl) dec hl ;; KeyBufGetPos ld (hl),a ret z88dk-1.8.ds1/libsrc/oz/ozinput/ozkeyhit.asm0000755000175000017500000000106207747247131020510 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; Keyboard routines ; ; ------ ; $Id: ozkeyhit.asm,v 1.2 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozkeyhit2 ; renamed (will be redefined if used) XREF KeyBufGetPos XREF EnableKeyboard ozkeyhit2: ld de,EnableKeyboard ld a,(de) and 0ffh-7 ld (de),a ld hl,KeyBufGetPos ld a,(hl) inc hl ;; KeyBufPutPos cp (hl) ld hl,1 ret nz dec hl ret z88dk-1.8.ds1/libsrc/oz/ozinput/ozkeylower.asm0000755000175000017500000000133507745506145021060 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; int ozkeylower(char mask); ; returns key pressed bitmap for lower part of keyboard ; ; ------ ; $Id: ozkeylower.asm,v 1.1 2003/10/22 13:55:49 stefano Exp $ ; XLIB ozkeylower ozkeylower: ;ld hl,2 ;add hl,sp ;call $gint ;push hl ; pushed byte ;pop bc pop hl pop bc : pick the mask push bc push hl xor a out (18),a ld a,c out (17),a in a,(16) ld c,a ld b,0 push bc pop hl ret z88dk-1.8.ds1/libsrc/oz/ozinput/ozkeyupper.asm0000755000175000017500000000133307745506145021061 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; int ozkeyupper(char mask); ; returns key pressed bitmap for upper part of keyboard ; ; ------ ; $Id: ozkeyupper.asm,v 1.1 2003/10/22 13:55:49 stefano Exp $ ; XLIB ozkeyupper ozkeyupper: ;ld hl,2 ;add hl,sp ;call $gint ;push hl ; pushed byte ;pop bc pop hl pop bc : pick the mask push bc push hl xor a out (17),a ld a,c out (18),a in a,(16) ld c,a ld b,0 push bc pop hl ret z88dk-1.8.ds1/libsrc/oz/ozinput/ozungetch.asm0000755000175000017500000000203007745730252020643 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; int ozungetch(int key-char); ; puts a character back in the keyboard buffer ; ; ------ ; $Id: ozungetch.asm,v 1.1 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozungetch2 ; renamed (will be redefined if used) XREF KeyBufGetPos ozungetch2: pop hl pop de push de push hl di ld hl,KeyBufGetPos ld c,(hl) ld b,0 inc bc add hl,bc add hl,bc ld (hl),e inc hl ld (hl),d ; key saved ld hl,KeyBufGetPos ld a,(hl) or a jr z,ldB dec a ld c,a jr ok1 ldB: ld c,0bh ok1: ld (hl),c inc hl ld a,(hl) ; KeyBufPutPos cp c ; overflowed buffer jr nz,ok2 or a jr z,ldB2 dec a jr ok3 ldB2: ld a,0bh ok3: ld (hl),a ok2: ei ret z88dk-1.8.ds1/libsrc/oz/ozinterrupt/0000755000175000017500000000000010765202715017024 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/ozinterrupt/ozcustomisr.asm0000755000175000017500000003053007747247131022142 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; custom interrupt code + key scanning ; ; ; ------ ; $Id: ozcustomisr.asm,v 1.3 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozcustomisr XDEF serial_hook XDEF ozkeyclick XDEF oz1hz XDEF oz64hz_word XDEF oz64hz_dword XDEF ozi64hztime XDEF oz4sec_word XDEF ozi64hzcount XDEF ozdisablepowerkey XDEF ozgreyscale XDEF ozgreycount XDEF s_64hz_hook XDEF s_64hz_return XREF cleanup ; exit in oz_crt0 XREF s_init_unblank ; exit quickly " XREF KeyboardBuffer XREF KeyBufGetPos XREF KeyBufPutPos ; settings XREF ozkeyrepeatspeed XREF ozkeyrepeatdelay XREF ozclick_setting defc PauseFirst = 32 PowerOff: ld a,(ozdisablepowerkey) or a jp nz,NotPowerOff inc a ld (ozdisablepowerkey),a ld hl,kPower ld (KeyboardBuffer),hl ld a,0bh ld (KeyBufGetPos),a xor a ld (KeyBufPutPos),a ;jp _exit jp cleanup FastClock: ld a,(ozgreyscale) or a jp z,FastClockDone push hl ld hl,(ozgreycount) dec hl ld (ozgreycount),hl ld a,l or h jp nz,pophl_FastClockDone in a,(22h) xor 4 out (22h),a ld hl,110 jr z,NotAdd ;; second page -- only 300 delay add hl,hl NotAdd: ld (ozgreycount),hl pophl_FastClockDone: pop hl FastClockDone: ld a,d and 0ffh - 64 jr nz,FromFastClock ei ret ; ------------------------------------ ozcustomisr: in a,(5) ld d,a ld a,0ffh out (6),a in a,(7) ;; mask cpl and d ld d,a bit 6,d jp nz,FastClock FromFastClock: bit 0,d ;; e ;; get keyboard bit call nz,KbdHit in a,(46h) and 16 jp nz,PowerOff ;; power switch depressed NotPowerOff: in a,(12h) and 128 ;jp z,__exit ;; battery switch flipped - get out rapidly jp z,s_init_unblank ;; battery switch flipped - get out rapidly serial_hook: jp GetOutPopAF ;$serial_hook equ $-2 GetOutPopAF: bit 4,d ;; 1hz jr nz,Inc1hz notInc1hz: bit 5,d ;; 64hz jp nz,KbdAndClock ei ret Inc1hz: push hl ld hl,(oz1hz) inc hl ld (oz1hz),hl pop hl jr notInc1hz KbdHit: ozi64hztime: ld a,PauseFirst+1 ;__ozi64hztime equ $-1 ld (ozi64hzcount),a or a ret z in a,(7) and 255-32 ;; enable 64hz interrupt or 1 ;; disable keyboard interrupt for now out (7),a ret KbdAndClock: ld a,(keybusy) or a ret nz dec a ; a=ff ld (keybusy),a ei jp key_isr key_isr_ret: xor a ld (keybusy),a ret ozdisablepowerkey: defs 1 ozi64hzcount: defs 1 ozgreyscale: defs 1 ozgreycount: defs 2 oz1hz: defs 2 oz64hz_word: oz64hz_dword: defs 1 oz4sec_word: defs 1 defs 2 keybusy: defs 1 ; Keyboard driver adapted from software labeled: ; Source code free for non-commercial use ; Assembled program (C)2000 OZdev ; Benjamin Green keyTable: defs 10 mask10: defs 1 mask11: defs 1 repeatcount: defs 1 repeatkey: defs 2 mask12: defs 1 defc Mask2nd = 01h defc MaskNew = 02h defc MaskInv = 04h defc MaskShift = 08h defc kPower = 803Ah defc kUpperMenu = 8068h defc kUpperEnter = 8066h defc kUpperEsc = 8067h defc kEnter = 8038h defc kLShift = 0000h defc kRShift = 8836h defc k2nd = 8137h defc kEsc = 8058h defc kMenu = 8032h defc kNew = 8233h defc kInv = 8435h defc kUp = 8040h defc kDown = 8041h defc kRight = 8043h defc kLeft = 8042h defc kMain = 7025h defc kTel = 70e9h defc kSched = 70eah defc kMemo = 70ebh defc kMyProg = 7015h defc kLight = 803bh defc kPageUp = 8044h defc kPageDown = 8045h key_isr: push bc push de push hl ld hl,ozi64hzcount ld a,(hl) or a jr z,skipCountDown dec a ld (hl),a jr nz,skipCountDown in a,(7) or 32 ;; disable 64hz interrupt and 255-1 ;; but enable keyboard interrupt out (7),a skipCountDown: ld hl,(oz64hz_dword) ld bc,1 add hl,bc ld (oz64hz_dword),hl ld hl,(oz64hz_dword+2) ld bc,0 adc hl,bc ld (oz64hz_dword+2),hl ; global $64hz_hook,$64hz_return s_64hz_hook: jp s_64hz_return ;$64hz_hook equ $-2 s_64hz_return: rxxoff_hook: jp noxoff ;$rxxoff_hook equ $-2 noxoff: ld a,(KeyBufPutPos) inc a cp 0ch jr c,dontzero xor a dontzero: ld b,a ld a,(KeyBufGetPos) cp b jp z,KBufferFull xor a out (11h),a ld a,2 out (12h),a ld (mask12),a ld hl,keyTable+8 in a,(10h) ld b,(hl) ld (hl),a or b xor b and a jr z,noProgKey1 bitP0: bit 0,a jr z,bitP1 ld a,56 ld l,1 jp lookup bitP1: bit 1,a jr z,bitP2 ld a,57 ld l,2 jr lookup bitP2: bit 2,a jr z,bitP3 ld a,58 ld l,4 jr lookup bitP3: bit 3,a jr z,bitP4 ld a,59 ld l,8 jr lookup bitP4: bit 4,a jr z,bitP6 ld a,60 ld l,16 jr lookup bitP6: bit 6,a jr z,noProgKey1 ld a,61 ld l,64 jr lookup noProgKey1: ld a,1 out (12h),a ld (mask12),a ld hl,keyTable+9 in a,(10h) ld b,(hl) ld (hl),a or b xor b and a jr z,noProgKey2 abitP0: bit 0,a jr z,abitP3 ld a,62 ld l,1 jp lookup abitP3: bit 3,a jr z,abitP4 ld a,63 ld l,8 jr lookup abitP4: bit 4,a jr z,abitP5 ld a,64 ld l,16 jr lookup abitP5: bit 5,a jr z,abitP6 ld a,65 ld l,32 jr lookup abitP6: bit 6,a jr z,noProgKey2 ld a,66 ld l,64 lookup: ld e,a xor a ld (mask11),a ld a,l ld (mask10),a jr lookup2 noProgKey2: xor a out (12h),a ld hl,keyTable ld de,100h keyscan: ld a,d out (11h),a in a,(10h) ld b,(hl) ld (hl),a or b xor b and a jr nz,bit0 inc e inc hl sla d jr nz,keyscan bit0: bit 0,a jr z,bit1 ld a,e ld l,1 jr rlookup bit1: bit 1,a jr z,bit2 ld a,e add a,8 ld l,2 jr rlookup bit2: bit 2,a jr z,bit3 ld a,e add a,16 ld l,4 jr rlookup bit3: bit 3,a jr z,bit4 ld a,e add a,24 ld l,8 jr rlookup bit4: bit 4,a jr z,bit5 ld a,e add a,32 ld l,16 jr rlookup bit5: bit 5,a jr z,bit6 ld a,e add a,40 ld l,32 jr rlookup bit6: bit 6,a jp z,nokey ld a,e add a,48 ld l,64 rlookup: ld e,a ld a,l ld hl,mask10 ld (hl),a inc hl ; =mask11 ld (hl),d xor a ld (mask12),a lookup2: xor a ld hl,keyTable ld b,(hl) bit 6,b jr z,no2nd ld a,Mask2nd no2nd: bit 5,b jr nz,shift ld hl,keyTable+6 bit 3,(hl) jr z,noShift shift: or MaskShift noShift: ld hl,keyTable+3 bit 6,(hl) jr z,noInv or MaskInv noInv: dec hl bit 6,(hl) jr z,noNew or MaskNew noNew: lookupKey: ld b,a ld hl,keys ld d,0 add hl,de add hl,de ld a,(hl) ld c,a inc hl ld a,(hl) xor b ld b,a ld hl,repeatcount ld a,(ozkeyrepeatdelay) ld (hl),a inc hl ; =repeatkey ld (hl),c inc hl ld (hl),b putinbuf: call KbdHit ld a,(ozclick_setting) or a call nz,ozkeyclick putinbuf_noclick: ld a,(KeyBufPutPos) inc a cp 0ch jr c,dontzero2 xor a dontzero2: ld (KeyBufPutPos),a ld e,a ld d,0 ld hl,KeyboardBuffer add hl,de add hl,de ld (hl),c inc hl ld (hl),b KBufferFull: iret: ld a,0ffh out (11h),a out (12h),a pop hl pop de pop bc jp key_isr_ret clearrepeat: xor a ld hl,mask11 ld (hl),a ; hl=mask11 inc hl ld (hl),a ; hl=mask12 jr iret nokey: ld a,(mask12) ld hl,mask11 ld c,(hl) ; c=(mask11) or c jr z,iret ; nothing to repeat inc hl ; =repeatcount inc hl ; =repeatkey ld hl,repeatkey xor a ld b,(hl) or b jr z,clearrepeat ; lower shift - do not repeat inc hl ld a,080h and (hl) jr z,doRepeat ; not any other shift key ld a,b cp kRShift.and.0ffh jr z,clearrepeat cp kNew.and.0ffh jr z,clearrepeat cp kInv.and.0ffh jr z,clearrepeat cp k2nd.and.0ffh jr z,clearrepeat doRepeat: ld hl,mask10 ld a,c out (11h),a ; set mask ld a,(mask12) out (12h),a in a,(10h) and (hl) ; (mask10) inc hl ; =mask11 jr z,clearrepeat ; key to be repeated released inc hl ; =repeatcount dec (hl) ld a,(hl) or a jr nz,iret ; not time yet ld a,(ozkeyrepeatspeed) ld (hl),a inc hl ; =repeatkey ld c,(hl) inc hl ld b,(hl) jp putinbuf_noclick keys: defw kEsc,'1','2','3','4','5','6','7' defw 'q','w','e','r','t','8','9','0' defw 0,'y','u','i','o','p',8,'.' defw 'g','h','j','k','l',13,kRShift,',' defw 'a','s','d','f',kLeft,kDown,kRight,kUp defw kLShift,'z','x','c','v','b','n','m' defw k2nd,kMenu,kNew,kInv,' ','-',kEnter,0 defw kMain,kTel,kSched,kMemo,kMyProg,kLight defw kUpperMenu,kUpperEsc,kUpperEnter,kPageUp,kPageDown ozkeyclick: in a,(15h) and a ret nz ; bell char takes priority ld a,1 out (19h),a out (16h),a xor a keyclick: dec a jr nz,keyclick out (16h),a dontClick: ret z88dk-1.8.ds1/libsrc/oz/ozinterrupt/ozinstisr.asm0000755000175000017500000000203407747247131021603 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; interrupt routines ; ; ; ------ ; $Id: ozinstisr.asm,v 1.2 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozinstisr ozinstisr: ld a,(0) cp F3h ;di jr nz,error ;; install an interrupt table ;; ld hl,0fe00h ld de,0fe01h ld bc,256 ld a,0ffh ld (hl),a ldir di ld hl,0fff4h ld (hl),F3h ;di inc hl ld (hl),C3h ;jp inc hl pop bc ;; return address pop de ;; isr argument push de push bc ld (hl),e inc hl ld (hl),d ld a,18h ;jr ld (0ffffh),a ld a,0feh ld i,a im 2 ei ld hl,0 ret error: ld hl,-1 ret z88dk-1.8.ds1/libsrc/oz/ozinterrupt/ozintwait.asm0000755000175000017500000000130507747247131021567 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; custom interrupt code + key scanning ; waits for a keystroke, serial data, or interrupt event ; ; ; ------ ; $Id: ozintwait.asm,v 1.2 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozintwait LIB ozcustomisr XDEF serial_check_hook XREF KeyBufGetPos XREF KeyBufPutPos ozintwait: di serial_check_hook: jp NoSerialCheck ;$serial_check_hook equ $-2 NoSerialCheck: ld a,(KeyBufGetPos) ld c,a ld a,(KeyBufPutPos) cp c jr nz,getout ei halt getout: ei ret z88dk-1.8.ds1/libsrc/oz/ozinterrupt/ozsetisr.asm0000755000175000017500000000335007747247131021423 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; interrupt routines ; ; ; ------ ; $Id: ozsetisr.asm,v 1.2 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozsetisr LIB ozinstisr ozsetisr: ;; load in interrupt handler stub ld hl,ISRStub_begin ld de,ISRStub_loc ld bc,ISRStub_len ldir ld hl,2 add hl,sp ld de,r_ozisrpointer ldi ldi ld bc,ISRStub_loc push bc call ozinstisr pop bc ret ISRStub_begin: push af push bc push de ld c,1 in e,(c) inc c in d,(c) push de inc c in e,(c) inc c in d,(c) push de ld a,6-4 out (1),a ld a,4 out (2),a ld a,7 out (3),a ld a,4 out (4),a ;ozisrpointer equ $+1 ozisrpointer: call 38h pop de ld c,3 out (c),e inc c out (c),d pop de ld c,1 out (c),e inc c out (c),d pop de pop bc pop af ei reti ISRStub_end: ;ISRStub_len equ ISRStub_end-ISRStub_begin ;ISRStub_loc equ 0fff4h - ISRStub_len ;r_ozisrpointer equ ISRStub_loc + (ozisrpointer-ISRStub_begin) defc ISRStub_len = ISRStub_end-ISRStub_begin defc ISRStub_loc = 0fff4h - ISRStub_len defc r_ozisrpointer = ISRStub_loc + (ozisrpointer+1-ISRStub_begin) z88dk-1.8.ds1/libsrc/oz/ozinterrupt/serial_int.asm0000755000175000017500000000473007747247131021675 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; interrupt driven serial routines ; ; ; ------ ; $Id: serial_int.asm,v 1.3 2003/10/27 16:56:57 stefano Exp $ ; XLIB serial_int XDEF serial_int_check XDEF ozserbufget XDEF ozserbufput XDEF SerialBuffer XDEF ozrxhandshaking XDEF ozrxxoff LIB ozcustomisr XREF rxxoff_hook XREF serial_hook LIB ozintwait XREF serial_check_hook ; Don't exchange the items position !! defc BufLen = 256 ozserbufget: defs 1 ozserbufput: defs 1 SerialBuffer: defs BufLen ozrxhandshaking: defs 1 ozrxxoff: defs 1 rxxoff_handler: ld a,(ozrxxoff) or a ;jp z,$rxxoff_hook+2 jp z,rxxoff_hook+3 ld hl,ozserbufput ld a,(hl) dec hl ; hl=ozserbufget sub (hl) cp 150 jp nc,rxxoff_hook+3 waittop2: in a,(45h) and 20h jr z,waittop2 ld a,17 ; XON out (40h),a xor a ld (ozrxxoff),a jp rxxoff_hook+3 serial_int_check: ld a,(ozserbufget) ld c,a ld a,(ozserbufput) cp c jp z,serial_check_hook+3 ei ret serial_int: in a,(45h) and 1 jp z,serial_hook+3 ;; no serial data in a,(40h) push hl ld e,a ld hl,ozserbufput ld a,(hl) ld c,a inc a dec hl ; hl=ozserbufget cp (hl) jp z,BufferFull inc hl ; hl=ozserbufput ld (hl),a ei ld b,0 inc hl ; hl=SerialBuffer add hl,bc ld (hl),e ld hl,ozserbufget sub (hl) ; a=buffer size cp 200 jr c,noXOFF ld a,(ozrxhandshaking) or a jr z,noXOFF ld a,(ozrxxoff) or a jr nz,noXOFF waittop: in a,(45h) and 20h jr z,waittop ld a,19 ; XOFF out (40h),a ld a,1 ld (ozrxxoff),a noXOFF: BufferFull: pop hl jp serial_hook+3 z88dk-1.8.ds1/libsrc/oz/ozmisc/0000755000175000017500000000000010765202715015723 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/ozmisc/ozdelay.asm0000755000175000017500000000100507745506145020103 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; void ozdelay(unsigned d) ; ; ------ ; $Id: ozdelay.asm,v 1.1 2003/10/22 13:55:49 stefano Exp $ ; XLIB ozdelay ozdelay: ;ld hl,2 ;add hl,sp ;call $gint pop bc pop hl push hl push bc delaylp: dec hl ld a,h or l jr nz,delaylp ret z88dk-1.8.ds1/libsrc/oz/ozmisc/ozexitto.asm0000755000175000017500000000101107747247131020315 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; ; ------ ; $Id: ozexitto.asm,v 1.2 2003/10/27 16:56:57 stefano Exp $ ; XLIB ozexitto LIB ozkeyclear LIB ozungetch2 XREF cleanup ;exit ozexitto: call ozkeyclear pop bc ;; retval pop hl ;; key push hl ;; put two copies of key on stack push hl call ozungetch2 pop hl ;; use previous copy of key on stack as argument call ozungetch2 jp cleanup z88dk-1.8.ds1/libsrc/oz/ozmisc/ozgetautorun.asm0000755000175000017500000000116407745264651021213 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ------ ; $Id: ozgetautorun.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozgetautorun ozgetautorun: in a,(4) push af in a,(3) push af xor a out (3),a ld c,4 out (c),c ld a,(0bf2ch) ld l,a ld h,0 pop af out (3),a pop af out (4),a ; ozsetautorun: ; unimplemented ret z88dk-1.8.ds1/libsrc/oz/ozmisc/ozinitsound.asm0000755000175000017500000000054007747247754021036 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; void ozinitsound(void) ; ; ------ ; $Id: ozinitsound.asm,v 1.1 2003/10/27 17:03:40 stefano Exp $ ; XLIB ozinitsound ozinitsound: ld a,1 out (19h),a ; turn tone mode on ret z88dk-1.8.ds1/libsrc/oz/ozmisc/ozportin.asm0000755000175000017500000000060707745452122020322 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; char ozportin(char port) ; ; ------ ; $Id: ozportin.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozportin ozportin: ld hl,2 add hl,sp ld c,(hl) in l,(c) ld h,0 retz88dk-1.8.ds1/libsrc/oz/ozmisc/ozportout.asm0000755000175000017500000000070707745452122020524 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; void ozportout(char port, char value) ; ; ------ ; $Id: ozportout.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozportout ozportout: push ix ld ix,4 add ix,sp ld c,(ix+0) ld a,(ix+2) out (c),a pop ix ret z88dk-1.8.ds1/libsrc/oz/ozmisc/ozquiet.asm0000755000175000017500000000076707747247754020164 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; void ozquiet() ; ; ------ ; $Id: ozquiet.asm,v 1.1 2003/10/27 17:03:40 stefano Exp $ ; XLIB ozquiet LIB ozclick XREF ozclick_setting ozquiet: xor a out (16h),a ; turn off note ld a,(ozclick_setting) or a ret z ld hl,1 push hl call ozclick pop hl ret z88dk-1.8.ds1/libsrc/oz/ozmisc/ozsound.asm0000755000175000017500000000104507747247754020153 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; void ozsound(unsigned divisor); ; ; ------ ; $Id: ozsound.asm,v 1.1 2003/10/27 17:03:40 stefano Exp $ ; XLIB ozsound LIB ozinitsound ozsound: call ozinitsound xor a out (16h),a ; turn off note ld hl,2 add hl,sp ld a,(hl) out (17h),a inc hl ld a,(hl) out (18h),a ld a,3 out (16h),a ; set frequency and output tone ret z88dk-1.8.ds1/libsrc/oz/ozscreen/0000755000175000017500000000000010765202715016247 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/ozscreen/ozblankscreen.asm0000755000175000017500000000142307745264651021627 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; display blanking control functions ; LCDStatus is 0c024h in the OS; ; ; ; ------ ; $Id: ozblankscreen.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozblankscreen LIB ozunblankscreen LIB ozsetlcdstate XREF s_blanked XREF s_ozlcdstatus XREF s_init_unblank ozblankscreen: ld hl,ozunblankscreen ; was ozslow ld (s_init_unblank+1),hl ld a,1 ld (s_blanked),a ld hl,(s_ozlcdstatus) ld a,l or 40h and 7fh ld l,a push hl call ozsetlcdstate pop hl ret z88dk-1.8.ds1/libsrc/oz/ozscreen/ozfast.asm0000755000175000017500000000074607745264651020304 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; display blanking control functions ; LCDStatus is 0c024h in the OS; ; ; ozslow is same than ozunblankscreen ; ; ; ------ ; $Id: ozfast.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozfast LIB ozblankscreen ozfast: call ozblankscreen xor a out (20h),a out (24h),a ret z88dk-1.8.ds1/libsrc/oz/ozscreen/ozgetcontrast.asm0000755000175000017500000000062107745264651021674 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; display contrast control functions ; ; ------ ; $Id: ozgetcontrast.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozgetcontrast XREF ozcontrast ozgetcontrast: ld a,(ozcontrast) ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/oz/ozscreen/ozsetcontrast.asm0000755000175000017500000000144707745264651021717 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; display contrast control functions ; ; ------ ; $Id: ozsetcontrast.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozsetcontrast LIB ozsetlcdstate XREF ozcontrast XREF s_ozlcdstatus ozsetcontrast: pop hl pop bc push bc push hl ld a,c cp 40h jr c,LeaveAlone ld a,3fh LeaveAlone: ld (ozcontrast),a ld e,a ld bc,(s_ozlcdstatus) ld a,c and 0ffh-3fh or e ld c,a push bc call ozsetlcdstate pop bc ret z88dk-1.8.ds1/libsrc/oz/ozscreen/ozsetlcdstate.asm0000755000175000017500000000127007745264651021657 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; display backlight control functions ; ; ; ozsetlcdstate - service routine ; ; ; ------ ; $Id: ozsetlcdstate.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozsetlcdstate XREF s_ozlcdstatus LIB restore_a000 ozsetlcdstate: pop de pop hl ;; status to set push hl push de xor a out (3),a ld a,3 out (4),a ;; page in page 300h ld (0a000h),hl ld (s_ozlcdstatus),hl jp restore_a000 z88dk-1.8.ds1/libsrc/oz/ozscreen/ozsetlight.asm0000755000175000017500000000237007745264651021165 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; display backlight control functions ; ; ; void ozsetlight(char light) ; ; ; ; ------ ; $Id: ozsetlight.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozsetlight XREF ozbacklight XREF ozbacklight_save XREF s_ozlcdstatus LIB ozsetlcdstate ozsetlight: pop hl pop bc push bc push hl ld a,c or a ld hl,ozbacklight jr nz,LightOn ld a,(hl) and 0ffh - 040h ld (hl),a ld hl,(s_ozlcdstatus) ld a,h and 0feh jr DoSet ld hl,ozbacklight_save ld a,(hl) and 0ffh - 08h ld (hl),a LightOn: ld a,040h or (hl) ld (hl),a ld hl,ozbacklight_save ld a,08h or (hl) ld (hl),a ld hl,(s_ozlcdstatus) ld a,h or 01 DoSet: ld h,a push hl call ozsetlcdstate pop hl ret z88dk-1.8.ds1/libsrc/oz/ozscreen/oztogglelight.asm0000755000175000017500000000105507745264651021652 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; display backlight control functions ; ; ; void oztogglelight(void) ; ; ; ; ------ ; $Id: oztogglelight.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB oztogglelight XREF ozbacklight LIB ozsetlight oztogglelight: ld a,(ozbacklight) and 040h xor 040h ld l,a push hl call ozsetlight pop hl ret z88dk-1.8.ds1/libsrc/oz/ozscreen/ozunblankscreen.asm0000755000175000017500000000156407745264651022200 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; display blanking control functions ; LCDStatus is 0c024h in the OS; ; ; ; ------ ; $Id: ozunblankscreen.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozunblankscreen XDEF s_blanked LIB ozsetlcdstate XREF s_ozlcdstatus s_blanked: defb 0 ; ozslow: ozunblankscreen: ld hl,s_blanked ld a,(hl) or a ret z inc a ld (hl),a ld a,5 out (24h),a ld a,1 out (20h),a ld hl,(s_ozlcdstatus) ld a,l and 0bfh or 80h ld l,a push hl call ozsetlcdstate pop hl ret z88dk-1.8.ds1/libsrc/oz/ozserial/0000755000175000017500000000000010765202715016247 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/ozserial/ozclearserialbuffer.asm0000755000175000017500000000104707745264651023022 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; buffered serial input ; ; ------ ; $Id: ozclearserialbuffer.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozclearserialbuffer LIB serial_int XREF SerialBuffer XREF ozserbufget XREF ozrxxoff ozclearserialbuffer: ld hl,ozserbufget ld a,(hl) inc hl ld (hl),a xor a ld (ozrxxoff),a ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozdatabits.asm0000755000175000017500000000067407745452122021132 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; serial control commands ; ; ------ ; $Id: ozdatabits.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozdatabits ozdatabits: ld hl,2 add hl,sp in a,(43h) and 0FFh-3 or (hl) out (43h),a ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozgetbaud.asm0000755000175000017500000000076307745452122020751 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; serial control commands ; ; ------ ; $Id: ozgetbaud.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozgetbaud ozgetbaud: in a,(43h) ld b,a or 80h out (43h),a in a,(40h) ld l,a in a,(41h) ld h,a ld a,b and 7fh out (43h),a ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozgetlcr.asm0000755000175000017500000000053507745452122020613 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; serial control commands ; ; ------ ; $Id: ozgetlcr.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozgetlcr ozgetlcr: in a,(43h) ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozgetrxhandshaking.asm0000755000175000017500000000071007745264651022667 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; buffered serial input ; ; ------ ; $Id: ozgetrxhandshaking.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozgetrxhandshaking LIB serial_int XREF SerialBuffer XREF ozrxhandshaking ozgetrxhandshaking: ld a,(ozrxhandshaking) ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozparity.asm0000755000175000017500000000064207745452122020642 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; serial control commands ; ; ------ ; $Id: ozparity.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozparity ozparity: ld hl,2 add hl,sp in a,(43h) and 1+2+4+40h+80h or (hl) out (43h),a ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozserialgetc.asm0000755000175000017500000000146007745264651021463 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; buffered serial input ; ; ------ ; $Id: ozserialgetc.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozserialgetc LIB serial_int XREF SerialBuffer XREF ozserbufget XREF ozserbufput ozserialgetc: ld a,(ozserbufget) ld e,a ld a,(ozserbufput) cp e jr z,NothingInBuffer ld l,e ld h,0 ld bc,SerialBuffer add hl,bc ld a,(hl) ld l,a ld h,0 ld a,e inc a ld (ozserbufget),a ret NothingInBuffer: ld hl,-1 ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozserialin.asm0000755000175000017500000000071507745452122021141 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; ; ; ------ ; $Id: ozserialin.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozserialin ozserialin: in a,(45h) and 1 jr z,nothing in a,(40h) ld l,a ld h,0 ret nothing: ld hl,-1 ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozserialout.asm0000755000175000017500000000071307745452122021340 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; ; ; ------ ; $Id: ozserialout.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozserialout ozserialout: ld hl,2 add hl,sp waittop: in a,(45h) and 20h jr z,waittop ld a,(hl) out (40h),a ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozserintoff.asm0000755000175000017500000000126407745730252021335 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; ; ; ------ ; $Id: ozserintoff.asm,v 1.2 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozserintoff LIB ozcustomisr XREF serial_hook XREF rxxoff_hook LIB ozintwait XREF serial_check_hook ozserintoff: ld hl,serial_hook+3 ld (serial_hook+1),hl ld hl,serial_check_hook+3 ld (serial_check_hook+1),hl ld hl,rxxoff_hook+3 ld (rxxoff_hook+1),hl in a,(7) or 4 out (7),a ld a,0 out (41h),a ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozserinton.asm0000755000175000017500000000136307745730252021177 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; ; ; ------ ; $Id: ozserinton.asm,v 1.2 2003/10/23 10:42:50 stefano Exp $ ; XLIB ozserinton LIB ozcustomisr XREF serial_hook XREF rxxoff_hook LIB ozintwait XREF serial_check_hook LIB serial_int XREF serial_int_check XREF rxxoff_handler ozserinton: ld hl,serial_int ld (serial_hook+1),hl ld hl,serial_int_check ld (serial_check_hook+1),hl ld hl,rxxoff_handler ld (rxxoff_hook+1),hl in a,(7) and 0ffh-4 out (7),a ld a,1 out (41h),a ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozsetbaud.asm0000755000175000017500000000105707745452122020762 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; serial control commands ; ; ------ ; $Id: ozsetbaud.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozsetbaud ozsetbaud: ld hl,2 add hl,sp in a,(43h) ld b,a or 80h out (43h),a ld a,(hl) out (40h),a inc hl ld a,(hl) out (41h),a ld a,b and 7fh out (43h),a ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozsetlcr.asm0000755000175000017500000000056507745452122020632 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; serial control commands ; ; ------ ; $Id: ozsetlcr.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozsetlcr ozsetlcr: ld hl,2 add hl,sp ld a,(hl) out (43h),a ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozsetrxhandshaking.asm0000755000175000017500000000123007745264651022701 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; buffered serial input ; ; ------ ; $Id: ozsetrxhandshaking.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozsetrxhandshaking LIB serial_int XREF SerialBuffer XREF ozrxhandshaking XREF ozrxxoff ozsetrxhandshaking: pop hl pop de push de ld a,e or a jr z,load_it ld a,0 load_it: ld (ozrxhandshaking),a xor a ld (ozrxxoff),a jp (hl) z88dk-1.8.ds1/libsrc/oz/ozserial/ozsnap.asm0000755000175000017500000000311407745264651020300 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; ; ; ------ ; $Id: ozsnap.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozsnap XREF ozactivepage ozsnap: in a,(43h) push af ld a,80h out (43h),a in a,(40h) push af in a,(41h) push af ld a,4 out (40h),a xor a out (41h),a ld a,3 out (43h),a in a,(03h) ld c,a in a,(04h) ld b,a push bc ld bc,(ozactivepage) ld a,c out (03h),a ld a,b out (04h),a xor a yloop: push af call hexout ld d,0 ld e,a uartwait3: in a,(45h) bit 5,a jr z,uartwait3 ld a,':' out (40h),a ld hl,500h add hl,de add hl,hl add hl,hl add hl,hl add hl,hl cp a sbc hl,de add hl,hl ld b,30 xloop: ld a,(hl) call hexout inc hl djnz xloop uartwait4: in a,(45h) bit 5,a jr z,uartwait4 ld a,13 out (40h),a uartwait5: in a,(45h) bit 5,a jr z,uartwait5 ld a,10 out (40h),a pop af inc a cp 80 jp nz,yloop pop bc ld a,c out (03h),a ld a,b out (04h),a ld a,80h out (43h),a pop af out (41h),a pop af out (40h),a pop af out (43h),a ret hexout: push af push bc ld b,a uartwait1: in a,(45h) bit 5,a jr z,uartwait1 ld a,b srl a srl a srl a srl a cp 10 jr c,numeric1 add a,7 numeric1: add a,30h out (40h),a uartwait2: in a,(45h) bit 5,a jr z,uartwait2 ld a,b and 0Fh cp 10 jr c,numeric2 add a,7 numeric2: add a,30h out (40h),a pop bc pop af ret z88dk-1.8.ds1/libsrc/oz/ozserial/ozstopbits.asm0000755000175000017500000000065707745452122021207 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; Serial libraries ; serial control commands ; ; ------ ; $Id: ozstopbits.asm,v 1.1 2003/10/22 09:56:34 stefano Exp $ ; XLIB ozstopbits ozstopbits: ld hl,2 add hl,sp in a,(43h) and 1+2+8+10h+20h+40h+80 or (hl) out (43h),a ret z88dk-1.8.ds1/libsrc/oz/oztime/0000755000175000017500000000000010765202715015726 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/oz/oztime/Makefile0000755000175000017500000000030710763607706017400 0ustar tygrystygrys# # Makefile for OZ-7xx specific libraries - oztime # # $Id: Makefile,v 1.3 2008/03/05 20:35:47 dom Exp $ include ../../Make.config all: zcc +ozansi $(CFLAGS) *.c clean: $(RM) *.o* zcc_opt.def z88dk-1.8.ds1/libsrc/oz/oztime/ozday.asm0000755000175000017500000000052407745264651017575 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; clock functions ; ; unsigned ozday() ; ; ; ------ ; $Id: ozday.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozday LIB Compute ozday: ld c,38h jp Compute z88dk-1.8.ds1/libsrc/oz/oztime/ozhour.asm0000755000175000017500000000052707745264651020000 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; clock functions ; ; unsigned ozhour() ; ; ; ------ ; $Id: ozhour.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozhour LIB Compute ozhour: ld c,35h jp Compute z88dk-1.8.ds1/libsrc/oz/oztime/ozmin.asm0000755000175000017500000000052407745264651017603 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; clock functions ; ; unsigned ozmin() ; ; ; ------ ; $Id: ozmin.asm,v 1.1 2003/10/21 17:15:21 stefano Exp $ ; XLIB ozmin LIB Compute ozmin: ld c,33h jp Compute z88dk-1.8.ds1/libsrc/oz/oztime/ozmonth.asm0000755000175000017500000000053407745264652020147 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; clock functions ; ; unsigned ozmonth() ; ; ; ------ ; $Id: ozmonth.asm,v 1.1 2003/10/21 17:15:22 stefano Exp $ ; XDEF ozmonth LIB Compute ozmonth: ld c,3ah jp Compute z88dk-1.8.ds1/libsrc/oz/oztime/ozsec.asm0000755000175000017500000000052407745264652017573 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; clock functions ; ; unsigned ozsec() ; ; ; ------ ; $Id: ozsec.asm,v 1.1 2003/10/21 17:15:22 stefano Exp $ ; XLIB ozsec LIB Compute ozsec: ld c,31h jp Compute z88dk-1.8.ds1/libsrc/oz/oztime/oztime.c0000755000175000017500000000262107750163442017410 0ustar tygrystygrys /* oztime() by Alexander R. Pruss, based on public domain scaldate:: scalar date routines -- public domain by Ray Gardner Numerically, these will work over the range 1/01/01 thru 14699/12/31. Practically, these only work from the beginning of the Gregorian calendar thru 14699/12/31. The Gregorian calendar took effect in much of Europe in about 1582, some parts of Germany in about 1700, in England and the colonies in about 1752ff, and in Russia in 1918. */ #include //#include #define isleap(yr) ( yr % 400 == 0 || (yr % 4 == 0 && yr % 100 != 0) ) #define months_to_days(month) ( (month * 3057 - 3007) / 100 ) #define years_to_days(yr) ( yr * 365L + yr / 4 - yr / 100 + yr / 400 ) static unsigned long time0(void) { static unsigned long scalar; static unsigned long yr; //static byte mo; static int mo; yr=ozyear(); mo=ozmonth(); scalar = ozday() + months_to_days(mo); if ( mo > 2 ) // adjust if past February scalar -= isleap(yr) ? 1 : 2; yr--; scalar += years_to_days(yr)-(1970*365L+1970/4-1970/100+1970/400); return scalar*86400L + ozhour()*3600L + (unsigned int)ozmin()*60 + ozsec(); } long oztime(void) { static unsigned long t0; t0=time0(); if(t0!=time0()) return time0(); // watch out for carry problems on tc8521 else return t0; } z88dk-1.8.ds1/libsrc/oz/oztime/oztimecompute.asm0000755000175000017500000000111707745264652021353 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; clock functions ; ; ; ------ ; $Id: oztimecompute.asm,v 1.1 2003/10/21 17:15:22 stefano Exp $ ; XLIB Compute Compute: in a,(c) and 0fh add a,a ld b,a add a,a add a,a add a,b ld b,a ; b=10*(c) dec c in a,(c) and 0fh add a,b ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/oz/oztime/ozweekday.asm0000755000175000017500000000061207745264652020450 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; clock functions ; ; unsigned ozweekday() ; ; ; ------ ; $Id: ozweekday.asm,v 1.1 2003/10/21 17:15:22 stefano Exp $ ; XDEF ozweekday ozweekday: in a,(36h) and 0fh ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/oz/oztime/ozyear.asm0000755000175000017500000000062707745264652017765 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; clock functions ; ; unsigned ozyear() ; ; ; ------ ; $Id: ozyear.asm,v 1.1 2003/10/21 17:15:22 stefano Exp $ ; XLIB ozyear LIB Compute ozyear: ld c,3ch call Compute ld de,2000 add hl,de ret z88dk-1.8.ds1/libsrc/oz/restore_a000.asm0000755000175000017500000000057407745264647017355 0ustar tygrystygrys; ; Sharp OZ family functions ; ; ported from the OZ-7xx SDK by by Alexander R. Pruss ; by Stefano Bodrato - Oct. 2003 ; ; ; restore the page A000 ; ; ; ------ ; $Id: restore_a000.asm,v 1.1 2003/10/21 17:15:19 stefano Exp $ ; XLIB restore_a000 restore_a000: ld a,7 out (3),a ld a,4 out (4),a ret z88dk-1.8.ds1/libsrc/ozansi.lst0000644000175000017500000000725010712620314016011 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/oz/fgetc_cons stdio/fgets_cons stdio/oz/getk stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/oz/f_ansi_attr stdio/ansi/oz/f_ansi_bel stdio/ansi/oz/f_ansi_char stdio/ansi/oz/f_ansi_cls stdio/ansi/generic/f_ansi_dline stdio/ansi/oz/f_ansi_scrollup stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/oz/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy graphics/fill graphics/dfill graphics/getsprite graphics/oz/putsprite graphics/bksave graphics/bkrestore graphics/oz/pixladdr graphics/oz/swapgfxbk graphics/xorborder graphics/xorpixl graphics/xorplot games/joystick printflike/ltoa_any z88dk-1.8.ds1/libsrc/pps.lst0000644000175000017500000000104010763607600015310 0ustar tygrystygrysstdio/sprinter/fgetc_cons stdio/sprinter/fputc_cons stdio/sprinter/getk stdio/sprinter/puts_cons time/mktime time/sprinter/clock time/sprinter/time fcntl/sprinter/close fcntl/sprinter/creat fcntl/sprinter/fdgetpos fcntl/sprinter/fdtell fcntl/sprinter/lseek fcntl/sprinter/open fcntl/sprinter/open_z88 fcntl/sprinter/read fcntl/sprinter/readbyte fcntl/sprinter/remove fcntl/sprinter/rename fcntl/sprinter/write fcntl/sprinter/writebyte fcntl/sprinter/rmdir fcntl/sprinter/mkdir fcntl/sprinter/getwd fcntl/sprinter/getcwd games/joystick @z80.lst z88dk-1.8.ds1/libsrc/ppsansi.lst0000644000175000017500000000146010763607600016171 0ustar tygrystygrysstdio/sprinter/fgetc_cons stdio/sprinter/getk time/mktime time/sprinter/clock time/sprinter/time fcntl/sprinter/close fcntl/sprinter/creat fcntl/sprinter/fdgetpos fcntl/sprinter/fdtell fcntl/sprinter/lseek fcntl/sprinter/open fcntl/sprinter/open_z88 fcntl/sprinter/read fcntl/sprinter/readbyte fcntl/sprinter/remove fcntl/sprinter/rename fcntl/sprinter/write fcntl/sprinter/writebyte fcntl/sprinter/rmdir fcntl/sprinter/mkdir fcntl/sprinter/getwd fcntl/sprinter/getcwd stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/sprinter/f_ansi_attr stdio/ansi/sprinter/f_ansi_bel stdio/ansi/sprinter/f_ansi_char stdio/ansi/sprinter/f_ansi_cls stdio/ansi/sprinter/f_ansi_dline stdio/ansi/sprinter/f_ansi_scrollup games/joystick @z80.lst z88dk-1.8.ds1/libsrc/printflike/0000755000175000017500000000000010765202715016136 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/printflike/fprintf.c0000644000175000017500000000076307130401723017750 0ustar tygrystygrys/* * Printf style formatting. (Borrowed from MicroEmacs by Dave Conroy.) * A lot smaller than the full fledged printf. * * Liberated once more and inserted into Small C+ 29/4/99 djm */ #define ANSI_STDIO #include /* * Cheating somewhat, this will cause a barf in the compiler...bigtime.. * nevermind... */ int fprintf(FILE *fp, char *fmt,...) { int *ct; ct= (getarg()*2)+&fmt-4; return (vfprintf((FILE *)(*ct),(unsigned char *)(*(ct-1)),ct-2)); } z88dk-1.8.ds1/libsrc/printflike/fscanf.c0000644000175000017500000000076107130401723017536 0ustar tygrystygrys/* * Printf style formatting. (Borrowed from MicroEmacs by Dave Conroy.) * A lot smaller than the full fledged printf. * * Liberated once more and inserted into Small C+ 29/4/99 djm */ #define ANSI_STDIO #include /* * Cheating somewhat, this will cause a barf in the compiler...bigtime.. * nevermind... */ int fscanf(FILE *fp, char *fmt,...) { int *ct; ct= (getarg()*2)+&fmt-4; return (vfscanf((FILE *)(*ct),(unsigned char *)(*(ct-1)),ct-2)); } z88dk-1.8.ds1/libsrc/printflike/itod.asm0000644000175000017500000001105107130401723017565 0ustar tygrystygrys ; itod -- convert nbr to signed decimal string of width sz ; right adjusted, blank filled ; returns str ; ; if sz > 0 terminate with null byte ; if sz = 0 find end of string ; if sz < 0 use last byte for data ; ; Used for printf - compiled hand optimized C ;itod(int nbr, char str[], sz) XLIB itod LIB l_gint LIB l_pint LIB l_neg LIB l_div .itod dec sp ; if (nbr < 0) ld hl,7 add hl,sp call l_gint xor a or h ld a,' ' ;for sgn jp p,i_2 ;nbr=-nbr ld hl,7 add hl,sp push hl call l_gint call l_neg pop de call l_pint ;sgn= '-' ld a,'-' ;flowing through ;else sgn= ' ' .i_2 ld hl,0 add hl,sp ld (hl),a ;if (sz >0) .i_3 ld hl,3 add hl,sp call l_gint xor a or h jp m,i_4 or l jp z,i_4 ;str[--sz]=NULL dec hl ex de,hl ;keep --sz sage ld hl,5 add hl,sp ;str call l_gint add hl,de ld (hl),0 ld hl,3 add hl,sp ;sz ex de,hl call l_pint jr i_5 ; else if sz < 0 sz=-sz ;we already have sz in hl if we come here... .i_4 xor a or h jp p,i_6 ;sz=-sz ld hl,3 add hl,sp push hl call l_gint call l_neg pop de ;sz call l_pint jr i_7 .i_6 ;else while ( str[sz] != NULL ) ++sz; .i_8 ld hl,3 add hl,sp ;sz push hl call l_gint ex de,hl ld hl,7 add hl,sp ;str call l_gint ;My short and sweet loop .i_djm1 add hl,de ld a,(hl) inc de and a jr nz,i_djm1 ;Have gone one step too far..undo dec de ex de,hl pop de ;&sz call l_pint .i_9 .i_7 .i_5 .i_10 ;While (sz) ld hl,3 add hl,sp call l_gint ld a,h or l jp z,i_11 dec hl ex de,hl ;de=--sz ld hl,5 add hl,sp ;str call l_gint add hl,de ;str[--sz] push hl ld hl,5 add hl,sp ;sz ex de,hl call l_pint ld hl,9 add hl,sp ;nbr call l_gint ex de,hl ;de=nbr ld hl,10 call l_div ex de,hl ;get modulus ld de,48 add hl,de pop de ld a,l ld (de),a ; if (nbr/=10) == 0 break ld hl,7 add hl,sp push hl call l_gint ex de,hl ld hl,10 call l_div pop de call l_pint ld a,h or l jp nz,i_10 ; jp nz,i_12 ; jp i_11 .i_12 ; jp i_10 ; if (sz) .i_11 ld hl,3 add hl,sp call l_gint ld a,h or l jp z,i_13 ;str[--sz]=sgn dec hl ex de,hl ;keep --sz safe ld hl,5 add hl,sp ;str call l_gint add hl,de push hl ;str[--sz] ld hl,5 add hl,sp ;sz ex de,hl call l_pint pop de ;str[--sz] ld hl,0 add hl,sp ;sgn ld a,(hl) ld (de),a .i_13 ; while ( sz > 0 ) ; str[--sz] = ' ' ; .i_14 ld hl,3 add hl,sp ;sz call l_gint xor a or h jp m,i_15 or l jp z,i_15 dec hl ex de,hl ;keep --sz ld hl,5 add hl,sp ;str call l_gint ;str[--sz]=' '; ;de=sz add hl,de ;str[--sz] ld (hl),' ' ld hl,3 add hl,sp ;store sz ex de,hl call l_pint jr i_14 .i_15 ld hl,5 add hl,sp call l_gint inc sp ret z88dk-1.8.ds1/libsrc/printflike/itod.c0000644000175000017500000000205507130401723017233 0ustar tygrystygrys /* * itod -- convert nbr to signed decimal string of width sz * right adjusted, blank filled ; returns str * * if sz > 0 terminate with null byte * if sz = 0 find end of string * if sz < 0 use last byte for data */ /* Black magic */ #include int itod(int nbr, char str[], int sz); itod(nbr, str, sz) int nbr ; char str[] ; int sz ; { char sgn ; if ( nbr < 0 ) { nbr = -nbr ; sgn = '-' ; } else sgn = ' ' ; if ( sz > 0 ) str[--sz] = NULL ; else if ( sz < 0 ) sz = -sz ; else while ( str[sz] != NULL ) ++sz ; while ( sz ) { str[--sz] = nbr % 10 + '0' ; if ( (nbr/=10) == 0 ) break ; } if ( sz ) str[--sz] = sgn ; while ( sz > 0 ) str[--sz] = ' ' ; return str ; } z88dk-1.8.ds1/libsrc/printflike/itou.c0000644000175000017500000000232307130401723017252 0ustar tygrystygrys /* * itou -- convert nbr to unsigned decimal string of width sz * right adjusted, blank filled ; returns str * * if sz > 0 terminate with null byte * if sz = 0 find end of string * if sz < 0 use last byte for data * * Why were we dividing by 5? I'm truly puzzled, fixed to 10.. */ #include extern int __LIB__ itou(unsigned int nbr, char str[], int sz); itou(nbr, str, sz) unsigned int nbr ; unsigned char str[] ; int sz ; { if ( sz > 0 ) str[--sz] = NULL ; else if ( sz < 0 ) sz = -sz ; else while ( str[sz] != NULL ) ++sz ; while ( sz ) { str[--sz] = nbr % 10 + '0' ; if ( (nbr/=10) == 0 ) break ; } #ifdef WTF while ( sz ) { lowbit = nbr & 1 ; nbr = (nbr >> 1) & 0x7fff ; /* divide by 2 */ str[--sz] = ( (nbr%5) << 1 ) + lowbit + '0' ; if ( (nbr/=5) == 0 ) break ; } #endif while ( sz ) str[--sz] = ' ' ; return str ; } z88dk-1.8.ds1/libsrc/printflike/itox.asm0000644000175000017500000000713607130401723017622 0ustar tygrystygrys; ; itox -- converts nbr to hex string of length sz ; right adjusted and blank filled, returns str ; ; if sz > 0 terminate with null byte ; if sz = 0 find end of string ; if sz < 0 use last byte for data ; ; ; Used by printf, compiled C and hand optimized ; ; 13/10/98 djm ;itox(int nbr. char str[], int sz] XLIB itox LIB l_gint LIB l_pint LIB l_neg LIB l_and LIB l_asr .itox ; if (sz > 0) ld hl,2 add hl,sp push hl call l_gint pop de xor a or h jp m,i_2 or l jr z,i_2 ; str[--sz] = NULL dec hl ;--sz call l_pint ;store sz ex de,hl ;keep it ld hl,4 add hl,sp ;str call l_gint add hl,de ld (hl),0 jr i_3 ; else if (sz <0) ;get here with hl=sz ;and de=&sz .i_2 xor a or h jp p,i_4 ;sz=-sz call l_neg call l_pint ;store sz (de=&sz - unaffected by l_neg) jr i_5 .i_4 ; else while (str[sz] != NULL) ++sz ;when we get here: hl=sz de=&sz .i_6 push de ;&sz ex de,hl ;keep safe (de=sz) ld hl,4 add hl,sp ;str call l_gint add hl,de .i_djm1 ld a,(hl) inc hl inc de and a jr nz,i_djm1 ;We've incremeted sz one too far so undo dec de ex de,hl pop de ;sz call l_pint .i_7 .i_5 .i_3 .i_8 ; while (sz) ; digit= nbr & 15; ld hl,2 add hl,sp ;sz call l_gint ld a,h or l jp z,i_9 ld hl,6 add hl,sp ;nbr ld a,(hl) and 15 ex af,af' ;keep digit ; nbr = ( nbr >> 4) & fff ld hl,6 add hl,sp ;nbr push hl call l_gint ex de,hl ld hl,4 call l_asr ex de,hl ld hl,4095 call l_and pop de ;nbr call l_pint ex af,af' ;retrieve digit ld e,'0' cp 10 jr c,i_djm2 ld e,55 ;'A'-10 .i_djm2 add a,e ;gets the correct hex digit ex af,af' ;save it ;str[--sz] = digit+offset; ld hl,2 add hl,sp ;sz push hl call l_gint dec hl pop de call l_pint ;store sz ex de,hl ;save sz ld hl,4 add hl,sp ;str call l_gint add hl,de ;str[--sz] ex af,af' ;a=digit+offset ld (hl),a ; if (nbr == 0) break; ld hl,6 add hl,sp ;nbr call l_gint ld a,h or l jr nz,i_8 .i_9 .i_13 ld hl,2 add hl,sp ;sz push hl call l_gint pop de ld a,h or l jp z,i_14 dec hl ;--sz call l_pint ;store sz ex de,hl ;keep sz in de ld hl,4 add hl,sp ;str call l_gint add hl,de ld (hl),' ' jr i_13 .i_14 ld hl,4 add hl,sp ;str call l_gint ret z88dk-1.8.ds1/libsrc/printflike/itox.c0000644000175000017500000000210207130401723017250 0ustar tygrystygrys /* * itox -- converts nbr to hex string of length sz * right adjusted and blank filled, returns str * * if sz > 0 terminate with null byte * if sz = 0 find end of string * if sz < 0 use last byte for data */ #include #pragma proto HDRPRTYPE extern int itox(int nbr, char str[], int sz); #pragma unproto HDRPRTYPE itox(nbr, str, sz) int nbr ; char str[] ; int sz ; { int digit, offset ; if ( sz > 0 ) str[--sz] = NULL ; else if ( sz < 0 ) sz = -sz ; else while ( str[sz] != NULL ) ++sz ; while ( sz ) { digit = nbr & 15 ; nbr = ( nbr >> 4 ) & 0xfff ; if ( digit < 10 ) offset = 48 ; else offset = 55 ; str[--sz] = digit + offset ; if ( nbr == 0 ) break ; } while ( sz ) str[--sz] = ' ' ; return str ; }z88dk-1.8.ds1/libsrc/printflike/ltoa_any.c0000644000175000017500000000154310367506017020113 0ustar tygrystygrys/* * Convert number to any base through to a string, space pads * string for the printf routines * * $Id: ltoa_any.c,v 1.2 2006/01/30 21:58:39 dom Exp $ */ #include static unsigned char basechar[] = "0123456789ABCDEF"; int ltoa_any(long in,unsigned char *str, int sz, unsigned int radix, int signflag) { unsigned long nbr; unsigned char sgn; if ( signflag && in < 0 ) { nbr = -in; sgn = '-'; } else { nbr = in; sgn = ' '; } if ( sz > 0 ) str[--sz] = 0; else if ( sz < 0 ) sz = -sz; else while ( str[sz] ) ++sz; while ( sz ) { str[--sz] = basechar[nbr % radix]; if ( ( nbr /= radix ) == 0 ) break; } if ( sz ) str[--sz] = sgn; while ( sz ) str[--sz] = ' '; return sz; } z88dk-1.8.ds1/libsrc/printflike/Makefile0000644000175000017500000000067510763607706017615 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../Make.config CFILES = \ fprintf.c \ fscanf.c \ itou.c \ ltoa_any.c \ printf.c \ scanf.c \ sprintf.c \ sscanf.c \ utoi.c \ vfprintf_comp.c \ vfprintf_fp.c \ vfscanf.c \ vsprintf.c \ vsscanf.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: $(OBJECTS) .c.o: zcc +test $(CFLAGS) $*.c clean: $(RM) *.err *.o* *.sym *.map zcc_opt.def *.i $(AFILES) z88dk-1.8.ds1/libsrc/printflike/printf.c0000644000175000017500000000073407130401723017600 0ustar tygrystygrys/* * Printf style formatting. (Borrowed from MicroEmacs by Dave Conroy.) * A lot smaller than the full fledged printf. * * Liberated once more and inserted into Small C+ 29/4/99 djm */ #define ANSI_STDIO #include /* * Cheating somewhat, this will cause a barf in the compiler...bigtime.. * nevermind... */ int printf(char *fmt,...) { int *ct; ct= (getarg()*2)+&fmt-4; return (vfprintf(stdout,(unsigned char *)(*ct),ct-1)); } z88dk-1.8.ds1/libsrc/printflike/README0000644000175000017500000000046007130401723017006 0ustar tygrystygrysThis is the "full" printf routines - they support width specifiers, but not the %ld/%lu types (well ya can't have it all!) - they've been rejigged into using the new stdio library, I've tested sprintf and printf and they seem to work. The scanf routines have also been rejigged, but they're not tested. z88dk-1.8.ds1/libsrc/printflike/scanf.c0000644000175000017500000000073107130401723017365 0ustar tygrystygrys/* * Printf style formatting. (Borrowed from MicroEmacs by Dave Conroy.) * A lot smaller than the full fledged printf. * * Liberated once more and inserted into Small C+ 29/4/99 djm */ #define ANSI_STDIO #include /* * Cheating somewhat, this will cause a barf in the compiler...bigtime.. * nevermind... */ int scanf(char *fmt,...) { int *ct; ct= (getarg()*2)+&fmt-4; return (vfscanf(stdin,(unsigned char *)(*ct),ct-1)); } z88dk-1.8.ds1/libsrc/printflike/sprintf.c0000644000175000017500000000135607130401723017764 0ustar tygrystygrys/* * Minix source: src/commands/simple/uud.c * * Printf style formatting. (Borrowed from MicroEmacs by Dave Conroy.) * A lot smaller than the full fledged printf. * * Liberated once more and inserted into Small C+ 29/4/99 djm * * This routine is quite long also, hopefully it'll become a lot * shorter with the new io routines * * New I/O version, we fake up a file channel which is in fact * a string djm 1/4/2000 */ #define ANSI_STDIO #include int sprintf(char *str,char *fmt,...) { FILE temp; int num; int *ct; ct= (getarg()*2)+&fmt-4; temp.desc.ptr=(void *)(*ct); temp.flags=_IOWRITE|_IOSTRING; num=vfprintf(temp,(unsigned char *)(*(ct-1)),ct-2); *(temp.desc.ptr)=0; return(num); } z88dk-1.8.ds1/libsrc/printflike/sscanf.c0000644000175000017500000000134610214013063017544 0ustar tygrystygrys/* * Minix source: src/commands/simple/uud.c * * Printf style formatting. (Borrowed from MicroEmacs by Dave Conroy.) * A lot smaller than the full fledged printf. * * Liberated once more and inserted into Small C+ 29/4/99 djm * * This routine is quite long also, hopefully it'll become a lot * shorter with the new io routines * * New I/O version, we fake up a file channel which is in fact * a string djm 1/4/2000 */ #define ANSI_STDIO #include int sscanf(char *str,char *fmt,...) { FILE temp; int num; int *ct; ct= (getarg()*2)+&fmt-4; temp.desc.ptr=(void *)(*ct); temp.flags=_IOREAD|_IOSTRING|_IOUSE; temp.ungetc = 0; return (vfscanf(temp,(unsigned char *)(*(ct-1)),ct-2)); } z88dk-1.8.ds1/libsrc/printflike/unused/0000755000175000017500000000000010765202715017441 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/printflike/unused/printf1.asm0000644000175000017500000002674407130401723021533 0ustar tygrystygrys; The integer printf routine ; Is compiled C, but been optimized by hand ; An awful lot of work went into this - some 400 hundred ; or so bytes have been winkled out! ; ; 13/10/98 XLIB printf1 LIB utoi LIB itod LIB itou LIB itox LIB pf_outc XREF _pf_string XREF _pf_count LIB l_gint LIB l_pint LIB l_gt .printf1 ld hl,-26 add hl,sp ld sp,hl ld hl,0 ld (_pf_count),hl ;ctl=*nxtarg ld hl,28 add hl,sp call l_gint call l_gint pop de pop bc push hl push de .i_2 ; while (c=*ctl++) ld hl,17 add hl,sp push hl ;c ld hl,4 ;ctl add hl,sp push hl call l_gint ld a,(hl) ;character, keep it safe in a' ex af,af' inc hl pop de call l_pint ex af,af' pop de ld (de),a and a jp z,i_3 ;if zero, end of string out of here ;ATP a is our character..keep it safe in c ;also hl=ctl ;If character isnt % then print it cp '%' jr z,i_4 .i_djm1 ld l,a ld h,0 push hl ld hl,32 add hl,sp ;fd - stream call l_gint push hl call pf_outc pop bc pop bc jp i_2 ;Come here if we have a percentage ;If the next character is % then print it out. ;Remember, hl holds ctl so we can just get it out.. .i_4 ld a,(hl) cp '%' jr nz,i_5 ;wasn't percentage ;Now, we have to increment the ctr inc hl ex de,hl ld hl,2 add hl,sp ex de,hl call l_pint ld a,'%' jr i_djm1 ;We still have ctl in hl .i_5 ;cx=ctl pop bc push hl ;Now, check if *cx = '-' ;if *cx='-' ld a,(hl) ex de,hl ;de=cx cp '-' jr nz,i_6 ;right=0 (char) ld hl,16 add hl,sp ;right ld (hl),0 ;++cx inc de ;cx ;store cx.. pop bc push de jr i_7 .i_6 ;else right = 1 ld hl,16 add hl,sp ld (hl),1 ;ATP cx is in de .i_7 ;if *cx = '0' ld a,(de) cp '0' jr nz,i_8 ;pad='0' ld hl,8 add hl,sp ld (hl),'0' ;cx++ inc de pop bc push de jr i_9 ;else pad=' ' .i_8 ld hl,8 add hl,sp ld (hl),' ' ;ATP de=cx still .i_9 ;if ( ( i=utoi(cx, &width)) >= 0 ) ld hl,24 add hl,sp push hl ;i push de ;last we'll see of cx I think! ld hl,10 add hl,sp push hl ;&width call utoi pop bc pop bc pop de ;i call l_pint ;test if i>=0 xor a or h jp m,i_2 ;continue ;hl=i ;cx +=i pop de ;cx (from auto) add hl,de ;cx +=i push hl ;store cx again ;if *cx=='.' ;hl=cx ld a,(hl) cp '.' jr nz,i_12 ; { if ( ( preclen=utoi(++cx, &prec)) >=0 ) ; Deal with ++cx first of all pop de inc de push de ld hl,20 add hl,sp push hl ;preclen push de ;cx ld hl,26 add hl,sp push hl ;&prec call utoi pop bc pop bc pop de call l_pint xor a or h jp m,i_2 ;continue ;cx += preclen ;hl = preclen pop de ;cx is first variable add hl,de push de jr i_15 ; [ *cx != '.'] ; else preclen=0 .i_12 ld hl,20 add hl,sp ld (hl),0 inc hl ld (hl),0 ;sptr=str i.e. sptr=&str (sptr is char *sptr] .i_15 ld hl,4 add hl,sp push hl ld hl,11 add hl,sp pop de call l_pint ;c=cx++ pop de ld a,(de) inc de ;cx++ push de ld hl,17 add hl,sp ld (hl),a ;c=*cxr++ ex af,af' ;keep c safe in a' ;i=*(--nxtarg) ld hl,24 add hl,sp push hl ld hl,30 add hl,sp ;next arg push hl call l_gint dec hl dec hl pop de call l_pint call l_gint pop de ;&i call l_pint ;switch(c) ex af,af' ;retrieve c cp 'd' jr z,i_19 cp 'x' jr z,i_20 cp 'c' jr z,i_21 cp 's' jr z,i_22 cp 'u' jr z,i_23 jp i_2 ;default ; case 'd' .i_19 ld hl,24 add hl,sp call l_gint push hl ld hl,11 add hl,sp push hl ld hl,7 push hl call itod pop bc pop bc pop bc jp i_17 ; case 'x' .i_20 ld hl,24 add hl,sp call l_gint push hl ld hl,11 add hl,sp push hl ld hl,7 push hl call itox pop bc pop bc pop bc jp i_17 ;case 'c' .i_21 ld hl,9 add hl,sp push hl ld hl,26 add hl,sp call l_gint pop de ld a,l ld (de),a inc de xor a ld (de),a jp i_17 ;case 's' .i_22 ld hl,4 add hl,sp push hl ld hl,26 add hl,sp call l_gint pop de call l_pint jp i_17 ;case 'u' .i_23 ld hl,24 add hl,sp call l_gint push hl ld hl,11 add hl,sp push hl ld hl,7 push hl call itou pop bc pop bc pop bc ;ctl=cx .i_17 pop hl ;cx pop de ;ctl push hl ;ctl push hl ;cx ; if c!='s' ld hl,17 add hl,sp ld a,(hl) cp 's' jr z,i_25 ; while ( *sptr == ' ') ++sptr; .i_26 ld hl,4 add hl,sp push hl call l_gint .i_djm2 ld a,(hl) inc hl cp ' ' jr z,i_djm2 ;We incremented one too far, so decrement and store sptr dec hl pop de ;where it should go call l_pint .i_27 ;len=-1 [almagamated with loop] .i_25 ; while ( sptr[++len] ) ; .i_28 ld hl,4 add hl,sp ;sptr call l_gint ld de,-1 ;len ;My quick loop now ;hl=sptr, de=len .i_djm4 inc de ld a,(hl) inc hl ;increment sptr and a jr nz,i_djm4 ld hl,18 add hl,sp ;get location of len ld (hl),e inc hl ld (hl),d ; if ( c == 's'&& len>prec && preclen >0 ) .i_29 ld hl,17 add hl,sp ld a,(hl) cp 's' jp nz,i_30 ;Cheating.. hl=sp+17 need sp+18 inc hl ;len call l_gint push hl ld hl,24 add hl,sp call l_gint ;prec pop de call l_gt ld a,h or l jp z,i_30 ld hl,20 add hl,sp ;preclen call l_gint ex de,hl ld hl,0 call l_gt ld a,h or l jp z,i_30 ;len=prec ld hl,18 add hl,sp push hl ld hl,24 add hl,sp call l_gint pop de call l_pint ; if (right) .i_30 ld hl,16 add hl,sp ld a,(hl) and a jp z,i_33 ; whle ( ((width--)-len) > 0 ) .i_34 ld hl,6 add hl,sp push hl call l_gint dec hl pop de call l_pint inc hl push hl ld hl,20 add hl,sp ;len call l_gint ex de,hl pop hl ;width and a sbc hl,de xor a ;test for zero or h jp m,i_35 or l jp z,i_35 ;pf_outc(pad,fd) ld hl,8 add hl,sp ld l,(hl) ld h,0 push hl ld hl,32 add hl,sp ;fd call l_gint push hl call pf_outc pop bc pop bc jp i_34 .i_35 .i_33 ; while (len) .i_36 ;do the len-- here.. ld hl,18 add hl,sp push hl ;keep address call l_gint pop de ;restore it ld a,h or l jp z,i_37 dec hl call l_pint ld hl,4 add hl,sp ;sptr push hl call l_gint inc hl ;sptr++ pop de call l_pint dec hl ld l,(hl) ld h,0 push hl ld hl,32 add hl,sp ;fd call l_gint push hl call pf_outc pop bc pop bc ;--width ld hl,6 add hl,sp push hl call l_gint dec hl pop de call l_pint jp i_36 .i_37 .i_38 ld hl,6 add hl,sp ;width ld e,(hl) inc hl ld d,(hl) dec de ;width-- ld (hl),d dec hl ld (hl),e inc de ;width restored ld hl,20 add hl,sp ;len call l_gint ;hl=len ex de,hl and a sbc hl,de xor a or h jp m,i_2 or l jp z,i_2 ld hl,8 add hl,sp ;pad ld l,(hl) ld h,0 push hl ld hl,32 add hl,sp ;fd call l_gint push hl call pf_outc pop bc pop bc jp i_38 ;if (pf_string != 0_ *pfstring= '\000'; .i_3 ld hl,(_pf_string) ld a,h or l jr z,i_40 ld hl,(_pf_string) ld (hl),0 ; return (pf_count); .i_40 ld hl,26 add hl,sp ld sp,hl ;restore count ld hl,(_pf_count) ;number of chars printed ret z88dk-1.8.ds1/libsrc/printflike/unused/printf2.c0000644000175000017500000000416307130401723021165 0ustar tygrystygrys/* * printf2.c - generic _printf for floating point output * also, floating point conversion functions * * Compile with -m option * * R M Yorston 1987 * */ #include #include #define NULL 0 #define ERR -1 extern __LIB__ utoi(); extern __LIB__ itod(); extern __LIB__ itox(); extern __LIB__ itou(); printf2(fd, ctl, nxtarg) FILE *fd; unsigned char *ctl; void *nxtarg; { double *pd ; int i, width, prec, preclen, len, pf_count=0 ; unsigned char c, right, str[128], pad; unsigned char *sptr, *cx ; while ( c = *ctl++ ) { if (c != '%' ) { fputc(c, fd) ; ++pf_count; continue ; } if ( *ctl == '%' ) { fputc(*ctl++, fd) ; ++pf_count; continue ; } cx = ctl ; if ( *cx == '-' ) { right = 0 ; ++cx ; } else right = 1 ; if ( *cx == '0' ) { pad = '0' ; ++cx ; } else pad = ' ' ; if ( (i=utoi(cx, &width)) >= 0 ) cx += i ; else continue ; if (*cx == '.') { if ( (preclen=utoi(++cx, &prec)) >= 0 ) cx += preclen ; else continue ; } else preclen = 0 ; sptr = str ; c = *cx++ ; i = *(--nxtarg) ; switch(c) { case 'd' : itod(i, str, 7) ; break ; case 'x' : itox(i, str, 7) ; break ; case 'c' : str[0] = i ; str[1] = NULL ; break ; case 's' : sptr = i ; break ; case 'u' : itou(i, str, 7) ; break ; default: if ( preclen == 0 ) prec = 6 ; if ( c == 'f' ) { nxtarg -= 2 ; pd = nxtarg ; ftoa( *pd, prec, str ) ; } else if ( c == 'e' ) { nxtarg -= 2 ; pd = nxtarg ; ftoe( *pd, prec, str ) ; } else continue ; } ctl = cx ; /* accept conversion spec */ if ( c != 's' ) while ( *sptr == ' ' ) ++sptr ; len = -1 ; while ( sptr[++len] ) ; /* get length */ if ( c == 's' && len>prec && preclen>0 ) len = prec ; if (right) while ( ((width--)-len) > 0 ) { fputc(pad, fd) ; ++pf_count; } while ( len ) { fputc(*sptr++, fd) ; ++pf_count; --len ; --width ; } while ( ((width--)-len) > 0 ) { fputc(pad, fd) ; ++pf_count; } } return(pf_count) ; } z88dk-1.8.ds1/libsrc/printflike/unused/printf2.opt0000644000175000017500000002046007130401723021543 0ustar tygrystygrys;* * * * * Small-C/Plus Z88 * * * * * ; Version: v1.10b0.70pre2 Date: 1/4/2000 ; ; Reconstructed for the z80 Module Assembler ; By Dominic Morris ; ; Module compile time: Thu Apr 6 01:57:17 2000 MODULE printf2.c INCLUDE "#z88_crt0.hdr" ._printf2 ld hl,-12 ;const add hl,sp ld sp,hl ld hl,0 ;const push hl ld hl,-135 ;const add hl,sp ld sp,hl .i_3 ld hl,134 ;const add hl,sp push hl ld hl,155 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint dec hl ld a,(hl) pop de ld (de),a and a jp z,i_4 ld hl,134 ;const add hl,sp ld a,(hl) cp #(37 % 256) jp z,i_5 ld hl,134 ;const add hl,sp ld l,(hl) ld h,0 push hl ld hl,157 ;const add hl,sp call l_gint ; push hl call fputc pop bc pop bc ld hl,135 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint jp i_3 .i_5 ld hl,153 ;const add hl,sp call l_gint ; ld a,(hl) cp #(37 % 256) jp nz,i_6 ld hl,153 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint dec hl ld l,(hl) ld h,0 push hl ld hl,157 ;const add hl,sp call l_gint ; push hl call fputc pop bc pop bc ld hl,135 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint jp i_3 .i_6 ld hl,153 ;const add hl,sp call l_gint ; pop bc push hl ld a,(hl) cp #(45 % 256) jp nz,i_7 ld hl,133 ;const add hl,sp ld (hl),#(0 % 256) pop hl inc hl push hl jp i_8 .i_7 ld hl,133 ;const add hl,sp ld (hl),#(1 % 256) .i_8 pop hl push hl ld a,(hl) cp #(48 % 256) jp nz,i_9 ld hl,4 ;const add hl,sp ld (hl),#(48 % 256) pop hl inc hl push hl jp i_10 .i_9 ld hl,4 ;const add hl,sp ld (hl),#(32 % 256) .i_10 ld hl,145 ;const add hl,sp push hl pop bc pop hl push hl push bc push hl ld hl,147 ;const add hl,sp push hl call utoi pop bc pop bc pop de call l_pint xor a or h jp m,i_11 pop de push de ld hl,147-2 ;const add hl,sp call l_gint ; add hl,de pop bc push hl jp i_12 .i_11 jp i_3 .i_12 pop hl push hl ld a,(hl) cp #(46 % 256) jp nz,i_13 ld hl,139 ;const add hl,sp push hl pop de pop hl inc hl push hl push de push hl ld hl,145 ;const add hl,sp push hl call utoi pop bc pop bc pop de call l_pint xor a or h jp m,i_14 pop de push de ld hl,141-2 ;const add hl,sp call l_gint ; add hl,de pop bc push hl jp i_15 .i_14 jp i_3 .i_15 jp i_16 .i_13 ld hl,139 ;const add hl,sp ld de,0 ;const ex de,hl call l_pint .i_16 ld hl,5 ;const add hl,sp pop de pop bc push hl push de ld hl,134 ;const add hl,sp push hl pop de pop hl inc hl push hl push de dec hl ld a,(hl) pop de ld (de),a ld hl,145 ;const add hl,sp push hl ld hl,153 ;const add hl,sp push hl call l_gint ; dec hl pop de call l_pint call l_gint ; pop de call l_pint ld hl,134 ;const add hl,sp ld l,(hl) ld h,0 jp i_19 .i_20 ld hl,145 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,7 ;const add hl,sp push hl ld hl,7 ;const push hl call itod pop bc pop bc pop bc jp i_18 .i_21 ld hl,145 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,7 ;const add hl,sp push hl ld hl,7 ;const push hl call itox pop bc pop bc pop bc jp i_18 .i_22 ld hl,5 ;const add hl,sp ex de,hl ld hl,147-2 ;const add hl,sp call l_gint ; ld a,l ld (de),a ld hl,6 ;const add hl,sp ld (hl),#(0 % 256) ld l,(hl) ld h,0 jp i_18 .i_23 ld hl,145 ;const add hl,sp call l_gint ; pop de pop bc push hl push de jp i_18 .i_24 ld hl,145 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,7 ;const add hl,sp push hl ld hl,7 ;const push hl call itou pop bc pop bc pop bc jp i_18 .i_25 ld hl,139 ;const add hl,sp call l_gint ; ld a,h or l jp nz,i_26 ld hl,141 ;const add hl,sp ld de,6 ;const ex de,hl call l_pint .i_26 ld hl,134 ;const add hl,sp ld a,(hl) cp #(102 % 256) jp nz,i_27 ld hl,151 ;const add hl,sp push hl call l_gint ; dec hl dec hl pop de call l_pint ld hl,147 ;const add hl,sp ex de,hl ld hl,153-2 ;const add hl,sp call l_gint ; call l_pint ld hl,147 ;const add hl,sp call l_gint ; call dldpsh ld hl,147 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,13 ;const add hl,sp push hl call ftoa exx ld hl,10 ;const add hl,sp ld sp,hl exx jp i_28 .i_27 ld hl,134 ;const add hl,sp ld a,(hl) cp #(101 % 256) jp nz,i_29 ld hl,151 ;const add hl,sp push hl call l_gint ; dec hl dec hl pop de call l_pint ld hl,147 ;const add hl,sp ex de,hl ld hl,153-2 ;const add hl,sp call l_gint ; call l_pint ld hl,147 ;const add hl,sp call l_gint ; call dldpsh ld hl,147 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,13 ;const add hl,sp push hl call ftoe exx ld hl,10 ;const add hl,sp ld sp,hl exx jp i_30 .i_29 jp i_3 .i_30 .i_28 jp i_18 .i_19 ld a,l cp #(100% 256) jp z,i_20 cp #(120% 256) jp z,i_21 cp #(99% 256) jp z,i_22 cp #(115% 256) jp z,i_23 cp #(117% 256) jp z,i_24 jp i_25 .i_18 ld hl,153 ;const add hl,sp ex de,hl pop hl push hl call l_pint ld hl,134 ;const add hl,sp ld e,(hl) ld d,0 ld hl,115 ;const call l_ne jp nc,i_31 .i_32 pop bc pop hl push hl push bc ld a,(hl) cp #(32 % 256) jp nz,i_33 pop de pop hl inc hl push hl push de jp i_32 .i_33 .i_31 ld hl,137 ;const add hl,sp ld de,-1 ;const ex de,hl call l_pint .i_34 pop bc pop hl push hl push bc push hl ld hl,139 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint pop de add hl,de ld l,(hl) ld h,0 ld a,h or l jp nz,i_34 .i_35 ld hl,134 ;const add hl,sp ld a,(hl) cp #(115 % 256) jp nz,i_37 ld hl,137 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,143 ;const add hl,sp call l_gint ; pop de call l_gt jp nc,i_37 ld hl,139 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,0 ;const call l_gt jr c,i_38_i_37 .i_37 jp i_36 .i_38_i_37 ld hl,137 ;const add hl,sp ex de,hl ld hl,143-2 ;const add hl,sp call l_gint ; call l_pint .i_36 ld hl,133 ;const add hl,sp ld l,(hl) ld h,0 ld a,h or l jp z,i_39 .i_40 ld hl,143 ;const add hl,sp push hl call l_gint ; dec hl pop de call l_pint inc hl ex de,hl ld hl,139-2 ;const add hl,sp call l_gint ; call l_sub xor a or h jp m,i_41 or l jp z,i_41 ld hl,4 ;const add hl,sp ld l,(hl) ld h,0 push hl ld hl,157 ;const add hl,sp call l_gint ; push hl call fputc pop bc pop bc ld hl,135 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint jp i_40 .i_41 .i_39 .i_42 ld hl,137 ;const add hl,sp call l_gint ; ld a,h or l jp z,i_43 pop de pop hl inc hl push hl push de dec hl ld l,(hl) ld h,0 push hl ld hl,157 ;const add hl,sp call l_gint ; push hl call fputc pop bc pop bc ld hl,135 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint ld hl,137 ;const add hl,sp push hl call l_gint ; dec hl pop de call l_pint ld hl,143 ;const add hl,sp push hl call l_gint ; dec hl pop de call l_pint jp i_42 .i_43 .i_44 ld hl,143 ;const add hl,sp push hl call l_gint ; dec hl pop de call l_pint inc hl ex de,hl ld hl,139-2 ;const add hl,sp call l_gint ; call l_sub xor a or h jp m,i_45 or l jp z,i_45 ld hl,4 ;const add hl,sp ld l,(hl) ld h,0 push hl ld hl,157 ;const add hl,sp call l_gint ; push hl call fputc pop bc pop bc ld hl,135 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint jp i_44 .i_45 jp i_3 .i_4 ld hl,135 ;const add hl,sp call l_gint ; exx ld hl,149 ;const add hl,sp ld sp,hl exx ret ; --- Start of Static Variables --- ; --- Start of Scope Defns --- LIB feof LIB fprand LIB fpseed LIB getk LIB fmod LIB sprintf LIB ftoa LIB ftoe LIB read LIB itod LIB itou LIB itox LIB open LIB fgetc LIB freopen LIB fgets LIB open_z88 LIB fopen_z88 LIB creat LIB close LIB minisprintf LIB puts LIB utoi LIB fseek LIB rename LIB floor LIB fopen LIB fchkstd LIB ftell LIB readbyte LIB fprintf LIB minivfprintf XREF __sgoioblk LIB fgetc_cons LIB fgets_cons LIB fputc LIB remove XDEF _printf2 LIB fputs LIB lseek LIB vsprintf LIB writebyte LIB fclose LIB fgetpos LIB printf LIB minifprintf LIB minisfprintf LIB printn LIB fdtell LIB closeall LIB freopen_z88 LIB ungetc LIB getarg LIB miniprintf LIB fabandon LIB fdgetpos LIB ceil LIB fabs LIB vfprintf LIB write LIB fputc_cons LIB puts_cons LIB amax LIB amin ; --- End of Scope Defns --- ; --- End of Compilation --- z88dk-1.8.ds1/libsrc/printflike/unused/scanf1.asm0000644000175000017500000003537407130401724021323 0ustar tygrystygrys;* * * * * Small-C/Plus Z88 * * * * * ; Version: v1.10b0.49 Date: 14/3/99 ; ; Reconstructed for the z80 Module Assembler ; By Dominic Morris ; Small C+ Library Function XLIB scanf1 INCLUDE "#z88_crt0.hdr" LIB sf_getc; LIB sf_ungetc LIB utoi LIB isspace XREF _sf_oldch .scanf1 ld hl,-20 add hl,sp ld sp,hl ; _sf_oldch = char -1 ld a,-1 ld (_sf_oldch),a ld hl,8 add hl,sp ; Optimized set int to 0 ld (hl),( 0 % 256) inc hl ld (hl),( 0 / 256) ld hl,16 add hl,sp push hl ld hl,24 add hl,sp push hl call l_gint dec hl dec hl pop de call l_pint inc hl inc hl call l_gint pop de call l_pint .i_3 ld hl,16 add hl,sp call l_gint ; Optimized if (char) { ld a,(hl) and a jp z,i_4 ld hl,16 add hl,sp call l_gint ld l,(hl) ld h,0 push hl call isspace pop bc ld a,h or l jp z,i_5 ld hl,16 add hl,sp push hl call l_gint inc hl pop de call l_pint jp i_3 .i_5 ld hl,16 add hl,sp push hl call l_gint inc hl pop de call l_pint dec hl ld l,(hl) ld h,0 ;push hl, ld hl,37 pop de optimized ld de,37 ex de,hl call l_ne ld a,h or l jp z,i_6 jp i_3 .i_6 ld hl,16 add hl,sp call l_gint ; Optimized char x == 42 jp z,i_7 ld a,(hl) cp 42 ; ld hl,0 jp nz,i_7 ld hl,12 add hl,sp push hl ld hl,20 add hl,sp push hl ld hl,14 add hl,sp pop de call l_pint pop de call l_pint ld hl,16 add hl,sp push hl call l_gint inc hl pop de call l_pint jp i_8 .i_7 ld hl,12 add hl,sp push hl ld hl,20 add hl,sp push hl ld hl,26 add hl,sp push hl call l_gint dec hl dec hl pop de call l_pint inc hl inc hl call l_gint pop de call l_pint pop de call l_pint .i_8 ld hl,16 add hl,sp push hl call l_gint push hl ld hl,20 add hl,sp call l_gint push hl ld hl,12 add hl,sp push hl call utoi pop bc pop bc pop de add hl,de pop de call l_pint ld hl,6 add hl,sp call l_gint call l_lneg ld a,h or l jp z,i_9 ld hl,6 add hl,sp ;push hl, ld hl,32767 pop de optimized ld de,32767 ex de,hl call l_pint .i_9 ld hl,0 add hl,sp push hl ld hl,18 add hl,sp push hl call l_gint inc hl pop de call l_pint dec hl ld l,(hl) ld h,0 pop de ld a,l ld (de),a call l_lneg ld a,h or l jp z,i_10 jp i_4 .i_10 .i_11 ld hl,2 add hl,sp push hl ld hl,26 add hl,sp call l_gint push hl call sf_getc pop bc pop de ld a,l ld (de),a push hl call isspace pop bc ld a,h or l jp z,i_12 jp i_11 .i_12 ld hl,2 add hl,sp ; Optimized char x == -1 jp z,i_13 ld a,(hl) cp -1 ; ld hl,0 jp nz,i_13 ld hl,8 add hl,sp call l_gint ld a,h or l jp z,i_14 jp i_4 jp i_15 .i_14 ld hl,-1 exx ld hl,20 add hl,sp ld sp,hl exx ret .i_15 .i_13 ld hl,2 add hl,sp ld l,(hl) ld h,0 push hl call sf_ungetc pop bc ld hl,0 add hl,sp ld l,(hl) ld h,0 jp i_18 .i_19 ld hl,18 add hl,sp call l_gint push hl ld hl,26 add hl,sp call l_gint push hl call sf_getc pop bc pop de ld a,l ld (de),a jp i_17 .i_20 .i_21 ld hl,6 add hl,sp push hl call l_gint dec hl pop de call l_pint inc hl ld a,h or l jp z,i_22 ld hl,18 add hl,sp call l_gint push hl ld hl,26 add hl,sp call l_gint push hl call sf_getc pop bc pop de ld a,l ld (de),a ;push hl, ld hl,-1 pop de optimized ld de,-1 ex de,hl call l_eq ld a,h or l jp z,i_23 jp i_22 .i_23 ld hl,18 add hl,sp call l_gint ld l,(hl) ld h,0 push hl call isspace pop bc ld a,h or l jp z,i_24 jp i_22 .i_24 ld hl,18 add hl,sp call l_gint push hl ld hl,12 add hl,sp pop de call l_ne ld a,h or l jp z,i_25 ld hl,18 add hl,sp push hl call l_gint inc hl pop de call l_pint .i_25 jp i_21 .i_22 ld hl,18 add hl,sp call l_gint ;push hl, ld hl,0 pop de optimized ld de,0 ex de,hl ld a,l ld (de),a jp i_17 .i_26 ld hl,0 add hl,sp ld l,(hl) ld h,0 jp i_29 .i_30 ld hl,1 add hl,sp ;push hl, ld hl,10 pop de optimized ;Set char to number, but not when result is used ld (hl),(10 % 256) ld hl,3 add hl,sp ;push hl, ld hl,0 pop de optimized ;Set char to number, but not when result is used ld (hl),(0 % 256) ld hl,4 add hl,sp ;push hl, ld hl,3276 pop de optimized ld de,3276 ex de,hl call l_pint jp i_28 .i_31 ld hl,1 add hl,sp ;push hl, ld hl,8 pop de optimized ;Set char to number, but not when result is used ld (hl),(8 % 256) ld hl,3 add hl,sp ;push hl, ld hl,1 pop de optimized ;Set char to number, but not when result is used ld (hl),(1 % 256) ld hl,4 add hl,sp ;push hl, ld hl,8191 pop de optimized ld de,8191 ex de,hl call l_pint jp i_28 .i_32 ld hl,1 add hl,sp ;push hl, ld hl,10 pop de optimized ;Set char to number, but not when result is used ld (hl),(10 % 256) ld hl,3 add hl,sp ;push hl, ld hl,1 pop de optimized ;Set char to number, but not when result is used ld (hl),(1 % 256) ld hl,4 add hl,sp ;push hl, ld hl,6553 pop de optimized ld de,6553 ex de,hl call l_pint jp i_28 .i_33 ld hl,1 add hl,sp ;push hl, ld hl,16 pop de optimized ;Set char to number, but not when result is used ld (hl),(16 % 256) ld hl,3 add hl,sp ;push hl, ld hl,1 pop de optimized ;Set char to number, but not when result is used ld (hl),(1 % 256) ld hl,4 add hl,sp ;push hl, ld hl,4095 pop de optimized ld de,4095 ex de,hl call l_pint jp i_28 .i_34 ld hl,8 add hl,sp call l_gint exx ld hl,20 add hl,sp ld sp,hl exx ret jp i_28 .i_29 call l_case defw i_30,100 defw i_31,111 defw i_32,117 defw i_33,120 defw 0 jp i_34 .i_28 ld hl,12 add hl,sp call l_gint push hl ld hl,16 add hl,sp ;push hl, ld hl,0 pop de optimized ld de,0 ex de,hl call l_pint pop de call l_pint .i_35 ld hl,6 add hl,sp push hl call l_gint dec hl pop de call l_pint inc hl ld a,h or l jp z,i_37 ld hl,2 add hl,sp push hl ld hl,26 add hl,sp call l_gint push hl call sf_getc pop bc pop de ld a,l ld (de),a push hl call isspace pop bc call l_lneg ld a,h or l jp z,i_37 ld hl,2 add hl,sp ; Optimized char x != -1 jp z,i_37 ld a,(hl) cp -1 ; ld hl,0 jp z,i_37 ld hl,1 jp i_38 .i_37 ld hl,0 .i_38 ld a,h or l jp z,i_36 ld hl,3 add hl,sp ld l,(hl) ld h,0 call l_lneg ld a,h or l jp z,i_39 ld hl,2 add hl,sp ; Optimized char x == 45 jp z,i_40 ld a,(hl) cp 45 ; ld hl,0 jp nz,i_40 ld hl,3 add hl,sp ;push hl, ld hl,-1 pop de optimized ld de,-1 ex de,hl ld a,l ld (de),a jp i_35 jp i_41 .i_40 ld hl,3 add hl,sp ;push hl, ld hl,1 pop de optimized ld de,1 ex de,hl ld a,l ld (de),a .i_41 .i_39 ld hl,2 add hl,sp ; Optimized if ( uchar < 48 ) (only if char isn't used) (ugly) ld a,(hl) cp 48 jp z,i_42 jp nc,i_42 ld hl,8 add hl,sp call l_gint exx ld hl,20 add hl,sp ld sp,hl exx ret .i_42 ld hl,2 add hl,sp ; optimized ( uchar >= 97 ) (only if char not used) ld a,(hl) cp 97 jr z,ASMPC+5 jp c,i_43 ld hl,2 add hl,sp ; Optimized add -87 to unsigned char ld a,(hl) add a,-87 ld (hl),a jp i_44 .i_43 ld hl,2 add hl,sp ; optimized ( uchar >= 65 ) (only if char not used) ld a,(hl) cp 65 jr z,ASMPC+5 jp c,i_45 ld hl,2 add hl,sp ; Optimized add -55 to unsigned char ld a,(hl) add a,-55 ld (hl),a jp i_46 .i_45 ld hl,2 add hl,sp ; Optimized add -48 to unsigned char ld a,(hl) add a,-48 ld (hl),a .i_46 .i_44 ld hl,2 add hl,sp ld l,(hl) ld h,0 push hl ld hl,3 add hl,sp ld l,(hl) ld h,0 pop de call l_uge ld a,h or l jp nz,i_48 ld hl,14 add hl,sp call l_gint push hl ld hl,6 add hl,sp call l_gint pop de call l_ugt ld a,h or l jp nz,i_48 ld hl,0 jp i_49 .i_48 ld hl,1 .i_49 ld a,h or l jp z,i_47 ld hl,8 add hl,sp call l_gint exx ld hl,20 add hl,sp ld sp,hl exx ret .i_47 ld hl,14 add hl,sp push hl ld hl,16 add hl,sp call l_gint push hl ld hl,5 add hl,sp ld l,(hl) ld h,0 pop de call l_mult push hl ld hl,6 add hl,sp ld l,(hl) ld h,0 pop de add hl,de pop de call l_pint jp i_35 .i_36 ld hl,12 add hl,sp call l_gint push hl ld hl,5 add hl,sp ld l,(hl) ld h,0 push hl ld hl,18 add hl,sp call l_gint pop de call l_mult pop de call l_pint jp i_17 .i_18 call l_case defw i_19,99 defw i_20,115 defw 0 jp i_26 .i_17 ld hl,8 add hl,sp push hl call l_gint inc hl pop de call l_pint jp i_3 .i_4 ld hl,8 add hl,sp call l_gint exx ld hl,20 add hl,sp ld sp,hl exx ret ; --- Start of Static Variables --- ; --- End of Compilation --- z88dk-1.8.ds1/libsrc/printflike/unused/scanf2.c0000644000175000017500000000627707130401724020766 0ustar tygrystygrys/* * Core routine for scanf-type functions, including floating point * only e, f, d, o, x, c, s, and u specs are supported. * Also includes atof() */ #include #include #include #define ERR (-1) extern __LIB__ utoi() ; int scanf2(fd, ctl, nxtarg) FILE *fd; unsigned char *ctl; void *nxtarg ; { unsigned char *carg, *zunsigned, fstr[40] ; int *narg, wast, ac, width, base, ovfl ; unsigned char cnv,sign,ch; double *farg ; ac = 0 ; while ( *ctl) { if ( isspace(*ctl) ) { ++ctl; continue; } if ( *ctl++ != '%' ) continue ; if ( *ctl == '*' ) { farg = narg = carg = &wast; ++ctl; } else farg = narg = carg = *nxtarg-- ; ctl += utoi(ctl, &width) ; if ( !width ) width = 32767 ; if ( !(cnv=*ctl++) ) break ; while ( isspace(ch=fgetc(fd)) ) ; if ( ch == EOF ) { if (ac) break ; else return EOF ; } ungetc(ch,fd) ; switch(cnv) { case 'c' : *carg = fgetc(fd) ; break ; case 's' : while ( width-- ) { if ( (*carg=fgetc(fd)) == EOF ) break ; if ( isspace(*carg) ) break ; if ( carg != &wast ) ++carg ; } *carg = 0 ; break ; case 'e' : case 'f' : if ( width > 39 ) width = 39 ; _getf(fstr, fd, width) ; *farg = atof(fstr) ; break ; default : switch(cnv) { case 'd' : base = 10 ; sign = 0 ; ovfl = 3276 ; break ; case 'o' : base = 8 ; sign = 1 ; ovfl = 8191 ; break ; case 'u' : base = 10 ; sign = 1 ; ovfl = 6553 ; break ; case 'x' : base = 16 ; sign = 1 ; ovfl = 4095 ; break ; default : return ac ; } *narg = zunsigned = 0 ; while ( width-- && !isspace(ch=fgetc(fd)) && ch!=EOF ) { if ( !sign ) if ( ch == '-' ) { sign = -1; continue; } else sign = 1 ; if ( ch < '0' ) return ac ; if ( ch >= 'a') ch -= 87 ; else if ( ch >= 'A' ) ch -= 55 ; else ch -= '0' ; if ( ch >= base || zunsigned > ovfl ) return ac ; zunsigned = zunsigned * base + ch ; } *narg = sign * zunsigned ; } ++ac ; } return ac ; } /* * _getf - fetch string representation of floating point number * from file (or string). Maximum number of characters * examined is width. */ _getf(s, fd, width) unsigned char *s ; /* result string */ FILE *fd ; /* file descriptor */ int width ; /* number of characters to be examined */ { int i ; i = 1 ; *s = fgetc(fd) ; if ( isdigit(*s) || *s == '-' || *s == '.' ) { if ( *s != '.' ) { /* fetch figures before point */ while ( isdigit(*++s=fgetc(fd)) ) { if ( ++i > width ) { ungetc(*s,fd) ; *s = NULL ; return ; } } } if ( *s == '.' ) { /* fetch figures after point */ while ( isdigit(*++s=fgetc(fd)) ) { if ( ++i > width ) { ungetc(*s,fd) ; *s = NULL ; return ; } } } /* check for exponent */ if ( tolower(*s) == 'e' ) { *++s = fgetc(fd) ; if ( ++i > width ) { ungetc(*s,fd) ; *s = NULL ; return ; } if ( isdigit(*s) || *s == '-' ) { /* fetch figures of exponent */ while ( isdigit(*++s=fgetc(fd)) ) { if ( ++i > width ) { ungetc(*s,fd) ; *s = NULL ; return ; } } } } } ungetc(*s,fd) ; *s = NULL ; } z88dk-1.8.ds1/libsrc/printflike/unused/scanf2.opt0000644000175000017500000003101107130401724021326 0ustar tygrystygrys;* * * * * Small-C/Plus Z88 * * * * * ; Version: v1.10b0.70pre2 Date: 1/4/2000 ; ; Reconstructed for the z80 Module Assembler ; By Dominic Morris ; ; Module compile time: Thu Apr 6 02:11:06 2000 MODULE scanf2.c INCLUDE "#z88_crt0.hdr" ._scanf2 ld hl,-64 ;const add hl,sp ld sp,hl ld hl,14 ;const add hl,sp ld de,0 ;const ex de,hl call l_pint .i_3 ld hl,68 ;const add hl,sp call l_gint ; ld a,(hl) and a jp z,i_4 ld hl,68 ;const add hl,sp call l_gint ; ld l,(hl) ld h,0 push hl call isspace pop bc ld a,h or l jp z,i_5 ld hl,68 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint jp i_3 .i_5 ld hl,68 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint dec hl ld e,(hl) ld d,0 ld hl,37 ;const call l_ne jp c,i_3 .i_6 ld hl,68 ;const add hl,sp call l_gint ; ld a,(hl) cp #(42 % 256) jp nz,i_7 ld hl,18 ;const add hl,sp push hl ld hl,64 ;const add hl,sp push hl ld hl,20 ;const add hl,sp pop de call l_pint pop de call l_pint pop bc push hl ld hl,68 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint jp i_8 .i_7 ld hl,18 ;const add hl,sp push hl ld hl,64 ;const add hl,sp push hl ld hl,70 ;const add hl,sp push hl call l_gint ; dec hl pop de call l_pint inc hl call l_gint ; pop de call l_pint pop de call l_pint pop bc push hl .i_8 ld hl,68 ;const add hl,sp push hl ld e,(hl) inc hl ld d,(hl) push de ld hl,72 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,18 ;const add hl,sp push hl call utoi pop bc pop bc pop de add hl,de pop de call l_pint ld hl,12 ;const add hl,sp call l_gint ; call l_lneg jp nc,i_9 ld hl,12 ;const add hl,sp ld de,32767 ;const ex de,hl call l_pint .i_9 ld hl,8 ;const add hl,sp push hl ld hl,70 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint dec hl ld l,(hl) ld h,0 pop de call l_pint call l_lneg jp c,i_4 .i_10 .i_11 ld hl,10 ;const add hl,sp push hl ld hl,72 ;const add hl,sp call l_gint ; push hl call fgetc pop bc pop de call l_pint push hl call isspace pop bc ld a,h or l jp nz,i_11 .i_12 ld hl,10 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,-1 ;const call l_eq jp nc,i_13 ld hl,14 ;const add hl,sp call l_gint ; ld a,h or l jp nz,i_4 .i_14 ld hl,64 ;const add hl,sp ld sp,hl ld hl,-1 ;const ret .i_15 .i_13 ld hl,10 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,72 ;const add hl,sp call l_gint ; push hl call ungetc pop bc pop bc ld hl,8 ;const add hl,sp call l_gint ; jp i_18 .i_19 ld hl,62 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,72 ;const add hl,sp call l_gint ; push hl call fgetc pop bc pop de ld a,l ld (de),a jp i_17 .i_20 .i_21 ld hl,12 ;const add hl,sp push hl call l_gint ; dec hl pop de call l_pint inc hl ld a,h or l jp z,i_22 ld hl,62 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,72 ;const add hl,sp call l_gint ; push hl call fgetc pop bc pop de ld a,l ld (de),a inc hl ld a,h or l jp z,i_22 .i_23 ld hl,62 ;const add hl,sp call l_gint ; ld l,(hl) ld h,0 push hl call isspace pop bc ld a,h or l jp nz,i_22 .i_24 ld hl,62 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,18 ;const add hl,sp pop de call l_ne jp nc,i_25 ld hl,62 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint .i_25 jp i_21 .i_22 ld hl,62 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,0 ;const ld a,l ld (de),a jp i_17 .i_26 .i_27 ld hl,12 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,39 ;const call l_gt jp nc,i_28 ld hl,12 ;const add hl,sp ld de,39 ;const ex de,hl call l_pint .i_28 ld hl,20 ;const add hl,sp push hl ld hl,72 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,16 ;const add hl,sp call l_gint ; push hl call __getf pop bc pop bc pop bc pop hl push hl push hl ld hl,22 ;const add hl,sp push hl call _atof pop bc call float pop hl call dstore jp i_17 .i_29 ld hl,8 ;const add hl,sp call l_gint ; jp i_32 .i_33 ld hl,6 ;const add hl,sp ld (hl),#(10 % 256) inc hl ld (hl),#(10 / 256) ld hl,0 ;const pop de pop bc push hl push de ld hl,4 ;const add hl,sp ld de,3276 ;const ex de,hl call l_pint jp i_31 .i_34 ld hl,6 ;const add hl,sp ld (hl),#(8 % 256) inc hl ld (hl),#(8 / 256) ld hl,1 ;const pop de pop bc push hl push de ld hl,4 ;const add hl,sp ld de,8191 ;const ex de,hl call l_pint jp i_31 .i_35 ld hl,6 ;const add hl,sp ld (hl),#(10 % 256) inc hl ld (hl),#(10 / 256) ld hl,1 ;const pop de pop bc push hl push de ld hl,4 ;const add hl,sp ld de,6553 ;const ex de,hl call l_pint jp i_31 .i_36 ld hl,6 ;const add hl,sp ld (hl),#(16 % 256) inc hl ld (hl),#(16 / 256) ld hl,1 ;const pop de pop bc push hl push de ld hl,4 ;const add hl,sp ld de,4095 ;const ex de,hl call l_pint jp i_31 .i_37 ld hl,14 ;const add hl,sp call l_gint ; exx ld hl,64 ;const add hl,sp ld sp,hl exx ret jp i_31 .i_32 call l_case defw i_33,100 defw i_34,111 defw i_35,117 defw i_36,120 defw 0 jp i_37 .i_31 ld hl,18 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,62 ;const add hl,sp ld de,0 ;const ex de,hl call l_pint pop de call l_pint .i_38 ld hl,12 ;const add hl,sp push hl call l_gint ; dec hl pop de call l_pint inc hl ld a,h or l jp z,i_40 ld hl,10 ;const add hl,sp push hl ld hl,72 ;const add hl,sp call l_gint ; push hl call fgetc pop bc pop de call l_pint push hl call isspace pop bc call l_lneg jp nc,i_40 ld hl,10 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,-1 ;const call l_ne jr c,i_41_i_40 .i_40 jp i_39 .i_41_i_40 pop bc pop hl push hl push bc call l_lneg jp nc,i_42 ld hl,10 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,45 ;const call l_eq jp nc,i_43 ld hl,-1 ;const pop de pop bc push hl push de jp i_38 .i_43 ld hl,1 ;const pop de pop bc push hl push de .i_44 .i_42 ld hl,10 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,48 ;const call l_lt jp nc,i_45 ld hl,14 ;const add hl,sp call l_gint ; exx ld hl,64 ;const add hl,sp ld sp,hl exx ret .i_45 ld hl,10 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,97 ;const call l_ge jp nc,i_46 ld hl,10 ;const add hl,sp push hl call l_gint ; ld bc,-87 add hl,bc pop de call l_pint jp i_47 .i_46 ld hl,10 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,65 ;const call l_ge jp nc,i_48 ld hl,10 ;const add hl,sp push hl call l_gint ; ld bc,-55 add hl,bc pop de call l_pint jp i_49 .i_48 ld hl,10 ;const add hl,sp push hl call l_gint ; ld bc,-48 add hl,bc pop de call l_pint .i_49 .i_47 ld hl,10 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,8 ;const add hl,sp call l_gint ; pop de call l_ge jp c,i_51 ld hl,60 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,6 ;const add hl,sp call l_gint ; pop de call l_ugt jp nc,i_50 .i_51 ld hl,14 ;const add hl,sp call l_gint ; exx ld hl,64 ;const add hl,sp ld sp,hl exx ret .i_50 ld hl,60 ;const add hl,sp push hl ld hl,62 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,10 ;const add hl,sp call l_gint ; pop de call l_mult ex de,hl ld hl,14-2 ;const add hl,sp call l_gint ; add hl,de pop de call l_pint jp i_38 .i_39 ld hl,18 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,4 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,64 ;const add hl,sp call l_gint ; pop de call l_mult pop de call l_pint jp i_17 .i_18 call l_case defw i_19,99 defw i_20,115 defw i_26,101 defw i_27,102 defw 0 jp i_29 .i_17 ld hl,14 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint jp i_3 .i_4 ld hl,14 ;const add hl,sp call l_gint ; exx ld hl,64 ;const add hl,sp ld sp,hl exx ret .__getf ld hl,1 ;const push hl ld hl,8 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) push de ld hl,8 ;const add hl,sp call l_gint ; push hl call fgetc pop bc pop de ld a,l ld (de),a ld hl,8 ;const add hl,sp call l_gint ; ld l,(hl) ld h,0 push hl call isdigit pop bc ld a,h or l jp nz,i_54 ld hl,8 ;const add hl,sp call l_gint ; ld a,(hl) cp #(45 % 256) jp z,i_54 cp #(46 % 256) jp nz,i_53 .i_54 ld hl,8 ;const add hl,sp call l_gint ; ld e,(hl) ld d,0 ld hl,46 ;const call l_ne jp nc,i_56 .i_57 ld hl,8 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint push hl ld hl,8 ;const add hl,sp call l_gint ; push hl call fgetc pop bc pop de ld a,l ld (de),a push hl call isdigit pop bc ld a,h or l jp z,i_58 pop hl inc hl push hl ex de,hl ld hl,6-2 ;const add hl,sp call l_gint ; call l_gt jp nc,i_59 ld hl,8 ;const add hl,sp call l_gint ; ld l,(hl) ld h,0 push hl ld hl,8 ;const add hl,sp call l_gint ; push hl call ungetc pop bc pop bc ld hl,8 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,0 ;const ld a,l ld (de),a pop bc ret .i_59 jp i_57 .i_58 .i_56 ld hl,8 ;const add hl,sp call l_gint ; ld e,(hl) ld d,0 ld hl,46 ;const call l_eq jp nc,i_60 .i_61 ld hl,8 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint push hl ld hl,8 ;const add hl,sp call l_gint ; push hl call fgetc pop bc pop de ld a,l ld (de),a push hl call isdigit pop bc ld a,h or l jp z,i_62 pop hl inc hl push hl ex de,hl ld hl,6-2 ;const add hl,sp call l_gint ; call l_gt jp nc,i_63 ld hl,8 ;const add hl,sp call l_gint ; ld l,(hl) ld h,0 push hl ld hl,8 ;const add hl,sp call l_gint ; push hl call ungetc pop bc pop bc ld hl,8 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,0 ;const ld a,l ld (de),a pop bc ret .i_63 jp i_61 .i_62 .i_60 ld hl,8 ;const add hl,sp call l_gint ; ld l,(hl) ld h,0 push hl call tolower pop bc ld de,101 ;const ex de,hl call l_eq jp nc,i_64 ld hl,8 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint push hl ld hl,8 ;const add hl,sp call l_gint ; push hl call fgetc pop bc pop de ld a,l ld (de),a pop hl inc hl push hl ex de,hl ld hl,6-2 ;const add hl,sp call l_gint ; call l_gt jp nc,i_65 ld hl,8 ;const add hl,sp call l_gint ; ld l,(hl) ld h,0 push hl ld hl,8 ;const add hl,sp call l_gint ; push hl call ungetc pop bc pop bc ld hl,8 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,0 ;const ld a,l ld (de),a pop bc ret .i_65 ld hl,8 ;const add hl,sp call l_gint ; ld l,(hl) ld h,0 push hl call isdigit pop bc ld a,h or l jp nz,i_67 ld hl,8 ;const add hl,sp call l_gint ; ld a,(hl) cp #(45 % 256) jp nz,i_66 .i_67 .i_69 ld hl,8 ;const add hl,sp push hl call l_gint ; inc hl pop de call l_pint push hl ld hl,8 ;const add hl,sp call l_gint ; push hl call fgetc pop bc pop de ld a,l ld (de),a push hl call isdigit pop bc ld a,h or l jp z,i_70 pop hl inc hl push hl ex de,hl ld hl,6-2 ;const add hl,sp call l_gint ; call l_gt jp nc,i_71 ld hl,8 ;const add hl,sp call l_gint ; ld l,(hl) ld h,0 push hl ld hl,8 ;const add hl,sp call l_gint ; push hl call ungetc pop bc pop bc ld hl,8 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,0 ;const ld a,l ld (de),a pop bc ret .i_71 jp i_69 .i_70 .i_66 .i_64 .i_53 ld hl,8 ;const add hl,sp call l_gint ; ld l,(hl) ld h,0 push hl ld hl,8 ;const add hl,sp call l_gint ; push hl call ungetc pop bc pop bc ld hl,8 ;const add hl,sp ld e,(hl) inc hl ld d,(hl) ld hl,0 ;const ld a,l ld (de),a pop bc ret ; --- Start of Static Variables --- ; --- Start of Scope Defns --- LIB feof XDEF __getf LIB fprand LIB fpseed XREF _atof LIB getk LIB isprint LIB fmod LIB sprintf LIB tolower LIB ispunct LIB ftoa LIB ftoe LIB read XDEF _scanf2 LIB isupper LIB open LIB fgetc LIB freopen LIB fgets LIB open_z88 LIB fopen_z88 LIB creat LIB close LIB isxdigit LIB toupper LIB minisprintf LIB puts LIB utoi LIB fseek LIB rename LIB floor LIB fopen LIB fchkstd LIB ftell LIB readbyte LIB fprintf LIB minivfprintf XREF __sgoioblk LIB fgetc_cons LIB fgets_cons LIB fputc LIB isalpha LIB remove LIB isdigit LIB isascii LIB fputs LIB isalnum LIB lseek LIB vsprintf LIB toascii LIB writebyte LIB fclose LIB iscntrl LIB fgetpos LIB printf LIB minifprintf LIB minisfprintf LIB printn LIB fdtell LIB closeall LIB freopen_z88 LIB ungetc LIB getarg LIB miniprintf LIB fabandon LIB fdgetpos LIB ceil LIB fabs LIB vfprintf LIB islower LIB write LIB fputc_cons LIB puts_cons LIB amax LIB amin LIB isspace ; --- End of Scope Defns --- ; --- End of Compilation --- z88dk-1.8.ds1/libsrc/printflike/utoi.c0000644000175000017500000000136107130401723017253 0ustar tygrystygrys#include /* * utoi -- convert unsigned decimal string to integer nbr * returns field size, else ERR on error * * Amazing! My briefly hand optimized version is only one byte * shorter than the compiled C - leaving has compiled version * - djm 18/5/99 */ #define ERR -1 extern int __LIB__ utoi(char *decstr, int *nbr); int utoi(decstr, nbr) unsigned char *decstr ; int *nbr; { int t, d ; d = 0 ; *nbr = 0 ; while ( *decstr >= '0' && *decstr <= '9' ) { t = *nbr ; t = (10*t) + (*decstr++ - '0') ; if ( t >= 0 && *nbr < 0 ) return ERR ; ++d ; *nbr = t ; } return d ; } z88dk-1.8.ds1/libsrc/printflike/vfprintf_comp.c0000644000175000017500000000604107434702172021160 0ustar tygrystygrys/* * printf1 - generic _printf routine for integer-only operation * * * R M Yorston 1987 */ #include extern __LIB__ utoi(); int vfprintf_comp(fd,ctl, ap) FILE *fd ; unsigned char *ctl; void *ap ; { int i, prec, preclen, len ; unsigned char c, right, str[25], pad; int width, pf_count=0; unsigned char *sptr, *cx ; while ( c = *ctl++ ) { if (c != '%' ) { fputc(c, fd) ; ++pf_count; continue ; } if ( *ctl == '%' ) { fputc(*ctl++, fd) ; ++pf_count; continue ; } cx = ctl ; if ( *cx == '-' ) { right = 0 ; ++cx ; } else right = 1 ; if ( *cx == '0' ) { pad = '0' ; ++cx ; } else pad = ' ' ; if ( (i=utoi(cx, &width)) >= 0 ) cx += i ; else continue ; if (*cx=='.') { if ( (preclen=utoi(++cx, &prec)) >= 0 ) cx += preclen ; else continue ; } else preclen = 0 ; sptr = str ; c = *cx++ ; i = *ap; ap -= sizeof(int); switch(c) { case 'l': c = *cx++; switch ( c ) { case 'd': case 'u': case 'x': ltoa_any(*(long *)ap,str,20,( c == 'x' ? 16 : 10 ),(c == 'd')); ap -= sizeof(int); break; default: continue; } break; case 'u': ltoa_any((unsigned long)i,str,7,10,0); break; case 'd' : ltoa_any(i,str,7,10,1); break ; case 'x' : ltoa_any((unsigned long)i,str,7,16,0); break ; case 'c' : str[0] = i ; str[1] = 0 ; break ; case 's' : sptr = (unsigned char *)i ; break ; default: continue ; } ctl = cx ; /* accept conversion spec */ if ( c != 's' ) while ( *sptr == ' ' ) ++sptr ; len = -1 ; while ( sptr[++len] ) ; /* get length */ if ( c == 's' && len>prec && preclen>0 ) len = prec ; if (right) while ( ((width--)-len) > 0 ) { fputc(pad, fd) ; ++pf_count; } while ( len ) { fputc(*sptr++, fd) ; ++pf_count; --len ; --width ; } while ( ((width--)-len) > 0 ) { fputc(pad, fd) ; ++pf_count; } } return(pf_count) ; } z88dk-1.8.ds1/libsrc/printflike/vfprintf_fp.c0000644000175000017500000000544410763607706020643 0ustar tygrystygrys/* * printf2.c - generic _printf for floating point output * also, floating point conversion functions * * Compile with -m option * * R M Yorston 1987 * */ #include #include extern __LIB__ utoi() ; #define ERR -1 vfprintf_fp(fd, ctl, ap) FILE *fd; unsigned char *ctl; void *ap; { int i, width, prec, preclen, len, pf_count=0 ; unsigned char c, right, str[128], pad; unsigned char *sptr, *cx ; while ( c = *ctl++ ) { if (c != '%' ) { fputc(c, fd) ; ++pf_count; continue ; } if ( *ctl == '%' ) { fputc(*ctl++, fd) ; ++pf_count; continue ; } cx = ctl ; if ( *cx == '-' ) { right = 0 ; ++cx ; } else right = 1 ; if ( *cx == '0' ) { pad = '0' ; ++cx ; } else pad = ' ' ; if ( (i=utoi(cx, &width)) >= 0 ) cx += i ; else continue ; if (*cx == '.') { if ( (preclen=utoi(++cx, &prec)) >= 0 ) cx += preclen ; else continue ; } else preclen = 0 ; sptr = str ; c = *cx++ ; i = *ap; ap -= sizeof(int); switch(c) { case 'l': c = *cx++; switch ( c ) { case 'd': case 'u': case 'x': ltoa_any(*(long *)ap,str,20,( c == 'x' ? 16 : 10 ),(c == 'd')); ap -= sizeof(int); break; default: continue; } break; case 'd' : ltoa_any(i,str,7,10,1); break ; case 'x' : ltoa_any((unsigned long)i,str,7,16,0); break ; case 'c' : str[0] = i ; str[1] = 0 ; break ; case 's' : sptr = (unsigned char *)i ; break ; case 'u' : ltoa_any((unsigned long)i,str,7,10,0); break ; default: if ( preclen == 0 ) prec = 6 ; if ( c == 'f' ) { ap -= sizeof(double) - sizeof(int) - sizeof(int); ftoa( *(double *)ap, prec, str ) ; ap -= sizeof(int); } else if ( c == 'e' ) { ap -= sizeof(double) - sizeof(int) - sizeof(int); ftoe( *(double *)ap, prec, str ) ; ap -= sizeof(int); } else continue ; } ctl = cx ; /* accept conversion spec */ if ( c != 's' ) while ( *sptr == ' ' ) ++sptr ; len = -1 ; while ( sptr[++len] ) ; /* get length */ if ( c == 's' && len>prec && preclen>0 ) len = prec ; if (right) while ( ((width--)-len) > 0 ) { fputc(pad, fd) ; ++pf_count; } while ( len ) { fputc(*sptr++, fd) ; ++pf_count; --len ; --width ; } while ( ((width--)-len) > 0 ) { fputc(pad, fd) ; ++pf_count; } } return(pf_count) ; } z88dk-1.8.ds1/libsrc/printflike/vfscanf.c0000644000175000017500000000440210701520715017721 0ustar tygrystygrys/* * Core routine for integer-only scanf-type functions * only d, o, x, c, s, and u specs are supported. */ #include #include #define ERR (-1) extern __LIB__ utoi() ; int vfscanf(fd, ctl, nxtarg) FILE *fd; unsigned char *ctl; void *nxtarg ; { unsigned char *carg; unsigned int zunsigned ; int *narg, wast, ac, width, ovfl ; int sign; unsigned char ch, base, cnv; ac = 0 ; while ( *ctl) { if ( isspace(*ctl) ) { ++ctl; continue; } if ( *ctl++ != '%' ) continue ; if ( *ctl == '*' ) { narg = carg = &wast; ++ctl; } else { narg = carg = *nxtarg; nxtarg -= sizeof(int) ; } ctl += utoi(ctl, &width) ; if ( !width ) width = 32767 ; if ( !(cnv=*ctl++) ) break ; while ( isspace(ch=fgetc(fd)) ) ; if ( ch == EOF ) { if (ac) break ; else return EOF ; } ungetc(ch,fd) ; switch(cnv) { case 'c' : *carg = fgetc(fd) ; break ; case 's' : while ( width-- ) { if ( (*carg=fgetc(fd)) == EOF ) break ; if ( isspace(*carg) ) break ; if ( carg != &wast ) ++carg ; } *carg = 0 ; break ; default : switch(cnv) { case 'd' : base = 10 ; sign = 0 ; ovfl = 3276 ; break ; case 'o' : base = 8 ; sign = 1 ; ovfl = 8191 ; break ; case 'u' : base = 10 ; sign = 1 ; ovfl = 6553 ; break ; case 'x' : base = 16 ; sign = 1 ; ovfl = 4095 ; break ; default : return ac ; } *narg = zunsigned = 0 ; while ( width-- && !isspace(ch=fgetc(fd)) && ch!=EOF ) { if ( !sign ) if ( ch == '-' ) { sign = -1; continue; } else sign = 1 ; if ( ch < '0' ) return ac ; if ( ch >= 'a') ch -= 87 ; else if ( ch >= 'A' ) ch -= 55 ; else ch -= '0' ; if ( ch >= base || zunsigned > ovfl ) return ac ; zunsigned = zunsigned * base + ch ; } *narg = sign * zunsigned ; } ++ac ; } return ac ; } z88dk-1.8.ds1/libsrc/printflike/vsprintf.c0000644000175000017500000000043107130401723020143 0ustar tygrystygrys/* * Generic z88dk stdio library * */ #define ANSI_STDIO #include int vsprintf(char *str,unsigned char *a, void *b) { FILE temp; int ret; temp.desc.ptr=str; temp.flags=_IOWRITE|_IOSTRING; ret=vfprintf(temp,a,b); *(temp.desc.ptr)=0; return(ret); } z88dk-1.8.ds1/libsrc/printflike/vsscanf.c0000644000175000017500000000044307460744365017760 0ustar tygrystygrys/* * Generic z88dk stdio library * */ #define ANSI_STDIO #include int vsscanf(char *str,unsigned char *a, void *b) { FILE temp; int ret; temp.desc.ptr=str; temp.flags=_IOREAD|_IOSTRING; ret=vfscanf(temp,a,b); #if 0 *(temp.desc.ptr)=0; #endif return(ret); } z88dk-1.8.ds1/libsrc/rcmx000/0000755000175000017500000000000010765202715015160 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rcmx000.lst0000755000175000017500000000601010712620314015673 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/8080/fchkstd stdio/8080/fclose stdio/feof stdio/8080/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/8080/fputc stdio/8080/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/8080/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/8080/ungetc stdio/8080/fabandon stdio/rcmx000/fgetc_cons stdio/rcmx000/cnvtab stdio/fgets_cons stdio/rcmx000/getk stdio/puts_cons stdio/rcmx000/fputc_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert time/rcmx000/clock printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf printflike/ltoa_any z80_crt0s/z80_emu/rcmx_cpd z80_crt0s/z80_emu/rcmx_cpdr z80_crt0s/z80_emu/rcmx_cpi z80_crt0s/z80_emu/rcmx_cpir z80_crt0s/z80_emu/rcmx_rld z80_crt0s/z80_emu/rcmx_rrd z88dk-1.8.ds1/libsrc/rect/0000755000175000017500000000000010765202715014724 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rect/Makefile0000644000175000017500000000027410633257400016362 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../Make.config all: $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/rect @rect.lst clean: $(RM) *.o* *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/rect/r_IntersectIval16.asm0000644000175000017500000000152610434501503020664 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IntersectIval16 LIB RIntersectIval16 ; int r_IntersectIval16(struct r_Ival16 *i1, struct r_Ival16 *i2, struct r_Ival16 *result) .r_IntersectIval16 ld hl,7 add hl,sp ld d,(hl) dec hl ld e,(hl) dec hl push hl ex de,hl ld e,(hl) inc hl ld d,(hl) inc hl ld c,(hl) inc hl ld b,(hl) push bc exx pop de exx pop hl push de ld d,(hl) dec hl ld e,(hl) dec hl push hl ex de,hl ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) pop hl ex (sp),hl call RIntersectIval16 jr nc, no pop hl ld a,(hl) dec hl ld l,(hl) ld h,a ld (hl),c inc hl ld (hl),b inc hl ld (hl),e inc hl ld (hl),d ld hl,1 ret .no pop hl ld hl,0 ret z88dk-1.8.ds1/libsrc/rect/r_IntersectIval8.asm0000644000175000017500000000117210434501503020602 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IntersectIval8 LIB RIntersectIval8 ; int r_IntersectIval8(struct r_Ival8 *i1, struct r_Ival8 *i2, struct r_Ival8 *result) .r_IntersectIval8 ld hl,7 add hl,sp ld d,(hl) dec hl ld e,(hl) dec hl ex de,hl ld b,(hl) inc hl ld c,(hl) ex de,hl ld d,(hl) dec hl ld e,(hl) dec hl push hl ex de,hl ld d,(hl) inc hl ld e,(hl) call RIntersectIval8 jr nc, no pop hl ld d,(hl) dec hl ld e,(hl) ex de,hl ld (hl),b inc hl ld (hl),c ld hl,1 ret .no pop hl ld hl,0 ret z88dk-1.8.ds1/libsrc/rect/r_IntersectRect16.asm0000644000175000017500000000201210434501503020655 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IntersectRect16 LIB RIntersectRect16 ; int r_IntersectRect16(struct r_Rect16 *r1, struct r_Rect16 *r2, struct r_Rect16 *result) .r_IntersectRect16 ld hl,7 add hl,sp ld d,(hl) dec hl ld e,(hl) dec hl push de ld d,(hl) dec hl ld e,(hl) dec hl ld b,(hl) dec hl ld c,(hl) ld ixl,c ld ixh,b ex de,hl ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) inc hl ex (sp),hl ld a,(hl) inc hl push hl ld h,(hl) ld l,a ; stack = r2.y, r1.width-1 exx pop hl inc hl pop de ld a,(hl) inc hl ex af,af ld a,(hl) inc hl ld c,(hl) inc hl ld b,(hl) inc hl push bc ld c,(hl) inc hl ld b,(hl) push bc ex de,hl ld e,(hl) inc hl ld d,(hl) inc hl push de ld e,(hl) inc hl ld d,(hl) push de ld d,a ex af,af ld e,a exx call RIntersectRect16 ld hl,0 ret nc inc l ret z88dk-1.8.ds1/libsrc/rect/r_IntersectRect8.asm0000644000175000017500000000155110434501503020605 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IntersectRect8 LIB RIntersectRect8 ; int r_IntersectRect8(struct r_Rect8 *r1, struct r_Rect8 *r2, struct r_Rect8 *result) .r_IntersectRect8 ld hl,7 add hl,sp ld d,(hl) dec hl ld e,(hl) dec hl push hl ex de,hl ld b,(hl) inc hl ld c,(hl) inc hl ld d,(hl) inc hl ld e,(hl) pop hl push de ld d,(hl) dec hl ld e,(hl) dec hl push hl ex de,hl ld d,(hl) inc hl ld e,(hl) inc hl push hl exx pop hl ld d,(hl) inc hl ld e,(hl) pop hl pop bc push hl exx call RIntersectRect8 pop hl jr nc, no ld d,(hl) dec hl ld e,(hl) ex de,hl ld (hl),b inc hl ld (hl),c inc hl push hl exx pop hl ld (hl),b inc hl ld (hl),c ld hl,1 ret .no ld hl,0 ret z88dk-1.8.ds1/libsrc/rect/r_IsIvalInIval16.asm0000644000175000017500000000113210434501503020373 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IsIvalInIval16 LIB RIsIvalInIval16 ; int r_IsIvalInIval16(struct r_Ival16 *i1, struct r_Ival16 *i2) .r_IsIvalInIval16 ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) inc hl ld a,(hl) inc hl ld h,(hl) ld l,a push hl ex de,hl ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) pop hl ld a,(hl) inc hl push hl ld h,(hl) ld l,a exx pop hl inc hl ld e,(hl) inc hl ld d,(hl) exx call RIsIvalInIval16 ld hl,0 ret nc inc l ret z88dk-1.8.ds1/libsrc/rect/r_IsIvalInIval8.asm0000644000175000017500000000070310434501503020317 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IsIvalInIval8 LIB RIsIvalInIval8 ; int r_IsIvalInIval8(struct r_Ival8 *i1, struct r_Ival8 *i2) .r_IsIvalInIval8 ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) inc hl ex de,hl ld b,(hl) inc hl ld c,(hl) ex de,hl ld e,(hl) inc hl ld d,(hl) ex de,hl ld d,(hl) inc hl ld e,(hl) call RIsIvalInIval8 ld hl,0 ret nc inc l ret z88dk-1.8.ds1/libsrc/rect/r_IsPtInIval16.asm0000644000175000017500000000070310434501503020066 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IsPtInIval16 LIB RIsPtInIval16 ; int r_IsPtInIval16(uint x, struct r_Ival16 *i) .r_IsPtInIval16 ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) inc hl push hl ex de,hl ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) pop hl ld a,(hl) inc hl ld h,(hl) ld l,a call RIsPtInIval16 ld hl,0 ret nc inc l ret z88dk-1.8.ds1/libsrc/rect/r_IsPtInIval8.asm0000644000175000017500000000053210434501503020007 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IsPtInIval8 LIB RIsPtInIval8 ; int r_IsPtInIval8(uchar x, struct r_Ival8 *i) .r_IsPtInIval8 ld hl,4 add hl,sp ld a,(hl) dec hl ld d,(hl) dec hl ld e,(hl) ex de,hl ld d,(hl) inc hl ld e,(hl) call RIsPtInIval8 ld hl,0 ret nc inc l ret z88dk-1.8.ds1/libsrc/rect/r_IsPtInRect16.asm0000644000175000017500000000122710434501503020072 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IsPtInRect16 LIB RIsPtInRect16 ; int r_IsPtInRect16(uint x, uint y, struct r_Rect16 *r) .r_IsPtInRect16 ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) inc hl push hl ex de,hl ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) inc hl push hl exx pop hl ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) pop hl ld a,(hl) inc hl push hl ld h,(hl) ld l,a exx pop hl inc hl ld a,(hl) inc hl ld h,(hl) ld l,a call RIsPtInRect16 ld hl,0 ret nc inc l ret z88dk-1.8.ds1/libsrc/rect/r_IsPtInRect8.asm0000644000175000017500000000071710434501503020016 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IsPtInRect8 LIB RIsPtInRect8 ; int r_IsPtInRect8(uchar x, uchar y, struct r_Rect8 *r) .r_IsPtInRect8 ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) inc hl push hl ld b,(hl) inc hl ld c,(hl) inc hl ld d,(hl) inc hl ld e,(hl) pop hl ld a,(hl) inc hl inc hl ld h,(hl) ld l,a ld a,h call RIsPtInRect8 ld hl,0 ret nc inc l ret z88dk-1.8.ds1/libsrc/rect/r_IsRectInRect16.asm0000644000175000017500000000164610434501503020411 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IsRectInRect16 LIB RIsRectInRect16 ; int r_IsRectInRect16(struct r_Rect16 *r1, struct r_Rect16 *r2) .r_IsRectInRect16 ld hl,5 add hl,sp ld d,(hl) dec hl ld e,(hl) dec hl push de ld d,(hl) dec hl ld e,(hl) ex de,hl ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) inc hl ex (sp),hl ld a,(hl) inc hl push hl ld h,(hl) ld l,a ; stack = r2.y, r1.width-1 exx pop hl inc hl pop de ld a,(hl) inc hl ex af,af ld a,(hl) inc hl ld c,(hl) inc hl ld b,(hl) inc hl push bc ld c,(hl) inc hl ld b,(hl) push bc ex de,hl ld e,(hl) inc hl ld d,(hl) inc hl push de ld e,(hl) inc hl ld d,(hl) push de ld d,a ex af,af ld e,a exx call RIsRectInRect16 ld hl,0 ret nc inc l ret z88dk-1.8.ds1/libsrc/rect/r_IsRectInRect8.asm0000644000175000017500000000112510434501503020322 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB r_IsRectInRect8 LIB RIsRectInRect8 ; int r_IsRectInRect8(struct r_Rect8 *r1, struct r_Rect8 *r2) .r_IsRectInRect8 ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) inc hl ex de,hl ld b,(hl) inc hl ld c,(hl) inc hl push hl ex de,hl ld a,(hl) inc hl ld h,(hl) ld l,a ld d,(hl) inc hl ld e,(hl) inc hl push hl exx pop hl ld d,(hl) inc hl ld e,(hl) pop hl ld b,(hl) inc hl ld c,(hl) exx call RIsRectInRect8 ld hl,0 ret nc inc l ret z88dk-1.8.ds1/libsrc/rect/rect.lst0000644000175000017500000000057010434501503016375 0ustar tygrystygrysr_IntersectIval8 r_IntersectIval16 r_IntersectRect8 r_IntersectRect16 r_IsIvalInIval8 r_IsIvalInIval16 r_IsPtInIval8 r_IsPtInIval16 r_IsPtInRect8 r_IsPtInRect16 r_IsRectInRect8 r_IsRectInRect16 RIntersectIval8 RIntersectIval16 RIntersectRect8 RIntersectRect16 RIsIvalInIval8 RIsIvalInIval16 RIsPtInIval8 RIsPtInIval16 RIsPtInRect8 RIsPtInRect16 RIsRectInRect8 RIsRectInRect16 z88dk-1.8.ds1/libsrc/rect/RIntersectIval16.asm0000644000175000017500000000253210434501503020463 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIntersectIval16 ; Returns the intersection of two 16-bit intervals. ; Since intervals can wrap across the 0-65535 boundary, ; the result of the intersection can be the empty ; interval (no intersection), a single interval or ; two intervals. This routine will return one ; intersected interval. ; ; enter : hl = interval 1 start coordinate ; bc = interval 2 start coordinate ; de = interval 2 width ; de' = interval 1 width ; ; exit : carry flag set = intersection detected and ; bc = start coordinate, de = width of intersection ; uses : af, bc, de, hl, hl', bc', de' .RIntersectIval16 push hl push bc or a sbc hl,bc or a sbc hl,de jr nc, checki2ini1 .i1ini2 push hl exx pop bc xor a ld h,a ld l,a sbc hl,bc push hl or a sbc hl,de push de exx jr nc, w1smaller pop de pop de pop bc pop bc ret .w1smaller pop de pop bc pop bc pop bc scf ret .checki2ini1 exx pop hl pop bc or a sbc hl,bc or a sbc hl,de jr nc, exit ex de,hl xor a ld h,a ld l,a sbc hl,de push hl exx pop hl push hl or a sbc hl,de jr nc, w2smaller pop de ret .w2smaller scf ret .exit exx ret z88dk-1.8.ds1/libsrc/rect/RIntersectIval8.asm0000644000175000017500000000160710434501503020406 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIntersectIval8 ; Returns the intersection of two 8-bit intervals. ; Since intervals can wrap across the 0-255 boundary, ; the result of the intersection can be the empty ; interval (no intersection), a single interval or ; two intervals. This routine will return one ; intersected interval. ; ; enter : b = interval 1 start coordinate ; c = interval 1 width ; d = interval 2 start coordinate ; e = interval 2 width ; exit : carry flag set = intersection detected and ; b = start coord, c = width of intersection ; uses : af, bc .RIntersectIval8 ld a,b sub d sub e jr c, i1ini2 ld a,d sub b sub c ret nc .i2ini1 ld b,d neg cp e ld c,a jr c, min ld c,e .min scf ret .i1ini2 neg cp c jr nc, max ld c,a .max scf ret z88dk-1.8.ds1/libsrc/rect/RIntersectRect16.asm0000644000175000017500000000220010434501503020455 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIntersectRect16 LIB RIntersectIval16 ; Returns the intersection of two 16-bit rectangles. ; Since rectangles can wrap across their 0-65535 ; boundaries, the result of the intersection can be ; 0, 1, 2 or 3 rectangles. This routine will return ; one result only. ; ; enter : hl = rect #1 x coord ; bc = rect #2 x coord ; de = rect #2 width ; de' = rect #1 width ; ix = & struct r_Rect16 to hold result ; stack : rect #1 y coord, rect #1 height, rect #2 y coord, rect #2 height, ret addr ; exit : carry flag set = intersection detected, stack cleared ; and ix rectangle filled with result of intersection ; uses : f, bc, de, hl, bc', de', hl' .RIntersectRect16 call RIntersectIval16 jr nc, exitearly ld (ix+0),c ld (ix+1),b ld (ix+2),e ld (ix+3),d pop hl pop de pop bc exx pop de exx ex (sp),hl call RIntersectIval16 ret nc ld (ix+4),c ld (ix+5),b ld (ix+6),e ld (ix+7),d ret .exitearly pop de ld hl,8 add hl,sp ld sp,hl ex de,hl or a jp (hl) z88dk-1.8.ds1/libsrc/rect/RIntersectRect8.asm0000644000175000017500000000257010434501503020410 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIntersectRect8 ; Returns the intersection of two 8-bit rectangles. ; Since rectangles can wrap across their 0-255 ; boundaries, the result of the intersection can be ; 0, 1, 2 or 3 rectangles. This routine will return ; one result only. ; ; enter : b = rect #1 x-interval start coordinate ; c = rect #1 x-interval width ; d = rect #2 x-interval start coordinate ; e = rect #2 x-interval width ; b' = rect #1 y-interval start coordinate ; c' = rect #1 y-interval width ; d' = rect #2 y-interval start coordinate ; e' = rect #2 y-interval width ; exit : carry flag set = intersection detected and ; b = rect x coord, c = rect width ; b' = rect y coord, c' = rect height ; uses : af, bc, bc' .RIntersectRect8 ld a,b sub d sub e jr c, xr1inr2 ld a,d sub b sub c ret nc .xr2inr1 ld b,d neg cp e ld c,a jr c, doy ld c,e .doy exx ld a,b sub d sub e jr c, yr1inr2 ld a,d sub b sub c jr c, yr2inr1 exx ret .xr1inr2 neg cp c jr nc, doy ld c,a jp doy .yr1inr2 neg cp c jr nc, done ld c,a exx ret .done scf exx ret .yr2inr1 ld b,d neg cp e ld c,a jr c, done+1 ld c,e exx scf ret z88dk-1.8.ds1/libsrc/rect/RIsIvalInIval16.asm0000644000175000017500000000140610434501503020200 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIsIvalInIval16 ; Determine if two 16-bit intervals intersect. Intervals ; can wrap across 0-65535 boundary. Amazingly this test ; reduces to detecting whether either of the start points ; of each interval lie in the other interval. ; ; enter : hl = interval 1 start coordinate ; bc = interval 2 start coordinate ; de = interval 2 width ; de' = interval 1 width ; ; exit : carry flag set = intersection detected ; uses : f, hl, hl', bc' .RIsIvalInIval16 push hl push bc or a sbc hl,bc or a sbc hl,de jr c, cleanup exx pop hl pop bc or a sbc hl,bc or a sbc hl,de exx ret .cleanup pop bc pop hl ret z88dk-1.8.ds1/libsrc/rect/RIsIvalInIval8.asm0000644000175000017500000000113410434501503020117 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIsIvalInIval8 ; Determine if two 8-bit intervals intersect. Intervals ; can wrap across 0-255 boundary. Amazingly this test ; reduces to detecting whether either of the start points ; of each interval lie in the other interval. ; ; enter : b = interval 1 start coordinate ; c = interval 1 width ; d = interval 2 start coordinate ; e = interval 2 width ; exit : carry flag set = intersection detected ; uses : af .RIsIvalInIval8 ld a,b sub d cp e ret c ld a,d sub b cp c ret z88dk-1.8.ds1/libsrc/rect/RIsPtInIval16.asm0000644000175000017500000000063410434501503017672 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIsPtInIval16 ; Determine if 16-bit point lies in a 16-bit interval. ; Interval bounds wrap across 0-65535 boundaries. ; ; enter : hl = coordinate of point ; bc = interval start coordinate ; de = width of interval ; exit : carry flag set = in interval ; used : f, hl .RIsPtInIval16 or a sbc hl,bc or a sbc hl,de ret z88dk-1.8.ds1/libsrc/rect/RIsPtInIval8.asm0000644000175000017500000000057310434501503017615 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIsPtInIval8 ; Determine if 8-bit point lies in an 8-bit interval. ; Interval bounds wrap across 0-255 boundaries. ; ; enter : a = coordinate of point ; d = interval start coordinate ; e = width of interval ; exit : carry flag set = in interval ; used : af .RIsPtInIval8 sub d cp e ret z88dk-1.8.ds1/libsrc/rect/RIsPtInRect16.asm0000644000175000017500000000115610434501503017674 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIsPtInRect16 ; Determine if 16-bit (x,y) point lies in a 16-bit bounding ; rectangle. Rectangle bounds wrap across 0-65535 boundaries. ; ; enter : hl = x coord of point ; bc = x coord of rectangle ; de = width of rectangle ; hl' = y coord of point ; bc' = y coord of rectangle ; de' = height of rectangle ; ; exit : carry flag set = in rectangle ; uses : f, hl, hl' .RIsPtInRect16 or a sbc hl,bc or a sbc hl,de ret nc exx or a sbc hl,bc or a sbc hl,de exx ret z88dk-1.8.ds1/libsrc/rect/RIsPtInRect8.asm0000644000175000017500000000102710434501503017612 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIsPtInRect8 ; Determine if 8-bit (x,y) point lies in an 8-bit bounding ; rectangle. Rectangle bounds wrap across 0-255 boundaries. ; ; enter : a = x coordinate of point ; l = y coordinate of point ; b = x coordinate of rect ; c = width of rect ; d = y coordinate of rect ; e = height of rect ; exit : carry flag set = in rectangle ; uses : af .RIsPtInRect8 sub b cp c ret nc ld a,l sub d cp e ret z88dk-1.8.ds1/libsrc/rect/RIsRectInRect16.asm0000644000175000017500000000135410434501503020206 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIsRectInRect16 LIB RIsIvalInIval16 ; Determine if two 16-bit rectangles intersect. Rectangles ; can wrap across 0-65535 boundaries. ; ; enter : hl = rect #1 x coord ; bc = rect #2 x coord ; de = rect #2 width ; de' = rect #1 width ; stack : rect #1 y coord, rect #1 height, rect #2 y coord, rect #2 height, ret addr ; exit : carry flag set = intersection detected, stack cleared ; uses : f, bc, de, hl, bc', de', hl' .RIsRectInRect16 call RIsIvalInIval16 jp c, maybe pop de ld hl,8 add hl,sp ld sp,hl ex de,hl or a jp (hl) .maybe pop hl pop de pop bc exx pop de exx ex (sp),hl jp RIsIvalInIval16 z88dk-1.8.ds1/libsrc/rect/RIsRectInRect8.asm0000644000175000017500000000153010434501503020123 0ustar tygrystygrys ; Rectangle, Intervals and Points ; 05.2006 aralbrec XLIB RIsRectInRect8 ; Determine if two 8-bit rectangles intersect. Rectangles ; can wrap across 0-255 boundaries. ; ; enter : b = rect #1 x-interval start coordinate ; c = rect #1 x-interval width ; d = rect #2 x-interval start coordinate ; e = rect #2 x-interval width ; b' = rect #1 y-interval start coordinate ; c' = rect #1 y-interval width ; d' = rect #2 y-interval start coordinate ; e' = rect #2 y-interval width ; exit : carry flag set = intersection detected ; uses : af .RIsRectInRect8 ld a,b sub d cp e jr c, intersect1 ld a,d sub b cp c ret nc .intersect1 exx ld a,b sub d cp e jr c, intersect2 ld a,d sub b cp c .intersect2 exx ret z88dk-1.8.ds1/libsrc/rex/0000755000175000017500000000000010765202715014565 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rex/DbDeleteText.asm0000644000175000017500000000077307457364561017627 0ustar tygrystygrys; ; Database Call for REX6000 ; ; DbDeleteText ; ; $Id: DbDeleteText.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ XLIB DbDeleteText .DbDeleteText ld ix,2 add ix,sp ld hl,$0000 push hl ld hl,$0003 push hl ld hl,$0000 push hl add hl,sp ld ($c00a),hl ld l,(ix+0) ld h,(ix+1) ld ($c008),hl ld l,(ix+2) ld h,(ix+3) ld ($c006),hl ld l,(ix+4) ld h,(ix+5) ld ($c004),hl ld l,(ix+6) ld h,(ix+7) ld ($c002),hl ld hl,$00ea ld ($c000),hl rst $10 ld hl,($c00e) pop af pop af pop af ret z88dk-1.8.ds1/libsrc/rex/DbFindRecord.asm0000644000175000017500000000203407457364561017567 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: DbFindRecord.asm,v 1.3 2002/04/17 21:30:25 dom Exp $ ; ; extern INT DbFindRecord(int, char, char, ... ); ; ; Written by Damjan Marion XLIB DbFindRecord .DbFindRecord sub 3 ;except 1st 3 params ld b,a ld ix,2 add ix,sp .DbFindRecord_1 ld l,(ix+0) ld h,(ix+1) push hl inc ix inc ix djnz DbFindRecord_1 ;repush args in REX order ld hl,0 add hl,sp push hl ld hl,0 add hl,sp ld ($c008),hl ; param 5 - points to pointer to other parameters ld l,(ix+0) ld h,0 ld ($c006),hl ; param 4 inc ix inc ix ld l,(ix+0) ld h,0 ld ($c004),hl ; param 2 inc ix inc ix ld l,(ix+0) ld h,(ix+1) ld ($c002),hl ; param 1 ld de,$00e0 ;DB_FINDRECORD ld ($c000),de push af ; save number of args rst $10 pop af pop hl ;get parameters from stack ld b,a .DbFindRecord_2 pop ix djnz DbFindRecord_2 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/DbGetRecordCount.asm0000644000175000017500000000077407457364561020450 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: DbGetRecordCount.asm,v 1.3 2002/04/17 21:30:25 dom Exp $ ; ; extern unsigned long DbGetRecordCount( int ); ; ; Written by Damjan Marion XLIB DbGetRecordCount .DbGetRecordCount pop ix pop hl push hl push ix ld de,$00ee ;DB_GETRECORDCOUNT ld ($c000),de ld ($c002),hl ; param 1 ld hl,0 push hl push hl add hl,sp ld ($c004),hl ; param 2, ptr to long rst $10 pop hl pop de ret z88dk-1.8.ds1/libsrc/rex/DbInsertRecord.asm0000644000175000017500000000121307327235717020145 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: DbInsertRecord.asm,v 1.1 2001/07/24 09:11:43 dmarion Exp $ ; ; extern INT DbInsertRecord( int, ... ); ; XLIB DbInsertRecord .DbInsertRecord ld b,a ld ix,2 add ix,sp .DbInsertRecord_1 ld l,(ix+0) ld h,(ix+1) push hl inc ix inc ix djnz DbInsertRecord_1 ld de,$00d8 ;DB_INSERTRECORD ld ($c000),de ld ($c002),hl ld hl,2 add hl,sp push hl ld hl,0 add hl,sp ld ($c004),hl push af rst $10 pop af pop hl ld b,a .DbInsertRecord_2 pop ix djnz DbInsertRecord_2 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/DbInsertText.asm0000644000175000017500000000101007457364561017652 0ustar tygrystygrys; ; Database Call for REX6000 ; ; DbInsertText ; ; $Id: DbInsertText.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ XLIB DbInsertText .DbInsertText ld ix,2 add ix,sp ld l,(ix+0) ld h,(ix+1) push hl ld hl,$0002 push hl ld hl,$0000 push hl add hl,sp ld ($c00a),hl ld l,(ix+2) ld h,(ix+3) ld ($c008),hl ld l,(ix+4) ld h,(ix+5) ld ($c006),hl ld l,(ix+6) ld h,(ix+7) ld ($c004),hl ld l,(ix+8) ld h,(ix+9) ld ($c002),hl ld hl,$00ea ld ($c000),hl rst $10 ld hl,($c00e) pop af pop af pop af ret z88dk-1.8.ds1/libsrc/rex/DbReadField.asm0000644000175000017500000000177007344726040017362 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: DbReadField.asm,v 1.2 2001/09/03 16:13:20 dom Exp $ ; ; extern INT DbReadField(int, int, ... ); ; ; Written by Damjan Marion XLIB DbReadField .DbReadField sub 2 ;except 1st 2 params ld b,a ld ix,2 add ix,sp ld hl,0 push hl ; probably page address .DbReadField_1 ld l,(ix+0) ld h,(ix+1) push hl inc ix inc ix djnz DbReadField_1 ;repush args in REX order ld hl,0 add hl,sp push hl ld hl,0 add hl,sp ld ($c006),hl ; param 4 - points to pointer to other parameters ld l,(ix+0) ld h,(ix+1) ld ($c004),hl ; param 3 inc ix inc ix ld l,(ix+0) ld h,(ix+1) ld ($c002),hl ; param 2 ld de,$00de ;DB_FINDRECORD ld ($c000),de push af ; save number of args rst $10 pop af pop hl ;get parameters from stack ld b,a .DbReadField_2 pop ix djnz DbReadField_2 pop hl ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/DbReadRecord.asm0000644000175000017500000000117107327235511017547 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: DbReadRecord.asm,v 1.1 2001/07/24 09:09:29 dmarion Exp $ ; ; extern INT DbReadRecord( int, ... ); ; XLIB DbReadRecord .DbReadRecord ld b,a ld ix,2 add ix,sp .DbReadRecord_1 ld l,(ix+0) ld h,(ix+1) push hl inc ix inc ix djnz DbReadRecord_1 ld de,$00dc ;DB_READRECORD ld ($c000),de ld ($c002),hl ld hl,2 add hl,sp push hl ld hl,0 add hl,sp ld ($c004),hl push af rst $10 pop af pop hl ld b,a .DbReadRecord_2 pop ix djnz DbReadRecord_2 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/DbReadText.asm0000644000175000017500000000103407457364561017267 0ustar tygrystygrys; ; Database Call for REX6000 ; ; DbReadText ; ; $Id: DbReadText.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ XLIB DbReadText .DbReadText ld ix,2 add ix,sp ld l,(ix+0) ld h,(ix+1) push hl ld hl,$0001 push hl ld l,(ix+2) ld h,(ix+3) push hl ld hl,$0000 add hl,sp ld ($c00a),hl ld l,(ix+4) ld h,(ix+5) ld ($c008),hl ld l,(ix+6) ld h,(ix+7) ld ($c006),hl ld l,(ix+8) ld h,(ix+9) ld ($c004),hl ld l,(ix+10) ld h,(ix+11) ld ($c002),hl ld hl,$00ea ld ($c000),hl rst $10 ld hl,($c00e) pop af pop af pop af ret z88dk-1.8.ds1/libsrc/rex/DbUpdateField.asm0000644000175000017500000000170307344726040017725 0ustar tygrystygrys; ; Database Call for REX6000 ; ; DbUpdateField ; ; $Id: DbUpdateField.asm,v 1.1 2001/09/03 16:13:20 dom Exp $ XLIB DbUpdateField .DbUpdateField sub 2 ;except 1st 2 params ld b,a ld ix,2 add ix,sp ld hl,0 push hl ; probably page address .DbUpdateField_1 ld l,(ix+0) ld h,(ix+1) push hl inc ix inc ix djnz DbUpdateField_1 ;repush args in REX order ld hl,0 add hl,sp push hl ld hl,0 add hl,sp ld ($c006),hl ; param 4 - points to pointer to other parameters ld l,(ix+0) ld h,(ix+1) ld ($c004),hl ; param 3 inc ix inc ix ld l,(ix+0) ld h,(ix+1) ld ($c002),hl ; param 2 ld de,$00e8 ;DB_UPDATERECORD ld ($c000),de push af ; save number of args rst $10 pop af pop hl ;get parameters from stack ld b,a .DbUpdateField_2 pop ix djnz DbUpdateField_2 pop hl ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/DbUpdateRecord.asm0000644000175000017500000000121307327235670020121 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: DbUpdateRecord.asm,v 1.1 2001/07/24 09:11:20 dmarion Exp $ ; ; extern INT DbUpdateRecord( int, ... ); ; XLIB DbUpdateRecord .DbUpdateRecord ld b,a ld ix,2 add ix,sp .DbUpdateRecord_1 ld l,(ix+0) ld h,(ix+1) push hl inc ix inc ix djnz DbUpdateRecord_1 ld de,$00e6 ;DB_UPDATERECORD ld ($c000),de ld ($c002),hl ld hl,2 add hl,sp push hl ld hl,0 add hl,sp ld ($c004),hl push af rst $10 pop af pop hl ld b,a .DbUpdateRecord_2 pop ix djnz DbUpdateRecord_2 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/DsPrintf.asm0000644000175000017500000000212607457364561017035 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: DsPrintf.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ ; ; DsPrintf (int, int, int, char*) ; ; Written by Damjan Marion XLIB DsPrintf LIB syscallex .DsPrintf ld ix,$08 add ix,sp ld hl,$0330 push hl ld l,(ix+0) ; x ld h,(ix+1) push hl dec ix dec ix ld l,(ix+0) ; y ld h,(ix+1) push hl ld hl,$FFFF ; dummy push hl dec ix dec ix ld l,(ix+0) ; font ld h,(ix+1) push hl dec ix dec ix ld l,(ix+0) ; string ld h,(ix+1) push hl ld a,h ld hl,0 and a,$e0 ; compare if points to $8000-$9FFF add a,$80 jp NZ,DsPrintf_1 in a,(1) ; load mem page of addin code ld l,a .DsPrintf_1 push hl ld a,7 call syscallex ld hl,14 add hl,sp ld sp,hl ret z88dk-1.8.ds1/libsrc/rex/DsPrintfe.asm0000644000175000017500000000572107457364561017206 0ustar tygrystygrys; ; System Call for REX6000 ; ; ported from Rix Myles' SDK ; Unfortunately, I've found no other way to rewrite the ; function for the emulator. Daniel ; ; $Id: DsPrintfe.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ XLIB DsPrintfe .DsPrintfe call saveRegAlloc DEFW $ffb0 ld c,(ix+$08) ld b,(ix+$09) ; BC = source ld hl,$0000 add hl,sp ex de,hl ; DE= dest (=stack pointer) call strcpyn ; copy string from BC to DE (ie onto stack) ld hl,$0066 push hl ld l,(ix+$0e) ld h,(ix+$0f) push hl ; x ld l,(ix+$0c) ld h,(ix+$0d) push hl ; y ld hl,$0028 push hl ; 40 ld hl,$0001 push hl ; mode ld hl,$0000 add hl,sp ld de,$000a add hl,de push hl ; pointer to string call syscall5_1 ex de,hl ld hl,$000e add hl,sp ld sp,hl ex de,hl jp restoreReg jp end .saveRegAlloc pop hl ; HL = ret addr. push bc push de push ix ld ix,$0000 add ix,sp ; ix=sp ld e,(hl) ; get NNNNlo inc hl ld d,(hl) ; get NNNNhi inc hl ex de,hl ; de=return address add hl,sp ; adjust SP according to NNNN ld sp,hl ; Stack point is NNNN bytes further down than before ex de,hl ; hl=return address jp (hl) .strcpyn call saveReg ld e,c ld d,b ld l,(ix+$02) ld h,(ix+$03) push af push hl push de push bc xor a ex de,hl .sloop cp (hl) ldi ; (hl) -> (de), til bc==0 or (hl)==0 jr nz,sloop pop bc pop de pop hl pop af jp restoreReg .saveReg pop hl push bc push de push ix ld ix,$0000 add ix,sp jp (hl) .restoreReg ld sp,ix pop ix pop de pop bc ret .syscall5_1 call saveReg ld l,(ix+$12) ld h,(ix+$13) ld ($c000),hl ; System call number ld l,(ix+$10) ld h,(ix+$11) ld ($c002),hl ; Param 1 ld l,(ix+$0e) ld h,(ix+$0f) ld ($c004),hl ; Param 2 ld l,(ix+$0c) ld h,(ix+$0d) ld ($c006),hl ; Param 3 ld l,(ix+$0a) ld h,(ix+$0b) ld ($c008),hl ; Param 4 ld l,(ix+$08) ld h,(ix+$09) ld ($c00a),hl ; Param 5 rst $10 ld hl,$c00e ld b,(hl) inc hl ld h,(hl) ld l,b jp restoreReg .end ret z88dk-1.8.ds1/libsrc/rex/DsTrace.asm0000644000175000017500000000071307422007720016610 0ustar tygrystygrys ; Trace function for REX6000 emulator ; ; written by Daniel Schmidt XLIB DsTrace .DsTrace ld d,a ;we need to reverse the param order first ld b,d ld ix,2 add ix,sp .trace_1 ld l,(ix+0) ld h,(ix+1) push hl inc ix inc ix djnz trace_1 call trace_3 ;the emulator needs this dummy call in ;order to recognize the trace statement ld b,d .trace_2 pop ix djnz trace_2 ret .trace_3 ld a,0 out ($fe),a ret z88dk-1.8.ds1/libsrc/rex/farcall/0000755000175000017500000000000010765202715016171 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rex/farcall/farcall.asm0000644000175000017500000000051007455116631020276 0ustar tygrystygrys; ; Far Call for REX6000 ; ; FarCall function to call code in other mem pages ; Daniel ; ; $Id: farcall.asm,v 1.3 2002/04/10 20:16:25 dom Exp $ ; XLIB farcall .farcall pop hl ;return addr pop bc ;Lib page pop de ;LibMain addr push de push bc push hl in a,(1) ld h,0 ld l,a push hl push de ld a,c jp $26ea z88dk-1.8.ds1/libsrc/rex/farcall/farcalld.asm0000644000175000017500000000031307455116631020443 0ustar tygrystygrys; ; Far Call for REX6000 ; ; FarCall function to call code in other mem pages ; Daniel ; ; $Id: farcalld.asm,v 1.2 2002/04/10 20:16:25 dom Exp $ ; XLIB farcalld LIB farcall .farcalld jp farcall z88dk-1.8.ds1/libsrc/rex/farcall/findlib.asm0000644000175000017500000000341107534156166020311 0ustar tygrystygrys; ; written by Waleed Hasan ; ; Fixed list of pages (were off by 4) ; Graham R. Cobb 19 May 2002 XLIB findlib .findlib pop hl ; ret addr pop de ; &signature to look for push de push hl ; ;ASM entry point ; i/p : DE = points to signature to look for (zero terminated) ; o/p : HL = library page ; = -1 if not found ; .findlib_asm ; save old bank2 values ld c,3 ; c=3 in l,(c) inc c ; c=4 in h,(c) push hl ; REGISTER_WRITE(REG_BANK2_HI, 0x00); xor a out (c),a ; c=4 ; for(i=0; i<25; i++) ld hl,_pages dec c ; c=3 .PagLoop ; REGISTER_WRITE(REG_BANK2_LO, pages[i]); ld a,(hl) and a ; is it pages end-marker? jr z,LibNotFound out (c),a ; c=3 push hl ; save pages[] push de ; we should save &sig ld hl,$A003 ; &SIGnature in library ; de already = &sig .SigLoop ld a,(de) and a ; end of seg? jr z,LibFound ; yes - we found it! cp (hl) jr nz,ChkNxtPag inc hl ; next SIG char inc de ; next sig char jr SigLoop .LibFound ; we found the library pop de ; &sig pop hl ; the page in ld a,(hl) sub 4 ; Page[i]-4 ld h,0 ld l,a jr end .ChkNxtPag pop de ; &sig pop hl ; get pages[] inc hl ; next page jr PagLoop .LibNotFound ld hl,-1 ; page not found .end pop de ; restore old bank2 values ld c,3 ; c=3 out (c),e inc c ; c=4 out (c),d ret ._pages ; We first search the pages loaded by Adder defb 26,27,28 defb 47,77,81,92,102 defb 124,125,126 defb 136,137,138,139,140,141 ; Then a couple of pages that Adder does not load today but might in ; the future defb 142,143 defb 127,69,70,71,84,85,86,97 ; Web/Calc/Clock pages ; We check the standard addin slots last because addins copied ; using Adder are not deleted until overwritten defb 128,129,130,131,132,133,134,135 defb 0 ; pages end-marker z88dk-1.8.ds1/libsrc/rex/farcall/Makefile0000644000175000017500000000005307555321702017630 0ustar tygrystygrys all: clean: $(RM) *.o* zcc_opt.def z88dk-1.8.ds1/libsrc/rex/graphics/0000755000175000017500000000000010765202715016365 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rex/graphics/DsClearScreen.asm0000644000175000017500000000057307634116556021561 0ustar tygrystygrys; ; written by Benjamin Green, adapting code from Waleed Hasan ; ; $Id: DsClearScreen.asm,v 1.3 2003/03/13 15:02:06 dom Exp $ ; XLIB DsClearScreen .DsClearScreen ; in a,(3) ; ld l,a ; in a,(4) ; ld h,a ; push hl ld a,$10 out (4),a xor a out (3),a ld de,$A001 ld h,d ld l,a ld bc,30*120-1 ld (hl),a ldir ; pop hl ; ld a,l ; out (3),a ; ld a,h ; out (4),a ret z88dk-1.8.ds1/libsrc/rex/graphics/DsDisplayCircle.asm0000644000175000017500000000176407634116557022126 0ustar tygrystygrys; ; written by Waleed Hasan ; ; $Id: DsDisplayCircle.asm,v 1.2 2003/03/13 15:02:07 dom Exp $ ; XLIB DsDisplayCircle LIB set4pix LIB setpixsave .DsDisplayCircle pop bc ;ret addr pop hl ;r ld d,l ; b=r pop hl ;yc ld e,l ; e=yc pop hl ;xc push bc push bc push bc push bc ld b,l ld c,e ; ASM Circle draw ; ASM - entry point ; i/p : B=xc, C=yc, D=r, H=0 ; uses : AF,BC,HL,DE .circle ; x=0; h=0 alrady! ld l,d ; y=r; srl d ; a=r>>1 .loop push de call set4pix ld a,b add a,l ld d,a ld a,c add a,h ld e,a call setpixsave ;PIX(xc+y,yc+x) ld a,b sub l ld d,a call setpixsave ;PIX(xc-y,yc+x) ld a,c sub h ld e,a call setpixsave ;PIX(xc-y,yc-x) ld a,b add a,l ld d,a call setpixsave ;PIX(xc+y,yc-x) inc h ;x++; pop de ld a,d sub h ld d,a ;a-=x; bit 7,d jr z, NextLoop ;if(a>=0) ;{ add a,l ld d,a ;a+=y dec l ;y--; ;} .NextLoop ;this test should go up! ld a,h ;for(;x<=y;) sub l jr c,loop jr z,loop ret z88dk-1.8.ds1/libsrc/rex/graphics/DsDisplayEllipse.c0000644000175000017500000000137307634116557021760 0ustar tygrystygrys /* (partial) ASM ellipse drawing routine By Waleed Hasan - 11Jan2002 This is not in full assembly, but calling the asm set_4_pix saved some bytes & made the ellipse drawing faster $Id: DsDisplayEllipse.c,v 1.2 2003/03/13 15:02:07 dom Exp $ */ #asm LIB ellset4pix .DsDisplayEllipse #endasm void DsDisplayEllipse(xc, yc, a0, b0) int xc, yc, a0, b0; { long a=a0,b=b0; int x=0,y=b0; long asq=a*a,tasq=asq<<1; long bsq=b*b,tbsq=bsq<<1; long d=bsq-asq*b+asq>>2,dx=0,dy=tasq*b; while(dx0L) {y--;dy-=tasq;d-=dy;} x++;dx+=tbsq;d+=bsq+dx; } d+=(3L*(asq-bsq)>>1-(dx+dy))>>1; while(y>=0) { #asm call ellset4pix #endasm if(d<0L) {x++;dx+=tbsq;d+=dx;} y--;dy-=tasq;d+=asq-dy; } } z88dk-1.8.ds1/libsrc/rex/graphics/DsFillScreen.asm0000644000175000017500000000117207634116560021410 0ustar tygrystygrys; ; written by Waleed Hasan ; ; $Id;$ ; XLIB DsFillScreen .DsFillScreen ; ; LCD memory pattern fill ; C - entry point pop bc pop hl ld d,l push bc push bc ; ; LCD memory pattern fill ; ASM - entry point ; ; i/p : d = fill pattern ; uses : AF,BC,HL,DE ; in a,(3) ; ld l,a ; in a,(4) ; ld h,a ; push hl ld a,$10 out (4),a xor a out (3),a ld hl,$a000 ld e,1 ; pattern mask ld b,120 ; number of lines .scrFillLoop push bc ld b,30 .scrFillLine ld a,d and e jr z,skipFill ld (hl),d .skipFill inc hl djnz scrFillLine pop bc rlc e djnz scrFillLoop ; pop hl ; ld a,l ; out (3),a ; ld a,h ; out (4),a ret z88dk-1.8.ds1/libsrc/rex/graphics/DsGetPixelAddr.asm0000644000175000017500000000042607634116560021677 0ustar tygrystygrys; ; written by Waleed Hasan ; ; $Id;$ XLIB DsGetPixelAddr LIB pixaddr .DsGetPixelAddr pop de ;ret addr. pop bc ;&bit pop hl ;y ld a,l ; a=y pop hl ;x ; l=x push de push de push de push de ld d,l ; d=x ld e,a ; e=y ld a,l and $07 jp pixaddr z88dk-1.8.ds1/libsrc/rex/graphics/DsSetPixel.asm0000644000175000017500000000030607634116560021115 0ustar tygrystygrys; ; written by Waleed Hasan ; ; $Id;$ XLIB DsSetPixel LIB setpix .DsSetPixel pop bc ;ret addr. pop hl ;y ld e,l ; e=y pop hl ;x ld d,l ; d=x push bc push bc push bc jp setpix z88dk-1.8.ds1/libsrc/rex/graphics/ellset4pix.asm0000644000175000017500000000050107634116561021164 0ustar tygrystygrys; ; written by Waleed Hasan ; ; $Id: ellset4pix.asm,v 1.2 2003/03/13 15:02:09 dom Exp $ XLIB ellset4pix LIB set4pix .ellset4pix ld hl,32 add hl,sp ld d,(hl) ;x dec hl dec hl ld e,(hl) ;y ld hl,50 add hl,sp ld b,(hl) ;B=xc dec hl dec hl ld c,(hl) ;C=yc ex de,hl ;H=x ;L=y jp set4pix z88dk-1.8.ds1/libsrc/rex/graphics/Makefile0000644000175000017500000000036310445312213020015 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.4 2006/06/18 17:59:39 dom Exp $ include ../../Make.config all: DsDisplayEllipse.o .c.o: zcc +rex $(CFLAGS) $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* z88dk-1.8.ds1/libsrc/rex/graphics/pixaddr.asm0000644000175000017500000000133707634116561020532 0ustar tygrystygrys; ; written by Waleed Hasan ; ; $Id: pixaddr.asm,v 1.2 2003/03/13 15:02:09 dom Exp $ XLIB pixaddr ; ; LCD memory pixel addres ; ASM - entry point ; ; i/p : D=x E=y ; uses : AF,BC,HL,DE ; o/p : HL=LCD memory byte address C=pixel bit .pixaddr ld c,$80 ld a,d and $07 ld b,a jr z,SkpShft .ShftOne srl c djnz ShftOne .SkpShft ; c = pixel bit. ld a,d srl a srl a srl a ; a = pixel byte ld h,b ld l,e ; HL = Y ld d,h ; DE = Y ; ;we need to multiply Y by 30 ; add hl,hl ; HL = 2*Y add hl,hl ; HL = 4*Y add hl,hl ; HL = 8*Y add hl,hl ; HL = 16*Y sbc hl,de ; HL = 15*Y add hl,hl ; HL = 30*Y ld de,$a000 add hl,de ld e,a ld d,0 add hl,de ; hl = memory address ; c = pixel bit ret z88dk-1.8.ds1/libsrc/rex/graphics/set4pix.asm0000644000175000017500000000061307634116561020473 0ustar tygrystygrys; ; written by Waleed Hasan ; ; $Id: set4pix.asm,v 1.2 2003/03/13 15:02:09 dom Exp $ XLIB set4pix LIB setpixsave .set4pix ld a,b add a,h ld d,a ld a,c add a,l ld e,a call setpixsave ;PIX(xc+x,yc+y) ld a,b sub h ld d,a call setpixsave ;PIX(xc-x,yc+y) ld a,c sub l ld e,a call setpixsave ;PIX(xc-x,yc-y) ld a,b add a,h ld d,a call setpixsave ;PIX(xc+x,yc-y) ret z88dk-1.8.ds1/libsrc/rex/graphics/setpix.asm0000644000175000017500000000062307634116562020411 0ustar tygrystygrys; ; written by Waleed Hasan ; ; $Id: setpix.asm,v 1.2 2003/03/13 15:02:10 dom Exp $ ; XLIB setpix LIB pixaddr ; ; direct LCD pixel plot ; ASM entry point ; ; i/p : D=x E=y ; uses : AF,BC,HL,DE ; .setpix ; in a,(3) ; ld l,a ; in a,(4) ; ld h,a ; push hl ld a,$10 out (4),a xor a out (3),a call pixaddr ld a,c or (hl) ld (hl),a ; pop hl ; ld a,l ; out (3),a ; ld a,h ; out (4),a ret z88dk-1.8.ds1/libsrc/rex/graphics/setpixsave.asm0000644000175000017500000000031707634116562021270 0ustar tygrystygrys; ; written by Waleed Hasan ; ; $Id: setpixsave.asm,v 1.2 2003/03/13 15:02:10 dom Exp $ XLIB setpixsave LIB setpix .setpixsave push hl push de push bc call setpix pop bc pop de pop hl ret z88dk-1.8.ds1/libsrc/rex/input8.asm0000644000175000017500000000030607457364561016531 0ustar tygrystygrys; ; Input8 -read in from a port ; ; djm 7/3/2001 ; ; $Id: input8.asm,v 1.3 2002/04/17 21:30:25 dom Exp $ XLIB input8 .input8 pop hl pop bc push bc push hl in a,(c) ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/rex/Makefile0000644000175000017500000000031410445312213016211 0ustar tygrystygrys include ../Make.config all: cd graphics ; $(MAKE) ; cd .. .c.o: zcc +rex $(CFLAGS) $*.c clean: $(RM) *.o* *~ zcc_opt.def cd graphics ; $(MAKE) clean ; cd .. cd farcall ; $(MAKE) clean ; cd .. z88dk-1.8.ds1/libsrc/rex/output8.asm0000644000175000017500000000036007457364561016732 0ustar tygrystygrys; ; Input8 -read in from a port ; ; djm 7/3/2001 ; ; $Id: output8.asm,v 1.3 2002/04/17 21:30:25 dom Exp $ XLIB output8 .output8 pop hl pop de ;value pop bc ;port push bc push de push hl ld a,e out (c),a ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/rex/README0000644000175000017500000000031107344726040015441 0ustar tygrystygrysXircom Rex 6000 support. Originally written by dom@jadara.org.uk, overhauled by Damjan Marion in June 2001 - and reported working Added work by Daniel Schmidt z88dk-1.8.ds1/libsrc/rex/syscall0.asm0000644000175000017500000000031607457364561017035 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: syscall0.asm,v 1.3 2002/04/17 21:30:25 dom Exp $ XLIB syscall0 .syscall0 pop bc pop hl ;parameter push hl push bc ld ($c000),hl rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscall1.asm0000644000175000017500000000037507457364561017043 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: syscall1.asm,v 1.5 2002/04/17 21:30:25 dom Exp $ ; XLIB syscall1 .syscall1 pop bc pop de ;parameter pop hl ;call number push hl push de push bc ld ($c000),hl ld ($c002),de rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscall1p.asm0000644000175000017500000000114607457364561017220 0ustar tygrystygrys; ; System Call for REX6000 ; ; I've never tested this function, hope it works. Daniel ; ; $Id: syscall1p.asm,v 1.3 2002/04/17 21:30:25 dom Exp $ XLIB syscall1p .syscall1p pop bc pop de ;parameter pop hl ;call number push hl push de push bc ld ($c000),hl ld ($c002),de ld a,h ld hl,0 and a,$e0 ; compare if points to $8000-$9FFF add a,$80 jp Z, syscall1p_1 in a,(1) ; load mem page of addin code ld l,a .syscall1p_1 ld ($c004),hl ;par 2 rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscall2.asm0000644000175000017500000000046707457364561017046 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: syscall2.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; XLIB syscall2 .syscall2 ld ix,2 add ix,sp ld l,(ix+0) ;par 2 ld h,(ix+1) ld ($c004),hl ld l,(ix+2) ;par 1 ld h,(ix+3) ld ($c002),hl ld l,(ix+4) ;call ld h,(ix+5) ld ($c000),hl rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscall3.asm0000644000175000017500000000054707457364561017046 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: syscall3.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; XLIB syscall3 .syscall3 ld ix,2 add ix,sp ld l,(ix+0) ;par 3 ld h,(ix+1) ld ($c006),hl ld l,(ix+2) ;par 2 ld h,(ix+3) ld ($c004),hl ld l,(ix+4) ;par 1 ld h,(ix+5) ld ($c002),hl ld l,(ix+6) ;call ld h,(ix+7) ld ($c000),hl rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscall4.asm0000644000175000017500000000062707457364561017046 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: syscall4.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; XLIB syscall4 .syscall4 ld ix,2 add ix,sp ld l,(ix+0) ;par 4 ld h,(ix+1) ld ($c008),hl ld l,(ix+2) ;par 3 ld h,(ix+3) ld ($c006),hl ld l,(ix+4) ;par 2 ld h,(ix+5) ld ($c004),hl ld l,(ix+6) ;par 1 ld h,(ix+7) ld ($c002),hl ld l,(ix+8) ;call ld h,(ix+9) ld ($c000),hl rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscall4d.asm0000644000175000017500000000114007457364561017201 0ustar tygrystygrys; ; System Call for REX6000 ; ; ; simply rewritten the function with Damjan's algorithm ; Daniel ; ; $Id: syscall4d.asm,v 1.3 2002/04/17 21:30:25 dom Exp $ XLIB syscall4d .syscall4d ld ix,2 add ix,sp ld l,(ix+0) ;par 4 ld h,(ix+1) ld ($c00a),hl ld l,(ix+2) ld h,(ix+3) ld ($c006),hl ;par 3 ld a,h ld hl,0 in a,(1) ; load mem page of addin code ld l,a ld ($c008),hl ld l,(ix+4) ;par 2 ld h,(ix+5) ld ($c004),hl ld l,(ix+6) ;par 1 ld h,(ix+7) ld ($c002),hl ld l,(ix+8) ;call ld h,(ix+9) ld ($c000),hl rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscall5.asm0000644000175000017500000000071107457364561017041 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: syscall5.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; XLIB syscall5 .syscall5 ld ix,2 add ix,sp ld l,(ix+0) ;par 5 ld h,(ix+1) ld ($c00a),hl ld l,(ix+2) ;par 4 ld h,(ix+3) ld ($c008),hl ld l,(ix+4) ;par 3 ld h,(ix+5) ld ($c006),hl ld l,(ix+6) ;par 2 ld h,(ix+7) ld ($c004),hl ld l,(ix+8) ;par 1 ld h,(ix+9) ld ($c002),hl ld l,(ix+10) ;call ld h,(ix+11) ld ($c000),hl rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscall5p.asm0000644000175000017500000000216207457364561017223 0ustar tygrystygrys; ; System Call for REX6000 ; ; never tested this function ; again with Damjan's algorithm ; Daniel ; ; $Id: syscall5p.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ XLIB syscall5p .syscall5p ld ix,2 add ix,sp ld l,(ix+0) ;par 5 ld h,(ix+1) ld ($c00a),hl ld a,h ld hl,0 and a,$e0 ; compare if points to $8000-$9FFF add a,$80 jp Z, syscall5p_1 in a,(1) ; load mem page of addin code ld l,a .syscall5p_1 ld ($c00c),hl ;par 6 ld l,(ix+2) ;par 4 ld h,(ix+3) ld ($c008),hl ld l,(ix+4) ;par 3 ld h,(ix+5) ld ($c006),hl ld l,(ix+6) ;par 2 ld h,(ix+7) ld ($c004),hl ld l,(ix+8) ;par 1 ld h,(ix+9) ld ($c002),hl ld l,(ix+10) ;call ld h,(ix+11) ld ($c000),hl rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscall6.asm0000644000175000017500000000077307457364561017052 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: syscall6.asm,v 1.4 2002/04/17 21:30:25 dom Exp $ ; XLIB syscall6 .syscall6 ld ix,2 add ix,sp ld l,(ix+0) ;par 6 ld h,(ix+1) ld ($c00c),hl ld l,(ix+2) ;par 5 ld h,(ix+3) ld ($c00a),hl ld l,(ix+4) ;par 4 ld h,(ix+5) ld ($c008),hl ld l,(ix+6) ;par 3 ld h,(ix+7) ld ($c006),hl ld l,(ix+8) ;par 2 ld h,(ix+9) ld ($c004),hl ld l,(ix+10) ;par 1 ld h,(ix+11) ld ($c002),hl ld l,(ix+12) ;call ld h,(ix+13) ld ($c000),hl rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscall6p.asm0000644000175000017500000000221307457364561017221 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: syscall6p.asm,v 1.5 2002/04/17 21:30:25 dom Exp $ ; ; XLIB syscall6p .syscall6p ld ix,2 add ix,sp ld l,(ix+0) ;par 6 ld h,(ix+1) ld ($c00c),hl ld a,h ld hl,0 and a,$e0 ; compare if points to $8000-$9FFF add a,$80 jp NZ, syscall6p_1 in a,(1) ; load mem page of addin code ld l,a .syscall6p_1 ld ($c00e),hl ;par 7 ld l,(ix+2) ;par 5 ld h,(ix+3) ld ($c00a),hl ld l,(ix+4) ;par 4 ld h,(ix+5) ld ($c008),hl ld l,(ix+6) ;par 3 ld h,(ix+7) ld ($c006),hl ld l,(ix+8) ;par 2 ld h,(ix+9) ld ($c004),hl ld l,(ix+10) ;par 1 ld h,(ix+11) ld ($c002),hl ld l,(ix+12) ;call ld h,(ix+13) ld ($c000),hl rst $10 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscallex.asm0000644000175000017500000000117307457364561017314 0ustar tygrystygrys; ; System Call for REX6000 ; ; $Id: syscallex.asm,v 1.7 2002/04/17 21:30:25 dom Exp $ ; ; extern INT SYSCALLEX( int, ... ); ; ; Latest version from Damjan..it works. ; XLIB syscallex .syscallex ld b,a ld ix,2 add ix,sp .syscallex_1 ld l,(ix+0) ld h,(ix+1) push hl inc ix inc ix djnz syscallex_1 ld de,$00ce ld ($c000),de ld ($c002),hl ld hl,2 add hl,sp push hl ld hl,0 add hl,sp ld ($c004),hl push af rst $10 pop af pop hl ld b,a .syscallex_2 pop ix djnz syscallex_2 ld hl,($c00e) ret z88dk-1.8.ds1/libsrc/rex/syscallexl.asm0000644000175000017500000000211507457364561017465 0ustar tygrystygrys; ; System Call for REX6000 ; ; ; extern LONG SYSCALLEXL( int, ... ); ; ; $Id: syscallexl.asm,v 1.5 2002/04/17 21:30:25 dom Exp $ XLIB syscallexl ; we supply a pointer to a pointer to the args push'd ; ; We need to repush our arguments in the correct order (well, correct for ; the SDK) ; .syscallexl ld b,a ;number of parameters give add a,a ld e,a ld d,0 ld ix,0 add ix,sp add ix,de ;hl now points to first given parameter i.e. syscall ld e,(ix+0) ld d,(ix+1) ld ($c002),de ;store the actual syscall we want dec ix dec ix dec b ;now holds number of parameters left ; Now we have to get the parameters in the correct order ld c,b ;number of parameters - keep it safe! .syscallexl1 ld l,(ix+0) ld h,(ix+1) push hl dec ix dec ix djnz syscallexl1 ld b,0 push bc pop ix ;get number of stack ld hl,0 add hl,sp ;address of our parameters ld ($c004),hl ld hl,$00ce ;DS_SYSCALL_EXTENDED ld ($c000),hl rst $10 ;ix survives the call ld b,ixl ;terrible inefficient, but I'm lazy .syscallexl2 pop de djnz syscallexl2 ld hl,($c00e) ld de,($c010) ;who knows ret z88dk-1.8.ds1/libsrc/rex/WHmath/0000755000175000017500000000000010765202715015755 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rex6000.lst0000644000175000017500000000547510712620314015621 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp rex/DsPrintf rex/DsPrintfe rex/input8 rex/output8 rex/syscall0 rex/syscall1 rex/syscall1p rex/syscall2 rex/syscall3 rex/syscall4 rex/syscall4d rex/syscall5 rex/syscall5p rex/syscall6 rex/syscall6p rex/syscallex rex/syscallexl rex/DbFindRecord rex/DbGetRecordCount rex/DbReadField rex/DbUpdateField rex/DbInsertRecord rex/DbReadRecord rex/DbUpdateRecord rex/DbReadText rex/DbInsertText rex/DbDeleteText rex/DsTrace rex/farcall/farcall rex/farcall/farcalld rex/farcall/findlib rex/graphics/pixaddr rex/graphics/setpix rex/graphics/setpixsave rex/graphics/set4pix rex/graphics/ellset4pix rex/graphics/DsClearScreen rex/graphics/DsFillScreen rex/graphics/DsGetPixelAddr rex/graphics/DsSetPixel rex/graphics/DsDisplayCircle rex/graphics/DsDisplayEllipse setjmp/longjmp setjmp/setjmp z88dk-1.8.ds1/libsrc/rs232/0000755000175000017500000000000010765202715014642 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rs232/Makefile0000644000175000017500000000031510307441272016274 0ustar tygrystygrys# $Id: Makefile,v 1.4 2005/09/07 01:30:34 aralbrec Exp $ lzx: cd spectrum ; $(MAKE) ; cd .. lz88: cd z88 ; $(MAKE) ; cd .. clean: cd z88 ; $(MAKE) clean ; cd .. cd spectrum ; $(MAKE) clean ; cd .. z88dk-1.8.ds1/libsrc/rs232/spectrum/0000755000175000017500000000000010765202715016504 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rs232/spectrum/if1/0000755000175000017500000000000010765202715017163 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rs232/spectrum/if1/if1list0000644000175000017500000000007507473154352020470 0ustar tygrystygrysrs232_close rs232_get rs232_init rs232_params rs232_put z88dk-1.8.ds1/libsrc/rs232/spectrum/if1/Makefile0000644000175000017500000000070410763607711020627 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.8 2008/03/05 20:35:47 dom Exp $ include ../../../Make.config CFILES = rs232_close.c rs232_get.c rs232_init.c rs232_params.c rs232_put.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: $(OBJECTS) $(LIBLINKER) -x../../../$(OUTPUT_DIRECTORY)/rs232if1 @if1list .c.o: zcc +zx $(CFLAGS) $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* *~ *.err *.i $(AFILES) z88dk-1.8.ds1/libsrc/rs232/spectrum/if1/rs232_close.c0000644000175000017500000000033007472172727021375 0ustar tygrystygrys/* * z88dk RS232 Function * * ZX Spectrum (interface 1) version * * unsigned char rs232_close() * * Specify the serial interface parameters */ #include u8_t rs232_close() { return RS_ERR_OK; } z88dk-1.8.ds1/libsrc/rs232/spectrum/if1/rs232_get.c0000644000175000017500000000061707472172727021057 0ustar tygrystygrys/* * z88dk RS232 Function * * ZX Spectrum (interface 1) version * * unsigned char rs232_get(char *) * * Returns RS_ERROR_OVERFLOW on error (and sets carry) */ #include u8_t rs232_get(i8_t *char) { /* fastcall so implicit push */ #asm rst 8 defb $1d pop de ld hl,RS_ERR_OK jr nc,exitget ld (de),a ld hl,RS_ERR_NO_DATA .exitget push bc ;any rubbish will do #endasm } z88dk-1.8.ds1/libsrc/rs232/spectrum/if1/rs232_init.c0000644000175000017500000000066307472172727021244 0ustar tygrystygrys/* * z88dk RS232 Function * * ZX Spectrum (interface 1) version * * unsigned char rs232_init() * * Initialise the serial interface */ #include u8_t __FASTCALL__ rs232_init() { #asm rst 8 defb $31 ; Create the IF1 system variables area xor a ld ($5cc7),a ; Reset SER-FL to clean the input buffer ld a,(23624) ld (23750),a ; Set IOBORD to the current border colour (hide flashing) ld hl,RS_ERR_OK #endasm } z88dk-1.8.ds1/libsrc/rs232/spectrum/if1/rs232_params.c0000644000175000017500000000347007473154352021556 0ustar tygrystygrys/* * z88dk RS232 Function * * ZX Spectrum (interface 1) version * * unsigned char rs232_params(unsigned char param, unsigned char parity) * * Specify the serial interface parameters * * Later on, this should set panel values */ /* BAUD system variable: 23747 Value = (3500000/(26*BaudRate))-2 */ #include u8_t __FASTCALL__ rs232_params(unsigned char param, unsigned char parity) { #if 0 { /* Unfinished code */ unsigned u16_t baud; switch ( param & 0x0F ) { case RS_BAUD_50: baud = 50; break; case RS_BAUD_110: baud = 110; break; case RS_BAUD_300: baud = 300; break; case RS_BAUD_600: baud = 600; break; case RS_BAUD_1200: baud = 1200; break; case RS_BAUD_2400: baud = 2400; break; case RS_BAUD_4800: baud = 4800; break; case RS_BAUD_9600: baud = 9600; break; case RS_BAUD_19200: /* Not perfect but works */ baud = 19200; break; case RS_BAUD_38400: /* Let's try... ! */ baud = 38400; break; case RS_BAUD_57600: case RS_BAUD_115200: case RS_BAUD_230400: return RS_ERR_BAUD_TOO_FAST; default: case RS_BAUD_134_5: return RS_ERR_BAUD_NOT_AVAIL; } baud = (unsigned int) (3500000.0 / (26 * baud) ) - 2; rs232_setbaud(&baud); } /* { u8_t par; if ( ( parity & 0xE0) != RS_PAR_NONE) return RS_ERR_PARITY_NOT_AVAIL; switch ( parity ) { case RS_PAR_NONE: par = 'N'; break; case RS_PAR_ODD: par = 'O'; break; case RS_PAR_EVEN: par = 'E'; break; case RS_PAR_MARK: par = 'M'; break; case RS_PAR_SPACE: par = 'S'; break; } */ } #endif return RS_ERR_OK; } #if 0 static void rs232_setbaud(u16_t *baud) { #asm pop bc pop hl push hl push bc ld (23747),hl #endasm } #endif z88dk-1.8.ds1/libsrc/rs232/spectrum/if1/rs232_put.c0000644000175000017500000000051007472172727021100 0ustar tygrystygrys/* * z88dk RS232 Function * * ZX Spectrum (interface 1) version * * unsigned char rs232_put(char) * * No error checking, for now. */ #include u8_t rs232_put(i8_t char) { /* Fastcall so implicit push */ #asm ld a,l ;get byte rst 8 defb $1E ld hl,RS_ERR_OK pop bc ;remove implicit push ret #endasm } z88dk-1.8.ds1/libsrc/rs232/spectrum/Makefile0000644000175000017500000000051510307441272020140 0ustar tygrystygrys# # $Id: Makefile,v 1.5 2005/09/07 01:30:34 aralbrec Exp $ all: @echo '' @echo '---> Building +3 RS232 library <---' @echo '' cd plus3 ; $(MAKE) ; cd .. @echo '' @echo '---> Building Interface 1 RS232 library <---' @echo '' cd if1 ; $(MAKE) ; cd .. clean: cd plus3 ; $(MAKE) clean ; cd .. cd if1 ; $(MAKE) clean ; cd .. z88dk-1.8.ds1/libsrc/rs232/spectrum/plus3/0000755000175000017500000000000010765202715017552 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rs232/spectrum/plus3/Makefile0000644000175000017500000000070210763607712021215 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.8 2008/03/05 20:35:47 dom Exp $ include ../../../Make.config CFILES = rs232_close.c rs232_get.c rs232_init.c rs232_params.c rs232_put.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: $(OBJECTS) $(LIBLINKER) -x../../../$(OUTPUT_DIRECTORY)/rs232p3 @p3list .c.o: zcc +zx $(CFLAGS) $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* *~ *.err *.i $(AFILES) z88dk-1.8.ds1/libsrc/rs232/spectrum/plus3/p3list0000644000175000017500000000007507473154352020722 0ustar tygrystygrysrs232_close rs232_get rs232_init rs232_params rs232_put z88dk-1.8.ds1/libsrc/rs232/spectrum/plus3/rs232_close.c0000644000175000017500000000031707472736171021770 0ustar tygrystygrys/* * z88dk RS232 Function * * ZX Spectrum plus version * * unsigned char rs232_close() * * Specify the serial interface parameters */ #include u8_t rs232_close() { return RS_ERR_OK; } z88dk-1.8.ds1/libsrc/rs232/spectrum/plus3/rs232_get.c0000644000175000017500000000161007472736171021437 0ustar tygrystygrys/* * z88dk RS232 Function * * ZX Spectrum plus version * Reference: zfst terminal emulator by Russell Marks * * unsigned char rs232_get(char *) * * Returns RS_ERROR_OVERFLOW on error (and sets carry) */ #include u8_t rs232_get(i8_t *char) { /* fastcall so implicit push */ #asm .getchar defc romsend = $205b defc romrecv = $1e78 defc bank2 = $1ffd defc bank678 = $5b67 push af call brkcheck call page_romin pop af call romrecv push af call page_romout pop af pop de ld hl,RS_ERR_NO_DATA ret c ld (de),a ld hl,RS_ERR_OK push bc ;any rubbish will do ret .page_romout di ld bc,bank2 ld a,(bank678) set 2,a ld (bank678),a out (c),a ei ret .page_romin di ld bc,bank2 ld a,(bank678) res 2,a ld (bank678),a out (c),a ei ret .brkcheck ld bc,$7ffe in a,(c) bit 0,a ret nz ld b,$fe in a,(c) bit 0,a ret nz jr brkcheck #endasm } z88dk-1.8.ds1/libsrc/rs232/spectrum/plus3/rs232_init.c0000644000175000017500000000036607472736171021632 0ustar tygrystygrys/* * z88dk RS232 Function * * ZX Spectrum +3 version * * unsigned char rs232_init() * * Initialise the serial interface * * Still nothing, here! */ #include u8_t __FASTCALL__ rs232_init() { #asm ld hl,RS_ERR_OK #endasm } z88dk-1.8.ds1/libsrc/rs232/spectrum/plus3/rs232_params.c0000644000175000017500000000350707473154352022146 0ustar tygrystygrys/* * z88dk RS232 Function * * ZX Spectrum plus version * * unsigned char rs232_params(unsigned char param, unsigned char parity) * * Specify the serial interface parameters * * Later on, this should set panel values */ /* BAUD system variable: 23391 Value = (3500000/(25.7*BaudRate))-3 this function should be right.. Stefano 21/5/2002 */ #include u8_t __FASTCALL__ rs232_params(unsigned char param, unsigned char parity) { #if 0 { /* Unfinished code */ unsigned u16_t baud; switch ( param & 0x0F ) { case RS_BAUD_50: baud = 50; break; case RS_BAUD_110: baud = 110; break; case RS_BAUD_300: baud = 300; break; case RS_BAUD_600: baud = 600; break; case RS_BAUD_1200: baud = 1200; break; case RS_BAUD_2400: baud = 2400; break; case RS_BAUD_4800: baud = 4800; break; case RS_BAUD_9600: baud = 9600; break; case RS_BAUD_19200: /* Let's try... ! */ baud = 19200; break; case RS_BAUD_38400: /* These are too fast ! */ case RS_BAUD_57600: case RS_BAUD_115200: case RS_BAUD_230400: return RS_ERR_BAUD_TOO_FAST; default: case RS_BAUD_134_5: return RS_ERR_BAUD_NOT_AVAIL; } baud = (unsigned int) (3500000.0 / (25.7 * baud) ) - 3; rs232_setbaud(&baud); } /* { u8_t par; if ( ( parity & 0xE0) != RS_PAR_NONE) return RS_ERR_PARITY_NOT_AVAIL; switch ( parity ) { case RS_PAR_NONE: par = 'N'; break; case RS_PAR_ODD: par = 'O'; break; case RS_PAR_EVEN: par = 'E'; break; case RS_PAR_MARK: par = 'M'; break; case RS_PAR_SPACE: par = 'S'; break; } */ } #endif return RS_ERR_OK; } #if 0 static void rs232_setbaud(u16_t *baud) { #asm pop bc pop hl push hl push bc ld (23391),hl #endasm } #endif z88dk-1.8.ds1/libsrc/rs232/spectrum/plus3/rs232_put.c0000644000175000017500000000156407472736171021500 0ustar tygrystygrys/* * z88dk RS232 Function * * ZX Spectrum plus version * Reference: zfst terminal emulator by Russell Marks * * unsigned char rs232_put(char) * * No error checking, for now. */ #include u8_t rs232_put(i8_t char) { /* Fastcall so implicit push */ #asm defc romsend = $205b defc romrecv = $1e78 defc bank2 = $1ffd defc bank678 = $5b67 .sendchar ld a,l ;get byte push hl push af call brkcheck call page_romin pop af call romsend push af call page_romout pop af pop hl ld hl,RS_ERR_OK pop bc ;remove implicit push ret .page_romout di ld bc,bank2 ld a,(bank678) set 2,a ld (bank678),a out (c),a ei ret .page_romin di ld bc,bank2 ld a,(bank678) res 2,a ld (bank678),a out (c),a ei ret .brkcheck ld bc,$7ffe in a,(c) bit 0,a ret nz ld b,$fe in a,(c) bit 0,a ret nz jr brkcheck #endasm } z88dk-1.8.ds1/libsrc/rs232/z88/0000755000175000017500000000000010765202715015273 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/rs232/z88/Makefile0000644000175000017500000000062210763607713016740 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.5 2008/03/05 20:35:47 dom Exp $ include ../../Make.config CFILES = \ rs232_close.c \ rs232_get.c \ rs232_init.c \ rs232_params.c \ rs232_put.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: $(OBJECTS) .c.o: zcc +z88 $(CFLAGS) $*.c clean: $(RM) *.sym *.map zcc_opt.def *.o* *~ *.err *.i $(AFILES) z88dk-1.8.ds1/libsrc/rs232/z88/rs232_close.c0000644000175000017500000000030207425022337017471 0ustar tygrystygrys/* * z88dk RS232 Function * * z88 version * * unsigned char rs232_close() * * Specify the serial interface parameters */ #include u8_t rs232_close() { return RS_ERR_OK; } z88dk-1.8.ds1/libsrc/rs232/z88/rs232_get.c0000644000175000017500000000063607425022337017155 0ustar tygrystygrys/* * z88dk RS232 Function * * z88 version * * unsigned char rs232_get(char *) * * Returns RS_ERROR_OVERFLOW on error (and sets carry) */ #include u8_t rs232_get(i8_t *char) { /* fastcall so implicit push */ #asm INCLUDE "#serintfc.def" ld l,si_gbt ld bc,0 ;timeout call_oz(os_si) pop de ld hl,RS_ERR_NO_DATA ret c ld (de),a ld hl,RS_ERR_OK push bc ;any rubbish will do #endasm } z88dk-1.8.ds1/libsrc/rs232/z88/rs232_init.c0000644000175000017500000000040607425022337017334 0ustar tygrystygrys/* * z88dk RS232 Function * * z88 version * * unsigned char rs232_init() * * Initialise the serial interface */ #include u8_t __FASTCALL__ rs232_init() { #asm INCLUDE "#serintfc.def" ld l,si_sft call_oz(os_si) ld hl,RS_ERR_OK #endasm } z88dk-1.8.ds1/libsrc/rs232/z88/rs232_params.c0000644000175000017500000000343507425022337017661 0ustar tygrystygrys/* * z88dk RS232 Function * * z88 version * * unsigned char rs232_params(unsigned char param, unsigned char parity) * * Specify the serial interface parameters * * Later on, this should set panel values */ #include #if 0 #asm INCLUDE "#director.def" #endasm #endif u8_t __FASTCALL__ rs232_params(unsigned char param, unsigned char parity) { #if 0 { /* Unfinished code */ unsigned u16_t baud; switch ( param & 0x0F ) { case RS_BAUD_300: baud = 300; break; case RS_BAUD_600: baud = 600; break; case RS_BAUD_1200: baud = 1200; break; case RS_BAUD_2400: baud = 2400; break; case RS_BAUD_9600: baud = 9600; break; case RS_BAUD_19200: /* Available but broken */ case RS_BAUD_38400: /* Availabe but broken */ case RS_BAUD_57600: case RS_BAUD_115200: case RS_BAUD_230400: return RS_ERR_BAUD_TOO_FAST; case RS_BAUD_50: case RS_BAUD_110: case RS_BAUD_134_5: case RS_BAUD_4800: default: return RS_ERR_BAUD_NOT_AVAIL; } rs232_setbaud(&baud); } { u8_t par; switch ( parity ) { case RS_PAR_NONE: par = 'N'; break; case RS_PAR_ODD: par = 'O'; break; case RS_PAR_EVEN: par = 'E'; break; case RS_PAR_MARK: par = 'M'; break; case RS_PAR_SPACE: par = 'S'; break; } rs232_setparity(&par); } #endif return RS_ERR_OK; } #if 0 static void rs232_setbaud(u16_t *baud) { #asm pop bc pop hl push hl push bc push hl ld bc,PA_Txb ld a,2 call_oz(os_sp) pop hl ld a,2 ld bc,PA_Rxb call_oz(os_sp) #endasm static void rs232_setparity(u8_t *baud) { #asm pop bc pop hl push hl push bc ld bc,PA_Par ld a,1 call_oz(os_sp) #endasm } #endif z88dk-1.8.ds1/libsrc/rs232/z88/rs232_put.c0000644000175000017500000000063307425022337017203 0ustar tygrystygrys/* * z88dk RS232 Function * * z88 version * * unsigned char rs232_put(char) * * Returns RS_ERROR_OVERFLOW on error (and sets carry) */ #include u8_t rs232_put(i8_t char) { /* Fastcall so implicit push */ #asm INCLUDE "#serintfc.def" ld a,l ;get byte ld l,si_pbt ld bc,0 ;timeout call_oz(os_si) ld hl,RS_ERR_OK pop bc ;remove implicit push ret nc ld hl,RS_ERR_OVERFLOW #endasm } z88dk-1.8.ds1/libsrc/sam.lst0000644000175000017500000000577010763607600015304 0ustar tygrystygrysinput/spectrum/in_GetKey input/spectrum/in_GetKeyReset input/spectrum/in_Inkey input/spectrum/in_JoyFuller input/spectrum/in_JoyKempston input/spectrum/in_JoyKeyboard input/spectrum/in_JoySinclair1 input/spectrum/in_JoySinclair2 input/spectrum/in_JoyTimex1 input/spectrum/in_JoyTimex2 input/spectrum/in_KeyPressed input/spectrum/in_keytranstbl input/spectrum/in_LookupKey input/spectrum/in_MouseAMX input/spectrum/in_MouseAMX_callee input/spectrum/in_MouseAMXInit input/spectrum/in_MouseAMXInit_callee input/spectrum/in_MouseAMXSetPos input/spectrum/in_MouseAMXSetPos_callee input/spectrum/in_MouseKemp input/spectrum/in_MouseKemp_callee input/spectrum/in_MouseKempInit input/spectrum/in_MouseKempSetPos input/spectrum/in_MouseKempSetPos_callee input/spectrum/in_MouseSim input/spectrum/in_MouseSimInit input/spectrum/in_MouseSimSetPos input/spectrum/in_Pause input/spectrum/in_Wait input/spectrum/in_WaitForKey input/spectrum/in_WaitForNoKey input/spectrum/INMouseAMX input/spectrum/INMouseKemp input/spectrum/INMouseSim stdio/sam/fgetc_cons stdio/sam/fputc_cons stdio/sam/getk time/spectrum/clock graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/clsgraph graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy graphics/fill graphics/dfill graphics/getsprite graphics/spectrum/putsprite graphics/spectrum/bksave graphics/spectrum/bkrestore graphics/spectrum/rowtab graphics/spectrum/pixladdr2 graphics/spectrum/swapgfxbk graphics/sam/swapgfxbk graphics/xorborder graphics/xorpixl graphics/xorplot games/joystick games/sam/bit_open games/sam/bit_open_di games/sam/bit_close games/sam/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/sam/beeper spectrum/zx_attr spectrum/zx_attr_callee spectrum/zx_border spectrum/zx_break spectrum/zx_aaddr2cx spectrum/zx_aaddr2cy spectrum/zx_aaddr2px spectrum/zx_aaddr2py spectrum/zx_aaddr2saddr spectrum/zx_aaddrcdown spectrum/zx_aaddrcleft spectrum/zx_aaddrcright spectrum/zx_aaddrcup spectrum/zx_cy2aaddr spectrum/zx_cy2saddr spectrum/zx_cyx2aaddr spectrum/zx_cyx2aaddr_callee spectrum/zx_cyx2saddr spectrum/zx_cyx2saddr_callee spectrum/zx_pxy2aaddr spectrum/zx_pxy2aaddr_callee spectrum/zx_pxy2saddr spectrum/zx_pxy2saddr_callee spectrum/zx_py2aaddr spectrum/zx_py2saddr spectrum/zx_saddr2aaddr spectrum/zx_saddr2cx spectrum/zx_saddr2cy spectrum/zx_saddr2px spectrum/zx_saddr2px_callee spectrum/zx_saddr2py spectrum/zx_saddrcdown spectrum/zx_saddrcleft spectrum/zx_saddrcright spectrum/zx_saddrcup spectrum/zx_saddrpdown spectrum/zx_saddrpleft spectrum/zx_saddrpleft_callee spectrum/zx_saddrpright spectrum/zx_saddrpright_callee spectrum/zx_saddrpup @z80.lst z88dk-1.8.ds1/libsrc/samansi.lst0000755000175000017500000000645010763607601016157 0ustar tygrystygrysinput/spectrum/in_GetKey input/spectrum/in_GetKeyReset input/spectrum/in_Inkey input/spectrum/in_JoyFuller input/spectrum/in_JoyKempston input/spectrum/in_JoyKeyboard input/spectrum/in_JoySinclair1 input/spectrum/in_JoySinclair2 input/spectrum/in_JoyTimex1 input/spectrum/in_JoyTimex2 input/spectrum/in_KeyPressed input/spectrum/in_keytranstbl input/spectrum/in_LookupKey input/spectrum/in_MouseAMX input/spectrum/in_MouseAMX_callee input/spectrum/in_MouseAMXInit input/spectrum/in_MouseAMXInit_callee input/spectrum/in_MouseAMXSetPos input/spectrum/in_MouseAMXSetPos_callee input/spectrum/in_MouseKemp input/spectrum/in_MouseKemp_callee input/spectrum/in_MouseKempInit input/spectrum/in_MouseKempSetPos input/spectrum/in_MouseKempSetPos_callee input/spectrum/in_MouseSim input/spectrum/in_MouseSimInit input/spectrum/in_MouseSimSetPos input/spectrum/in_Pause input/spectrum/in_Wait input/spectrum/in_WaitForKey input/spectrum/in_WaitForNoKey input/spectrum/INMouseAMX input/spectrum/INMouseKemp input/spectrum/INMouseSim stdio/sam/fgetc_cons stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/sam/f_ansi_attr stdio/ansi/sam/f_ansi_bel stdio/ansi/sam/f_ansi_char stdio/ansi/sam/f_ansi_cls stdio/ansi/sam/f_ansi_default stdio/ansi/sam/f_ansi_dline stdio/ansi/sam/f_ansi_restore stdio/ansi/sam/f_ansi_scrollup stdio/sam/getk time/spectrum/clock graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/clsgraph graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy graphics/fill graphics/dfill graphics/getsprite graphics/spectrum/putsprite graphics/spectrum/bksave graphics/spectrum/bkrestore graphics/spectrum/rowtab graphics/spectrum/pixladdr2 graphics/sam/swapgfxbk graphics/xorborder graphics/xorplot graphics/xorpixl games/joystick games/sam/bit_open games/sam/bit_open_di games/sam/bit_close games/sam/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/sam/beeper spectrum/zx_attr spectrum/zx_attr_callee spectrum/zx_border spectrum/zx_break spectrum/zx_aaddr2cx spectrum/zx_aaddr2cy spectrum/zx_aaddr2px spectrum/zx_aaddr2py spectrum/zx_aaddr2saddr spectrum/zx_aaddrcdown spectrum/zx_aaddrcleft spectrum/zx_aaddrcright spectrum/zx_aaddrcup spectrum/zx_cy2aaddr spectrum/zx_cy2saddr spectrum/zx_cyx2aaddr spectrum/zx_cyx2aaddr_callee spectrum/zx_cyx2saddr spectrum/zx_cyx2saddr_callee spectrum/zx_pxy2aaddr spectrum/zx_pxy2aaddr_callee spectrum/zx_pxy2saddr spectrum/zx_pxy2saddr_callee spectrum/zx_py2aaddr spectrum/zx_py2saddr spectrum/zx_saddr2aaddr spectrum/zx_saddr2cx spectrum/zx_saddr2cy spectrum/zx_saddr2px spectrum/zx_saddr2px_callee spectrum/zx_saddr2py spectrum/zx_saddrcdown spectrum/zx_saddrcleft spectrum/zx_saddrcright spectrum/zx_saddrcup spectrum/zx_saddrpdown spectrum/zx_saddrpleft spectrum/zx_saddrpleft_callee spectrum/zx_saddrpright spectrum/zx_saddrpright_callee spectrum/zx_saddrpup @z80.lst z88dk-1.8.ds1/libsrc/setjmp/0000755000175000017500000000000010765202715015271 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/setjmp/longjmp.c0000644000175000017500000000074307130401723017077 0ustar tygrystygrys/* * longjmp(jmp_buf env, int val) * * Return to a previous frame * * djn 28/2/2000 */ #include void longjmp(jmp_buf env, int val) { #pragma asm pop de ;return address discarded pop bc ;val ld a,b or c jr nz,longjmp1 inc bc ;cant return 0 .longjmp1 pop hl ;&env ld e,(hl) ;sp inc hl ld d,(hl) inc hl ld a,(hl) ;pc inc hl ld h,(hl) ld l,a ex de,hl ld sp,hl push de ;"&env" push de ;ret address ld l,c ;ret value ld h,b #pragma endasm } z88dk-1.8.ds1/libsrc/setjmp/Makefile0000644000175000017500000000044210763607714016737 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../Make.config CFILES = \ longjmp.c \ setjmp.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: $(OBJECTS) .c.o: zcc +test $(CFLAGS) $*.c clean: $(RM) *.o* *.sym *.map *~ *.err zcc_opt.def *.i $(AFILES) z88dk-1.8.ds1/libsrc/setjmp/setjmp.c0000644000175000017500000000063007130401723016726 0ustar tygrystygrys/* * setjmp(jmp_buf env) * * djm 28/2/2000 * * We have no register vars so only need to * save sp and return PC */ #include int setjmp(jmp_buf env) { #pragma asm pop bc ;return address pop de ;&env push de push bc ld hl,0 add hl,sp ;stack pointer ex de,hl ld (hl),e ;sp inc hl ld (hl),d inc hl ld (hl),c ;pc inc hl ld (hl),b ld hl,0 ;Have to return 0 #pragma endasm } z88dk-1.8.ds1/libsrc/sms/0000755000175000017500000000000010765202715014571 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sms/add_pause_int.asm0000755000175000017500000000100110630364750020064 0ustar tygrystygrys XLIB add_pause_int XREF pause_procs ;============================================================== ; add_pause_int(void *ptr) ;============================================================== ; Adds a pause interrupt handler ;============================================================== .add_pause_int ld hl, 2 add hl, sp ld c, (hl) ; Proc address inc hl ld b, (hl) ld hl, pause_procs .loop ld a,(hl) inc hl or (hl) jr z, found inc hl jr loop .found ld (hl), b dec hl ld (hl), c ret z88dk-1.8.ds1/libsrc/sms/add_raster_int.asm0000755000175000017500000000101010630364750020247 0ustar tygrystygrys XLIB add_raster_int XREF raster_procs ;============================================================== ; add_raster_int(void *ptr) ;============================================================== ; Adds a VBL/HBL interrupt handler ;============================================================== .add_raster_int ld hl, 2 add hl, sp ld c, (hl) ; Proc address inc hl ld b, (hl) ld hl, raster_procs .loop ld a,(hl) inc hl or (hl) jr z, found inc hl jr loop .found ld (hl), b dec hl ld (hl), c ret z88dk-1.8.ds1/libsrc/sms/aplib_depack.asm0000755000175000017500000001062410630364750017676 0ustar tygrystygrys XLIB aplib_depack XREF aPLibMemory_bits XREF aPLibMemory_byte XREF aPLibMemory_LWM XREF aPLibMemory_R0 ;============================================================== ; aplib_depack(unsigned char *src, unsigned char *dest) ;============================================================== ; Uncompresses data previously compressed with apLib ;============================================================== .aplib_depack ld hl, 2 add hl, sp ld e, (hl) ; Destination address inc hl ld d, (hl) inc hl ld a, (hl) ; Source address inc hl ld h, (hl) ld l, a jp depack ; Usage: ; ; .include this file in your code ; somewhere after that, an aPLibMemoryStruct called aPLibMemory must be defined somewhere in RAM ; ie. "aPLibMemory instanceof aPLibMemoryStruct" inside a .ramsection or .enum ; ; Then do ; ; ld hl, ; ld de, ; call depack ; ; In my tests, depack() used a maximum of 12 bytes of stack, but this may vary with different data. ; This file is using WLA-DX syntax quite heavily, you'd better use it too... ;.struct aPLibMemoryStruct ;bits db ;byte db ; not directly referenced, assumed to come after bits ;LWM db ;R0 dw ;.endst ; Reader's note: ; The structure of the code has been arranged such that the entry point is in the middle - ; this is so it can use jr to branch out to the various subsections to save a few bytes, ; but it makes it somewhat harder to read. "depack" is the entry point and "aploop" is ; the main loop. ; Subsections which are only referenced by calls are defined in separate .sections to enable ; better code packing in the output (more finely divided blobs). ; More optimisations may be possible; in general, size optimisations are favoured over speed. .ap_getbit push bc ld bc,(aPLibMemory_bits) rrc c jr nc,ap_getbit_continue ld b,(hl) inc hl .ap_getbit_continue ld a,c and b ld (aPLibMemory_bits),bc pop bc ret .ap_getbitbc ;doubles BC and adds the read bit sla c rl b call ap_getbit ret z inc bc ret .ap_getgamma ld bc,1 .ap_getgammaloop call ap_getbitbc call ap_getbit jr nz,ap_getgammaloop ret .apbranch2 ;use a gamma code * 256 for offset, another gamma code for length call ap_getgamma dec bc dec bc ld a,(aPLibMemory_LWM) or a jr nz,ap_not_LWM ;bc = 2? ; Maxim: I think he means 0 ld a,b or c jr nz,ap_not_zero_gamma ;if gamma code is 2, use old R0 offset, and a new gamma code for length call ap_getgamma push hl ld h,d ld l,e push bc ld bc,(aPLibMemory_R0) sbc hl,bc pop bc ldir pop hl jr ap_finishup .ap_not_zero_gamma dec bc .ap_not_LWM ;do I even need this code? ; Maxim: seems so, it's broken without it ;bc=bc*256+(hl), lazy 16bit way ld b,c ld c,(hl) inc hl ld (aPLibMemory_R0),bc push bc call ap_getgamma ex (sp),hl ;bc = len, hl=offs push de ex de,hl ;some comparison junk for some reason ; Maxim: optimised to use add instead of sbc ld hl,-32000 add hl,de jr nc,skip1 inc bc .skip1 ld hl,-1280 add hl,de jr nc,skip2 inc bc .skip2 ld hl,-128 add hl,de jr c,skip3 inc bc inc bc .skip3 ;bc = len, de = offs, hl=junk pop hl push hl or a sbc hl,de pop de ;hl=dest-offs, bc=len, de = dest ldir pop hl .ap_finishup ld a,1 ld (aPLibMemory_LWM),a jr aploop .apbranch1 ; Maxim: moved this one closer to where it's jumped from to allow jr to work and save 2 bytes ldi xor a ld (aPLibMemory_LWM),a jr aploop .depack ;hl = source ;de = dest ldi xor a ld (aPLibMemory_LWM),a inc a ld (aPLibMemory_bits),a .aploop call ap_getbit jr z, apbranch1 call ap_getbit jr z, apbranch2 call ap_getbit jr z, apbranch3 ;LWM = 0 xor a ld (aPLibMemory_LWM),a ;get an offset ld bc,0 call ap_getbitbc call ap_getbitbc call ap_getbitbc call ap_getbitbc ld a,b or c jr nz,apbranch4 ; xor a ;write a 0 ; Maxim: a is zero already (just failed nz test), optimise this line away ld (de),a inc de jr aploop .apbranch4 ex de,hl ;write a previous bit (1-15 away from dest) push hl sbc hl,bc ld a,(hl) pop hl ld (hl),a inc hl ex de,hl jr aploop .apbranch3 ;use 7 bit offset, length = 2 or 3 ;if a zero is encountered here, it's EOF ld c,(hl) inc hl rr c ret z ld b,2 jr nc,ap_dont_inc_b inc b .ap_dont_inc_b ;LWM = 1 ld a,1 ld (aPLibMemory_LWM),a push hl ld a,b ld b,0 ;R0 = c ld (aPLibMemory_R0),bc ld h,d ld l,e or a sbc hl,bc ld c,a ldir pop hl jr aploop z88dk-1.8.ds1/libsrc/sms/clear_vram.asm0000755000175000017500000000107310630364750017411 0ustar tygrystygrys XLIB clear_vram LIB VRAMToHL ;============================================================== ; Clear VRAM ;============================================================== ; Sets all of VRAM to zero ;============================================================== .clear_vram ld hl,$0000 call VRAMToHL ; Output 16KB of zeroes ld hl, $4000 ; Counter for 16KB of VRAM ld a, $00 ; Value to write .clearVRAM1 out ($be),a ; Output to VRAM address, which is auto-incremented after each write dec h jp nz, clearVRAM1 dec l jp nz, clearVRAM1 ret z88dk-1.8.ds1/libsrc/sms/DrawOneLine.asm0000755000175000017500000000123610630364750017446 0ustar tygrystygrys XLIB DrawOneLine INCLUDE "sms/sms.hdr" LIB VRAMToHL ;============================================================== ; DrawOneLine ;============================================================== ; Draws one line on the bkg map. ; hl = Initial address of data ; de = Destination VRAM address ; c = Number of bkg tiles to write ;============================================================== .DrawOneLine push hl ld h, d ld l, e call VRAMToHL ; Set VRAM write address pop hl push af .loop ld a, (hl) out ($be), a ; Character number inc hl ld a, (hl) out ($be), a ; Attribute number inc hl dec c jp nz, loop ; Repeat until c is zero pop af ret z88dk-1.8.ds1/libsrc/sms/FONT8.BIN0000755000175000017500000000400010630364750015755 0ustar tygrystygrys~~~~l|88||888888||8<<><~~<$$$$$$r>c8DD8x~~~<~~<8|TT|8 0``0@@@~$ff$8||8$$$$$~$~$$>@<|bd&F0H0Vv  @@@   D88D| ~ @8  @ ~~B?` .11.|` ,2""b08BB<` $(0(&08vIIII\bBBB@<|| BBBF:AA"AIII6D((DBBB>|| | ` 002L"AA B8088<@@<@@>$ p B|D(||LxDODE|` 8 ~8DD8| @B<~@@~BH)CBJ*_$H$H$$H""""UUUUww1JDJ1HHH0DDDz@@3L|8DD8|$B~B$$BB$$f 8 ? ret nc ; yes, return -1 inc a ld (driveno),a ; drive number selected (d_str1) ld e,(ix+4) ; file name ld d,(ix+5) ld hl,filename push de push hl ; location call if1_setname pop bc pop de ld (fnlen),hl ld a,(ix+2) ; record number ld (record),a ld l,(ix+0) ; buffer ld h,(ix+1) ld (mdvbuffer),hl call if1_rommap ld hl,(driveno) ; drive number selected ld (5CD6h),hl ; d_str1 ld a,'M' ld (5CD9h),A ; l_str1 (device type = "M") ; Probably it will also work by forcing fnlen to zero ; and not setting the pointer to filename ld hl,(fnlen) ; length of file name ld (5CDAh),hl ; n_str1 (lenght of file name) ld hl,filename ; addr of file name ld (5CDCh),hl ; pointer to filename ;IF !OLDIF1MOTOR ; ld a,(driveno) ; call MOTOR ; select drive motor ; jp nz,error_exit ;ENDIF call MAKE_M copyname: ; copy file name from temp string to current channel push ix pop hl ld de,0Eh ; point to filename in channel add hl,de ex de,hl ld hl,filename ld bc,10 ldir ; Copy parameters from work buffer to actual channel ld a,(driveno) ; drive number selected ld (ix+19h),A ; CHDRIV ld a,(record) ld (ix+0Dh),a ; CHREC res 0,(ix+18h) ; set CHFLAG to "read" mode xor a ld (if1_sect_read),a ; flag for "sector read" ld hl,04FBh ld (5CC9h),hl ; SECTOR ld a,(driveno) ; drive number selected call MOTOR ; select drive motor IF !OLDIF1MOTOR jr nz,error_exit ENDIF do_read: call FETCH_H ; fetch header ld de,001Bh add hl,de call RD_BUFF ; get buffer ld a,(ix+43h) ; RECFLG or (ix+46h) ; 2nd byte of RECLEN and 2 jr z,nxt_sect ld a,(ix+44h) ; RECNUM cp (ix+0Dh) ; CHREC jr nz,nxt_sect push ix pop hl ld de,0Eh ; CHNAME: point to filename in channel add hl,de push hl ld de,39h ; 47h = RECNAM add hl,de pop de ; DE now points to CHNAME ld b,10 ; compare RECNAM and CHNAME ckn_loop: ld a,(de) cp (hl) jr nz,nxt_sect inc de inc hl djnz ckn_loop call if1_checkblock ; various checks cp 4 jr z,sectread nxt_sect: call next_sector ; Decrease sector counter and check if we reached zero jr nz,do_read ld a,(if1_sect_read) ; flag for "sector read" or a jr z,sect_notfound sectread: ld a,(ix+29h) ; save the current sector number ld (record),a call CLOSE_M ; close file call 1 ; unpage ei ld a,(record) ld h,0 ld l,a ; sector read OK ret sect_notfound: call CLOSE_M ; close file error_exit: call 1 ; unpage ei ; xor a ; ld (if1_sect_read),a ; flag for "sector read" ld hl,-1 ; sector not found ret ; Decrease sector counter and check if we reached zero next_sector: ld hl,(5CC9h) ; SECTOR dec hl ld (5CC9h),hl ld a,l or h ret z88dk-1.8.ds1/libsrc/spectrum/if1_load_sector.asm0000755000175000017500000001171510643721250021373 0ustar tygrystygrys; ; ZX IF1 & Microdrive functions ; ; Pick a sector with a given sector number ; ; int if1_load_sector (int drive, int sector, struct M_CHAN buffer); ; ; 4/5 drive: 1-8 for microdrive number ; 2/3 sector number ; 0/1 buffer ; ; $Id: if1_load_sector.asm,v 1.3 2007/07/07 14:26:48 stefano Exp $ ; XLIB if1_load_sector LIB if1_rommap XREF mdvbuffer LIB if1_checkblock XREF if1_sect_read XREF MAKE_M XREF CLOSE_M XREF FETCH_H XREF MOTOR XREF RD_BUFF ;; various flags ;flags: defb 0 ; parameters and variables driveno: defb 0 sector: defb 0 if1_load_sector: ld ix,2 add ix,sp ld a,(ix+4) ld hl,-1 and a ; drive no. = 0 ? ret z ; yes, return -1 dec a cp 8 ; drive no. >8 ? ret nc ; yes, return -1 inc a ld (driveno),a ; drive number selected (d_str1) ld a,(ix+2) ; sector number ld (sector),a ld l,(ix+0) ; buffer ld h,(ix+1) ld (mdvbuffer),hl call if1_rommap ld hl,(driveno) ; drive number selected ld (5CD6h),hl ; d_str1 ld a,'M' ld (5CD9h),A ; l_str1 (device type = "M") ld hl,0 ; force to zero (otherwise it hangs) ld (5CDAh),hl ; n_str1 (lenght of file name) call MAKE_M ; Copy parameters from work buffer to actual channel ld a,(driveno) ; drive number selected ld (ix+19h),A ; CHDRIV ld a,(sector) ld (ix+0Dh),a ; CHREC res 0,(ix+18h) ; set CHFLAG to "read" mode xor a ld (if1_sect_read),a ; flag for "sector read" ld hl,04FBh ld (5CC9h),hl ; SECTOR ; *** scelta routine *** ld a,(driveno) ; drive number selected call MOTOR ; select drive motor IF !OLDIF1MOTOR jr nz,error_exit ENDIF nxtsector: call FETCH_H ; fetch header ld a,(ix+29h) ; HDNUMB: sector number cp (ix+0Dh) ; CHREC jr nz,nextrec ld de,001Bh add hl,de call RD_BUFF ; get buffer call if1_checkblock ; various checks cp 4 jr z,ok_close nextrec: call next_sector jr nz,nxtsector ; ld a,(flags) ; bit 2,a ; "verify mode" flag ; ; jp z,noverify ; ;; close, return with "VERIFICATION ERROR" code ; call CLOSE_M ; close file ; call 1 ; unpage ; ei ; ld hl,-2 ; verify error ; ret ;noverify: ld a,(if1_sect_read) ; flag for "sector read" or a jr z,sect_notfound sectread: call CLOSE_M ; close file call 1 ; unpage ei ld a,(sector) ld l,a ld h,0 ; Return the sector number ret sect_notfound: call CLOSE_M ; close file error_exit: call 1 ; unpage ei ld hl,-1 ; sector not found ret ; close file, and go back to main ok_close: call 1 ; unpage ei ld a,(sector) ld l,a ld h,0 ; Return the sector number ret ; Decrease sector counter and check if we reached zero next_sector: ld hl,(5CC9h) ; SECTOR dec hl ld (5CC9h),hl ld a,l or h ret z88dk-1.8.ds1/libsrc/spectrum/if1_mdv_status.asm0000644000175000017500000000275210644637602021274 0ustar tygrystygrys; ; ZX IF1 & Microdrive functions ; ; Get Microdrive status ; ; int if1_mdv_status (int drive); ; ; Returns: ; 0: Microdrive Ready, cartridge inserted, no write protection ; 1: Cartridge is write protected ; 2: Microdrive not present ; ; $Id: if1_mdv_status.asm,v 1.1 2007/07/10 08:12:50 stefano Exp $ ; XLIB if1_mdv_status LIB if1_rommap XREF MOTOR if1_mdv_status: pop hl pop bc push bc push hl ld a,c ld hl,-1 and a ; drive no. = 0 ? ret z ; yes, return -1 dec a cp 8 ; drive no. >8 ? ret nc ; yes, return -1 inc a push af call if1_rommap pop af call MOTOR ; select drive motor ld hl,retcode+1 ld a,2 ld (hl),a jr nz,estatus ; microdrive not present in a,($ef) and 1 ; test the write-protect tab ;;ret z ; drive 'write' protected xor 1 ; invert result (now 1=protected) ld (hl),a estatus: xor a call MOTOR ; Switch microdrive motor off (a=0) call 1 ; unpage ei retcode: ld hl,0 ret z88dk-1.8.ds1/libsrc/spectrum/if1_remove_file.asm0000755000175000017500000000142210434701355021365 0ustar tygrystygrys; ; ZX IF1 & Microdrive functions ; ; remove a given file in the given drive ; ; int if1_remove (int drive, char *filename); ; ; $Id: if1_remove_file.asm,v 1.2 2006/05/23 21:47:25 stefano Exp $ ; XLIB if1_remove_file LIB if1_setname LIB if1_rommap XREF ERASEM ; parameters and variables filename: defs 10 if1_remove_file: rst 8 defb 31h ; Create Interface 1 system vars if required pop af pop de ;filename pop bc ;driveno push bc push de push af ld a,c ld ($5cd6),a push de ld hl,filename ; filename location push hl call if1_setname ld ($5cda),hl ; length pop de ld ($5cdc),hl ; pointer to filename call if1_rommap call ERASEM call 1 ; unpage ei ld hl,0 ret z88dk-1.8.ds1/libsrc/spectrum/if1_rommap.asm0000755000175000017500000001320410643721250020363 0ustar tygrystygrys; ; ZX IF1 & Microdrive functions ; ; Stefano Bodrato - Oct. 2004 ; ; ; if1_rommap: ; - detect the shadow rom version ; - init the jump table ; ; MAKE_M can't be called with the 'hook code' system because ; the first issue of the interface one just doesn't have it. ; ; $Id: if1_rommap.asm,v 1.4 2007/07/07 14:26:48 stefano Exp $ ; XLIB if1_rommap XDEF MAKE_M XDEF CLOSE_M XDEF FETCH_H XDEF MOTOR XDEF RD_BUFF XDEF ERASEM XDEF ADD_RECD XDEF DEL_S_1 XDEF mdvbuffer mdvbuffer: defw 0 if1_rommap: ; start creating an 'M' channel rst 8 defb 31h ; Create Interface 1 system vars if required ld hl,paged ld (5CEDh),hl ; Location for hook 32h to jump to rst 8 ; Call 'paged' with shadow paged in defb 32h ; (in other words: page in the shadow ROM) paged: set 0,(iy+7Ch) ; FLAGS3: reset the "executing extended command" flag ; update jump table ld a,(10A5h) or a jr z,rom1 ld bc,24 ; 8 jumps * 3 bytes ;ld bc,30 ; 10 jumps * 3 bytes ld de,jptab ; JP table dest addr ld hl,rom2tab ; JP table for ROM 2 ldir rom1: pop bc ; throw away some garbage pop bc ; ... from the stack ret ;jp MAKE_M ; Jump table (ROM1 is the default) jptab: MAKE_M: JP 0FE8h ; set temporary "M" channel CLOSE_M: JP 12A9h ; close file (pointed by IX) FETCH_H: JP 12C4h ; fetch header IF OLDIF1MOTOR MOTOR: JP 17F7h ; select drive motor ELSE MOTOR2: JP 17F7h ; select drive motor ENDIF RD_BUFF: JP 18A9h ; get buffer ERASEM: JP 1D6Eh ; delete a file from cartridge FREESECT: JP 1D38h ; add a record to file DEL_S_1: JP 1867h ; 1ms delay ;LDBYTS: JP 15ACh ; ;SVBYTS: JP 14EEh ; ; Jump table image (rom2 and rom3) ; ; Luckily the routines we need are in the same ; location for both the shadow ROM versions rom2tab: JP 10A5h JP 138Eh JP 13A9h JP 1532h ;MOTOR JP 15EBh ;RD_BUFF JP 1D79h ;ERASEM JP 1D43h ;FREESECT JP 15A2h ;DEL_S_1 ;JP 199Dh ;LDBYTS ;JP 18DFh ;SVBYTS IF !OLDIF1MOTOR ; New MOTOR routine. ; This one traps the 'microdrive not present' error ; Mostly from the A. Pennel's Microdrive book MOTOR: and a ; need to stop a motor ? jp z,MOTOR2 ; use the original ROM routine push hl di ;; jr sw_motor sw_motor: ;push de ld de,$0100 ; d=1, e=0 neg ; negate the drive number add 9 ; a = 9 - drive number ld c,a ; drive selected ld b,8 ; drive counter all_motors: dec c ; decrement the drive selected jr nz,off_motor ; jump if not the one that is ; under investigation ; put a motor ON ld a,d ld ($f7),a ; send 1 (ON) ld a,$ee out ($ef),a call DEL_S_1 ; wait 1 ms ld a,$ec out ($ef),a call DEL_S_1 ; wait 1 ms jr nxt_motor ; do the next one off_motor: ; switch a drive OFF ld a,$ef out ($ef),a ld a,e out ($f7),a ; send 0: OFF call DEL_S_1 ; wait 1 ms ld a,$ed out ($ef),a call DEL_S_1 ; wait 1 ms nxt_motor: djnz all_motors ld a,d out ($f7),a ; send 1 ld a,$ee out ($ef),a ;; jr turned_on ; now drive is on, check its status turned_on: ld hl,5000 ; delay counter ton_delay: dec hl ld a,l or h jr nz,ton_delay ld hl,5000 ; 'check' loop counter reptest: ld b,6 ; six times ; here the original ROM checks for BREAK, ; but we removed it as Pennel did chk_pres: in a,($ef) ; and 4 ; bit 2 only jr nz,nopres ; jp if drive not present djnz chk_pres pop hl ; *CARTRIDGE PRESENT*, return.. ret ;.. with zero flag set nopres: dec hl ; decrement counter ld a,h or l jr nz,reptest inc a ; *CARTRIDGE NOT PRESENT*, reset zero flag... pop hl ret ; ...and return ENDIF z88dk-1.8.ds1/libsrc/spectrum/if1_setname.asm0000755000175000017500000000162010131504424020515 0ustar tygrystygrys; ; ZX IF1 & Microdrive functions ; ; int if1_setname(char* name, int location); ; ; Put a 10 characters file name at the specified location ; Truncate or fill with blanks when necessary. ; Return with the file name length ; ; $Id: if1_setname.asm,v 1.1 2004/10/08 12:33:24 stefano Exp $ ; XLIB if1_setname if1_setname: pop bc ; ret addr pop hl ; location pop de ; name push de push hl push bc xor a strcpylp: push af ld a,(de) and a ; check for string termination jr z,strcopied ld (hl),a inc hl inc de pop af inc a cp 10 ; max filename size jr z,scopied2 jr strcpylp strcopied: pop af scopied2: push af ; filename length neg a ;..now onto the trailing spaces add 10 ld b,a jr z,nospaces ld b,a ld a,' ' spcloop: ld (hl),a inc hl djnz spcloop nospaces: pop af ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/spectrum/if1_touch_file.asm0000755000175000017500000000216610434701356021221 0ustar tygrystygrys; ; ZX IF1 & Microdrive functions ; ; int if1_touch_file (int drive, int name); ; ; Works like the 'touch' command. ; Returns with the sector number associated to the file. ; ; ... no timestamp, just opens a file creating it if necessary and closes it immediately. ; A temp buffer in the BASIC area is created and destroyed, so don't locate your code too low. ; ; $Id: if1_touch_file.asm,v 1.2 2006/05/23 21:47:26 stefano Exp $ ; XLIB if1_touch_file LIB if1_setname filename: defs 10 if1_touch_file: rst 8 defb 31h ; Create Interface 1 system vars if required pop hl pop de ;filename pop bc ;driveno push bc push de push hl ld a,c ld ($5cd6),a push de ld hl,filename ; filename location push hl call if1_setname ld ($5cda),hl ; length pop hl ld (5cdch),hl ; pointer to filename pop de rst 8 defb 22h ; Open temporary 'M' channel (touch) ; Now IX points to the newly created channel ld h,0 ld l,(ix+$29) ; save the sector number push hl rst 8 defb 23h ; Close channel and write current sector. pop hl ret z88dk-1.8.ds1/libsrc/spectrum/if1_update_map.asm0000755000175000017500000000203110434701356021206 0ustar tygrystygrys; ; ZX IF1 & Microdrive functions ; ; void if1_update_map (int drive, char *mdvmap); ; ; ; Load in a Microdrive MAP array (32 bytes) ; the actual values for the specified drive. ; ; $Id: if1_update_map.asm,v 1.2 2006/05/23 21:47:26 stefano Exp $ ; XLIB if1_update_map filename: defm "!h7$" ; foo file name: it will never be written ! if1_update_map: rst 8 defb 31h ; Create Interface 1 system vars if required pop af pop hl ;map location pop bc ;driveno push bc push hl push af push hl ld a,c ld ($5cd6),a ld hl,4 ld ($5cda),hl ; length ld hl,filename ld ($5cdc),hl ; pointer to filename ;rst 8 ; Erase if file exists ? ;defb 24h rst 8 defb 22h ; Open temporary 'M' channel (touch) xor a rst 8 defb 21h ; stop microdrive motor pop de ld l,(ix+$1a) ; load address of the associated ld h,(ix+$1b) ; map into the HL register. ld bc,32 ldir ; copy the map rst 8 defb 2Ch ; Reclaim the channel ret z88dk-1.8.ds1/libsrc/spectrum/if1_write_record.asm0000755000175000017500000000221610643721250021561 0ustar tygrystygrys; ; ZX IF1 & Microdrive functions ; write a new record for the current buffer ; ; if1_write_record (int drive, struct M_CHAN buffer); ; ; This one is similar to "write sector" but fixes the record header. ; It is necessary to load a copy of the microdirve MAP and to pass it ; putting its location into the record structure.; ; ; $Id: if1_write_record.asm,v 1.2 2007/07/07 14:26:48 stefano Exp $ ; XLIB if1_write_record filename: defm 3 if1_write_record: rst 8 defb 31h ; Create Interface 1 system vars if required ld ix,2 add ix,sp ld a,(ix+2) ld hl,-1 and a ; drive no. = 0 ? ret z ; yes, return -1 dec a cp 8 ; drive no. >8 ? ret nc ; yes, return -1 inc a ;push af ld ($5cd6),a ld hl,1 ld ($5cda),hl ; filename length ld hl,filename ; filename location ld (5cdch),hl ; pointer to filename ld l,(ix+0) ; buffer ld h,(ix+1) push hl pop ix rst 8 defb 26h ; Write Record ;pop ix ;rst 8 ;defb 23h ; (close) ;rst 8 ;defb 2Ch ; reclaim buffer xor a rst 8 defb 21h ; Switch microdrive motor off (a=0) ret z88dk-1.8.ds1/libsrc/spectrum/if1_write_sector.asm0000755000175000017500000000267610643721250021614 0ustar tygrystygrys; ; ZX IF1 & Microdrive functions ; ; int if1_write_sector (int drive, int sector, struct M_CHAN buffer); ; ; Writes the specified sector to the specified drive. ; ; ; $Id: if1_write_sector.asm,v 1.4 2007/07/07 14:26:48 stefano Exp $ ; XLIB if1_write_sector LIB if1_rommap XREF MAKE_M XREF MOTOR if1_write_sector: call if1_rommap ld ix,2 add ix,sp ld a,(ix+4) ld hl,-1 and a ; drive no. = 0 ? ret z ; yes, return -1 dec a cp 8 ; drive no. >8 ? ret nc ; yes, return -1 inc a push af ld a,(ix+2) ; sector number push af ld l,(ix+0) ; buffer ld h,(ix+1) ld (mdvbuffer+1),hl ; Self modifying code :oP call MAKE_M pop af ; sector number ld (ix+0Dh),a ; CHREC pop af ld (ix+19h),A ; CHDRIV call MOTOR ld hl,-1 IF !OLDIF1MOTOR ret nz ; microdrive not present ENDIF in a,($ef) and 1 ; test the write-protect tab ret z ; drive 'write' protected push ix pop hl ld de,37h ; point to 12 bytes of data block preamble add hl,de push hl mdvbuffer: ld hl,0 add hl,de pop de ld bc,21ch ldir set 0,(ix+18h) ; set CHFLAG to "write" mode call 1 RST 8 defb 22h ; Open a temp "M" channel rst 8 defb 2Ah ; Write a sector to drive xor a rst 8 defb 21h ; Switch microdrive motor off (a=0) RST 8 defb 2Ch ; Reclaim an "M" channel ld hl,0 ret z88dk-1.8.ds1/libsrc/spectrum/Makefile0000644000175000017500000000045110700451034017256 0ustar tygrystygrys# # Makefile for +3 file support # # $Id: Makefile,v 1.5 2007/10/02 14:13:48 stefano Exp $ include ../Make.config all: tape_save.o .c.o: zcc +zx $(CFLAGS) $*.c clean: $(RM) *.o* zcc_opt.def cd disciple ; $(RM) *.o* ; cd .. cd microdrive ; $(RM) *.o* ; cd .. cd opus ; $(RM) *.o* ; cd .. z88dk-1.8.ds1/libsrc/spectrum/microdrive/0000755000175000017500000000000010765202715017774 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/spectrum/opus/0000755000175000017500000000000010765202715016617 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/spectrum/opus/get_kempston.asm0000755000175000017500000000056610701155057022026 0ustar tygrystygrys; ; ZX Spectrum OPUS DISCOVERY specific routines ; ; Stefano Bodrato - Jun. 2006 ; ; This routine get the kempston joystick emulation status. ; ; $Id: get_kempston.asm,v 1.1 2007/10/04 12:18:55 stefano Exp $ ; XLIB get_kempston get_kempston: call $1708 ; page_in ld a,($3000) and 128 ld hl,0 and a jr z,pageout inc hl .pageout jp $1748 z88dk-1.8.ds1/libsrc/spectrum/opus/opus_6116.asm0000755000175000017500000000077610701155060020767 0ustar tygrystygrys; ; ZX Spectrum OPUS DISCOVERY specific routines ; ; Stefano Bodrato - Jun. 2006 ; ; This routine checks if the 6116 memory expansion is present. ; ; $Id: opus_6116.asm,v 1.1 2007/10/04 12:18:56 stefano Exp $ ; XLIB opus_6116 LIB opus_rommap .opus_6116 call opus_rommap call $1708 ; Page in the Discovery ROM ld hl,3001 ld a,(hl) ld (hl),255 bit 1,(hl) ld (hl),a ld hl,0 jr z,noram inc hl .noram call $1748 ; Page out the Discovery ROM ret z88dk-1.8.ds1/libsrc/spectrum/opus/opus_getblocks.asm0000755000175000017500000000126310701155060022337 0ustar tygrystygrys; ; ZX Spectrum OPUS DISCOVERY specific routines ; ; Stefano Bodrato - Jun. 2006 ; ; int opus_getblocks (int drive); ; ; $Id: opus_getblocks.asm,v 1.1 2007/10/04 12:18:56 stefano Exp $ ; XLIB opus_getblocks LIB opus_rommap XREF P_DEVICE opus_getblocks: call opus_rommap ld ix,2 add ix,sp ld hl,-1 ld a,(ix+0) ; drive and a ; drive no. = 0 ? ret z ; yes, return -1 dec a cp 5 ; drive no. >5 ? ret nc ; yes, return -1 call $1708 ; Page in the Discovery ROM ld a,(ix+0) ; drive ld bc,$0400 ; inquire disk call P_DEVICE call $1748 ; Page out the Discovery ROM ; HL = number of blocks ret z88dk-1.8.ds1/libsrc/spectrum/opus/opus_getblocksize.asm0000755000175000017500000000131110701155060023041 0ustar tygrystygrys; ; ZX Spectrum OPUS DISCOVERY specific routines ; ; Stefano Bodrato - Jun. 2006 ; ; int opus_getblocksize (int drive); ; ; $Id: opus_getblocksize.asm,v 1.1 2007/10/04 12:18:56 stefano Exp $ ; XLIB opus_getblocksize LIB opus_rommap XREF P_DEVICE opus_getblocksize: call opus_rommap ld ix,2 add ix,sp ld hl,-1 ld a,(ix+0) ; drive and a ; drive no. = 0 ? ret z ; yes, return -1 dec a cp 5 ; drive no. >5 ? ret nc ; yes, return -1 call $1708 ; Page in the Discovery ROM ld a,(ix+0) ; drive ld bc,$0400 ; inquire disk call P_DEVICE call $1748 ; Page out the Discovery ROM ld h,b ; block size ld l,c ret z88dk-1.8.ds1/libsrc/spectrum/opus/opus_lptread.asm0000755000175000017500000000072310701155060022015 0ustar tygrystygrys; ; ZX Spectrum OPUS DISCOVERY specific routines ; ; Stefano Bodrato - Jun. 2006 ; ; unsigned char opus_lptread; ; ; $Id: opus_lptread.asm,v 1.1 2007/10/04 12:18:56 stefano Exp $ ; XLIB opus_lptread LIB opus_rommap XREF P_DEVICE opus_lptread: call opus_rommap call $1708 ; Page in the Discovery ROM ld b,2 ld a,$81 call P_DEVICE call $1748 ; Page out the Discovery ROM ; HL = number of blocks ret z88dk-1.8.ds1/libsrc/spectrum/opus/opus_lptwrite.asm0000755000175000017500000000103010701155060022224 0ustar tygrystygrys; ; ZX Spectrum OPUS DISCOVERY specific routines ; ; Stefano Bodrato - Jun. 2006 ; ; void opus_lptwrite (unsigned char databyte); ; ; $Id: opus_lptwrite.asm,v 1.1 2007/10/04 12:18:56 stefano Exp $ ; XLIB opus_lptwrite LIB opus_rommap XREF P_DEVICE opus_lptwrite: call opus_rommap ld ix,2 add ix,sp call $1708 ; Page in the Discovery ROM ld h,(ix+0) ; drive ld b,2 ld a,$81 call P_DEVICE call $1748 ; Page out the Discovery ROM ; HL = number of blocks ret z88dk-1.8.ds1/libsrc/spectrum/opus/opus_rommap.asm0000755000175000017500000000163310701155061021657 0ustar tygrystygrys; ; ZX Spectrum OPUS DISCOVERY specific routines ; ; Stefano Bodrato - Jun. 2006 ; ; ; - init the jump table ; ; $Id: opus_rommap.asm,v 1.1 2007/10/04 12:18:57 stefano Exp $ ; XLIB opus_rommap XDEF P_DEVICE XDEF P_TESTCH opus_rommap: ; start creating an 'M' channel ;rst 8 ;defb $D4 ; Create microdrive system vars ; why does it crash ?!?? call $1708 ; Page in the Discovery ROM ld b,0 ; Table entry 0: "call physical device" rst $30 ; 'read table' restart defb $12 ; Table number 12h: SYSTEM ld (P_DEVICE+1),hl ; Self modifying code ld b,8 ; Table entry 8: "test channel parameters" rst $30 ; 'read table' restart defb $12 ; Table number 12h: SYSTEM ld (P_TESTCH+1),hl ; Self modifying code jp $1748 ; Page out the Discovery ROM ; Jump table P_DEVICE: jp 0 ; set temporary "M" channel P_TESTCH: jp 0 ; test channel z88dk-1.8.ds1/libsrc/spectrum/opus/opus_testchannel.asm0000755000175000017500000000132710701155061022674 0ustar tygrystygrys; ; ZX Spectrum OPUS DISCOVERY specific routines ; ; Stefano Bodrato - Jun. 2006 ; ; void opus_testchannel (struct X_CHAN channel); ; test channel parameters, return 0 if no errors ; ; $Id: opus_testchannel.asm,v 1.1 2007/10/04 12:18:57 stefano Exp $ ; XLIB opus_testchannel LIB opus_rommap XREF P_TESTCH opus_testchannel: call opus_rommap ld ix,2 add ix,sp call $1708 ; Page in the Discovery ROM ld e,(ix+0) ; channel address ld d,(ix+0) ; channel address call P_TESTCH ld hl,0 jr nc,noerr inc hl ; some error jr nz,noerr inc hl ; error in second part noerr: call $1748 ; Page out the Discovery ROM ; HL = zero or error code ret z88dk-1.8.ds1/libsrc/spectrum/opus/opus_version.asm0000755000175000017500000000217310701155061022051 0ustar tygrystygrys; ; ZX Spectrum OPUS DISCOVERY specific routines ; ; Stefano Bodrato - Jun. 2006 ; ; This routine tries to query the Opus ROM to fetch its version ; It gives a float containg the version, otherwise a float containing zero.. ; ; With many of the other existing disk interfaces this test crashes. ; ; $Id: opus_version.asm,v 1.1 2007/10/04 12:18:57 stefano Exp $ ; XLIB opus_version XREF fa INCLUDE "#zxfp.def" .opus_version ld bc,($5c3d) push bc ; save original ERR_SP ld bc,return push bc ld ($5c3d),sp ; update error handling routine ld bc,8 call ZXFP_STACK_BC rst ZXFP_BEGIN_CALC ; Do the string conversion ! defb ZXFP_USR_NO defb $FD ; Hook code for "OPUS Version" defb ZXFP_DELETE defb ZXFP_RE_STACK defb ZXFP_END_CALC ; Copy in "fa" the result ld a,(hl) ;exponent ld de,fa+5 ld (de),a inc hl dec de ld b,4 .bloop2 ld a,(hl) ld (de),a inc hl dec de djnz bloop2 pop bc jr exitgoto .return ld (iy+0),255 ; reset ERR_NR .exitgoto pop bc ld ($5c3d),bc ; restore orginal ERR_SP ret z88dk-1.8.ds1/libsrc/spectrum/opus/set_kempston.asm0000755000175000017500000000061310701155061022026 0ustar tygrystygrys; ; ZX Spectrum OPUS DISCOVERY specific routines ; ; This routine sets the kempston joystick emulation mode. ; ; $Id: set_kempston.asm,v 1.1 2007/10/04 12:18:57 stefano Exp $ ; XLIB set_kempston set_kempston: pop hl pop bc ld a,c push bc push hl call $1708 ; page_in ld hl,$3000 set 7,(hl) and a jr z,pageout res 7,(hl) .pageout jp $1748 z88dk-1.8.ds1/libsrc/spectrum/opus/zx_opus.asm0000755000175000017500000000143710753010311021022 0ustar tygrystygrys; ; ZX Spectrum specific routines ; Stefano Bodrato - 5/2/2008 ; ; int opus_installed(); ; ; The result is: ; - 0 (false) if the Opus Discovery Interface is missing ; - 1 (true) if the Opus Discovery Interface is connected ; ; Tries to issue a POINT #0,1 command, to see if the syntax is accepted. ; If so, tries the short style command LOAD *PI;"A" ; Shouldn't conflict with other interfaces. ; ; $Id: zx_opus.asm,v 1.3 2008/02/08 08:20:25 stefano Exp $ ; XLIB zx_opus LIB zx_syntax zx_opus: ld hl,testcmd call zx_syntax xor a or l ret z ld hl,testcmd2 ; further test (Disciple might accept "POINT") jp zx_syntax testcmd: defb 169,35,195,167,44,188,167,13 ; POINT # NOT PI,SGN PI testcmd2: defb 239,42,167,59,34,65,34,13 ; LOAD *PI;"A" z88dk-1.8.ds1/libsrc/spectrum/plus3/0000755000175000017500000000000010765202715016677 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/spectrum/README0000644000175000017500000000021710551132474016506 0ustar tygrystygrys$Id: README,v 1.3 2007/01/10 09:43:24 stefano Exp $ ZX Spectrum specific code and libraries. Tape and disk support, enhanced graphics, etc.. z88dk-1.8.ds1/libsrc/spectrum/screenstr.asm0000644000175000017500000000043710634605627020353 0ustar tygrystygrys; uint screenstr(uchar row, uchar col) ; CALLER linkage for function pointers XLIB screenstr LIB screenstr_callee XREF ASMDISP_SCREENSTR_CALLEE .screenstr pop bc pop hl pop de push de push hl push bc ld h,e jp screenstr_callee + ASMDISP_SCREENSTR_CALLEE z88dk-1.8.ds1/libsrc/spectrum/screenstr_callee.asm0000644000175000017500000000313710635312636021654 0ustar tygrystygrys; uint __CALLEE__ screenstr_callee(uchar row, uchar col) ; aralbrec 06.2007 ; Sinclair Basic's SCREEN$() returns ascii code if the ; bit pattern on screen matches exactly the character ; set's bit pattern or its inverse. This subroutine ; goes a little further and will conclude a match ; if the bit pattern contains a mixture of inverted ; and non-inverted bit patterns. XLIB screenstr_callee XDEF ASMDISP_SCREENSTR_CALLEE LIB zx_cyx2saddr_callee XREF ASMDISP_ZX_CYX2SADDR_CALLEE .screenstr_callee pop hl pop de ex (sp),hl ld h,l ld l,e .asmentry ; h = char Y 0..23 ; l = char X 0..31 ; ; exit : hl = ascii char code if match, else 0 and carry set call zx_cyx2saddr_callee + ASMDISP_ZX_CYX2SADDR_CALLEE ; hl = screen address ld c,96 ; number of chars to match against ld de,(23606) ; use CHARS system variable to locate character set bitmap inc d .charloop ld b,8 ; match 8 pixel rows push hl .mloop ld a,(de) xor (hl) jr z, cont ; jump if bit patterns match inc a jr nz, nomatch ; jump if bit patterns are not inverses .cont inc de inc h djnz mloop .match pop hl ld a,128 sub c ld l,a ; hl = ascii char code ld h,b ret .nomatch ld a,8 sub b add a,e ld e,a jp nc, cont inc d .cont pop hl dec c jp nz, charloop ld l,c ld h,c ; return with 0 to indicate no match scf ret DEFC ASMDISP_SCREENSTR_CALLEE = asmentry - screenstr_callee z88dk-1.8.ds1/libsrc/spectrum/tape_load_block.asm0000644000175000017500000000056210633632101021426 0ustar tygrystygrys; int tape_load_block(void *addr, size_t len, unsigned char type) ; CALLER linkage for function pointers XLIB tape_load_block LIB tape_load_block_callee XREF ASMDISP_TAPE_LOAD_BLOCK_CALLEE .tape_load_block pop hl pop bc ld a,c pop de pop ix push hl push de push bc push hl jp tape_load_block_callee + ASMDISP_TAPE_LOAD_BLOCK_CALLEE z88dk-1.8.ds1/libsrc/spectrum/tape_load_block_callee.asm0000644000175000017500000000111510637523155022742 0ustar tygrystygrys; ; Tape load routine ; ; djm 16/10/2001 ; ; int __CALLEE__ tape_load_block_callee(void *addr, size_t len, unsigned char type) ; XLIB tape_load_block_callee XDEF ASMDISP_TAPE_LOAD_BLOCK_CALLEE XREF call_rom3 .tape_load_block_callee pop hl pop bc ld a,c pop de pop ix push hl .asmentry ; enter : ix = addr ; de = len ; a = type scf call call_rom3 defw 1366 ;call ROM3 load routine ld hl,-1 ret nc ;error inc hl ;okay ret DEFC ASMDISP_TAPE_LOAD_BLOCK_CALLEE = asmentry - tape_load_block_callee z88dk-1.8.ds1/libsrc/spectrum/tape_save.c0000755000175000017500000000124110633632101017733 0ustar tygrystygrys/* * Tape save routine * * * djm 16/10/2001 */ #define __HAVESEED #include #include #include int tape_save(char *name, size_t loadstart,void *start, size_t len) { struct zxtapehdr hdr; int l,i; l = strlen(name); if ( l > 10 ) l = 10; for (i=0 ; i < l ; i++ ) hdr.name[i] = name[i]; for ( ; i < 10 ; i++ ) hdr.name[i] = 32; hdr.type = 3; hdr.length = len; hdr.address = loadstart; hdr.offset = len; if ( tape_save_block(&hdr,17,0) ) return -1; if ( tape_save_block(start,len,255) ) return -1; return 0; } z88dk-1.8.ds1/libsrc/spectrum/tape_save_block.asm0000644000175000017500000000056210633632101021445 0ustar tygrystygrys; int tape_save_block(void *addr, size_t len, unsigned char type) ; CALLER linkage for function pointers XLIB tape_save_block LIB tape_save_block_callee XREF ASMDISP_TAPE_SAVE_BLOCK_CALLEE .tape_save_block pop hl pop bc ld a,c pop de pop ix push hl push de push bc push hl jp tape_save_block_callee + ASMDISP_TAPE_SAVE_BLOCK_CALLEE z88dk-1.8.ds1/libsrc/spectrum/tape_save_block_callee.asm0000644000175000017500000000163410637523155022767 0ustar tygrystygrys; ; Tape save routine ; ; djm 16/10/2001 ; ; int __CALLEE__ tape_save_block_callee(void *addr, size_t len, unsigned char type) XLIB tape_save_block_callee XDEF ASMDISP_TAPE_SAVE_BLOCK_CALLEE XREF call_rom3 .tape_save_block_callee pop hl pop bc ld a,c pop de pop ix push hl ; enter : ix = addr ; de = len ; a = type .asmentry ld hl,(23613) push hl ld hl,saveblock1 push hl ld (23613),sp call call_rom3 defw 1218 ;call ROM3 routine pop hl ;successfull dump the random value ld hl,0 .saveblock2 pop de ld (23613),de ;get back original 23613 ret .saveblock1 ld hl,-1 ;error jr saveblock2 DEFC ASMDISP_TAPE_SAVE_BLOCK_CALLEE = asmentry - tape_save_block_callee z88dk-1.8.ds1/libsrc/spectrum/zx_128mode.asm0000755000175000017500000000066610450600346020237 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 26/06/2006 ; ; int zx_128mode(); ; ; The result is: ; - 0 (false) if the spectrum is not a ZX128 or if it is in 48K mode ; - 1 (true) if the spectrum is a Spectrum 128K in 128K mode ; ; $Id: zx_128mode.asm,v 1.1 2006/06/28 22:21:26 stefano Exp $ ; XLIB zx_128mode zx_128mode: ld hl,0 ld a,(75) cp 191 ret z ld a,(23611) and 16 ret z inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_aaddr2cx.asm0000644000175000017500000000023010633632102020526 0ustar tygrystygrys; uint __FASTCALL__ zx_aaddr2cx(void *attraddr) ; aralbrec 06.2007 XLIB zx_aaddr2cx .zx_aaddr2cx ld a,l and $1f ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/spectrum/zx_aaddr2cy.asm0000644000175000017500000000027710633632102020542 0ustar tygrystygrys; uint __FASTCALL__ zx_aaddr2cy(void *attraddr) ; aralbrec 06.2007 XLIB zx_aaddr2cy .zx_aaddr2cy add hl,hl add hl,hl add hl,hl ld a,h and $1f ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/spectrum/zx_aaddr2px.asm0000644000175000017500000000025610633632102020553 0ustar tygrystygrys; uint __FASTCALL__ zx_aaddr2px(void *attraddr) ; aralbrec 06.2007 XLIB zx_aaddr2px .zx_aaddr2px ld a,l rla rla rla and $f8 ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/spectrum/zx_aaddr2py.asm0000644000175000017500000000031010633632102020543 0ustar tygrystygrys; uint __FASTCALL__ zx_aaddr2py(void *attraddr) ; aralbrec 06.2007 XLIB zx_aaddr2py .zx_aaddr2py ld a,l and $e0 srl h rra srl h rra srl h rra ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/spectrum/zx_aaddr2saddr.asm0000644000175000017500000000026110633632102021215 0ustar tygrystygrys; uchar __FASTCALL__ *zx_aaddr2saddr(void *attraddr) ; aralbrec 06.2007 XLIB zx_aaddr2saddr .zx_aaddr2saddr ld a,h rlca rlca rlca xor $82 ld h,a ret z88dk-1.8.ds1/libsrc/spectrum/zx_aaddrcdown.asm0000644000175000017500000000051310633632102021150 0ustar tygrystygrys; uchar __FASTCALL__ *zx_aaddrcdown(void *attraddr) ; aralbrec 06.2007 XLIB zx_aaddrcdown .zx_aaddrcdown ; enter : hl = attribute address ; exit : hl = new attribute address down one character ; carry set if off screen .attr_chardown ld a,l add a,$20 ld l,a ret nc inc h ld a,$5a cp h ret z88dk-1.8.ds1/libsrc/spectrum/zx_aaddrcleft.asm0000644000175000017500000000044610633632102021140 0ustar tygrystygrys; uchar __FASTCALL__ *zx_aaddrcleft(void *attraddr) ; aralbrec 06.2007 XLIB zx_aaddrcleft .zx_aaddrcleft ; enter : hl = attribute address ; exit : hl = new attribute address left one character with line wrap ; carry if off screen dec hl ld a,h cp $58 ret z88dk-1.8.ds1/libsrc/spectrum/zx_aaddrcright.asm0000644000175000017500000000043310633632102021317 0ustar tygrystygrys; uchar __FASTCALL__ *zx_aaddrcright(void *attraddr) ; aralbrec 06.2007 XLIB zx_aaddrcright .zx_aaddrcright ; hl = valid attribute address ; hl = new attribute address right one character with line wrap ; carry if off screen inc hl ld a,$5a cp h ret z88dk-1.8.ds1/libsrc/spectrum/zx_aaddrcup.asm0000644000175000017500000000046310633632102020631 0ustar tygrystygrys; uchar __FASTCALL__ *zx_aaddrcup(void *attraddr) ; aralbrec 06.2007 XLIB zx_aaddrcup .zx_aaddrcup ; enter : hl = valid attribute address ; exit : hl = new attribute address up one character ; carry if off screen ld a,l sub $20 ld l,a ret nc dec h ld a,h cp $58 ret z88dk-1.8.ds1/libsrc/spectrum/zx_attr.asm0000644000175000017500000000043210637142614020024 0ustar tygrystygrys; uint zx_attr(uchar row, uchar col) ; CALLER linkage for function pointers XLIB zx_attr LIB zx_attr_callee XREF ASMDISP_ZX_ATTR_CALLEE .zx_attr pop af pop de pop hl push hl push de push af ld h,l ld l,e jp zx_attr_callee + ASMDISP_ZX_ATTR_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_attr_callee.asm0000644000175000017500000000072110637142614021332 0ustar tygrystygrys; uint __CALLEE__ zx_attr_callee(uchar row, uchar col) ; aralbrec 06.2007 XLIB zx_attr_callee XDEF ASMDISP_ZX_ATTR_CALLEE LIB zx_cyx2aaddr_callee XREF ASMDISP_ZX_CYX2AADDR_CALLEE .zx_attr_callee pop hl pop de ex (sp),hl ld h,l ld l,e .asmentry ; h = char Y 0..23 ; l = char X 0..31 call zx_cyx2aaddr_callee + ASMDISP_ZX_CYX2AADDR_CALLEE ld l,(hl) ld h,0 ret DEFC ASMDISP_ZX_ATTR_CALLEE = asmentry - zx_attr_callee z88dk-1.8.ds1/libsrc/spectrum/zx_basemem.asm0000755000175000017500000000054010534057466020474 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 21/09/2006 ; ; int zx_basemem; ; ; This function returns the base memory size in kbytes ; ; $Id: zx_basemem.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_basemem zx_basemem: ld a,(23733) srl a inc a srl a sub 16 ; subtract the ROM size ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/spectrum/zx_basic_length.asm0000755000175000017500000000064510450600346021477 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 22/06/2006 ; ; This routine gives the length of the current BASIC program. ; Memory used by variables is not included. ; ; $Id: zx_basic_length.asm,v 1.1 2006/06/28 22:21:26 stefano Exp $ ; XLIB zx_basic_length zx_basic_length: ld de,($5c53) ; PROG :location of BASIC program ld hl,($5c4b) ; VARS :location of variables sbc hl,de ret z88dk-1.8.ds1/libsrc/spectrum/zx_border.asm0000644000175000017500000000017410637142614020332 0ustar tygrystygrys; 04.2006 aralbrec ; void __FASTCALL__ zx_border(uchar colour) XLIB zx_border .zx_border ld a,l out (254),a ret z88dk-1.8.ds1/libsrc/spectrum/zx_break.asm0000755000175000017500000000053110730213552020133 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_break(); ; ; Check if the CAPS-SPACE (BREAK) key is being pressed ; ( 1 = pressed; 0 = not pressed ) ; ; $Id: zx_break.asm,v 1.1 2007/12/13 11:28:42 stefano Exp $ ; XLIB zx_break zx_break: in a,($fe) and 1 xor 1 ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/spectrum/zx_cy2aaddr.asm0000644000175000017500000000033610633632102020536 0ustar tygrystygrys; uchar __FASTCALL__ *zx_cy2aaddr(uchar row) ; aralbrec 06.2007 XLIB zx_cy2aaddr .zx_cy2aaddr ld a,l rrca rrca rrca ld h,a and $e0 ld l,a ld a,h and $03 or $58 ld h,a ret z88dk-1.8.ds1/libsrc/spectrum/zx_cy2saddr.asm0000644000175000017500000000034410633632102020557 0ustar tygrystygrys; uchar __FASTCALL__ *zx_cy2saddr(uchar row) ; aralbrec 06.2007 XLIB zx_cy2saddr ; l = char Y 0..23 .zx_cy2saddr ld a,l and $18 or $40 ld h,a ld a,l rrca rrca rrca and $e0 ld l,a ret z88dk-1.8.ds1/libsrc/spectrum/zx_cyx2aaddr.asm0000644000175000017500000000046510633632102020731 0ustar tygrystygrys; uchar *zx_cyx2aaddr(uchar row, uchar col) ; CALLER linkage for function pointers XLIB zx_cyx2aaddr LIB zx_cyx2aaddr_callee XREF ASMDISP_ZX_CYX2AADDR_CALLEE .zx_cyx2aaddr pop af pop hl pop de push de push hl push af ld h,e jp zx_cyx2aaddr_callee + ASMDISP_ZX_CYX2AADDR_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_cyx2aaddr_callee.asm0000644000175000017500000000073210633632102022233 0ustar tygrystygrys; uchar __CALLEE__ *zx_cyx2aaddr_callee(uchar row, uchar col) ; aralbrec 06.2007 XLIB zx_cyx2aaddr_callee XDEF ASMDISP_ZX_CYX2AADDR_CALLEE .zx_cyx2aaddr_callee pop hl pop de ex (sp),hl ld h,l ld l,e .asmentry ; h = char Y 0..23 ; l = char X 0..31 ld a,h rrca rrca rrca ld h,a and $e0 or l ld l,a ld a,h and $03 or $58 ld h,a ret DEFC ASMDISP_ZX_CYX2AADDR_CALLEE = asmentry - zx_cyx2aaddr_callee z88dk-1.8.ds1/libsrc/spectrum/zx_cyx2saddr.asm0000644000175000017500000000046510633632102020753 0ustar tygrystygrys; uchar *zx_cyx2saddr(uchar row, uchar col) ; CALLER linkage for function pointers XLIB zx_cyx2saddr LIB zx_cyx2saddr_callee XREF ASMDISP_ZX_CYX2SADDR_CALLEE .zx_cyx2saddr pop bc pop hl pop de ld h,d push de push hl push bc jp zx_cyx2saddr_callee + ASMDISP_ZX_CYX2SADDR_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_cyx2saddr_callee.asm0000644000175000017500000000071410633632103022256 0ustar tygrystygrys; uchar __CALLEE__ *zx_cyx2saddr_callee(uchar row, uchar col) ; aralbrec 06.2007 XLIB zx_cyx2saddr_callee XDEF ASMDISP_ZX_CYX2SADDR_CALLEE .zx_cyx2saddr_callee pop hl pop de ex (sp),hl ld h,l ld l,e .asmentry ; h = char Y 0..23 ; l = char X 0..31 ld a,h rrca rrca rrca and $e0 or l ld l,a ld a,h and $18 or $40 ld h,a ret DEFC ASMDISP_ZX_CYX2SADDR_CALLEE = asmentry - zx_cyx2saddr_callee z88dk-1.8.ds1/libsrc/spectrum/zx_extsys.asm0000755000175000017500000000105510534057466020424 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_extsys(); ; ; Check whether the BASIC program has been moved to leave space for ; extra system variables, normally added by some added interface. ; ; The result is: ; - 0 (false) the BASIC is at its normal position ; - 1 (true) the BASIC program has been moved ; ; $Id: zx_extsys.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_extsys zx_extsys: ld hl,(23635) ld de,23755 scf ccf sbc hl,de ld a,h or l ld hl,0 ret z inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_floatingbus.asm0000755000175000017500000000102710754330255021373 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 12/02/2008 ; ; int zx_floatingbus(); ; ; The result is: ; - 1 (true) if Spectrum has floating bus ; - 0 (false) otherwise ; ; $Id: zx_floatingbus.asm,v 1.1 2008/02/12 14:43:57 stefano Exp $ ; XLIB zx_floatingbus zx_floatingbus: ld hl,1 ld e,h ld bc,32767 loop: push bc ld bc,65535 in a,($c) pop bc add e ld e,a dec bc ld a,b or c jr nz,loop ld a,e cp l ; is it one ? ret nz ; no, floating bus is present ! dec hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_fullerstick.asm0000755000175000017500000000065610534057466021422 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_fullerstick(); ; ; The result is: ; - 1 (true) if a fuller Joystickstick is present ; - 0 (false) otherwise ; ; $Id: zx_fullerstick.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_fullerstick zx_fullerstick: ld hl,0 ld bc,65535 loop: in a,($7f) cp 255 ret nz dec bc ld a,b or c jr nz,loop inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_getint.asm0000755000175000017500000000107110633632101020336 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 28/06/2006 ; ; Copy a variable from basic to integer ; Float values are rounded authomatically ; ; int __FASTCALL__ zx_getint(char *variable); ; ; ; $Id: zx_getint.asm,v 1.2 2007/06/13 00:03:13 aralbrec Exp $ ; XLIB zx_getint LIB zx_locatenum INCLUDE "#zxfp.def" ; hl = char *variable zx_getint: call zx_locatenum jr c,error ld a,(hl) inc hl ld e,(hl) inc hl ld d,(hl) inc hl ld c,(hl) inc hl ld b,(hl) call ZXFP_STK_STORE call ZXFP_FP_TO_BC ld h,b ld l,c ret error: ld hl,-1 ret z88dk-1.8.ds1/libsrc/spectrum/zx_getstr.asm0000755000175000017500000000043110633632101020353 0ustar tygrystygrys; int zx_getstr(char variable, char *value) ; CALLER linkage for function pointers XLIB zx_getstr LIB zx_getstr_callee XREF ASMDISP_ZX_GETSTR_CALLEE .zx_getstr pop bc pop hl pop de push de push hl push bc jp zx_getstr_callee + ASMDISP_ZX_GETSTR_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_getstr_callee.asm0000644000175000017500000000152110705630630021663 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 22/06/2006 ; ; Copy a variable from basic ; ; int __CALLEE__ zx_getstr_callee(char variable, char *value); ; ; ; $Id: zx_getstr_callee.asm,v 1.2 2007/10/18 10:12:40 stefano Exp $ ; XLIB zx_getstr_callee XDEF ASMDISP_ZX_GETSTR_CALLEE zx_getstr_callee: pop bc pop hl pop de push bc ; enter : hl = char *value ; e = char variable .asmentry ld a,e and 95 ld (morevar+1),a ld (pointer+1),hl ld hl,($5c4b) ; VARS loop: ld a,(hl) cp 128 jr nz,morevar ld hl,-1 ; variable not found ret morevar: cp 0 jr nz,nextvar inc hl ld c,(hl) inc hl ld b,(hl) inc hl pointer: ld de,0 ldir inc de xor a ld (de),a ld hl,0 ret nextvar: call $19b8 ;get next variable start ex de,hl jr loop DEFC ASMDISP_ZX_GETSTR_CALLEE = asmentry - zx_getstr_callee z88dk-1.8.ds1/libsrc/spectrum/zx_goto.asm0000755000175000017500000000247610641013425020027 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 22/06/2006 ; ; int __FASTCALL__ zx_goto(int line); ; ; Jumps to a BASIC program line. ; Returns on error or if program is finished correctly. ; The STOP statement can be used as a sort of "RETURN" command. ; In that case, to handle errors, consider that its error code is #9. ; ; NOTE: The Interface 1 (and probably other interfaces too) stops the ; program on any error trapped directly by the shadow ROM, ; including the infamous "program finished" ; ; to solve this you need to put a BASIC line like: ; 9999 REM ; or ; 9999 STOP ; ; $Id: zx_goto.asm,v 1.4 2007/06/28 20:16:21 stefano Exp $ ; XLIB zx_goto ; enter : hl = line number zx_goto: ld bc,($5c3d) push bc ; save original ERR_SP ld bc,return push bc ld ($5c3d),sp ; update error handling routine ld ($5c6e),hl ; BASIC line number xor a ld ($5c44),a ; Position within line call $1b9e ; Enter BASIC pop bc ld hl,0 jr exitgoto return: ld h,0 ld l,(iy+0) ; error code (hope so !) ld (iy+0),255 ; reset ERR_NR bit 0,(iy+124) ; test FLAGS3: coming from paged ROM ? jr nz,stderr ld (iy+124),0 ; yes, reset FLAGS3.. ld l,254 ; ... and set error code to 255 stderr: inc l ; return with error code (0=OK, etc..) exitgoto: pop bc ld ($5c3d),bc ; restore orginal ERR_SP ret z88dk-1.8.ds1/libsrc/spectrum/zx_interface1.asm0000755000175000017500000000177110753010311021070 0ustar tygrystygrys; ; ZX Spectrum specific routines ; ; int zx_interface1(); ; ; The result is: ; - 0 (false) if the ZX Interface1 is missing ; - 1 (true) if the ZX Interface1 is connected ; ; This function has the side of loading the Interface 1 ; system variables if they aren't already present. ; ; Shouldn't conflict with other interfaces. ; ; $Id: zx_interface1.asm,v 1.4 2008/02/08 08:20:25 stefano Exp $ ; XLIB zx_interface1 LIB if1_installed zx_interface1: ld bc,($5c3d) push bc ; save original ERR_SP ld bc,return push bc ld ($5c3d),sp ; update error handling routine rst $28 ; load zero to floating point stack defb $a0 ; stk-zero defb $38 ; end-calc call $16e5 ; CLOSE #0 (this will force IF1 to activate system variables) pop bc return: pop bc ld (iy+0),255 ; reset ERR_NR ; bit 0,(iy+124) ; test FLAGS3: coming from paged ROM ? ; jr nz,stderr ; ld (iy+124),0 ; yes, reset FLAGS3 ;stderr: ld ($5c3d),bc ; restore orginal ERR_SP jp if1_installed z88dk-1.8.ds1/libsrc/spectrum/zx_iss_stick.asm0000755000175000017500000000055410534057466021063 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_iss_stick(); ; ; The result is: ; - 1 (true) if the ISS Joystick interface is connected ; - 0 (false) otherwise ; ; $Id: zx_iss_stick.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_iss_stick zx_iss_stick: ld hl,0 in a,(32) cp 32 ret nc inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_issue3.asm0000755000175000017500000000072310450600346020265 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 22/06/2006 ; ; int zx_issue3(); ; ; The result is: ; - 0 (false) if the spectrum is issue 1 or 2. ; - 1 (true) if the spectrum is an "issue 3" or more ; ; $Id: zx_issue3.asm,v 1.3 2006/06/28 22:21:26 stefano Exp $ ; XLIB zx_issue3 zx_issue3: ld a,(23624) rrca rrca rrca or 8 out (254),a ld bc,57342 in a,(c) in a,(c) ld hl,1 ; true xor 255 ret nz dec hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_kempston.asm0000755000175000017500000000054310534057466020726 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_kempston(); ; ; The result is: ; - 1 (true) if the Kempston Joystick is connected ; - 0 (false) otherwise ; ; $Id: zx_kempston.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_kempston zx_kempston: ld hl,0 in a,(31) cp 32 ret nc inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_kempstonmouse.asm0000755000175000017500000000067410534057466022004 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_kempstonmouse(); ; ; The result is: ; - 1 (true) if a Kempston mouse is present ; - 0 (false) otherwise ; ; $Id: zx_kempstonmouse.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_kempstonmouse zx_kempstonmouse: ld hl,0 ld de,65535 loop: ld bc,64223 in a,(c) cp 255 ret nz dec de ld a,d or e jr nz,loop inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_locatenum.asm0000755000175000017500000000247710454510140021045 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 28/06/2006 ; ; Locate the numeric variable having name pointed by HL ; Internal routine used by zx_getint and zx_setint ; ; Carry flag is set on error ; ; ; $Id: zx_locatenum.asm,v 1.2 2006/07/10 17:37:36 stefano Exp $ ; XLIB zx_locatenum zx_locatenum: ld a,(hl) and a jr nz,notempty scf ret notempty: or 32 ld c,a ; keep the first letter push hl inc hl ld a,(hl) and a ; only 1 char for var name ? jr z,onechar ld a,63 ; first letter of a long numeric variable name and c ; has those odd bits added or 160 ld c,a onechar: ld hl,($5c4b) vp: ld a,(hl) cp 128 jr z,notfound cp c jr z,v2 v1: push bc call $19b8 ; find next variable pop bc ex de,hl jr vp v2: and 224 cp 160 jr nz,result pop de push de push hl v3: inc hl inc de ld a,(de) or 96 ld b,a inc de ; if this is the last character in the ld a,(de) ; variable name, then... dec de and a ld a,b jr nz,noterminate add 128 ; ...add the ZX style string terminator noterminate: cp (hl) jr nz,v4 rla jr nc,v3 inc de ld a,(de) dec de and a jr nz,v3 pop de jr result v4: pop hl jr v1 result: inc hl pop de and a ret notfound: pop de scf ret z88dk-1.8.ds1/libsrc/spectrum/zx_mb02.asm0000755000175000017500000000055410754330255017622 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 11/02/2008 ; ; int zx_mb02(); ; ; The result is: ; - 0 (false) if MB-02 isn't connected ; - 1 (true) if MB-02 real time clock is responding ; ; $Id: zx_mb02.asm,v 1.1 2008/02/12 14:43:57 stefano Exp $ ; XLIB zx_mb02 zx_mb02: ld bc,3 in a,(c) cp 10 ld hl,0 ret nc inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_model.asm0000755000175000017500000000221510534057466020164 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 22/09/2006 ; ; int zx_model(); ; ; The result is: ; - 0 unknown ; - 1 if the spectrum is a 48K ; - 2 if we have a Spectrum 128K or +2 ; - 3 if it is a Spectrum +2A or Pentagon ; - 4 if it is a Spectrum +3 ; - 5 if it is a Spectrum +2A or +3 fixed for games ; - 6 TS2068 ; (disabled) - 7 Scorpion or similar clone ; ; $Id: zx_model.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_model zx_model: ld hl,0 ld a,(75) cp 191 jr z,classiclike cp 110 jr z,newmodels cp 225 ld l,6 ; TS2068 ret z ld l,0 ret classiclike: ld l,1 ret newmodels: ld de,16384 loop0: in a,(255) cp 127 ld l,5 ret z ld l,2 ret c dec de ld a,d or e jr nz,loop0 ld de,16384 loop: ld bc,$2ffd in a,(c) cp 56 ; If you find ULA related data, then you have a Scorpion like clone ld l,7 ; sadly you'll never fall here ! ret z and a ld l,2 ret z cp 128 ld l,4 ret z cp 255 jr nz,plus3 ; ..or should it be unknowk ? endloop: dec de ld a,d or e jr nz,loop in a,(c) cp 255 ld l,3 ret z plus3: ld l,4 ret z88dk-1.8.ds1/libsrc/spectrum/zx_multiface.asm0000755000175000017500000000065210534057466021040 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_multiface(); ; ; The result is: ; - 1 (true) if the MultiFace is connected ; - 0 (false) otherwise ; ; $Id: zx_multiface.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_multiface zx_multiface: ld hl,0 in a,($bf) in a,($9f) ld a,(200) ld b,a in a,($3f) in a,($1f) ld a,(200) cp b ret z inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_plus3fdc.asm0000755000175000017500000000071210534057466020607 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_plus3fdc(); ; ; The result is: ; - 1 (true) if a +3 floppy controller is found ; - 0 (false) otherwise ; ; $Id: zx_plus3fdc.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_plus3fdc zx_plus3fdc: ld hl,0 ld de,65535 loop: ld bc,$2ffd in a,(c) cp 255 ret z cp 56 ret z cp 0 ret z dec de ld a,d or e jr nz,loop inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_printer.asm0000755000175000017500000000053310534057466020550 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_printer(); ; ; The result is: ; - 1 (true) if the ZX printer is connected ; - 0 (false) otherwise ; ; $Id: zx_printer.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_printer zx_printer: ld hl,0 in a,($fb) bit 6,a ret nz inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_pxy2aaddr.asm0000644000175000017500000000047310633632103020746 0ustar tygrystygrys; uchar *zx_pxy2aaddr(uchar xcoord, uchar ycoord) ; CALLER linkage for function pointers XLIB zx_pxy2aaddr LIB zx_pxy2aaddr_callee XREF ASMDISP_ZX_PXY2AADDR_CALLEE .zx_pxy2aaddr pop af pop de pop hl push hl push de push af ld h,e jp zx_pxy2aaddr_callee + ASMDISP_ZX_PXY2AADDR_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_pxy2aaddr_callee.asm0000644000175000017500000000106010633632103022244 0ustar tygrystygrys; uchar __CALLEE__ *zx_pxy2aaddr_callee(uchar xcoord, uchar ycoord) ; aralbrec 06.2007 XLIB zx_pxy2aaddr_callee XDEF ASMDISP_ZX_PXY2AADDR_CALLEE .zx_pxy2aaddr_callee pop hl pop de ex (sp),hl ld h,e .asmentry ; enter: l = pix X 0..255 ; h = pix Y 0..191 ; exit : hl = screen address ; uses : af, hl srl l srl l srl l ld a,h rlca rlca ld h,a and $e0 or l ld l,a ld a,h and $03 or $58 ld h,a ret DEFC ASMDISP_ZX_PXY2AADDR_CALLEE = asmentry - zx_pxy2aaddr_callee z88dk-1.8.ds1/libsrc/spectrum/zx_pxy2saddr.asm0000644000175000017500000000053510633632103020767 0ustar tygrystygrys; uchar *zx_pxy2saddr(uchar xcoord, uchar ycoord, uchar *mask) ; CALLER linkage for function pointers XLIB zx_pxy2saddr LIB zx_pxy2saddr_callee XREF ASMDISP_ZX_PXY2SADDR_CALLEE .zx_pxy2saddr pop af pop de pop bc pop hl push hl push bc push de push af ld h,c jp zx_pxy2saddr_callee + ASMDISP_ZX_PXY2SADDR_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_pxy2saddr_callee.asm0000644000175000017500000000160710633632103022275 0ustar tygrystygrys; uchar __CALLEE__ *zx_pxy2saddr_callee(uchar xcoord, uchar ycoord, uchar *mask) ; aralbrec 06.2007 XLIB zx_pxy2saddr_callee XDEF ASMDISP_ZX_PXY2SADDR_CALLEE .zx_pxy2saddr_callee pop hl pop de pop bc ex (sp),hl ld h,c .asmentry ; enter: l = pix X 0..255 ; h = pix Y 0..191 ; de = uchar *mask, if 0 skip mask ; exit : hl = screen address ; e = mask ; uses : af, b, de, hl ld a,d or e jr z, skipmask ld a,l and $07 ld b,a ld a,$80 jr z, nomaskrotate .rotloop rra djnz rotloop .nomaskrotate ld (de),a ld e,a .skipmask ld a,h and $07 or $40 ld d,a ld a,h rra rra rra and $18 or d ld d,a srl l srl l srl l ld a,h rla rla and $e0 or l ld l,a ld h,d ret DEFC ASMDISP_ZX_PXY2SADDR_CALLEE = asmentry - zx_pxy2saddr_callee z88dk-1.8.ds1/libsrc/spectrum/zx_py2aaddr.asm0000644000175000017500000000033110633632103020547 0ustar tygrystygrys; uchar __FASTCALL__ *zx_py2aaddr(uchar ycoord) ; aralbrec 06.2007 XLIB zx_py2aaddr .zx_py2aaddr ld a,l rlca rlca ld h,a and $e0 ld l,a ld a,h and $03 or $58 ld h,a ret z88dk-1.8.ds1/libsrc/spectrum/zx_py2saddr.asm0000644000175000017500000000040510633632103020573 0ustar tygrystygrys; uchar __FASTCALL__ *zx_py2saddr(uchar ycoord) ; aralbrec 06.2007 XLIB zx_py2saddr .zx_py2saddr ld a,l and $07 or $40 ld h,a ld a,l rra rra rra and $18 or h ld h,a ld a,l rla rla and $e0 ld l,a ret z88dk-1.8.ds1/libsrc/spectrum/zx_saddr2aaddr.asm0000644000175000017500000000027110633632103021217 0ustar tygrystygrys; uchar __FASTCALL__ *zx_saddr2aaddr(void *pixeladdr) ; aralbrec 06.2007 XLIB zx_saddr2aaddr .zx_saddr2aaddr ld a,h rra rra rra and $03 or $58 ld h,a ret z88dk-1.8.ds1/libsrc/spectrum/zx_saddr2cx.asm0000644000175000017500000000023110633632103020552 0ustar tygrystygrys; uint __FASTCALL__ zx_saddr2cx(void *pixeladdr) ; aralbrec 06.2007 XLIB zx_saddr2cx .zx_saddr2cx ld a,l and $1f ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/spectrum/zx_saddr2cy.asm0000644000175000017500000000033010633632104020554 0ustar tygrystygrys; uint __FASTCALL__ zx_saddr2cy(void *pixeladdr) ; aralbrec 06.2007 XLIB zx_saddr2cy .zx_saddr2cy ld a,l rlca rlca rlca and $07 ld l,a ld a,h and $18 or l ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/spectrum/zx_saddr2px.asm0000644000175000017500000000046410633632104020600 0ustar tygrystygrys; uint zx_saddr2px(void *pixeladdr, uchar mask) ; CALLER linkage for function pointers XLIB zx_saddr2px LIB zx_saddr2px_callee XREF ASMDISP_ZX_SADDR2PX_CALLEE .zx_saddr2px pop af pop de pop hl push hl push de push af ld a,e jp zx_saddr2px_callee + ASMDISP_ZX_SADDR2PX_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_saddr2px_callee.asm0000644000175000017500000000077410633632104022111 0ustar tygrystygrys; uint __CALLEE__ zx_saddr2px_callee(void *pixeladdr, uchar mask) ; aralbrec 06.2007 XLIB zx_saddr2px_callee XDEF ASMDISP_ZX_SADDR2PX_CALLEE .zx_saddr2px_callee pop hl pop de ld a,e ex (sp),hl .asmentry ; enter : a = mask ; hl = screen address ; exit : hl = pixel X 0..255 ; uses : af, hl ld h,0 sla l sla l sla l or a ret z dec l .maskloop inc l rla jp nc, maskloop ret DEFC ASMDISP_ZX_SADDR2PX_CALLEE = asmentry - zx_saddr2px_callee z88dk-1.8.ds1/libsrc/spectrum/zx_saddr2py.asm0000644000175000017500000000042210633632104020573 0ustar tygrystygrys; uint __FASTCALL__ zx_saddr2py(void *pixeladdr) ; aralbrec 06.2007 XLIB zx_saddr2py .zx_saddr2py ld a,l rra rra and $38 ld l,a ld a,h rla rla rla and $c0 or l ld l,a ld a,h and $07 or l ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/spectrum/zx_saddrcdown.asm0000644000175000017500000000053210633632104021175 0ustar tygrystygrys; uchar __FASTCALL__ *zx_saddrcdown(void *pixeladdr) ; aralbrec 06.2007 XLIB zx_saddrcdown .zx_saddrcdown ; enter: hl = valid screen address ; exit : carry = moved off screen ; hl = new screen address one char down ; uses : af,hl ld a,l add a,$20 ld l,a ret nc ld a,h add a,$08 ld h,a cp $58 ccf ret z88dk-1.8.ds1/libsrc/spectrum/zx_saddrcleft.asm0000644000175000017500000000054010633632104021157 0ustar tygrystygrys; uchar __FASTCALL__ *zx_saddrcleft(void *pixeladdr) ; aralbrec 06.2007 XLIB zx_saddrcleft .zx_saddrcleft ; enter: hl = valid screen address ; exit : carry = moved off screen ; hl = new screen address one character left with line wrap ; uses : af, hl ld a,l dec l or a ret nz ld a,h sub $08 ld h,a cp $40 ret z88dk-1.8.ds1/libsrc/spectrum/zx_saddrcright.asm0000644000175000017500000000053410633632104021345 0ustar tygrystygrys; uchar __FASTCALL__ *zx_saddrcright(void *pixeladdr) ; aralbrec 06.2007 XLIB zx_saddrcright .zx_saddrcright ; enter: hl = valid screen address ; exit : carry = moved off screen ; hl = new screen address one character right with line wrap ; uses : af, hl inc l ret nz ld a,8 add a,h ld h,a cp $58 ccf ret z88dk-1.8.ds1/libsrc/spectrum/zx_saddrcup.asm0000644000175000017500000000051510633632104020653 0ustar tygrystygrys; uchar __FASTCALL__ *zx_saddrcup(void *pixeladdr) ; aralbrec 06.2007 XLIB zx_saddrcup .zx_saddrcup ; enter: hl = valid screen address ; exit : carry = moved off screen ; hl = new screen address up one character ; uses : af, hl ld a,l sub $20 ld l,a ret nc ld a,h sub $08 ld h,a cp $40 ret z88dk-1.8.ds1/libsrc/spectrum/zx_saddrpdown.asm0000644000175000017500000000065210633632104021215 0ustar tygrystygrys; uchar __FASTCALL__ *zx_saddrpdown(void *pixeladdr) ; aralbrec 06.2007 XLIB zx_saddrpdown .zx_saddrpdown ; enter: hl = valid screen address ; exit : carry = moved off screen ; hl = new screen address one pixel down ; uses : af, hl inc h ld a,h and $07 ret nz ld a,h sub $08 ld h,a ld a,l add a,$20 ld l,a ret nc ld a,h add a,$08 ld h,a cp $58 ccf ret z88dk-1.8.ds1/libsrc/spectrum/zx_saddrpleft.asm0000644000175000017500000000047210633632105021201 0ustar tygrystygrys; uchar *zx_saddrpleft(void *pixeladdr, uchar *mask) ; CALLER linkage for function pointers XLIB zx_saddrpleft LIB zx_saddrpleft_callee XREF ASMDISP_ZX_SADDEPLEFT_CALLEE .zx_saddrpleft pop af pop hl pop de push de push hl push af jp zx_saddrpleft_callee + ASMDISP_ZX_SADDRPLEFT_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_saddrpleft_callee.asm0000644000175000017500000000112410633632105022501 0ustar tygrystygrys; uchar __CALLEE__ *zx_saddrpleft_callee(void *pixeladdr, uchar *mask) ; aralbrec 06.2007 XLIB zx_saddrpleft_callee XDEF ASMDISP_ZX_SADDRPLEFT_CALLEE .zx_saddrpleft_callee pop af pop hl pop de push af .asmentry ; enter: de = valid screen address ; hl = uchar *mask ; exit : carry = moved off screen ; hl = new screen address left one pixel ; *mask = new bitmask left one pixel ; uses : af, hl, de rlc (hl) ex de,hl ret nc ld a,l dec l and $1f ret nz scf ret DEFC ASMDISP_ZX_SADDRPLEFT_CALLEE = asmentry - zx_saddrpleft_callee z88dk-1.8.ds1/libsrc/spectrum/zx_saddrpright.asm0000644000175000017500000000050110633632105021355 0ustar tygrystygrys; uchar *zx_saddrpright(void *pixeladdr, uchar *mask) ; CALLER linkage for function pointers XLIB zx_saddrpright LIB zx_saddrpright_callee XREF ASMDISP_ZX_SADDRPRIGHT_CALLEE .zx_saddrpright pop af pop hl pop de push de push hl push af jp zx_saddrpright_callee + ASMDISP_ZX_SADDRPRIGHT_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_saddrpright_callee.asm0000644000175000017500000000114110633632105022663 0ustar tygrystygrys; uchar __CALLEE__ *zx_saddrpright_callee(void *pixeladdr, uchar *mask) ; aralbrec 06.2007 XLIB zx_saddrpright_callee XDEF ASMDISP_ZX_SADDRPRIGHT_CALLEE .zx_saddrpright_callee pop af pop hl pop de push af .asmentry ; enter: de = valid screen address ; hl = uchar *mask ; exit : carry = moved off screen ; hl = new screen address right one pixel ; *mask = new mask right one pixel ; uses : af, hl, de rrc (hl) ex de,hl ret nc inc l ld a,l and $1f ret nz scf ret DEFC ASMDISP_ZX_SADDRPRIGHT_CALLEE = asmentry - zx_saddrpright_callee z88dk-1.8.ds1/libsrc/spectrum/zx_saddrpup.asm0000644000175000017500000000063110633632105020670 0ustar tygrystygrys; uchar __FASTCALL__ *zx_saddrpup(void *pixeladdr) ; aralbrec 06.2007 XLIB zx_saddrpup .zx_saddrpup ; enter: hl = valid screen address ; exit : carry = moved off screen ; hl = new screen address one pixel up ; uses : af, hl ld a,h dec h and $07 ret nz ld a,$08 add a,h ld h,a ld a,l sub $20 ld l,a ret nc ld a,h sub $08 ld h,a cp $40 ret z88dk-1.8.ds1/libsrc/spectrum/zx_screenstr.asm0000644000175000017500000000046410637142614021067 0ustar tygrystygrys; uint zx_screenstr(uchar row, uchar col) ; CALLER linkage for function pointers XLIB zx_screenstr LIB zx_screenstr_callee XREF ASMDISP_ZX_SCREENSTR_CALLEE .zx_screenstr pop bc pop hl pop de push de push hl push bc ld h,e jp zx_screenstr_callee + ASMDISP_ZX_SCREENSTR_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_screenstr_callee.asm0000644000175000017500000000316410637142615022375 0ustar tygrystygrys; uint __CALLEE__ zx_screenstr_callee(uchar row, uchar col) ; aralbrec 06.2007 ; Sinclair Basic's SCREEN$() returns ascii code if the ; bit pattern on screen matches exactly the character ; set's bit pattern or its inverse. This subroutine ; goes a little further and will conclude a match ; if the bit pattern contains a mixture of inverted ; and non-inverted bit patterns. XLIB zx_screenstr_callee XDEF ASMDISP_ZX_SCREENSTR_CALLEE LIB zx_cyx2saddr_callee XREF ASMDISP_ZX_CYX2SADDR_CALLEE .zx_screenstr_callee pop hl pop de ex (sp),hl ld h,l ld l,e .asmentry ; h = char Y 0..23 ; l = char X 0..31 ; ; exit : hl = ascii char code if match, else 0 and carry set call zx_cyx2saddr_callee + ASMDISP_ZX_CYX2SADDR_CALLEE ; hl = screen address ld c,96 ; number of chars to match against ld de,(23606) ; use CHARS system variable to locate character set bitmap inc d .charloop ld b,8 ; match 8 pixel rows push hl .mloop ld a,(de) xor (hl) jr z, cont1 ; jump if bit patterns match inc a jr nz, nomatch ; jump if bit patterns are not inverses .cont1 inc de inc h djnz mloop .match pop hl ld a,128 sub c ld l,a ; hl = ascii char code ld h,b ret .nomatch ld a,8 sub b add a,e ld e,a jp nc, cont2 inc d .cont2 pop hl dec c jp nz, charloop ld l,c ld h,c ; return with 0 to indicate no match scf ret DEFC ASMDISP_ZX_SCREENSTR_CALLEE = asmentry - zx_screenstr_callee z88dk-1.8.ds1/libsrc/spectrum/zx_setint.asm0000755000175000017500000000043110633632101020351 0ustar tygrystygrys; int zx_setint(char *variable, int value) ; CALLER linkage for function pointers XLIB zx_setint LIB zx_setint_callee XREF ASMDISP_ZX_SETINT_CALLEE .zx_setint pop bc pop de pop hl push hl push de push bc jp zx_setint_callee + ASMDISP_ZX_SETINT_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_setint_callee.asm0000644000175000017500000000314310633632105021662 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 28/06/2006 ; ; Copy a variable from basic ; ; int __CALLEE__ zx_setint_callee(char *variable, int value); ; ; $Id: zx_setint_callee.asm,v 1.1 2007/06/13 00:03:17 aralbrec Exp $ ; XLIB zx_setint_callee XDEF ASMDISP_ZX_SETINT_CALLEE LIB zx_locatenum zx_setint_callee: pop hl pop de ex (sp),hl ; enter : de = int value ; hl = char *variable .asmentry push de push hl call zx_locatenum jr nc,store ; variable not found: create space for a new one pop hl push hl ld c,0 vlcount: ld a,(hl) inc c and a inc hl jr nz,vlcount dec c ld a,5 ; 5 bytes + len of VAR name add c ld c,a ld b,0 ld hl,($5c59) ; E_LINE dec hl ; now HL points to end of VARS call $1655 ; MAKE-ROOM inc hl pop de ; point to VAR name cp 6 ld a,(de) jr nz,morethan1 or 32 ; fall here if the variable name is ld (hl),a ; only one char long inc hl jr store2 morethan1: and 63 ; first letter of a long numeric variable name or 160 ; has those odd bits added ld (hl),a lintlp: inc de ld a,(de) ; now we copy the body of the VAR name.. and a jr z,endlint or 32 inc hl ld (hl),a djnz lintlp endlint: ld a,(hl) or 128 ; .. then we fix the last char ld (hl),a inc hl jr store2 store: pop bc ; so we keep HL pointing just after the VAR name store2: pop de ; hint by Dom Morris, store integer directly in VAR memory ld (hl),0 inc hl ld (hl),0 inc hl ld (hl),e inc hl ld (hl),d inc hl ld (hl),0 ret DEFC ASMDISP_ZX_SETINT_CALLEE = asmentry - zx_setint_callee z88dk-1.8.ds1/libsrc/spectrum/zx_setstr.asm0000755000175000017500000000043110633632101020367 0ustar tygrystygrys; int zx_setstr(char variable, char *value) ; CALLER linkage for function pointers XLIB zx_setstr LIB zx_setstr_callee XREF ASMDISP_ZX_SETSTR_CALLEE .zx_setstr pop bc pop hl pop de push de push hl push bc jp zx_setstr_callee + ASMDISP_ZX_SETSTR_CALLEE z88dk-1.8.ds1/libsrc/spectrum/zx_setstr_callee.asm0000644000175000017500000000223410633632105021700 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 29/06/2006 ; ; Copy a string to a BASIC variable ; ; int __CALLEE__ zx_setstr_callee(char variable, char *value); ; ; ; $Id: zx_setstr_callee.asm,v 1.1 2007/06/13 00:03:17 aralbrec Exp $ ; XLIB zx_setstr_callee XDEF ASMDISP_ZX_SETSTR_CALLEE zx_setstr_callee: pop bc pop hl pop de push bc ; enter : hl = char *value ; e = char variable .asmentry ld a,e and 95 ld (morevar+1),a ld (pointer+1),hl ld hl,($5c4b) ; VARS loop: ld a,(hl) cp 128 jr nz,morevar jr store ; variable not found morevar: cp 0 jr nz,nextvar call $19b8 ; get next variable start call $19e8 ; reclaim space (delete) store: ld bc,0 pointer: ld de,0 ; point to the string push de lenloop: inc bc ; string length counter inc de ld a,(de) and a jr nz,lenloop push hl push bc inc bc inc bc inc bc call $1655 ; MAKE-ROOM pop bc pop hl ld a,(morevar+1) ld (hl),a inc hl ld (hl),c inc hl ld (hl),b inc hl pop de ex de,hl ldir ret nextvar: call $19b8 ;get next variable start ex de,hl jr loop DEFC ASMDISP_ZX_SETSTR_CALLEE = asmentry - zx_setstr_callee z88dk-1.8.ds1/libsrc/spectrum/zx_soundchip.asm0000755000175000017500000000103610534057466021060 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 14/09/2006 ; ; int zx_soundchip(); ; ; The result is: ; - 1 (true) if a sound chip is present ; - 0 (false) otherwise ; ; $Id: zx_soundchip.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_soundchip zx_soundchip: ld hl,0 ld bc,$fffd ld a,11 ; envelope register out (c),a in a,(c) ld e,a xor 170 ld b,$bf out (c),a ld b,$ff ld d,a in a,(c) cp d ld b,$bf ld a,e out (c),a ; restore original value ret nz inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_syntax.asm0000755000175000017500000000362110753010311020371 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 05/02/2008 ; ; int zx_syntax(char *statement); ; ; Test a BASIC command syntax ; Returns (true) if OK, (false) on error. ; ; statement: pointer to BASIC command to be loaded for immediate execution. ; Terminate the string with carriage return. ; ; ; $Id: zx_syntax.asm,v 1.2 2008/02/08 08:20:25 stefano Exp $ ; XLIB zx_syntax LIB zx_interface1 ; max space for BASIC command(s) defc cmdlen = 20 zx_syntax: push hl call zx_interface1 ; force IF1 activation to avoid crashes call $16b0 ; clear buffers pop de ld hl,($5c5d) ; save CH-ADD push hl ld hl,($5c5f) ; save X-PTR push hl ld hl,($5c59) ; E-LINE push hl ld bc,cmdlen push bc push de call $1655 ; MAKE_ROOM pop hl pop bc pop de ldir ; copy command to E-LINE ld hl,$5c44 ; NSPPC ld a,(hl) push af ld (hl),1 ; set to first statement in line ld a,($5c47) ; push af ; keep SUBPPC (statement number ; within line being executed) ld bc,($5c3d) push bc ; save original ERR_SP ld bc,return push bc ld ($5c3d),sp ; update error handling routine call $1b17 ; check syntax ;ld (iy+0),255 ; set ERR_NR to OK pop bc return: pop bc ld ($5c3d),bc ; restore ERR_SP xor a bit 7,(iy+0) ; test ERR_NR ld (iy+0),255 ; reset ERR_NR jr z,nook inc a nook: ld (result+1),a ; Restore system variables to original values set 7,(iy+48) ; signal line execution pop af ld ($5c47),a ; restore original SUBPPC pop af ld ($5c44),a ; restore original NSPPC ; bit 0,(iy+124) ; test FLAGS3: coming from paged ROM ? ; jr nz,stderr ; ld (iy+124),0 ; yes, reset FLAGS3 ;stderr: ;set 5,(iy+$37) ; force to EDIT mode ;call $1097 ; CLEAR-SP ;res 5,(iy+$37) ; unset EDIT mode call $16b0 ; clear buffers pop hl ld ($5c5f),hl ; restore X-PTR pop hl ld ($5c5d),hl ; restore CH-ADD result: ld hl,0 ret z88dk-1.8.ds1/libsrc/spectrum/zx_timexsound.asm0000755000175000017500000000121010534057466021255 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 15/09/2006 ; ; int zx_timexsound(); ; ; The result is: ; - 1 (true) if a sound chip on the TS2068 standard location is present ; - 0 (false) otherwise ; ; $Id: zx_timexsound.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_timexsound zx_timexsound: ld hl,0 ld a,11 ; envelope register out ($f6),a in a,($f5) ld e,a xor 170 out ($f5),a ld d,a in a,($f5) cp d ld a,e out ($f5),a ; restore original value jr nz,testend ret nz inc hl testend: ld a,($5c48) ; border and $38 rrc a rrc a rrc a or 8 out (254),a ret z88dk-1.8.ds1/libsrc/spectrum/zx_type.asm0000755000175000017500000000066210534057466020051 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 22/09/2006 ; ; int zx_type(); ; ; The result is: ; - 0 (false) if the spectrum is a 48K ; - 1 (true) if the spectrum is a Spectrum 128K or compatible ; - 2 (true) if the spectrum is a TS2068 ; ; $Id: zx_type.asm,v 1.1 2006/12/01 16:58:30 stefano Exp $ ; XLIB zx_type zx_type: ld hl,0 ld a,(75) cp 191 ret z inc hl cp 225 ret nz inc hl ret z88dk-1.8.ds1/libsrc/spectrum/zx_var_length.asm0000755000175000017500000000057610450600346021211 0ustar tygrystygrys; ; ZX Spectrum specific routines ; by Stefano Bodrato, 22/06/2006 ; ; This routine gives the size of memory used by BASIC variables ; ; $Id: zx_var_length.asm,v 1.1 2006/06/28 22:21:26 stefano Exp $ ; XLIB zx_var_length zx_var_length: ld de,(23627) ; VARS : location of variables ld hl,(23641) ; E-line: edit area is end of VARS sbc hl,de dec hl ret z88dk-1.8.ds1/libsrc/sprites/0000755000175000017500000000000010765202715015460 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/hardware/0000755000175000017500000000000010765202715017255 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/hardware/amstrad-cpcplus/0000755000175000017500000000000010765202715022357 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/hardware/msx1/0000755000175000017500000000000010765202715020145 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/hardware/readme.txt0000644000175000017500000000017010415667774021265 0ustar tygrystygrysA directory containing APIs for hardware sprites on various platforms. Look for header files in {z88dk}/include/sprites z88dk-1.8.ds1/libsrc/sprites/readme.txt0000644000175000017500000000104710415667774017474 0ustar tygrystygrysSprite engines come in two varieties: 1) hardware -- APIs for accessing hardware sprite features of various platforms 2) software -- for sprites implemented completely in software accessible to any platform * Software sprite engines offer cross-platform development opportunites * Hardware sprite engines offer sprites with minimal impact on program speed * There is no reason why you can't mix the two, using the software engine for cross-platform development and the hardware API to enhance the game on a specific platform. z88dk-1.8.ds1/libsrc/sprites/software/0000755000175000017500000000000010765202715017312 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/readme.txt0000644000175000017500000000005710415667774021326 0ustar tygrystygrysA directory containing software sprite engines z88dk-1.8.ds1/libsrc/sprites/software/sp1/0000755000175000017500000000000010765202715020015 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/amstrad-cpc/0000755000175000017500000000000010765202715022213 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/Makefile0000644000175000017500000000246410760516260021461 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../../../Make.config default: @echo @echo Make the library from the {z88dk}/libsrc directory. @echo 'make sp1' will list instructions. @echo sp1-spectrum: @echo @echo SP1 Software Sprite Engine @echo making sinclair spectrum version @echo $(LIBLINKER) -x../../../$(OUTPUT_DIRECTORY)/sp1 @spectrum.lst cp spectrum/spectrum-sp1.h ../../../../include/sprites/sp1.h @echo @echo all done @echo sp1-ts2068hr: @echo @echo SP1 Software Sprite Engine @echo making ts2068 hi-res version @echo $(LIBLINKER) -x../../../$(OUTPUT_DIRECTORY)/sp1 @ts2068hr.lst cp ts2068hr/ts2068hr-sp1.h ../../../../include/sprites/sp1.h @echo @echo all done @echo sp1-zx81hr: @echo @echo SP1 Software Sprite Engine @echo making zx81 hrg version @echo $(LIBLINKER) -x../../../$(OUTPUT_DIRECTORY)/sp1 -IXIY @zx81hr.lst cp zx81hr/zx81hr-sp1.h ../../../../include/sprites/sp1.h @echo @echo all done @echo clean: $(RM) *.o $(RM) spectrum/sprites/*.o $(RM) spectrum/sprites/draw/*.o $(RM) spectrum/tiles/*.o $(RM) spectrum/updater/*.o $(RM) ts2068hr/sprites/*.o $(RM) ts2068hr/sprites/draw/*.o $(RM) ts2068hr/tiles/*.o $(RM) ts2068hr/updater/*.o $(RM) zx81hr/sprites/*.o $(RM) zx81hr/sprites/draw/*.o $(RM) zx81hr/tiles/*.o $(RM) zx81hr/updater/*.o z88dk-1.8.ds1/libsrc/sprites/software/sp1/msx1/0000755000175000017500000000000010765202715020705 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/readme.txt0000644000175000017500000000360310760516260022013 0ustar tygrystygrys // SOFTWARE SPRITE ENGINE // SP1 - Z88DK Sprite Package #1 Sprite Pack v3.0 (c) 2002-2008 aralbrec z88dk license applies // DOCUMENTATION See the z88dk wiki at http://www.z88dk.org/ Documentation is still scant there but will hopefully fill out with time. Some examples can be found in the {target}/examples directories. // PORTING TO OTHER MACHINES Several ports are underway. As of now three versions of the library are available: 1. spectrum (256x192 pixel, 32x192 colour resolution) 2. ts2068hr (512x192 pixel monochrome) 3. zx81hr (256x192 pixel monochrome) These ports can be used as the basis for other targets having similar screen resolutions. ts2068hr is suitable for any black and white target with memory mapped display. spectrum is suitable for targets with pixel displays having character-size colour overlays. If the new target's screen resolution matches one of the descriptions above, porting can be as simple as customizing two or three assembler functions. // COMPILING THE LIBRARY The library is compiled from the {z88dk}/libsrc directory. Only one version of the SP1 library can exist at a time. Before building the library you can customize several library parameters such as size of the display file managed, memory map, etc by editing the file "customize.asm" inside the target directory. The default configuration, which "customize.asm" initially contains, is also held in the file "{target}-customize.asm". After building the library the header file "sp1.h" will be created in the {z88dk}/include/sprites directory so that C programs can include it with "#include ". The customized sp1 library "sp1.lib" will be created in the {z88dk}/libsrc directory as is done with all libraries. Move it to the correct final location with a "make install" from the {z88dk}/libsrc directory. Link to the sp1 library on the compile line with "-lsp1". - aralbrec 02.2008 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/0000755000175000017500000000000010765202715021657 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/collision/0000755000175000017500000000000010765202715023652 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/collision/SP1IntersectRect.asm0000644000175000017500000000151710434502103027445 0ustar tygrystygrys ; SP1IntersectRect ; 05.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; uses rectangles library XLIB SP1IntersectRect LIB RIntersectRect8 ; Returns the result of intersecting two 8-bit rectangles. ; ; enter : de = & sp1_Rect #1 ; hl = & sp1_Rect #2 ; exit : carry flag set = overlap detected and ; b = rect x coord, c = rect width ; b' = rect y coord, c' = rect height ; uses : af,bc,de,hl,af',bc',de',hl' .SP1IntersectRect ld a,(de) inc de push de ex af,af ; a' = rect #1 y coord ld a,(hl) ; a = rect #2 y coord inc hl ld d,(hl) inc hl ld e,(hl) inc hl ex (sp),hl ld b,(hl) inc hl ld c,(hl) inc hl push hl exx pop hl ld c,(hl) ld d,a ex af,af ld b,a pop hl ld e,(hl) exx jp RIntersectRect8 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/collision/SP1IsPt8InRect.asm0000644000175000017500000000155610434502103026746 0ustar tygrystygrys ; SP1IsPt8InRect ; 05.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; uses rectangles library XLIB SP1IsPt8InRect LIB RIsPtInRect8 ; Determines if a pixel coordinate lies within an 8-bit ; rectangle described using character coordinates. The ; pixel coordinate is divided by 8 to change to character ; coordinates in this subroutine. ; ; enter : bc = x coordinate of pixel ; de = y coordinate of pixel ; hl = & struct sp1_Rect ; exit : carry flag set = in rectangle ; uses : af,af',bc,de,hl .SP1IsPt8InRect ld a,c srl b rra srl b rra srl b rra ex af,af // a' = 8-bit x coord ld a,e srl d rra srl d rra srl d rra // a = 8-bit y coord ld d,(hl) inc hl ld b,(hl) inc hl ld c,(hl) inc hl ld e,(hl) ld l,a ex af,af jp RIsPtInRect8 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/collision/SP1IsPtInRect.asm0000644000175000017500000000121510434502103026646 0ustar tygrystygrys ; SP1IsPtInRect ; 05.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; uses rectangles library XLIB SP1IsPtInRect LIB RIsPtInRect8 ; Determines if a pixel coordinate lies within an 8-bit ; rectangle described using character coordinates. The ; pixel coordinate is divided by 8 to change to character ; coordinates in this subroutine. ; ; enter : a = x coordinate ; e = y coordinate ; hl = & struct sp1_Rect ; exit : carry flag set = in rectangle ; uses : af,af',bc,de,hl .SP1IsPtInRect ld d,(hl) inc hl ld b,(hl) inc hl ld c,(hl) inc hl ld l,(hl) ld h,e ld e,l ld l,h jp RIsPtInRect8 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/collision/SP1IsRectInRect.asm0000644000175000017500000000134010434502103027157 0ustar tygrystygrys ; SP1IsRectInRect ; 05.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; uses rectangles library XLIB SP1IsRectInRect LIB RIsRectInRect8 ; Determines if two 8-bit rectangles overlap. ; ; enter : de = & sp1_Rect #1 ; hl = & sp1_Rect #2 ; exit : carry flag set = overlap detected ; uses : af,bc,de,hl,af',bc',de',hl' .SP1IsRectInRect ld a,(de) inc de push de ex af,af ; a' = rect #1 y coord ld a,(hl) ; a = rect #2 y coord inc hl ld d,(hl) inc hl ld e,(hl) inc hl ex (sp),hl ld b,(hl) inc hl ld c,(hl) inc hl push hl exx pop hl ld c,(hl) ld d,a ex af,af ld b,a pop hl ld e,(hl) exx jp RIsRectInRect8 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/collision/SP1MakeRect16.asm0000644000175000017500000000111510434502103026523 0ustar tygrystygrys ; SP1MakeRect16 ; 05.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1MakeRect16 ; A straight conversion from struct_sp1_Rect ; to struct_r_Rect16 ; ; enter : hl = struct sp1_Rect * ; de = destination struct r_Rect16 * ; uses : af, b, de, hl .SP1MakeRect16 ld b,(hl) inc hl ld a,(hl) inc hl ld (de),a inc de xor a ld (de),a inc de ld a,(hl) ld (de),a inc de xor a ld (de),a inc de ld a,b ld (de),a inc de xor a ld (de),a inc de ld a,(hl) ld (de),a inc de xor a ld (de),a ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/collision/SP1MakeRect16Pix.asm0000644000175000017500000000232610434502103027211 0ustar tygrystygrys ; SP1MakeRect16Pix ; 05.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1MakeRect16Pix ; Conversion from struct_sp1_ss to struct_r_Rect16 ; with members multiplied by 8 (change from character ; coordinates to pixel coordinates). ; ; enter : hl = struct sp1_ss * ; bc = destination struct r_Rect16 * ; uses : af, af', bc, de, hl .SP1MakeRect16Pix ld a,(hl) ex af,af inc hl ld e,(hl) ld d,0 inc hl push de inc bc inc bc ld e,(hl) inc hl ex de,hl add hl,hl add hl,hl add hl,hl ld a,l ld (bc),a inc bc ld a,h ld (bc),a inc bc ex de,hl inc bc inc bc ld e,(hl) inc hl ld d,0 ex de,hl add hl,hl add hl,hl add hl,hl ld a,l ld (bc),a inc bc ld a,h ld (bc),a dec bc dec bc ex de,hl ex af,af ld e,a ld a,(hl) inc hl and $07 ld d,0 ex de,hl add hl,hl add hl,hl add hl,hl add a,l ld l,a jp nc, noinc0 inc h .noinc0 ld a,h ld (bc),a dec bc ld a,l ld (bc),a dec bc dec bc dec bc ld a,(de) pop hl ld d,h ld e,a add hl,hl add hl,hl add hl,hl add hl,de ld a,h ld (bc),a dec bc ld a,l ld (bc),a ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/collision/SP1MakeRect8.asm0000644000175000017500000000072110434502103026446 0ustar tygrystygrys ; SP1MakeRect8 ; 05.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1MakeRect8 ; A straight conversion from struct_sp1_Rect ; to struct_r_Rect8 ; ; enter : hl = struct sp1_Rect * ; de = destination struct r_Rect8 * ; uses : a, b, de, hl .SP1MakeRect8 ld b,(hl) inc hl ld a,(hl) inc hl ld (de),a inc de ld a,(hl) inc hl ld (de),a inc de ld a,b ld (de),a inc de ld a,(hl) ld (de),a ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/collision/SP1MakeRect8Pix.asm0000644000175000017500000000151210434502103027126 0ustar tygrystygrys ; SP1MakeRect8Pix ; 05.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1MakeRect8Pix ; Conversion from struct_sp1_ss to struct_r_Rect8 ; with members multiplied by 8 (change from character ; coordinates to pixel coordinates). ; ; enter : hl = struct sp1_ss * ; de = destination struct r_Rect8 * ; uses : af, b, de, hl .SP1MakeRect8Pix ld b,(hl) inc hl ld a,(hl) inc hl add a,a add a,a add a,a ld (de),a inc de ld a,(hl) inc hl add a,a add a,a add a,a ld (de),a inc de ld a,b add a,a add a,a add a,a ld (de),a inc de ld a,(hl) inc hl add a,a add a,a add a,a ld (de),a dec de ld a,(de) ld b,a ld a,(hl) inc hl and $07 add a,b ld (de),a dec de dec de ld a,(de) add a,(hl) ld (de),a ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/customize.asm0000644000175000017500000000615210757251102024402 0ustar tygrystygrys ; CUSTOMIZATION TEMPLATE FOR SP1 ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; See below for Memory Map with these default settings ; /////////////////////// ; Display Characteristics ; /////////////////////// defc SP1V_DISPORIGX = 0 ; x coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPORIGY = 0 ; y coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPWIDTH = 32 ; width of area managed by sp1 in characters (16, 24, 32 ok as of now) defc SP1V_DISPHEIGHT = 24 ; height of area managed by sp1 in characters ; /////////////////////// ; Buffers ; /////////////////////// defc SP1V_PIXELBUFFER = $d1f7 ; address of an 8-byte buffer to hold intermediate pixel-draw results defc SP1V_ATTRBUFFER = $d1ff ; address of a single byte buffer to hold intermediate colour-draw results ; /////////////////////// ; Data Structures ; /////////////////////// defc SP1V_TILEARRAY = $f000 ; address of the 512-byte tile array associating character codes with tile graphics, must lie on 256-byte boundary (LSB=0) defc SP1V_UPDATEARRAY = $d200 ; address of the 10*SP1V_DISPWIDTH*SP1V_DISPHEIGHT byte update array defc SP1V_ROTTBL = $f000 ; location of the 3584-byte rotation table. Must lie on 256-byte boundary (LSB=0). Table begins $0200 bytes ahead of this ; pointer ($f200-$ffff in this default case). Set to $0000 if the table is not needed (if, for example, all sprites ; are drawn at exact horizontal character coordinates or you use pre-shifted sprites only). ; /////////////////////// ; SP1 Variables ; /////////////////////// defc SP1V_UPDATELISTH = $d1ed ; address of 10-byte area holding a dummy struct_sp1_update that is always the "first" in list of screen tiles to be drawn defc SP1V_UPDATELISTT = $d1ef ; address of 2-byte variable holding the address of the last struct_sp1_update in list of screen tiles to be drawn ; NOTE: SP1V_UPDATELISTT is located inside the dummy struct_sp1_update pointed at by SP1V_UPDATELISTH ; /////////////////////// ; DEFAULT MEMORY MAP ; /////////////////////// ; With these default settings the memory map is: ; ; ADDRESS (HEX) LIBRARY DESCRIPTION ; ; f200 - ffff SP1.LIB horizontal rotation tables ; f000 - f1ff SP1.LIB tile array ; d200 - efff SP1.LIB update array for full size screen 32x24 ; d1ff - d1ff SP1.LIB attribute buffer ; d1f7 - d1fe SP1.LIB pixel buffer ; d1ed - d1f6 SP1.LIB update list head - a dummy struct sp1_update acting as first in invalidated list ; * d1ef - d1f0 SP1.LIB update list tail pointer (inside dummy struct sp1_update) ; d1d4 - d1ec --free- 25 bytes free ; d1d1 - d1d3 ------- JP to im2 service routine (im2 table filled with 0xd1 bytes) ; d101 - d1d0 --free- 208 bytes ; d000 - d100 IM2.LIB im 2 vector table (257 bytes) ; ce00 - cfff ------- z80 stack (512 bytes) set SP=d000 ; z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/cwrapper/0000755000175000017500000000000010765202715023502 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/0000755000175000017500000000000010765202715023475 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex1.c0000644000175000017500000001027410757251143024342 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #1 // 04.2006 aralbrec // // Ten software-rotated masked sprites move in straight lines // at various speeds, bouncing off screen edges. All ten // share the same sprite graphic which is not animated in // this first test program. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex1.c -o ex1.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex1.tap0000644000175000017500000000731410757251143024705 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex1.bin |~!:\s#1!9s=>͔!X'1N#F#Small C+ ZXtڂ UUUU;!T]"ւS؂!@!'Ƀ!x!!8! ! !=!`͍P!96n&!94n&-!9~ ʔ!9!d! 9n&))!@!@!!!9n&ii!9^#V!!!0!9n&!9^#V!!!!9n&!9^#V!`!v! !!!P!96n&ì!94n&-!9~ `!d!9n&))^#V!`!}o!}o! 9\###V!9\##V\~//###!9\###Va}o}\#~]]##!9\##Va}o}ãÔ3xxxxxxxxւ|+F+N ##MD~#fo(B(0J# MD&i`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!ւ##xŽyҎ~#fo(1^#VB0#ÎB8##+s#r#q#p#7~7ւ׃x y q#p#ek!F!PĄӄkbKBt}@w]T! !  }w|w q p fnV#^ v`˶ |w#}wrs ~w#~w|(*]T^ V !~(.u t ]4,7|XDŽ!!{C!G!Pʅ!Pʅׅkbwp(x@tuӄkbqw]T! !  }w|w u t |(4tu]T^ V qq!~(.u t Å}o|g7|X˅ >!! go~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$nGnN%o:Ѡ2=! [~##2~##2[~##2~##2[~##2~##2[~##2~#2=!@ W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2=!= WGc{G(yg.A];s$w%, !<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#zV#^#F#N׈*>oң$r#s!> _һ@ £6 "Uj&zT%))))){ )T]))CUpxݾw ~"qO~ݾx| nfDuty( u t 6~̊~ϊfn* ׈FxiixݖݾœGhNy v M8H0CyݖݾO 34V#^#~(I~wr#s!6q  ßV#^#~ ?###v(zÊ@ }BKr#s#~#~*4#DM!͎ω6####ь ~R=r#s!6V#^#~ ####v  kzÊ@ }6####ь ~ʭ=vr#s!6v"rsfn* ׈Fx00xݖݾ G/Ny vyݖݾ3O4F#N#~ʻ ьF#Ns+r###~a =<ur#s!6 r#s!6+~#N#DM!͎(  zÊ@ r#s##~ɋ<܋r#s!6ÉV#^#~(?G#N+6####ь ~=r#s!6v©! ###V#^#~ ####v  2zÊ@ G#N+6####ь ~x==r#s!6=V#(^0Îq+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_xG~O///݆Wy7O! ~s_$~rgk*}lgf ~(#ngv >[wGÍi`2!"#+Ð!V#^0 (| &~$fo~##~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}Ʉz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2a.c0000644000175000017500000001012010757251143024472 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #2A // 04.2006 aralbrec // // As ex1.c but this time with OR-type sprites. The only // changes are in the sprite create calls. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex2a.c -o ex2a.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_OR2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_OR2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_OR2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2a.tap0000644000175000017500000000703310757251143025045 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex2a.bin @ !:\s#1!9s=>͔!X'1N#F#Small C+ ZXtڂ UUUU;!T]"ւS؂!@!'Ƀ!Ǎ!!8! !!ʏ gKo~$n2nN%oy2Ko~$n2nN%oy2Ko~$n 2n N%oy2Ko~$n 2nN%oy2Ì!͏ ###############Ì!Άʏ WK#^#2#^#2K#^#2#^#2K#^#2#^#2K#^#2#^2Ì!1ʌ WՆc{G(yg.A];s$w%,R K!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#ɇV#^#F#N&*>o$r#s!> _ @ 6 "Uj&zT1%))))){ =)T]))CUpxݾw ~qqO~ݾx| nfÓuty( u t 6~~fn* &FxڸҸxݖݾG·Ny v M8H0CyݖݾO 34V#^#~(I~2wr#s!6q  V#^#~ ?###v(z@ ̈BKr#s#~#~y4#DM!݋6#### ~ʡ=Nr#s!6NV#^#~ ####v  úz@ ̈6#### ~=ʼnr#s!6ʼn"rsfn* &FxxݖݾZG~Ny v000yݖݾ‚O/4F#N#~  F#Ns+r###~ʰ =<Ċr#s!6 ؊r#s!6+~#N#DM!݋(  ]z@ ;r#s##~<+r#s!6؊V#^#~(?G#N+6#### ~T=gr#s!6v! ]###gV#^#~ ####v  Áz@ ;G#N+6#### ~Nj=r#s!6ÌV#(^0݋q+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_xiG~O///݆WyچOV! ~s_$~rgk*}lgµ ~(#ngv >wGi`2!"#+ߌ!V#^0 (| &~$fo~#G#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}>z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2b.c0000644000175000017500000001012410757251143024477 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #2B // 04.2006 aralbrec // // As ex1.c but this time with XOR-type sprites. The only // changes are in the sprite create calls. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex2b.c -o ex2b.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_XOR2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_XOR2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_XOR2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2b.tap0000644000175000017500000000703310757251143025046 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex2b.bin C !:\s#1!9s=>͔!X'1N#F#Small C+ ZXtڂ UUUU;!T]"ւS؂!@!'Ƀ!Ǎ!!8! !!ʏ gKo~$n2nN%oy2Ko~$n2nN%oy2Ko~$n 2n N%oy2Ko~$n 2nN%oy2Ì!͏ ###############Ì!Άʏ WK#^#2#^#2K#^#2#^#2K#^#2#^#2K#^#2#^2Ì!1ʌ WՆc{G(yg.A];s$w%,R K!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#ɇV#^#F#N&*>o$r#s!> _ @ 6 "Uj&zT1%))))){ =)T]))CUpxݾw ~qqO~ݾx| nfÓuty( u t 6~~fn* &FxڸҸxݖݾG·Ny v M8H0CyݖݾO 34V#^#~(I~2wr#s!6q  V#^#~ ?###v(z@ ̈BKr#s#~#~y4#DM!݋6#### ~ʡ=Nr#s!6NV#^#~ ####v  úz@ ̈6#### ~=ʼnr#s!6ʼn"rsfn* &FxxݖݾZG~Ny v000yݖݾ‚O/4F#N#~  F#Ns+r###~ʰ =<Ċr#s!6 ؊r#s!6+~#N#DM!݋(  ]z@ ;r#s##~<+r#s!6؊V#^#~(?G#N+6#### ~T=gr#s!6v! ]###gV#^#~ ####v  Áz@ ;G#N+6#### ~Nj=r#s!6ÌV#(^0݋q+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_xiG~O///݆WyچOV! ~s_$~rgk*}lgµ ~(#ngv >wGi`2!"#+ߌ!V#^0 (| &~$fo~#G#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}>z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2c.c0000644000175000017500000001013010757251143024475 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #2C // 04.2006 aralbrec // // As ex1.c but this time with LOAD-type sprites. The only // changes are in the sprite create calls. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex2c.c -o ex2c.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_LOAD2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2c.tap0000644000175000017500000000672510757251143025056 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex2c.bin !:\s#1!9s=>͔!X'1N#F#Small C+ ZXtڂ UUUU;!T]"ւS؂!@!'Ƀ!́!!8! ! !F!`͖Y!96n&!94n&-!9~ ʔ!9!d! 9n&))!!@!!!9n&ii!9^#V!!!0!9n&!9^#V!!!!9n&!9^#V!`!v! !!!Y!96n&ì!94n&-!9~ `!d!9n&))^#V!`!}o!}o! 9\###V!9\##V\~//###!9\###Va}o}\#~]]##!9\##Va}o}ãÔ3xxxxxxxxւ|+F+N ##MD~#fo(B(0J# MD&i`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!ւ##xŽyҎ~#fo(1^#VB0#ÎB8##+s#r#q#p#7~7ւ׃x y q#p#ek!F!PĄӄkbKBt}@w]T! !  }w|w q p fnV#^ v`˶ |w#}wrs ~w#~w|(*]T^ V !~(.u t ]4,7|XDŽ!!{C!G!Pʅ!Pʅׅkbwp(x@tuӄkbqw]T! !  }w|w u t |(4tu]T^ V qq!~(.u t Å}o|g7|X˅ >!!w go~$n2nF%ox2o~$n2nF%ox2o~$n 2n F%ox2o~$n 2nF%ox2F!w ########~F!͠w W#^#2#^#2#^#2#^#2#^#2#^#2#^#2#^2F!F Wçc{G(yg.A];s$w%, !<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#ÃV#^#F#N*>oҬ$r#s!> _ć@ ¬6 "Uj&zT%))))){ )T]))CUpxݾw ~+qO~ݾx| nfMuty( u t 6~Չ~؉fn* Fxrrxݖݾ¥GqNy v M8H0CyݖݾɈO 34V#^#~(I~wr#s!6q  èV#^#~ ?###v(z̉@ ÆBKr#s#~#~34#DM!͗؈6####ڋ ~[=r#s!6V#^#~ ####v  tz̉@ Æ6####ڋ ~ʶ=r#s!6"rsfn* Fx99xݖݾG8Ny vyݖݾ<O4F#N#~Ċ ڋF#Ns+r###~j =<~r#s!6 r#s!6+~#N#DM!͗(  z̉@ r#s##~Ҋ<r#s!6ÒV#^#~(?G#N+6####ڋ ~=!r#s!6v²! ###!V#^#~ ####v  ;z̉@ G#N+6####ڋ ~ʁ=Fr#s!6FV#(^0×q+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_x#G~O///݆Wy@O! ~s_$~rgk*}lgo ~(#ngv >dwǦi`2!"#+Ù!V#^0 (| &~$fo~##~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}^z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2d.c0000644000175000017500000001024110757251143024501 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #2D // 04.2006 aralbrec // // A second look at LOAD-type sprites as in ex2c.c but this // time we make the left and right borders LBIM/RBIM type // (load type with implied mask on left/right border) ///////////////////////////////////////////////////////////// // zcc +zx -vn ex2d.c -o ex2d.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_LOAD2LBIM, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2RBIM, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2d.tap0000644000175000017500000000700710757251143025051 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex2d.bin 9 !:\s#1!9s=>͔!X'1N#F#Small C+ ZXtڂ UUUU;!T]"ւS؂!@!'Ƀ!ͳ!!8! (! !x!`ȇ͋!96n&!94n&-!9~ ʔ!9!d! 9n&))!!@!!!9n&ii!9^#V!!!0!9n&!9^#V!!!!9n&!9^#V!`!v! !!!5͋!96n&ì!94n&-!9~ `!d!9n&))^#V!`!}o!}o! 9\###V!9\##V0\~//###!9\###Va}o}\#~]]##!9\##Va}o}ãÔ3xxxxxxxxւ|+F+N ##MD~#fo(B(0J# MD&i`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!ւ##xŽyҎ~#fo(1^#VB0#ÎB8##+s#r#q#p#7~7ւ׃x y q#p#ek!F!PĄӄkbKBt}@w]T! !  }w|w q p fnV#^ v`˶ |w#}wrs ~w#~w|(*]T^ V !~(.u t ]4,7|XDŽ!!{C!G!Pʅ!Pʅׅkbwp(x@tuӄkbqw]T! !  }w|w u t |(4tu]T^ V qq!~(.u t Å}o|g7|X˅ >!!w go~$n2nF%ox2o~$n2nF%ox2o~$n 2n F%ox2o~$n 2nF%ox2x!w ########~x!͠w g.~/Oo:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2x!x g.N$íc{G(yg.A];s$w%,> 7!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#õV#^#F#N*>oއ$r#s!> _@ އ6 "Uj&zT%))))){ ))T]))CUpxݾw ~]qO~ݾx| nfuty( u t 6~~ fn* FxڤҤxݖݾ׈G£Ny v M8H0CyݖݾO 34V#^#~(I~wr#s!6q  ڈV#^#~ ?###v(z@ øBKr#s#~#~e4#DM!ɋ 6#### ~ʍ=:r#s!6:V#^#~ ####v  æz@ ø6#### ~=r#s!6ñ"rsfn* FxkkxݖݾFGjNy vyݖݾnO4F#N#~ F#Ns+r###~ʜ =<r#s!6 Ċr#s!6+~#N#DM!ɋ(  Iz@ 'r#s##~<r#s!6ĊV#^#~(?G#N+6#### ~@=Sr#s!6v! I###SV#^#~ ####v  mz@ 'G#N+6#### ~ʳ=xr#s!6xV#(^0ɋq+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_xUG~O///݆WyrOB! ~s_$~rgk*}lg¡ ~(#ngv >wGi`2!"#+ˌ!V#^0 (| &~$fo~#3#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}Ɇz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2e.c0000644000175000017500000001066410757251143024513 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #2E // 04.2006 aralbrec // // A third look at LOAD-type sprites as in ex2d.c with the // implied masks on the sprite borders. This time we make // the sprites occluding type so that nothing underneath the // top-most sprite is drawn except the background graphic. // The drawing should be faster when many sprites overlap... // do you see the speed-ups when they do? ///////////////////////////////////////////////////////////// // zcc +zx -vn ex2e.c -o ex2e.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_LOAD2LBIM, SP1_TYPE_2BYTE | SP1_TYPE_OCCLUDE | SP1_TYPE_BGNDCLR, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2, SP1_TYPE_OCCLUDE | SP1_TYPE_BGNDCLR, 48, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2RBIM, SP1_TYPE_OCCLUDE | SP1_TYPE_BGNDCLR, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2e.tap0000644000175000017500000000700710757251143025052 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex2e.bin 8 !:\s#1!9s=>͔!X'1N#F#Small C+ ZXtڂ UUUU;!T]"ւS؂!@!'Ƀ!ͳ!!8! (! !x!`ȇ͋!96n&!94n&-!9~ ʔ!9!d! 9n&))!!!!!9n&ii!9^#V!!!0!9n&!9^#V!!!!9n&!9^#V!`!v! !!!5͋!96n&ì!94n&-!9~ `!d!9n&))^#V!`!}o!}o! 9\###V!9\##V0\~//###!9\###Va}o}\#~]]##!9\##Va}o}ãÔ3xxxxxxxxւ|+F+N ##MD~#fo(B(0J# MD&i`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!ւ##xŽyҎ~#fo(1^#VB0#ÎB8##+s#r#q#p#7~7ւ׃x y q#p#ek!F!PĄӄkbKBt}@w]T! !  }w|w q p fnV#^ v`˶ |w#}wrs ~w#~w|(*]T^ V !~(.u t ]4,7|XDŽ!!{C!G!Pʅ!Pʅׅkbwp(x@tuӄkbqw]T! !  }w|w u t |(4tu]T^ V qq!~(.u t Å}o|g7|X˅ >!!w go~$n2nF%ox2o~$n2nF%ox2o~$n 2n F%ox2o~$n 2nF%ox2x!w ########~x!͠w g.~/Oo:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2x!x g.N$íc{G(yg.A];s$w%,> 7!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#õV#^#F#N*>oއ$r#s!> _@ އ6 "Uj&zT%))))){ ))T]))CUpxݾw ~]qO~ݾx| nfuty( u t 6~~ fn* FxڤҤxݖݾ׈G£Ny v M8H0CyݖݾO 34V#^#~(I~wr#s!6q  ڈV#^#~ ?###v(z@ øBKr#s#~#~e4#DM!ɋ 6#### ~ʍ=:r#s!6:V#^#~ ####v  æz@ ø6#### ~=r#s!6ñ"rsfn* FxkkxݖݾFGjNy vyݖݾnO4F#N#~ F#Ns+r###~ʜ =<r#s!6 Ċr#s!6+~#N#DM!ɋ(  Iz@ 'r#s##~<r#s!6ĊV#^#~(?G#N+6#### ~@=Sr#s!6v! I###SV#^#~ ####v  mz@ 'G#N+6#### ~ʳ=xr#s!6xV#(^0ɋq+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_xUG~O///݆WyrOB! ~s_$~rgk*}lg¡ ~(#ngv >wGi`2!"#+ˌ!V#^0 (| &~$fo~#3#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2f.c0000644000175000017500000001100610757251143024503 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #2F // 04.2006 aralbrec // // As in ex2e.c with the occluding load sprites but this time // we see what happens when the SP1_TYPE_BGNDCLR flag is not // specified. Backgrounds will not be drawn before occluding // sprites are drawn into the buffer, meaning a mix of // complete graphics from a previous character square and the // occluding sprite is drawn on screen. This will be used // later to do things like reflections but for here it only // confuses the eye. See if you can make sense of it all. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex2f.c -o ex2f.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_LOAD2LBIM, SP1_TYPE_2BYTE | SP1_TYPE_OCCLUDE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2, SP1_TYPE_OCCLUDE, 48, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2RBIM, SP1_TYPE_OCCLUDE, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2f.tap0000644000175000017500000000700710757251143025053 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex2f.bin ; !:\s#1!9s=>͔!X'1N#F#Small C+ ZXtڂ UUUU;!T]"ւS؂!@!'Ƀ!ͳ!!8! (! !x!`ȇ͋!96n&!94n&-!9~ ʔ!9!d! 9n&))!!!!!9n&ii!9^#V!!!0!9n&!9^#V!!!!9n&!9^#V!`!v! !!!5͋!96n&ì!94n&-!9~ `!d!9n&))^#V!`!}o!}o! 9\###V!9\##V0\~//###!9\###Va}o}\#~]]##!9\##Va}o}ãÔ3xxxxxxxxւ|+F+N ##MD~#fo(B(0J# MD&i`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!ւ##xŽyҎ~#fo(1^#VB0#ÎB8##+s#r#q#p#7~7ւ׃x y q#p#ek!F!PĄӄkbKBt}@w]T! !  }w|w q p fnV#^ v`˶ |w#}wrs ~w#~w|(*]T^ V !~(.u t ]4,7|XDŽ!!{C!G!Pʅ!Pʅׅkbwp(x@tuӄkbqw]T! !  }w|w u t |(4tu]T^ V qq!~(.u t Å}o|g7|X˅ >!!w go~$n2nF%ox2o~$n2nF%ox2o~$n 2n F%ox2o~$n 2nF%ox2x!w ########~x!͠w g.~/Oo:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2x!x g.N$íc{G(yg.A];s$w%,> 7!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#õV#^#F#N*>oއ$r#s!> _@ އ6 "Uj&zT%))))){ ))T]))CUpxݾw ~]qO~ݾx| nfuty( u t 6~~ fn* FxڤҤxݖݾ׈G£Ny v M8H0CyݖݾO 34V#^#~(I~wr#s!6q  ڈV#^#~ ?###v(z@ øBKr#s#~#~e4#DM!ɋ 6#### ~ʍ=:r#s!6:V#^#~ ####v  æz@ ø6#### ~=r#s!6ñ"rsfn* FxkkxݖݾFGjNy vyݖݾnO4F#N#~ F#Ns+r###~ʜ =<r#s!6 Ċr#s!6+~#N#DM!ɋ(  Iz@ 'r#s##~<r#s!6ĊV#^#~(?G#N+6#### ~@=Sr#s!6v! I###SV#^#~ ####v  mz@ 'G#N+6#### ~ʳ=xr#s!6xV#(^0ɋq+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_xUG~O///݆WyrOB! ~s_$~rgk*}lg¡ ~(#ngv >wGi`2!"#+ˌ!V#^0 (| &~$fo~#3#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2g.c0000644000175000017500000001177510757251143024521 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #2G // 04.2006 aralbrec // // Let's have a look at all the different sprite types // we've seem drawn all at once. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex2g.c -o ex2g.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { if (i < 3) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); } else if (i < 6) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_OR2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_OR2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_OR2RB, 0, 0, i); } else if (i < 8) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_LOAD2LBIM, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2RBIM, 0, 0, i); } else if (i == 8) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_LOAD2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_LOAD2RB, 0, 0, i); } else { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_XOR2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_XOR2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_XOR2RB, 0, 0, i); } sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2g.tap0000644000175000017500000001243310757251143025053 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex2g.bin _!:\s#1!9s=>͔!X'1N#F#Small C+ ZẌ́ UUUU;!T]"S!@!'م!ǔ!!8! !!ʇ go~$n2nF%ox2o~$n2nF%ox2o~$n 2n F%ox2o~$n 2nF%ox2Ì!͇ ########~Ì!Ͱʇ W#^#2#^#2#^#2#^#2#^#2#^#2#^#2#^2Ì!ʇ g.~/Oo:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2Ì!tʌ W÷!͉ʌ g.N$!!͢ʐ go~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$nGnN%o:Ѡ2Ì!͐ [~##2~##2[~##2~##2[~##2~##2[~##2~#2Ì!ʐ W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2Ì!͏ʌ W!!ͤ> gKo~$n2nN%oy2Ko~$n2nN%oy2Ko~$n 2n N%oy2Ko~$n 2nN%oy2Ì!> ###############Ì!}> WK#^#2#^#2K#^#2#^#2K#^#2#^#2K#^#2#^2Ì!ʌ WÄ!!ʏ gKo~$n2nN%oy2Ko~$n2nN%oy2Ko~$n 2n N%oy2Ko~$n 2nN%oy2Ì!͏ ###############Ì!΍ʏ WK#^#2#^#2K#^#2#^#2K#^#2#^#2K#^#2#^2Ì!1ʌ WՍc{G(yg.A];s$w%,R K!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#ɎV#^#F#N&*>o$r#s!> _ @ 6 "Uj&zT1%))))){ =)T]))CUpxݾw ~qqO~ݾx| nfÓuty( u t 6~~fn* &FxڸҸxݖݾG·Ny v M8H0CyݖݾO 34V#^#~(I~2wr#s!6q  V#^#~ ?###v(z@ ̏BKr#s#~#~y4#DM!ݒ6#### ~ʡ=Nr#s!6NV#^#~ ####v  úz@ ̏6#### ~=Őr#s!6Ő"rsfn* &FxxݖݾZG~Ny v000yݖݾ‚O/4F#N#~  F#Ns+r###~ʰ =<đr#s!6 ؑr#s!6+~#N#DM!ݒ(  ]z@ ;r#s##~<+r#s!6ؑV#^#~(?G#N+6#### ~T=gr#s!6v! ]###gV#^#~ ####v  Áz@ ;G#N+6#### ~ǒ=r#s!6ÌV#(^0ݒq+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_xiG~O///݆WyچOV! ~s_$~rgk*}lgµ ~(#ngv >wGi`2!"#+ߓ!V#^0 (| &~$fo~#G#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}Oz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2h.c0000644000175000017500000001220610760241133024500 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #2H // 04.2006 aralbrec // // So far we've been using sprites with 2-byte definitions, // ie sprite graphics containing (mask,graph) pairs to define // them. Only the MASK type sprite needs to have a mask in // the sprite definitions; the others ignore the mask byte. // We used 2-byte draw functions for those (ie OR2, XOR2, etc) // which skipped over the mask byte while drawing so that they // could share the graphics definition with the MASK sprite. // However we can also define sprites that consist of graphics // only and no mask. We do this here in a modification to ex2g.c // with the sprite graphic definition edited to remove the // mask bytes and a switch to the 1-byte draw functions // OR1, XOR1, etc. This saves on memory but we've lost the // masked sprite! ///////////////////////////////////////////////////////////// // zcc +zx -vn ex2g.c -o ex2g.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { if (i < 3) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_OR1LB, SP1_TYPE_1BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_OR1, 0, 24, i); sp1_AddColSpr(s, SP1_DRAW_OR1RB, 0, 0, i); } else if (i < 6) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_LOAD1LBIM, SP1_TYPE_1BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_LOAD1, 0, 24, i); sp1_AddColSpr(s, SP1_DRAW_LOAD1RBIM, 0, 0, i); } else if (i < 9) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_LOAD1LB, SP1_TYPE_1BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_LOAD1, 0, 24, i); sp1_AddColSpr(s, SP1_DRAW_LOAD1RB, 0, 0, i); } else { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_XOR1LB, SP1_TYPE_1BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_XOR1, 0, 24, i); sp1_AddColSpr(s, SP1_DRAW_XOR1RB, 0, 0, i); } sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb 0, 0, 0, 0, 0, 0, 0 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ; hand edited to remove mask bytes ._gr_window DEFB 127, 192, 191, 161 DEFB 161, 161, 161, 191 DEFB 191, 161, 161, 161 DEFB 161, 191, 192, 127 DEFB 0, 0, 0, 0 DEFB 0, 0, 0, 0 DEFB 254, 3, 253, 133 DEFB 133, 133, 133, 253 DEFB 253, 133, 133, 133 DEFB 133, 253, 3, 254 DEFB 0, 0, 0, 0 DEFB 0, 0, 0, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex2h.tap0000644000175000017500000001101710760241133025041 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex2h.bin !!:\s#1!9s=>͔!X'1N#F#Small C+ ZXʄ0 UUUU;!T]",S.!@!'!ͻ!!8! 0! !̀!`Ћ͓!96n&!94n&-!9~ !yy!9!d! 9n&))!!!!!9n&AͿͿ!9^#V!Ȉ!!!9n&>!9^#V!!!!9n&>!9~!9!d! 9n&))!)!!!!9n&AͿͿ!9^#V!K!!!9n&>!9^#V!!!!9n&>!9~ ʅ҅!9!d! 9n&))!!!!!9n&AͿͿ!9^#V!K!!!9n&>!9^#V!!!!9n&>!9!d! 9n&))!ʊ!!!!9n&AͿͿ!9^#V!!!!9n&>!9^#V!%!!!9n&>!9^#V!`!! !!!=͓!96n&9!94n&-!9~ !d!9n&))^#V!`!}ń!}ń! 9Ͳ###ͬ!9Ͳ##ͬ8Ͳ~ʼڼ###!9Ͳ###ͬͷ}ń}Ͳ#~##!9Ͳ##ͬͷ}ń}0!3,:|+F+N ##MD~#fo(B(0J#J MD|i`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!,Մ##xy~#fo(1^#VB0#B8##+s#r#q#p#7~7,-x y q#p#:ek!F!P)kbKBt}@w]T! !  }w|w q p fnV#^ vʶ˶ |w#}wrs ~w#~w|(*]T^ V !~(.u t ó4,7|X!!{C!G!P !P -kbwp(x@tu)kbqw]T! !  }w|w u t |(4tu]T^ V qq!~(.u t ۆ}o|g7|X! >!!KŇ go~$n2nF%ox2o~$n2nF%ox2o~$n2nF%ox2o~$n2nF%ox2À!Ň ~À!Ň W^#2^#2^#2^#2^#2^#2^#2^2À!)Ň g.~/Oo:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2o:ѡ2À!͚ʀ W!ͯʀ g.N$6!!ȈZ gKo~$n2nN%oy2Ko~$n2nN%oy2Ko~$n2nN%oy2Ko~$n2nN%oy2À!Z #######À!͑Z WK^#2^#2K^#2^#2K^#2^#2K^#2^2À!ʀ WØ!!ʓ gKo~$n2nN%oy2Ko~$n2nN%oy2Ko~$n2nN%oy2Ko~$n2nN%oy2À!͓ #######À!ʊʓ WK^#2^#2K^#2^#2K^#2^#2K^#2^2À!%ʀ Wъc{G(yg.A];s$w%,F ?!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#ýV#^#F#N*>o$r#s!> _@ 6 "Uj&zT%%))))){ 1)T]))CUpxݾw ~eqO~ݾx| nfÇuty( u t 6~~fn* FxڬҬxݖݾߌG«Ny v M8H0CyݖݾO 34V#^#~(I~&wr#s!6q  V#^#~ ?###v(z@ BKr#s#~#~m4#DM!я6#### ~ʕ=Br#s!6BV#^#~ ####v  îz@ 6#### ~=r#s!6ù"rsfn* FxssxݖݾNGrNy v$$$yݖݾvO#4F#N#~ F#Ns+r###~ʤ =<r#s!6 ̎r#s!6+~#N#DM!я(  Qz@ /r#s##~ <r#s!6̎V#^#~(?G#N+6#### ~H=[r#s!6v! Q###[V#^#~ ####v  uz@ /G#N+6#### ~ʻ=r#s!6ÀV#(^0яq+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_x]G~O///݆WyzOJ! ~s_$~rgk*}lg© ~(#ngv >wGi`2!"#+Ӑ!V#^0 (| &~$fo~#;#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex3a.c0000644000175000017500000001077210760241133024500 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #3A // 04.2006 aralbrec // // We're back to ex1.c with 10 masked sprites but this time // 9 of them are drawn on top of each other in the centre of // the screen and do not move. The 10th is moved left to // right over top of them. SP1 only draws areas of the screen // that change, so the 9 static sprites are not redrawn only // the 10th moving one. As the 10th moving sprite overlaps // the nine others the speed dramatically slows down since // the engine needs to draw all 9 sprites underneath the 10th // moving one. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex3a.c -o ex3a.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=1; i++) { // move the first sprite only (dx=1, dy=0) se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex3a.tap0000644000175000017500000000731410760241133025040 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex3a.bin |~!:\s#1!9s=>͔!X'1N#F#Small C+ ZXtڂ UUUU;!T]"ւS؂!@!'Ƀ!x!!8! ! !=!`͍P!96n&!94n&-!9~ ʔ!9!d! 9n&))!@!@!!!9n&ii!9^#V!!!0!9n&!9^#V!!!!9n&!9^#V!`!v! !!!P!96n&ì!94n&-!9~`!d!9n&))^#V!`!}o!}o! 9\###V!9\##V\~//###!9\###Va}o}\#~]]##!9\##Va}o}ãÔ3xxxxxxxxւ|+F+N ##MD~#fo(B(0J# MD&i`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!ւ##xŽyҎ~#fo(1^#VB0#ÎB8##+s#r#q#p#7~7ւ׃x y q#p#ek!F!PĄӄkbKBt}@w]T! !  }w|w q p fnV#^ v`˶ |w#}wrs ~w#~w|(*]T^ V !~(.u t ]4,7|XDŽ!!{C!G!Pʅ!Pʅׅkbwp(x@tuӄkbqw]T! !  }w|w u t |(4tu]T^ V qq!~(.u t Å}o|g7|X˅ >!! go~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$nGnN%o:Ѡ2=! [~##2~##2[~##2~##2[~##2~##2[~##2~#2=!@ W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2=!= WGc{G(yg.A];s$w%, !<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#zV#^#F#N׈*>oң$r#s!> _һ@ £6 "Uj&zT%))))){ )T]))CUpxݾw ~"qO~ݾx| nfDuty( u t 6~̊~ϊfn* ׈FxiixݖݾœGhNy v M8H0CyݖݾO 34V#^#~(I~wr#s!6q  ßV#^#~ ?###v(zÊ@ }BKr#s#~#~*4#DM!͎ω6####ь ~R=r#s!6V#^#~ ####v  kzÊ@ }6####ь ~ʭ=vr#s!6v"rsfn* ׈Fx00xݖݾ G/Ny vyݖݾ3O4F#N#~ʻ ьF#Ns+r###~a =<ur#s!6 r#s!6+~#N#DM!͎(  zÊ@ r#s##~ɋ<܋r#s!6ÉV#^#~(?G#N+6####ь ~=r#s!6v©! ###V#^#~ ####v  2zÊ@ G#N+6####ь ~x==r#s!6=V#(^0Îq+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_xG~O///݆Wy7O! ~s_$~rgk*}lgf ~(#ngv >[wGÍi`2!"#+Ð!V#^0 (| &~$fo~##~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}ɏz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex3b.c0000644000175000017500000001171710760241133024501 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #3B // 04.2006 aralbrec // // As in ex3a.c but this time we make the single moving // sprite occlude type, meaning anything underneath it is // not drawn. We also specify the background clear flag // so that the background tile is drawn underneath the // sprite. Since the 9 sprites underneath the 10th moving // one do not need to be drawn, the movement does not // slow down as the 10th sprite overlaps the other nine. // However because the nine underlying sprites are not // drawn underneath the 10th, they can no longer be seen // as the 10th crosses them. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex3b.c -o ex3b.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { if (!i) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE | SP1_TYPE_OCCLUDE | SP1_TYPE_BGNDCLR, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, SP1_TYPE_OCCLUDE | SP1_TYPE_BGNDCLR, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, SP1_TYPE_OCCLUDE | SP1_TYPE_BGNDCLR, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); } else { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); } }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=1; i++) { // move the first sprite only (dx=1, dy=0) se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex3b.tap0000644000175000017500000000757210760241133025047 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex3b.bin *,!:\s#1!9s=>͔!X'1N#F#Small C+ ZX"̓ UUUU;!T]"S!@!'w!&!!8! ͛! !!`;!96n&!94n&-!9~ =!9n& ҡ!9!d! 9n&))!!!!!9n&͙!9^#V!!!0!9n&͖!9^#V!!!!9n&͖!9^#V!`!! !!!ͨ:!9!d! 9n&))!!@!!!9n&͙!9^#V!!!0!9n&͖!9^#V!!!!9n&͖!9^#V!`!! !!!ͨ!96n&U!94n&-!9~ !d!9n&))^#V!`!}!}! 9###!9##ͣ~؂؂###!9###}}#~##!9##}}L=3xxxxxxxxÍ|+F+N ##MD~#fo(B(0J#Ý MDσi`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|7|/g}/o#}|ogMD!-##x!!ͣʑ go~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$nGnN%o:Ѡ2!͑ [~##2~##2[~##2~##2[~##2~##2[~##2~#2!ʑ W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2!͐ Wc{G(yg.A];s$w%,± ª!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#(V#^#F#Nͅ*>oQ$ar#s!> _i@ Q6 "Uj&zTڐ%))))){ ڜ)T]))CUpxݾw ~ЉqO~ݾx| nfuty( u t 6~z~}fn* ͅFxxݖݾJGNy v M8H0CyݖݾnO 34V#^#~(I~wr#s!6q  MV#^#~ ?###v(zq@ +BKr#s#~#~؊4#DM!<}6#### ~=r#s!6íV#^#~ ####v  zq@ +6#### ~[=$r#s!6$"rsfn* ͅFxތތxݖݾ¹G݌Ny vڏҏyݖݾOŽ4F#N#~i F#Ns+r###~ =<#r#s!6 7r#s!6+~#N#DM!<(  üzq@ Úr#s##~w<r#s!67V#^#~(?G#N+6#### ~ʳ=ƌr#s!6vW! ü###ƌV#^#~ ####v  zq@ ÚG#N+6#### ~&=r#s!6V#(^0 wGqi`2!"#+>!V#^0 (| &~$fo~#æ#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}ɩz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex3c.c0000644000175000017500000001177710760241133024510 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #3C // 04.2006 aralbrec // // As in ex3b.c but we remove the background clear flag // from the occluding moving sprite. We saw what happens // when this is done in ex2f.c but here we do it to reinforce // the idea. With the background clear flag not set, nothing // is drawn underneath the occluding sprite, not even the // background tile. Instead what appears underneath the // occluding sprite is the completed graphics for the // *previous* character cell drawn. The results are confusing // visually but by controlling the order that character cells // are drawn will will be able to implement things like // mirrors and watery reflections using this feature. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex3c.c -o ex3c.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { if (!i) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE | SP1_TYPE_OCCLUDE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, SP1_TYPE_OCCLUDE, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, SP1_TYPE_OCCLUDE, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); } else { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); } }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=1; i++) { // move the first sprite only (dx=1, dy=0) se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex3c.tap0000644000175000017500000000757210760241133025050 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex3c.bin *,!:\s#1!9s=>͔!X'1N#F#Small C+ ZX"̓ UUUU;!T]"S!@!'w!&!!8! ͛! !!`;!96n&!94n&-!9~ =!9n& ҡ!9!d! 9n&))!!!!!9n&͙!9^#V!!!0!9n&͖!9^#V!!!!9n&͖!9^#V!`!! !!!ͨ:!9!d! 9n&))!!@!!!9n&͙!9^#V!!!0!9n&͖!9^#V!!!!9n&͖!9^#V!`!! !!!ͨ!96n&U!94n&-!9~ !d!9n&))^#V!`!}!}! 9###!9##ͣ~؂؂###!9###}}#~##!9##}}L=3xxxxxxxxÍ|+F+N ##MD~#fo(B(0J#Ý MDσi`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|7|/g}/o#}|ogMD!-##x!!ͣʑ go~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$nGnN%o:Ѡ2!͑ [~##2~##2[~##2~##2[~##2~##2[~##2~#2!ʑ W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2!͐ Wc{G(yg.A];s$w%,± ª!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#(V#^#F#Nͅ*>oQ$ar#s!> _i@ Q6 "Uj&zTڐ%))))){ ڜ)T]))CUpxݾw ~ЉqO~ݾx| nfuty( u t 6~z~}fn* ͅFxxݖݾJGNy v M8H0CyݖݾnO 34V#^#~(I~wr#s!6q  MV#^#~ ?###v(zq@ +BKr#s#~#~؊4#DM!<}6#### ~=r#s!6íV#^#~ ####v  zq@ +6#### ~[=$r#s!6$"rsfn* ͅFxތތxݖݾ¹G݌Ny vڏҏyݖݾOŽ4F#N#~i F#Ns+r###~ =<#r#s!6 7r#s!6+~#N#DM!<(  üzq@ Úr#s##~w<r#s!67V#^#~(?G#N+6#### ~ʳ=ƌr#s!6vW! ü###ƌV#^#~ ####v  zq@ ÚG#N+6#### ~&=r#s!6V#(^0 wGqi`2!"#+>!V#^0 (| &~$fo~#æ#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}ɹz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex4a.c0000644000175000017500000001364310760241133024501 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #4A // 04.2006 aralbrec // // We begin with the ten masked sprites once again and for // the first time add some colour. By default created // sprites are transparent in colour, meaning they do not // alter the background colour. We make the first half // of the sprites (which appear closer to the viewer) // have RED ink and INK-only mask meaning they do not affect // the background PAPER/FLASH/BRIGHT. The second half of // the sprites we make BLUE ink and GREEN paper. When // a RED sprite overlaps a BLUE one you will see the colour // becomes RED on GREEN. This is because the BLUE one // appears underneath the RED one, setting the paper to GREEN. // The RED one is then drawn on top but it is INK-only so // only alters the INK colour to RED. The result is RED // on GREEN. // // As the sprite is created SP1 internally represents each // character of the sprite by a "struct sp1_cs" which you // can look up in the sp1 header file. Among the properties // of each sprite character stored here is the sprite char's // attribute (ie colour) and attribute mask (ie colour mask). // By using the function "sp1_IterateSprChar()" we can // visit all nine "struct sp1_cs" of each sprite, calling // a supplied function once for each of those nine structs. // We supply a function that change's the struct's stored // colour. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex4a.c -o ex4a.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; // Used to colour the sprites uchar attr; uchar amask; void colourSpr(struct sp1_cs *c) { c->attr_mask = amask; // set the sprite character's attribute mask c->attr = attr; // set the sprite character's attribute } main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); if (i < 5) { attr = INK_RED; // store colour in global variable amask = SP1_AMASK_INK; // store INK-only mask (defined in sp1.h) in global variable } else { attr = INK_BLUE | PAPER_GREEN; amask = SP1_AMASK_INK & SP1_AMASK_PAPER; } sp1_IterateSprChar(s, colourSpr); // colour the sprite }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex4a.tap0000644000175000017500000000750310760241133025041 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex4a.bin }!:\s#1!9s=>Ͷ!X'1N#F#Small C+ ZXσ5 UUUU !/~ !4~o&;!T]"0S2!@!'$!!!8! H! !ʹ!`Ǎ!96n&!94n&-!9~ !9!d! 9n&))!!@!!!9n&Făă!9^#V!P!!0!9n&C!9^#V!=!!!9n&C!9^#V!`!ς! !!!q!9~ρρ>24!}2/ہ>!24!}2/!9^#V!UǍ!96n&!94n&-!9~ ʹ!d!9n&))^#V!`!}ʃ!}ʃ! 9ͷ###ͱ!9ͷ##ͱlͷ~ʈڈ###!9ͷ###ͱͼ}ʃ}ͷ#~ʶڶ##!9ͷ##ͱͼ}ʃ}3xxxxxxxx0?|+F+N ##MD~#fo(B(0J#O MDÁi`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!0ڃ##xy~#fo(1^#VB0#B8##+s#r#q#p#7~702x y q#p#?ek!F!P.kbKBt}@w]T! !  }w|w q p fnV#^ vʻ˶ |w#}wrs ~w#~w|(*]T^ V !~(.u t ø4,7|X"!!{C!G!P%!P%2kbwp(x@tu.kbqw]T! !  }w|w u t |(4tu]T^ V qq!~(.u t }o|g7|X& >!!P> go~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$nGnN%o:Ѡ2ô!> [~##2~##2[~##2~##2[~##2~##2[~##2~#2ô!͛> W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2ô!=ʴ Wâc{G(yg.A];s$w%,^ W!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#ՈV#^#F#N2*>o$r#s!> _@ 6 "Uj&zT=%))))){ I)T])) H~#ngo^CUpxݾw ~ʙqO~ݾx| nfûuty( u t 6~C~Ffn* 2FxxݖݾGߊNy v M8H0Cyݖݾ7O 34V#^#~(I~Zwr#s!6q  V#^#~ ?###v(z:@ BKr#s#~#~ʡ4#DM!F6####H ~Ɋ=vr#s!6vV#^#~ ####v  z:@ 6####H ~$=r#s!6"rsfn* 2Fxڧҧxݖݾ‚G¦Ny vXXXyݖݾªOW4F#N#~2 HF#Ns+r###~؋ =<r#s!6 r#s!6+~#N#DM!(  Åz:@ cr#s##~@<Sr#s!6V#^#~(?G#N+6####H ~|=r#s!6v ! Å###ÏV#^#~ ####v  éz:@ cG#N+6####H ~=r#s!6ôV#(^0q+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_xڑG~O///݆WyڮO~! ~s_$~rgk*}lgݍ ~(#ngv >ҍwG:i`2!"#+!V#^0 (| &~$fo~#o#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex4b.c0000644000175000017500000001404010760241133024472 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #4B // 04.2006 aralbrec // // In ex4a.c we used sp1_IterateSprChar() to call our function // once for each "struct sp1_cs" character cell in the sprite. // We used this opportunity to change the colour of the sprite // char by modifying appropriate members of each "struct sp1_cs". // // sp1_IterateSprChar() actually iterates over a sprite's char // cells in row-major order. That is left-to-right, top-to- // bottom. It also passes two parameters to the user function: // a count, beginning at zero and incremented for each sprite // cell visited, and a actual "struct sp1_cs" being visited. // In ex4a.c we ignored that second count parameter. // // This time we use the count parameter to colour the middle // column of all sprites with YELLOW ink and BLACK paper. // Since the sprites are 3x3 chars in size, the middle column // corresponds to counts of 1,4,7. // // A more general sprite colouring routine would probably // have the function called by sp1_IterateSprChar() copy // attribute bytes into the sprite char cells from an // array. This is not the only way to colour sprites; there // is a faster way meant to be used from within the game loop // which we will visit later on. However this is a good way // to do it outside the main game loop. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex4b.c -o ex4b.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; // Used to colour the sprites uchar attr; uchar amask; void colourSpr(uint count, struct sp1_cs *c) { if ((count == 1) || (count == 4) || (count == 7)) { c->attr_mask = SP1_AMASK_INK & SP1_AMASK_PAPER; c->attr = INK_YELLOW | PAPER_BLACK; } else { c->attr_mask = amask; // set the sprite character's attribute mask c->attr = attr; // set the sprite character's attribute } } main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); if (i < 5) { attr = INK_RED; // store colour in global variable amask = SP1_AMASK_INK; // store INK-only mask (defined in sp1.h) in global variable } else { attr = INK_BLUE | PAPER_GREEN; amask = SP1_AMASK_INK & SP1_AMASK_PAPER; } sp1_IterateSprChar(s, colourSpr); // colour the sprite }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex4b.tap0000644000175000017500000000762410760241133025046 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex4b.bin DF!:\s#1!9s=>!X'1N#F#Small C+ ZX  UUUU!9^#V!Ā!9^#V!Ā!9^#V!ހ 6 6n& !y~ !~~o&;!T]"zS|!@!'u!@!!8! ͙! !!`9!96n&Z!94n&-!9~ 7!9!d! 9n&))!!@!!!9n&͗!9^#V!!!0!9n&͔!9^#V!!!!9n&͔!9^#V!`!! !!!‰!9~>2~!}2y%>!2~!}2y!9^#V!ͦQ!96n&O!94n&-!9~ !d!9n&))^#V!`!}!}! 9###!9##ͽ~҂҂###!9### }}#~##!9## }}F73xxxxxxxxzÉ|+F+N ##MD~#fo(B(0J#Ù MD˃i`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~wɧR?ȧ~og~#fo|/g}/o#}|ogMD!z+##x:y:~#fo(1^#VB0#:B8##+s#r#q#p#7~7zÃx y q#p#Éek!F!PpkbKBt}@w]T! !  }w|w q p fnV#^ v ˶ |w#}wrs ~w#~w|(*]T^ V !~(.u t 4,7|Xs!!{C!G!Pv!Pvkbwp(x@tukbqw]T! !  }w|w u t |(4tu]T^ V qq!~(.u t 1}o|g7|Xw >!!͡ʏ go~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$nGnN%o:Ѡ2!͏ [~##2~##2[~##2~##2[~##2~##2[~##2~#2!ʏ W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2!͎ Wc{G(yg.A];s$w%,¯ ¨!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#&V#^#F#N̓*>oO$_r#s!> _g@ O6 "Uj&zTڎ%))))){ ښ)T])) H~#ngïCUpxݾw ~ꉑqO~ݾx| nf uty( u t 6~”~—fn* ̓Fx11xݖݾdG0Ny v M8H0CyݖݾˆO 34V#^#~(I~wr#s!6q  gV#^#~ ?###v(zʋ@ EBKr#s#~#~4#DM!V×6####͙ ~=NJr#s!6NJV#^#~ ####v  3zʋ@ E6####͙ ~u=>r#s!6>"rsfn* ̓FxxݖݾӋGNy v©کҩyݖݾO¨4F#N#~ʃ ͙F#Ns+r###~) =<=r#s!6 Qr#s!6+~#N#DM!V(  ֋zʋ@ ôr#s##~ʑ<r#s!6QV#^#~(?G#N+6####͙ ~͌=r#s!6vq! ֋###V#^#~ ####v  zʋ@ ôG#N+6####͙ ~@=r#s!6V#(^0Vq+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_xG~O///݆WyOω! ~s_$~rgk*}lg. ~(#ngv >#wG͋i`2!"#+X!V#^0 (| &~$fo~##~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex4c.c0000644000175000017500000001520710760241133024501 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #4C // 04.2006 aralbrec // // Beginning from ex4a.c we have ten masked sprites with // half of them coloured red and half coloured blue. Up // to this point we have been using a single clipping // rectangle in all the sp1_MoveSpr*() calls we have been // making with little explanation what this clipping rectangle // is for. It's exactly what you think it is -- the sprite // is drawn such that only the parts of the sprite inside // the rectangle get drawn. By using the full screen as // clipping rectangle up to this point we have been // accomplishing one important function of the clipping // rectangle and that is preventing the sprite engine from // drawing into non-existent areas of the screen. // // Now we are going to use the clipping rectangle for a // second purpose which is to control where the sprites // can appear on screen. Two new clipping rectangles are // defined and the sp1_MoveSprAbs() call in the main loop // uses clipping rectangle #1 for the first half of the // sprites (those coloured red) and clipping rectangle #2 // for the rest (those coloured blue). The result is, // although the rectangles are freely moving across the // entire screen, they are only drawn when they appear // in their respective clipping rectangles. // // Clipping can only be done to character cell boundaries. // Among applications of this, consider a vertical gate // hidden in a doorway. As the player approaches it drops // closed. If the gate is a sprite with clipping rectangle // covering the doorway only, it can appear to drop into // place by being moved from over the doorway onto the // doorway. ///////////////////////////////////////////////////////////// // zcc +zx -vn ex4c.c -o ex4c.bin -create-app -lsp1 -lmalloc #include #include #include #pragma output STACKPTR=53248 // place stack at $d000 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen struct sp1_Rect clip1 = {1, 1, 12, 12}; // clip region 1 struct sp1_Rect clip2 = {10, 18, 12, 12}; // clip region 2 // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,1,0}, {0,0,1}, {0,1,2}, {0,2,1}, {0,1,3}, {0,3,1}, {0,2,3}, {0,3,2}, {0,1,1}, {0,2,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; // Used to colour the sprites uchar attr; uchar amask; void colourSpr(struct sp1_cs *c) { c->attr_mask = amask; // set the sprite character's attribute mask c->attr = attr; // set the sprite character's attribute } main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 10000); // make available memory from 40000-49999 // Initialize SP1.LIB zx_border(BLACK); sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, INK_BLACK | PAPER_WHITE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character // colour the two rectangular areas on screen so we can see them sp1_ClearRect(&clip1, INK_BLACK | PAPER_CYAN, 0, SP1_RFLAG_COLOUR); sp1_ClearRect(&clip2, INK_BLACK | PAPER_CYAN, 0, SP1_RFLAG_COLOUR); sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); if (i < 5) { attr = INK_RED; // store colour in global variable amask = SP1_AMASK_INK; // store INK-only mask (defined in sp1.h) in global variable } else { attr = INK_BLUE | PAPER_GREEN; amask = SP1_AMASK_INK & SP1_AMASK_PAPER; } sp1_IterateSprChar(s, colourSpr); // colour the sprite }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; if (i < 5) sp1_MoveSprRel(se->s, &clip1, 0, 0, 0, se->dy, se->dx); else sp1_MoveSprRel(se->s, &clip2, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/examples/ex4c.tap0000644000175000017500000001021610760241133025036 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex4c.bin >@!:\s#1!9s=>;!X'1N#F#Small C+ ZXLͲ   UUUU !~ !~o&;!T]"S!@!'͡!:!!8! ͼ! !!d!(!!Å!h!(!!Å!`\!96n&>!94n&-!9~ !9!l! 9n&))!!@!!!9n&ͺAA!9^#V!ć!!0!9n&!9^#V!!!!9n&!9^#V!`!L! !!!ͼ!9~>2!}2 >!2!}2!9^#V!͢5!96n&3!94n&-!9~ 6!l!9n&))!9~ʛқ^#V!d!}G!}G! 94###.!94##.ͷւ^#V!h!}G!}G! 94###.!94##.ͷ4~###!94###.9}G}4#~33##!94##.9}G}*3xxxxxxxxü|+F+N ##MD~#fo(B(0J#̃ MDi`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!W##xfyf~#fo(1^#VB0#fB8##+s#r#q#p#7~7ïx y q#p#üek!F!PҜkbKBt}@w]T! !  }w|w q p fnV#^ v8˶ |w#}wrs ~w#~w|(*]T^ V !~(.u t 54,7|Xß!!cyV#^#F#N͗͑@ ɇo&$~o#~g(1?r~> o$##s#6>o$#r> o$#r#s#6>o$~o`$~(#ngR>o$##s#6+++?#r+?#r#s#6+++?Uj&zTڢ%))))){ ڮ)T])){C!G!Pҙ!Pҙkbwp(x@tukbqw]T! !  }w|w u t |(4tu]T^ V qq!~(.u t T}o|g7|XÚ >!!ćʲ go~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGnN%o:Ѡ2o~$nGn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$n Gn N%o:Ѡ2o~$nGnN%o:Ѡ2!Ͳ [~##2~##2[~##2~##2[~##2~##2[~##2~#2!ʲ W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2!ͱ Wc{G(yg.A];s$w%,҉ ˉ!<O~$I  r%s$%#>_>W!"!"!W6#r#s#6#6#6#6#6#(xw#x@w# y 8x8#IV#^#F#N͗*>or$r#s!> _Ҋ@ r6 " H~#ng͑ëCUpxݾw ~䊑qO~ݾx| nfuty( u t 6~Ž~‘fn* ͗Fx++xݖݾ^G*Ny v M8H0Cyݖݾ‚O 34V#^#~(I~wr#s!6q  aV#^#~ ?###v(zʅ@ ?BKr#s#~#~4#DM!PÑ6####͓ ~=r#s!6V#^#~ ####v  -zʅ@ ?6####͓ ~o=8r#s!68"rsfn* ͗Fxxݖݾ͌GNy v£ڣңyݖݾO¢4F#N#~} ͓F#Ns+r###~# =<7r#s!6 Kr#s!6+~#N#DM!P(  Ќzʅ@ îr#s##~ʋ<r#s!6KV#^#~(?G#N+6####͓ ~Ǎ=ڍr#s!6vk! Ќ###ڍV#^#~ ####v  zʅ@ îG#N+6####͓ ~:=r#s!6V#(^0Pq+p! 6##r#s##q+p! r#s#p#q+++ r#sF##V#^6N#V#^p#q! p#qCU~G///݆_x܎G~O///݆WyOɊ! ~s_$~rgk*}lg( ~(#ngv >wGͅi`2!"#+R!V#^0 (| &~$fo~#ú#~2#^#V#| &~$fo(*~~#ng:Ѧ##2^#V###F#N#~#fow$w$w$w$w$w$w$w|g:w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r|g:w}z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/spectrum-customize.asm0000644000175000017500000000615210757251102026242 0ustar tygrystygrys ; CUSTOMIZATION TEMPLATE FOR SP1 ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; See below for Memory Map with these default settings ; /////////////////////// ; Display Characteristics ; /////////////////////// defc SP1V_DISPORIGX = 0 ; x coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPORIGY = 0 ; y coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPWIDTH = 32 ; width of area managed by sp1 in characters (16, 24, 32 ok as of now) defc SP1V_DISPHEIGHT = 24 ; height of area managed by sp1 in characters ; /////////////////////// ; Buffers ; /////////////////////// defc SP1V_PIXELBUFFER = $d1f7 ; address of an 8-byte buffer to hold intermediate pixel-draw results defc SP1V_ATTRBUFFER = $d1ff ; address of a single byte buffer to hold intermediate colour-draw results ; /////////////////////// ; Data Structures ; /////////////////////// defc SP1V_TILEARRAY = $f000 ; address of the 512-byte tile array associating character codes with tile graphics, must lie on 256-byte boundary (LSB=0) defc SP1V_UPDATEARRAY = $d200 ; address of the 10*SP1V_DISPWIDTH*SP1V_DISPHEIGHT byte update array defc SP1V_ROTTBL = $f000 ; location of the 3584-byte rotation table. Must lie on 256-byte boundary (LSB=0). Table begins $0200 bytes ahead of this ; pointer ($f200-$ffff in this default case). Set to $0000 if the table is not needed (if, for example, all sprites ; are drawn at exact horizontal character coordinates or you use pre-shifted sprites only). ; /////////////////////// ; SP1 Variables ; /////////////////////// defc SP1V_UPDATELISTH = $d1ed ; address of 10-byte area holding a dummy struct_sp1_update that is always the "first" in list of screen tiles to be drawn defc SP1V_UPDATELISTT = $d1ef ; address of 2-byte variable holding the address of the last struct_sp1_update in list of screen tiles to be drawn ; NOTE: SP1V_UPDATELISTT is located inside the dummy struct_sp1_update pointed at by SP1V_UPDATELISTH ; /////////////////////// ; DEFAULT MEMORY MAP ; /////////////////////// ; With these default settings the memory map is: ; ; ADDRESS (HEX) LIBRARY DESCRIPTION ; ; f200 - ffff SP1.LIB horizontal rotation tables ; f000 - f1ff SP1.LIB tile array ; d200 - efff SP1.LIB update array for full size screen 32x24 ; d1ff - d1ff SP1.LIB attribute buffer ; d1f7 - d1fe SP1.LIB pixel buffer ; d1ed - d1f6 SP1.LIB update list head - a dummy struct sp1_update acting as first in invalidated list ; * d1ef - d1f0 SP1.LIB update list tail pointer (inside dummy struct sp1_update) ; d1d4 - d1ec --free- 25 bytes free ; d1d1 - d1d3 ------- JP to im2 service routine (im2 table filled with 0xd1 bytes) ; d101 - d1d0 --free- 208 bytes ; d000 - d100 IM2.LIB im 2 vector table (257 bytes) ; ce00 - cfff ------- z80 stack (512 bytes) set SP=d000 ; z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/spectrum-sp1.h0000644000175000017500000006350710757000107024376 0ustar tygrystygrys #ifndef _SP1_H #define _SP1_H /////////////////////////////////////////////////////////// // SPRITE PACK v3.0 // // Sinclair Spectrum Version // // aralbrec - April / May 2006 // /////////////////////////////////////////////////////////// // // // See the wiki for documentation details // // http://www.z88dk.org/wiki // // // /////////////////////////////////////////////////////////// #include #include /////////////////////////////////////////////////////////// // DATA STRUCTURES // /////////////////////////////////////////////////////////// struct sp1_Rect { uchar row; uchar col; uchar width; uchar height; }; struct sp1_update; struct sp1_ss; struct sp1_cs; struct sp1_update { // "update structs" - 10 bytes - Every tile in the display area managed by SP1 is described by one of these uchar nload; // +0 bit 7 = 1 for invalidated, bit 6 = 1 for removed, bits 5:0 = number of occluding sprites present + 1 uchar colour; // +1 background tile attribute uint tile; // +2 background 16-bit tile code (if MSB != 0 taken as address of graphic, else lookup in tile array) struct sp1_cs *slist; // +4 BIG ENDIAN ; list of sprites occupying this tile (MSB = 0 if none) points at struct sp1_cs.attr_mask struct sp1_update *ulist; // +6 BIG ENDIAN ; next update struct in list of update structs queued for draw (MSB = 0 if none) uchar *screen; // +8 address in display file where this tile is drawn }; struct sp1_ss { // "sprite structs" - 20 bytes - Every sprite is described by one of these uchar row; // +0 current y tile-coordinate uchar col; // +1 current x tile-coordinate uchar width; // +2 width of sprite in tiles uchar height; // +3 height of sprite in tiles uchar vrot; // +4 bit 7 = 1 for 2-byte graphical definition else 1-byte, bits 2:0 = current vertical rotation (0..7) uchar hrot; // +5 current horizontal rotation (0..7) uchar *frame; // +6 current sprite frame address added to graphic pointers uchar res0; // +8 "LD A,n" opcode uchar e_hrot; // +9 effective horizontal rotation = MSB of rotation table to use uchar res1; // +10 "LD BC,nn" opcode uint e_offset; // +11 effective offset to add to graphic pointers, equals result of vertical rotation + frame addr uchar res2; // +13 "EX DE,HL" opcode uchar res3; // +14 "JP (HL)" opcode struct sp1_cs *first; // +15 BIG ENDIAN ; first struct sp1_cs of this sprite uchar xthresh; // +17 hrot must be at least this number of pixels for last column of sprite to be drawn (1 default) uchar ythresh; // +18 vrot must be at least this number of pixels for last row of sprite to be drawn (1 default) uchar nactive; // +19 number of struct sp1_cs cells on display (written by sp1_MoveSpr*) }; struct sp1_cs { // "char structs" - 24 bytes - Every sprite is broken into pieces fitting into a tile, each of which is described by one of these struct sp1_cs *next_in_spr; // +0 BIG ENDIAN ; next sprite char within same sprite in row major order (MSB = 0 if none) struct sp1_update *update; // +2 BIG ENDIAN ; tile this sprite char currently occupies (MSB = 0 if none) uchar plane; // +4 plane sprite occupies, 0 = closest to viewer uchar type; // +5 bit 7 = 1 occluding, bit 6 = 1 last column, bit 5 = 1 last row, bit 4 = 1 clear pixelbuffer uchar attr_mask; // +6 attribute mask logically ANDed with underlying attribute, default = 0xff for transparent uchar attr; // +7 sprite colour, logically ORed to form final colour, default = 0 for transparent void *ss_draw; // +8 struct sp1_ss + 8 bytes ; points at code embedded in sprite struct sp1_ss uchar res0; // +10 typically "LD HL,nn" opcode uchar *def; // +11 graphic definition pointer uchar res1; // +13 typically "LD IX,nn" opcode uchar res2; // +14 uchar *l_def; // +15 graphic definition pointer for sprite character to left of this one uchar res3; // +17 typically "CALL nn" opcode void *draw; // +18 & draw function for this sprite char struct sp1_cs *next_in_upd; // +20 BIG ENDIAN ; & sp1_cs.attr_mask of next sprite occupying the same tile (MSB = 0 if none) struct sp1_cs *prev_in_upd; // +22 BIG ENDIAN ; & sp1_cs.next_in_upd of previous sprite occupying the same tile }; struct sp1_ap { // "attribute pairs" - 2 bytes - A struct to hold sprite attribute and mask pairs uchar attr_mask; // +0 attribute mask logically ANDed with underlying attribute = 0xff for transparent uchar attr; // +1 sprite colour, logically ORed to form final colour = 0 for transparent }; struct sp1_tp { // "tile pairs" - 3 bytes - A struct to hold background colour and tile pairs uchar attr; // +0 colour uint tile; // +1 tile code }; struct sp1_pss { // "print string struct" - 11 bytes - A struct holding print state information struct sp1_Rect *bounds; // +0 rectangular boundary within which printing will be allowed uchar flags; // +2 bit 0=invalidate?, 1=xwrap?, 2=yinc?, 3=ywrap? uchar x; // +3 current x coordinate of cursor with respect to top left corner of bounds uchar y; // +4 current y coordinate of cursor with respect to top left corner of bounds uchar attr_mask; // +5 current attribute mask uchar attr; // +6 current attribute struct sp1_update *pos; // +7 RESERVED struct sp1_update associated with current cursor coordinates void *visit; // +9 void (*visit)(struct sp1_update *) function, set to 0 for none }; /////////////////////////////////////////////////////////// // SPRITES // /////////////////////////////////////////////////////////// // sprite type bits #define SP1_TYPE_OCCLUDE 0x80 // background and sprites underneath will not be drawn #define SP1_TYPE_BGNDCLR 0x10 // for occluding sprites, copy background tile into pixel buffer before draw #define SP1_TYPE_2BYTE 0x40 // sprite graphic consists of (mask,graph) pairs, valid only in sp1_CreateSpr() #define SP1_TYPE_1BYTE 0x00 // sprite graphic consists of graph only, valid only in sp1_CreateSpr() // sprite attribute masks, logically AND together if necessary // spectrum.h contains defines for INK and PAPER colours #define SP1_AMASK_TRANS 0xff // attribute mask for a transparent-colour sprite #define SP1_AMASK_INK 0xf8 // attribute mask for an ink-only sprite #define SP1_AMASK_PAPER 0xc7 // attribute mask for a paper-only sprite #define SP1_AMASK_NOFLASH 0x7f // attribute mask for no-flash #define SP1_AMASK_NOBRIGHT 0xbf // attribute mask for no-bright #define SP1_ATTR_TRANS 0x00 // attribute for a transparent-colour sprite // prototype struct_sp1_ss and struct_sp1_cs that can be used to initialize empty structures extern struct sp1_cs sp1_struct_cs_prototype; extern struct sp1_ss sp1_struct_ss_prototype; // draw functions for sprites with two-byte graphical definitions, ie (mask,graphic) pairs extern void __LIB__ SP1_DRAW_MASK2(void); // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation will use MASK2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_MASK2NR(void); // masked sprite 2-byte definition (mask,graph) pairs ; no rotation applied, graphic always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_MASK2LB(void); // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation as MASK2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_MASK2RB(void); // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation as MASK2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD2(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use LOAD2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_LOAD2NR(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_LOAD2LB(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD2RB(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_OR2(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use OR2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_OR2NR(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_OR2LB(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as OR2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_OR2RB(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as OR2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_XOR2(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use XOR2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_XOR2NR(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_XOR2LB(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as XOR2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_XOR2RB(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as XOR2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD2LBIM(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for left boundary of sprite w/ implied mask extern void __LIB__ SP1_DRAW_LOAD2RBIM(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for right boundary of sprite w/ implied mask // draw functions for sprites with one-byte graphical definitions, ie no mask just graphics extern void __LIB__ SP1_DRAW_LOAD1(void); // load sprite 1-byte definition graph only no mask; sw rotation will use LOAD1_NR if no rotation necessary extern void __LIB__ SP1_DRAW_LOAD1NR(void); // load sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_LOAD1LB(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD1RB(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_OR1(void); // or sprite 1-byte definition graph only no mask; sw rotation will use OR1_NR if no rotation necessary extern void __LIB__ SP1_DRAW_OR1NR(void); // or sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_OR1LB(void); // or sprite 1-byte definition graph only no mask; sw rotation as OR1 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_OR1RB(void); // or sprite 1-byte definition graph only no mask; sw rotation as OR1 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_XOR1(void); // xor sprite 1-byte definition graph only no mask; sw rotation will use XOR1_NR if no rotation necessary extern void __LIB__ SP1_DRAW_XOR1NR(void); // xor sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_XOR1LB(void); // xor sprite 1-byte definition graph only no mask; sw rotation as XOR1 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_XOR1RB(void); // xor sprite 1-byte definition graph only no mask; sw rotation as XOR1 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD1LBIM(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for left boundary of sprite with implied mask extern void __LIB__ SP1_DRAW_LOAD1RBIM(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for right boundary of sprite with implied mask // draw functions for sprites without graphics extern void __LIB__ SP1_DRAW_ATTR(void); // pixels are not drawn, only attributes // void *hook1 <-> void [ __FASTCALL__ ] (*hook1)(uint count, struct sp1_cs *c) // if __FASTCALL__ only struct sp1_cs* passed // void *hook2 <-> void [ __FASTCALL__ ] (*hook2)(uint count, struct sp1_update *u) // if __FASTCALL__ only struct sp1_update* passed // // void *drawf <-> void (*drawf)(void) // sprite draw function containing draw code and data for struct_sp1_cs extern struct sp1_ss __LIB__ *sp1_CreateSpr(void *drawf, uchar type, uchar height, int graphic, uchar plane); extern uint __LIB__ sp1_AddColSpr(struct sp1_ss *s, void *drawf, uchar type, int graphic, uchar plane); extern void __LIB__ sp1_ChangeSprType(struct sp1_cs *c, void *drawf); extern void __FASTCALL__ __LIB__ sp1_DeleteSpr(struct sp1_ss *s); // only call after sprite is moved off screen extern void __LIB__ sp1_MoveSprAbs(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot); extern void __LIB__ sp1_MoveSprRel(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot); extern void __LIB__ sp1_MoveSprPix(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uint x, uint y); extern void __LIB__ sp1_IterateSprChar(struct sp1_ss *s, void *hook1); extern void __LIB__ sp1_IterateUpdateSpr(struct sp1_ss *s, void *hook2); extern void __LIB__ sp1_GetSprClrAddr(struct sp1_ss *s, uchar **sprdest); extern void __LIB__ sp1_PutSprClr(uchar **sprdest, struct sp1_ap *src, uchar n); extern void __LIB__ sp1_GetSprClr(uchar **sprsrc, struct sp1_ap *dest, uchar n); extern void __LIB__ *sp1_PreShiftSpr(uchar flag, uchar height, uchar width, void *srcframe, void *destframe, uchar rshift); // some functions for displaying independent struct_sp1_cs not connected with any sprites; useful as foreground elements // if not using a no-rotate (NR) type sprite draw function, must manually init the sp1_cs.ldef member after calling sp1_InitCharStruct() extern void __LIB__ sp1_InitCharStruct(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane); extern void __LIB__ sp1_InsertCharStruct(struct sp1_update *u, struct sp1_cs *cs); extern void __FASTCALL__ __LIB__ sp1_RemoveCharStruct(struct sp1_cs *cs); /* CALLEE LINKAGE */ extern struct sp1_ss __CALLEE__ __LIB__ *sp1_CreateSpr_callee(void *drawf, uchar type, uchar height, int graphic, uchar plane); extern uint __CALLEE__ __LIB__ sp1_AddColSpr_callee(struct sp1_ss *s, void *drawf, uchar type, int graphic, uchar plane); extern void __CALLEE__ __LIB__ sp1_MoveSprAbs_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot); extern void __CALLEE__ __LIB__ sp1_MoveSprRel_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot); extern void __CALLEE__ __LIB__ sp1_MoveSprPix_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uint x, uint y); extern void __CALLEE__ __LIB__ sp1_IterateSprChar_callee(struct sp1_ss *s, void *hook1); extern void __CALLEE__ __LIB__ sp1_IterateUpdateSpr_callee(struct sp1_ss *s, void *hook2); extern void __CALLEE__ __LIB__ sp1_ChangeSprType_callee(struct sp1_cs *c, void *drawf); extern void __CALLEE__ __LIB__ sp1_GetSprClrAddr_callee(struct sp1_ss *s, uchar **sprdest); extern void __CALLEE__ __LIB__ sp1_PutSprClr_callee(uchar **sprdest, struct sp1_ap *src, uchar n); extern void __CALLEE__ __LIB__ sp1_GetSprClr_callee(uchar **sprsrc, struct sp1_ap *dest, uchar n); extern void __CALLEE__ __LIB__ *sp1_PreShiftSpr_callee(uchar flag, uchar height, uchar width, void *srcframe, void *destframe, uchar rshift); extern void __CALLEE__ __LIB__ sp1_InitCharStruct_callee(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane); extern void __CALLEE__ __LIB__ sp1_InsertCharStruct_callee(struct sp1_update *u, struct sp1_cs *cs); #define sp1_CreateSpr(a,b,c,d,e) sp1_CreateSpr_callee(a,b,c,d,e) #define sp1_AddColSpr(a,b,c,d,e) sp1_AddColSpr_callee(a,b,c,d,e) #define sp1_MoveSprAbs(a,b,c,d,e,f,g) sp1_MoveSprAbs_callee(a,b,c,d,e,f,g) #define sp1_MoveSprRel(a,b,c,d,e,f,g) sp1_MoveSprRel_callee(a,b,c,d,e,f,g) #define sp1_MoveSprPix(a,b,c,d,e) sp1_MoveSprPix_callee(a,b,c,d,e) #define sp1_IterateSprChar(a,b) sp1_IterateSprChar_callee(a,b) #define sp1_IterateUpdateSpr(a,b) sp1_IterateUpdateSpr_callee(a,b) #define sp1_ChangeSprType(a,b) sp1_ChangeSprType_callee(a,b) #define sp1_GetSprClrAddr(a,b) sp1_GetSprClrAddr_callee(a,b) #define sp1_PutSprClr(a,b,c) sp1_PutSprClr_callee(a,b,c) #define sp1_GetSprClr(a,b,c) sp1_GetSprClr_callee(a,b,c) #define sp1_PreShiftSpr(a,b,c,d,e,f) sp1_PreShiftSpr_callee(a,b,c,d,e,f) #define sp1_InitCharStruct(a,b,c,d,e) sp1_InitCharStruct_callee(a,b,c,d,e) #define sp1_InsertCharStruct(a,b) sp1_InsertCharStruct_callee(a,b) /////////////////////////////////////////////////////////// // COLLISION DETECTION // /////////////////////////////////////////////////////////// // BEING REVIEWED FOR CHANGES - DON'T USE // These are adapter functions for the rectangles library. // You must link to the rectangles library during compilation // if you use these functions "-lrect". // Collision is detected for non-zero return values // and carry flag set. // Notice that each struct_sp1_ss begins with a struct_sp1_Rect, // meaning a struct_sp1_ss can be used where struct_sp1_Rect // appears below. extern int __LIB__ sp1_IsPtInRect(uchar x, uchar y, struct sp1_Rect *r); extern int __LIB__ sp1_IsPt8InRect(uint x, uint y, struct sp1_Rect *r); // point coords divided by 8 extern int __LIB__ sp1_IsRectInRect(struct sp1_Rect *r1, struct sp1_Rect *r2); extern int __LIB__ sp1_IntersectRect(struct sp1_Rect *r1, struct sp1_Rect *r2, struct sp1_Rect *result); // straight conversions from struct sp1_Rect to struct r_Rect8/16 extern void __LIB__ sp1_MakeRect8(struct sp1_Rect *s, struct r_Rect8 *r); extern void __LIB__ sp1_MakeRect16(struct sp1_Rect *s, struct r_Rect16 *r); // conversions from struct sp1_ss to struct r_Rect8/16 with character coordinates changed to pixel coordinates // horizontal and vertical rotation also added to pixel coordinate origin extern void __LIB__ sp1_MakeRect8Pix(struct sp1_ss *s, struct r_Rect8 *r); extern void __LIB__ sp1_MakeRect16Pix(struct sp1_ss *s, struct r_Rect16 *r); /////////////////////////////////////////////////////////// // TILES // /////////////////////////////////////////////////////////// #define SP1_RFLAG_TILE 0x01 #define SP1_RFLAG_COLOUR 0x02 #define SP1_RFLAG_SPRITE 0x04 #define SP1_PSSFLAG_INVALIDATE 0x01 #define SP1_PSSFLAG_XWRAP 0x02 #define SP1_PSSFLAG_YINC 0x04 #define SP1_PSSFLAG_YWRAP 0x08 extern void __LIB__ *sp1_TileEntry(uchar c, void *def); extern void __LIB__ sp1_PrintAt(uchar row, uchar col, uchar colour, uint tile); extern void __LIB__ sp1_PrintAtInv(uchar row, uchar col, uchar colour, uint tile); extern uint __LIB__ sp1_ScreenStr(uchar row, uchar col); extern uchar __LIB__ sp1_ScreenAttr(uchar row, uchar col); extern void __LIB__ sp1_PrintString(struct sp1_pss *ps, uchar *s); extern void __LIB__ sp1_SetPrintPos(struct sp1_pss *ps, uchar row, uchar col); extern void __LIB__ sp1_GetTiles(struct sp1_Rect *r, struct sp1_tp *dest); extern void __LIB__ sp1_PutTiles(struct sp1_Rect *r, struct sp1_tp *src); extern void __LIB__ sp1_PutTilesInv(struct sp1_Rect *r, struct sp1_tp *src); extern void __LIB__ sp1_ClearRect(struct sp1_Rect *r, uchar colour, uchar tile, uchar rflag); extern void __LIB__ sp1_ClearRectInv(struct sp1_Rect *r, uchar colour, uchar tile, uchar rflag); /* CALLEE LINKAGE */ extern void __CALLEE__ __LIB__ *sp1_TileEntry_callee(uchar c, void *def); extern void __CALLEE__ __LIB__ sp1_PrintAt_callee(uchar row, uchar col, uchar colour, uint tile); extern void __CALLEE__ __LIB__ sp1_PrintAtInv_callee(uchar row, uchar col, uchar colour, uint tile); extern uint __CALLEE__ __LIB__ sp1_ScreenStr_callee(uchar row, uchar col); extern uchar __CALLEE__ __LIB__ sp1_ScreenAttr_callee(uchar row, uchar col); extern void __CALLEE__ __LIB__ sp1_PrintString_callee(struct sp1_pss *ps, uchar *s); extern void __CALLEE__ __LIB__ sp1_SetPrintPos_callee(struct sp1_pss *ps, uchar row, uchar col); extern void __CALLEE__ __LIB__ sp1_GetTiles_callee(struct sp1_Rect *r, struct sp1_tp *dest); extern void __CALLEE__ __LIB__ sp1_PutTiles_callee(struct sp1_Rect *r, struct sp1_tp *src); extern void __CALLEE__ __LIB__ sp1_PutTilesInv_callee(struct sp1_Rect *r, struct sp1_tp *src); extern void __CALLEE__ __LIB__ sp1_ClearRect_callee(struct sp1_Rect *r, uchar colour, uchar tile, uchar rflag); extern void __CALLEE__ __LIB__ sp1_ClearRectInv_callee(struct sp1_Rect *r, uchar colour, uchar tile, uchar rflag); #define sp1_TileEntry(a,b) sp1_TileEntry_callee(a,b) #define sp1_PrintAt(a,b,c,d) sp1_PrintAt_callee(a,b,c,d) #define sp1_PrintAtInv(a,b,c,d) sp1_PrintAtInv_callee(a,b,c,d) #define sp1_ScreenStr(a,b) sp1_ScreenStr_callee(a,b) #define sp1_ScreenAttr(a,b) sp1_ScreenAttr_callee(a,b) #define sp1_PrintString(a,b) sp1_PrintString_callee(a,b) #define sp1_SetPrintPos(a,b,c) sp1_SetPrintPos_callee(a,b,c) #define sp1_GetTiles(a,b) sp1_GetTiles_callee(a,b) #define sp1_PutTiles(a,b) sp1_PutTiles_callee(a,b) #define sp1_PutTilesInv(a,b) sp1_PutTilesInv_callee(a,b) #define sp1_ClearRect(a,b,c,d) sp1_ClearRect_callee(a,b,c,d) #define sp1_ClearRectInv(a,b,c,d) sp1_ClearRectInv_callee(a,b,c,d) /////////////////////////////////////////////////////////// // UPDATER // /////////////////////////////////////////////////////////// #define SP1_IFLAG_MAKE_ROTTBL 0x01 #define SP1_IFLAG_OVERWRITE_TILES 0x02 #define SP1_IFLAG_OVERWRITE_DFILE 0x04 // void *hook <-> void [ __FASTCALL__ ] (*hook)(struct sp1_update *u) extern void __LIB__ sp1_Initialize(uchar iflag, uchar colour, uchar tile); extern void __LIB__ sp1_UpdateNow(void); extern struct sp1_update __LIB__ *sp1_GetUpdateStruct(uchar row, uchar col); extern void __LIB__ sp1_IterateUpdateArr(struct sp1_update **ua, void *hook); // zero terminated array extern void __LIB__ sp1_IterateUpdateRect(struct sp1_Rect *r, void *hook); extern void __FASTCALL__ __LIB__ sp1_InvUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_ValUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructIfInv(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructIfVal(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructIfNotRem(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructAlways(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_RemoveUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_RestoreUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_Invalidate(struct sp1_Rect *r); extern void __FASTCALL__ __LIB__ sp1_Validate(struct sp1_Rect *r); /* CALLEE LINKAGE */ extern void __CALLEE__ __LIB__ sp1_Initialize_callee(uchar iflag, uchar colour, uchar tile); extern struct sp1_update __CALLEE__ __LIB__ *sp1_GetUpdateStruct_callee(uchar row, uchar col); extern void __CALLEE__ __LIB__ sp1_IterateUpdateArr_callee(struct sp1_update **ua, void *hook); extern void __CALLEE__ __LIB__ sp1_IterateUpdateRect_callee(struct sp1_Rect *r, void *hook); #define sp1_Initialize(a,b,c) sp1_Initialize_callee(a,b,c) #define sp1_GetUpdateStruct(a,b) sp1_GetUpdateStruct_callee(a,b) #define sp1_IterateUpdateArr(a,b) sp1_IterateUpdateArr_callee(a,b) #define sp1_IterateUpdateRect(a,b) sp1_IterateUpdateRect_callee(a,b) #endif z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/0000755000175000017500000000000010765202715023350 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/_sp1_struct_cs_prototype.asm0000644000175000017500000000241110624242400031115 0ustar tygrystygrys XLIB _sp1_struct_cs_prototype ._sp1_struct_cs_prototype defw 0 ; pointer to next struct sp1_CS in same sprite (big endian) defw 0 ; pointer to struct sp1_update this sprite char is currently drawn in (big endian) defb 0 ; sprite plane defb 0 ; sprite type (bit 7 = 1 occludes, bit 6 = 1 last column, bit 5 = 1 last row, bit 4 =1 pixelbuff clear) defb $ff ; attribute mask - part of underlying colour to keep; $ff = keep entire byte defb 0 ; sprite colour - attribute byte ORed into remaining masked portion; $ff/0 combo makes transparent defw 0 ; & struct sp1_ss.draw_code (+8 bytes offset into struct sp1_ss this struct belongs to) ; embedded code in struct (will be overlaid depending on sprite type) ld hl,0 ; graphic definition pointer ld ix,0 ; graphic definition pointer for sprite char to left of this one call 0 ; call draw function ; end embedded code defw 0 ; next struct sp1_CS.attr_mask in this struct update's sprite list (big endian) defw 0 ; prev struct sp1_CS.next_in_update in this struct update's sprite list (big endian) z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/_sp1_struct_ss_prototype.asm0000644000175000017500000000220010624242400031131 0ustar tygrystygrys XLIB _sp1_struct_ss_prototype XREF SP1V_ROTTBL, SP1V_DISPWIDTH ._sp1_struct_ss_prototype defb 0 ; initial row coordinate defb SP1V_DISPWIDTH ; initial col coordinate defb 1 ; initial width in chars/tiles defb 0 ; initial height in chars/tiles defb 0 ; initial vertical rotation in pixels defb 0 ; initial horizontal rotation in pixels defw 0 ; initial sprite graphic animation offset ; embedded code in struct ld a,SP1V_ROTTBL/256 ; MSB of horizontal rotation table to use ld bc,0 ; offset to add to graphic pointers when drawing sprite ex de,hl jp (hl) ; end embedded code defw 0 ; pointer to first struct sp1_CS in sprite (big endian) defb 1 ; initial xthreshold, minimum horizontal rotation in pixels for last column to draw defb 1 ; initial ythreshold, minimum vertical rotation in pixels for last row to draw defb 0 ; initial number of struct sp1_cs cells belonging to this sprite on display z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/0000755000175000017500000000000010765202715024305 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_ATTR.asm0000644000175000017500000000042610624242400027050 0ustar tygrystygrys ; DRAW ATTR ONLY SPRITE (NO PIXELS) ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_ATTR XREF SP1RETSPRDRAW ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1RETSPRDRAW .SP1_DRAW_ATTR ; yes that's it z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD1.asm0000644000175000017500000000320310624242400027072 0ustar tygrystygrys ; DRAW LOAD SPRITE 1 BYTE DEFINITION ROTATED ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD1 LIB SP1_DRAW_LOAD1NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 ld ix,0 call SP1_DRAW_LOAD1 ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; ix = left graphic def ptr ; ; 51 + 138*4 - 6 + 10 = 607 cycles .SP1_DRAW_LOAD1 cp SP1V_ROTTBL/256 jp z, SP1_DRAW_LOAD1NR add hl,bc add ix,bc ex de,hl ld h,a ; h = shift table ; de = sprite def (graph only) ; ix = left sprite def .SP1Load1Rotate ; 0 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+0) or (hl) ld (SP1V_PIXELBUFFER+0),a ld l,(ix+1) ld b,(hl) dec h ld a,(de) inc de ld l,a ld a,b or (hl) ld (SP1V_PIXELBUFFER+1),a ; 1 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+2) or (hl) ld (SP1V_PIXELBUFFER+2),a ld l,(ix+3) ld b,(hl) dec h ld a,(de) inc de ld l,a ld a,b or (hl) ld (SP1V_PIXELBUFFER+3),a ; 2 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+4) or (hl) ld (SP1V_PIXELBUFFER+4),a ld l,(ix+5) ld b,(hl) dec h ld a,(de) inc de ld l,a ld a,b or (hl) ld (SP1V_PIXELBUFFER+5),a ; 3 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+6) or (hl) ld (SP1V_PIXELBUFFER+6),a ld l,(ix+7) ld b,(hl) dec h ld a,(de) ld l,a ld a,b or (hl) ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD1LB.asm0000644000175000017500000000240210624242400027310 0ustar tygrystygrys ; DRAW LOAD SPRITE 1 BYTE DEFINITION ROTATED, ON LEFT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD1LB LIB SP1_DRAW_LOAD1NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_LOAD1LB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 32 + 33*8 - 6 + 10 = 300 cycles .SP1_DRAW_LOAD1LB cp SP1V_ROTTBL/256 jp z, SP1_DRAW_LOAD1NR add hl,bc ld d,a ; d = shift table ; hl = sprite def (graph only) .SP1Load1LBRotate ; 0 ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+0),a ; 1 ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+1),a ; 2 ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+2),a ; 3 ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+3),a ; 4 ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+4),a ; 5 ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+5),a ; 6 ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+6),a ; 7 ld e,(hl) ld a,(de) ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD1LBIM.asm0000644000175000017500000000333510624242400027544 0ustar tygrystygrys ; DRAW LOAD SPRITE 1 BYTE DEFINITION ROTATED, LEFT BORDER WITH IMPLIED MASK ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD1LBIM LIB SP1_DRAW_LOAD1NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_LOAD1LBIM ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 58 + 8*54 - 6 + 10 = 494 cycles .SP1_DRAW_LOAD1LBIM cp SP1V_ROTTBL/256 jp z, SP1_DRAW_LOAD1NR add hl,bc ex de,hl ld h,a ld l,$ff ld a,(hl) cpl ld c,a ; h = shift table ; c = constant mask ; de = sprite def (graph only) .SP1Load1LBIMRotate ; 0 ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+0) and c or (hl) ld (SP1V_PIXELBUFFER+0),a ; 1 ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+1) and c or (hl) ld (SP1V_PIXELBUFFER+1),a ; 2 ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+2) and c or (hl) ld (SP1V_PIXELBUFFER+2),a ; 3 ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+3) and c or (hl) ld (SP1V_PIXELBUFFER+3),a ; 4 ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+4) and c or (hl) ld (SP1V_PIXELBUFFER+4),a ; 5 ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+5) and c or (hl) ld (SP1V_PIXELBUFFER+5),a ; 6 ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+6) and c or (hl) ld (SP1V_PIXELBUFFER+6),a ; 7 ld a,(de) ld l,a ld a,(SP1V_PIXELBUFFER+7) and c or (hl) ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD1NR.asm0000644000175000017500000000122610624242400027335 0ustar tygrystygrys ; DRAW LOAD SPRITE 1 BYTE DEFINITION NO ROTATION ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD1NR XREF SP1RETSPRDRAW, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_LOAD1NR ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 11 + 7*16 + 10 + 14 + 10 = 157 cycles .SP1_DRAW_LOAD1NR add hl,bc ; hl = sprite def (graph only) ld de,SP1V_PIXELBUFFER ldi ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD1RB.asm0000644000175000017500000000131710624242400027322 0ustar tygrystygrys ; DRAW LOAD SPRITE 1 BYTE DEFINITION ROTATED, ON RIGHT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD1RB LIB SP1_DRAW_LOAD1LB XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld de,0 nop ld hl,0 call SP1_DRAW_LOAD1RB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; de = graphic def ptr ; hl = left graphic def ptr ; ; 46 + 33*8 - 6 + 10 = 314 cycles .SP1_DRAW_LOAD1RB cp SP1V_ROTTBL/256 jp z, SP1RETSPRDRAW add hl,bc ld d,a inc d ; d = shift table ; hl = left sprite def (graph only) .SP1Load1RBRotate jp SP1_DRAW_LOAD1LB + 7 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD1RBIM.asm0000644000175000017500000000145110624242400027547 0ustar tygrystygrys ; DRAW LOAD SPRITE 1 BYTE DEFINITION ROTATED, RIGHT BORDER WITH IMPLIED MASK ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD1RBIM LIB SP1_DRAW_LOAD1LBIM XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld de,0 nop ld hl,0 call SP1_DRAW_LOAD1RBIM ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; de = graphic def ptr ; hl = left graphic def ptr ; ; 64 + 8*54 - 6 + 10 = 500 cycles .SP1_DRAW_LOAD1RBIM cp SP1V_ROTTBL/256 jp z, SP1RETSPRDRAW add hl,bc ex de,hl ld h,a ld l,$ff ld c,(hl) inc h ; h = shift table ; c = constant mask ; de = sprite def (graph only) .SP1Load1RBIMRotate jp SP1_DRAW_LOAD1LBIM + 13 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD2.asm0000644000175000017500000000335710624242400027105 0ustar tygrystygrys ; DRAW LOAD SPRITE 2 BYTE DEFINITION ROTATED ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD2 LIB SP1_DRAW_LOAD2NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 ld ix,0 call SP1_DRAW_LOAD2 ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr (mask,graph) pairs ; ix = left graphic def ptr ; ; 51 + 150*4 - 6 + 10 = 655 cycles .SP1_DRAW_LOAD2 cp SP1V_ROTTBL/256 jp z, SP1_DRAW_LOAD2NR add hl,bc add ix,bc ex de,hl ld h,a ; h = shift table ; de = sprite def (mask,graph) pairs ; ix = left sprite def .SP1Load2Rotate ; 0 inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+1) or (hl) ld (SP1V_PIXELBUFFER+0),a ld l,(ix+3) ld b,(hl) dec h inc de ld a,(de) inc de ld l,a ld a,b or (hl) ld (SP1V_PIXELBUFFER+1),a ; 1 inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+5) or (hl) ld (SP1V_PIXELBUFFER+2),a ld l,(ix+7) ld b,(hl) dec h inc de ld a,(de) inc de ld l,a ld a,b or (hl) ld (SP1V_PIXELBUFFER+3),a ; 2 inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+9) or (hl) ld (SP1V_PIXELBUFFER+4),a ld l,(ix+11) ld b,(hl) dec h inc de ld a,(de) inc de ld l,a ld a,b or (hl) ld (SP1V_PIXELBUFFER+5),a ; 3 inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+13) or (hl) ld (SP1V_PIXELBUFFER+6),a ld l,(ix+15) ld b,(hl) dec h inc de ld a,(de) ld l,a ld a,b or (hl) ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD2LB.asm0000644000175000017500000000254510624242400027321 0ustar tygrystygrys ; DRAW LOAD SPRITE 2 BYTE DEFINITION ROTATED, ON LEFT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD2LB LIB SP1_DRAW_LOAD2NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_LOAD2LB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr (mask,graph) pairs ; de = left graphic def ptr ; ; 32 + 39*8 - 6 + 10 = 348 cycles .SP1_DRAW_LOAD2LB cp SP1V_ROTTBL/256 jp z, SP1_DRAW_LOAD2NR add hl,bc ld d,a ; d = shift table ; hl = sprite def (graph only) .SP1Load2LBRotate ; 0 inc hl ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+0),a ; 1 inc hl ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+1),a ; 2 inc hl ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+2),a ; 3 inc hl ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+3),a ; 4 inc hl ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+4),a ; 5 inc hl ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+5),a ; 6 inc hl ld e,(hl) inc hl ld a,(de) ld (SP1V_PIXELBUFFER+6),a ; 7 inc hl ld e,(hl) ld a,(de) ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD2LBIM.asm0000644000175000017500000000350010624242400027537 0ustar tygrystygrys ; DRAW LOAD SPRITE 2 BYTE DEFINITION ROTATED, LEFT BORDER WITH IMPLIED MASK ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD2LBIM LIB SP1_DRAW_LOAD2NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_LOAD2LBIM ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr (mask,graph) pairs ; de = left graphic def ptr ; ; 58 + 8*60 - 6 + 10 = 542 cycles .SP1_DRAW_LOAD2LBIM cp SP1V_ROTTBL/256 jp z, SP1_DRAW_LOAD2NR add hl,bc ex de,hl ld h,a ld l,$ff ld a,(hl) cpl ld c,a ; h = shift table ; c = constant mask ; de = sprite def (graph only) .SP1Load1LBIMRotate ; 0 inc de ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+0) and c or (hl) ld (SP1V_PIXELBUFFER+0),a ; 1 inc de ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+1) and c or (hl) ld (SP1V_PIXELBUFFER+1),a ; 2 inc de ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+2) and c or (hl) ld (SP1V_PIXELBUFFER+2),a ; 3 inc de ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+3) and c or (hl) ld (SP1V_PIXELBUFFER+3),a ; 4 inc de ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+4) and c or (hl) ld (SP1V_PIXELBUFFER+4),a ; 5 inc de ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+5) and c or (hl) ld (SP1V_PIXELBUFFER+5),a ; 6 inc de ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+6) and c or (hl) ld (SP1V_PIXELBUFFER+6),a ; 7 inc de ld a,(de) ld l,a ld a,(SP1V_PIXELBUFFER+7) and c or (hl) ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD2NR.asm0000644000175000017500000000137710624242400027345 0ustar tygrystygrys ; DRAW LOAD SPRITE 2 BYTE DEFINITION NO ROTATION ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD2NR XREF SP1RETSPRDRAW, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_LOAD2NR ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr (mask,graph) pairs ; de = left graphic def ptr ; ; 11 + 7*22 + 10 + 14 + 10 = 199 cycles .SP1_DRAW_LOAD2NR add hl,bc ; hl = sprite def (mask,graph) pairs ld de,SP1V_PIXELBUFFER inc hl ldi inc hl ldi inc hl ldi inc hl ldi inc hl ldi inc hl ldi inc hl ldi inc hl ld a,(hl) ld (de),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD2RB.asm0000644000175000017500000000134210624242400027321 0ustar tygrystygrys ; DRAW LOAD SPRITE 2 BYTE DEFINITION ROTATED, ON RIGHT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD2RB LIB SP1_DRAW_LOAD2LB XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld de,0 nop ld hl,0 call SP1_DRAW_LOAD2RB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; de = graphic def ptr ; hl = left graphic def ptr (mask,graph) pairs ; ; 46 + 39*8 - 6 + 10 = 362 cycles .SP1_DRAW_LOAD2RB cp SP1V_ROTTBL/256 jp z, SP1RETSPRDRAW add hl,bc ld d,a inc d ; d = shift table ; hl = left sprite def (graph only) .SP1Load2RBRotate jp SP1_DRAW_LOAD2LB + 7 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_LOAD2RBIM.asm0000644000175000017500000000145110624242400027550 0ustar tygrystygrys ; DRAW LOAD SPRITE 2 BYTE DEFINITION ROTATED, RIGHT BORDER WITH IMPLIED MASK ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_LOAD2RBIM LIB SP1_DRAW_LOAD2LBIM XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld de,0 nop ld hl,0 call SP1_DRAW_LOAD2RBIM ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; de = graphic def ptr ; hl = left graphic def ptr ; ; 64 + 8*54 - 6 + 10 = 500 cycles .SP1_DRAW_LOAD2RBIM cp SP1V_ROTTBL/256 jp z, SP1RETSPRDRAW add hl,bc ex de,hl ld h,a ld l,$ff ld c,(hl) inc h ; h = shift table ; c = constant mask ; de = sprite def (graph only) .SP1Load2RBIMRotate jp SP1_DRAW_LOAD2LBIM + 13 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_MASK2.asm0000644000175000017500000000606010624242400027113 0ustar tygrystygrys ; DRAW MASK SPRITE 2 BYTE DEFINITION ROTATED ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_MASK2 LIB SP1_DRAW_MASK2NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 ld ix,0 call SP1_DRAW_MASK2 ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; ix = left graphic def ptr ; ; 51 + 146*8 - 6 + 10 = 1223 cycles .SP1_DRAW_MASK2 cp SP1V_ROTTBL/256 jp z, SP1_DRAW_MASK2NR add hl,bc add ix,bc ex de,hl ld h,a ; h = shift table ; de = sprite def (mask,graph) pairs ; ix = left sprite def .SP1Mask2Rotate ; 0 ld a,(de) inc de ld l,a ld a,(hl) ; a = spr mask rotated right inc h ld l,(ix+0) or (hl) ; or in mask rotated from left ld b,a ; b = total mask ld l,(ix+1) ld c,(hl) ; c = spr graph rotated from left dec h ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+0) ; get background graphic and b ; mask it or c ; or graph rotated from left or (hl) ; or spr graph rotated right ld (SP1V_PIXELBUFFER+0),a ; store to current background ; 1 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+2) or (hl) ld b,a ld l,(ix+3) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+1) and b or c or (hl) ld (SP1V_PIXELBUFFER+1),a ; 2 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+4) or (hl) ld b,a ld l,(ix+5) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+2) and b or c or (hl) ld (SP1V_PIXELBUFFER+2),a ; 3 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+6) or (hl) ld b,a ld l,(ix+7) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+3) and b or c or (hl) ld (SP1V_PIXELBUFFER+3),a ; 4 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+8) or (hl) ld b,a ld l,(ix+9) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+4) and b or c or (hl) ld (SP1V_PIXELBUFFER+4),a ; 5 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+10) or (hl) ld b,a ld l,(ix+11) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+5) and b or c or (hl) ld (SP1V_PIXELBUFFER+5),a ; 6 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+12) or (hl) ld b,a ld l,(ix+13) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,(SP1V_PIXELBUFFER+6) and b or c or (hl) ld (SP1V_PIXELBUFFER+6),a ; 7 ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+14) or (hl) ld b,a ld l,(ix+15) ld c,(hl) dec h ld a,(de) ld l,a ld a,(SP1V_PIXELBUFFER+7) and b or c or (hl) ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_MASK2LB.asm0000644000175000017500000000410110624242400027323 0ustar tygrystygrys ; DRAW MASK SPRITE 2 BYTE DEFINITION ROTATED, ON LEFT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_MASK2LB LIB SP1_DRAW_MASK2NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_MASK2LB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 62 + 174*4 - 6 + 10 = 762 cycles .SP1_DRAW_MASK2LB cp SP1V_ROTTBL/256 jp z, SP1_DRAW_MASK2NR add hl,bc ld d,a ; d = shift table ; hl = sprite def (mask,graph) pairs ld e,$ff ld a,(de) cpl exx ld b,a exx .SP1Mask2LBRotate ; 0 ld bc,(SP1V_PIXELBUFFER+0) ld e,(hl) inc hl ld a,(de) exx or b exx and c ld c,a ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+0),a ld e,(hl) inc hl ld a,(de) exx or b exx and b ld b,a ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+1),a ; 1 ld bc,(SP1V_PIXELBUFFER+2) ld e,(hl) inc hl ld a,(de) exx or b exx and c ld c,a ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+2),a ld e,(hl) inc hl ld a,(de) exx or b exx and b ld b,a ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+3),a ; 2 ld bc,(SP1V_PIXELBUFFER+4) ld e,(hl) inc hl ld a,(de) exx or b exx and c ld c,a ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+4),a ld e,(hl) inc hl ld a,(de) exx or b exx and b ld b,a ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+5),a ; 3 ld bc,(SP1V_PIXELBUFFER+6) ld e,(hl) inc hl ld a,(de) exx or b exx and c ld c,a ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+6),a ld e,(hl) inc hl ld a,(de) exx or b exx and b ld b,a ld e,(hl) ld a,(de) or b ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_MASK2NR.asm0000644000175000017500000000252510624242400027355 0ustar tygrystygrys ; DRAW MASK SPRITE 2 BYTE DEFINITION NO ROTATION ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_MASK2NR XREF SP1RETSPRDRAW, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_MASK2NR ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 11 + 106*4 - 6 + 10 = 439 cycles .SP1_DRAW_MASK2NR add hl,bc ; hl = sprite def = (mask,graph) pairs ; 0 ld de,(SP1V_PIXELBUFFER+0) ld a,(hl) and e inc hl or (hl) inc hl ld (SP1V_PIXELBUFFER+0),a ld a,(hl) and d inc hl or (hl) inc hl ld (SP1V_PIXELBUFFER+1),a ; 1 ld de,(SP1V_PIXELBUFFER+2) ld a,(hl) and e inc hl or (hl) inc hl ld (SP1V_PIXELBUFFER+2),a ld a,(hl) and d inc hl or (hl) inc hl ld (SP1V_PIXELBUFFER+3),a ; 2 ld de,(SP1V_PIXELBUFFER+4) ld a,(hl) and e inc hl or (hl) inc hl ld (SP1V_PIXELBUFFER+4),a ld a,(hl) and d inc hl or (hl) inc hl ld (SP1V_PIXELBUFFER+5),a ; 3 ld de,(SP1V_PIXELBUFFER+6) ld a,(hl) and e inc hl or (hl) inc hl ld (SP1V_PIXELBUFFER+6),a ld a,(hl) and d inc hl or (hl) ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_MASK2RB.asm0000644000175000017500000000133310624242400027335 0ustar tygrystygrys ; DRAW MASK SPRITE 2 BYTE DEFINITION ROTATED, ON RIGHT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_MASK2RB LIB SP1_DRAW_MASK2LB XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld de,0 nop ld hl,0 call SP1_DRAW_MASK2RB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; de = graphic def ptr ; hl = left graphic def ptr ; ; 10 + 36 + 150*4 - 6 + 10 = 650 cycles .SP1_DRAW_MASK2RB cp SP1V_ROTTBL/256 jp z, SP1RETSPRDRAW add hl,bc ld d,a inc d ; d = shift table ; hl = left sprite def (mask,graph) pairs .SP1Mask2RBRotate jp SP1_DRAW_MASK2LB + 7 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_OR1.asm0000644000175000017500000000345510624242400026704 0ustar tygrystygrys ; DRAW OR SPRITE 1 BYTE DEFINITION ROTATED ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_OR1 LIB SP1_DRAW_OR1NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 ld ix,0 call SP1_DRAW_OR1 ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; ix = left graphic def ptr ; ; 51 + 166*4 - 6 + 10 = 719 cycles .SP1_DRAW_OR1 cp SP1V_ROTTBL/256 jp z, SP1_DRAW_OR1NR add hl,bc add ix,bc ex de,hl ld h,a ; h = shift table ; de = sprite def (graph only) ; ix = left sprite def .SP1Or1Rotate ; 0 ld bc,(SP1V_PIXELBUFFER+0) ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+0) or (hl) or c ld (SP1V_PIXELBUFFER+0),a ld l,(ix+1) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,c or b or (hl) ld (SP1V_PIXELBUFFER+1),a ; 1 ld bc,(SP1V_PIXELBUFFER+2) ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+2) or (hl) or c ld (SP1V_PIXELBUFFER+2),a ld l,(ix+3) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,c or b or (hl) ld (SP1V_PIXELBUFFER+3),a ; 2 ld bc,(SP1V_PIXELBUFFER+4) ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+4) or (hl) or c ld (SP1V_PIXELBUFFER+4),a ld l,(ix+5) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,c or b or (hl) ld (SP1V_PIXELBUFFER+5),a ; 3 ld bc,(SP1V_PIXELBUFFER+6) ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+6) or (hl) or c ld (SP1V_PIXELBUFFER+6),a ld l,(ix+7) ld c,(hl) dec h ld a,(de) ld l,a ld a,c or b or (hl) ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_OR1LB.asm0000644000175000017500000000261210624242400027114 0ustar tygrystygrys ; DRAW OR SPRITE 1 BYTE DEFINITION ROTATED, ON LEFT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_OR1LB LIB SP1_DRAW_OR1NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_OR1LB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 32 + 94*4 - 6 + 10 = 412 cycles .SP1_DRAW_OR1LB cp SP1V_ROTTBL/256 jp z, SP1_DRAW_OR1NR add hl,bc ld d,a ; d = shift table ; hl = sprite def (graph only) .SP1Or1LBRotate ; 0 ld bc,(SP1V_PIXELBUFFER+0) ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+0),a ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+1),a ; 1 ld bc,(SP1V_PIXELBUFFER+2) ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+2),a ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+3),a ; 2 ld bc,(SP1V_PIXELBUFFER+4) ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+4),a ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+5),a ; 3 ld bc,(SP1V_PIXELBUFFER+6) ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+6),a ld e,(hl) ld a,(de) or b ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_OR1NR.asm0000644000175000017500000000212010624242400027130 0ustar tygrystygrys ; DRAW OR SPRITE 1 BYTE DEFINITION NO ROTATION ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_OR1NR XREF SP1RETSPRDRAW, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_OR1NR ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 21 + 33*8 - 12 + 10 = 283 cycles .SP1_DRAW_OR1NR add hl,bc ld de,SP1V_PIXELBUFFER ; hl = sprite def (graph only) ; de = pixel buffer ; 0 ld a,(de) or (hl) ld (de),a inc de inc hl ; 1 ld a,(de) or (hl) ld (de),a inc de inc hl ; 2 ld a,(de) or (hl) ld (de),a inc de inc hl ; 3 ld a,(de) or (hl) ld (de),a inc de inc hl ; 4 ld a,(de) or (hl) ld (de),a inc de inc hl ; 5 ld a,(de) or (hl) ld (de),a inc de inc hl ; 6 ld a,(de) or (hl) ld (de),a inc de inc hl ; 7 ld a,(de) or (hl) ld (de),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_OR1RB.asm0000644000175000017500000000130110624242400027114 0ustar tygrystygrys ; DRAW OR SPRITE 1 BYTE DEFINITION ROTATED, ON RIGHT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_OR1RB LIB SP1_DRAW_OR1LB XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld de,0 nop ld hl,0 call SP1_DRAW_OR1RB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; de = graphic def ptr ; hl = left graphic def ptr ; ; 42 + 94*4 - 6 + 10 = 422 cycles .SP1_DRAW_OR1RB cp SP1V_ROTTBL/256 jp z, SP1RETSPRDRAW add hl,bc ld d,a inc d ; d = shift table ; hl = left sprite def (graph only) .SP1Or1RBRotate jp SP1_DRAW_OR1LB + 7 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_OR2.asm0000644000175000017500000000363110624242400026701 0ustar tygrystygrys ; DRAW OR SPRITE 2 BYTE DEFINITION ROTATED ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_OR2 LIB SP1_DRAW_OR2NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 ld ix,0 call SP1_DRAW_OR2 ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr (mask,graph) pairs ; ix = left graphic def ptr ; ; 51 + 178*4 - 6 + 10 = 767 cycles .SP1_DRAW_OR2 cp SP1V_ROTTBL/256 jp z, SP1_DRAW_OR2NR add hl,bc add ix,bc ex de,hl ld h,a ; h = shift table ; de = sprite def (mask,graph) pairs ; ix = left sprite def .SP1Or2Rotate ; 0 ld bc,(SP1V_PIXELBUFFER+0) inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+1) or (hl) or c ld (SP1V_PIXELBUFFER+0),a ld l,(ix+3) ld c,(hl) dec h inc de ld a,(de) inc de ld l,a ld a,c or b or (hl) ld (SP1V_PIXELBUFFER+1),a ; 1 ld bc,(SP1V_PIXELBUFFER+2) inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+5) or (hl) or c ld (SP1V_PIXELBUFFER+2),a ld l,(ix+7) ld c,(hl) dec h inc de ld a,(de) inc de ld l,a ld a,c or b or (hl) ld (SP1V_PIXELBUFFER+3),a ; 2 ld bc,(SP1V_PIXELBUFFER+4) inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+9) or (hl) or c ld (SP1V_PIXELBUFFER+4),a ld l,(ix+11) ld c,(hl) dec h inc de ld a,(de) inc de ld l,a ld a,c or b or (hl) ld (SP1V_PIXELBUFFER+5),a ; 3 ld bc,(SP1V_PIXELBUFFER+6) inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+13) or (hl) or c ld (SP1V_PIXELBUFFER+6),a ld l,(ix+15) ld c,(hl) dec h inc de ld a,(de) ld l,a ld a,c or b or (hl) ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_OR2LB.asm0000644000175000017500000000274110624242400027120 0ustar tygrystygrys ; DRAW OR SPRITE 2 BYTE DEFINITION ROTATED, ON LEFT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_OR2LB LIB SP1_DRAW_OR2NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_OR2LB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 32 + 106*4 - 6 + 10 = 460 cycles .SP1_DRAW_OR2LB cp SP1V_ROTTBL/256 jp z, SP1_DRAW_OR2NR add hl,bc ld d,a ; d = shift table ; hl = sprite def (mask,graph) pairs .SP1Or2LBRotate ; 0 ld bc,(SP1V_PIXELBUFFER+0) inc hl ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+0),a inc hl ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+1),a ; 1 ld bc,(SP1V_PIXELBUFFER+2) inc hl ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+2),a inc hl ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+3),a ; 2 ld bc,(SP1V_PIXELBUFFER+4) inc hl ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+4),a inc hl ld e,(hl) inc hl ld a,(de) or b ld (SP1V_PIXELBUFFER+5),a ; 3 ld bc,(SP1V_PIXELBUFFER+6) inc hl ld e,(hl) inc hl ld a,(de) or c ld (SP1V_PIXELBUFFER+6),a inc hl ld e,(hl) ld a,(de) or b ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_OR2NR.asm0000644000175000017500000000227110624242400027140 0ustar tygrystygrys ; DRAW OR SPRITE 2 BYTE DEFINITION NO ROTATION ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_OR2NR XREF SP1RETSPRDRAW, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_OR2NR ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr (mask,graph) pairs ; de = left graphic def ptr ; ; 21 + 39*8 - 12 + 10 = 331 cycles .SP1_DRAW_OR2NR add hl,bc ld de,SP1V_PIXELBUFFER ; hl = sprite def (mask,graph) pairs ; de = pixel buffer ; 0 ld a,(de) inc hl or (hl) ld (de),a inc de inc hl ; 1 ld a,(de) inc hl or (hl) ld (de),a inc de inc hl ; 2 ld a,(de) inc hl or (hl) ld (de),a inc de inc hl ; 3 ld a,(de) inc hl or (hl) ld (de),a inc de inc hl ; 4 ld a,(de) inc hl or (hl) ld (de),a inc de inc hl ; 5 ld a,(de) inc hl or (hl) ld (de),a inc de inc hl ; 6 ld a,(de) inc hl or (hl) ld (de),a inc de inc hl ; 7 ld a,(de) inc hl or (hl) ld (de),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_OR2RB.asm0000644000175000017500000000133310624242400027122 0ustar tygrystygrys ; DRAW OR SPRITE 2 BYTE DEFINITION ROTATED, ON RIGHT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_OR2RB LIB SP1_DRAW_OR2LB XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld de,0 nop ld hl,0 call SP1_DRAW_OR2RB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; de = graphic def ptr (mask,graph) pairs ; hl = left graphic def ptr ; ; 46 + 106*4 - 6 + 10 = 474 cycles .SP1_DRAW_OR2RB cp SP1V_ROTTBL/256 jp z, SP1RETSPRDRAW add hl,bc ld d,a inc d ; d = shift table ; hl = left sprite def (mask,graph) pairs .SP1Or2RBRotate jp SP1_DRAW_OR2LB + 7 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_XOR1.asm0000644000175000017500000000347410624242400027035 0ustar tygrystygrys ; DRAW XOR SPRITE 1 BYTE DEFINITION ROTATED ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_XOR1 LIB SP1_DRAW_XOR1NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 ld ix,0 call SP1_DRAW_XOR1 ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; ix = left graphic def ptr ; ; 51 + 166*4 - 6 + 10 = 719 cycles .SP1_DRAW_XOR1 cp SP1V_ROTTBL/256 jp z, SP1_DRAW_XOR1NR add hl,bc add ix,bc ex de,hl ld h,a ; h = shift table ; de = sprite def (graph only) ; ix = left sprite def .SP1XOr1Rotate ; 0 ld bc,(SP1V_PIXELBUFFER+0) ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+0) or (hl) xor c ld (SP1V_PIXELBUFFER+0),a ld l,(ix+1) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,c or (hl) xor b ld (SP1V_PIXELBUFFER+1),a ; 1 ld bc,(SP1V_PIXELBUFFER+2) ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+2) or (hl) xor c ld (SP1V_PIXELBUFFER+2),a ld l,(ix+3) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,c or (hl) xor b ld (SP1V_PIXELBUFFER+3),a ; 2 ld bc,(SP1V_PIXELBUFFER+4) ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+4) or (hl) xor c ld (SP1V_PIXELBUFFER+4),a ld l,(ix+5) ld c,(hl) dec h ld a,(de) inc de ld l,a ld a,c or (hl) xor b ld (SP1V_PIXELBUFFER+5),a ; 3 ld bc,(SP1V_PIXELBUFFER+6) ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+6) or (hl) xor c ld (SP1V_PIXELBUFFER+6),a ld l,(ix+7) ld c,(hl) dec h ld a,(de) ld l,a ld a,c or (hl) xor b ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_XOR1LB.asm0000644000175000017500000000263110624242400027245 0ustar tygrystygrys ; DRAW XOR SPRITE 1 BYTE DEFINITION ROTATED, ON LEFT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_XOR1LB LIB SP1_DRAW_XOR1NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_XOR1LB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 32 + 94*4 - 6 + 10 = 412 cycles .SP1_DRAW_XOR1LB cp SP1V_ROTTBL/256 jp z, SP1_DRAW_XOR1NR add hl,bc ld d,a ; d = shift table ; hl = sprite def (graph only) .SP1Xor1LBRotate ; 0 ld bc,(SP1V_PIXELBUFFER+0) ld e,(hl) inc hl ld a,(de) xor c ld (SP1V_PIXELBUFFER+0),a ld e,(hl) inc hl ld a,(de) xor b ld (SP1V_PIXELBUFFER+1),a ; 1 ld bc,(SP1V_PIXELBUFFER+2) ld e,(hl) inc hl ld a,(de) xor c ld (SP1V_PIXELBUFFER+2),a ld e,(hl) inc hl ld a,(de) xor b ld (SP1V_PIXELBUFFER+3),a ; 2 ld bc,(SP1V_PIXELBUFFER+4) ld e,(hl) inc hl ld a,(de) xor c ld (SP1V_PIXELBUFFER+4),a ld e,(hl) inc hl ld a,(de) xor b ld (SP1V_PIXELBUFFER+5),a ; 3 ld bc,(SP1V_PIXELBUFFER+6) ld e,(hl) inc hl ld a,(de) xor c ld (SP1V_PIXELBUFFER+6),a ld e,(hl) ld a,(de) xor b ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_XOR1NR.asm0000644000175000017500000000213410624242401027266 0ustar tygrystygrys ; DRAW XOR SPRITE 1 BYTE DEFINITION NO ROTATION ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_XOR1NR XREF SP1RETSPRDRAW, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_XOR1NR ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 21 + 33*8 - 12 + 10 = 283 cycles .SP1_DRAW_XOR1NR add hl,bc ld de,SP1V_PIXELBUFFER ; hl = sprite def (graph only) ; de = pixel buffer ; 0 ld a,(de) xor (hl) ld (de),a inc de inc hl ; 1 ld a,(de) xor (hl) ld (de),a inc de inc hl ; 2 ld a,(de) xor (hl) ld (de),a inc de inc hl ; 3 ld a,(de) xor (hl) ld (de),a inc de inc hl ; 4 ld a,(de) xor (hl) ld (de),a inc de inc hl ; 5 ld a,(de) xor (hl) ld (de),a inc de inc hl ; 6 ld a,(de) xor (hl) ld (de),a inc de inc hl ; 7 ld a,(de) xor (hl) ld (de),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_XOR1RB.asm0000644000175000017500000000131010624242401027245 0ustar tygrystygrys ; DRAW XOR SPRITE 1 BYTE DEFINITION ROTATED, ON RIGHT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_XOR1RB LIB SP1_DRAW_XOR1LB XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld de,0 nop ld hl,0 call SP1_DRAW_XOR1RB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; de = graphic def ptr ; hl = left graphic def ptr ; ; 42 + 94*4 - 6 + 10 = 422 cycles .SP1_DRAW_XOR1RB cp SP1V_ROTTBL/256 jp z, SP1RETSPRDRAW add hl,bc ld d,a inc d ; d = shift table ; hl = left sprite def (graph only) .SP1Xor1RBRotate jp SP1_DRAW_XOR1LB + 7 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_XOR2.asm0000644000175000017500000000365010624242401027033 0ustar tygrystygrys ; DRAW XOR SPRITE 2 BYTE DEFINITION ROTATED ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_XOR2 LIB SP1_DRAW_XOR2NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 ld ix,0 call SP1_DRAW_XOR2 ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr (mask,graph) pairs ; ix = left graphic def ptr ; ; 51 + 178*4 - 6 + 10 = 767 cycles .SP1_DRAW_XOR2 cp SP1V_ROTTBL/256 jp z, SP1_DRAW_XOR2NR add hl,bc add ix,bc ex de,hl ld h,a ; h = shift table ; de = sprite def (mask,graph) pairs ; ix = left sprite def .SP1Xor2Rotate ; 0 ld bc,(SP1V_PIXELBUFFER+0) inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+1) or (hl) xor c ld (SP1V_PIXELBUFFER+0),a ld l,(ix+3) ld c,(hl) dec h inc de ld a,(de) inc de ld l,a ld a,c or (hl) xor b ld (SP1V_PIXELBUFFER+1),a ; 1 ld bc,(SP1V_PIXELBUFFER+2) inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+5) or (hl) xor c ld (SP1V_PIXELBUFFER+2),a ld l,(ix+7) ld c,(hl) dec h inc de ld a,(de) inc de ld l,a ld a,c or (hl) xor b ld (SP1V_PIXELBUFFER+3),a ; 2 ld bc,(SP1V_PIXELBUFFER+4) inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+9) or (hl) xor c ld (SP1V_PIXELBUFFER+4),a ld l,(ix+11) ld c,(hl) dec h inc de ld a,(de) inc de ld l,a ld a,c or (hl) xor b ld (SP1V_PIXELBUFFER+5),a ; 3 ld bc,(SP1V_PIXELBUFFER+6) inc de ld a,(de) inc de ld l,a ld a,(hl) inc h ld l,(ix+13) or (hl) xor c ld (SP1V_PIXELBUFFER+6),a ld l,(ix+15) ld c,(hl) dec h inc de ld a,(de) ld l,a ld a,c or (hl) xor b ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_XOR2LB.asm0000644000175000017500000000276010624242401027252 0ustar tygrystygrys ; DRAW XOR SPRITE 2 BYTE DEFINITION ROTATED, ON LEFT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_XOR2LB LIB SP1_DRAW_XOR2NR XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_XOR2LB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr ; de = left graphic def ptr ; ; 32 + 106*4 - 6 + 10 = 460 cycles .SP1_DRAW_XOR2LB cp SP1V_ROTTBL/256 jp z, SP1_DRAW_XOR2NR add hl,bc ld d,a ; d = shift table ; hl = sprite def (mask,graph) pairs .SP1Xor2LBRotate ; 0 ld bc,(SP1V_PIXELBUFFER+0) inc hl ld e,(hl) inc hl ld a,(de) xor c ld (SP1V_PIXELBUFFER+0),a inc hl ld e,(hl) inc hl ld a,(de) xor b ld (SP1V_PIXELBUFFER+1),a ; 1 ld bc,(SP1V_PIXELBUFFER+2) inc hl ld e,(hl) inc hl ld a,(de) xor c ld (SP1V_PIXELBUFFER+2),a inc hl ld e,(hl) inc hl ld a,(de) xor b ld (SP1V_PIXELBUFFER+3),a ; 2 ld bc,(SP1V_PIXELBUFFER+4) inc hl ld e,(hl) inc hl ld a,(de) xor c ld (SP1V_PIXELBUFFER+4),a inc hl ld e,(hl) inc hl ld a,(de) xor b ld (SP1V_PIXELBUFFER+5),a ; 3 ld bc,(SP1V_PIXELBUFFER+6) inc hl ld e,(hl) inc hl ld a,(de) xor c ld (SP1V_PIXELBUFFER+6),a inc hl ld e,(hl) ld a,(de) xor b ld (SP1V_PIXELBUFFER+7),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_XOR2NR.asm0000644000175000017500000000230510624242401027267 0ustar tygrystygrys ; DRAW XOR SPRITE 2 BYTE DEFINITION NO ROTATION ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_XOR2NR XREF SP1RETSPRDRAW, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld hl,0 nop ld de,0 call SP1_DRAW_XOR2NR ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; hl = graphic def ptr (mask,graph) pairs ; de = left graphic def ptr ; ; 21 + 39*8 - 12 + 10 = 331 cycles .SP1_DRAW_XOR2NR add hl,bc ld de,SP1V_PIXELBUFFER ; hl = sprite def (mask,graph) pairs ; de = pixel buffer ; 0 ld a,(de) inc hl xor (hl) ld (de),a inc de inc hl ; 1 ld a,(de) inc hl xor (hl) ld (de),a inc de inc hl ; 2 ld a,(de) inc hl xor (hl) ld (de),a inc de inc hl ; 3 ld a,(de) inc hl xor (hl) ld (de),a inc de inc hl ; 4 ld a,(de) inc hl xor (hl) ld (de),a inc de inc hl ; 5 ld a,(de) inc hl xor (hl) ld (de),a inc de inc hl ; 6 ld a,(de) inc hl xor (hl) ld (de),a inc de inc hl ; 7 ld a,(de) inc hl xor (hl) ld (de),a jp SP1RETSPRDRAW z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/draw/SP1_DRAW_XOR2RB.asm0000644000175000017500000000134210624242401027253 0ustar tygrystygrys ; DRAW XOR SPRITE 2 BYTE DEFINITION ROTATED, ON RIGHT BORDER ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1_DRAW_XOR2RB LIB SP1_DRAW_XOR2LB XREF SP1RETSPRDRAW, SP1V_ROTTBL, SP1V_PIXELBUFFER ; following data segment copied into struct sp1_cs ld de,0 nop ld hl,0 call SP1_DRAW_XOR2RB ; following draw code called by way of SP1UpdateNow ; ; a = hor rot table ; bc = graphic disp ; de = graphic def ptr (mask,graph) pairs ; hl = left graphic def ptr ; ; 46 + 106*4 - 6 + 10 = 474 cycles .SP1_DRAW_XOR2RB cp SP1V_ROTTBL/256 jp z, SP1RETSPRDRAW add hl,bc ld d,a inc d ; d = shift table ; hl = left sprite def (mask,graph) pairs .SP1Xor2RBRotate jp SP1_DRAW_XOR2LB + 7 z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/MoveC.asm0000644000175000017500000002662210624263644025075 0ustar tygrystygrys ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; iy = & clipping rectangle ; ix = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row .CCrowloop ld a,b inc b ; row++ ; is row in clipping rectangle? sub (iy+0) jp c, CCcliprow0 sub (iy+3) jp nc, CCcliprow0 ; is this the last row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,b sub (ix+0) cp (ix+3) jp nz, CCnotlastrow ; **************************************************************** ; this is the last row, should it be drawn? ex af,af bit 0,a jp nz, CCcliprow1 ex af,af .CCnotlastrow ld c,(ix+1) ; c = column .CCcolloop ld a,c inc c ; column++ ; has this update struct been removed from the display? bit 6,(hl) ex (sp),hl jp nz, CCclipcol0 ; hl = & struct sp1_update.ulist (tail) ; stack = & struct sp1_update, row ; is column in clipping rectangle? sub (iy+1) jp c, CCclipcol0 sub (iy+2) jp nc, CCclipcol0 ; is this the last column in row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,c sub (ix+1) cp (ix+2) jp nz, CCnotlastcol ; z flag set if it is the last column in row ; **************************************************************** ; this is the last column, should it be drawn? ex af,af bit 1,a jp nz, CCclipcol1 ex af,af .CCnotlastcol exx inc (ix+19) ; number of active spr chars++ ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld b,(hl) inc hl ld c,(hl) ; bc = & next struct sp1_cs in sprite inc hl ld a,(hl) or a jp z, CCnoremovenec0 ; first remove spr char from current update struct push bc push hl ; stack = sp1_cs.update, next sp1_cs, sp1_update, row ld bc,4 add hl,bc ; hl = & struct sp1_cs.attr_mask call SP1RemoveSprChar pop de pop hl ex (sp),hl ex de,hl ; hl = & struct sp1_cs.update ; de = & struct sp1_update ; stack = & next struct sp1_cs, row ; change update struct spr char belongs to ld b,(hl) inc hl ld c,(hl) ; bc = old struct sp1_update ld (hl),e dec hl ld (hl),d ; store new struct sp1_update ; do count for occluding sprites inc hl inc hl inc hl ; hl = & struct sp1_cs.type bit 7,(hl) ; is this occluding type? jp z, CCnotoccl0 ld a,(bc) dec a ld (bc),a ; decrease num of occl sprites in old update struct ld a,(de) inc a ld (de),a ; increase num of occl sprites in new update struct .CCnotoccl0 ; invalidate update chars ld a,(de) xor $80 jp p, CCnoinvnew ; new update struct already invalidated so skip ld (de),a ; mark it as invalidated now push de exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,6 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCnoinvnew ld a,(bc) xor $80 jp p, CCnoinvold ; old update struct already invalidated so skip ld (bc),a ; mark it as invalidated now push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,6 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCnoinvold ; hl = & struct sp1_cs.type ; de = & struct sp1_update ; stack = & next struct sp1_cs, row ; now add spr char to new update struct it occupies dec hl ld a,(hl) ; a = plane inc hl ld c,(hl) push bc ; save type inc hl ld b,h ld c,l ; bc = & struct sp1_cs.attr_mask ld hl,4 add hl,de ; hl = & struct sp1_update.slist push de ; save sp1_update call SP1AddSprChar pop hl pop af pop de ; hl = & struct sp1_update ; de = & next struct sp1_cs ; f = z flag set if last col in row ; stack = row jr z, CCnextrow ld bc,10 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp CCcolloop .CCnextrow ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row pop hl ; hl = & struct sp1_update at start of row ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,10*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl exx ex (sp),hl jp CCrowloop .CCnoremovenec0 ; hl = & struct sp1_cs.update ; bc = & next struct sp1_cs in sprite ; stack = & struct sp1_update, row pop de ; de = & struct sp1_update ld (hl),d inc hl ld (hl),e ; store update struct the spr char occupies now inc hl inc hl ; hl = & struct sp1_cs.type ld a,(de) bit 7,(hl) ; is spr char occluding? jp z, CCnotoccl12 inc a ; increase # occluding sprites in update struct ld (de),a .CCnotoccl12 ; invalidate the update struct xor $80 jp p, CCalreadyinv33 ; skip if already invalidated ld (de),a ; mark it as invalidated push de exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,6 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCalreadyinv33 push bc ; hl = & struct sp1_cs.type ; de = & struct sp1_update ; stack = & next struct sp1_cs, row jp CCnoinvold ; add spr char to update list, loop .CCclipcol1 ex af,af .CCclipcol0 exx ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr z, CCskipremoveit ld b,a inc hl ld c,(hl) ; need to remove this spr char from update list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update + 1 ; bc = & old struct sp1_update ; stack = & struct sp1_update, row push bc push de dec hl ld (hl),0 ; this spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.attr_mask call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs pop bc ; bc = & old struct sp1_update ; invalidate so char is redrawn without sprite ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, CCnotoccl44 dec a ; number of occluding sprites in old update struct -- ld (bc),a .CCnotoccl44 xor $80 ; is char already invalidated? jp p, CCalreadyinv66 ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,6 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCalreadyinv66 ; hl = & struct sp1_cs.type ; de = & next struct sp1_cs ; stack = & struct sp1_update, row pop bc bit 6,(hl) ; last column in row? jp nz, CCnextrow ; this is not the last column ld hl,10 add hl,bc push hl ex de,hl exx ex (sp),hl jp CCcolloop .CCskipremoveit ; hl = & struct sp1_cs.update ; de = & next struct sp1_cs in sprite ; stack = & struct sp1_update, row inc hl inc hl inc hl jp CCalreadyinv66 .CCcliprow1 ex af,af .CCcliprow0 ; skipping an entire row, only need to remove ; spr chars from update struct list + invalidate ; if they are on-screen ex (sp),hl exx .CCcliprowlp ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr nz, CCCRremoveit ; ok, not on display inc hl inc hl inc hl ; hl = & struct sp1_cs.type .CCCRrejoinremove ; is this the last col in row? bit 6,(hl) pop hl ; hl = & struct sp1_update jr nz, CCCRnextrow ; this is not the last column in row ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row ld bc,10 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs jp CCcliprowlp .CCCRnextrow ; this was last column, move to next row ; de = & next struct sp1_cs ; hl = & struct sp1_update ; stack = row pop hl ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,10*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp CCrowloop .CCCRremoveit ; need to remove this spr char from update list ld b,a inc hl ld c,(hl) ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update + 1 ; bc = & old struct sp1_update ; stack = & struct sp1_update, row push bc push de dec hl ld (hl),0 ; spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.attr_mask call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs pop bc ; bc = & old struct sp1_update ; invalidate so char is redrawn without sprite ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, CCCRnotoccluding0 dec a ; number of occluding sprites in update struct -- ld (bc),a .CCCRnotoccluding0 xor $80 ; is char already invalidated? jp p, CCCRrejoinremove ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,6 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx jp CCCRrejoinremove z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/MoveNC.asm0000644000175000017500000002307010624263644025205 0ustar tygrystygrys ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; iy = & clipping rectangle ; ix = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row .NCrowloop ld a,b inc b ; row++ ; is row in clipping rectangle? sub (iy+0) jp c, NCcliprow0 sub (iy+3) jp nc, NCcliprow0 ; is this the last row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,b sub (ix+0) cp (ix+3) jp nz, NCnotlastrow ; **************************************************************** ; this is the last row, should it be drawn? ex af,af bit 0,a jp nz, NCcliprow1 ex af,af .NCnotlastrow ld c,(ix+1) ; c = column .NCcolloop ld a,c inc c ; column++ ; has this update struct been removed from the display? bit 6,(hl) ex (sp),hl jr nz, NCclipcol0 ; hl = & struct sp1_update.ulist (tail) ; stack = & struct sp1_update, row ; is column in clipping rectangle? sub (iy+1) jr c, NCclipcol0 sub (iy+2) jr nc, NCclipcol0 ; is this the last column in row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,c sub (ix+1) cp (ix+2) jp nz, NCnotlastcol ; z flag set if it is the last column in row ; **************************************************************** ; this is the last col, should it be drawn? ex af,af bit 1,a jr nz, NCclipcol1 ex af,af .NCnotlastcol exx push af inc (ix+19) ; number of active sprite chars++ ; hl = & struct sp1_cs ; stack = flag = z if last col, & struct sp1_update, row ; is sprite char already in update struct list? ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; hl = & struct sp1_cs.update ld a,(hl) ; if MSB of update struct this spr char is != 0 or a ; then already in list jr z, NCaddit ; already in update struct list so no need to add spr char to update struct list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = flag = z if last col, & struct sp1_update, row pop bc pop hl .NCrejoinaddit ; de = & next struct sp1_cs ; hl = & struct sp1_update ; c = bit 6 set if last col ; stack = row ; invalidate ld a,(hl) ; skip if char already invalidated xor $80 jp p, NCalreadyinv0 ld (hl),a ; mark as invalidated push hl exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,6 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .NCalreadyinv0 bit 6,c ; is this last col? jr nz, NCnextrow .NCnextcol ; this is not the last column in row ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row ld bc,10 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp NCcolloop .NCclipcol1 ex af,af .NCclipcol0 exx ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr nz, NCremoveit ; ok, not on display inc hl inc hl inc hl ; hl = & struct sp1_cs.type .NCrejoinremove ; is this the last col in row? bit 6,(hl) pop hl ; hl = & struct sp1_update jr z, NCnextcol .NCnextrow ; this was last column, move to next row ; de = & next struct sp1_cs ; hl = & struct sp1_update ; stack = row pop hl ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,10*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp NCrowloop .NCaddit ; add the sprite char to update struct's sprite list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = flag = z if last col, & struct sp1_update, row pop af ; f = flag ld b,d ld c,e ; bc = & next struct sp1_cs in update pop de ; de = & struct sp1_update push de push af ld (hl),d inc hl ld (hl),e ; write struct update this spr char belongs to inc hl ld a,(hl) ; a = plane inc hl bit 7,(hl) ; is spr char occluding type? jp z, NCnotoccluding10 ex de,hl inc (hl) ; increase # occluding sprites in update struct ex de,hl .NCnotoccluding10 inc hl push bc ld b,h ld c,l ; bc = & struct sp1_cs.attr_mask ld hl,4 add hl,de ; hl = & struct sp1_update.slist call SP1AddSprChar ; add sprite to update list pop de pop bc pop hl ; de = & next struct sp1_cs ; hl = & struct sp1_update ; c = bit 6 set if last col ; stack = row jp NCrejoinaddit .NCremoveit ; need to remove this spr char from update list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = & struct sp1_update, row push de ld (hl),0 ; this spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.attr_mask call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs ; invalidate so char is redrawn without sprite pop bc ; bc = & struct sp1_update push bc ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, NCnotoccluding0 dec a ; number of occluding sprites in update struct -- ld (bc),a .NCnotoccluding0 xor $80 ; is char already invalidated? jp p, NCrejoinremove ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,6 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx jp NCrejoinremove .NCcliprow1 ex af,af .NCcliprow0 ; skipping an entire row, only need to remove ; spr chars from update struct list + invalidate ; if they are on-screen ex (sp),hl exx .NCcliprowlp ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr nz, NCCRremoveit ; ok, not on display inc hl inc hl inc hl ; hl = & struct sp1_cs.type .NCCRrejoinremove ; is this the last col in row? bit 6,(hl) pop hl ; hl = & struct sp1_update jr nz, NCCRnextrow ; this is not the last column in row ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row ld bc,10 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs jp NCcliprowlp .NCCRnextrow ; this was last column, move to next row ; de = & next struct sp1_cs ; hl = & struct sp1_update ; stack = row pop hl ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,10*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp NCrowloop .NCCRremoveit ; need to remove this spr char from update list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = & struct sp1_update, row push de ld (hl),0 ; spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.attr_mask call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs ; invalidate so char is redrawn without sprite pop bc ; bc = & struct sp1_update push bc ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, NCCRnotoccluding0 dec a ; number of occluding sprites in update struct -- ld (bc),a .NCCRnotoccluding0 xor $80 ; is char already invalidated? jp p, NCCRrejoinremove ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,6 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx jp NCCRrejoinremove z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_AddColSpr.asm0000644000175000017500000000064210624242400026437 0ustar tygrystygrys; uint sp1_AddColSpr(struct sp1_ss *s, uchar type, int graphic, uchar plane) ; CALLER linkage for function pointers XLIB sp1_AddColSpr LIB sp1_AddColSpr_callee XREF ASMDISP_SP1_ADDCOLSPR_CALLEE .sp1_AddColSpr pop af pop hl ld h,l pop bc pop de ld l,e pop de pop ix push hl push hl push de push bc push hl push af jp sp1_AddColSpr_callee + ASMDISP_SP1_ADDCOLSPR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_AddColSpr_callee.asm0000644000175000017500000001330610756777613027776 0ustar tygrystygrys; uint __CALLEE__ sp1_AddColSpr_callee(struct sp1_ss *s, void *drawf, uchar type, int graphic, uchar plane) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_AddColSpr_callee XDEF ASMDISP_SP1_ADDCOLSPR_CALLEE LIB _sp1_struct_cs_prototype XREF _u_malloc, _u_free .sp1_AddColSpr_callee pop af pop hl ld h,l pop bc pop de ld l,e pop de pop ix push af .asmentry ; Adds another column to an existing sprite. ; ; enter : ix = struct sp1_ss * ; h = plane ; l = type (index into table), bit 7 = 1 for occluding, bit 4 = 1 clear pixelbuffer ; bc = graphic definition for column ; de = address of sprite draw function ; uses : af, bc, de, hl, bc', de', hl', iy ; exit : carry flag for success and hl=1, else memory allocation failed and hl=0 .SP1AddColSpr exx ld hl,0 ; first try to get all the memory we need push hl ; push a 0 on stack to indicate end of allocated memory blocks ld b,(ix+3) ; b = height .csalloc push bc ld hl,24 ; sizeof(struct sp1_cs) push ix push hl call _u_malloc pop bc jp nc, fail pop ix pop bc push hl ; stack allocated block djnz csalloc exx ex (sp),hl ; hl = new struct sp1_cs, stack: l = type h = plane push de ; save draw function ; have all necessary memory blocks on stack, hl = new struct sp1_cs ld de,_sp1_struct_cs_prototype ex de,hl ; hl = & struct sp1_cs prototype, de = & new struct sp1_cs ld iyl,e ld iyh,d ; iy = & struct sp1_cs push bc ; save bc = graphic def ld bc,24 ; sizeof(struct sp1_cs) ldir ; copy prototype into new struct pop bc ; bc = graphic def ; have copied prototype struct sp1_cs, now fill in the rest of the details pop de ; de = draw function pop hl ; h = plane, l = type push bc ; stack graphic def ld c,e ld b,d ; bc = draw function ld (iy+4),h ; store plane ld a,l and $90 or $40 ld (iy+5),a ; store type ld e,iyl ld d,iyh ld hl,10 add hl,de ex de,hl ; de = & struct sp1_cs.draw_code (& embedded code in struct sp1_cs) ld hl,-10 add hl,bc ; hl = & draw function data ld bc,10 ; length of draw code ldir ; copy draw code into struct sp1_cs ld a,ixl add a,8 ld (iy+8),a ; store & struct sp1_ss + 8 (& embedded code in struct sp1_ss) ld a,ixh adc a,0 ld (iy+9),a pop bc ld (iy+11),c ; store graphics ptr ld (iy+12),b ld h,(ix+15) ; hl = first struct sp1_cs in sprite ld l,(ix+16) .loop ; ix = struct sp1_ss, iy = next struct sp1_cs to be added to sprite, hl = & next struct sp1_cs in sprite being iterated ld bc,4 .search ld d,(hl) inc hl ld e,(hl) ; de = next struct sp1_cs within sprite in iteration add hl,bc ; hl = & struct sp1_cs.type bit 6,(hl) ; is this struct sp1_cs in last column? ex de,hl jp z, search ex de,hl ; hl = & struct sp1_cs.type in last column, de = next struct sp1_cs at start of next row res 6,(hl) ; no longer last in column ld bc,-5 add hl,bc ; hl = & struct sp1_cs formerly in last column ld a,iyh ; store ptr to new struct sp1_cs as following this one ld (hl),a inc hl ld a,iyl ld (hl),a ld (iy+0),d ; and store next struct sp1_cs at start of next row as following the new one ld (iy+1),e ld bc,10 add hl,bc ; hl = & struct sp1_cs.def formerly in last column ld a,(hl) ld (iy+15),a ; copy left struct's graphic pointer into new struct's left graphic ptr inc hl ld a,(hl) ld (iy+16),a pop hl ; get next allocated memory block ld a,h or l jr z, done push de ; save & first struct sp1_cs in next row of sprite push hl ; stack new memory block ld e,iyl ld d,iyh ex de,hl ; hl = & new struct sp1_cs just added, de = memory block for new struct sp1_cs ld bc,24 ; sizeof(struct sp1_cs) ldir ; copy struct sp1_cs just added into new one ld e,(iy+11) ld d,(iy+12) ; de = graphics ptr from last struct sp1_cs pop iy ; iy = new struct sp1_cs ld hl,8 ; offset to next character in sprite graphic def bit 7,(ix+4) jr z, onebyte2 ld l,16 ; if 2-byte def, offset is 16 bytes .onebyte2 add hl,de ld (iy+11),l ; store correct graphics ptr for this struct sp1_cs ld (iy+12),h pop hl ; hl = & first struct sp1_cs in next row of sprite jp loop .done set 5,(iy+5) ; indicate last struct sp1_cs added is in the last row of sprite inc (ix+2) ; increase width of sprite inc l scf ; indicate success ret .fail pop ix pop bc .faillp pop hl ; hl = allocated memory block ld a,h or l ret z ; if 0 done freeing, ret with nc for failure push hl call _u_free ; free the block pop hl jp faillp DEFC ASMDISP_SP1_ADDCOLSPR_CALLEE = asmentry - sp1_AddColSpr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_ChangeSprType.asm0000644000175000017500000000052110624412256027344 0ustar tygrystygrys; void sp1_ChangeSprType(struct sp1_cs *c, void *drawf) ; CALLER linkage for function pointers XLIB sp1_ChangeSprType LIB sp1_ChangeSprType_callee XREF ASMDISP_SP1_CHANGESPRTYPE_CALLEE .sp1_ChangeSprType pop bc pop de pop hl push hl push de push bc jp sp1_ChangeSprType_callee + ASMDISP_SP1_CHANGESPRTYPE_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_ChangeSprType_callee.asm0000644000175000017500000000210410756777613030671 0ustar tygrystygrys; void __CALLEE__ sp1_ChangeSprType_callee(struct sp1_cs *c, void *drawf) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_ChangeSprType_callee XDEF ASMDISP_SP1_CHANGESPRTYPE_CALLEE .sp1_ChangeSprType_callee pop hl pop de ex (sp),hl .asmentry ; Change the type of a sprite char struct so that it draws using ; a different draw function. If the occluding flag is changed, ; make sure the sprite char struct is off screen before calling. ; ; enter : hl = struct sp1_cs * ; de = address of sprite draw function ; uses : af, bc, de, hl .SP1ChangeSprType ld bc,10 add hl,bc ex de,hl ; de = & struct sp1_CS.draw_code, hl = & draw function ld bc,-10 add hl,bc ; hl = & draw function data ldi ; copy draw code into struct sp1_cs.draw_code inc hl ; but skip over graphic pointers inc hl inc de inc de ldi ldi inc hl inc hl inc de inc de ldi ldi ldi ret DEFC ASMDISP_SP1_CHANGESPRTYPE_CALLEE = asmentry - sp1_ChangeSprType_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_CreateSpr.asm0000644000175000017500000000100510624242400026506 0ustar tygrystygrys; struct sp1_ss *sp1_CreateSpr(void *drawf, uchar type, uchar height, int graphic, uchar plane) ; CALLER linkage for function pointers XLIB sp1_CreateSpr LIB sp1_CreateSpr_callee XREF ASMDISP_SP1_CREATESPR_CALLEE .sp1_CreateSpr ld hl,2 add hl,sp ld c,(hl) inc hl inc hl ld e,(hl) inc hl ld d,(hl) inc hl ld a,(hl) inc hl inc hl ld b,(hl) inc hl inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ex de,hl jp sp1_CreateSpr_callee + ASMDISP_SP1_CREATESPR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_CreateSpr_callee.asm0000644000175000017500000001342010756777613030050 0ustar tygrystygrys; struct sp1_ss __CALLEE__ *sp1_CreateSpr_callee(void *drawf, uchar type, uchar height, int graphic, uchar plane) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_CreateSpr_callee XDEF ASMDISP_SP1_CREATESPR_CALLEE LIB _sp1_struct_ss_prototype, _sp1_struct_cs_prototype XREF _u_malloc, _u_free .sp1_CreateSpr_callee pop ix pop bc pop hl pop de ld a,e pop de ld b,e pop de push ix .asmentry ; Create sprite of given height one column wide. Further columns are ; added with successive calls to SP1AddColSpr. ; ; enter : a = height in chars ; b = type: bit 7 = 1 occluding, bit 6 = 1 2 byte definition, bit 4 = 1 clear pixelbuff ; c = plane sprite occupies (0 = closest to viewer) ; de = address of draw function ; hl = graphic definition for column ; uses : all ; exit : no carry and hl=0 if memory allocation failed else hl = struct sp1_ss * and carry set .SP1CreateSpr push af ex af,af pop af ; a = a' = height exx ld hl,0 ; first try to get all the memory we need push hl ; push a 0 on stack to indicate end of allocated memory blocks ld b,a ; b = height .csalloc push bc ; save height counter ld hl,24 ; sizeof(struct sp1_cs) push hl call _u_malloc pop bc jp nc, fail pop bc push hl ; stack allocated block djnz csalloc ld hl,20 ; sizeof(struct sp1_ss) push hl call _u_malloc pop bc jp nc, fail push hl exx ex (sp),hl ; stack = graphic pointer push de ; save de = draw function push bc ; save b = type, c = plane ; have all necessary memory blocks on stack, hl = & struct sp1_ss ld de,_sp1_struct_ss_prototype ex de,hl ; hl = & struct sp1_ss prototype, de = & new struct sp1_ss ld ixl,e ld ixh,d ; ix = & struct sp1_ss ld bc,20 ; sizeof(struct sp1_ss) ldir ; copy prototype into new struct ; have copied prototype struct sp1_ss, now fill in the rest of the details ex af,af ; a = height ld (ix+3),a ; store height pop bc ; b = type, c = plane bit 6,b jr z, onebyte set 7,(ix+4) ; indicate 2-byte definition .onebyte ld a,b ; a = type and $90 or $40 ; a = type entry for struct sp1_cs pop de ; de = draw function pop hl ex (sp),hl ; stack = graphics ptr, hl = & first struct sp1_cs push de ; save draw function ld (ix+15),h ; store ptr to first struct sp1_cs in struct sp1_ss ld (ix+16),l ; done with struct sp1_ss, now do first struct sp1_cs ld de,_sp1_struct_cs_prototype ex de,hl ; hl = & struct sp1_cs prototype, de = & new struct sp1_cs ld iyl,e ld iyh,d ; iy = & struct sp1_cs push bc ; save c = plane ld bc,24 ; sizeof(struct sp1_cs) ldir ; copy prototype into new struct pop bc ; c = plane ; have copied prototype struct sp1_cs, now fill in the rest of the details ld (iy+4),c ; store plane ld (iy+5),a ; store type ld e,iyl ld d,iyh ld hl,10 add hl,de ex de,hl ; de = & struct sp1_cs.draw_code (& embedded code in struct sp1_cs) pop bc ; bc = draw function ld hl,-10 add hl,bc ; hl = embedded draw function code ld bc,10 ; length of draw code ldir ; copy draw code into struct sp1_cs ld a,ixl add a,8 ld (iy+8),a ; store & struct sp1_ss + 8 (& embedded code in struct sp1_ss) ld a,ixh adc a,0 ld (iy+9),a pop hl ; hl = graphics ptr ld (iy+11),l ; store graphics ptr ld (iy+12),h .loop ; ix = struct sp1_ss, iy = last struct sp1_cs added to sprite pop hl ; hl = & next struct sp1_cs to add ld a,h or l jr z, done push hl ld (iy+0),h ; store ptr to next struct sp1_cs ld (iy+1),l ld e,iyl ld d,iyh ex de,hl ; hl = last struct sp1_cs, de = new struct sp1_cs ld bc,24 ; sizeof(struct sp1_cs) ldir ; make copy of last one into new one ld e,(iy+11) ld d,(iy+12) ; de = graphics ptr from last struct sp1_cs pop iy ; iy = new struct sp1_cs ld (iy+0),c ; place 0 into struct sp1_cs.next_in_spr to indicate ld (iy+1),c ; this is currently last struct sp1_cs in sprite ld hl,8 ; offset to next character in sprite graphic def bit 7,(ix+4) jr z, onebyte2 ld l,16 ; if 2-byte def, offset is 16 bytes .onebyte2 add hl,de ld (iy+11),l ; store correct graphics ptr for this struct sp1_cs ld (iy+12),h jp loop .done set 5,(iy+5) ; indicate last struct sp1_cs added is in the last row of sprite ld a,ixl ld l,a ld a,ixh ld h,a scf ; indicate success ret .fail pop bc .faillp pop hl ; hl = allocated memory block ld a,h or l ret z ; if 0 done freeing, ret with nc for failure push hl call _u_free ; free the block pop hl jp faillp DEFC ASMDISP_SP1_CREATESPR_CALLEE = asmentry - sp1_CreateSpr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_DeleteSpr.asm0000644000175000017500000000141610563550331026522 0ustar tygrystygrys ; void __FASTCALL__ sp1_DeleteSpr(struct sp1_ss *s) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_DeleteSpr XREF _u_free ; Delete the sprite, freeing any memory that was allocated in its ; creation. Sprite must not be display on screen (move off-screen ; first). ; ; enter : hl = struct sp1_ss * ; uses : af, bc, de, hl .sp1_DeleteSpr ex de,hl ld hl,15 add hl,de ; hl = & struct sp1_ss.first .loop ld b,(hl) inc hl ld c,(hl) ; bc = next struct sp1_cs to delete push bc ex de,hl push hl call _u_free ; free current struct sp1_cs pop hl pop de ld l,e ld h,d ; de = hl = next struct sp1_cs to delete inc h dec h jp nz, loop ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_GetSprClr.asm0000644000175000017500000000054310563550331026500 0ustar tygrystygrys; void sp1_GetSprClr(uchar **sprsrc, struct sp1_ap *dest, uchar n) ; CALLER linkage for function pointers XLIB sp1_GetSprClr LIB sp1_GetSprClr_callee XREF ASMDISP_SP1_GETSPRCLR_CALLEE .sp1_GetSprClr pop af pop bc ld b,c pop de pop hl push hl push de push bc push af jp sp1_GetSprClr_callee + ASMDISP_SP1_GETSPRCLR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_GetSprClr_callee.asm0000644000175000017500000000173510577177144030025 0ustar tygrystygrys; void __CALLEE__ sp1_GetSprClr_callee(uchar **sprsrc, struct sp1_ap *dest, uchar n) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_GetSprClr_callee XDEF ASMDISP_SP1_GETSPRCLR_CALLEE .sp1_GetSprClr_callee pop hl pop bc ld b,c pop de ex (sp),hl .asmentry ; Copy sprite colours into an array of struct_sp1_ap ; colour pairs. ; ; enter : b = number of colour pairs to copy (size of sprite in tiles) ; de = struct sp1_ap[] dest array of colour pairs ; hl = array of sprite colour addresses (all point at struct sp1_cs.attr_mask) ; uses : f, bc, de, hl .SP1GetSprClr ld c,$ff .loop push de ld e,(hl) inc hl ld d,(hl) ; de = & struct sp1_cs.attr_mask inc hl ex (sp),hl ex de,hl ; hl = & struct sp1_cs.attr_mask, de = destination array of colour pairs ldi ldi pop hl djnz loop ret DEFC ASMDISP_SP1_GETSPRCLR_CALLEE = asmentry - sp1_GetSprClr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_GetSprClrAddr.asm0000644000175000017500000000053110563550331027270 0ustar tygrystygrys; void sp1_GetSprClrAddr(struct sp1_ss *s, uchar **sprdest) ; CALLER linkage for function pointers XLIB sp1_GetSprClrAddr LIB sp1_GetSprClrAddr_callee XREF ASMDISP_SP1_GETSPRCLRADDR_CALLEE .sp1_GetSprClrAddr pop bc pop de pop hl push hl push de push bc jp sp1_GetSprClrAddr_callee + ASMDISP_SP1_GETSPRCLRADDR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_GetSprClrAddr_callee.asm0000644000175000017500000000225210577177144030613 0ustar tygrystygrys; void __CALLEE__ sp1_GetSprClrAddr_callee(struct sp1_ss *s, uchar **sprdest) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_GetSprClrAddr_callee XDEF ASMDISP_SP1_GETSPRCLRADDR_CALLEE LIB sp1_IterateSprChar_callee XREF ASMDISP_SP1_ITERATESPRCHAR_CALLEE .sp1_GetSprClrAddr_callee pop hl pop de ex (sp),hl .asmentry ; Stores address of attr_mask member in all struct_sp1_cs ; making up a sprite into array passed in. ; ; enter : hl = & struct sp1_ss ; de = destination array of sprite colour addresses ; uses : af, bc, de, hl, ix .SP1GetSprClrAddr ld ix,getaddr jp sp1_IterateSprChar_callee + ASMDISP_SP1_ITERATESPRCHAR_CALLEE .getaddr ; hl = & struct sp1_cs ; de = current position in destination array of sprite colour addresses ld bc,6 add hl,bc ex de,hl ; de = & struct sp1_cs.attr_mask, hl = address array ld (hl),e ; store address of sprite tile's colour info into array inc hl ld (hl),d inc hl ex de,hl ; de = next destination address in array of pointers ret DEFC ASMDISP_SP1_GETSPRCLRADDR_CALLEE = asmentry - sp1_GetSprClrAddr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_InitCharStruct.asm0000644000175000017500000000074010624263546027547 0ustar tygrystygrys; void sp1_InitCharStruct(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane) ; CALLER linkage for function pointers XLIB sp1_InitCharStruct LIB sp1_InitCharStruct_callee XREF ASMDISP_SP1_INITCHARSTRUCT_CALLEE .sp1_InitCharStruct pop ix pop bc ld a,c ex af,af pop bc pop de ld a,e pop de pop hl push hl push de push de push bc push bc push ix jp sp1_InitCharStruct_callee + ASMDISP_SP1_INITCHARSTRUCT_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_InitCharStruct_callee.asm0000644000175000017500000000360210624412256031046 0ustar tygrystygrys; void __CALLEE__ sp1_InitCharStruct_callee(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane) ; 05.2007 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_InitCharStruct_callee XDEF ASMDISP_SP1_INITCHARSTRUCT_CALLEE LIB _sp1_struct_cs_prototype XREF SP1V_ROTTBL .sp1_InitCharStruct_callee pop hl pop bc ld a,c ex af,af pop bc pop de ld a,e pop de ex (sp),hl ; enter : a' = plane ; a = type ; hl = struct sp1_cs * ; de = address of sprite draw function ; bc = graphic ; uses : af, bc, de, hl, af', bc', de', hl' .asmentry push bc ; save graphic push de ; save draw function ex de,hl ; de = struct sp1_cs * ld hl,_sp1_struct_cs_prototype ld bc,24 ldir ; copy prototype struct sp1_cs into sp1_cs ld hl,-5 add hl,de ; hl = & sp1_cs.draw + 1b pop de dec de ; de = & last byte of draw function data ex de,hl ldd ; copy draw function data into struct sp1_cs ldd ldd dec hl dec hl dec de dec de ldd ldd pop bc ; bc = graphic ex de,hl ld (hl),b dec hl ld (hl),c dec hl dec de dec de ex de,hl ldd ex de,hl ; hl = & sp1_cs.ss_draw + 1b ld (hl),sp1_ss_embedded / 256 dec hl ld (hl),sp1_ss_embedded % 256 dec hl dec hl dec hl ; hl = & sp1_cs.type ld (hl),a ; store type dec hl ex af,af ld (hl),a ; store plane ret .sp1_ss_embedded ld a,SP1V_ROTTBL/256 + 8 ; use rotation of four pixels if user selects a non-NR draw function ld bc,0 ex de,hl jp (hl) DEFC ASMDISP_SP1_INITCHARSTRUCT_CALLEE = asmentry - sp1_InitCharStruct_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_InsertCharStruct.asm0000644000175000017500000000056010624263546030110 0ustar tygrystygrys; void sp1_InsertCharStruct(struct sp1_update *u, struct sp1_cs *cs) ; CALLER linkage for function pointers XLIB sp1_InsertCharStruct LIB sp1_InsertCharStruct_callee XREF ASMDISP_SP1_INSERTCHARSTRUCT_CALLEE .sp1_InsertCharStruct pop bc pop hl pop de push de push hl push bc jp sp1_InsertCharStruct_callee + ASMDISP_SP1_INSERTCHARSTRUCT_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_InsertCharStruct_callee.asm0000644000175000017500000000202510624263546031413 0ustar tygrystygrys ; void __CALLEE__ sp1_InsertCharStruct_callee(struct sp1_update *u, struct sp1_cs *cs) ; 05.2007 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_InsertCharStruct_callee XDEF ASMDISP_SP1_INSERTCHARSTRUCT_CALLEE LIB SP1AddSprChar .sp1_InsertCharStruct_callee pop hl pop de ex (sp),hl ex de,hl .asmentry ; hl = struct sp1_cs * ; de = struct sp1_update * inc hl inc hl ld (hl),d ; store sp1_update into sp1_cs.update inc hl ld (hl),e inc hl ld a,(hl) ; a = plane inc hl ; hl = & sp1_cs.type bit 7,(hl) ; is it occluding type? ex de,hl jr z, notoccluding inc (hl) ; increase # occluding sprites in update struct .notoccluding inc de ld c,e ld b,d ; bc = & sp1_cs.attr_mask ld de,4 add hl,de ; hl = & sp1_update.slist jp SP1AddSprChar DEFC ASMDISP_SP1_INSERTCHARSTRUCT_CALLEE = asmentry - sp1_InsertCharStruct_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_IterateSprChar.asm0000644000175000017500000000053010563550331027507 0ustar tygrystygrys; void sp1_IterateSprChar(struct sp1_ss *s, void *hook1) ; CALLER linkage for function pointers XLIB sp1_IterateSprChar LIB sp1_IterateSprChar_callee XREF ASMDISP_SP1_ITERATESPRCHAR_CALLEE .sp1_IterateSprChar pop bc pop ix pop hl push hl push hl push bc jp sp1_IterateSprChar_callee + ASMDISP_SP1_ITERATESPRCHAR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_IterateSprChar_callee.asm0000644000175000017500000000177010577177144031037 0ustar tygrystygrys; void __CALLEE__ sp1_IterateSprChar_callee(struct sp1_ss *s, void *hook1) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_IterateSprChar_callee XREF ASMDISP_SP1_ITERATESPRCHAR_CALLEE LIB l_jpix .sp1_IterateSprChar_callee pop hl pop ix ex (sp),hl .asmentry ; Iterate over all the struct sp1_cs contained in a sprite ; in row major order, calling the user function for each one. ; ; enter : hl = & struct sp1_ss ; ix = user function ; uses : af, bc, hl + whatever user function uses .SP1IterateSprChar ld bc,15 add hl,bc ; hl = & struct sp1_ss.first ld c,b ; bc = sprite char counter = 0 .iterloop ld a,(hl) or a ret z inc hl ld l,(hl) ld h,a ; hl = & next struct sp1_cs push bc push hl call l_jpix ; call userfunc(uint count, struct sp1_cs *c) pop hl pop bc inc bc jp iterloop DEFC ASMDISP_SP1_ITERATESPRCHAR_CALLEE = asmentry - sp1_IterateSprChar_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_IterateUpdateSpr.asm0000644000175000017500000000054610563550331030063 0ustar tygrystygrys; void sp1_IterateUpdateSpr(struct sp1_ss *s, void *hook2) ; CALLER linkage for function pointers XLIB sp1_IterateUpdateSpr LIB sp1_IterateUpdateSpr_callee XREF ASMDISP_SP1_ITERATEUPDATESPR_CALLEE .sp1_IterateUpdateSpr pop bc pop ix pop hl push hl push hl push bc jp sp1_IterateUpdateSpr_callee + ASMDISP_SP1_ITERATEUPDATESPR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_IterateUpdateSpr_callee.asm0000644000175000017500000000241710577177144031403 0ustar tygrystygrys; void __CALLEE__ sp1_IterateUpdateSpr_callee(struct sp1_ss *s, void *hook2) ; 11.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_IterateUpdateSpr_callee XDEF ASMDISP_SP1_ITERATEUPDATESPR_CALLEE LIB l_jpix .sp1_IterateUpdateSpr_callee pop hl pop ix ex (sp),hl .asmentry ; Iterate over all the sp1_update* that the sprite's characters ; occupy in row major order, calling the user function for each ; one. Where a sprite character is not drawn, the user function ; is not called. ; ; enter : hl = & struct sp1_ss ; ix = user function ; uses : af, bc, hl + whatever user function uses .SP1IterateSprChar ld bc,15 add hl,bc ; hl = & struct sp1_ss.first ld c,b ; bc = sprite char counter = 0 .iterloop ld a,(hl) or a ret z inc hl ld l,(hl) ld h,a ; hl = & next struct sp1_cs push hl inc hl inc hl ld a,(hl) or a jr z, skipit inc hl ld l,(hl) ld h,a ; hl = struct sp1_update* push bc push hl call l_jpix ; call userfunc(uint count, struct sp1_update *u) pop hl pop bc .skipit pop hl inc bc jp iterloop DEFC ASMDISP_SP1_ITERATEUPDATESPR_CALLEE = asmentry - sp1_IterateUpdateSpr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_MoveSprAbs.asm0000644000175000017500000000100010563550331026641 0ustar tygrystygrys; void sp1_MoveSprAbs(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot) ; CALLER linkage for function pointers XLIB sp1_MoveSprAbs LIB sp1_MoveSprAbs_callee XREF ASMDISP_SP1_MOVESPRABS_CALLEE .sp1_MoveSprAbs pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop iy pop ix push hl push hl push hl push hl push de push bc push de push af jp sp1_MoveSprAbs_callee + ASMDISP_SP1_MOVESPRABS_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_MoveSprAbs_callee.asm0000644000175000017500000001225410757133754030176 0ustar tygrystygrys; void __CALLEE__ sp1_MoveSprAbs_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot) ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; *** PLEASE HELP ME I'VE BEEN MADE UGLY BY BUGFIXES XLIB sp1_MoveSprAbs_callee XDEF ASMDISP_SP1_MOVESPRABS_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE XREF SP1V_ROTTBL, SP1V_DISPWIDTH, SP1V_UPDATELISTT LIB SP1AddSprChar, SP1RemoveSprChar .sp1_MoveSprAbs_callee pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop iy pop ix push af .asmentry ; enter: ix = & struct sp1_ss ; hl = sprite frame address (0 = no change) ; d = new row coord in chars ; e = new col coord in chars ; b = new horizontal rotation (0..7) ie horizontal pixel position ; c = new vertical rotation (0..7) ie vertical pixel position ; iy = clipping rectangle entirely on screen ; (iy+0) = row, (iy+1) = col, (iy+2) = width, (iy+3) = height ; uses : all except ix, iy which remain unchanged .SP1MoveSprAbs ld (ix+5),b ; store new horizontal rotation ld a,b cp (ix+17) ; decide if last col should draw, result in b rl b add a,a add a,SP1V_ROTTBL/256 ld (ix+9),a ; store effective horizontal rotation (MSB of lookup table to use) xor a sub c ; a = - (vertical rotation in pixels) bit 7,(ix+4) jp z, onebytedef sub c ; a = - 2*(vertical rotation) for 2-byte definitions set 7,c .onebytedef ld (ix+4),c ; store new vertical rotation ld c,a ; c = vertical rotation offset for graphics ptrs ld a,(ix+4) ; decide if last row should draw and $07 cp (ix+18) ld a,b rla ex af,af ld a,h or l jr nz, newframe ld l,(ix+6) ld h,(ix+7) ; hl = old sprite frame pointer jp framerejoin .newframe ld (ix+6),l ld (ix+7),h ; store new frame pointer .framerejoin ld a,c or a jr z, skipadj ld b,$ff ; bc = negative vertical rotation offset add hl,bc ; add vertical rotation offset .skipadj ld (ix+11),l ld (ix+12),h ; store new effective offset for graphics pointers ; d = new row coord (chars) ; e = new col coord (chars) ; ix = & struct sp1_ss ; iy = clipping rectangle ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; ; 329 cycles to this point worst case ld (ix+19),0 ld a,(ix+0) ; has the row coord changed? cp d jp nz, changing0 ld a,(ix+1) ; has the col coord changed? cp e jp nz, changing1 ; not changing character coordinate, no need to remove sprite from update struct lists ; ///////////////////////////////////////////////////////////////////////////////// ; MOVE SPRITE, CHARACTER COORDINATES NOT CHANGING ; ///////////////////////////////////////////////////////////////////////////////// ld h,(ix+15) ld l,(ix+16) push de exx pop de ld hl,(SP1V_UPDATELISTT) ld bc,6 add hl,bc push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ld b,(ix+0) pop de push hl push de ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; iy = & clipping rectangle ; ix = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row INCLUDE "./spectrum/sprites/MoveNC.asm" .done exx ld de,-6 add hl,de ; hl = & last struct sp1_update.ulist in invalidated list ld (SP1V_UPDATELISTT),hl ret ; changing character coordinate, must remove and place sprite in update struct lists ; ///////////////////////////////////////////////////////////////////////////////// ; MOVE SPRITE, CHANGING CHARACTER COORDINATES ; ///////////////////////////////////////////////////////////////////////////////// .changing0 ld (ix+0),d ; write new row coord .changing1 ld (ix+1),e ; write new col coord ; d = new row coord (chars) ; e = new col coord (chars) ; ix = & struct sp1_ss ; iy = & clipping rectangle ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ld h,(ix+15) ld l,(ix+16) push de exx pop de ld hl,(SP1V_UPDATELISTT) ld bc,6 add hl,bc push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ld b,(ix+0) pop de push hl push de ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; iy = & clipping rectangle ; ix = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row INCLUDE "./spectrum/sprites/MoveC.asm" ; jumps to done for exit inside INCLUDE DEFC ASMDISP_SP1_MOVESPRABS_CALLEE = asmentry - sp1_MoveSprAbs_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_MoveSprPix.asm0000644000175000017500000000064410563550331026711 0ustar tygrystygrys; void sp1_MoveSprPix(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uint x, uint y) ; CALLER linkage for function pointers XLIB sp1_MoveSprPix LIB sp1_MoveSprPix_callee XREF ASMDISP_SP1_MOVESPRPIX_CALLEE .sp1_MoveSprPix pop af pop bc pop de pop hl pop iy pop ix push hl push hl push hl push de push bc push af jp sp1_MoveSprPix_callee + ASMDISP_SP1_MOVESPRPIX_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_MoveSprPix_callee.asm0000644000175000017500000000272010563550331030213 0ustar tygrystygrys; void __CALLEE__ sp1_MoveSprPix_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uint x, uint y) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_MoveSprPix_callee XDEF ASMDISP_SP1_MOVESPRPIX_CALLEE LIB sp1_MoveSprAbs_callee XREF ASMDISP_SP1_MOVESPRABS_CALLEE .sp1_MoveSprPix_callee pop af pop bc pop de pop hl pop iy pop ix push af .asmentry ; Move sprite to an absolute pixel location. ; ; enter: ix = sprite structure address ; iy = clipping rectangle, absolute coords and entirely on screen ; (IY+0) = row, (IY+1) = col, (IY+2) = width, (IY+3) = height ; de = pixel x coordinate (0..2047 is meaningful) ; bc = pixel y coordinate (0..2047 is meaningful) ; hl = next sprite frame (0 for no change) ; uses : af, bc, de + SP1MoveSprAbs .SP1MoveSprPix ld a,e and $07 srl d ; compute: de = de / 8, a = de % 8 rr e srl d rr e srl d rr e ; e = new col coord in chars ld d,b ld b,a ; b = new horizontal rotation (0..7) ; dc = y coord ld a,c and $07 srl d ; compute: dc = dc / 8, a = dc % 8 rr c srl d rr c srl d rr c ld d,c ; d = new row coord in chars ld c,a ; c = new vertical rotation (0..7) jp sp1_MoveSprAbs_callee + ASMDISP_SP1_MOVESPRABS_CALLEE DEFC ASMDISP_SP1_MOVESPRPIX_CALLEE = asmentry - sp1_MoveSprPix_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_MoveSprRel.asm0000644000175000017500000000101310563550331026662 0ustar tygrystygrys; void sp1_MoveSprRel(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot) ; CALLER linkage for function pointers XLIB sp1_MoveSprRel LIB sp1_MoveSprRel_callee XREF ASMDISP_SP1_MOVESPRREL_CALLEE .sp1_MoveSprRel pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop iy pop ix push hl push hl push hl push hl push de push bc push de push af jp sp1_MoveSprRel_callee + ASMDISP_SP1_MOVESPRREL_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_MoveSprRel_callee.asm0000644000175000017500000000351110563550331030174 0ustar tygrystygrys; void __CALLEE__ sp1_MoveSprRel_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_MoveSprRel_callee XDEF ASMDISP_SP1_MOVESPRREL_CALLEE LIB sp1_MoveSprAbs_callee XREF ASMDISP_SP1_MOVESPRABS_CALLEE .sp1_MoveSprRel_callee pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop iy pop ix push af .asmentry ; Move sprite a relative distance from current position. ; ; enter: ix = sprite structure address ; hl = next sprite frame address (0 for no change) ; d = relative row coord, signed byte ; e = relative col coord, signed byte ; b = relative horizontal pixel movement, signed byte ; c = relative vertical pixel movement, signed byte ; iy = clipping rectangle absolute coords and entirely on screen ; (IY+0) = row, (IY+1) = col, (IY+2) = width, (IY+3) = height ; uses : af, bc, de + SP1MoveSprAbs .SP1MoveSprRel ld a,(ix+5) ; current horizontal rotation add a,b ld b,a sra a sra a sra a add a,e add a,(ix+1) ld e,a ; e = absolute column position ld a,b cp $80 jp c, mvpos1 add a,8 .mvpos1 and $07 ld b,a ; b = absolute horizontal rotation ld a,(ix+4) ; current vertical rotation and $07 ; get rid of flag in bit 7 add a,c ld c,a sra a sra a sra a add a,d add a,(ix+0) ld d,a ; d = absolute row position ld a,c cp $80 jp c, mvpos2 add a,8 .mvpos2 and $07 ld c,a ; c = absolute vertical rotation jp sp1_MoveSprAbs_callee + ASMDISP_SP1_MOVESPRABS_CALLEE DEFC ASMDISP_SP1_MOVESPRREL_CALLEE = asmentry - sp1_MoveSprRel_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_PreShiftSpr.asm0000644000175000017500000000111410563550331027037 0ustar tygrystygrys; void *sp1_PreShiftSpr(uchar flag, uchar height, uchar width, void *srcframe, void *destframe, uchar rshift) ; CALLER linkage for function pointers XLIB sp1_PreShiftSpr LIB sp1_PreShiftSpr_callee XREF ASMDISP_SP1_PRESHIFTSPR_CALLEE .sp1_PreShiftSpr ld hl,2 add hl,sp ld c,(hl) inc hl inc hl ld e,(hl) inc hl ld d,(hl) inc hl ld iyl,e ld iyh,d ld e,(hl) inc hl ld d,(hl) inc hl ld b,(hl) inc hl inc hl ld a,(hl) inc hl inc hl ld h,(hl) ld l,a ld a,c jp sp1_PreShiftSpr_callee + ASMDISP_SP1_PRESHIFTSPR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_PreShiftSpr_callee.asm0000644000175000017500000000527610564001656030363 0ustar tygrystygrys; void __CALLEE__ *sp1_PreShiftSpr_callee(uchar flag, uchar height, uchar width, void *srcframe, void *destframe, uchar rshift) ; 05.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_PreShiftSpr_callee XDEF ASMDISP_SP1_PRESHIFTSPR_CALLEE .sp1_PreShiftSpr_callee pop af pop bc pop iy pop de pop hl ld b,l pop hl pop ix push af ld a,ixl ld h,a ld a,c .asmentry ; enter : a = right shift amount (0-7) ; b = width in characters (# columns) ; h = zero for 1-byte definition; otherwise 2-byte ; de = source frame graphic ; iy = destination frame address ; l = height in characters ; exit : hl = next available address ; uses : af, bc, de, hl, af', iy .SP1PreShiftSpr and $07 inc a ld c,a ; c = right shift amount + 1 ld a,l inc h dec h ld hl,dummy1byte ; point at two 0 bytes if 1-byte def jr z, onebyte add a,a ld hl,dummy2byte ; point at (255,0) pair if 2-byte def .onebyte add a,a add a,a add a,a ; a = # bytes in graphic definition in each column .dofirstcol ; first column has no graphics on left, will use dummy bytes for left push af ; save height of column in bytes push de ; save top of first column .firstcolloop ex af,af ; a' = pixel height push bc ; save width and rotation amount ld b,c ; b = right shift + 1 ld c,(hl) ; c = graphic byte from col on left ld a,1 xor l ld l,a ld a,(de) ; a = graphic byte in current col inc de djnz firstsloop jp firstdoneshift .firstsloop rr c rra djnz firstsloop .firstdoneshift ld (iy+0),a ; store shifted graphic in destination frame inc iy pop bc ex af,af dec a jr nz, firstcolloop pop hl pop af djnz nextcol push iy pop hl ret .nextcol ; do rest of columns push af push de ; a = height in pixels ; de = graphic definition for this column ; hl = graphic definition for column to left ; b = width remaining in characters ; c = right shift amount + 1 .colloop ex af,af push bc ld b,c ld a,(de) inc de ld c,(hl) inc hl djnz sloop jp doneshift .sloop rr c rra djnz sloop .doneshift ld (iy+0),a inc iy pop bc ex af,af dec a jr nz, colloop pop hl pop af djnz nextcol push iy pop hl ret defb 0 .dummy1byte defb 0,0 .dummy2byte defb 255,0 DEFC ASMDISP_SP1_PRESHIFTSPR_CALLEE = asmentry - sp1_PreShiftSpr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_PutSprClr.asm0000644000175000017500000000054310563550331026531 0ustar tygrystygrys; void sp1_PutSprClr(uchar **sprdest, struct sp1_ap *src, uchar n) ; CALLER linkage for function pointers XLIB sp1_PutSprClr LIB sp1_PutSprClr_callee XREF ASMDISP_SP1_PUTSPRCLR_CALLEE .sp1_PutSprClr pop af pop bc pop de pop hl push hl push de push bc push af ld b,c jp sp1_PutSprClr_callee + ASMDISP_SP1_PUTSPRCLR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_PutSprClr_callee.asm0000644000175000017500000000225610577177144030055 0ustar tygrystygrys; void __CALLEE__ sp1_PutSprClr_callee(uchar **sprdest, struct sp1_ap *src, uchar n) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_PutSprClr_callee XDEF ASMDISP_SP1_PUTSPRCLR_CALLEE .sp1_PutSprClr_callee pop hl pop bc ld b,c pop de ex (sp),hl .asmentry ; Colour sprite by writing (mask,attr) pairs into each ; struct_sp1_cs whose addresses are stored in the array ; pointed at by hl. The array of struct_sp1_cs is ; populated by a call to SP1GetSprClrAddr. ; ; enter : b = number of colour pairs to copy (size of sprite in tiles) ; de = struct sp1_ap[] source array of colour pairs ; hl = array of sprite colour addresses (all point at struct sp1_cs.attr_mask) ; uses : af, bc, de, hl .SP1PutSprClr ld c,$ff .loop push de ld e,(hl) inc hl ld d,(hl) ; de = & sp1_cs.attr_mask inc hl ex (sp),hl ; hl = struct sp1_ap[] ldi ; copy mask and attribute into struct sp1_cs ldi pop de ; de = array of sprite colour addresses advanced one entry ex de,hl djnz loop ret DEFC ASMDISP_SP1_PUTSPRCLR_CALLEE = asmentry - sp1_PutSprClr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/sp1_RemoveCharStruct.asm0000644000175000017500000000173010756777444030116 0ustar tygrystygrys ; void __FASTCALL__ sp1_RemoveCharStruct(struct sp1_cs *cs) ; 05.2007 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_RemoveCharStruct LIB SP1RemoveSprChar ; remove an independent char struct that may be ; inserted into a struct_sp1_update's draw list ; ; enter : hl = struct sp1_cs * ; uses : af, bc, de, hl .sp1_RemoveCharStruct inc hl inc hl ld a,(hl) or a ret z ; not in any struct update draw list ld d,a ld (hl),0 ; not part of this draw list anymore inc hl ld e,(hl) ; de = struct update * inc hl inc hl ; hl = & sp1_cs.type bit 7,(hl) ex de,hl jr z, notoccluding dec (hl) ; reduce occluding count in struct update .notoccluding inc de ; de = & sp1_cs.attr_mask ld hl,17 add hl,de ; hl = & sp1_cs.prev_in_upd + 1b ex de,hl jp SP1RemoveSprChar z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/SP1AddSprChar.asm0000644000175000017500000000514210624263644026355 0ustar tygrystygrys XLIB SP1AddSprChar ; ///////////////////////////////////////////////////////////////////////////////// ; Adds a sprite char to the linked list of sprites in a ; struct sp1_update at the correct position dependant on plane. ; ; enter : a = plane ; hl = & struct update.slist ; bc = & sp1_cs.attr_mask of sprite char being added ; uses : f, bc, de, hl ; ; 98n - 26 + 197 = 98n + 171 (n = # sprites in char; n=3: 465, n=1: 130) .SP1AddSprChar ; hl = prev sprite's & sp1_cs.next_in_upd (pending point to add current sprite after) ld d,(hl) inc hl inc d dec d jr z, donesearch1 ; if no next sprite, we add this sprite to end of list ld e,(hl) dec de dec de ex de,hl ; hl = the next sprite's & sp1_cs.plane, de = prev sprite's & sp1_cs.next_in_upd + 1b cp (hl) jr nc, donesearch0 ; if plane >= this sprite's plane, place before it ld de,16 add hl,de ; hl = the next sprite's & sp1_cs.next_in_upd jp SP1AddSprChar .donesearch1 ; no next sprite ld (hl),c ; hl = & prev sprite's sp1_cs.next_in_upd + 1b dec hl ld (hl),b ; write new sprite char into next ptr ex de,hl ; de = & prev sprite's sp1_cs.next_in_upd ld hl,14 add hl,bc ; hl = & sp1_cs.next_in_upd of spr char to add ld (hl),0 ; no sprite chars follow this one in list inc hl inc hl ld (hl),d ; write prev sprite into prev spr ptr inc hl ld (hl),e ret .donesearch0 ; there is a next sprite inc hl inc hl ex de,hl ; hl = & prev sprite's sp1_cs.next_in_upd + 1b, de = next sprite's & sp1_cs.attr_mask ld (hl),c dec hl ld (hl),b ; prev sprite's next ptr points at new sprite char push hl ; stack = prev sprite's & sp1_cs.next_in_upd ld hl,14 add hl,bc ; hl = new sprite's & sp1_cs.next_in_upd ld (hl),d inc hl ld (hl),e ; new sprite's next ptr points at next sprite inc hl ; hl = new sprite's & sp1_cs.prev_in_upd pop bc ; bc = prev sprite's & sp1_cs.next_in_upd ld (hl),b inc hl ld (hl),c ; new sprite's prev ptr points at prev sprite dec hl dec hl dec hl ex de,hl ; de = new sprite's & sp1_cs.next_in_upd ld bc,16 add hl,bc ; hl = next sprite's & sp1_cs.prev_in_upd ld (hl),d inc hl ld (hl),e ; next sprite's prev ptr points at new sprite ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/sprites/SP1RemoveSprChar.asm0000644000175000017500000000343610624263644027126 0ustar tygrystygrys XLIB SP1RemoveSprChar ; ///////////////////////////////////////////////////////////////////////////////// ; Remove a sprite char from the linked list of sprites ; it occupies in a struct sp1_update ; ; enter : hl = & struct sp1_cs.attr_mask ; exit : de = & struct sp1_cs.prev_in_upd + 1 ; uses : f, bc, de, hl ; ; 179 cycles worst case .SP1RemoveSprChar ld de,14 add hl,de ; hl = & struct sp1_cs.next_in_upd ld b,(hl) ; check if there's any sprite char after this one in list inc b inc hl ; hl = & struct sp1_cs.next_in_upd + 1 djnz nextexists ; no sprite char after this one in list so removing from end of list inc hl ld d,(hl) inc hl ld e,(hl) ; de = & left link's sp1_cs.next_in_upd ex de,hl ; de = & struct sp1_cs.prev_in_upd + 1 ld (hl),0 ; mark no next sprite, removing this one from list ret .nextexists ; there is a sprite char after this one in update list, so removing from middle of list ld c,(hl) ; bc = & right link's struct sp1_cs.attr_mask inc hl ld d,(hl) inc hl ld e,(hl) ; de = & left link's struct sp1_cs.next_in_upd ex de,hl ; de = & struct sp1_cs.prev_in_upd + 1b push hl ; stack & left link's struct sp1_cs.next_in_upd ld (hl),b inc hl ld (hl),c ; previous sprite's next ptr = & right link's struct sp1_cs.attr_mask ld hl,16 add hl,bc ; hl = & right link's struct sp1_cs.prev_in_update pop bc ; bc = & left link's struct sp1_cs.next_in_upd ld (hl),b inc hl ld (hl),c ; next sprite's prev ptr = & left link's struct sp1_cs.next_in_upd ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/0000755000175000017500000000000010765202715022777 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_ClearRect.asm0000644000175000017500000000104110561243335026121 0ustar tygrystygrys; void sp1_ClearRect(struct sp1_Rect *r, uchar colour, uchar tile, uchar rflag) ; CALLER linkage for function pointers XLIB sp1_ClearRect LIB sp1_ClearRect_callee XREF ASMDISP_SP1_CLEARRECT_CALLEE .sp1_ClearRect ld hl,2 add hl,sp ld a,(hl) inc hl inc hl ld e,(hl) inc hl inc hl ld d,(hl) inc hl inc hl ld c,(hl) inc hl ld h,(hl) ld l,c push de ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl jp sp1_ClearRect_callee + ASMDISP_SP1_CLEARRECT_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_ClearRect_callee.asm0000644000175000017500000001027610561243335027440 0ustar tygrystygrys; void __CALLEE__ sp1_ClearRect_callee(struct sp1_Rect *r, uchar colour, uchar tile, uchar rflag) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_ClearRect_callee XDEF ASMDISP_SP1_CLEARRECT_CALLEE, ASMDISP_SP1CRSELECT LIB sp1_GetUpdateStruct_callee, l_jpix XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH .sp1_ClearRect_callee pop af pop bc pop hl pop de ld h,e pop de push af ld a,c push hl ex de,hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl .asmentry ; Clear a rectangular area on screen, erasing sprites, ; changing tile and changing colour depending on flags. ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; h = attr ; l = tile ; a = bit 0 set for tiles, bit 1 set for tile colours, bit 2 set for sprites ; uses : af, bc, de, hl, af', ix .SP1ClearRect and $07 ret z ; ret if all flags reset push hl call SP1CRSELECT ; ix = address of operation code (depending on flags passed in) call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct update pop de ; d = attr, e = tile .rowloop push bc ; save b = width push hl ; save update position .colloop call l_jpix ; apply operation on hl, advance hl to next struct sp1_update to the right djnz colloop pop hl ld bc,10*SP1V_DISPWIDTH add hl,bc pop bc dec c jp nz, rowloop ret .SP1CRSELECT add a,a add a,seltbl%256 ld l,a ld h,seltbl/256 jp nc, noinc0 inc h .noinc0 ld a,(hl) ld ixl,a inc hl ld a,(hl) ld ixh,a ret .seltbl defw OPTION0, OPTION1, OPTION2, OPTION3 defw OPTION4, OPTION5, OPTION6, OPTION7 .OPTION0 ; no flags ld a,10 add a,l ld l,a ret nc inc h ret .OPTION1 ; tile only inc hl inc hl ld (hl),e inc hl ld (hl),0 ld a,7 add a,l ld l,a ret nc inc h ret .OPTION2 ; colour only inc hl ld (hl),d ld a,9 add a,l ld l,a ret nc inc h ret .OPTION3 ; tile and colour inc hl ld (hl),d inc hl ld (hl),e inc hl ld (hl),0 ld a,7 add a,l ld l,a ret nc inc h ret .OPTION4 ; sprite only ld a,(hl) and $c0 inc a ; keep bit 6:7 flag, occluding spr count reset to 1 ld (hl),a inc hl inc hl inc hl inc hl push hl ld a,(hl) ; if no sprites in this tile, done or a jr z, done ld (hl),0 ; mark no sprites in this tile inc hl ld l,(hl) ld h,a .loop ; hl = & struct sp1_cs.attr_mask dec hl dec hl dec hl dec hl ; hl = & struct sp1_cs.update ld (hl),0 ; remove from sprite char from tile ld a,18 add a,l ld l,a jp nc, noinc1 inc h .noinc1 ; hl = & struct sp1_cs.next_in_upd ld a,(hl) or a jr z, done inc hl ld l,(hl) ld h,a jp loop .done pop hl ld a,6 add a,l ld l,a ret nc inc h ret .OPTION5 ; sprite and tile inc hl inc hl ld (hl),e inc hl ld (hl),0 dec hl dec hl dec hl jp OPTION4 .OPTION6 ; sprite and colour inc hl ld (hl),d dec hl jp OPTION4 .OPTION7 ; sprite, tile and colour inc hl ld (hl),d inc hl ld (hl),e inc hl ld (hl),0 dec hl dec hl dec hl jp OPTION4 DEFC ASMDISP_SP1_CLEARRECT_CALLEE = asmentry - sp1_ClearRect_callee DEFC ASMDISP_SP1CRSELECT = SP1CRSELECT - sp1_ClearRect_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_ClearRectInv.asm0000644000175000017500000000106710561243335026606 0ustar tygrystygrys; void sp1_ClearRectInv(struct sp1_Rect *r, uchar colour, uchar tile, uchar rflag) ; CALLER linkage for function pointers XLIB sp1_ClearRectInv LIB sp1_ClearRectInv_callee XREF ASMDISP_SP1_CLEARRECTINV_CALLEE .sp1_ClearRectInv ld hl,2 add hl,sp ld a,(hl) inc hl inc hl ld e,(hl) inc hl inc hl ld d,(hl) inc hl inc hl ld c,(hl) inc hl ld h,(hl) ld l,c push de ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl jp sp1_ClearRectInv_callee + ASMDISP_SP1_CLEARRECTINV_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_ClearRectInv_callee.asm0000644000175000017500000000462110561243335030112 0ustar tygrystygrys; void __CALLEE__ sp1_ClearRectInv_callee(struct sp1_Rect *r, uchar colour, uchar tile, uchar rflag) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_ClearRectInv_callee XDEF ASMDISP_SP1_CLEARRECTINV_CALLEE LIB sp1_GetUpdateStruct_callee, sp1_ClearRect_callee, l_jpix XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, ASMDISP_SP1CRSELECT XREF SP1V_DISPWIDTH, SP1V_UPDATELISTT .sp1_ClearRectInv_callee pop af pop bc pop hl pop de ld h,e pop de push af ld a,c push hl ex de,hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl .asmentry ; Clear a rectangular area on screen, erasing sprites, ; changing tile and changing colour depending on flags. ; Invalidate the area so that it is drawn in the next update. ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; h = attr ; l = tile ; a = bit 0 set for tiles, bit 1 set for tile colours, bit 2 set for sprites ; uses : af, bc, de, hl, af', ix, iy .SP1ClearRectInv and $07 ret z ; ret if all flags reset push hl call sp1_ClearRect_callee + ASMDISP_SP1CRSELECT ; ix = address of operation code (depending on flags passed in) call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct update pop de ; d = attr, e = tile ld iy,(SP1V_UPDATELISTT) ; iy = last struct sp1_update in draw queue .rowloop push bc ; save b = width push hl ; save update position .colloop ld a,$80 xor (hl) jp p, alreadyinv ; if this update struct already invalidated, skip ahead ld (hl),a ld (iy+6),h ; store link in last invalidated update struct to this struct update ld (iy+7),l ld a,l ; make this update struct the last one in invalidated list ld iyl,a ; "ld iyl,l" is likely taken as "ld iyl,iyl" ld a,h ld iyh,a .alreadyinv call l_jpix ; apply operation on hl, advance hl to next struct sp1_update to the right djnz colloop pop hl ld bc,10*SP1V_DISPWIDTH add hl,bc pop bc dec c jp nz, rowloop ld (iy+6),0 ld (SP1V_UPDATELISTT),iy ret DEFC ASMDISP_SP1_CLEARRECTINV_CALLEE = asmentry - sp1_ClearRectInv_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_GetTiles.asm0000644000175000017500000000072410561243335026004 0ustar tygrystygrys; void sp1_GetTiles(struct sp1_Rect *r, struct sp1_tp *dest) ; CALLER linkage for function pointers XLIB sp1_GetTiles LIB sp1_GetTiles_callee XREF ASMDISP_SP1_GETTILES_CALLEE .sp1_GetTiles ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) push de inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl jp sp1_GetTiles_callee + ASMDISP_SP1_GETTILES_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_GetTiles_callee.asm0000644000175000017500000000305510761347506027320 0ustar tygrystygrys; void __CALLEE__ sp1_GetTiles_callee(struct sp1_Rect *r, struct sp1_tp *dest) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_GetTiles_callee XDEF ASMDISP_SP1_GETTILES_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH .sp1_GetTiles_callee pop af pop hl ex (sp),hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl push af .asmentry ; Copy colour and tile from background into destination array. Can ; be printed to screen as a macro by SP1PutTiles. ; ; enter : hl = & struct sp1_tp[] destination array to store tile info ; d = row coord ; e = col coord ; b = width ; c = height ; uses : af, bc, de, hl, ixl .SP1GetTiles push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update pop de ; de = dest address inc hl ld ixl,c ; ixl = height ld c,$ff .rowloop push bc ; save b = width push hl ; save update position .colloop ldi ldi ldi ld a,7 add a,l ld l,a jp nc, noinc inc h .noinc djnz colloop pop hl ; hl = & struct sp1_update in same row leftmost column ld bc,10*SP1V_DISPWIDTH add hl,bc ; hl = & struct sp1_update in next row leftmost column pop bc dec ixl jp nz, rowloop ret DEFC ASMDISP_SP1_GETTILES_CALLEE = asmentry - sp1_GetTiles_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_PrintAt.asm0000644000175000017500000000061510561243335025644 0ustar tygrystygrys; void sp1_PrintAt(uchar row, uchar col, uchar colour, uint tile) ; CALLER linkage for function pointers XLIB sp1_PrintAt LIB sp1_PrintAt_callee XREF ASMDISP_SP1_PRINTAT_CALLEE .sp1_PrintAt ld hl,2 add hl,sp ld c,(hl) inc hl ld b,(hl) inc hl ld a,(hl) inc hl inc hl ld e,(hl) inc hl inc hl ld d,(hl) jp sp1_PrintAt_callee + ASMDISP_SP1_PRINTAT_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_PrintAt_callee.asm0000644000175000017500000000146710561243335027157 0ustar tygrystygrys; void __CALLEE__ sp1_PrintAt_callee(uchar row, uchar col, uchar colour, uint tile) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_PrintAt_callee XDEF ASMDISP_SP1_PRINTAT_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_PrintAt_callee pop af pop bc pop hl pop de ld d,l pop hl push af ld a,d ld d,l .asmentry ; Print tile and colour to given coordinate. ; ; enter : d = row coord ; e = col coord ; bc = tile code ; a = attr ; uses : af, de, hl, af' .SP1PrintAt ex af,af call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ex af,af inc hl ld (hl),a inc hl ld (hl),c inc hl ld (hl),b ret DEFC ASMDISP_SP1_PRINTAT_CALLEE = asmentry - sp1_PrintAt_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_PrintAtInv.asm0000644000175000017500000000064210561243335026321 0ustar tygrystygrys; void sp1_PrintAtInv(uchar row, uchar col, uchar colour, uint tile) ; CALLER linkage for function pointers XLIB sp1_PrintAtInv LIB sp1_PrintAtInv_callee XREF ASMDISP_SP1_PRINTATINV_CALLEE .sp1_PrintAtInv ld hl,2 add hl,sp ld c,(hl) inc hl ld b,(hl) inc hl ld a,(hl) inc hl inc hl ld e,(hl) inc hl inc hl ld d,(hl) jp sp1_PrintAtInv_callee + ASMDISP_SP1_PRINTATINV_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_PrintAtInv_callee.asm0000644000175000017500000000337210561243335027631 0ustar tygrystygrys; void __CALLEE__ sp1_PrintAtInv_callee(uchar row, uchar col, uchar colour, uint tile) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_PrintAtInv_callee XDEF ASMDISP_SP1_PRINTATINV_CALLEE LIB sp1_GetUpdateStruct_callee, sp1_PrintAt_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, ASMDISP_SP1_PRINTAT_CALLEE XREF SP1V_UPDATELISTT .sp1_PrintAtInv_callee pop af pop bc pop hl pop de ld d,l pop hl push af ld a,d ld d,l .asmentry ; Print tile and colour to given coordinate and invalidate ; the tile so that it is redrawn in the next update. ; ; enter : d = row coord ; e = col coord ; bc = tile code ; a = attr ; uses : af, bc, de, hl, af' .SP1PrintAtInv ex af,af call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ld a,(hl) xor $80 jp p, sp1_PrintAt_callee + ASMDISP_SP1_PRINTAT_CALLEE + 4 ; if already marked for invalidation just do PrintAt ld (hl),a ; mark struct_sp1_update as invalidated ex af,af ld e,l ld d,h ; de = & struct sp1_update inc hl ld (hl),a ; write colour inc hl ld (hl),c ; write tile inc hl ld (hl),b inc hl inc hl inc hl ld (hl),0 ; mark no struct sp1_update following in invalidated list ld hl,(SP1V_UPDATELISTT) ; current last sp1_update in invalidated list ld bc,6 add hl,bc ld (hl),d ; store this new sp1_update into current tail inc hl ld (hl),e ld (SP1V_UPDATELISTT),de ; this new struct sp1_update is now the tail in invalidated list ret DEFC ASMDISP_SP1_PRINTATINV_CALLEE = asmentry - sp1_PrintAtInv_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_PrintString.asm0000644000175000017500000000102610763607743026556 0ustar tygrystygrys; void sp1_PrintString(struct sp1_pss *ps, uchar *s) ; CALLER linkage for function pointers XLIB sp1_PrintString LIB SP1PrintString, SP1PSPOP, SP1PSPUSH .sp1_PrintString ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ; de = & string inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = & struct sp1_pss push hl ; push & struct sp1_pss call SP1PSPOP call SP1PrintString pop hl ; hl = & struct sp1_pss jp SP1PSPUSH z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_PrintString_callee.asm0000644000175000017500000000060310763607743030063 0ustar tygrystygrys; void __CALLEE__ sp1_PrintString_callee(struct sp1_pss *ps, uchar *s) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zxz81 hi-res version XLIB sp1_PrintString_callee LIB SP1PrintString, SP1PSPOP, SP1PSPUSH .sp1_PrintString_callee pop hl pop de ex (sp),hl push hl ; save & struct sp1_pss call SP1PSPOP call SP1PrintString pop hl jp SP1PSPUSH z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_PutTiles.asm0000644000175000017500000000072310561243335026034 0ustar tygrystygrys; void sp1_PutTiles(struct sp1_Rect *r, struct sp1_tp *src) ; CALLER linkage for function pointers XLIB sp1_PutTiles LIB sp1_PutTiles_callee XREF ASMDISP_SP1_PUTTILES_CALLEE .sp1_PutTiles ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) push de inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl jp sp1_PutTiles_callee + ASMDISP_SP1_PUTTILES_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_PutTiles_callee.asm0000644000175000017500000000377010761347506027355 0ustar tygrystygrys; void __CALLEE__ sp1_PutTiles_callee(struct sp1_Rect *r, struct sp1_tp *src) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_PutTiles_callee XDEF ASMDISP_SP1_PUTTILES_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH .sp1_PutTiles_callee pop af pop hl ex (sp),hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl push af .asmentry ; Copy a rectangular set of tiles and colours to screen. The ; source array can be filled in by SP1GetTiles. ; ; enter : hl = struct sp1_tp[] array of attr/tile pairs ; d = row coord ; e = col coord ; b = width ; c = height ; uses : af, bc, de, hl, ixl .SP1PutTiles push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update pop de ; de = struct sp1_tp * inc hl ex de,hl ; hl = struct sp1_tp *, de = & struct sp1_update ld ixl,c ; ixl = height ld c,$ff .rowloop push bc ; save b = width push de ; save update position .colloop ldi ; copy colour and tile from struct sp1_tp[] ldi ; into struct sp1_update ldi ld a,7 add a,e ld e,a jp nc, noinc inc d ; de = next struct sp1_update * one column to right .noinc djnz colloop ex (sp),hl ; hl = struct sp1_update * in same row but leftmost column ld bc,10*SP1V_DISPWIDTH add hl,bc ; hl = struct sp1_update * one row down leftmost column pop de ex de,hl ; de = struct sp1_update * down one row, hl = struct sp1_tp[] pop bc ; b = width dec ixl jp nz, rowloop ret DEFC ASMDISP_SP1_PUTTILES_CALLEE = asmentry - sp1_PutTiles_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_PutTilesInv.asm0000644000175000017500000000075010561243335026511 0ustar tygrystygrys; void sp1_PutTilesInv(struct sp1_Rect *r, struct sp1_tp *src) ; CALLER linkage for function pointers XLIB sp1_PutTilesInv LIB sp1_PutTilesInv_callee XREF ASMDISP_SP1_PUTTILESINV_CALLEE .sp1_PutTilesInv ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) push de inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl jp sp1_PutTilesInv_callee + ASMDISP_SP1_PUTTILESINV_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_PutTilesInv_callee.asm0000644000175000017500000000502710561243335030020 0ustar tygrystygrys; void __CALLEE__ sp1_PutTilesInv_callee(struct sp1_Rect *r, struct sp1_tp *src) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_PutTilesInv_callee XDEF ASMDISP_SP1_PUTTILESINV_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE XREF SP1V_DISPWIDTH, SP1V_UPDATELISTT .sp1_PutTilesInv_callee pop af pop hl ex (sp),hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl push af .asmentry ; Copy a rectangular set of tiles and colours to screen. The ; source array can be filled in by SP1GetTiles. Invalidate ; the rectangular area so that it is drawn in the next update. ; ; enter : hl = struct sp1_tp[] array of attr/tile pairs ; d = row coord ; e = col coord ; b = width ; c = height ; uses : af, bc, de, hl, af', ix .SP1PutTilesInv push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update pop de ; de = struct sp1_tp * ex de,hl ; hl = struct sp1_tp *, de = & struct sp1_update ld a,c ; a = height ld c,$ff ld ix,(SP1V_UPDATELISTT) .rowloop push bc ; save b = width push de ; save update position ex af,af ; a' = height .colloop ld a,(de) xor $80 jp p, skipinval ; bit 7 now reset if already invalidated ld (de),a ld (ix+6),d ; this struct sp1_update to end of list ld (ix+7),e ld ixl,e ld ixh,d .skipinval inc de ldi ; copy colour and tile from struct sp1_tp[] ldi ; into struct sp1_update ldi ld a,6 add a,e ld e,a jp nc, noinc inc d ; de = next struct sp1_update * one column to right .noinc djnz colloop ex (sp),hl ; hl = struct sp1_update * in same row but leftmost column ld bc,10*SP1V_DISPWIDTH add hl,bc ; hl = struct sp1_update * one row down leftmost column pop de ex de,hl ; de = struct sp1_update * down one row, hl = struct sp1_tp[] pop bc ; b = width ex af,af ; a = height dec a jp nz, rowloop ld (ix+6),0 ld (SP1V_UPDATELISTT),ix ret DEFC ASMDISP_SP1_PUTTILESINV_CALLEE = asmentry - sp1_PutTilesInv_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_ScreenAttr.asm0000644000175000017500000000047310561243335026337 0ustar tygrystygrys; uchar sp1_ScreenAttr(uchar row, uchar col) ; CALLER linkage for function pointers XLIB sp1_ScreenAttr LIB sp1_ScreenAttr_callee XREF ASMDISP_SP1_SCREENATTR_CALLEE .sp1_ScreenAttr ld hl,2 add hl,sp ld e,(hl) inc hl inc hl ld d,(hl) jp sp1_ScreenAttr_callee + ASMDISP_SP1_SCREENATTR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_ScreenAttr_callee.asm0000644000175000017500000000124710577177144027657 0ustar tygrystygrys; uchar__CALLEE__ sp1_ScreenAttr_callee(uchar row, uchar col) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_ScreenAttr_callee XDEF ASMDISP_SP1_SCREENATTR_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_ScreenAttr_callee pop hl pop de ex (sp),hl ld d,l .asmentry ; Return colour at background coord given. ; ; enter : d = row coord ; e = col coord ; exit : hl = attr ; uses : af, de, hl .SP1ScreenAttr call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE inc hl ld l,(hl) ld h,0 ret DEFC ASMDISP_SP1_SCREENATTR_CALLEE = asmentry - sp1_ScreenAttr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_ScreenStr.asm0000644000175000017500000000044610561243335026175 0ustar tygrystygrys; uint sp1_ScreenStr(uchar row, uchar col) ; CALLER linkage for function pointers XLIB sp1_ScreenStr LIB sp1_ScreenStr_callee XREF ASMDISP_SP1_SCREENSTR_CALLEE .sp1_ScreenStr ld hl,2 ld e,(hl) inc hl inc hl ld d,(hl) jp sp1_ScreenStr_callee + ASMDISP_SP1_SCREENSTR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_ScreenStr_callee.asm0000644000175000017500000000130110577177144027504 0ustar tygrystygrys; uint __CALLEE__ sp1_ScreenStr_callee(uchar row, uchar col) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_ScreenStr_callee XDEF ASMDISP_SP1_SCREENSTR_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_ScreenStr_callee pop hl pop de ex (sp),hl ld d,l .asmentry ; Return tile at background coord given. ; ; enter : d = row coord ; e = col coord ; exit : hl = tile ; uses : af, de, hl .SP1ScreenStr call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE inc hl inc hl ld e,(hl) inc hl ld d,(hl) ex de,hl ret DEFC ASMDISP_SP1_SCREENSTR_CALLEE = asmentry - sp1_ScreenStr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_SetPrintPos.asm0000644000175000017500000000063310563550331026514 0ustar tygrystygrys; void sp1_SetPrintPos(struct sp1_pss *ps, uchar row, uchar col) ; CALLER linkage for function pointers XLIB sp1_SetPrintPos LIB sp1_SetPrintPos_callee XREF ASMDISP_SP1_SETPRINTPOS_CALLEE .sp1_SetPrintPos ld hl,2 add hl,sp ld e,(hl) inc hl inc hl ld d,(hl) inc hl inc hl ld a,(hl) inc hl ld h,(hl) ld l,a jp sp1_SetPrintPos_callee + ASMDISP_SP1_SETPRINTPOS_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_SetPrintPos_callee.asm0000644000175000017500000000157710563550331030031 0ustar tygrystygrys; void __CALLEE__ sp1_SetPrintPos_callee(struct sp1_pss *ps, uchar row, uchar col) ; 05.2006 aralbrec, Sprite Pack v3.0 ; Sinclair Spectrum version XLIB sp1_SetPrintPos_callee XDEF ASMDISP_SP1_SETPRINTPOS_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_SetPrintPos_callee pop af pop de pop hl ld d,l pop hl push af .asmentry ; e = col ; d = row ; hl = struct sp1_pss *ps ld c,(hl) inc hl ld b,(hl) ; bc = & bounds rectangle inc hl inc hl ld (hl),e inc hl ld (hl),d inc hl inc hl inc hl push hl ld a,(bc) add a,d ld d,a inc bc ld a,(bc) add a,e ld e,a call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE pop de ex de,hl ld (hl),e inc hl ld (hl),d ret DEFC ASMDISP_SP1_SETPRINTPOS_CALLEE = asmentry - sp1_SetPrintPos_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_TileEntry.asm0000644000175000017500000000047710561243335026210 0ustar tygrystygrys; void *sp1_TileEntry(uchar c, void *def) ; CALLER linkage for function pointers XLIB sp1_TileEntry LIB sp1_TileEntry_callee XREF ASMDISP_SP1_TILEENTRY_CALLEE .sp1_TileEntry ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) inc hl ld c,(hl) jp sp1_TileEntry_callee + ASMDISP_SP1_TILEENTRY_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/sp1_TileEntry_callee.asm0000644000175000017500000000135610561243335027512 0ustar tygrystygrys; void __CALLEE__ *sp1_TileEntry_callee(uchar c, void *def) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_TileEntry_callee XDEF ASMDISP_SP1_TILEENTRY_CALLEE XREF SP1V_TILEARRAY .sp1_TileEntry_callee pop hl pop de pop bc push hl .asmentry ; Associate a new graphic with character code passed in. ; ; enter : de = address of udg graphic to associate with character code ; c = char code ; exit : hl = old udg graphic associated with char code ; uses : af, b, de, hl .SP1TileEntry ld hl,SP1V_TILEARRAY ld b,0 add hl,bc ld a,(hl) ld (hl),e ld e,a inc h ld a,(hl) ld (hl),d ld h,a ld l,e ret DEFC ASMDISP_SP1_TILEENTRY_CALLEE = asmentry - sp1_TileEntry_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/SP1PrintString.asm0000644000175000017500000002663210763354025026321 0ustar tygrystygrys; m/c entry point for print string function ; 05.2006, 12.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1PrintString LIB sp1_GetUpdateStruct_callee, l_jpix XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE XREF SP1V_UPDATELISTT, SP1V_DISPWIDTH ; A sophisticated print string function ; ; The string to print is pointed at by HL and terminates with a 0 byte. ; Characters are printed as background tiles (ie a tile# and colour/pallette) ; with the following special character codes understood: ; ; code meaning ; ---- ------- ; 0 terminate string ; 1 logically AND into attribute mask N* ; 2 gotoy N* (goto y coordinate on same column) ; 3 ywrap N* ; 4 attribute mask N* ; 5 16-bit tile code follows W* ; 6 gotox N* (goto x coordinate on same line) ; 7 print string at address W* (like a subroutine call / macro for printstrings; see also 26,28) ; 8 left ; 9 right ; 10 up ; 11 down ; 12 home (to top left of bounds rectangle) ; 13 carriage return (move to start of next line in bounds rectangle) ; 14 repeat N* ; 15 endrepeat ; 16 ink N* ; 17 paper N* ; 18 flash N* ; 19 bright N* ; 20 attribute N* ; 21 invalidate N* ; 22 AT y(N*),x(N*) (relative to bounds rectangle) ; 23 AT dy(N*), dx(N*) (relative to current position in bounds rectangle) ; 24 xwrap N* ; 25 yinc N* ; 26 push state ; 27 escape, next char is literal not special code ; 28 pop state ; 29 transparent char ; 30 logically OR into attribute mask N* ; 31 visit : call function pointed at by ix with current struct_sp1_update as parameter ; ; * N is a single byte parameter following the code. ; * W is a 16-bit parameter following the code. ; ; All printing is done within a bounds rectangle. No printing outside this ; bounds rectangle will occur. ; ; enter: HL = address of string to print ; E = flags (bit 0 = invalidate?, bit 1 = xwrap?, bit 2 = yinc?, bit3 = ywrap?) ; B = current x coordinate (relative to bounds rect IY) ; C = current y coordinate (relative to bounds rect IY) ; ( HL' = & tail struct sp1_update.ulist in invalidated list ) loaded here, not entry condition ; DE' = current struct sp1_update * ; B' = current attribute mask ; C' = current colour ; IX = visit function ; IY+0 = row coordinate \ ; IY+1 = col coordinate | Bounds Rectangle ; IY+2 = width in chars | Must Fit On Screen ; IY+3 = height in chars / ; exit : same as enter ; uses : all except ix, iy ; ; The C API maintains a structure to retain the print state between calls. ; Doing something similar from assembly language may be helpful. .SP1PrintString exx ld hl,(SP1V_UPDATELISTT) ld a,6 add a,l ld l,a jp nc, noinc0 inc h .noinc0 exx .psloop ld a,(hl) or a jr z, alldone inc hl cp 32 jp nc, printable ; here we have a special code [1,31] push hl ld d,a add a,a ; get address of handler from jump table ld h,jumptbl/256 add a,jumptbl%256 ld l,a jp nc, nospill inc h .nospill ld a,(hl) inc hl ld h,(hl) ld l,a ld a,d ; restore A to code ex (sp),hl ret .alldone exx ld (hl),0 ld a,-6 add a,l ld l,a ld a,$ff adc a,h ld h,a ld (SP1V_UPDATELISTT),hl exx ret .jumptbl defw printable, codeAMaskAND, codeGotoY, codeYWrap defw codeAMask, codeTC, codeGotoX, codePString defw codeLeft, codeRight, codeUp, codeDown defw codeHome, codeReturn, codeRepeat, codeEndRepeat defw codeInk, codePaper, codeFlash, codeBright defw codeAttribute, codeInvalidate, codeAt, codeAtRel defw codeXWrap, codeYInc, codePush, codeEscape defw codePop, codeTransparent, codeAMaskOR, codeVisit .codeVisit ld a,b ; only visit if inbounds cp (iy+2) jp nc, psloop ld a,c cp (iy+3) jp nc, psloop push bc push de push hl exx push bc push hl push de ex de,hl call l_jpix pop de pop hl pop bc exx pop hl pop de pop bc jp psloop .codeYWrap ld a,(hl) ; parameter following YWRAP (0/1) inc hl rra jp nc, noywrap set 3,e jp psloop .noywrap res 3,e jp psloop .codeEscape ld a,(hl) ; char following ESCAPE inc hl jp printable .codePop exx pop de pop bc exx pop de pop bc jp psloop .codePush push bc push de exx push bc push de exx jp psloop .codeYInc ld a,(hl) ; parameter following YINC (0/1) inc hl rra jp nc, noywrap5 set 2,e jp psloop .noywrap5 res 2,e jp psloop .codeXWrap ld a,(hl) ; parameter following XWRAP (0/1) inc hl rra jp nc, noxwrap set 1,e jp psloop .noxwrap res 1,e jp psloop .codeAtRel ld a,(hl) add a,c ld c,a inc hl ld a,(hl) add a,b ld b,a inc hl jp computenewupdate .codeAt ld c,(hl) inc hl ld b,(hl) inc hl jp computenewupdate .codeGotoX ld b,(hl) inc hl jp computenewupdate .codeGotoY ld c,(hl) inc hl jp computenewupdate .codeAMaskAND ld a,(hl) inc hl exx and b ld b,a exx jp psloop .codeAMaskOR ld a,(hl) inc hl exx or b ld b,a exx jp psloop .codePString ld a,(hl) inc hl ld d,(hl) inc hl push hl ld h,d ld l,a call psloop pop hl ; exx ; ld a,6 ; add a,l ; ld l,a ; jp nc, noinc5 ; inc h ;.noinc5 ; exx jp psloop .codeInvalidate ld a,(hl) ; parameter following INVALIDATE (0/1) inc hl srl e rra rl e jp psloop .codeAttribute ld a,(hl) ; parameter following ATTRIBUTE inc hl exx ld c,a exx jp psloop .codeBright ld a,(hl) ; parameter following BRIGHT (0/1) inc hl exx rra jp nc,nobright set 6,c exx jp psloop .nobright res 6,c exx jp psloop .codeFlash ld a,(hl) ; parameter following FLASH (0/1) inc hl exx rl c rra rr c exx jp psloop .codePaper ld a,(hl) ; parameter following PAPER (0-7) inc hl rla rla rla and $38 ; move paper to bits 5:3 exx ex af,af' ld a,c ; get current attribute and $c7 ; throw away current paper colour ld c,a ex af,af' ; get new paper colour or c ld c,a ; set new attribute exx jp psloop .codeInk ld a,(hl) ; parameter following INK (0-7) and $07 inc hl exx ex af,af' ; save ink colour ld a,c ; get current attribute and $f8 ; clear current ink ld c,a ex af,af' ; get new ink colour or c ld c,a ; set new ink colour exx jp psloop .codeHome ld bc,0 jp computenewupdate .codeReturn ld b,0 inc c jp computenewupdate .codeRepeat ld a,(hl) ; # times to repeat inc hl .reploop push hl ; save string position at start of repeat block push af ; save # remaining iterations call psloop ; returns after endrepeat or 0 terminator pop af dec a ; any more iterations? jr z, nomoreiter pop hl ; restore string pointer for next repeat jp reploop .nomoreiter pop af ; trash saved string position jp psloop .codeEndRepeat ret .codeAMask ld a,(hl) inc hl exx ld b,a exx jp psloop .codeTC ; a 16 bit tile code follows ; first check if in bounds ld a,b cp (iy+2) jr nc, codeRight2 ld a,c cp (iy+3) jr nc, codeRight2 ; are we invalidating? bit 0,e exx jr z, noinvalidation2 ; invalidate the char ld a,(de) xor $80 jp p, noinvalidation2 ; if already invalidated, skip ld (de),a ld (hl),d inc hl ld (hl),e ld hl,6 add hl,de .noinvalidation2 ex de,hl inc hl ld a,b and (hl) ; do attr mask or c ld (hl),a ; store bgnd colour inc hl exx ld a,(hl) inc hl push hl ld h,(hl) ld l,a ex (sp),hl inc hl exx ex de,hl ex (sp),hl ex de,hl ld (hl),e ; store tile inc hl ld (hl),d pop de ; advance to next char on right dec hl dec hl dec hl ex de,hl exx jp codeRight .codeRight2 inc hl inc hl jp codeRight .codeTransparent ; are we invalidating? bit 0,e jp z, codeRight ; invalidate the char exx ld a,(de) xor $80 jp p, noinvalidation20 ; if already invalidated, skip ld (de),a ld (hl),d inc hl ld (hl),e ld hl,6 add hl,de .noinvalidation20 exx jp codeRight .printable ; a = tile# ex af,af ; first check if in bounds ld a,b cp (iy+2) jr nc, codeRight ld a,c cp (iy+3) jr nc, codeRight ; are we invalidating? bit 0,e exx jr z, noinvalidation ; invalidate the char ld a,(de) xor $80 jp p, noinvalidation ; if already invalidated, skip ld (de),a ld (hl),d inc hl ld (hl),e ld hl,6 add hl,de .noinvalidation ex de,hl inc hl ld a,b and (hl) ; do attr mask or c ld (hl),a ; store bgnd colour inc hl ex af,af ld (hl),a ; store tile inc hl ld (hl),0 ; advance to next char on right dec hl dec hl dec hl ex de,hl exx .codeRight inc b ; increase x coord bit 1,e ; are we doing x wrap? jr nz, yesxwrap .inxbounds exx ; move update struct to right ld a,10 add a,e ld e,a jp nc, noinc1 inc d .noinc1 exx jp psloop .yesxwrap ld a,b cp (iy+2) jr c, inxbounds ld b,0 bit 2,e ; are we doing yinc? jr z, noyinc inc c bit 3,e ; are we doing ywrap? jr z, noyinc ld a,c cp (iy+3) jr c, noyinc ld c,0 .noyinc .computenewupdate ; need to compute struct sp1_update for new coords push bc exx ex (sp),hl ld a,(iy+0) add a,l ld d,a ld a,(iy+1) add a,h ld e,a call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ex de,hl pop hl exx jp psloop .codeLeft dec b bit 1,e jr nz, yesxwrap2 .inxbounds2 exx ld a,-10 add a,e ld e,a ld a,$ff adc a,d ld d,a exx jp psloop .yesxwrap2 ld a,b cp (iy+2) jr c, inxbounds2 ld b,(iy+2) dec b bit 2,e jr z, computenewupdate dec c bit 3,e jr z, computenewupdate ld a,c cp (iy+3) jr c, computenewupdate ld c,(iy+3) dec c jp computenewupdate .codeUp dec c bit 3,e jr nz, yesywrap .inybounds exx ld a,-SP1V_DISPWIDTH*10 add a,e ld e,a ld a,#(((SP1V_DISPWIDTH*10):$ffff)+1)/256 adc a,d ld d,a exx jp psloop .yesywrap ld a,c cp (iy+3) jr c, inybounds ld c,(iy+3) dec c jp computenewupdate .codeDown inc c bit 3,e jr nz, yesywrap2 .inybounds2 exx ld a,0+(SP1V_DISPWIDTH*10)%256 add a,e ld e,a ld a,0+(SP1V_DISPWIDTH*10)/256 adc a,d ld d,a exx jp psloop .yesywrap2 ld a,c cp (iy+3) jr c, inybounds2 ld c,0 jp computenewupdate z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/SP1PSPOP.asm0000644000175000017500000000245410763353743024741 0ustar tygrystygrys; subroutine for reading the contents of a "struct sp1_pss" into registers ; 02.2008 aralbrec ; sinclair spectrum version XLIB SP1PSPOP ; enter : de = & string to print (or something else) ; hl = & struct sp1_pss to read ; ; exit : hl = & string to print (or something else) ; e = flags ; b = current x coordinate (relative to bounds rect IY) ; c = current y coordinate (relative to bounds rect IY) ; de' = current struct sp1_update * ; b' = current attribute mask ; c' = current colour ; ix = visit function ; iy = bounds rectangle .SP1PSPOP ld a,(hl) inc hl ld iyl,a ld a,(hl) inc hl ld iyh,a ; iy = bounds rectangle ld a,(hl) ; a = flags inc hl ld b,(hl) ; b = x coordinate inc hl ld c,(hl) ; c = y coordinate inc hl push hl ex de,hl ; hl = string ld e,a ; e = flags exx pop hl ld b,(hl) ; b' = attr mask inc hl ld c,(hl) ; c' = attr inc hl ld e,(hl) inc hl ld d,(hl) ; de = & struct sp1_update inc hl ld a,(hl) ld ixl,a inc hl ld a,(hl) ld ixh,a ; ix = visit function exx ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/tiles/SP1PSPUSH.asm0000644000175000017500000000212510763353743025055 0ustar tygrystygrys; subroutine for writing registers to "struct sp1_pss" ; 02.2008 aralbrec ; sinclair spectrum version XLIB SP1PSPUSH ; enter : hl = & struct sp1_pss to write to ; e = flags ; b = current x coordinate (relative to bounds rect IY) ; c = current y coordinate (relative to bounds rect IY) ; de' = current struct sp1_update * ; b' = current attribute mask ; c' = current colour ; ix = visit function ; iy = bounds rectangle .SP1PSPUSH ld a,iyl ld (hl),a inc hl ld a,iyh ld (hl),a ; write bounds rectangle inc hl ld (hl),e ; write flags inc hl ld (hl),b ; write x coord inc hl ld (hl),c ; write y coord inc hl push hl exx pop hl ld (hl),b ; write attr mask inc hl ld (hl),c ; write attr inc hl ld (hl),e inc hl ld (hl),d ; write struct sp1_update inc hl ld a,ixl ld (hl),a inc hl ld a,ixh ld (hl),a ; write visit function ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/0000755000175000017500000000000010765202715023323 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_DrawUpdateStructAlways.asm0000644000175000017500000000106610545200146031231 0ustar tygrystygrys ; sp1_DrawUpdateStructAlways(struct sp1_update *u) ; 12.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; FASTCALL XLIB sp1_DrawUpdateStructAlways LIB SP1DrawUpdateStruct ; Draws the update struct no matter what, including ; structs removed from the engine. Validates char ; if it hasn't been removed. ; ; enter : hl = & struct sp1_update ; uses : af, bc, de, hl, ix, b' for MaskLB and MaskRB sprites .sp1_DrawUpdateStructAlways bit 6,(hl) jr nz, skipval res 7,(hl) .skipval ld a,(hl) and $3f ld b,a jp SP1DrawUpdateStruct z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_DrawUpdateStructIfInv.asm0000644000175000017500000000127010545200146031001 0ustar tygrystygrys ; sp1_DrawUpdateStructIfInv(struct sp1_update *u) ; 12.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; FASTCALL XLIB sp1_DrawUpdateStructIfInv LIB SP1DrawUpdateStruct ; Draw the char's graphics to screen but only ; if the update struct is currently invalidated ; (ie marked for draw). Also validates the char. ; ; enter : hl = & struct sp1_update ; uses : af, bc, de, hl, ix, b' for MaskLB and MaskRB sprites .sp1_DrawUpdateStructIfInv bit 6,(hl) ret nz ; do not draw if removed ld a,(hl) xor $80 ret m ; do not draw if validated ld (hl),a ; mark as validated ld b,a jp SP1DrawUpdateStruct z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_DrawUpdateStructIfNotRem.asm0000644000175000017500000000112310545200146031446 0ustar tygrystygrys ; sp1_DrawUpdateStructIfNotRem(struct sp1_update *u) ; 12.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; FASTCALL XLIB sp1_DrawUpdateStructIfNotRem LIB SP1DrawUpdateStruct ; Draw the char's graphics to screen if it hasn't ; been removed. Validates char as well. ; ; enter : hl = & struct sp1_update ; uses : af, bc, de, hl, ix, b' for MaskLB and MaskRB sprites .sp1_DrawUpdateStructIfNotRem bit 6,(hl) ret nz ; do not draw if removed ld a,(hl) and $7f ld (hl),a ; validate char ld b,a jp SP1DrawUpdateStruct z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_DrawUpdateStructIfVal.asm0000644000175000017500000000116510545200146030772 0ustar tygrystygrys ; sp1_DrawUpdateStructIfVal(struct sp1_update *u) ; 12.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version ; FASTCALL XLIB sp1_DrawUpdateStructIfVal LIB SP1DrawUpdateStruct ; draw the char's graphics to screen but only ; if the update struct is currently validated ; (not already marked for draw) ; ; enter : hl = & struct sp1_update ; uses : af, bc, de, hl, ix, b' for MaskLB and MaskRB sprites .sp1_DrawUpdateStructIfVal ld a,(hl) ld b,a and $c0 ; keep bits 7 (invalidated) and 6 (removed) ret nz ; do not draw if invalidated or removed jp SP1DrawUpdateStruct z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_GetUpdateStruct.asm0000644000175000017500000000055610557335042027704 0ustar tygrystygrys; struct sp1_update *sp1_GetUpdateStruct(uchar row, uchar col) ; CALLER linkage for function pointers XLIB sp1_GetUpdateStruct LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_GetUpdateStruct ld hl,2 add hl,sp ld e,(hl) inc hl inc hl ld d,(hl) jp sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_GetUpdateStruct_callee.asm0000644000175000017500000000556310757133754031224 0ustar tygrystygrys; struct sp1_update __CALLEE__ *sp1_GetUpdateStruct_callee(uchar row, uchar col) ; 01.2008 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version INCLUDE "spectrum/customize.asm" XLIB sp1_GetUpdateStruct_callee XDEF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_GetUpdateStruct_callee pop hl pop de ex (sp),hl ld d,l .asmentry ; Return struct_sp1_update for row,col coordinate given ; 9 * (SP1V_DISPWIDTH * ROW + COL) + SP1V_UPDATEARRAY ; ; enter : d = row coord ; e = col coord ; exit : hl = struct update * ; uses : af, de, hl .SP1GetUpdateStruct ld l,d ld h,0 ld a,d ld d,h cp SP1V_DISPHEIGHT jp c, nohtadj dec h .nohtadj IF SP1V_DISPWIDTH=16 add hl,hl add hl,hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de ; hl = 16 * ROW + COL ENDIF IF SP1V_DISPWIDTH=24 add hl,hl add hl,hl add hl,hl push hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de ; hl = 24 * ROW + COL ENDIF IF SP1V_DISPWIDTH=32 add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de ; hl = 32 * ROW + COL ENDIF IF SP1V_DISPWIDTH=40 add hl,hl add hl,hl add hl,hl push hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de ; hl = 40 * ROW + COL ENDIF IF SP1V_DISPWIDTH=48 add hl,hl add hl,hl add hl,hl add hl,hl push hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de ; hl = 48 * ROW + COL ENDIF IF SP1V_DISPWIDTH=56 add hl,hl add hl,hl add hl,hl push hl add hl,hl push hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de pop de add hl,de ; hl = 56 * ROW + COL ENDIF IF SP1V_DISPWIDTH=64 add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de ; hl = 64 * ROW + COL ENDIF add hl,hl ld d,h ld e,l add hl,hl add hl,hl add hl,de ; hl = 10 * (SP1V_DISPWIDTH * ROW + COL) ld de,SP1V_UPDATEARRAY add hl,de ret DEFC ASMDISP_SP1_GETUPDATESTRUCT_CALLEE = asmentry - sp1_GetUpdateStruct_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_Initialize.asm0000644000175000017500000000047510624242400026704 0ustar tygrystygrys; CALLER linkage for function pointers XLIB sp1_Initialize LIB sp1_Initialize_callee XREF ASMDISP_SP1_INITIALIZE_CALLEE .sp1_Initialize ld hl,6 add hl,sp ld a,(hl) dec hl dec hl ld d,(hl) dec hl dec hl ld e,(hl) ex de,hl jp sp1_Initialize_callee + ASMDISP_SP1_INITIALIZE_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_Initialize_callee.asm0000644000175000017500000001041710760516407030222 0ustar tygrystygrys; void __CALLEE__ sp1_Initialize_callee(uchar iflag, uchar colour, uchar tile) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version INCLUDE "spectrum/customize.asm" XLIB sp1_Initialize_callee XDEF ASMDISP_SP1_INITIALIZE_CALLEE XDEF SP1V_DISPORIGX XDEF SP1V_DISPORIGY XDEF SP1V_DISPWIDTH XDEF SP1V_DISPHEIGHT XDEF SP1V_PIXELBUFFER XDEF SP1V_ATTRBUFFER XDEF SP1V_TILEARRAY XDEF SP1V_UPDATEARRAY XDEF SP1V_ROTTBL XDEF SP1V_UPDATELISTH XDEF SP1V_UPDATELISTT .sp1_Initialize_callee pop bc pop hl pop de ld h,e pop de ld a,e push bc .asmentry ; 1. Constructs the rotation table if SP1_IFLAG_MAKE_ROTTBL flag set ; 2. Initializes tile array so that ROM character set is used by ; default - if SP1_IFLAG_OVERWRITE_TILES flag is set will not alter ; graphic pointers for character codes set previously (any non-zero ; pointer is not touched) ; 3. Resets the invalidated list to empty ; 4. Resets the update array, generating display file addresses for ; each char square if SP1_IFLAG_OVERWRITE_DFILE flag is set ; ; enter : hl= startup background tile ; a = flag, bit 0 = 1 if rotation table needed, bit 1 = 1 to overwrite all tile defs ; bit 2 = 1 to overwrite screen addresses in update structs ; used : af, bc, de, hl, af' .SP1Initialize push hl ; save h = attr, l = tile bit 0,a jr z, norottbl ; if flag bit not set, do not construct rotation table ; construct the rotation table ld c,7 ; rotate by c bits push af .rottbllp ld a,c add a,a or SP1V_ROTTBL/256 ld h,a ld l,0 .entrylp ld b,c ld e,l xor a .rotlp srl e rra djnz rotlp ld (hl),e inc h ld (hl),a dec h inc l jp nz, entrylp dec c jp nz, rottbllp pop af .norottbl ; initialize tile array to point to characters in ROM ld hl,SP1V_TILEARRAY ld de,15360 ld b,0 ld c,a .tileloop ld a,(hl) ; if a tile address is already present (ie non-zero entry) inc h ; then we will skip it bit 1,c jr nz, overwrite ; unless overwrite flag set or (hl) jr nz, tilepresent .overwrite ld (hl),d dec h ld (hl),e inc h .tilepresent dec h inc hl ld a,8 add a,e ld e,a ld a,0 adc a,d ld d,a djnz tileloop ; init the invalidated list ld hl,SP1V_UPDATELISTH ; this variable points at a dummy struct sp1_update that is ld (SP1V_UPDATELISTT),hl ld hl,0 ld (SP1V_UPDATELISTH+6),hl ; nothing in invalidate list ; initialize the update array pop de ; d = attr, e = tile ld b,SP1V_DISPORIGY ; b = current row coord ld hl,SP1V_UPDATEARRAY ; hl = current struct sp1_update bit 2,c ex af,af .rowloop ld c,SP1V_DISPORIGX ; c = current col coord .colloop ld (hl),1 ; # of occluding sprites in this tile + 1 inc hl ld (hl),d ; write tile colour inc hl ld (hl),e ; write tile code inc hl ld (hl),0 inc hl ld (hl),0 ; no sprites in the tile inc hl ld (hl),0 inc hl ld (hl),0 ; not in invalidated list inc hl ld (hl),0 inc hl ex af,af jr z, skipscrnaddr ex af,af ld a,b ; compute screen address for char coord (b,c) rrca ; and store in struct sp1_update rrca rrca and $e0 ; screen address : 010B BSSS LLLC CCCC or c ; y coord (b) : 000B BLLL ld (hl),a ; x coord (c) : 000C CCCC inc hl ld a,b and $18 or $40 ld (hl),a .rejoinscrnaddr inc hl ; hl points at next struct sp1_update inc c ; next column ld a,c cp SP1V_DISPORIGX + SP1V_DISPWIDTH jr c, colloop inc b ; next row ld a,b cp SP1V_DISPORIGY + SP1V_DISPHEIGHT jr c, rowloop ret .skipscrnaddr ex af,af inc hl jp rejoinscrnaddr DEFC ASMDISP_SP1_INITIALIZE_CALLEE = asmentry - sp1_Initialize_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_Invalidate.asm0000644000175000017500000000436310756777212026707 0ustar tygrystygrys; void __FASTCALL__ sp1_Invalidate(struct sp1_Rect *r) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_Invalidate XDEF ASMDISP_SP1_INVALIDATE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH, SP1V_UPDATELISTT .sp1_Invalidate ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) .asmentry ; Invalidate a rectangular area so the tiles are drawn in the next update. ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; uses : af, bc, de, hl .SP1Invalidate call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ex de,hl ; de = & struct sp1_update ld hl,(SP1V_UPDATELISTT) ld a,6 add a,l ld l,a jp nc, rowlp inc h ; hl = last struct sp1_update+6 in invalidated list .rowlp push bc ; save b = width, c = height push de ; save first struct sp1_update in row ; hl = last struct sp1_update + 6 in invalidated list ; de = current struct sp1_update to invalidate .collp ld a,(de) xor $80 jp p, alreadyinlist ; if already invalidated skip it ld (de),a ; mark as invalidated ld (hl),d ; store this struct sp1_update at tail end of invalidated list inc hl ld (hl),e ld hl,6 add hl,de ; hl = new last struct sp1_update+6 in invalidated list .alreadyinlist ld a,10 add a,e ld e,a jp nc, noinc inc d .noinc ; de = struct sp1_update to invalidate in next column djnz collp pop de ; de = first struct sp1_update in row ex de,hl ld bc,10*SP1V_DISPWIDTH add hl,bc ex de,hl ; de = first struct sp1_update in next row, hl = last+6 in invalidated list pop bc ; b = width, c = height dec c jp nz, rowlp ld (hl),0 ; mark end of invalidated list ld bc,-6 add hl,bc ; point to start of struct sp1_update ld (SP1V_UPDATELISTT),hl ; and store as last in invalidated list ret DEFC ASMDISP_SP1_INVALIDATE = asmentry - sp1_Invalidate z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_InvUpdateStruct.asm0000644000175000017500000000166710545177715027735 0ustar tygrystygrys ; sp1_InvUpdateStruct ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_InvUpdateStruct XREF SP1V_UPDATELISTT ; FASTCALL ; Add struct_sp1_update to invalidated list so that it is ; drawn at next update. ; ; enter : hl = & struct sp1_update ; uses : af, bc, de, hl .sp1_InvUpdateStruct ld a,$80 xor (hl) ; bit 7 of (hl) = 1 if already invalidated ret p ; return if update struct already invalidated ld (hl),a ; mark it as invalidated ex de,hl ; de = struct sp1_update needing invalidation ld hl,(SP1V_UPDATELISTT) ; last struct sp_update in invalidated list ld bc,6 add hl,bc ld (hl),d inc hl ld (hl),e ; store link to new one being invalidated ex de,hl ld (SP1V_UPDATELISTT),hl ; new one becomes last in list add hl,bc ld (hl),0 ; no next after this one in list ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_IterateUpdateArr.asm0000644000175000017500000000055310557335042030017 0ustar tygrystygrys; void sp1_IterateUpdateArr(struct sp1_update **ua, void *hook) ; CALLER linkage for function pointers XLIB sp1_IterateUpdateArr LIB sp1_IterateUpdateArr_callee XREF ASMDISP_SP1_ITERATEUPDATEARR_CALLEE .sp1_IterateUpdateArr pop bc pop ix pop hl push hl push hl push bc jp sp1_IterateUpdateArr_callee + ASMDISP_SP1_ITERATEUPDATEARR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_IterateUpdateArr_callee.asm0000644000175000017500000000203610577177144031333 0ustar tygrystygrys; void __CALLEE__ sp1_IterateUpdateArr_callee(struct sp1_update **ua, void *hook) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_IterateUpdateArr_callee XDEF ASMDISP_SP1_ITERATEUPDATEARR_CALLEE LIB l_jpix .sp1_IterateUpdateArr_callee pop hl pop ix ex (sp),hl .asmentry ; Iterate over an array of struct_sp1_update*, calling the supplied function ; with each of the struct_sp1_update* as parameter. The array must be zero ; terminated. ; ; enter : hl = zero terminated array of struct sp1_update * ; ix = function to call for each stuct sp1_update in array (stack, hl = parameter) ; uses : af, de, hl + whatever user function uses .SP1IterateUpdateArr ld e,(hl) inc hl ld d,(hl) ; de = struct sp1_update * ld a,d or e ret z inc hl push hl push de ex de,hl call l_jpix ; call function with hl = struct sp1_update * pop de pop hl jp SP1IterateUpdateArr DEFC ASMDISP_SP1_ITERATEUPDATEARR_CALLEE = asmentry - sp1_IterateUpdateArr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_IterateUpdateRect.asm0000644000175000017500000000055210557335043030170 0ustar tygrystygrys; void sp1_IterateUpdateRect(struct sp1_Rect *r, void *hook) ; CALLER linkage for function pointers XLIB sp1_IterateUpdateRect LIB sp1_IterateUpdateRect_callee XREF CDISP_SP1_ITERATEUPDATERECT_CALLEE .sp1_IterateUpdateRect pop bc pop ix pop hl push hl push hl push bc jp sp1_IterateUpdateRect_callee + CDISP_SP1_ITERATEUPDATERECT_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_IterateUpdateRect_callee.asm0000644000175000017500000000325510577177144031510 0ustar tygrystygrys; void __CALLEE__ sp1_IterateUpdateRect_callee(struct sp1_Rect *r, void *hook) ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_IterateUpdateRect_callee XDEF ASMDISP_SP1_ITERATEUPDATERECT_CALLEE, CDISP_SP1_ITERATEUPDATERECT_CALLEE LIB sp1_GetUpdateStruct_callee, l_jpix XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH .sp1_IterateUpdateRect_callee pop hl pop ix ex (sp),hl .centry ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) .asmentry ; Iterate over all the struct_sp1_update making up ; a rectangular area in row major order. Call a ; user supplied function with each struct_sp1_update ; iterated as parameter. ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; ix = void (*func)(struct sp1_update*), hl also holds parameter ; uses : af, bc, de, hl (de can be used by user function to hold state between calls) .SP1IterateUpdateRect call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update .rowloop push bc push hl ; save update position .colloop push bc push hl call l_jpix pop hl ld bc,10 add hl,bc pop bc djnz colloop pop hl ; hl = & struct sp1_update same row leftmost column ld bc,10*SP1V_DISPWIDTH add hl,bc ; hl = & struct sp1_update next row leftmost column pop bc dec c ; c = height jp nz, rowloop ret DEFC ASMDISP_SP1_ITERATEUPDATERECT_CALLEE = asmentry - sp1_IterateUpdateRect_callee DEFC CDISP_SP1_ITERATEUPDATERECT_CALLEE = centry - sp1_IterateUpdateRect_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_RemoveUpdateStruct.asm0000644000175000017500000000235310545177715030427 0ustar tygrystygrys ; sp1_RemoveUpdateStruct ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_RemoveUpdateStruct ; FASTCALL ; Removes the character cell represented by the struct_sp1_update ; passed in so that the sprite engine will not draw the cell. ; Sprites will not be entered into the internal representation of ; the cell but tiles can continue to be printed to it. ; ; enter : hl = & struct sp1_update ; uses : af, de, hl .sp1_RemoveUpdateStruct ld (hl),$c1 ; invalidated & removed, # occluding sprites + 1 = 1 inc hl inc hl inc hl inc hl ; hl = sprite list ld a,(hl) ld (hl),0 ; mark no sprites in this update struct inc hl ld l,(hl) ; al = & struct sp1_cs of first sprite in this update char or a ; if no sprites, done ret z ld h,a ; hl = & struct sp1_cs.attr_mask .loop ld de,-4 add hl,de ; hl = & struct sp1_cs.update ld (hl),0 ; this sprite char belongs to no update structs ld de,18 add hl,de ; hl = & struct sp1_cs.next_in_upd ld a,(hl) or a ret z inc hl ld l,(hl) ld h,a ; hl = & next struct sp1_cs.attr_mask jp loop z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_RestoreUpdateStruct.asm0000644000175000017500000000100510545177715030606 0ustar tygrystygrys ; sp1_RestoreUpdateStruct ; 04.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_RestoreUpdateStruct ; FASTCALL ; Restores a character cell previously removed from ; the sprite engine so that it will again be drawn ; by the engine. Restored cell is not invalidated. ; ; enter : hl = & struct sp1_update ; uses : f .sp1_RestoreUpdateStruct bit 6,(hl) ret z ; this cell was never removed so just return ld (hl),1 ; clear invalidated + removed flags ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_UpdateNow.asm0000644000175000017500000000335110545200146026510 0ustar tygrystygrys ; sp1_UpdateNow ; 01.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_UpdateNow LIB SP1DrawUpdateStruct XREF SP1V_UPDATELISTH, SP1V_UPDATELISTT ; Iterates through the invalidated tiles list, drawing all invalidated tiles on screen. ; Validates them and removes them from the list along the way. ; ; enter : none ; uses : af, bc, de, hl, ix, b' for MaskLB and MaskRB sprites .sp1_UpdateNow ld hl,(SP1V_UPDATELISTH+6) ; get the first struct update char to draw ld a,l ld l,h ld h,a ; correct endianness or a jp nz, updatelp ret ; if empty update list .skipthischar ld bc,6 add hl,bc ; hl = & struct update.next_update ld a,(hl) or a jr z, doneupdate ; return if no next struct update inc hl ld l,(hl) ld h,a ; hl = next struct update .updatelp bit 6,(hl) ; if this update char has been removed from the display skip it jr nz, skipthischar ld a,$80 xor (hl) ; (hl) = # load sprites, bit 7 set for marked to update jp m, skipthischar ; if bit 7 was reset (now set), this char was validated so skip it ld (hl),a ; mark char as not needing update (bit 7 is reset) ld b,a ; b = # of occluding sprites in this char + 1 ; b = # occluding sprites in char + 1 ; hl = & struct sp1_update call SP1DrawUpdateStruct ; bc = & next sp1_update in update list ld l,c ld h,b inc b ; go to next char to update (more if b!=0) djnz updatelp .doneupdate xor a ld (SP1V_UPDATELISTH+6),a ; mark update list empty ld hl,SP1V_UPDATELISTH ld (SP1V_UPDATELISTT),hl ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_Validate.asm0000644000175000017500000000303610557335043026343 0ustar tygrystygrys; void __FASTCALL__ sp1_Validate(struct sp1_Rect *r) ; 02.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_Validate XDEF ASMDISP_SP1_VALIDATE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH .sp1_Validate ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) .asmentry ; Validate a rectangular area, ensuring the area is not drawn ; in next update. Make sure that none of the validated area ; is invalidated by further calls before the next update otherwise ; areas of the screen may become inactive (ie are never drawn). ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; uses : f, bc, de, hl .SP1Validate call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update ld de,10 .rowloop push bc ; save b = width push hl ; save update position .colloop bit 6,(hl) ; has this update char been removed from the display? jr nz, skipit ; if so we must not validate it res 7,(hl) ; validate update char .skipit add hl,de djnz colloop pop hl ; hl = & struct sp1_update same row leftmost column ld bc,10*SP1V_DISPWIDTH add hl,bc ; hl = & struct sp1_update next row leftmost column pop bc dec c ; c = height jp nz, rowloop ret DEFC ASMDISP_SP1_VALIDATE = asmentry - sp1_Validate z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/sp1_ValUpdateStruct.asm0000644000175000017500000000105010545177715027705 0ustar tygrystygrys ; sp1_ValUpdateStruct ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_ValUpdateStruct ; FASTCALL ; Validate struct_sp1_update so that it is not drawn in ; the next update. You must make sure that this tile is ; not invalidated by any call before the next update or ; portions of the screen may become inactive (ie will never ; be drawn during update). ; ; enter : HL = & struct sp1_update ; uses : none .sp1_ValUpdateStruct bit 6,(hl) ; must not validate removed update chars ret nz res 7,(hl) ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum/updater/SP1DrawUpdateStruct.asm0000644000175000017500000001432410557335132027621 0ustar tygrystygrys; SP1DrawUpdateStruct ; 12.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB SP1DrawUpdateStruct XDEF SP1RETSPRDRAW XREF SP1V_ATTRBUFFER, SP1V_PIXELBUFFER, SP1V_TILEARRAY ; Draw the tile described by the indicated update struct ; to screen -- not meant to be called directly, just a ; code fragment called from other functions. ; ; enter : b = # occluding sprites in char + 1 ; hl = & struct sp1_update ; exit : bc = & next sp1_update in update list .haveocclspr ; there are occluding sprites in this char ; b = # occl sprites ; de = 16-bit tile code ; hl = & update.slist inc hl push hl dec hl push de jp skiplp .skipthisone ; don't need to draw this sprite ld hl,15 add hl,de ; stack = & update.slist + 1b, 16-bit tile code .skiplp ld d,(hl) inc hl ld e,(hl) ; de = & sp1_cs.attr_mask dec de ; de = & sp1_cs.type ld a,(de) rla ; is this an occluding sprite? jr nc, skipthisone ; if no skip it djnz skipthisone ; if haven't seen all occl sprites yet, skip this one too ; de = & sp1_cs.type ; a = sprite type rotated left one bit ; stack = & update.slist + 1b, 16-bit tile code and $20 ; type has been rot left one bit, check orig bit 4 if should clear pixel buff pop hl ; hl = 16-bit tile code jr z, noclearbuff ; clear pixel buffer ; de = & sp1_cs.type ; hl = 16-bit tile code ; stack = & update.slist + 1b ld a,h or a jr nz, havetiledef2 ; if MSB of tile code != 0 we have & tile definition already ld h,SP1V_TILEARRAY/256 ld a,(hl) inc h ld h,(hl) ld l,a ; hl = & tile definition .havetiledef2 push de ld de,SP1V_PIXELBUFFER ldi ; copy background tile graphics into pixel buffer ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a pop de .noclearbuff ; de = & sp1_cs.type ; stack = & update.slist + 1b ex de,hl inc hl ; hl = & sp1_cs.attr_mask jp spritedraw .SP1DrawUpdateStruct ; b = # occluding sprites in char + 1 ; hl = & struct sp1_update inc hl ld a,(hl) ld (SP1V_ATTRBUFFER),a ; write background colour to buffer inc hl ; hl = & update.tile ld e,(hl) inc hl ld d,(hl) inc hl djnz haveocclspr ; deal with case of occluding sprites ex de,hl ; hl = 16-bit tile code, de = & update.slist ld a,h or a jr nz, havetiledef ; if MSB of tile code != 0 we have & tile definition already ld h,SP1V_TILEARRAY/256 ld a,(hl) inc h ld h,(hl) ld l,a ; hl = & tile definition ; de = & update.slist .havetiledef ld a,(de) or a jr z, drawtileonly ; if there are no sprites in this char, just draw background tile push de ; save & update.slist ld de,SP1V_PIXELBUFFER ldi ; copy background tile graphics into pixel buffer ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a pop hl ; hl = & update.slist ld a,(hl) inc hl push hl ; save & update.slist + 1b .spritedrawlp ; hl = & sp1_cs.next_in_upd + 1b ; a = MSB of next sp1_cs.attr_mask ld l,(hl) ld h,a ; hl = & sp1_cs.attr_mask .spritedraw ; hl = & sp1_cs.attr_mask ; stack = & update.slist + 1b ld a,(SP1V_ATTRBUFFER) ; get current char colour and (hl) ; apply sprite's colour mask inc hl or (hl) ; apply sprite's colour inc hl ; hl = & sp1_cs.ss_draw ld (SP1V_ATTRBUFFER),a ; write back as current colour ld e,(hl) inc hl ld d,(hl) inc hl ex de,hl ; de = & sp1_cs.draw_code, hl = & sp1_ss.draw_code jp (hl) ; jump into sp1_ss's draw code .drawtileonly ; hl = & tile definition ; de = & update.slist ex de,hl inc hl inc hl ld b,(hl) inc hl ld c,(hl) ; bc = & next sp1_update in update list inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = screen address for char ; de = tile definition ld a,(de) ; copy tile directly to screen ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a ; jp rejoin ; inlined instead -- did you know this ten-cycle ; instruction executed 100 times adds up to 1000 cycles! ld a,h ; compute attribute addr from pixel addr xor $85 rrca rrca rrca ld h,a ld a,(SP1V_ATTRBUFFER) ld (hl),a ; write colour to screen ; bc = & next sp1_update in update list ret .SP1RETSPRDRAW ; return here after sprite char drawn pop hl ; hl = & sp1_cs.next_in_upd (pushed by sprite draw code) ld a,(hl) inc hl or a jr nz, spritedrawlp ; if there are more sprites in this char go draw them pop hl ; hl = & update.slist + 1b .donesprites inc hl ld b,(hl) inc hl ld c,(hl) ; bc = & next sp1_update in update list inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = screen address for this char cell ld de,(SP1V_PIXELBUFFER+0) ; copy final graphic in pixel buffer to screen ld (hl),e inc h ld (hl),d inc h ld de,(SP1V_PIXELBUFFER+2) ld (hl),e inc h ld (hl),d inc h ld de,(SP1V_PIXELBUFFER+4) ld (hl),e inc h ld (hl),d inc h ld de,(SP1V_PIXELBUFFER+6) ld (hl),e inc h ld (hl),d .rejoin ld a,h ; compute attribute addr from pixel addr xor $85 rrca rrca rrca ld h,a ld a,(SP1V_ATTRBUFFER) ld (hl),a ; write colour to screen ; bc = & next sp1_update in update list ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/spectrum.lst0000644000175000017500000001010610763607734022411 0ustar tygrystygrysspectrum/sprites/_sp1_struct_cs_prototype spectrum/sprites/_sp1_struct_ss_prototype spectrum/sprites/sp1_AddColSpr spectrum/sprites/sp1_AddColSpr_callee spectrum/sprites/sp1_ChangeSprType spectrum/sprites/sp1_ChangeSprType_callee spectrum/sprites/sp1_CreateSpr spectrum/sprites/sp1_CreateSpr_callee spectrum/sprites/sp1_DeleteSpr spectrum/sprites/sp1_GetSprClr spectrum/sprites/sp1_GetSprClr_callee spectrum/sprites/sp1_GetSprClrAddr spectrum/sprites/sp1_GetSprClrAddr_callee spectrum/sprites/sp1_InitCharStruct spectrum/sprites/sp1_InitCharStruct_callee spectrum/sprites/sp1_InsertCharStruct spectrum/sprites/sp1_InsertCharStruct_callee spectrum/sprites/sp1_IterateSprChar spectrum/sprites/sp1_IterateSprChar_callee spectrum/sprites/sp1_IterateUpdateSpr spectrum/sprites/sp1_IterateUpdateSpr_callee spectrum/sprites/sp1_MoveSprAbs spectrum/sprites/sp1_MoveSprAbs_callee spectrum/sprites/sp1_MoveSprPix spectrum/sprites/sp1_MoveSprPix_callee spectrum/sprites/sp1_MoveSprRel spectrum/sprites/sp1_MoveSprRel_callee spectrum/sprites/sp1_PreShiftSpr spectrum/sprites/sp1_PreShiftSpr_callee spectrum/sprites/sp1_PutSprClr spectrum/sprites/sp1_PutSprClr_callee spectrum/sprites/sp1_RemoveCharStruct spectrum/sprites/SP1AddSprChar spectrum/sprites/SP1RemoveSprChar spectrum/sprites/draw/SP1_DRAW_ATTR spectrum/sprites/draw/SP1_DRAW_LOAD1 spectrum/sprites/draw/SP1_DRAW_LOAD1LB spectrum/sprites/draw/SP1_DRAW_LOAD1LBIM spectrum/sprites/draw/SP1_DRAW_LOAD1NR spectrum/sprites/draw/SP1_DRAW_LOAD1RB spectrum/sprites/draw/SP1_DRAW_LOAD1RBIM spectrum/sprites/draw/SP1_DRAW_LOAD2 spectrum/sprites/draw/SP1_DRAW_LOAD2LB spectrum/sprites/draw/SP1_DRAW_LOAD2LBIM spectrum/sprites/draw/SP1_DRAW_LOAD2NR spectrum/sprites/draw/SP1_DRAW_LOAD2RB spectrum/sprites/draw/SP1_DRAW_LOAD2RBIM spectrum/sprites/draw/SP1_DRAW_MASK2 spectrum/sprites/draw/SP1_DRAW_MASK2LB spectrum/sprites/draw/SP1_DRAW_MASK2NR spectrum/sprites/draw/SP1_DRAW_MASK2RB spectrum/sprites/draw/SP1_DRAW_OR1 spectrum/sprites/draw/SP1_DRAW_OR1LB spectrum/sprites/draw/SP1_DRAW_OR1NR spectrum/sprites/draw/SP1_DRAW_OR1RB spectrum/sprites/draw/SP1_DRAW_OR2 spectrum/sprites/draw/SP1_DRAW_OR2LB spectrum/sprites/draw/SP1_DRAW_OR2NR spectrum/sprites/draw/SP1_DRAW_OR2RB spectrum/sprites/draw/SP1_DRAW_XOR1 spectrum/sprites/draw/SP1_DRAW_XOR1LB spectrum/sprites/draw/SP1_DRAW_XOR1NR spectrum/sprites/draw/SP1_DRAW_XOR1RB spectrum/sprites/draw/SP1_DRAW_XOR2 spectrum/sprites/draw/SP1_DRAW_XOR2LB spectrum/sprites/draw/SP1_DRAW_XOR2NR spectrum/sprites/draw/SP1_DRAW_XOR2RB spectrum/tiles/sp1_ClearRect spectrum/tiles/sp1_ClearRect_callee spectrum/tiles/sp1_ClearRectInv spectrum/tiles/sp1_ClearRectInv_callee spectrum/tiles/sp1_GetTiles spectrum/tiles/sp1_GetTiles_callee spectrum/tiles/sp1_PrintAt spectrum/tiles/sp1_PrintAt_callee spectrum/tiles/sp1_PrintAtInv spectrum/tiles/sp1_PrintAtInv_callee spectrum/tiles/sp1_PrintString spectrum/tiles/sp1_PrintString_callee spectrum/tiles/sp1_PutTiles spectrum/tiles/sp1_PutTiles_callee spectrum/tiles/sp1_PutTilesInv spectrum/tiles/sp1_PutTilesInv_callee spectrum/tiles/sp1_ScreenAttr spectrum/tiles/sp1_ScreenAttr_callee spectrum/tiles/sp1_ScreenStr spectrum/tiles/sp1_ScreenStr_callee spectrum/tiles/sp1_SetPrintPos spectrum/tiles/sp1_SetPrintPos_callee spectrum/tiles/sp1_TileEntry spectrum/tiles/sp1_TileEntry_callee spectrum/tiles/SP1PrintString spectrum/tiles/SP1PSPOP spectrum/tiles/SP1PSPUSH spectrum/updater/sp1_DrawUpdateStructAlways spectrum/updater/sp1_DrawUpdateStructIfInv spectrum/updater/sp1_DrawUpdateStructIfNotRem spectrum/updater/sp1_DrawUpdateStructIfVal spectrum/updater/sp1_GetUpdateStruct spectrum/updater/sp1_GetUpdateStruct_callee spectrum/updater/sp1_Initialize spectrum/updater/sp1_Initialize_callee spectrum/updater/sp1_Invalidate spectrum/updater/sp1_InvUpdateStruct spectrum/updater/sp1_IterateUpdateArr spectrum/updater/sp1_IterateUpdateArr_callee spectrum/updater/sp1_IterateUpdateRect spectrum/updater/sp1_IterateUpdateRect_callee spectrum/updater/sp1_RemoveUpdateStruct spectrum/updater/sp1_RestoreUpdateStruct spectrum/updater/sp1_UpdateNow spectrum/updater/sp1_Validate spectrum/updater/sp1_ValUpdateStruct spectrum/updater/SP1DrawUpdateStruct z88dk-1.8.ds1/libsrc/sprites/software/sp1/ticalc/0000755000175000017500000000000010765202715021254 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/0000755000175000017500000000000010765202715021315 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/customize.asm0000644000175000017500000000571510757251102024044 0ustar tygrystygrys ; CUSTOMIZATION TEMPLATE FOR SP1 ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version ; See below for Memory Map with these default settings ; /////////////////////// ; Display Characteristics ; /////////////////////// defc SP1V_DISPORIGX = 0 ; x coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPORIGY = 0 ; y coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPWIDTH = 64 ; width of area managed by sp1 in characters (16, 24, 32, 40, 48, 56, 64 ok as of now) defc SP1V_DISPHEIGHT = 24 ; height of area managed by sp1 in characters ; /////////////////////// ; Buffers ; /////////////////////// defc SP1V_PIXELBUFFER = $b9f8 ; address of an 8-byte buffer to hold intermediate pixel-draw results ; /////////////////////// ; Data Structures ; /////////////////////// defc SP1V_TILEARRAY = $f000 ; address of the 512-byte tile array associating character codes with tile graphics, must lie on 256-byte boundary (LSB=0) defc SP1V_UPDATEARRAY = $ba00 ; address of the 9*SP1V_DISPWIDTH*SP1V_DISPHEIGHT byte update array defc SP1V_ROTTBL = $f000 ; location of the 3584-byte rotation table. Must lie on 256-byte boundary (LSB=0). Table begins $0200 bytes ahead of this ; pointer ($f200-$ffff in this default case). Set to $0000 if the table is not needed (if, for example, all sprites ; are drawn at exact horizontal character coordinates or you use pre-shifted sprites only). ; /////////////////////// ; SP1 Variables ; /////////////////////// defc SP1V_UPDATELISTH = $b9ef ; address of 9-byte area holding a dummy struct_sp1_update that is always the "first" in list of screen tiles to be drawn defc SP1V_UPDATELISTT = $b9f0 ; address of 2-byte variable holding the address of the last struct_sp1_update in list of screen tiles to be drawn ; NOTE: SP1V_UPDATELISTT is located inside the dummy struct_sp1_update pointed at by SP1V_UPDATELISTH ; /////////////////////// ; DEFAULT MEMORY MAP ; /////////////////////// ; With these default settings the memory map is: ; ; ADDRESS (HEX) LIBRARY DESCRIPTION ; ; f200 - ffff SP1.LIB horizontal rotation tables ; f000 - f1ff SP1.LIB tile array ; ba00 - efff SP1.LIB update array for 64x24 display ; b9f8 - b9ff SP1.LIB pixel buffer ; b9ef - b9f7 SP1.LIB update list head - a dummy struct sp1_update acting as first in invalidated list ; * b9f0 - b9f1 SP1.LIB update list tail pointer (inside dummy struct sp1_update) ; b9bc - b9ee --free- 51 bytes free ; b9b9 - b9bb ------- JP to im2 service routine (im2 table filled with 0xb9 bytes) ; b901 - b9b8 --free- 184 bytes free ; b800 - b900 IM2.LIB im2 vector table (257 bytes) ; b600 - b7ff ------- z80 stack (512 bytes) set SP=b800 ; z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/examples/0000755000175000017500000000000010765202715023133 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/examples/ex1.c0000644000175000017500000001102410757413655024002 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #1 // 02.2008 aralbrec // // Ten software-rotated masked sprites move in straight lines // at various speeds, bouncing off screen edges. All ten // share the same sprite graphic which is not animated in // this first test program. ///////////////////////////////////////////////////////////// // zcc +ts2068 -vn ex1.c -o ex1.bin -create-app -lsp1 -lmalloc #include #include #include #include #pragma output STACKPTR=47104 // place stack at $b800 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 64, 24}; // full screen // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { // doubled the dx speed compared to spectrum {0,2,0}, {0,0,1}, {0,2,2}, {0,4,1}, {0,2,3}, // because we're traversing double the horizontal res {0,6,1}, {0,4,3}, {0,6,2}, {0,2,1}, {0,4,2} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 6000); // make available memory from 40000-45999 // Set 512x192 Video Mode memset(16384, 0, 6144); // clear both halves of the display file before switching video mode memset(24576, 0, 6144); ts_vmod(PAPER_BLACK | VMOD_HIRES); // select 64-col mode with black background // Initialize SP1.LIB sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 61) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/examples/ex1.tap0000644000175000017500000000733010757413655024351 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex1.bin B!:\s"1"!9s2͉!1Small C+ ZX̓@UUUU;!T]"S!@!p!@!!؃!`!!؃!z!! ! !d!Uͳw!96n&!94n&-!9~ ʣ!9!Y! 9n&))!a!@!!!9n& xx!9^#V!!!0!9n& !9^#V!!!!9n& !9^#V!U!! !!!!w!96n&û!94n&-!9~ o!Y!9n&))^#V!U!}~!}~! 9k###e!9k##ek~>>###!9k###ep}~}k#~=ll##!9k##ep}~}òã3xxxxxxxx|+F+N ##MD~#fo(B(0J# MD5i`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!Î##xyҝ~#fo(1^#VB0#ÝB8##+s#r#q#p#7~7xs x]Tx y q#p#ek!F!EkbKBt}@w]T!!  }w|wq p fnV#^ vʃ˶ |w#}wrs ~w #~w|(*]T^ V !~(.u t À4,7|M!!{C!G!E!Ekbwp(x@tukbqw]T!!  }w|wu t |(4tu]T^ V qq!~(.u t æ}o|g7|M@>!! go~$nGnN%o:2o~$nGnN%o:2o~$nGnN%o:2o~$nGnN%o:2o~$nGn N%o:2o~$n Gn N%o:2o~$n Gn N%o:2o~$nGnN%o:2J! [~##2~##2[~##2~##2[~##2~##2[~##2~#2J!a W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2J!J Wh{G(yg.A];s$w%," !<O~$I  r%s$%#>_>W!"!"!W6#s#6#6#6#6#6#('xWyw#x@A( w# y@8x8#àV#^#F#N*>oɈ$وr#s!> _@ Ɉ6 "Uj&zT%)))))){@T])))CUpxݾw ~IqO~ݾx| nfkuty( u t 6~~fn* FxڐҐxݖݾÉGNy v M8H0CyݖݾO 34V#^#~(I~ wr#s!6q  ƉV#^#~ ?###v(z@ äBKr#s#~#~Q4#DM!͵6#### ~y=&r#s!6&V#^#~ ####v  Òz@ ä6#### ~Ԋ=r#s!6Ý"rsfn* FxWWxݖݾ2GVNy vyݖݾZO4F#N#~ F#Ns+r###~ʈ =<r#s!6 r#s!6+~#N#DM!͵(  5z@ r#s##~<r#s!6ðV#^#~(?G#N+6#### ~,=?r#s!6vЋ! 5###?V#^#~ ####v  Yz@ G#N+6#### ~ʟ=dr#s!6dV#(^0õq+p! 6##r#s##q+p! r#s#p#q+++ r#s F##V#^6N#V#^p#q! p#qCU~G///݆_xAG~O///݆Wy^O.! ~s_$~rgk*}lg ~(#ngv >wGi`2!"#+÷! V#^0 (| &~$fo~##^#V#| &~$fo( ~~#ng^#V###F#N#~#fow$w$w$w$w$w$w$w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r}?8oUz88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/examples/ex4c.c0000644000175000017500000001470210760516341024144 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #4C // 04.2006 aralbrec // // Up to this point we have been using a single clipping // rectangle in all the sp1_MoveSpr*() calls we have been // making with little explanation of what this clipping rectangle // is for. It's exactly what you think it is -- the sprite // is drawn such that only the parts of the sprite inside // the rectangle get drawn. By using the full screen as // clipping rectangle up to this point we have been // accomplishing one important function of the clipping // rectangle and that is preventing the sprite engine from // drawing into non-existent areas of the screen. // // Now we are going to use the clipping rectangle for a // second purpose which is to control where the sprites // can appear on screen. Two new clipping rectangles are // defined and the sp1_MoveSprAbs() call in the main loop // uses clipping rectangle #1 for the first five sprites // created (the MASKed sprites) and clipping rectangle #2 // for the rest (the XOR sprites). The result is, // although the rectangles are freely moving across the // entire screen, they are only drawn when they appear // in their respective clipping rectangles. // // Clipping can only be done to character cell boundaries. // // Among applications of this, consider a vertical gate // hidden in a doorway. As the player approaches it drops // closed. If the gate is a sprite with clipping rectangle // covering the doorway only, it can appear to drop into // place by being moved from over the doorway onto the // doorway. ///////////////////////////////////////////////////////////// // zcc +ts2068 -vn ex4c.c -o ex4c.bin -create-app -lsp1 -lmalloc #include #include #include #include #pragma output STACKPTR=47104 // place stack at $b800 at startup long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 64, 24}; // full screen struct sp1_Rect clip1 = {1, 2, 24, 12}; // clip region 1 struct sp1_Rect clip2 = {10, 36, 24, 12}; // clip region 2 // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,2,0}, {0,0,1}, {0,2,2}, {0,4,1}, {0,2,3}, // double the spectrum's dx speed as we have {0,6,1}, {0,4,3}, {0,6,2}, {0,2,1}, {0,4,2} // double the horizontal resolution }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; #asm di #endasm // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 6000); // make available memory from 40000-45999 // Set 512x192 Video Mode memset(16384, 0, 6144); // clear both halves of the display file before switching video mode memset(24576, 0, 6144); ts_vmod(PAPER_BLACK | VMOD_HIRES); // select 64-col mode with black background // Initialize SP1.LIB sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with ' ' character // mark the two rectangular areas on screen so we can see them sp1_ClearRect(&clip1, '+', SP1_RFLAG_TILE); sp1_ClearRect(&clip2, '+', SP1_RFLAG_TILE); sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { if (i < 5) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); } else { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_XOR2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_XOR2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_XOR2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); } }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; if (i < 5) sp1_MoveSprRel(se->s, &clip1, 0, 0, 0, se->dy, se->dx); else sp1_MoveSprRel(se->s, &clip2, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 61) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/examples/ex4c.tap0000644000175000017500000001075110760516613024510 0ustar tygrystygrysLoader  ; "32767":"":"32768" iex4c.bin  !:\s"1"!9s2͑!1Small C+ ZX͜@ $ UUUU;!T]"S!@!p!@!!!`!!!͋!! G! !u!Y!+!%!]!+!%!U͈!96n&#!94n&-!9~ mсс!9!a! 9n&))!I!@!!!9n&͑͑!9^#V!!!0!9n&$!9^#V!!!!9n&$!9^#V!U!! !!!2j!9!a! 9n&))!ي!@!!!9n&͑͑!9^#V!!!0!9n&$!9^#V! o$#s#6>o$> o$~oҮ$~(#ngà>o$#s#6++ÎUj&zTۆ%)))))){@T]))){C!G!EӇ!EӇkbwp(x@tukbqw]T!!  }w|wu t |(4tu]T^ V qq!~(.u t Î}o|g7|Mԇ@>!! go~$nGnN%o:2o~$nGnN%o:2o~$nGnN%o:2o~$nGnN%o:2o~$nGn N%o:2o~$n Gn N%o:2o~$n Gn N%o:2o~$nGnN%o:2[! [~##2~##2[~##2~##2[~##2~##2[~##2~#2[!I W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2[![ WP!!ʚ gKo~$n2nN%oy2Ko~$n2nN%oy2Ko~$n 2n N%oy2Ko~$n 2nN%oy2[!͚ ###############[!يʚ WK#^#2#^#2K#^#2#^#2K#^#2#^#2K#^#2#^2[!<[ W{G(yg.A];s$w%,[ T!<O~$I  r%s$%#>_>W!"!"!Q6#s#6#6#6#6#6#('xWyw#x@A( w# y@8x8#ًV#^#F#NІ*>o$r#s!> _@ 6 "CUpxݾw ~ZqO~ݾx| nf|uty( u t 6~~fn* ІFxڡҡxݖݾԌG Ny v M8H0CyݖݾO 34V#^#~(I~wr#s!6q  ׌V#^#~ ?###v(z@ õBKr#s#~#~b4#DM!Ə6#### ~ʊ=7r#s!67V#^#~ ####v  ãz@ õ6#### ~=r#s!6î"rsfn* ІFxhhxݖݾCGgNy vyݖݾkO4F#N#~ F#Ns+r###~ʙ =<r#s!6 r#s!6+~#N#DM!Ə(  Fz@ $r#s##~<r#s!6V#^#~(?G#N+6#### ~==Pr#s!6v! F###PV#^#~ ####v  jz@ $G#N+6#### ~ʰ=ur#s!6uV#(^0Əq+p! 6##r#s##q+p! r#s#p#q+++ r#s F##V#^6N#V#^p#q! p#qCU~G///݆_xRG~O///݆WyoO?! ~s_$~rgk*}lgž ~(#ngv >wGi`2!"#+Ȑ! V#^0 (| &~$fo~#+#^#V#| &~$fo( ~~#ng^#V###F#N#~#fow$w$w$w$w$w$w$w~# #F#N#~#fo[s$r$[s$r$[s$r$[s$r}?8oɰz88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/0000755000175000017500000000000010765202715023006 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/_sp1_struct_cs_prototype.asm0000644000175000017500000000204110756777120030574 0ustar tygrystygrys XLIB _sp1_struct_cs_prototype ._sp1_struct_cs_prototype defw 0 ; pointer to next struct sp1_CS in same sprite (big endian) defw 0 ; pointer to struct sp1_update this sprite char is currently drawn in (big endian) defb 0 ; sprite plane defb 0 ; sprite type (bit 7 = 1 occludes, bit 6 = 1 last column, bit 5 = 1 last row, bit 4 =1 pixelbuff clear) defw 0 ; & struct sp1_ss.draw_code (+8 bytes offset into struct sp1_ss this struct belongs to) ; embedded code in struct (will be overlaid depending on sprite type) ld hl,0 ; graphic definition pointer ld ix,0 ; graphic definition pointer for sprite char to left of this one call 0 ; call draw function ; end embedded code defw 0 ; next struct sp1_CS.ss_draw in this struct update's sprite list (big endian) defw 0 ; prev struct sp1_CS.next_in_update in this struct update's sprite list (big endian) z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/draw/0000755000175000017500000000000010765202715023743 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/MoveC.asm0000644000175000017500000002660510756777117024547 0ustar tygrystygrys ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; iy = & clipping rectangle ; ix = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row .CCrowloop ld a,b inc b ; row++ ; is row in clipping rectangle? sub (iy+0) jp c, CCcliprow0 sub (iy+3) jp nc, CCcliprow0 ; is this the last row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,b sub (ix+0) cp (ix+3) jp nz, CCnotlastrow ; **************************************************************** ; this is the last row, should it be drawn? ex af,af bit 0,a jp nz, CCcliprow1 ex af,af .CCnotlastrow ld c,(ix+1) ; c = column .CCcolloop ld a,c inc c ; column++ ; has this update struct been removed from the display? bit 6,(hl) ex (sp),hl jp nz, CCclipcol0 ; hl = & struct sp1_update.ulist (tail) ; stack = & struct sp1_update, row ; is column in clipping rectangle? sub (iy+1) jp c, CCclipcol0 sub (iy+2) jp nc, CCclipcol0 ; is this the last column in row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,c sub (ix+1) cp (ix+2) jp nz, CCnotlastcol ; z flag set if it is the last column in row ; **************************************************************** ; this is the last column, should it be drawn? ex af,af bit 1,a jp nz, CCclipcol1 ex af,af .CCnotlastcol exx inc (ix+19) ; number of active spr chars++ ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld b,(hl) inc hl ld c,(hl) ; bc = & next struct sp1_cs in sprite inc hl ld a,(hl) or a jp z, CCnoremovenec0 ; first remove spr char from current update struct push bc push hl ; stack = sp1_cs.update, next sp1_cs, sp1_update, row ld bc,4 add hl,bc ; hl = & struct sp1_cs.ss_draw call SP1RemoveSprChar pop de pop hl ex (sp),hl ex de,hl ; hl = & struct sp1_cs.update ; de = & struct sp1_update ; stack = & next struct sp1_cs, row ; change update struct spr char belongs to ld b,(hl) inc hl ld c,(hl) ; bc = old struct sp1_update ld (hl),e dec hl ld (hl),d ; store new struct sp1_update ; do count for occluding sprites inc hl inc hl inc hl ; hl = & struct sp1_cs.type bit 7,(hl) ; is this occluding type? jp z, CCnotoccl0 ld a,(bc) dec a ld (bc),a ; decrease num of occl sprites in old update struct ld a,(de) inc a ld (de),a ; increase num of occl sprites in new update struct .CCnotoccl0 ; invalidate update chars ld a,(de) xor $80 jp p, CCnoinvnew ; new update struct already invalidated so skip ld (de),a ; mark it as invalidated now push de exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCnoinvnew ld a,(bc) xor $80 jp p, CCnoinvold ; old update struct already invalidated so skip ld (bc),a ; mark it as invalidated now push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCnoinvold ; hl = & struct sp1_cs.type ; de = & struct sp1_update ; stack = & next struct sp1_cs, row ; now add spr char to new update struct it occupies dec hl ld a,(hl) ; a = plane inc hl ld c,(hl) push bc ; save type inc hl ld b,h ld c,l ; bc = & struct sp1_cs.ss_draw ld hl,3 add hl,de ; hl = & struct sp1_update.slist push de ; save sp1_update call SP1AddSprChar pop hl pop af pop de ; hl = & struct sp1_update ; de = & next struct sp1_cs ; f = z flag set if last col in row ; stack = row jr z, CCnextrow ld bc,9 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp CCcolloop .CCnextrow ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row pop hl ; hl = & struct sp1_update at start of row ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,9*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl exx ex (sp),hl jp CCrowloop .CCnoremovenec0 ; hl = & struct sp1_cs.update ; bc = & next struct sp1_cs in sprite ; stack = & struct sp1_update, row pop de ; de = & struct sp1_update ld (hl),d inc hl ld (hl),e ; store update struct the spr char occupies now inc hl inc hl ; hl = & struct sp1_cs.type ld a,(de) bit 7,(hl) ; is spr char occluding? jp z, CCnotoccl12 inc a ; increase # occluding sprites in update struct ld (de),a .CCnotoccl12 ; invalidate the update struct xor $80 jp p, CCalreadyinv33 ; skip if already invalidated ld (de),a ; mark it as invalidated push de exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCalreadyinv33 push bc ; hl = & struct sp1_cs.type ; de = & struct sp1_update ; stack = & next struct sp1_cs, row jp CCnoinvold ; add spr char to update list, loop .CCclipcol1 ex af,af .CCclipcol0 exx ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr z, CCskipremoveit ld b,a inc hl ld c,(hl) ; need to remove this spr char from update list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update + 1 ; bc = & old struct sp1_update ; stack = & struct sp1_update, row push bc push de dec hl ld (hl),0 ; this spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.ss_draw call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs pop bc ; bc = & old struct sp1_update ; invalidate so char is redrawn without sprite ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, CCnotoccl44 dec a ; number of occluding sprites in old update struct -- ld (bc),a .CCnotoccl44 xor $80 ; is char already invalidated? jp p, CCalreadyinv66 ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCalreadyinv66 ; hl = & struct sp1_cs.type ; de = & next struct sp1_cs ; stack = & struct sp1_update, row pop bc bit 6,(hl) ; last column in row? jp nz, CCnextrow ; this is not the last column ld hl,9 add hl,bc push hl ex de,hl exx ex (sp),hl jp CCcolloop .CCskipremoveit ; hl = & struct sp1_cs.update ; de = & next struct sp1_cs in sprite ; stack = & struct sp1_update, row inc hl inc hl inc hl jp CCalreadyinv66 .CCcliprow1 ex af,af .CCcliprow0 ; skipping an entire row, only need to remove ; spr chars from update struct list + invalidate ; if they are on-screen ex (sp),hl exx .CCcliprowlp ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr nz, CCCRremoveit ; ok, not on display inc hl inc hl inc hl ; hl = & struct sp1_cs.type .CCCRrejoinremove ; is this the last col in row? bit 6,(hl) pop hl ; hl = & struct sp1_update jr nz, CCCRnextrow ; this is not the last column in row ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row ld bc,9 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs jp CCcliprowlp .CCCRnextrow ; this was last column, move to next row ; de = & next struct sp1_cs ; hl = & struct sp1_update ; stack = row pop hl ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,9*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp CCrowloop .CCCRremoveit ; need to remove this spr char from update list ld b,a inc hl ld c,(hl) ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update + 1 ; bc = & old struct sp1_update ; stack = & struct sp1_update, row push bc push de dec hl ld (hl),0 ; spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.ss_draw call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs pop bc ; bc = & old struct sp1_update ; invalidate so char is redrawn without sprite ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, CCCRnotoccluding0 dec a ; number of occluding sprites in update struct -- ld (bc),a .CCCRnotoccluding0 xor $80 ; is char already invalidated? jp p, CCCRrejoinremove ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx jp CCCRrejoinremove z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/MoveNC.asm0000644000175000017500000002305610756777117024662 0ustar tygrystygrys ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; iy = & clipping rectangle ; ix = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row .NCrowloop ld a,b inc b ; row++ ; is row in clipping rectangle? sub (iy+0) jp c, NCcliprow0 sub (iy+3) jp nc, NCcliprow0 ; is this the last row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,b sub (ix+0) cp (ix+3) jp nz, NCnotlastrow ; **************************************************************** ; this is the last row, should it be drawn? ex af,af bit 0,a jp nz, NCcliprow1 ex af,af .NCnotlastrow ld c,(ix+1) ; c = column .NCcolloop ld a,c inc c ; column++ ; has this update struct been removed from the display? bit 6,(hl) ex (sp),hl jr nz, NCclipcol0 ; hl = & struct sp1_update.ulist (tail) ; stack = & struct sp1_update, row ; is column in clipping rectangle? sub (iy+1) jr c, NCclipcol0 sub (iy+2) jr nc, NCclipcol0 ; is this the last column in row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,c sub (ix+1) cp (ix+2) jp nz, NCnotlastcol ; z flag set if it is the last column in row ; **************************************************************** ; this is the last col, should it be drawn? ex af,af bit 1,a jr nz, NCclipcol1 ex af,af .NCnotlastcol exx push af inc (ix+19) ; number of active sprite chars++ ; hl = & struct sp1_cs ; stack = flag = z if last col, & struct sp1_update, row ; is sprite char already in update struct list? ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; hl = & struct sp1_cs.update ld a,(hl) ; if MSB of update struct this spr char is != 0 or a ; then already in list jr z, NCaddit ; already in update struct list so no need to add spr char to update struct list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = flag = z if last col, & struct sp1_update, row pop bc pop hl .NCrejoinaddit ; de = & next struct sp1_cs ; hl = & struct sp1_update ; c = bit 6 set if last col ; stack = row ; invalidate ld a,(hl) ; skip if char already invalidated xor $80 jp p, NCalreadyinv0 ld (hl),a ; mark as invalidated push hl exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .NCalreadyinv0 bit 6,c ; is this last col? jr nz, NCnextrow .NCnextcol ; this is not the last column in row ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row ld bc,9 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp NCcolloop .NCclipcol1 ex af,af .NCclipcol0 exx ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr nz, NCremoveit ; ok, not on display inc hl inc hl inc hl ; hl = & struct sp1_cs.type .NCrejoinremove ; is this the last col in row? bit 6,(hl) pop hl ; hl = & struct sp1_update jr z, NCnextcol .NCnextrow ; this was last column, move to next row ; de = & next struct sp1_cs ; hl = & struct sp1_update ; stack = row pop hl ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,9*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp NCrowloop .NCaddit ; add the sprite char to update struct's sprite list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = flag = z if last col, & struct sp1_update, row pop af ; f = flag ld b,d ld c,e ; bc = & next struct sp1_cs in update pop de ; de = & struct sp1_update push de push af ld (hl),d inc hl ld (hl),e ; write struct update this spr char belongs to inc hl ld a,(hl) ; a = plane inc hl bit 7,(hl) ; is spr char occluding type? jp z, NCnotoccluding10 ex de,hl inc (hl) ; increase # occluding sprites in update struct ex de,hl .NCnotoccluding10 inc hl push bc ld b,h ld c,l ; bc = & struct sp1_cs.ss_draw ld hl,3 add hl,de ; hl = & struct sp1_update.slist call SP1AddSprChar ; add sprite to update list pop de pop bc pop hl ; de = & next struct sp1_cs ; hl = & struct sp1_update ; c = bit 6 set if last col ; stack = row jp NCrejoinaddit .NCremoveit ; need to remove this spr char from update list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = & struct sp1_update, row push de ld (hl),0 ; this spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.ss_draw call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs ; invalidate so char is redrawn without sprite pop bc ; bc = & struct sp1_update push bc ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, NCnotoccluding0 dec a ; number of occluding sprites in update struct -- ld (bc),a .NCnotoccluding0 xor $80 ; is char already invalidated? jp p, NCrejoinremove ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx jp NCrejoinremove .NCcliprow1 ex af,af .NCcliprow0 ; skipping an entire row, only need to remove ; spr chars from update struct list + invalidate ; if they are on-screen ex (sp),hl exx .NCcliprowlp ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr nz, NCCRremoveit ; ok, not on display inc hl inc hl inc hl ; hl = & struct sp1_cs.type .NCCRrejoinremove ; is this the last col in row? bit 6,(hl) pop hl ; hl = & struct sp1_update jr nz, NCCRnextrow ; this is not the last column in row ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row ld bc,9 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs jp NCcliprowlp .NCCRnextrow ; this was last column, move to next row ; de = & next struct sp1_cs ; hl = & struct sp1_update ; stack = row pop hl ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,9*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp NCrowloop .NCCRremoveit ; need to remove this spr char from update list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = & struct sp1_update, row push de ld (hl),0 ; spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.ss_draw call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs ; invalidate so char is redrawn without sprite pop bc ; bc = & struct sp1_update push bc ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, NCCRnotoccluding0 dec a ; number of occluding sprites in update struct -- ld (bc),a .NCCRnotoccluding0 xor $80 ; is char already invalidated? jp p, NCCRrejoinremove ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx jp NCCRrejoinremove z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/sp1_AddColSpr_callee.asm0000644000175000017500000001327710756777120027434 0ustar tygrystygrys; uint __CALLEE__ sp1_AddColSpr_callee(struct sp1_ss *s, void *drawf, uchar type, int graphic, uchar plane) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_AddColSpr_callee XDEF ASMDISP_SP1_ADDCOLSPR_CALLEE LIB _sp1_struct_cs_prototype XREF _u_malloc, _u_free .sp1_AddColSpr_callee pop af pop hl ld h,l pop bc pop de ld l,e pop de pop ix push af .asmentry ; Adds another column to an existing sprite. ; ; enter : ix = struct sp1_ss * ; h = plane ; l = type (index into table), bit 7 = 1 for occluding, bit 4 = 1 clear pixelbuffer ; bc = graphic definition for column ; de = address of sprite draw function ; uses : af, bc, de, hl, bc', de', hl', iy ; exit : carry flag for success and hl=1, else memory allocation failed and hl=0 .SP1AddColSpr exx ld hl,0 ; first try to get all the memory we need push hl ; push a 0 on stack to indicate end of allocated memory blocks ld b,(ix+3) ; b = height .csalloc push bc ld hl,22 ; sizeof(struct sp1_cs) push ix push hl call _u_malloc pop bc jp nc, fail pop ix pop bc push hl ; stack allocated block djnz csalloc exx ex (sp),hl ; hl = new struct sp1_cs, stack: l = type h = plane push de ; save draw function ; have all necessary memory blocks on stack, hl = new struct sp1_cs ld de,_sp1_struct_cs_prototype ex de,hl ; hl = & struct sp1_cs prototype, de = & new struct sp1_cs ld iyl,e ld iyh,d ; iy = & struct sp1_cs push bc ; save bc = graphic def ld bc,22 ; sizeof(struct sp1_cs) ldir ; copy prototype into new struct pop bc ; bc = graphic def ; have copied prototype struct sp1_cs, now fill in the rest of the details pop de ; de = draw function pop hl ; h = plane, l = type push bc ; stack graphic def ld c,e ld b,d ; bc = draw function ld (iy+4),h ; store plane ld a,l and $90 or $40 ld (iy+5),a ; store type ld e,iyl ld d,iyh ld hl,8 add hl,de ex de,hl ; de = & struct sp1_cs.draw_code (& embedded code in struct sp1_cs) ld hl,-10 add hl,bc ; hl = & draw function data ld bc,10 ; length of draw code ldir ; copy draw code into struct sp1_cs ld a,ixl add a,8 ld (iy+6),a ; store & struct sp1_ss + 8 (& embedded code in struct sp1_ss) ld a,ixh adc a,0 ld (iy+7),a pop bc ld (iy+9),c ; store graphics ptr ld (iy+10),b ld h,(ix+15) ; hl = first struct sp1_cs in sprite ld l,(ix+16) .loop ; ix = struct sp1_ss, iy = next struct sp1_cs to be added to sprite, hl = & next struct sp1_cs in sprite being iterated ld bc,4 .search ld d,(hl) inc hl ld e,(hl) ; de = next struct sp1_cs within sprite in iteration add hl,bc ; hl = & struct sp1_cs.type bit 6,(hl) ; is this struct sp1_cs in last column? ex de,hl jp z, search ex de,hl ; hl = & struct sp1_cs.type in last column, de = next struct sp1_cs at start of next row res 6,(hl) ; no longer last in column ld bc,-5 add hl,bc ; hl = & struct sp1_cs formerly in last column ld a,iyh ; store ptr to new struct sp1_cs as following this one ld (hl),a inc hl ld a,iyl ld (hl),a ld (iy+0),d ; and store next struct sp1_cs at start of next row as following the new one ld (iy+1),e ld bc,8 add hl,bc ; hl = & struct sp1_cs.def formerly in last column ld a,(hl) ld (iy+13),a ; copy left struct's graphic pointer into new struct's left graphic ptr inc hl ld a,(hl) ld (iy+14),a pop hl ; get next allocated memory block ld a,h or l jr z, done push de ; save & first struct sp1_cs in next row of sprite push hl ; stack new memory block ld e,iyl ld d,iyh ex de,hl ; hl = & new struct sp1_cs just added, de = memory block for new struct sp1_cs ld bc,22 ; sizeof(struct sp1_cs) ldir ; copy struct sp1_cs just added into new one ld e,(iy+9) ld d,(iy+10) ; de = graphics ptr from last struct sp1_cs pop iy ; iy = new struct sp1_cs ld hl,8 ; offset to next character in sprite graphic def bit 7,(ix+4) jr z, onebyte2 ld l,16 ; if 2-byte def, offset is 16 bytes .onebyte2 add hl,de ld (iy+9),l ; store correct graphics ptr for this struct sp1_cs ld (iy+10),h pop hl ; hl = & first struct sp1_cs in next row of sprite jp loop .done set 5,(iy+5) ; indicate last struct sp1_cs added is in the last row of sprite inc (ix+2) ; increase width of sprite inc l scf ; indicate success ret .fail pop ix pop bc .faillp pop hl ; hl = allocated memory block ld a,h or l ret z ; if 0 done freeing, ret with nc for failure push hl call _u_free ; free the block pop hl jp faillp DEFC ASMDISP_SP1_ADDCOLSPR_CALLEE = asmentry - sp1_AddColSpr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/sp1_ChangeSprType_callee.asm0000644000175000017500000000207710756777120030331 0ustar tygrystygrys; void __CALLEE__ sp1_ChangeSprType_callee(struct sp1_cs *c, void *drawf) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_ChangeSprType_callee XDEF ASMDISP_SP1_CHANGESPRTYPE_CALLEE .sp1_ChangeSprType_callee pop hl pop de ex (sp),hl .asmentry ; Change the type of a sprite char struct so that it draws using ; a different draw function. If the occluding flag is changed, ; make sure the sprite char struct is off screen before calling. ; ; enter : hl = struct sp1_cs * ; de = address of sprite draw function ; uses : af, bc, de, hl .SP1ChangeSprType ld bc,8 add hl,bc ex de,hl ; de = & struct sp1_CS.draw_code, hl = & draw function ld bc,-10 add hl,bc ; hl = & draw function data ldi ; copy draw code into struct sp1_cs.draw_code inc hl ; but skip over graphic pointers inc hl inc de inc de ldi ldi inc hl inc hl inc de inc de ldi ldi ldi ret DEFC ASMDISP_SP1_CHANGESPRTYPE_CALLEE = asmentry - sp1_ChangeSprType_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/sp1_CreateSpr_callee.asm0000644000175000017500000001341210756777120027500 0ustar tygrystygrys; struct sp1_ss __CALLEE__ *sp1_CreateSpr_callee(void *drawf, uchar type, uchar height, int graphic, uchar plane) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_CreateSpr_callee XDEF ASMDISP_SP1_CREATESPR_CALLEE LIB _sp1_struct_ss_prototype, _sp1_struct_cs_prototype XREF _u_malloc, _u_free .sp1_CreateSpr_callee pop ix pop bc pop hl pop de ld a,e pop de ld b,e pop de push ix .asmentry ; Create sprite of given height one column wide. Further columns are ; added with successive calls to SP1AddColSpr. ; ; enter : a = height in chars ; b = type: bit 7 = 1 occluding, bit 6 = 1 2 byte definition, bit 4 = 1 clear pixelbuff ; c = plane sprite occupies (0 = closest to viewer) ; de = address of draw function ; hl = graphic definition for column ; uses : all ; exit : no carry and hl=0 if memory allocation failed else hl = struct sp1_ss * and carry set .SP1CreateSpr push af ex af,af pop af ; a = a' = height exx ld hl,0 ; first try to get all the memory we need push hl ; push a 0 on stack to indicate end of allocated memory blocks ld b,a ; b = height .csalloc push bc ; save height counter ld hl,22 ; sizeof(struct sp1_cs) push hl call _u_malloc pop bc jp nc, fail pop bc push hl ; stack allocated block djnz csalloc ld hl,20 ; sizeof(struct sp1_ss) push hl call _u_malloc pop bc jp nc, fail push hl exx ex (sp),hl ; stack = graphic pointer push de ; save de = draw function push bc ; save b = type, c = plane ; have all necessary memory blocks on stack, hl = & struct sp1_ss ld de,_sp1_struct_ss_prototype ex de,hl ; hl = & struct sp1_ss prototype, de = & new struct sp1_ss ld ixl,e ld ixh,d ; ix = & struct sp1_ss ld bc,20 ; sizeof(struct sp1_ss) ldir ; copy prototype into new struct ; have copied prototype struct sp1_ss, now fill in the rest of the details ex af,af ; a = height ld (ix+3),a ; store height pop bc ; b = type, c = plane bit 6,b jr z, onebyte set 7,(ix+4) ; indicate 2-byte definition .onebyte ld a,b ; a = type and $90 or $40 ; a = type entry for struct sp1_cs pop de ; de = draw function pop hl ex (sp),hl ; stack = graphics ptr, hl = & first struct sp1_cs push de ; save draw function ld (ix+15),h ; store ptr to first struct sp1_cs in struct sp1_ss ld (ix+16),l ; done with struct sp1_ss, now do first struct sp1_cs ld de,_sp1_struct_cs_prototype ex de,hl ; hl = & struct sp1_cs prototype, de = & new struct sp1_cs ld iyl,e ld iyh,d ; iy = & struct sp1_cs push bc ; save c = plane ld bc,22 ; sizeof(struct sp1_cs) ldir ; copy prototype into new struct pop bc ; c = plane ; have copied prototype struct sp1_cs, now fill in the rest of the details ld (iy+4),c ; store plane ld (iy+5),a ; store type ld e,iyl ld d,iyh ld hl,8 add hl,de ex de,hl ; de = & struct sp1_cs.draw_code (& embedded code in struct sp1_cs) pop bc ; bc = draw function ld hl,-10 add hl,bc ; hl = embedded draw function code ld bc,10 ; length of draw code ldir ; copy draw code into struct sp1_cs ld a,ixl add a,8 ld (iy+6),a ; store & struct sp1_ss + 8 (& embedded code in struct sp1_ss) ld a,ixh adc a,0 ld (iy+7),a pop hl ; hl = graphics ptr ld (iy+9),l ; store graphics ptr ld (iy+10),h .loop ; ix = struct sp1_ss, iy = last struct sp1_cs added to sprite pop hl ; hl = & next struct sp1_cs to add ld a,h or l jr z, done push hl ld (iy+0),h ; store ptr to next struct sp1_cs ld (iy+1),l ld e,iyl ld d,iyh ex de,hl ; hl = last struct sp1_cs, de = new struct sp1_cs ld bc,22 ; sizeof(struct sp1_cs) ldir ; make copy of last one into new one ld e,(iy+9) ld d,(iy+10) ; de = graphics ptr from last struct sp1_cs pop iy ; iy = new struct sp1_cs ld (iy+0),c ; place 0 into struct sp1_cs.next_in_spr to indicate ld (iy+1),c ; this is currently last struct sp1_cs in sprite ld hl,8 ; offset to next character in sprite graphic def bit 7,(ix+4) jr z, onebyte2 ld l,16 ; if 2-byte def, offset is 16 bytes .onebyte2 add hl,de ld (iy+9),l ; store correct graphics ptr for this struct sp1_cs ld (iy+10),h jp loop .done set 5,(iy+5) ; indicate last struct sp1_cs added is in the last row of sprite ld a,ixl ld l,a ld a,ixh ld h,a scf ; indicate success ret .fail pop bc .faillp pop hl ; hl = allocated memory block ld a,h or l ret z ; if 0 done freeing, ret with nc for failure push hl call _u_free ; free the block pop hl jp faillp DEFC ASMDISP_SP1_CREATESPR_CALLEE = asmentry - sp1_CreateSpr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/sp1_InitCharStruct_callee.asm0000644000175000017500000000355210756777120030522 0ustar tygrystygrys; void __CALLEE__ sp1_InitCharStruct_callee(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_InitCharStruct_callee XDEF ASMDISP_SP1_INITCHARSTRUCT_CALLEE LIB _sp1_struct_cs_prototype XREF SP1V_ROTTBL .sp1_InitCharStruct_callee pop hl pop bc ld a,c ex af,af pop bc pop de ld a,e pop de ex (sp),hl ; enter : a' = plane ; a = type ; hl = struct sp1_cs * ; de = address of sprite draw function ; bc = graphic ; uses : af, bc, de, hl, af', bc', de', hl' .asmentry push bc ; save graphic push de ; save draw function ex de,hl ; de = struct sp1_cs * ld hl,_sp1_struct_cs_prototype ld bc,22 ldir ; copy prototype struct sp1_cs into sp1_cs ld hl,-5 add hl,de ; hl = & sp1_cs.draw + 1b pop de dec de ; de = & last byte of draw function data ex de,hl ldd ; copy draw function data into struct sp1_cs ldd ldd dec hl dec hl dec de dec de ldd ldd pop bc ; bc = graphic ex de,hl ld (hl),b dec hl ld (hl),c dec hl dec de dec de ex de,hl ldd ex de,hl ; hl = & sp1_cs.ss_draw + 1b ld (hl),sp1_ss_embedded / 256 dec hl ld (hl),sp1_ss_embedded % 256 dec hl ; hl = & sp1_cs.type ld (hl),a ; store type dec hl ex af,af ld (hl),a ; store plane ret .sp1_ss_embedded ld a,SP1V_ROTTBL/256 + 8 ; use rotation of four pixels if user selects a non-NR draw function ld bc,0 ex de,hl jp (hl) DEFC ASMDISP_SP1_INITCHARSTRUCT_CALLEE = asmentry - sp1_InitCharStruct_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/sp1_InsertCharStruct_callee.asm0000644000175000017500000000203010756777120031051 0ustar tygrystygrys ; void __CALLEE__ sp1_InsertCharStruct_callee(struct sp1_update *u, struct sp1_cs *cs) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_InsertCharStruct_callee XDEF ASMDISP_SP1_INSERTCHARSTRUCT_CALLEE LIB SP1AddSprChar .sp1_InsertCharStruct_callee pop hl pop de ex (sp),hl ex de,hl .asmentry ; hl = struct sp1_cs * ; de = struct sp1_update * inc hl inc hl ld (hl),d ; store sp1_update into sp1_cs.update inc hl ld (hl),e inc hl ld a,(hl) ; a = plane inc hl ; hl = & sp1_cs.type bit 7,(hl) ; is it occluding type? ex de,hl jr z, notoccluding inc (hl) ; increase # occluding sprites in update struct .notoccluding inc de ld c,e ld b,d ; bc = & sp1_cs.ss_draw inc hl inc hl inc hl ; hl = & sp1_update.slist jp SP1AddSprChar DEFC ASMDISP_SP1_INSERTCHARSTRUCT_CALLEE = asmentry - sp1_InsertCharStruct_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/sp1_MoveSprAbs_callee.asm0000644000175000017500000001225010757133754027630 0ustar tygrystygrys; void __CALLEE__ sp1_MoveSprAbs_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version ; *** PLEASE HELP ME I'VE BEEN MADE UGLY BY BUGFIXES XLIB sp1_MoveSprAbs_callee XDEF ASMDISP_SP1_MOVESPRABS_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE XREF SP1V_ROTTBL, SP1V_DISPWIDTH, SP1V_UPDATELISTT LIB SP1AddSprChar, SP1RemoveSprChar .sp1_MoveSprAbs_callee pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop iy pop ix push af .asmentry ; enter: ix = & struct sp1_ss ; hl = sprite frame address (0 = no change) ; d = new row coord in chars ; e = new col coord in chars ; b = new horizontal rotation (0..7) ie horizontal pixel position ; c = new vertical rotation (0..7) ie vertical pixel position ; iy = clipping rectangle entirely on screen ; (iy+0) = row, (iy+1) = col, (iy+2) = width, (iy+3) = height ; uses : all except ix, iy which remain unchanged .SP1MoveSprAbs ld (ix+5),b ; store new horizontal rotation ld a,b cp (ix+17) ; decide if last col should draw, result in b rl b add a,a add a,SP1V_ROTTBL/256 ld (ix+9),a ; store effective horizontal rotation (MSB of lookup table to use) xor a sub c ; a = - (vertical rotation in pixels) bit 7,(ix+4) jp z, onebytedef sub c ; a = - 2*(vertical rotation) for 2-byte definitions set 7,c .onebytedef ld (ix+4),c ; store new vertical rotation ld c,a ; c = vertical rotation offset for graphics ptrs ld a,(ix+4) ; decide if last row should draw and $07 cp (ix+18) ld a,b rla ex af,af ld a,h or l jr nz, newframe ld l,(ix+6) ld h,(ix+7) ; hl = old sprite frame pointer jp framerejoin .newframe ld (ix+6),l ld (ix+7),h ; store new frame pointer .framerejoin ld a,c or a jr z, skipadj ld b,$ff ; bc = negative vertical rotation offset add hl,bc ; add vertical rotation offset .skipadj ld (ix+11),l ld (ix+12),h ; store new effective offset for graphics pointers ; d = new row coord (chars) ; e = new col coord (chars) ; ix = & struct sp1_ss ; iy = clipping rectangle ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; ; 329 cycles to this point worst case ld (ix+19),0 ld a,(ix+0) ; has the row coord changed? cp d jp nz, changing0 ld a,(ix+1) ; has the col coord changed? cp e jp nz, changing1 ; not changing character coordinate, no need to remove sprite from update struct lists ; ///////////////////////////////////////////////////////////////////////////////// ; MOVE SPRITE, CHARACTER COORDINATES NOT CHANGING ; ///////////////////////////////////////////////////////////////////////////////// ld h,(ix+15) ld l,(ix+16) push de exx pop de ld hl,(SP1V_UPDATELISTT) ld bc,5 add hl,bc push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ld b,(ix+0) pop de push hl push de ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; iy = & clipping rectangle ; ix = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row INCLUDE "./ts2068hr/sprites/MoveNC.asm" .done exx ld de,-5 add hl,de ; hl = & last struct sp1_update.ulist in invalidated list ld (SP1V_UPDATELISTT),hl ret ; changing character coordinate, must remove and place sprite in update struct lists ; ///////////////////////////////////////////////////////////////////////////////// ; MOVE SPRITE, CHANGING CHARACTER COORDINATES ; ///////////////////////////////////////////////////////////////////////////////// .changing0 ld (ix+0),d ; write new row coord .changing1 ld (ix+1),e ; write new col coord ; d = new row coord (chars) ; e = new col coord (chars) ; ix = & struct sp1_ss ; iy = & clipping rectangle ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ld h,(ix+15) ld l,(ix+16) push de exx pop de ld hl,(SP1V_UPDATELISTT) ld bc,5 add hl,bc push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ld b,(ix+0) pop de push hl push de ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; iy = & clipping rectangle ; ix = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row INCLUDE "./ts2068hr/sprites/MoveC.asm" ; jumps to done for exit inside INCLUDE DEFC ASMDISP_SP1_MOVESPRABS_CALLEE = asmentry - sp1_MoveSprAbs_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/sp1_RemoveCharStruct.asm0000644000175000017500000000172210756777120027544 0ustar tygrystygrys ; void __FASTCALL__ sp1_RemoveCharStruct(struct sp1_cs *cs) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_RemoveCharStruct LIB SP1RemoveSprChar ; remove an independent char struct that may be ; inserted into a struct_sp1_update's draw list ; ; enter : hl = struct sp1_cs * ; uses : af, bc, de, hl .sp1_RemoveCharStruct inc hl inc hl ld a,(hl) or a ret z ; not in any struct update draw list ld d,a ld (hl),0 ; not part of this draw list anymore inc hl ld e,(hl) ; de = struct update * inc hl inc hl ; hl = & sp1_cs.type bit 7,(hl) ex de,hl jr z, notoccluding dec (hl) ; reduce occluding count in struct update .notoccluding inc de ; de = & sp1_cs.ss_draw ld hl,15 add hl,de ; hl = & sp1_cs.prev_in_upd + 1b ex de,hl jp SP1RemoveSprChar z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/SP1AddSprChar.asm0000644000175000017500000000513610756777117026031 0ustar tygrystygrys XLIB SP1AddSprChar ; ///////////////////////////////////////////////////////////////////////////////// ; Adds a sprite char to the linked list of sprites in a ; struct sp1_update at the correct position dependant on plane. ; ; enter : a = plane ; hl = & struct update.slist ; bc = & sp1_cs.ss_draw of sprite char being added ; uses : f, bc, de, hl ; ; 98n - 26 + 197 = 98n + 171 (n = # sprites in char; n=3: 465, n=1: 130) .SP1AddSprChar ; hl = prev sprite's & sp1_cs.next_in_upd (pending point to add current sprite after) ld d,(hl) inc hl inc d dec d jr z, donesearch1 ; if no next sprite, we add this sprite to end of list ld e,(hl) dec de dec de ex de,hl ; hl = the next sprite's & sp1_cs.plane, de = prev sprite's & sp1_cs.next_in_upd + 1b cp (hl) jr nc, donesearch0 ; if plane >= this sprite's plane, place before it ld de,14 add hl,de ; hl = the next sprite's & sp1_cs.next_in_upd jp SP1AddSprChar .donesearch1 ; no next sprite ld (hl),c ; hl = & prev sprite's sp1_cs.next_in_upd + 1b dec hl ld (hl),b ; write new sprite char into next ptr ex de,hl ; de = & prev sprite's sp1_cs.next_in_upd ld hl,12 add hl,bc ; hl = & sp1_cs.next_in_upd of spr char to add ld (hl),0 ; no sprite chars follow this one in list inc hl inc hl ld (hl),d ; write prev sprite into prev spr ptr inc hl ld (hl),e ret .donesearch0 ; there is a next sprite inc hl inc hl ex de,hl ; hl = & prev sprite's sp1_cs.next_in_upd + 1b, de = next sprite's & sp1_cs.ss_draw ld (hl),c dec hl ld (hl),b ; prev sprite's next ptr points at new sprite char push hl ; stack = prev sprite's & sp1_cs.next_in_upd ld hl,12 add hl,bc ; hl = new sprite's & sp1_cs.next_in_upd ld (hl),d inc hl ld (hl),e ; new sprite's next ptr points at next sprite inc hl ; hl = new sprite's & sp1_cs.prev_in_upd pop bc ; bc = prev sprite's & sp1_cs.next_in_upd ld (hl),b inc hl ld (hl),c ; new sprite's prev ptr points at prev sprite dec hl dec hl dec hl ex de,hl ; de = new sprite's & sp1_cs.next_in_upd ld bc,14 add hl,bc ; hl = next sprite's & sp1_cs.prev_in_upd ld (hl),d inc hl ld (hl),e ; next sprite's prev ptr points at new sprite ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/sprites/SP1RemoveSprChar.asm0000644000175000017500000000343010756777120026563 0ustar tygrystygrys XLIB SP1RemoveSprChar ; ///////////////////////////////////////////////////////////////////////////////// ; Remove a sprite char from the linked list of sprites ; it occupies in a struct sp1_update ; ; enter : hl = & struct sp1_cs.ss_draw ; exit : de = & struct sp1_cs.prev_in_upd + 1 ; uses : f, bc, de, hl ; ; 179 cycles worst case .SP1RemoveSprChar ld de,12 add hl,de ; hl = & struct sp1_cs.next_in_upd ld b,(hl) ; check if there's any sprite char after this one in list inc b inc hl ; hl = & struct sp1_cs.next_in_upd + 1 djnz nextexists ; no sprite char after this one in list so removing from end of list inc hl ld d,(hl) inc hl ld e,(hl) ; de = & left link's sp1_cs.next_in_upd ex de,hl ; de = & struct sp1_cs.prev_in_upd + 1 ld (hl),0 ; mark no next sprite, removing this one from list ret .nextexists ; there is a sprite char after this one in update list, so removing from middle of list ld c,(hl) ; bc = & right link's struct sp1_cs.ss_draw inc hl ld d,(hl) inc hl ld e,(hl) ; de = & left link's struct sp1_cs.next_in_upd ex de,hl ; de = & struct sp1_cs.prev_in_upd + 1b push hl ; stack & left link's struct sp1_cs.next_in_upd ld (hl),b inc hl ld (hl),c ; previous sprite's next ptr = & right link's struct sp1_cs.ss_draw ld hl,14 add hl,bc ; hl = & right link's struct sp1_cs.prev_in_update pop bc ; bc = & left link's struct sp1_cs.next_in_upd ld (hl),b inc hl ld (hl),c ; next sprite's prev ptr = & left link's struct sp1_cs.next_in_upd ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/0000755000175000017500000000000010765202715022435 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_ClearRect.asm0000644000175000017500000000076210756777120025602 0ustar tygrystygrys; void sp1_ClearRect(struct sp1_Rect *r, uchar tile, uchar rflag) ; CALLER linkage for function pointers XLIB sp1_ClearRect LIB sp1_ClearRect_callee XREF ASMDISP_SP1_CLEARRECT_CALLEE .sp1_ClearRect ld hl,2 add hl,sp ld a,(hl) inc hl inc hl ld e,(hl) inc hl inc hl ld c,(hl) inc hl ld h,(hl) ld l,c push de ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl jp sp1_ClearRect_callee + ASMDISP_SP1_CLEARRECT_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_ClearRect_callee.asm0000644000175000017500000000706410756777120027111 0ustar tygrystygrys; void __CALLEE__ sp1_ClearRect_callee(struct sp1_Rect *r, uchar tile, uchar rflag) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_ClearRect_callee XDEF ASMDISP_SP1_CLEARRECT_CALLEE, ASMDISP_SP1CRSELECT LIB sp1_GetUpdateStruct_callee, l_jpix XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH .sp1_ClearRect_callee pop af pop bc pop hl pop de push af ld a,c push hl ex de,hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl .asmentry ; Clear a rectangular area on screen, erasing sprites, ; and changing tile depending on flags. ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; l = tile ; a = bit 0 set for tiles, bit 1 set for tile colours (ignored), bit 2 set for sprites ; uses : af, bc, de, hl, af', ix .SP1ClearRect and $07 ret z ; ret if all flags reset push hl call SP1CRSELECT ; ix = address of operation code (depending on flags passed in) call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct update pop de ; e = tile .rowloop push bc ; save b = width push hl ; save update position .colloop call l_jpix ; apply operation on hl, advance hl to next struct sp1_update to the right djnz colloop pop hl ld bc,9*SP1V_DISPWIDTH add hl,bc pop bc dec c jp nz, rowloop ret .SP1CRSELECT add a,a add a,seltbl%256 ld l,a ld h,seltbl/256 jp nc, noinc0 inc h .noinc0 ld a,(hl) ld ixl,a inc hl ld a,(hl) ld ixh,a ret .seltbl defw OPTION0, OPTION1, OPTION2, OPTION1 defw OPTION4, OPTION5, OPTION4, OPTION5 .OPTION0 ; no flags ld a,9 add a,l ld l,a ret nc inc h ret .OPTION1 ; tile only inc hl ld (hl),e inc hl ld (hl),0 ld a,7 add a,l ld l,a ret nc inc h ret .OPTION2 ; colour only - NOP ld a,9 add a,l ld l,a ret nc inc h ret .OPTION4 ; sprite only ld a,(hl) and $c0 inc a ; keep bit 6:7 flag, occluding spr count reset to 1 ld (hl),a inc hl inc hl inc hl push hl ld a,(hl) ; if no sprites in this tile, done or a jr z, done ld (hl),0 ; mark no sprites in this tile inc hl ld l,(hl) ld h,a .loop ; hl = & struct sp1_cs.ss_draw dec hl dec hl dec hl dec hl ; hl = & struct sp1_cs.update ld (hl),0 ; remove from sprite char from tile ld a,16 add a,l ld l,a jp nc, noinc1 inc h .noinc1 ; hl = & struct sp1_cs.next_in_upd ld a,(hl) or a jr z, done inc hl ld l,(hl) ld h,a jp loop .done pop hl ld a,6 add a,l ld l,a ret nc inc h ret .OPTION5 ; sprite and tile inc hl ld (hl),e inc hl ld (hl),0 dec hl dec hl jp OPTION4 DEFC ASMDISP_SP1_CLEARRECT_CALLEE = asmentry - sp1_ClearRect_callee DEFC ASMDISP_SP1CRSELECT = SP1CRSELECT - sp1_ClearRect_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_ClearRectInv.asm0000644000175000017500000000101010756777120026242 0ustar tygrystygrys; void sp1_ClearRectInv(struct sp1_Rect *r, uchar tile, uchar rflag) ; CALLER linkage for function pointers XLIB sp1_ClearRectInv LIB sp1_ClearRectInv_callee XREF ASMDISP_SP1_CLEARRECTINV_CALLEE .sp1_ClearRectInv ld hl,2 add hl,sp ld a,(hl) inc hl inc hl ld e,(hl) inc hl inc hl ld c,(hl) inc hl ld h,(hl) ld l,c push de ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl jp sp1_ClearRectInv_callee + ASMDISP_SP1_CLEARRECTINV_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_ClearRectInv_callee.asm0000644000175000017500000000452610756777120027566 0ustar tygrystygrys; void __CALLEE__ sp1_ClearRectInv_callee(struct sp1_Rect *r, uchar tile, uchar rflag) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_ClearRectInv_callee XDEF ASMDISP_SP1_CLEARRECTINV_CALLEE LIB sp1_GetUpdateStruct_callee, sp1_ClearRect_callee, l_jpix XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, ASMDISP_SP1CRSELECT XREF SP1V_DISPWIDTH, SP1V_UPDATELISTT .sp1_ClearRectInv_callee pop af pop bc pop hl pop de push af ld a,c push hl ex de,hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl .asmentry ; Clear a rectangular area on screen, erasing sprites, ; changing tile and changing colour depending on flags. ; Invalidate the area so that it is drawn in the next update. ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; l = tile ; a = bit 0 set for tiles, bit 1 set for tile colours, bit 2 set for sprites ; uses : af, bc, de, hl, af', ix, iy .SP1ClearRectInv and $07 ret z ; ret if all flags reset push hl call sp1_ClearRect_callee + ASMDISP_SP1CRSELECT ; ix = address of operation code (depending on flags passed in) call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct update pop de ; d = attr, e = tile ld iy,(SP1V_UPDATELISTT) ; iy = last struct sp1_update in draw queue .rowloop push bc ; save b = width push hl ; save update position .colloop ld a,$80 xor (hl) jp p, alreadyinv ; if this update struct already invalidated, skip ahead ld (hl),a ld (iy+5),h ; store link in last invalidated update struct to this struct update ld (iy+6),l ld a,l ; make this update struct the last one in invalidated list ld iyl,a ; "ld iyl,l" is likely taken as "ld iyl,iyl" ld a,h ld iyh,a .alreadyinv call l_jpix ; apply operation on hl, advance hl to next struct sp1_update to the right djnz colloop pop hl ld bc,9*SP1V_DISPWIDTH add hl,bc pop bc dec c jp nz, rowloop ld (iy+5),0 ld (SP1V_UPDATELISTT),iy ret DEFC ASMDISP_SP1_CLEARRECTINV_CALLEE = asmentry - sp1_ClearRectInv_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_GetTiles_callee.asm0000644000175000017500000000304110761347506026751 0ustar tygrystygrys; void __CALLEE__ sp1_GetTiles_callee(struct sp1_Rect *r, struct sp1_tp *dest) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_GetTiles_callee XDEF ASMDISP_SP1_GETTILES_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH .sp1_GetTiles_callee pop af pop hl ex (sp),hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl push af .asmentry ; Copy colour and tile from background into destination array. Can ; be printed to screen as a macro by SP1PutTiles. ; ; enter : hl = & struct sp1_tp[] destination array to store tile info ; d = row coord ; e = col coord ; b = width ; c = height ; uses : af, bc, de, hl, ixl .SP1GetTiles push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update pop de ; de = dest address inc hl ld ixl,c ; ixl = height ld c,$ff .rowloop push bc ; save b = width push hl ; save update position .colloop ldi ldi ld a,7 add a,l ld l,a jp nc, noinc inc h .noinc djnz colloop pop hl ; hl = & struct sp1_update in same row leftmost column ld bc,9*SP1V_DISPWIDTH add hl,bc ; hl = & struct sp1_update in next row leftmost column pop bc dec ixl jp nz, rowloop ret DEFC ASMDISP_SP1_GETTILES_CALLEE = asmentry - sp1_GetTiles_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_PrintAt.asm0000644000175000017500000000053610756777120025316 0ustar tygrystygrys; void sp1_PrintAt(uchar row, uchar col, uint tile) ; CALLER linkage for function pointers XLIB sp1_PrintAt LIB sp1_PrintAt_callee XREF ASMDISP_SP1_PRINTAT_CALLEE .sp1_PrintAt ld hl,2 add hl,sp ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl inc hl ld d,(hl) jp sp1_PrintAt_callee + ASMDISP_SP1_PRINTAT_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_PrintAt_callee.asm0000644000175000017500000000127610756777120026625 0ustar tygrystygrys; void __CALLEE__ sp1_PrintAt_callee(uchar row, uchar col, uint tile) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_PrintAt_callee XDEF ASMDISP_SP1_PRINTAT_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_PrintAt_callee pop af pop bc pop de pop hl ld d,l push af .asmentry ; Print tile and colour to given coordinate. ; ; enter : d = row coord ; e = col coord ; bc = tile code ; uses : af, de, hl .SP1PrintAt call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE inc hl ld (hl),c inc hl ld (hl),b ret DEFC ASMDISP_SP1_PRINTAT_CALLEE = asmentry - sp1_PrintAt_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_PrintAtInv.asm0000644000175000017500000000056310756777120025773 0ustar tygrystygrys; void sp1_PrintAtInv(uchar row, uchar col, uint tile) ; CALLER linkage for function pointers XLIB sp1_PrintAtInv LIB sp1_PrintAtInv_callee XREF ASMDISP_SP1_PRINTATINV_CALLEE .sp1_PrintAtInv ld hl,2 add hl,sp ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl inc hl ld d,(hl) jp sp1_PrintAtInv_callee + ASMDISP_SP1_PRINTATINV_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_PrintAtInv_callee.asm0000644000175000017500000000313410756777120027275 0ustar tygrystygrys; void __CALLEE__ sp1_PrintAtInv_callee(uchar row, uchar col, uint tile) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_PrintAtInv_callee XDEF ASMDISP_SP1_PRINTATINV_CALLEE LIB sp1_GetUpdateStruct_callee, sp1_PrintAt_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, ASMDISP_SP1_PRINTAT_CALLEE XREF SP1V_UPDATELISTT .sp1_PrintAtInv_callee pop af pop bc pop de pop hl ld d,l push af .asmentry ; Print tile and colour to given coordinate and invalidate ; the tile so that it is redrawn in the next update. ; ; enter : d = row coord ; e = col coord ; bc = tile code ; uses : af, bc, de, hl .SP1PrintAtInv call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ld a,(hl) xor $80 jp p, sp1_PrintAt_callee + ASMDISP_SP1_PRINTAT_CALLEE + 3 ; if already marked for invalidation just do PrintAt ld (hl),a ; mark struct_sp1_update as invalidated ld e,l ld d,h ; de = & struct sp1_update inc hl ld (hl),c ; write tile inc hl ld (hl),b inc hl inc hl inc hl ld (hl),0 ; mark no struct sp1_update following in invalidated list ld hl,(SP1V_UPDATELISTT) ; current last sp1_update in invalidated list ld bc,5 add hl,bc ld (hl),d ; store this new sp1_update into current tail inc hl ld (hl),e ld (SP1V_UPDATELISTT),de ; this new struct sp1_update is now the tail in invalidated list ret DEFC ASMDISP_SP1_PRINTATINV_CALLEE = asmentry - sp1_PrintAtInv_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_PutTiles_callee.asm0000644000175000017500000000374010761347506027010 0ustar tygrystygrys; void __CALLEE__ sp1_PutTiles_callee(struct sp1_Rect *r, struct sp1_tp *src) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_PutTiles_callee XDEF ASMDISP_SP1_PUTTILES_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH .sp1_PutTiles_callee pop af pop hl ex (sp),hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl push af .asmentry ; Copy a rectangular set of tiles to screen. The ; source array can be filled in by SP1GetTiles. ; ; enter : hl = struct sp1_tp[] array of attr/tile pairs ; d = row coord ; e = col coord ; b = width ; c = height ; uses : af, bc, de, hl, ixl .SP1PutTiles push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update pop de ; de = struct sp1_tp * inc hl ex de,hl ; hl = struct sp1_tp *, de = & struct sp1_update ld ixl,c ; ixl = height ld c,$ff .rowloop push bc ; save b = width push de ; save update position .colloop ldi ; copy colour and tile from struct sp1_tp[] ldi ; into struct sp1_update ld a,7 add a,e ld e,a jp nc, noinc inc d ; de = next struct sp1_update * one column to right .noinc djnz colloop ex (sp),hl ; hl = struct sp1_update * in same row but leftmost column ld bc,9*SP1V_DISPWIDTH add hl,bc ; hl = struct sp1_update * one row down leftmost column pop de ex de,hl ; de = struct sp1_update * down one row, hl = struct sp1_tp[] pop bc ; b = width dec ixl jp nz, rowloop ret DEFC ASMDISP_SP1_PUTTILES_CALLEE = asmentry - sp1_PutTiles_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_PutTilesInv_callee.asm0000644000175000017500000000500710756777120027466 0ustar tygrystygrys; void __CALLEE__ sp1_PutTilesInv_callee(struct sp1_Rect *r, struct sp1_tp *src) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_PutTilesInv_callee XDEF ASMDISP_SP1_PUTTILESINV_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE XREF SP1V_DISPWIDTH, SP1V_UPDATELISTT .sp1_PutTilesInv_callee pop af pop hl ex (sp),hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl push af .asmentry ; Copy a rectangular set of tiles and colours to screen. The ; source array can be filled in by SP1GetTiles. Invalidate ; the rectangular area so that it is drawn in the next update. ; ; enter : hl = struct sp1_tp[] array of attr/tile pairs ; d = row coord ; e = col coord ; b = width ; c = height ; uses : af, bc, de, hl, af', ix .SP1PutTilesInv push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update pop de ; de = struct sp1_tp * ex de,hl ; hl = struct sp1_tp *, de = & struct sp1_update ld a,c ; a = height ld c,$ff ld ix,(SP1V_UPDATELISTT) .rowloop push bc ; save b = width push de ; save update position ex af,af ; a' = height .colloop ld a,(de) xor $80 jp p, skipinval ; bit 7 now reset if already invalidated ld (de),a ld (ix+5),d ; this struct sp1_update to end of list ld (ix+6),e ld ixl,e ld ixh,d .skipinval inc de ldi ; copy colour tile from struct sp1_tp[] ldi ; into struct sp1_update ld a,6 add a,e ld e,a jp nc, noinc inc d ; de = next struct sp1_update * one column to right .noinc djnz colloop ex (sp),hl ; hl = struct sp1_update * in same row but leftmost column ld bc,9*SP1V_DISPWIDTH add hl,bc ; hl = struct sp1_update * one row down leftmost column pop de ex de,hl ; de = struct sp1_update * down one row, hl = struct sp1_tp[] pop bc ; b = width ex af,af ; a = height dec a jp nz, rowloop ld (ix+5),0 ld (SP1V_UPDATELISTT),ix ret DEFC ASMDISP_SP1_PUTTILESINV_CALLEE = asmentry - sp1_PutTilesInv_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_ScreenStr_callee.asm0000644000175000017500000000126310756777120027150 0ustar tygrystygrys; uint __CALLEE__ sp1_ScreenStr_callee(uchar row, uchar col) ; 01.2008 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version XLIB sp1_ScreenStr_callee XDEF ASMDISP_SP1_SCREENSTR_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_ScreenStr_callee pop hl pop de ex (sp),hl ld d,l .asmentry ; Return tile at background coord given. ; ; enter d = row coord ; e = col coord ; exit hl = tile ; uses af, de, hl .SP1ScreenStr call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE inc hl ld e,(hl) inc hl ld d,(hl) ex de,hl ret DEFC ASMDISP_SP1_SCREENSTR_CALLEE = asmentry - sp1_ScreenStr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/sp1_SetPrintPos_callee.asm0000644000175000017500000000162010756777120027467 0ustar tygrystygrys; void __CALLEE__ sp1_SetPrintPos_callee(struct sp1_pss *ps, uchar row, uchar col) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_SetPrintPos_callee XDEF ASMDISP_SP1_SETPRINTPOS_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_SetPrintPos_callee pop af pop de pop hl ld d,l pop hl push af .asmentry ; e = col ; d = row ; hl = struct sp1_pss *ps ld c,(hl) inc hl ld b,(hl) ; bc = & bounds rectangle inc hl inc hl ld (hl),e inc hl ld (hl),d inc hl push hl ; stack & sp1_pss.pos ld a,(bc) add a,d ld d,a inc bc ld a,(bc) add a,e ld e,a call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE pop de ex de,hl ld (hl),e inc hl ld (hl),d ret DEFC ASMDISP_SP1_SETPRINTPOS_CALLEE = asmentry - sp1_SetPrintPos_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/SP1PrintString.asm0000644000175000017500000002327210763354025025754 0ustar tygrystygrys; m/c entry point for print string function ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB SP1PrintString LIB sp1_GetUpdateStruct_callee, l_jpix XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE XREF SP1V_UPDATELISTT, SP1V_DISPWIDTH ; A sophisticated print string function ; ; The string to print is pointed at by HL and terminates with a 0 byte. ; Characters are printed as background tiles ; with the following special character codes understood: ; ; code meaning ; ---- ------- ; 0 terminate string ; 1 NOP N* [other ports: logically AND into attribute mask N*] ; 2 gotoy N* (goto y coordinate on same column) ; 3 ywrap N* ; 4 NOP N* [other ports: attribute mask N*] ; 5 16-bit tile code follows W* ; 6 gotox N* (goto x coordinate on same line) ; 7 print string at address W* (like a subroutine call / macro for printstrings; see also 26,28) ; 8 left ; 9 right ; 10 up ; 11 down ; 12 home (to top left of bounds rectangle) ; 13 carriage return (move to start of next line in bounds rectangle) ; 14 repeat N* ; 15 endrepeat ; 16 NOP N* [other ports: ink N*] ; 17 NOP N* [other ports: paper N*] ; 18 NOP N* [other ports: flash N*] ; 19 NOP N* [other ports: bright N*] ; 20 NOP N* [other ports: attribute N*] ; 21 invalidate N* ; 22 AT y(N*),x(N*) (relative to bounds rectangle) ; 23 AT dy(N*), dx(N*) (relative to current position in bounds rectangle) ; 24 xwrap N* ; 25 yinc N* ; 26 push state ; 27 escape, next char is literal not special code ; 28 pop state ; 29 transparent char ; 30 NOP N* [other ports: logically OR into attribute mask N*] ; 31 visit : call function pointed at by ix with current struct_sp1_update as parameter ; ; * N is a single byte parameter following the code. ; * W is a 16-bit parameter following the code. ; ; All printing is done within a bounds rectangle. No printing outside this ; bounds rectangle will occur. ; ; enter: HL = address of string to print ; E = flags (bit 0 = invalidate?, bit 1 = xwrap?, bit 2 = yinc?, bit3 = ywrap?) ; B = current x coordinate (relative to bounds rect IY) ; C = current y coordinate (relative to bounds rect IY) ; ( HL' = & tail struct sp1_update.ulist in invalidated list ) loaded here, not entry condition ; DE' = current struct sp1_update * ; IX = visit function ; IY+0 = row coordinate \ ; IY+1 = col coordinate | Bounds Rectangle ; IY+2 = width in chars | Must Fit On Screen ; IY+3 = height in chars / ; exit : same as enter ; uses : all except ix, iy ; ; The C API maintains a structure to retain the print state between calls. ; Doing something similar from assembly language may be helpful. .SP1PrintString exx ld hl,(SP1V_UPDATELISTT) ld bc,5 add hl,bc exx .psloop ld a,(hl) or a jr z, alldone inc hl cp 32 jp nc, printable ; here we have a special code [1,31] push hl ld d,a add a,a ; get address of handler from jump table ld h,jumptbl/256 add a,jumptbl%256 ld l,a jp nc, nospill inc h .nospill ld a,(hl) inc hl ld h,(hl) ld l,a ld a,d ; restore A to code ex (sp),hl ret .alldone exx ld (hl),0 ld bc,-5 add hl,bc ld (SP1V_UPDATELISTT),hl exx ret .jumptbl defw NOP0, NOP1, codeGotoY, codeYWrap defw NOP1, codeTC, codeGotoX, codePString defw codeLeft, codeRight, codeUp, codeDown defw codeHome, codeReturn, codeRepeat, codeEndRepeat defw NOP1, NOP1, NOP1, NOP1 defw NOP1, codeInvalidate, codeAt, codeAtRel defw codeXWrap, codeYInc, codePush, codeEscape defw codePop, codeTransparent, NOP1, codeVisit .NOP1 inc hl ; consume a single byte parameter ; fall through to NOP0 .NOP0 jp psloop ; on to the next byte to interpret .codeVisit ld a,b ; only visit if inbounds cp (iy+2) jp nc, psloop ld a,c cp (iy+3) jp nc, psloop push bc push de push hl exx push hl push de ex de,hl call l_jpix pop de pop hl exx pop hl pop de pop bc jp psloop .codeYWrap ld a,(hl) ; parameter following YWRAP (0/1) inc hl rra jp nc, noywrap set 3,e jp psloop .noywrap res 3,e jp psloop .codeEscape ld a,(hl) ; char following ESCAPE inc hl jp printable .codePop exx pop de exx pop de pop bc jp psloop .codePush push bc push de exx push de exx jp psloop .codeYInc ld a,(hl) ; parameter following YINC (0/1) inc hl rra jp nc, noywrap5 set 2,e jp psloop .noywrap5 res 2,e jp psloop .codeXWrap ld a,(hl) ; parameter following XWRAP (0/1) inc hl rra jp nc, noxwrap set 1,e jp psloop .noxwrap res 1,e jp psloop .codeAtRel ld a,(hl) add a,c ld c,a inc hl ld a,(hl) add a,b ld b,a inc hl jp computenewupdate .codeAt ld c,(hl) inc hl ld b,(hl) inc hl jp computenewupdate .codeGotoX ld b,(hl) inc hl jp computenewupdate .codeGotoY ld c,(hl) inc hl jp computenewupdate .codePString ld a,(hl) inc hl ld d,(hl) inc hl push hl ld h,d ld l,a call psloop pop hl jp psloop .codeInvalidate ld a,(hl) ; parameter following INVALIDATE (0/1) inc hl srl e rra rl e jp psloop .codeHome ld bc,0 jp computenewupdate .codeReturn ld b,0 inc c jp computenewupdate .codeRepeat ld a,(hl) ; # times to repeat inc hl .reploop push hl ; save string position at start of repeat block push af ; save # remaining iterations call psloop ; returns after endrepeat or 0 terminator pop af dec a ; any more iterations? jr z, nomoreiter pop hl ; restore string pointer for next repeat jp reploop .nomoreiter pop af ; trash saved string position jp psloop .codeEndRepeat ret .codeTC ; a 16 bit tile code follows ; first check if in bounds ld a,b cp (iy+2) jr nc, codeRight2 ld a,c cp (iy+3) jr nc, codeRight2 ; are we invalidating? bit 0,e push hl exx jr z, noinvalidation2 ; invalidate the char ld a,(de) xor $80 jp p, noinvalidation2 ; if already invalidated, skip ld (de),a ld (hl),d inc hl ld (hl),e ld hl,5 add hl,de .noinvalidation2 pop bc ; bc = & 16-bit tile ld a,(bc) inc de ld (de),a ; write tile into sp1_update inc bc ld a,(bc) inc de ld (de),a dec de dec de exx .codeRight2 ; skip 16-bit tile code in string inc hl inc hl ; advance to next char on right jp codeRight .codeTransparent ; are we invalidating? bit 0,e jp z, codeRight ; invalidate the char exx ld a,(de) xor $80 jp p, noinvalidation20 ; if already invalidated, skip ld (de),a ld (hl),d inc hl ld (hl),e ld hl,5 add hl,de .noinvalidation20 exx jp codeRight .printable ; a = tile# ex af,af ; first check if in bounds ld a,b cp (iy+2) jr nc, codeRight ld a,c cp (iy+3) jr nc, codeRight ; are we invalidating? bit 0,e exx jr z, noinvalidation ; invalidate the char ld a,(de) xor $80 jp p, noinvalidation ; if already invalidated, skip ld (de),a ld (hl),d inc hl ld (hl),e ld hl,5 add hl,de .noinvalidation ex de,hl inc hl ex af,af ld (hl),a ; store tile inc hl ld (hl),0 ; advance to next char on right dec hl dec hl ex de,hl exx .codeRight inc b ; increase x coord bit 1,e ; are we doing x wrap? jr nz, yesxwrap .inxbounds exx ; move update struct to right ld a,9 add a,e ld e,a jp nc, noinc1 inc d .noinc1 exx jp psloop .yesxwrap ld a,b cp (iy+2) jr c, inxbounds ld b,0 bit 2,e ; are we doing yinc? jr z, noyinc inc c bit 3,e ; are we doing ywrap? jr z, noyinc ld a,c cp (iy+3) jr c, noyinc ld c,0 .noyinc .computenewupdate ; need to compute struct sp1_update for new coords push bc exx ex (sp),hl ld a,(iy+0) add a,l ld d,a ld a,(iy+1) add a,h ld e,a call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ex de,hl pop hl exx jp psloop .codeLeft dec b bit 1,e jr nz, yesxwrap2 .inxbounds2 exx ld a,-9 add a,e ld e,a ld a,$ff adc a,d ld d,a exx jp psloop .yesxwrap2 ld a,b cp (iy+2) jr c, inxbounds2 ld b,(iy+2) dec b bit 2,e jr z, computenewupdate dec c bit 3,e jr z, computenewupdate ld a,c cp (iy+3) jr c, computenewupdate ld c,(iy+3) dec c jp computenewupdate .codeUp dec c bit 3,e jr nz, yesywrap .inybounds exx ld a,-SP1V_DISPWIDTH*9 add a,e ld e,a ld a,#(((SP1V_DISPWIDTH*9):$ffff)+1)/256 adc a,d ld d,a exx jp psloop .yesywrap ld a,c cp (iy+3) jr c, inybounds ld c,(iy+3) dec c jp computenewupdate .codeDown inc c bit 3,e jr nz, yesywrap2 .inybounds2 exx ld a,0+(SP1V_DISPWIDTH*9)%256 add a,e ld e,a ld a,0+(SP1V_DISPWIDTH*9)/256 adc a,d ld d,a exx jp psloop .yesywrap2 ld a,c cp (iy+3) jr c, inybounds2 ld c,0 jp computenewupdate z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/SP1PSPOP.asm0000644000175000017500000000226710763353743024401 0ustar tygrystygrys; subroutine for reading the contents of a "struct sp1_pss" into registers ; 02.2008 aralbrec ; ts2068 hi-res version XLIB SP1PSPOP ; enter : de = & string to print (or something else) ; hl = & struct sp1_pss to read ; ; exit : hl = address of string to print ; e = flags (bit 0 = invalidate?, bit 1 = xwrap?, bit 2 = yinc?, bit3 = ywrap?) ; b = current x coordinate (relative to bounds rect IY) ; c = current y coordinate (relative to bounds rect IY) ; de' = current struct sp1_update * ; ix = visit function ; iy = bounds rectangle .SP1PSPOP ld a,(hl) ld iyl,a inc hl ld a,(hl) ld iyh,a ; iy = & bounds rectangle inc hl ld a,(hl) ; a = flags inc hl ld b,(hl) ; b = x coordinate inc hl ld c,(hl) ; c = y coordinate inc hl push hl ex de,hl ; hl = & string ld e,a ; e = flags exx pop hl ld e,(hl) inc hl ld d,(hl) ; de' = & struct sp1_update inc hl ld a,(hl) ld ixl,a inc hl ld a,(hl) ld ixh,a ; ix = visit function exx ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/tiles/SP1PSPUSH.asm0000644000175000017500000000174610763353743024523 0ustar tygrystygrys; subroutine for writing registers to "struct sp1_pss" ; 02.2008 aralbrec ; ts2068 hi-res version XLIB SP1PSPUSH ; exit : hl = & struct sp1_pss to write to ; e = flags (bit 0 = invalidate?, bit 1 = xwrap?, bit 2 = yinc?, bit3 = ywrap?) ; b = current x coordinate (relative to bounds rect IY) ; c = current y coordinate (relative to bounds rect IY) ; de' = current struct sp1_update * ; ix = visit function ; iy = bounds rectangle .SP1PSPUSH ld a,iyl ; write bounds rectangle ld (hl),a inc hl ld a,iyh ld (hl),a inc hl ld (hl),e ; write flags inc hl ld (hl),b ; write x coordinate inc hl ld (hl),c ; write y coordinate inc hl push hl exx pop hl ld (hl),e ; write sp1_update inc hl ld (hl),d inc hl ld a,ixl ; write visit function ld (hl),a inc hl ld a,ixh ld (hl),a ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/ts2068hr-customize.asm0000644000175000017500000000571510757251102025342 0ustar tygrystygrys ; CUSTOMIZATION TEMPLATE FOR SP1 ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version ; See below for Memory Map with these default settings ; /////////////////////// ; Display Characteristics ; /////////////////////// defc SP1V_DISPORIGX = 0 ; x coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPORIGY = 0 ; y coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPWIDTH = 64 ; width of area managed by sp1 in characters (16, 24, 32, 40, 48, 56, 64 ok as of now) defc SP1V_DISPHEIGHT = 24 ; height of area managed by sp1 in characters ; /////////////////////// ; Buffers ; /////////////////////// defc SP1V_PIXELBUFFER = $b9f8 ; address of an 8-byte buffer to hold intermediate pixel-draw results ; /////////////////////// ; Data Structures ; /////////////////////// defc SP1V_TILEARRAY = $f000 ; address of the 512-byte tile array associating character codes with tile graphics, must lie on 256-byte boundary (LSB=0) defc SP1V_UPDATEARRAY = $ba00 ; address of the 9*SP1V_DISPWIDTH*SP1V_DISPHEIGHT byte update array defc SP1V_ROTTBL = $f000 ; location of the 3584-byte rotation table. Must lie on 256-byte boundary (LSB=0). Table begins $0200 bytes ahead of this ; pointer ($f200-$ffff in this default case). Set to $0000 if the table is not needed (if, for example, all sprites ; are drawn at exact horizontal character coordinates or you use pre-shifted sprites only). ; /////////////////////// ; SP1 Variables ; /////////////////////// defc SP1V_UPDATELISTH = $b9ef ; address of 9-byte area holding a dummy struct_sp1_update that is always the "first" in list of screen tiles to be drawn defc SP1V_UPDATELISTT = $b9f0 ; address of 2-byte variable holding the address of the last struct_sp1_update in list of screen tiles to be drawn ; NOTE: SP1V_UPDATELISTT is located inside the dummy struct_sp1_update pointed at by SP1V_UPDATELISTH ; /////////////////////// ; DEFAULT MEMORY MAP ; /////////////////////// ; With these default settings the memory map is: ; ; ADDRESS (HEX) LIBRARY DESCRIPTION ; ; f200 - ffff SP1.LIB horizontal rotation tables ; f000 - f1ff SP1.LIB tile array ; ba00 - efff SP1.LIB update array for 64x24 display ; b9f8 - b9ff SP1.LIB pixel buffer ; b9ef - b9f7 SP1.LIB update list head - a dummy struct sp1_update acting as first in invalidated list ; * b9f0 - b9f1 SP1.LIB update list tail pointer (inside dummy struct sp1_update) ; b9bc - b9ee --free- 51 bytes free ; b9b9 - b9bb ------- JP to im2 service routine (im2 table filled with 0xb9 bytes) ; b901 - b9b8 --free- 184 bytes free ; b800 - b900 IM2.LIB im2 vector table (257 bytes) ; b600 - b7ff ------- z80 stack (512 bytes) set SP=b800 ; z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/ts2068hr-sp1.h0000644000175000017500000005352310756777117023514 0ustar tygrystygrys #ifndef _SP1_H #define _SP1_H /////////////////////////////////////////////////////////// // SPRITE PACK v3.0 // // Timex Sinclair 2068 Hi-Res Version // // aralbrec - Jan 2008 // // ported from sinclair spectrum version // /////////////////////////////////////////////////////////// // // // See the wiki for documentation details // // http://www.z88dk.org/wiki // // // /////////////////////////////////////////////////////////// #include #include /////////////////////////////////////////////////////////// // DATA STRUCTURES // /////////////////////////////////////////////////////////// struct sp1_Rect { uchar row; uchar col; uchar width; uchar height; }; struct sp1_update; struct sp1_ss; struct sp1_cs; struct sp1_update { // "update structs" - 9 bytes - Every tile in the display area managed by SP1 is described by one of these uchar nload; // +0 bit 7 = 1 for invalidated, bit 6 = 1 for removed, bits 5:0 = number of occluding sprites present + 1 uint tile; // +1 background 16-bit tile code (if MSB != 0 taken as address of graphic, else lookup in tile array) struct sp1_cs *slist; // +3 BIG ENDIAN ; list of sprites occupying this tile (MSB = 0 if none) points at struct sp1_cs.ss_draw struct sp1_update *ulist; // +5 BIG ENDIAN ; next update struct in list of update structs queued for draw (MSB = 0 if none) uchar *screen; // +7 address in display file where this tile is drawn }; struct sp1_ss { // "sprite structs" - 20 bytes - Every sprite is described by one of these uchar row; // +0 current y tile-coordinate uchar col; // +1 current x tile-coordinate uchar width; // +2 width of sprite in tiles uchar height; // +3 height of sprite in tiles uchar vrot; // +4 bit 7 = 1 for 2-byte graphical definition else 1-byte, bits 2:0 = current vertical rotation (0..7) uchar hrot; // +5 current horizontal rotation (0..7) uchar *frame; // +6 current sprite frame address added to graphic pointers uchar res0; // +8 "LD A,n" opcode uchar e_hrot; // +9 effective horizontal rotation = MSB of rotation table to use uchar res1; // +10 "LD BC,nn" opcode uint e_offset; // +11 effective offset to add to graphic pointers, equals result of vertical rotation + frame addr uchar res2; // +13 "EX DE,HL" opcode uchar res3; // +14 "JP (HL)" opcode struct sp1_cs *first; // +15 BIG ENDIAN ; first struct sp1_cs of this sprite uchar xthresh; // +17 hrot must be at least this number of pixels for last column of sprite to be drawn (1 default) uchar ythresh; // +18 vrot must be at least this number of pixels for last row of sprite to be drawn (1 default) uchar nactive; // +19 number of struct sp1_cs cells on display (written by sp1_MoveSpr*) }; struct sp1_cs { // "char structs" - 22 bytes - Every sprite is broken into pieces fitting into a tile, each of which is described by one of these struct sp1_cs *next_in_spr; // +0 BIG ENDIAN ; next sprite char within same sprite in row major order (MSB = 0 if none) struct sp1_update *update; // +2 BIG ENDIAN ; tile this sprite char currently occupies (MSB = 0 if none) uchar plane; // +4 plane sprite occupies, 0 = closest to viewer uchar type; // +5 bit 7 = 1 occluding, bit 6 = 1 last column, bit 5 = 1 last row, bit 4 = 1 clear pixelbuffer void *ss_draw; // +6 struct sp1_ss + 8 bytes ; points at code embedded in sprite struct sp1_ss uchar res0; // +8 typically "LD HL,nn" opcode uchar *def; // +9 graphic definition pointer uchar res1; // +11 typically "LD IX,nn" opcode uchar res2; // +12 uchar *l_def; // +13 graphic definition pointer for sprite character to left of this one uchar res3; // +15 typically "CALL nn" opcode void *draw; // +16 & draw function for this sprite char struct sp1_cs *next_in_upd; // +18 BIG ENDIAN ; & sp1_cs.ss_draw of next sprite occupying the same tile (MSB = 0 if none) struct sp1_cs *prev_in_upd; // +20 BIG ENDIAN ; & sp1_cs.next_in_upd of previous sprite occupying the same tile }; struct sp1_tp { // "tile list" - 2 bytes - A struct to hold a 16-bit tile code uint tile; // +0 tile code }; struct sp1_pss { // "print string struct" - 9 bytes - A struct holding print state information struct sp1_Rect *bounds; // +0 rectangular boundary within which printing will be allowed uchar flags; // +2 bit 0=invalidate?, 1=xwrap?, 2=yinc?, 3=ywrap? uchar x; // +3 current x coordinate of cursor with respect to top left corner of bounds uchar y; // +4 current y coordinate of cursor with respect to top left corner of bounds struct sp1_update *pos; // +5 RESERVED struct sp1_update associated with current cursor coordinates void *visit; // +7 void (*visit)(struct sp1_update *) function, set to 0 for none }; /////////////////////////////////////////////////////////// // SPRITES // /////////////////////////////////////////////////////////// // sprite type bits #define SP1_TYPE_OCCLUDE 0x80 // background and sprites underneath will not be drawn #define SP1_TYPE_BGNDCLR 0x10 // for occluding sprites, copy background tile into pixel buffer before draw #define SP1_TYPE_2BYTE 0x40 // sprite graphic consists of (mask,graph) pairs, valid only in sp1_CreateSpr() #define SP1_TYPE_1BYTE 0x00 // sprite graphic consists of graph only, valid only in sp1_CreateSpr() // prototype struct_sp1_ss and struct_sp1_cs that can be used to initialize empty structures extern struct sp1_cs sp1_struct_cs_prototype; extern struct sp1_ss sp1_struct_ss_prototype; // draw functions for sprites with two-byte graphical definitions, ie (mask,graphic) pairs extern void __LIB__ SP1_DRAW_MASK2(void); // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation will use MASK2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_MASK2NR(void); // masked sprite 2-byte definition (mask,graph) pairs ; no rotation applied, graphic always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_MASK2LB(void); // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation as MASK2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_MASK2RB(void); // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation as MASK2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD2(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use LOAD2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_LOAD2NR(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_LOAD2LB(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD2RB(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_OR2(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use OR2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_OR2NR(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_OR2LB(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as OR2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_OR2RB(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as OR2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_XOR2(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use XOR2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_XOR2NR(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_XOR2LB(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as XOR2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_XOR2RB(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as XOR2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD2LBIM(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for left boundary of sprite w/ implied mask extern void __LIB__ SP1_DRAW_LOAD2RBIM(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for right boundary of sprite w/ implied mask // draw functions for sprites with one-byte graphical definitions, ie no mask just graphics extern void __LIB__ SP1_DRAW_LOAD1(void); // load sprite 1-byte definition graph only no mask; sw rotation will use LOAD1_NR if no rotation necessary extern void __LIB__ SP1_DRAW_LOAD1NR(void); // load sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_LOAD1LB(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD1RB(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_OR1(void); // or sprite 1-byte definition graph only no mask; sw rotation will use OR1_NR if no rotation necessary extern void __LIB__ SP1_DRAW_OR1NR(void); // or sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_OR1LB(void); // or sprite 1-byte definition graph only no mask; sw rotation as OR1 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_OR1RB(void); // or sprite 1-byte definition graph only no mask; sw rotation as OR1 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_XOR1(void); // xor sprite 1-byte definition graph only no mask; sw rotation will use XOR1_NR if no rotation necessary extern void __LIB__ SP1_DRAW_XOR1NR(void); // xor sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_XOR1LB(void); // xor sprite 1-byte definition graph only no mask; sw rotation as XOR1 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_XOR1RB(void); // xor sprite 1-byte definition graph only no mask; sw rotation as XOR1 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD1LBIM(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for left boundary of sprite with implied mask extern void __LIB__ SP1_DRAW_LOAD1RBIM(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for right boundary of sprite with implied mask // void *hook1 <-> void [ __FASTCALL__ ] (*hook1)(uint count, struct sp1_cs *c) // if __FASTCALL__ only struct sp1_cs* passed // void *hook2 <-> void [ __FASTCALL__ ] (*hook2)(uint count, struct sp1_update *u) // if __FASTCALL__ only struct sp1_update* passed // // void *drawf <-> void (*drawf)(void) // sprite draw function containing draw code and data for struct_sp1_cs extern struct sp1_ss __LIB__ *sp1_CreateSpr(void *drawf, uchar type, uchar height, int graphic, uchar plane); extern uint __LIB__ sp1_AddColSpr(struct sp1_ss *s, void *drawf, uchar type, int graphic, uchar plane); extern void __LIB__ sp1_ChangeSprType(struct sp1_cs *c, void *drawf); extern void __FASTCALL__ __LIB__ sp1_DeleteSpr(struct sp1_ss *s); // only call after sprite is moved off screen extern void __LIB__ sp1_MoveSprAbs(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot); extern void __LIB__ sp1_MoveSprRel(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot); extern void __LIB__ sp1_MoveSprPix(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uint x, uint y); extern void __LIB__ sp1_IterateSprChar(struct sp1_ss *s, void *hook1); extern void __LIB__ sp1_IterateUpdateSpr(struct sp1_ss *s, void *hook2); extern void __LIB__ *sp1_PreShiftSpr(uchar flag, uchar height, uchar width, void *srcframe, void *destframe, uchar rshift); // some functions for displaying independent struct_sp1_cs not connected with any sprites; useful as foreground elements // if not using a no-rotate (NR) type sprite draw function, must manually init the sp1_cs.ldef member after calling sp1_InitCharStruct() extern void __LIB__ sp1_InitCharStruct(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane); extern void __LIB__ sp1_InsertCharStruct(struct sp1_update *u, struct sp1_cs *cs); extern void __FASTCALL__ __LIB__ sp1_RemoveCharStruct(struct sp1_cs *cs); /* CALLEE LINKAGE */ extern struct sp1_ss __CALLEE__ __LIB__ *sp1_CreateSpr_callee(void *drawf, uchar type, uchar height, int graphic, uchar plane); extern uint __CALLEE__ __LIB__ sp1_AddColSpr_callee(struct sp1_ss *s, void *drawf, uchar type, int graphic, uchar plane); extern void __CALLEE__ __LIB__ sp1_MoveSprAbs_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot); extern void __CALLEE__ __LIB__ sp1_MoveSprRel_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot); extern void __CALLEE__ __LIB__ sp1_MoveSprPix_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uint x, uint y); extern void __CALLEE__ __LIB__ sp1_IterateSprChar_callee(struct sp1_ss *s, void *hook1); extern void __CALLEE__ __LIB__ sp1_IterateUpdateSpr_callee(struct sp1_ss *s, void *hook2); extern void __CALLEE__ __LIB__ sp1_ChangeSprType_callee(struct sp1_cs *c, void *drawf); extern void __CALLEE__ __LIB__ *sp1_PreShiftSpr_callee(uchar flag, uchar height, uchar width, void *srcframe, void *destframe, uchar rshift); extern void __CALLEE__ __LIB__ sp1_InitCharStruct_callee(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane); extern void __CALLEE__ __LIB__ sp1_InsertCharStruct_callee(struct sp1_update *u, struct sp1_cs *cs); #define sp1_CreateSpr(a,b,c,d,e) sp1_CreateSpr_callee(a,b,c,d,e) #define sp1_AddColSpr(a,b,c,d,e) sp1_AddColSpr_callee(a,b,c,d,e) #define sp1_MoveSprAbs(a,b,c,d,e,f,g) sp1_MoveSprAbs_callee(a,b,c,d,e,f,g) #define sp1_MoveSprRel(a,b,c,d,e,f,g) sp1_MoveSprRel_callee(a,b,c,d,e,f,g) #define sp1_MoveSprPix(a,b,c,d,e) sp1_MoveSprPix_callee(a,b,c,d,e) #define sp1_IterateSprChar(a,b) sp1_IterateSprChar_callee(a,b) #define sp1_IterateUpdateSpr(a,b) sp1_IterateUpdateSpr_callee(a,b) #define sp1_ChangeSprType(a,b) sp1_ChangeSprType_callee(a,b) #define sp1_PreShiftSpr(a,b,c,d,e,f) sp1_PreShiftSpr_callee(a,b,c,d,e,f) #define sp1_InitCharStruct(a,b,c,d,e) sp1_InitCharStruct_callee(a,b,c,d,e) #define sp1_InsertCharStruct(a,b) sp1_InsertCharStruct_callee(a,b) /////////////////////////////////////////////////////////// // COLLISION DETECTION // /////////////////////////////////////////////////////////// // BEING REVIEWED FOR CHANGES /////////////////////////////////////////////////////////// // TILES // /////////////////////////////////////////////////////////// #define SP1_RFLAG_TILE 0x01 #define SP1_RFLAG_SPRITE 0x04 #define SP1_PSSFLAG_INVALIDATE 0x01 #define SP1_PSSFLAG_XWRAP 0x02 #define SP1_PSSFLAG_YINC 0x04 #define SP1_PSSFLAG_YWRAP 0x08 extern void __LIB__ *sp1_TileEntry(uchar c, void *def); extern void __LIB__ sp1_PrintAt(uchar row, uchar col, uint tile); extern void __LIB__ sp1_PrintAtInv(uchar row, uchar col, uint tile); extern uint __LIB__ sp1_ScreenStr(uchar row, uchar col); extern void __LIB__ sp1_PrintString(struct sp1_pss *ps, uchar *s); extern void __LIB__ sp1_SetPrintPos(struct sp1_pss *ps, uchar row, uchar col); extern void __LIB__ sp1_GetTiles(struct sp1_Rect *r, struct sp1_tp *dest); extern void __LIB__ sp1_PutTiles(struct sp1_Rect *r, struct sp1_tp *src); extern void __LIB__ sp1_PutTilesInv(struct sp1_Rect *r, struct sp1_tp *src); extern void __LIB__ sp1_ClearRect(struct sp1_Rect *r, uchar tile, uchar rflag); extern void __LIB__ sp1_ClearRectInv(struct sp1_Rect *r, uchar tile, uchar rflag); /* CALLEE LINKAGE */ extern void __CALLEE__ __LIB__ *sp1_TileEntry_callee(uchar c, void *def); extern void __CALLEE__ __LIB__ sp1_PrintAt_callee(uchar row, uchar col, uint tile); extern void __CALLEE__ __LIB__ sp1_PrintAtInv_callee(uchar row, uchar col, uint tile); extern uint __CALLEE__ __LIB__ sp1_ScreenStr_callee(uchar row, uchar col); extern void __CALLEE__ __LIB__ sp1_PrintString_callee(struct sp1_pss *ps, uchar *s); extern void __CALLEE__ __LIB__ sp1_SetPrintPos_callee(struct sp1_pss *ps, uchar row, uchar col); extern void __CALLEE__ __LIB__ sp1_GetTiles_callee(struct sp1_Rect *r, struct sp1_tp *dest); extern void __CALLEE__ __LIB__ sp1_PutTiles_callee(struct sp1_Rect *r, struct sp1_tp *src); extern void __CALLEE__ __LIB__ sp1_PutTilesInv_callee(struct sp1_Rect *r, struct sp1_tp *src); extern void __CALLEE__ __LIB__ sp1_ClearRect_callee(struct sp1_Rect *r, uchar tile, uchar rflag); extern void __CALLEE__ __LIB__ sp1_ClearRectInv_callee(struct sp1_Rect *r, uchar tile, uchar rflag); #define sp1_TileEntry(a,b) sp1_TileEntry_callee(a,b) #define sp1_PrintAt(a,b,c) sp1_PrintAt_callee(a,b,c) #define sp1_PrintAtInv(a,b,c) sp1_PrintAtInv_callee(a,b,c) #define sp1_ScreenStr(a,b) sp1_ScreenStr_callee(a,b) #define sp1_PrintString(a,b) sp1_PrintString_callee(a,b) #define sp1_SetPrintPos(a,b,c) sp1_SetPrintPos_callee(a,b,c) #define sp1_GetTiles(a,b) sp1_GetTiles_callee(a,b) #define sp1_PutTiles(a,b) sp1_PutTiles_callee(a,b) #define sp1_PutTilesInv(a,b) sp1_PutTilesInv_callee(a,b) #define sp1_ClearRect(a,b,c) sp1_ClearRect_callee(a,b,c) #define sp1_ClearRectInv(a,b,c) sp1_ClearRectInv_callee(a,b,c) /////////////////////////////////////////////////////////// // UPDATER // /////////////////////////////////////////////////////////// #define SP1_IFLAG_MAKE_ROTTBL 0x01 #define SP1_IFLAG_OVERWRITE_TILES 0x02 #define SP1_IFLAG_OVERWRITE_DFILE 0x04 // void *hook <-> void [ __FASTCALL__ ] (*hook)(struct sp1_update *u) extern void __LIB__ sp1_Initialize(uchar iflag, uchar tile); extern void __LIB__ sp1_UpdateNow(void); extern struct sp1_update __LIB__ *sp1_GetUpdateStruct(uchar row, uchar col); extern void __LIB__ sp1_IterateUpdateArr(struct sp1_update **ua, void *hook); // zero terminated array extern void __LIB__ sp1_IterateUpdateRect(struct sp1_Rect *r, void *hook); extern void __FASTCALL__ __LIB__ sp1_InvUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_ValUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructIfInv(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructIfVal(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructIfNotRem(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructAlways(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_RemoveUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_RestoreUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_Invalidate(struct sp1_Rect *r); extern void __FASTCALL__ __LIB__ sp1_Validate(struct sp1_Rect *r); /* CALLEE LINKAGE */ extern void __CALLEE__ __LIB__ sp1_Initialize_callee(uchar iflag, uchar tile); extern struct sp1_update __CALLEE__ __LIB__ *sp1_GetUpdateStruct_callee(uchar row, uchar col); extern void __CALLEE__ __LIB__ sp1_IterateUpdateArr_callee(struct sp1_update **ua, void *hook); extern void __CALLEE__ __LIB__ sp1_IterateUpdateRect_callee(struct sp1_Rect *r, void *hook); #define sp1_Initialize(a,b) sp1_Initialize_callee(a,b) #define sp1_GetUpdateStruct(a,b) sp1_GetUpdateStruct_callee(a,b) #define sp1_IterateUpdateArr(a,b) sp1_IterateUpdateArr_callee(a,b) #define sp1_IterateUpdateRect(a,b) sp1_IterateUpdateRect_callee(a,b) #endif z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/0000755000175000017500000000000010765202715022761 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/sp1_GetUpdateStruct_callee.asm0000644000175000017500000000555610757133754030664 0ustar tygrystygrys; struct sp1_update __CALLEE__ *sp1_GetUpdateStruct_callee(uchar row, uchar col) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version INCLUDE "ts2068hr/customize.asm" XLIB sp1_GetUpdateStruct_callee XDEF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_GetUpdateStruct_callee pop hl pop de ex (sp),hl ld d,l .asmentry ; Return struct_sp1_update for row,col coordinate given ; 9 * (SP1V_DISPWIDTH * ROW + COL) + SP1V_UPDATEARRAY ; ; enter : d = row coord ; e = col coord ; exit : hl = struct update * ; uses : af, de, hl .SP1GetUpdateStruct ld l,d ld h,0 ld a,d ld d,h cp SP1V_DISPHEIGHT jp c, nohtadj dec h .nohtadj IF SP1V_DISPWIDTH=16 add hl,hl add hl,hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de ; hl = 16 * ROW + COL ENDIF IF SP1V_DISPWIDTH=24 add hl,hl add hl,hl add hl,hl push hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de ; hl = 24 * ROW + COL ENDIF IF SP1V_DISPWIDTH=32 add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de ; hl = 32 * ROW + COL ENDIF IF SP1V_DISPWIDTH=40 add hl,hl add hl,hl add hl,hl push hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de ; hl = 40 * ROW + COL ENDIF IF SP1V_DISPWIDTH=48 add hl,hl add hl,hl add hl,hl add hl,hl push hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de ; hl = 48 * ROW + COL ENDIF IF SP1V_DISPWIDTH=56 add hl,hl add hl,hl add hl,hl push hl add hl,hl push hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de pop de add hl,de ; hl = 56 * ROW + COL ENDIF IF SP1V_DISPWIDTH=64 add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de ; hl = 64 * ROW + COL ENDIF ld d,h ld e,l add hl,hl add hl,hl add hl,hl add hl,de ; hl = 9 * (SP1V_DISPWIDTH * ROW + COL) ld de,SP1V_UPDATEARRAY add hl,de ret DEFC ASMDISP_SP1_GETUPDATESTRUCT_CALLEE = asmentry - sp1_GetUpdateStruct_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/sp1_Initialize.asm0000644000175000017500000000045010757414074026352 0ustar tygrystygrys; CALLER linkage for function pointers XLIB sp1_Initialize LIB sp1_Initialize_callee XREF ASMDISP_SP1_INITIALIZE_CALLEE .sp1_Initialize ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) inc hl ld a,(hl) ex de,hl jp sp1_Initialize_callee + ASMDISP_SP1_INITIALIZE_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/sp1_Initialize_callee.asm0000644000175000017500000001031210760516407027652 0ustar tygrystygrys; void __CALLEE__ sp1_Initialize_callee(uchar iflag, uchar tile) ; 02.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version INCLUDE "ts2068hr/customize.asm" XLIB sp1_Initialize_callee XDEF ASMDISP_SP1_INITIALIZE_CALLEE XDEF SP1V_DISPORIGX XDEF SP1V_DISPORIGY XDEF SP1V_DISPWIDTH XDEF SP1V_DISPHEIGHT XDEF SP1V_PIXELBUFFER XDEF SP1V_TILEARRAY XDEF SP1V_UPDATEARRAY XDEF SP1V_ROTTBL XDEF SP1V_UPDATELISTH XDEF SP1V_UPDATELISTT .sp1_Initialize_callee pop bc pop hl pop de ld a,e push bc .asmentry ; 1. Constructs the rotation table if SP1_IFLAG_MAKE_ROTTBL flag set ; 2. Initializes tile array so that ROM character set is used by ; default - if SP1_IFLAG_OVERWRITE_TILES flag is set will not alter ; graphic pointers for character codes set previously (any non-zero ; pointer is not touched) ; 3. Resets the invalidated list to empty ; 4. Resets the update array, generating display file addresses for ; each char square if SP1_IFLAG_OVERWRITE_DFILE flag is set ; ; enter : hl= startup background tile ; a = flag, bit 0 = 1 if rotation table needed, bit 1 = 1 to overwrite all tile defs ; bit 2 = 1 to overwrite screen addresses in update structs ; used : af, bc, de, hl, af' .SP1Initialize push hl ; save tile bit 0,a jr z, norottbl ; if flag bit not set, do not construct rotation table ; construct the rotation table ld c,7 ; rotate by c bits push af .rottbllp ld a,c add a,a or SP1V_ROTTBL/256 ld h,a ld l,0 .entrylp ld b,c ld e,l xor a .rotlp srl e rra djnz rotlp ld (hl),e inc h ld (hl),a dec h inc l jp nz, entrylp dec c jp nz, rottbllp pop af .norottbl ; initialize tile array to point to characters in ROM ld hl,SP1V_TILEARRAY ld de,15360 ld b,0 ld c,a .tileloop ld a,(hl) ; if a tile address is already present (ie non-zero entry) inc h ; then we will skip it bit 1,c jr nz, overwrite ; unless overwrite flag set or (hl) jr nz, tilepresent .overwrite ld (hl),d dec h ld (hl),e inc h .tilepresent dec h inc hl ld a,8 add a,e ld e,a ld a,0 adc a,d ld d,a djnz tileloop ; init the invalidated list ld hl,SP1V_UPDATELISTH ; this variable points at a dummy struct sp1_update that is ld (SP1V_UPDATELISTT),hl ld hl,0 ld (SP1V_UPDATELISTH+5),hl ; nothing in invalidate list ; initialize the update array pop de ; de = tile code ld b,SP1V_DISPORIGY ; b = current row coord ld hl,SP1V_UPDATEARRAY ; hl = current struct sp1_update bit 2,c ex af,af .rowloop ld c,SP1V_DISPORIGX ; c = current col coord .colloop ld (hl),1 ; # of occluding sprites in this tile + 1 inc hl ld (hl),e ; write tile code inc hl ld (hl),0 inc hl ld (hl),0 inc hl ld (hl),0 ; no sprites in the tile inc hl ld (hl),0 inc hl ld (hl),0 ; not in invalidated list inc hl ex af,af jr z, skipscrnaddr ex af,af ld a,b ; compute screen address for char coord (b,c) rrca ; and store in struct sp1_update rrca rrca and $e0 ; screen address : 010B BSSS LLLC CCCC ld d,a ld a,c rra or d ; y coord (b) : 000B BLLL ld (hl),a ; x coord (c) : 000C CCCC inc hl ld a,b and $18 or $40 bit 0,c jr z, evencol or $20 .evencol ld (hl),a .rejoinscrnaddr inc hl ; hl points at next struct sp1_update inc c ; next column ld a,c cp SP1V_DISPORIGX + SP1V_DISPWIDTH jr c, colloop inc b ; next row ld a,b cp SP1V_DISPORIGY + SP1V_DISPHEIGHT jr c, rowloop ret .skipscrnaddr ex af,af inc hl jp rejoinscrnaddr DEFC ASMDISP_SP1_INITIALIZE_CALLEE = asmentry - sp1_Initialize_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/sp1_Invalidate.asm0000644000175000017500000000435510756777120026344 0ustar tygrystygrys; void __FASTCALL__ sp1_Invalidate(struct sp1_Rect *r) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_Invalidate XDEF ASMDISP_SP1_INVALIDATE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH, SP1V_UPDATELISTT .sp1_Invalidate ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) .asmentry ; Invalidate a rectangular area so the tiles are drawn in the next update. ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; uses : af, bc, de, hl .SP1Invalidate call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ex de,hl ; de = & struct sp1_update ld hl,(SP1V_UPDATELISTT) ld a,5 add a,l ld l,a jp nc, rowlp inc h ; hl = last struct sp1_update+5 in invalidated list .rowlp push bc ; save b = width, c = height push de ; save first struct sp1_update in row ; hl = last struct sp1_update + 5 in invalidated list ; de = current struct sp1_update to invalidate .collp ld a,(de) xor $80 jp p, alreadyinlist ; if already invalidated skip it ld (de),a ; mark as invalidated ld (hl),d ; store this struct sp1_update at tail end of invalidated list inc hl ld (hl),e ld hl,5 add hl,de ; hl = new last struct sp1_update+5 in invalidated list .alreadyinlist ld a,9 add a,e ld e,a jp nc, noinc inc d .noinc ; de = struct sp1_update to invalidate in next column djnz collp pop de ; de = first struct sp1_update in row ex de,hl ld bc,9*SP1V_DISPWIDTH add hl,bc ex de,hl ; de = first struct sp1_update in next row, hl = last+6 in invalidated list pop bc ; b = width, c = height dec c jp nz, rowlp ld (hl),0 ; mark end of invalidated list ld bc,-5 add hl,bc ; point to start of struct sp1_update ld (SP1V_UPDATELISTT),hl ; and store as last in invalidated list ret DEFC ASMDISP_SP1_INVALIDATE = asmentry - sp1_Invalidate z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/sp1_InvUpdateStruct.asm0000644000175000017500000000166310756777120027367 0ustar tygrystygrys ; sp1_InvUpdateStruct ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_InvUpdateStruct XREF SP1V_UPDATELISTT ; FASTCALL ; Add struct_sp1_update to invalidated list so that it is ; drawn at next update. ; ; enter : hl = & struct sp1_update ; uses : af, bc, de, hl .sp1_InvUpdateStruct ld a,$80 xor (hl) ; bit 7 of (hl) = 1 if already invalidated ret p ; return if update struct already invalidated ld (hl),a ; mark it as invalidated ex de,hl ; de = struct sp1_update needing invalidation ld hl,(SP1V_UPDATELISTT) ; last struct sp_update in invalidated list ld bc,5 add hl,bc ld (hl),d inc hl ld (hl),e ; store link to new one being invalidated ex de,hl ld (SP1V_UPDATELISTT),hl ; new one becomes last in list add hl,bc ld (hl),0 ; no next after this one in list ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/sp1_IterateUpdateRect_callee.asm0000644000175000017500000000324710756777120031146 0ustar tygrystygrys; void __CALLEE__ sp1_IterateUpdateRect_callee(struct sp1_Rect *r, void *hook) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_IterateUpdateRect_callee XDEF ASMDISP_SP1_ITERATEUPDATERECT_CALLEE, CDISP_SP1_ITERATEUPDATERECT_CALLEE LIB sp1_GetUpdateStruct_callee, l_jpix XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH .sp1_IterateUpdateRect_callee pop hl pop ix ex (sp),hl .centry ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) .asmentry ; Iterate over all the struct_sp1_update making up ; a rectangular area in row major order. Call a ; user supplied function with each struct_sp1_update ; iterated as parameter. ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; ix = void (*func)(struct sp1_update*), hl also holds parameter ; uses : af, bc, de, hl (de can be used by user function to hold state between calls) .SP1IterateUpdateRect call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update .rowloop push bc push hl ; save update position .colloop push bc push hl call l_jpix pop hl ld bc,9 add hl,bc pop bc djnz colloop pop hl ; hl = & struct sp1_update same row leftmost column ld bc,9*SP1V_DISPWIDTH add hl,bc ; hl = & struct sp1_update next row leftmost column pop bc dec c ; c = height jp nz, rowloop ret DEFC ASMDISP_SP1_ITERATEUPDATERECT_CALLEE = asmentry - sp1_IterateUpdateRect_callee DEFC CDISP_SP1_ITERATEUPDATERECT_CALLEE = centry - sp1_IterateUpdateRect_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/sp1_RemoveUpdateStruct.asm0000644000175000017500000000233310756777120030063 0ustar tygrystygrys ; sp1_RemoveUpdateStruct ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_RemoveUpdateStruct ; FASTCALL ; Removes the character cell represented by the struct_sp1_update ; passed in so that the sprite engine will not draw the cell. ; Sprites will not be entered into the internal representation of ; the cell but tiles can continue to be printed to it. ; ; enter : hl = & struct sp1_update ; uses : af, de, hl .sp1_RemoveUpdateStruct ld (hl),$c1 ; invalidated & removed, # occluding sprites + 1 = 1 inc hl inc hl inc hl ; hl = sprite list ld a,(hl) ld (hl),0 ; mark no sprites in this update struct inc hl ld l,(hl) ; al = & struct sp1_cs of first sprite in this update char or a ; if no sprites, done ret z ld h,a ; hl = & struct sp1_cs.ss_draw .loop ld de,-4 add hl,de ; hl = & struct sp1_cs.update ld (hl),0 ; this sprite char belongs to no update structs ld de,16 add hl,de ; hl = & struct sp1_cs.next_in_upd ld a,(hl) or a ret z inc hl ld l,(hl) ld h,a ; hl = & next struct sp1_cs.attr_mask jp loop z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/sp1_UpdateNow.asm0000644000175000017500000000334510756777120026170 0ustar tygrystygrys ; sp1_UpdateNow ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_UpdateNow LIB SP1DrawUpdateStruct XREF SP1V_UPDATELISTH, SP1V_UPDATELISTT ; Iterates through the invalidated tiles list, drawing all invalidated tiles on screen. ; Validates them and removes them from the list along the way. ; ; enter : none ; uses : af, bc, de, hl, ix, b' for MaskLB and MaskRB sprites .sp1_UpdateNow ld hl,(SP1V_UPDATELISTH+5) ; get the first struct update char to draw ld a,l ld l,h ld h,a ; correct endianness or a jp nz, updatelp ret ; if empty update list .skipthischar ld bc,5 add hl,bc ; hl = & struct update.next_update ld a,(hl) or a jr z, doneupdate ; return if no next struct update inc hl ld l,(hl) ld h,a ; hl = next struct update .updatelp bit 6,(hl) ; if this update char has been removed from the display skip it jr nz, skipthischar ld a,$80 xor (hl) ; (hl) = # load sprites, bit 7 set for marked to update jp m, skipthischar ; if bit 7 was reset (now set), this char was validated so skip it ld (hl),a ; mark char as not needing update (bit 7 is reset) ld b,a ; b = # of occluding sprites in this char + 1 ; b = # occluding sprites in char + 1 ; hl = & struct sp1_update call SP1DrawUpdateStruct ; bc = & next sp1_update in update list ld l,c ld h,b inc b ; go to next char to update (more if b!=0) djnz updatelp .doneupdate xor a ld (SP1V_UPDATELISTH+5),a ; mark update list empty ld hl,SP1V_UPDATELISTH ld (SP1V_UPDATELISTT),hl ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/sp1_Validate.asm0000644000175000017500000000303010756777121026003 0ustar tygrystygrys; void __FASTCALL__ sp1_Validate(struct sp1_Rect *r) ; 01.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB sp1_Validate XDEF ASMDISP_SP1_VALIDATE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, SP1V_DISPWIDTH .sp1_Validate ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) .asmentry ; Validate a rectangular area, ensuring the area is not drawn ; in next update. Make sure that none of the validated area ; is invalidated by further calls before the next update otherwise ; areas of the screen may become inactive (ie are never drawn). ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; uses : f, bc, de, hl .SP1Validate call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update ld de,9 .rowloop push bc ; save b = width push hl ; save update position .colloop bit 6,(hl) ; has this update char been removed from the display? jr nz, skipit ; if so we must not validate it res 7,(hl) ; validate update char .skipit add hl,de djnz colloop pop hl ; hl = & struct sp1_update same row leftmost column ld bc,9*SP1V_DISPWIDTH add hl,bc ; hl = & struct sp1_update next row leftmost column pop bc dec c ; c = height jp nz, rowloop ret DEFC ASMDISP_SP1_VALIDATE = asmentry - sp1_Validate z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr/updater/SP1DrawUpdateStruct.asm0000644000175000017500000001240010756777120027260 0ustar tygrystygrys; SP1DrawUpdateStruct ; 1.2008 aralbrec, Sprite Pack v3.0 ; ts2068 hi-res version XLIB SP1DrawUpdateStruct XDEF SP1RETSPRDRAW XREF SP1V_PIXELBUFFER, SP1V_TILEARRAY ; Draw the tile described by the indicated update struct ; to screen -- not meant to be called directly, just a ; code fragment called from other functions. ; ; enter : b = # occluding sprites in char + 1 ; hl = & struct sp1_update ; exit : bc = & next sp1_update in update list .haveocclspr ; there are occluding sprites in this char ; b = # occl sprites ; de = 16-bit tile code ; hl = & update.slist inc hl push hl dec hl push de jp skiplp .skipthisone ; don't need to draw this sprite ld hl,13 add hl,de ; stack = & update.slist + 1b, 16-bit tile code .skiplp ld d,(hl) inc hl ld e,(hl) ; de = & sp1_cs.ss_draw dec de ; de = & sp1_cs.type ld a,(de) rla ; is this an occluding sprite? jr nc, skipthisone ; if no skip it djnz skipthisone ; if haven't seen all occl sprites yet, skip this one too ; de = & sp1_cs.type ; a = sprite type rotated left one bit ; stack = & update.slist + 1b, 16-bit tile code and $20 ; type has been rot left one bit, check orig bit 4 if should clear pixel buff pop hl ; hl = 16-bit tile code jr z, noclearbuff ; clear pixel buffer ; de = & sp1_cs.type ; hl = 16-bit tile code ; stack = & update.slist + 1b ld a,h or a jr nz, havetiledef2 ; if MSB of tile code != 0 we have & tile definition already ld h,SP1V_TILEARRAY/256 ld a,(hl) inc h ld h,(hl) ld l,a ; hl = & tile definition .havetiledef2 push de ld de,SP1V_PIXELBUFFER ldi ; copy background tile graphics into pixel buffer ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a pop de .noclearbuff ; de = & sp1_cs.type ; stack = & update.slist + 1b ex de,hl inc hl ; hl = & sp1_cs.ss_draw jp spritedraw .SP1DrawUpdateStruct ; b = # occluding sprites in char + 1 ; hl = & struct sp1_update inc hl ; hl = & update.tile ld e,(hl) inc hl ld d,(hl) inc hl djnz haveocclspr ; deal with case of occluding sprites ex de,hl ; hl = 16-bit tile code, de = & update.slist ld a,h or a jr nz, havetiledef ; if MSB of tile code != 0 we have & tile definition already ld h,SP1V_TILEARRAY/256 ld a,(hl) inc h ld h,(hl) ld l,a ; hl = & tile definition ; de = & update.slist .havetiledef ld a,(de) or a jr z, drawtileonly ; if there are no sprites in this char, just draw background tile push de ; save & update.slist ld de,SP1V_PIXELBUFFER ldi ; copy background tile graphics into pixel buffer ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a pop hl ; hl = & update.slist ld a,(hl) inc hl push hl ; save & update.slist + 1b .spritedrawlp ; hl = & sp1_cs.next_in_upd + 1b ; a = MSB of next sp1_cs.ss_draw ld l,(hl) ld h,a ; hl = & sp1_cs.ss_draw .spritedraw ; hl = & sp1_cs.ss_draw ; stack = & update.slist + 1b ld e,(hl) inc hl ld d,(hl) inc hl ex de,hl ; de = & sp1_cs.draw_code, hl = & sp1_ss.draw_code jp (hl) ; jump into sp1_ss's draw code .drawtileonly ; hl = & tile definition ; de = & update.slist ex de,hl inc hl inc hl ld b,(hl) inc hl ld c,(hl) ; bc = & next sp1_update in update list inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = screen address for char ; de = tile definition ld a,(de) ; copy tile directly to screen ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a inc h inc de ld a,(de) ld (hl),a ; bc = & next sp1_update in update list ret .SP1RETSPRDRAW ; return here after sprite char drawn pop hl ; hl = & sp1_cs.next_in_upd (pushed by sprite draw code) ld a,(hl) inc hl or a jr nz, spritedrawlp ; if there are more sprites in this char go draw them pop hl ; hl = & update.slist + 1b .donesprites inc hl ld b,(hl) inc hl ld c,(hl) ; bc = & next sp1_update in update list inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = screen address for this char cell ld de,(SP1V_PIXELBUFFER+0) ; copy final graphic in pixel buffer to screen ld (hl),e inc h ld (hl),d inc h ld de,(SP1V_PIXELBUFFER+2) ld (hl),e inc h ld (hl),d inc h ld de,(SP1V_PIXELBUFFER+4) ld (hl),e inc h ld (hl),d inc h ld de,(SP1V_PIXELBUFFER+6) ld (hl),e inc h ld (hl),d ; bc = & next sp1_update in update list ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/ts2068hr.lst0000644000175000017500000000741010763607734022053 0ustar tygrystygrysts2068hr/sprites/_sp1_struct_cs_prototype spectrum/sprites/_sp1_struct_ss_prototype spectrum/sprites/sp1_AddColSpr ts2068hr/sprites/sp1_AddColSpr_callee spectrum/sprites/sp1_ChangeSprType ts2068hr/sprites/sp1_ChangeSprType_callee spectrum/sprites/sp1_CreateSpr ts2068hr/sprites/sp1_CreateSpr_callee spectrum/sprites/sp1_DeleteSpr spectrum/sprites/sp1_InitCharStruct ts2068hr/sprites/sp1_InitCharStruct_callee spectrum/sprites/sp1_InsertCharStruct ts2068hr/sprites/sp1_InsertCharStruct_callee spectrum/sprites/sp1_IterateSprChar spectrum/sprites/sp1_IterateSprChar_callee spectrum/sprites/sp1_IterateUpdateSpr spectrum/sprites/sp1_IterateUpdateSpr_callee spectrum/sprites/sp1_MoveSprAbs ts2068hr/sprites/sp1_MoveSprAbs_callee spectrum/sprites/sp1_MoveSprPix spectrum/sprites/sp1_MoveSprPix_callee spectrum/sprites/sp1_MoveSprRel spectrum/sprites/sp1_MoveSprRel_callee spectrum/sprites/sp1_PreShiftSpr spectrum/sprites/sp1_PreShiftSpr_callee ts2068hr/sprites/sp1_RemoveCharStruct ts2068hr/sprites/SP1AddSprChar ts2068hr/sprites/SP1RemoveSprChar spectrum/sprites/draw/SP1_DRAW_LOAD1 spectrum/sprites/draw/SP1_DRAW_LOAD1LB spectrum/sprites/draw/SP1_DRAW_LOAD1LBIM spectrum/sprites/draw/SP1_DRAW_LOAD1NR spectrum/sprites/draw/SP1_DRAW_LOAD1RB spectrum/sprites/draw/SP1_DRAW_LOAD1RBIM spectrum/sprites/draw/SP1_DRAW_LOAD2 spectrum/sprites/draw/SP1_DRAW_LOAD2LB spectrum/sprites/draw/SP1_DRAW_LOAD2LBIM spectrum/sprites/draw/SP1_DRAW_LOAD2NR spectrum/sprites/draw/SP1_DRAW_LOAD2RB spectrum/sprites/draw/SP1_DRAW_LOAD2RBIM spectrum/sprites/draw/SP1_DRAW_MASK2 spectrum/sprites/draw/SP1_DRAW_MASK2LB spectrum/sprites/draw/SP1_DRAW_MASK2NR spectrum/sprites/draw/SP1_DRAW_MASK2RB spectrum/sprites/draw/SP1_DRAW_OR1 spectrum/sprites/draw/SP1_DRAW_OR1LB spectrum/sprites/draw/SP1_DRAW_OR1NR spectrum/sprites/draw/SP1_DRAW_OR1RB spectrum/sprites/draw/SP1_DRAW_OR2 spectrum/sprites/draw/SP1_DRAW_OR2LB spectrum/sprites/draw/SP1_DRAW_OR2NR spectrum/sprites/draw/SP1_DRAW_OR2RB spectrum/sprites/draw/SP1_DRAW_XOR1 spectrum/sprites/draw/SP1_DRAW_XOR1LB spectrum/sprites/draw/SP1_DRAW_XOR1NR spectrum/sprites/draw/SP1_DRAW_XOR1RB spectrum/sprites/draw/SP1_DRAW_XOR2 spectrum/sprites/draw/SP1_DRAW_XOR2LB spectrum/sprites/draw/SP1_DRAW_XOR2NR spectrum/sprites/draw/SP1_DRAW_XOR2RB ts2068hr/tiles/sp1_ClearRect ts2068hr/tiles/sp1_ClearRect_callee ts2068hr/tiles/sp1_ClearRectInv ts2068hr/tiles/sp1_ClearRectInv_callee spectrum/tiles/sp1_GetTiles ts2068hr/tiles/sp1_GetTiles_callee ts2068hr/tiles/sp1_PrintAt ts2068hr/tiles/sp1_PrintAt_callee ts2068hr/tiles/sp1_PrintAtInv ts2068hr/tiles/sp1_PrintAtInv_callee spectrum/tiles/sp1_PrintString spectrum/tiles/sp1_PrintString_callee spectrum/tiles/sp1_PutTiles ts2068hr/tiles/sp1_PutTiles_callee spectrum/tiles/sp1_PutTilesInv ts2068hr/tiles/sp1_PutTilesInv_callee spectrum/tiles/sp1_ScreenStr ts2068hr/tiles/sp1_ScreenStr_callee spectrum/tiles/sp1_SetPrintPos ts2068hr/tiles/sp1_SetPrintPos_callee spectrum/tiles/sp1_TileEntry spectrum/tiles/sp1_TileEntry_callee ts2068hr/tiles/SP1PrintString ts2068hr/tiles/SP1PSPOP ts2068hr/tiles/SP1PSPUSH spectrum/updater/sp1_DrawUpdateStructAlways spectrum/updater/sp1_DrawUpdateStructIfInv spectrum/updater/sp1_DrawUpdateStructIfNotRem spectrum/updater/sp1_DrawUpdateStructIfVal spectrum/updater/sp1_GetUpdateStruct ts2068hr/updater/sp1_GetUpdateStruct_callee ts2068hr/updater/sp1_Initialize ts2068hr/updater/sp1_Initialize_callee ts2068hr/updater/sp1_Invalidate ts2068hr/updater/sp1_InvUpdateStruct spectrum/updater/sp1_IterateUpdateArr spectrum/updater/sp1_IterateUpdateArr_callee spectrum/updater/sp1_IterateUpdateRect ts2068hr/updater/sp1_IterateUpdateRect_callee ts2068hr/updater/sp1_RemoveUpdateStruct spectrum/updater/sp1_RestoreUpdateStruct ts2068hr/updater/sp1_UpdateNow ts2068hr/updater/sp1_Validate spectrum/updater/sp1_ValUpdateStruct ts2068hr/updater/SP1DrawUpdateStruct z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/0000755000175000017500000000000010765202715021161 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/customize.asm0000644000175000017500000000740410761503744023714 0ustar tygrystygrys ; CUSTOMIZATION TEMPLATE FOR SP1 ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res-graphics version ; This customization file is intended for a 64k ; zx96 computer with memory map as follows: ; ; 0000 - 1fff : 8k : ROM ; 2000 - 3fff : 8k : RAM or EPROM/EEPROM (m/c possible) ; 4000 - 7fff : 16k : RAM (basic, m/c possible) ; 8000 - bfff : 16k : RAM (basic, m/c possible) ; c000 - ffff : 16k : RAM/RAM-echo (only data, no m/c) ; ; For other targets you must select a different ; and appropriate memory map by making changes below. ; At least 32k RAM is recommended. ; ; Keep in mind that the "struct sp1_ss" and "struct sp1_cs" ; that the library allocates when creating sprites contain ; executable code, meaning they must be allocated out of a ; memory block capable of executing m/c. ; /////////////////////// ; Display Characteristics ; /////////////////////// defc SP1V_DISPORIGX = 0 ; x coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPORIGY = 0 ; y coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPWIDTH = 32 ; width of area managed by sp1 in characters (16, 24, 32 ok as of now) defc SP1V_DISPHEIGHT = 24 ; height of area managed by sp1 in characters (anything reasonable ok) ; /////////////////////// ; Buffers ; /////////////////////// defc SP1V_PIXELBUFFER = $bcf8 ; address of an 8-byte buffer to hold intermediate pixel-draw results ; /////////////////////// ; Temp Variables ; /////////////////////// defc SP1V_TEMP_AF = $bcf2 defc SP1V_TEMP_IX = $bcf6 defc SP1V_TEMP_IY = $bced ; /////////////////////// ; Data Structures ; /////////////////////// defc SP1V_TILEARRAY = $f000 ; address of the 512-byte tile array associating character codes with tile graphics, must lie on 256-byte boundary (LSB=0) defc SP1V_UPDATEARRAY = $d500 ; address of the 9*SP1V_DISPWIDTH*SP1V_DISPHEIGHT byte update array defc SP1V_ROTTBL = $f000 ; location of the 3584-byte rotation table. Must lie on 256-byte boundary (LSB=0). Table begins $0200 bytes ahead of this ; pointer ($f200-$ffff in this default case). Set to $0000 if the table is not needed (if, for example, all sprites ; are drawn at exact horizontal character coordinates or you use pre-shifted sprites only). ; /////////////////////// ; SP1 Variables ; /////////////////////// defc SP1V_UPDATELISTH = $bcef ; address of 9-byte area holding a dummy struct_sp1_update that is always the "first" in list of screen tiles to be drawn defc SP1V_UPDATELISTT = $bcf0 ; address of 2-byte variable holding the address of the last struct_sp1_update in list of screen tiles to be drawn ; NOTE: SP1V_UPDATELISTT is located inside the dummy struct_sp1_update pointed at by SP1V_UPDATELISTH ; /////////////////////// ; DEFAULT MEMORY MAP ; /////////////////////// ; With these default settings the memory map is: ; ; ADDRESS (HEX) LIBRARY DESCRIPTION ; ; f200 - ffff SP1.LIB horizontal rotation tables ; f000 - f1ff SP1.LIB tile array ; d500 - efff SP1.LIB update array for 32x24 display ; bd00 - d4ff ZX81HRG 256x192 display file (suggested, least significant 5 bits of address must be 0) ; bcf8 - bcff SP1.LIB pixel buffer ; bcef - bcf7 SP1.LIB update list head - a dummy struct sp1_update acting as first in invalidated list ; * bcf0 - bcf1 SP1.LIB update list tail pointer (inside dummy struct sp1_update) ; * bcf2 - bcf3 SP1.LIB SP1V_TEMP_AF (inside dummy struct sp1_update) ; * bcf6 - bcf7 SP1.LIB SP1V_TEMP_IX (inside dummy struct sp1_update) ; bced - bcee SP1.LIB SP1V_TEMP_IY z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/examples/0000755000175000017500000000000010765202715022777 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/examples/ex1.c0000644000175000017500000001051010761503770023636 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #1 // 02.2008 aralbrec // // Ten software-rotated masked sprites move in straight lines // at various speeds, bouncing off screen edges. All ten // share the same sprite graphic which is not animated in // this first test program. ///////////////////////////////////////////////////////////// // zcc +zx81 -vn ex1.c -o ex1.bin -create-app -startup=4 -lgfx81hr192 -lsp1 -lmalloc -Ca"-IXIY" #include #include #include #pragma output hrgpage=48384 // set location of the hrg display file long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen struct sp1_Rect clip1 = {1, 1, 12, 12}; // clip region 1 // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { // doubled the dx,dy speed compared to spectrum {0,2,0}, {0,0,2}, {0,2,4}, {0,4,2}, {0,2,6}, // since we have half the cpu time to draw {0,6,2}, {0,4,6}, {0,6,4}, {0,2,2}, {0,4,4} }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 6000); // make available memory from 40000-45999 // Initialize SP1.LIB sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with space character sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; sp1_MoveSprRel(se->s, &cr, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/examples/ex1.P0000644000175000017500000001157210761503770023624 0ustar tygrystygrysiPjPSSSSS]@7iP !@v ~Ò@?$$)0v@@s@!9sgAAͶ@@1*@!@"@+@!@@!>G!4@~(!*@ |G}>A*nA#"nA|A!oA4!,A:(@O:;@Û!@ !@äOSmall C+ ZX81͜DD  UUUU;!T]"CSD!@!pD!! 1I! !A9O!AZJLO!96n&B!94n&-!9~ ʼB!9!A! 9n&))!H!@!!!9n&%F͑D͑D!9^#V!9G!!0!9n&E!9^#V!&I!!!9n&E!9^#V!A!C! !!!J BLO!96n&B!94n&-!9~ ʈC!A!9n&))^#V!A!}͗D!}͗D! 9̈́D###~D!9̈́D##~DN̈́D~WCWC###!9̈́D###~D͉D}͗D}̈́D#~ʅCڅC##!9̈́D##~D͉D}͗D}BüB3xxxxxxxxC D|+F+N ##MD~#fo(B(0J#D MDNDi`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!CçD##x¶DyҶD~#fo(1^#VB0#öDB8##+s#r#q#p#7~7CDx y q#p# Dek!F!AF"FkbKBt}@w]T!!  :w:wq p * N#naV#^ vʓE˶ |w#}wrs ~w #~w|(/]T^ V * ~!(.u t ÐE*4,7|͇AF!!{C2!G!AG!AGGkb:wp(x@tu"Fkbqw]T!!  :w:wu t |(9tu]T^ V qq* ~!(.u t F*7|͇AG >!!9G'H go~$nGnN%o:2o~$nGnN%o:2o~$nGnN%o:2o~$nGnN%o:2o~$nGn N%o:2o~$n Gn N%o:2o~$n Gn N%o:2o~$nGnN%o:2$P!'H [~##2~##2[~##2~##2[~##2~##2[~##2~#2$P!̈́H'H W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^2$P!&I$P WËH{G(yg.A];s$w%,EI >IO@!>@I_~$I  r%s$%>_>WA!a~$I  w%w$%#!"!"!Q6#s#6#6#6#6#6#(:@w#:@w# y 8x8#I~ > .8&0"&8@0!(J( (##~>rs p q w v " $:?()><=+-*/;,.'V#^#F#NͤJ*>opJ$Jr#s!> _҈J  pJ6 "Uj&zTگJ%))))){ ڻJT])))CU""pxw ~JqO~x2| nfKuty( u t 6~´L~·Lfn* ͤJFx*QLQLx*|K:GQLN*y v R8M0Hy*ªK:O 14V#^#~(I~Kwr#s!6q  KV#^#~ ?###v(zʫL  TKBKr#s#~#~L4#DM!͆NøK6####N ~;L=Kr#s!6KV#^#~ ####v  SLzʫL  TK6####N ~ʕL=^Lr#s!6^L"rsfn* ͤJFx*(N(Nx*L:G(NN*y vMMMy*-M:OM4F#N#~ʵM NF#Ns+r###~[M =<oMr#s!6 Mr#s!6+~#N#DM!͆N(  LzʫL  Lr#s##~M<Mr#s!6ÃMV#^#~(?G#N+6####N ~M=Nr#s!6v£M! L###NV#^#~ ####v  *NzʫL  LG#N+6####N ~pN=5Nr#s!65NV#(^0ÆNq+p! 6##r#s##q+p! r#s#p#q+++ r#s F##V#^6N#V#^p#q! p#qCU"~G///_xOG~O///Wy3OOJ! ~s_$~rgk*}lgbO ~(#ngv >WOwGͿOi`2!"#+ÌO! V#^0 (| &~$fo~#O#^#V#| &~$fo( ~~#ng^#V###F#N#~#fo w w w w w w w w~# #F#N#~#fo [s r [s r [s r [s rv "! vvvvvvvvvvvvvvvvvvvvvvvvvvz88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/examples/ex4c.c0000644000175000017500000001430410761503770024011 0ustar tygrystygrys ///////////////////////////////////////////////////////////// // EXAMPLE PROGRAM #4C // 04.2006 aralbrec // // Up to this point we have been using a single clipping // rectangle in all the sp1_MoveSpr*() calls we have been // making with little explanation of what this clipping rectangle // is for. It's exactly what you think it is -- the sprite // is drawn such that only the parts of the sprite inside // the rectangle get drawn. By using the full screen as // clipping rectangle up to this point we have been // accomplishing one important function of the clipping // rectangle and that is preventing the sprite engine from // drawing into non-existent areas of the screen. // // Now we are going to use the clipping rectangle for a // second purpose which is to control where the sprites // can appear on screen. Two new clipping rectangles are // defined and the sp1_MoveSprAbs() call in the main loop // uses clipping rectangle #1 for the first five sprites // created (the MASKed sprites) and clipping rectangle #2 // for the rest (the XOR sprites). The result is, // although the sprites are freely moving across the // entire screen, they are only drawn when they appear // in their respective clipping rectangles. // // Clipping can only be done to character cell boundaries. // // Among applications of this, consider a vertical gate // hidden in a doorway. As the player approaches it drops // closed. If the gate is a sprite with clipping rectangle // covering the doorway only, it can appear to drop into // place by being moved from over the doorway onto the // doorway. ///////////////////////////////////////////////////////////// // zcc +zx81 -vn ex4c.c -o ex4c.bin -create-app -startup=4 -lgfx81hr192 -lsp1 -lmalloc -Ca"-IXIY" #include #include #include #pragma output hrgpage=48384 // set location of the hrg display file long heap; // malloc's heap pointer // Memory Allocation Policy void *u_malloc(uint size) { return malloc(size); } void u_free(void *addr) { free(addr); } // Clipping Rectangle for Sprites struct sp1_Rect cr = {0, 0, 32, 24}; // full screen struct sp1_Rect clip1 = {1, 1, 12, 12}; // clip region 1 struct sp1_Rect clip2 = {10, 18, 12, 12}; // clip region 2 // Table Holding Movement Data for Each Sprite struct sprentry { struct sp1_ss *s; // sprite handle returned by sp1_CreateSpr() char dx; // signed horizontal speed in pixels char dy; // signed vertical speed in pixels }; struct sprentry sprtbl[] = { {0,2,0}, {0,0,2}, {0,2,4}, {0,4,2}, {0,2,6}, // double the spectrum's dx,dy speed as we have {0,6,2}, {0,4,6}, {0,6,4}, {0,2,2}, {0,4,4} // half the cpu time for drawing }; // A Hashed UDG for Background uchar hash[] = {0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; // Attach C Variable to Sprite Graphics Declared in ASM at End of File extern uchar gr_window[]; main() { uchar i; struct sp1_ss *s; struct sprentry *se; void *temp; // Initialize MALLOC.LIB heap = 0L; // heap is empty sbrk(40000, 6000); // make available memory from 40000-45999 // Initialize SP1.LIB sp1_Initialize(SP1_IFLAG_MAKE_ROTTBL | SP1_IFLAG_OVERWRITE_TILES | SP1_IFLAG_OVERWRITE_DFILE, ' '); sp1_TileEntry(' ', hash); // redefine graphic associated with ' ' character // mark the two rectangular areas on screen so we can see them sp1_ClearRect(&clip1, '+', SP1_RFLAG_TILE); sp1_ClearRect(&clip2, '+', SP1_RFLAG_TILE); sp1_Invalidate(&cr); // invalidate entire screen so that it is all initially drawn sp1_UpdateNow(); // draw screen area managed by sp1 now // Create Ten Masked Software-Rotated Sprites for (i=0; i!=10; i++) { if (i < 5) { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_MASK2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_MASK2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_MASK2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); } else { s = sprtbl[i].s = sp1_CreateSpr(SP1_DRAW_XOR2LB, SP1_TYPE_2BYTE, 3, 0, i); sp1_AddColSpr(s, SP1_DRAW_XOR2, 0, 48, i); sp1_AddColSpr(s, SP1_DRAW_XOR2RB, 0, 0, i); sp1_MoveSprAbs(s, &cr, gr_window, 10, 14, 0, 4); } }; while (1) { // main loop sp1_UpdateNow(); // draw screen now for (i=0; i!=10; i++) { // move all sprites se = &sprtbl[i]; if (i < 5) sp1_MoveSprRel(se->s, &clip1, 0, 0, 0, se->dy, se->dx); else sp1_MoveSprRel(se->s, &clip2, 0, 0, 0, se->dy, se->dx); if (se->s->row > 21) // if sprite went off screen, reverse direction se->dy = - se->dy; if (se->s->col > 29) // notice if coord moves less than 0, it becomes se->dx = - se->dx; // 255 which is also caught by these cases } } // end main loop } #asm defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 defb @11111111, @00000000 ; ASM source file created by SevenuP v1.20 ; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain ;GRAPHIC DATA: ;Pixel Size: ( 16, 24) ;Char Size: ( 2, 3) ;Sort Priorities: Mask, Char line, Y char, X char ;Data Outputted: Gfx ;Interleave: Sprite ;Mask: Yes, before graphic ._gr_window DEFB 128,127, 0,192, 0,191, 30,161 DEFB 30,161, 30,161, 30,161, 0,191 DEFB 0,191, 30,161, 30,161, 30,161 DEFB 30,161, 0,191, 0,192,128,127 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 1,254, 0, 3, 0,253,120,133 DEFB 120,133,120,133,120,133, 0,253 DEFB 0,253,120,133,120,133,120,133 DEFB 120,133, 0,253, 0, 3, 1,254 DEFB 255, 0,255, 0,255, 0,255, 0 DEFB 255, 0,255, 0,255, 0,255, 0 #endasm z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/examples/ex4c.P0000644000175000017500000001320710761503770023767 0ustar tygrystygrysvSwSVVVVV]@7vS !@v ~Ò@?$$)0v@@s@!9sgAAͶ@@1*@!@"@+@!@@!>G!4@~(!*@ |G}>A*nA#"nA|A!oA4!,A:(@O:;@Û!@ !@äOSmall C+ ZX81ͱEE   UUUU;!T]"ESE!@!pF!! eL! !AFR!A!+!:G!A!+!:G!A͎MYR!96n&8B!94n&-!9~ ʂCBB!9!A! 9n&))!gJ!@!!!9n&HͦEͦE!9^#V!I!!0!9n&%F!9^#V! K!!!9n&%F!9^#V!A!D! !!!MC!9!A! 9n&))!K!@!!!9n&HͦEͦE!9^#V!K!!0!9n&%F!9^#V!ZL!!!9n&%F!9^#V!A!D! !!!M/BYR!96n&ÚC!94n&-!9~ ʝD!A!9n&))!9~DD^#V!A!}ͬE!}ͬE! 9͙E###͓E!9͙E##͓EQ=D^#V!A!}ͬE!}ͬE! 9͙E###͓E!9͙E##͓EQ͙E~lDlD###!9͙E###͓E͞E}ͬE}͙E#~ʚDښD##!9͙E##͓E͞E}ͬE}ÑCÂC3xxxxxxxxE!E|+F+N ##MD~#fo(B(0J#1E MDcEi`^#V#N#F~w#~w++]T+~+ngR( s#rq#pq#p+OG++~w#~w~og~#fo|/g}/o#}|ogMD!EüE##xEyE~#fo(1^#VB0#EB8##+s#r#q#p#7~7EFx y q#p#!Eek!F!AG"$GkbKBt}@w]T!!  :w:wq p * N#naV#^ vʨF˶ |w#}wrs ~w #~w|(/]T^ V * ~!(.u t åF*4,7|͇AG!!yV#^#F#NgGGG  UGɇyo&GqG$~o#~gɉGGGGGGGG> o$#s#6>o$> o$~oG$~(#ngõG>o$#s#6++ãGUj&zTG%))))){ GT]))){C2!G!AH!AHHkb:wp(x@tu"$Gkbqw]T!!  :w:wu t |(9tu]T^ V qq* ~!(.u t êH*7|͇AH >!!I J go~$nGnN%o:2o~$nGnN%o:2o~$nGnN%o:2o~$nGnN%o:2o~$nGn N%o:2o~$n Gn N%o:2o~$n Gn N%o:2o~$nGnN%o:21S! J [~##2~##2[~##2~##2[~##2~##2[~##2~#21S!gJ J W/GK^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^#2K^#ٰ١O^#2^#ٰ٠G^21S! K1S WnJ!!KʸK gKo~$n2nN%oy2Ko~$n2nN%oy2Ko~$n 2n N%oy2Ko~$n 2nN%oy21S!͸K ###############1S!KʸK WK#^#2#^#2K#^#2#^#2K#^#2#^#2K#^#2#^21S!ZL1S WK{G(yg.A];s$w%,yL rLO@!>@$M_~$I  r%s$%>_>WA!a~$I  w%w$%#!"!"!Q6#s#6#6#6#6#6#(:@w#:@w# y 8x8#M~ > .8&0"&8@0!\M( (##~>rs p q w v " $:?()><=+-*/;,.'V#^#F#NG*>oҤM$Mr#s!> _ҼM  ¤M6 "CU""pxw ~NqO~x2| nf(Nuty( u t 6~O~Ofn* GFx*^O^Ox*‰N:G^ON*y v R8M0Hy*·N:O 14V#^#~(I~Nwr#s!6q  ÌNV#^#~ ?###v(zʸO  aNBKr#s#~#~ O4#DM!͓QN6####Q ~HO=Nr#s!6NV#^#~ ####v  `OzʸO  aN6####Q ~ʢO=kOr#s!6kO"rsfn* GFx*5Q5Qx* P:G5QN*y vPPPy*:P:OP4F#N#~P QF#Ns+r###~hP =<|Pr#s!6 Pr#s!6+~#N#DM!͓Q(  PzʸO  Or#s##~P<Pr#s!6ÐPV#^#~(?G#N+6####Q ~ Q=Qr#s!6v°P! P###QV#^#~ ####v  7QzʸO  OG#N+6####Q ~}Q=BQr#s!6BQV#(^0ÓQq+p! 6##r#s##q+p! r#s#p#q+++ r#s F##V#^6N#V#^p#q! p#qCU"~G///_x#RG~O///Wy@ROM! ~s_$~rgk*}lgoR ~(#ngv >dRwGRi`2!"#+ÙR! V#^0 (| &~$fo~#R#^#V#| &~$fo( ~~#ng^#V###F#N#~#fo w w w w w w w w~# #F#N#~#fo [s r [s r [s r [s rv "! vvvvvvvvvvvvvvvvvvvvvvvvvvz88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/0000755000175000017500000000000010765202715022652 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/draw/0000755000175000017500000000000010765202715023607 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/MoveC.asm0000644000175000017500000002715010761370050024364 0ustar tygrystygrys ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; (SP1V_TEMP_AF + 1) = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; (SP1V_TEMP_IY) = & clipping rectangle ; (SP1V_TEMP_IX) = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row .CCrowloop ld a,b inc b ; row++ ; is row in clipping rectangle? ld ix,(SP1V_TEMP_IY) sub (ix+0) jp c, CCcliprow0 sub (ix+3) jp nc, CCcliprow0 ; is this the last row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,b ld ix,(SP1V_TEMP_IX) sub (ix+0) cp (ix+3) jp nz, CCnotlastrow ; **************************************************************** ; this is the last row, should it be drawn? ld a,(SP1V_TEMP_AF + 1) bit 0,a jp nz, CCcliprow1 .CCnotlastrow ld c,(ix+1) ; c = column .CCcolloop ld ix,(SP1V_TEMP_IY) ld a,c inc c ; column++ ; has this update struct been removed from the display? bit 6,(hl) ex (sp),hl jp nz, CCclipcol0 ; hl = & struct sp1_update.ulist (tail) ; stack = & struct sp1_update, row ; is column in clipping rectangle? sub (ix+1) jp c, CCclipcol0 sub (ix+2) jp nc, CCclipcol0 ; is this the last column in row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,c ld ix,(SP1V_TEMP_IX) sub (ix+1) cp (ix+2) jp nz, CCnotlastcol ; z flag set if it is the last column in row ; **************************************************************** ; this is the last column, should it be drawn? ld a,(SP1V_TEMP_AF + 1) bit 1,a jp nz, CCclipcol1 .CCnotlastcol ; IX = IX exx inc (ix+19) ; number of active spr chars++ ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld b,(hl) inc hl ld c,(hl) ; bc = & next struct sp1_cs in sprite inc hl ld a,(hl) or a jp z, CCnoremovenec0 ; first remove spr char from current update struct push bc push hl ; stack = sp1_cs.update, next sp1_cs, sp1_update, row ld bc,4 add hl,bc ; hl = & struct sp1_cs.ss_draw call SP1RemoveSprChar pop de pop hl ex (sp),hl ex de,hl ; hl = & struct sp1_cs.update ; de = & struct sp1_update ; stack = & next struct sp1_cs, row ; change update struct spr char belongs to ld b,(hl) inc hl ld c,(hl) ; bc = old struct sp1_update ld (hl),e dec hl ld (hl),d ; store new struct sp1_update ; do count for occluding sprites inc hl inc hl inc hl ; hl = & struct sp1_cs.type bit 7,(hl) ; is this occluding type? jp z, CCnotoccl0 ld a,(bc) dec a ld (bc),a ; decrease num of occl sprites in old update struct ld a,(de) inc a ld (de),a ; increase num of occl sprites in new update struct .CCnotoccl0 ; invalidate update chars ld a,(de) xor $80 jp p, CCnoinvnew ; new update struct already invalidated so skip ld (de),a ; mark it as invalidated now push de exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCnoinvnew ld a,(bc) xor $80 jp p, CCnoinvold ; old update struct already invalidated so skip ld (bc),a ; mark it as invalidated now push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCnoinvold ; IX = IX ; hl = & struct sp1_cs.type ; de = & struct sp1_update ; stack = & next struct sp1_cs, row ; now add spr char to new update struct it occupies dec hl ld a,(hl) ; a = plane inc hl ld c,(hl) push bc ; save type inc hl ld b,h ld c,l ; bc = & struct sp1_cs.ss_draw ld hl,3 add hl,de ; hl = & struct sp1_update.slist push de ; save sp1_update call SP1AddSprChar pop hl pop af pop de ; hl = & struct sp1_update ; de = & next struct sp1_cs ; f = z flag set if last col in row ; stack = row jr z, CCnextrow ld bc,9 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp CCcolloop .CCnextrow ; IX = IX ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row pop hl ; hl = & struct sp1_update at start of row ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,9*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl exx ex (sp),hl jp CCrowloop .CCnoremovenec0 ; IX = IX ; hl = & struct sp1_cs.update ; bc = & next struct sp1_cs in sprite ; stack = & struct sp1_update, row pop de ; de = & struct sp1_update ld (hl),d inc hl ld (hl),e ; store update struct the spr char occupies now inc hl inc hl ; hl = & struct sp1_cs.type ld a,(de) bit 7,(hl) ; is spr char occluding? jp z, CCnotoccl12 inc a ; increase # occluding sprites in update struct ld (de),a .CCnotoccl12 ; invalidate the update struct xor $80 jp p, CCalreadyinv33 ; skip if already invalidated ld (de),a ; mark it as invalidated push de exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCalreadyinv33 push bc ; hl = & struct sp1_cs.type ; de = & struct sp1_update ; stack = & next struct sp1_cs, row jp CCnoinvold ; add spr char to update list, loop .CCclipcol1 ; IX = IX .CCclipcol0 ; IX = IY exx ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr z, CCskipremoveit ld b,a inc hl ld c,(hl) ; need to remove this spr char from update list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update + 1 ; bc = & old struct sp1_update ; stack = & struct sp1_update, row push bc push de dec hl ld (hl),0 ; this spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.ss_draw call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs pop bc ; bc = & old struct sp1_update ; invalidate so char is redrawn without sprite ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, CCnotoccl44 dec a ; number of occluding sprites in old update struct -- ld (bc),a .CCnotoccl44 xor $80 ; is char already invalidated? jp p, CCalreadyinv66 ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .CCalreadyinv66 ; hl = & struct sp1_cs.type ; de = & next struct sp1_cs ; stack = & struct sp1_update, row pop bc bit 6,(hl) ; last column in row? jp nz, CCnextrow ; this is not the last column ld hl,9 add hl,bc push hl ex de,hl exx ex (sp),hl jp CCcolloop .CCskipremoveit ; hl = & struct sp1_cs.update ; de = & next struct sp1_cs in sprite ; stack = & struct sp1_update, row inc hl inc hl inc hl jp CCalreadyinv66 .CCcliprow1 ; IX = IX .CCcliprow0 ; IX = IY ; skipping an entire row, only need to remove ; spr chars from update struct list + invalidate ; if they are on-screen ex (sp),hl exx .CCcliprowlp ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr nz, CCCRremoveit ; ok, not on display inc hl inc hl inc hl ; hl = & struct sp1_cs.type .CCCRrejoinremove ; is this the last col in row? bit 6,(hl) pop hl ; hl = & struct sp1_update jr nz, CCCRnextrow ; this is not the last column in row ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row ld bc,9 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs jp CCcliprowlp .CCCRnextrow ; this was last column, move to next row ; de = & next struct sp1_cs ; hl = & struct sp1_update ; stack = row pop hl ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,9*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp CCrowloop .CCCRremoveit ; need to remove this spr char from update list ld b,a inc hl ld c,(hl) ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update + 1 ; bc = & old struct sp1_update ; stack = & struct sp1_update, row push bc push de dec hl ld (hl),0 ; spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.ss_draw call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs pop bc ; bc = & old struct sp1_update ; invalidate so char is redrawn without sprite ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, CCCRnotoccluding0 dec a ; number of occluding sprites in update struct -- ld (bc),a .CCCRnotoccluding0 xor $80 ; is char already invalidated? jp p, CCCRrejoinremove ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx jp CCCRrejoinremove z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/MoveNC.asm0000644000175000017500000002357510760516260024515 0ustar tygrystygrys ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; (SP1V_TEMP_AF + 1) = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; (SP1V_TEMP_IY) = & clipping rectangle ; (SP1V_TEMP_IX) = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row .NCrowloop ld a,b inc b ; row++ ; is row in clipping rectangle? ld ix,(SP1V_TEMP_IY) sub (ix+0) jp c, NCcliprow0 sub (ix+3) jp nc, NCcliprow0 ; is this the last row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,b ld ix,(SP1V_TEMP_IX) sub (ix+0) cp (ix+3) jp nz, NCnotlastrow ; **************************************************************** ; this is the last row, should it be drawn? ld a,(SP1V_TEMP_AF + 1) bit 0,a jp nz, NCcliprow1 .NCnotlastrow ld c,(ix+1) ; c = column .NCcolloop ld ix,(SP1V_TEMP_IY) ld a,c inc c ; column++ ; has this update struct been removed from the display? bit 6,(hl) ex (sp),hl jr nz, NCclipcol0 ; hl = & struct sp1_update.ulist (tail) ; stack = & struct sp1_update, row ; is column in clipping rectangle? sub (ix+1) jr c, NCclipcol0 sub (ix+2) jr nc, NCclipcol0 ; is this the last column in row? ; **************************************************************** ; **** FIXED BUG HERE MESSED UP REGISTER ALLOCATION, IMPROVE LATER ld a,c ld ix,(SP1V_TEMP_IX) sub (ix+1) cp (ix+2) push af jp nz, NCnotlastcol ; z flag set if it is the last column in row ; **************************************************************** ; this is the last col, should it be drawn? ld a,(SP1V_TEMP_AF + 1) bit 1,a jr nz, NCclipcol1 .NCnotlastcol ; IX = IX exx inc (ix+19) ; number of active sprite chars++ ; hl = & struct sp1_cs ; stack = flag = z if last col, & struct sp1_update, row ; is sprite char already in update struct list? ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; hl = & struct sp1_cs.update ld a,(hl) ; if MSB of update struct this spr char is != 0 or a ; then already in list jr z, NCaddit ; already in update struct list so no need to add spr char to update struct list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = flag = z if last col, & struct sp1_update, row pop bc pop hl .NCrejoinaddit ; IX = IX ; de = & next struct sp1_cs ; hl = & struct sp1_update ; c = bit 6 set if last col ; stack = row ; invalidate ld a,(hl) ; skip if char already invalidated xor $80 jp p, NCalreadyinv0 ld (hl),a ; mark as invalidated push hl exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx .NCalreadyinv0 ; IX = IX bit 6,c ; is this last col? jr nz, NCnextrow .NCnextcol ; IX = IY ; this is not the last column in row ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row ld bc,9 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp NCcolloop .NCclipcol1 ; IX = IX pop af .NCclipcol0 ; IX = IY exx ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr nz, NCremoveit ; ok, not on display inc hl inc hl inc hl ; hl = & struct sp1_cs.type .NCrejoinremove ; IX = IY ; is this the last col in row? bit 6,(hl) pop hl ; hl = & struct sp1_update jr z, NCnextcol .NCnextrow ; IX = IY ; this was last column, move to next row ; de = & next struct sp1_cs ; hl = & struct sp1_update ; stack = row pop hl ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,9*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp NCrowloop .NCaddit ; IX = IX ; add the sprite char to update struct's sprite list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = flag = z if last col, & struct sp1_update, row pop af ; f = flag ld b,d ld c,e ; bc = & next struct sp1_cs in update pop de ; de = & struct sp1_update push de push af ld (hl),d inc hl ld (hl),e ; write struct update this spr char belongs to inc hl ld a,(hl) ; a = plane inc hl bit 7,(hl) ; is spr char occluding type? jp z, NCnotoccluding10 ex de,hl inc (hl) ; increase # occluding sprites in update struct ex de,hl .NCnotoccluding10 inc hl push bc ld b,h ld c,l ; bc = & struct sp1_cs.ss_draw ld hl,3 add hl,de ; hl = & struct sp1_update.slist call SP1AddSprChar ; add sprite to update list pop de pop bc pop hl ; de = & next struct sp1_cs ; hl = & struct sp1_update ; c = bit 6 set if last col ; stack = row jp NCrejoinaddit .NCremoveit ; IX = IY ; need to remove this spr char from update list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = & struct sp1_update, row push de ld (hl),0 ; this spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.ss_draw call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs ; invalidate so char is redrawn without sprite pop bc ; bc = & struct sp1_update push bc ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, NCnotoccluding0 dec a ; number of occluding sprites in update struct -- ld (bc),a .NCnotoccluding0 xor $80 ; is char already invalidated? jp p, NCrejoinremove ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx jp NCrejoinremove .NCcliprow1 ; IX = IY .NCcliprow0 ; IX = IY ; skipping an entire row, only need to remove ; spr chars from update struct list + invalidate ; if they are on-screen ex (sp),hl exx .NCcliprowlp ; IX = IY ; hl = & struct sp1_cs ; stack = & struct sp1_update, row ld d,(hl) inc hl ld e,(hl) ; de = & next struct sp1_cs in sprite inc hl ; is this spr char on the display now? ld a,(hl) or a jr nz, NCCRremoveit ; ok, not on display inc hl inc hl inc hl ; hl = & struct sp1_cs.type .NCCRrejoinremove ; IX = IY ; is this the last col in row? bit 6,(hl) pop hl ; hl = & struct sp1_update jr nz, NCCRnextrow ; this is not the last column in row ; hl = & struct sp1_update ; de = & next struct sp1_cs ; stack = row ld bc,9 add hl,bc push hl ex de,hl ; hl = & next struct sp1_cs jp NCcliprowlp .NCCRnextrow ; IX = IY ; this was last column, move to next row ; de = & next struct sp1_cs ; hl = & struct sp1_update ; stack = row pop hl ld a,d ; all done if there is no next sp1_cs or a jp z, done ld bc,9*SP1V_DISPWIDTH add hl,bc push hl push hl ex de,hl ; hl = & next struct sp1_cs exx ex (sp),hl jp NCrowloop .NCCRremoveit ; IX = IY ; need to remove this spr char from update list ; de = & next struct sp1_cs in sprite ; hl = & struct sp1_cs.update ; stack = & struct sp1_update, row push de ld (hl),0 ; spr char no longer belongs to update struct inc hl inc hl inc hl push hl inc hl ; hl = & struct sp1_cs.ss_draw call SP1RemoveSprChar pop hl ; hl = & struct sp1_cs.type pop de ; de = & next struct sp1_cs ; invalidate so char is redrawn without sprite pop bc ; bc = & struct sp1_update push bc ld a,(bc) bit 7,(hl) ; is spr char occluding type? jp z, NCCRnotoccluding0 dec a ; number of occluding sprites in update struct -- ld (bc),a .NCCRnotoccluding0 xor $80 ; is char already invalidated? jp p, NCCRrejoinremove ; if so skip invalidation step ld (bc),a ; mark as invalidated push bc exx pop de ; de = & struct sp1_update to invalidate ld (hl),d ; write & struct sp1_update into tail's ptr inc hl ld (hl),e ld hl,5 add hl,de ; hl = & struct sp1_update.ulist ld (hl),0 ; nothing after this one in list exx jp NCCRrejoinremove z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_AddColSpr_callee.asm0000644000175000017500000001356010761347455027273 0ustar tygrystygrys; uint __CALLEE__ sp1_AddColSpr_callee(struct sp1_ss *s, void *drawf, uchar type, int graphic, uchar plane) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB sp1_AddColSpr_callee XDEF ASMDISP_SP1_ADDCOLSPR_CALLEE LIB _sp1_struct_cs_prototype XREF _u_malloc, _u_free, SP1V_TEMP_IX .sp1_AddColSpr_callee pop af pop hl ld h,l pop bc pop de ld l,e pop de pop ix push af .asmentry ; Adds another column to an existing sprite. ; ; enter : ix = struct sp1_ss * ; h = plane ; l = type (index into table), bit 7 = 1 for occluding, bit 4 = 1 clear pixelbuffer ; bc = graphic definition for column ; de = address of sprite draw function ; uses : af, bc, de, hl, bc', de', hl', ix ; exit : carry flag for success and hl=1, else memory allocation failed and hl=0 .SP1AddColSpr exx ld hl,0 ; first try to get all the memory we need push hl ; push a 0 on stack to indicate end of allocated memory blocks ld b,(ix+3) ; b = height .csalloc push bc ld hl,22 ; sizeof(struct sp1_cs) push ix push hl call _u_malloc pop bc jp nc, fail pop ix pop bc push hl ; stack allocated block djnz csalloc exx ex (sp),hl ; hl = new struct sp1_cs, stack: l = type h = plane push de ; save draw function ld (SP1V_TEMP_IX),ix ; (SP1_TEMP_IX) = struct sp1_ss * ; have all necessary memory blocks on stack, hl = new struct sp1_cs ld de,_sp1_struct_cs_prototype ex de,hl ; hl = & struct sp1_cs prototype, de = & new struct sp1_cs ld ixl,e ld ixh,d ; ix = & struct sp1_cs push bc ; save bc = graphic def ld bc,22 ; sizeof(struct sp1_cs) ldir ; copy prototype into new struct pop bc ; bc = graphic def ; have copied prototype struct sp1_cs, now fill in the rest of the details pop de ; de = draw function pop hl ; h = plane, l = type push bc ; stack graphic def ld c,e ld b,d ; bc = draw function ld (ix+4),h ; store plane ld a,l and $90 or $40 ld (ix+5),a ; store type ld e,ixl ld d,ixh ld hl,8 add hl,de ex de,hl ; de = & struct sp1_cs.draw_code (& embedded code in struct sp1_cs) ld hl,-10 add hl,bc ; hl = & draw function data ld bc,10 ; length of draw code ldir ; copy draw code into struct sp1_cs ld a,(SP1V_TEMP_IX) add a,8 ld (ix+6),a ; store & struct sp1_ss + 8 (& embedded code in struct sp1_ss) ld a,(SP1V_TEMP_IX + 1) adc a,0 ld (ix+7),a pop bc ld (ix+9),c ; store graphics ptr ld (ix+10),b ld hl,(SP1V_TEMP_IX) ld bc,15 add hl,bc ld c,(hl) inc hl ld l,(hl) ld h,c ; hl = first struct sp1_cs in sprite .loop ; (SP1_TEMP_IX) = struct sp1_ss, ix = next struct sp1_cs to be added to sprite, hl = & next struct sp1_cs in sprite being iterated ld bc,4 .search ld d,(hl) inc hl ld e,(hl) ; de = next struct sp1_cs within sprite in iteration add hl,bc ; hl = & struct sp1_cs.type bit 6,(hl) ; is this struct sp1_cs in last column? ex de,hl jp z, search ex de,hl ; hl = & struct sp1_cs.type in last column, de = next struct sp1_cs at start of next row res 6,(hl) ; no longer last in column ld bc,-5 add hl,bc ; hl = & struct sp1_cs formerly in last column ld a,ixh ; store ptr to new struct sp1_cs as following this one ld (hl),a inc hl ld a,ixl ld (hl),a ld (ix+0),d ; and store next struct sp1_cs at start of next row as following the new one ld (ix+1),e ld bc,8 add hl,bc ; hl = & struct sp1_cs.def formerly in last column ld a,(hl) ld (ix+13),a ; copy left struct's graphic pointer into new struct's left graphic ptr inc hl ld a,(hl) ld (ix+14),a pop hl ; get next allocated memory block ld a,h or l jr z, done push de ; save & first struct sp1_cs in next row of sprite push hl ; stack new memory block ld e,ixl ld d,ixh ex de,hl ; hl = & new struct sp1_cs just added, de = memory block for new struct sp1_cs ld bc,22 ; sizeof(struct sp1_cs) ldir ; copy struct sp1_cs just added into new one ld e,(ix+9) ld d,(ix+10) ; de = graphics ptr from last struct sp1_cs pop ix ; ix = new struct sp1_cs ld hl,(SP1V_TEMP_IX) ld bc,4 add hl,bc bit 7,(hl) ld hl,8 jr z, onebyte2 ld l,16 ; if 2-byte def, offset is 16 bytes .onebyte2 add hl,de ld (ix+9),l ; store correct graphics ptr for this struct sp1_cs ld (ix+10),h pop hl ; hl = & first struct sp1_cs in next row of sprite jp loop .done set 5,(ix+5) ; indicate last struct sp1_cs added is in the last row of sprite ld ix,(SP1V_TEMP_IX) inc (ix+2) ; increase width of sprite inc l scf ; indicate success ret .fail pop ix pop bc .faillp pop hl ; hl = allocated memory block ld a,h or l ret z ; if 0 done freeing, ret with nc for failure push hl call _u_free ; free the block pop hl jp faillp DEFC ASMDISP_SP1_ADDCOLSPR_CALLEE = asmentry - sp1_AddColSpr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_CreateSpr_callee.asm0000644000175000017500000001373310761347455027352 0ustar tygrystygrys; struct sp1_ss __CALLEE__ *sp1_CreateSpr_callee(void *drawf, uchar type, uchar height, int graphic, uchar plane) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB sp1_CreateSpr_callee XDEF ASMDISP_SP1_CREATESPR_CALLEE LIB _sp1_struct_ss_prototype, _sp1_struct_cs_prototype XREF _u_malloc, _u_free, SP1V_TEMP_AF, SP1V_TEMP_IX .sp1_CreateSpr_callee pop ix pop bc pop hl pop de ld a,e pop de ld b,e pop de push ix .asmentry ; Create sprite of given height one column wide. Further columns are ; added with successive calls to SP1AddColSpr. ; ; enter : a = height in chars ; b = type: bit 7 = 1 occluding, bit 6 = 1 2 byte definition, bit 4 = 1 clear pixelbuff ; c = plane sprite occupies (0 = closest to viewer) ; de = address of draw function ; hl = graphic definition for column ; uses : all except af',iy ; exit : no carry and hl=0 if memory allocation failed else hl = struct sp1_ss * and carry set .SP1CreateSpr ld (SP1V_TEMP_AF + 1),a ; a = a' = height exx ld hl,0 ; first try to get all the memory we need push hl ; push a 0 on stack to indicate end of allocated memory blocks ld b,a ; b = height .csalloc push bc ; save height counter ld hl,22 ; sizeof(struct sp1_cs) push hl call _u_malloc pop bc jp nc, fail pop bc push hl ; stack allocated block djnz csalloc ld hl,20 ; sizeof(struct sp1_ss) push hl call _u_malloc pop bc jp nc, fail push hl exx ex (sp),hl ; stack = graphic pointer push de ; save de = draw function push bc ; save b = type, c = plane ; have all necessary memory blocks on stack, hl = & struct sp1_ss ld de,_sp1_struct_ss_prototype ex de,hl ; hl = & struct sp1_ss prototype, de = & new struct sp1_ss ld ixl,e ld ixh,d ; ix = & struct sp1_ss ld bc,20 ; sizeof(struct sp1_ss) ldir ; copy prototype into new struct ; have copied prototype struct sp1_ss, now fill in the rest of the details ld a,(SP1V_TEMP_AF + 1) ; a = height ld (ix+3),a ; store height pop bc ; b = type, c = plane bit 6,b jr z, onebyte set 7,(ix+4) ; indicate 2-byte definition .onebyte ld a,b ; a = type and $90 or $40 ; a = type entry for struct sp1_cs pop de ; de = draw function pop hl ex (sp),hl ; stack = graphics ptr, hl = & first struct sp1_cs push de ; save draw function ld (ix+15),h ; store ptr to first struct sp1_cs in struct sp1_ss ld (ix+16),l ld (SP1V_TEMP_IX),ix ; struct sp1_ss now in SP1V_TEMP_IX ; done with struct sp1_ss, now do first struct sp1_cs ld de,_sp1_struct_cs_prototype ex de,hl ; hl = & struct sp1_cs prototype, de = & new struct sp1_cs ld ixl,e ld ixh,d ; ix = & struct sp1_cs push bc ; save c = plane ld bc,22 ; sizeof(struct sp1_cs) ldir ; copy prototype into new struct pop bc ; c = plane ; have copied prototype struct sp1_cs, now fill in the rest of the details ld (ix+4),c ; store plane ld (ix+5),a ; store type ld e,ixl ld d,ixh ld hl,8 add hl,de ex de,hl ; de = & struct sp1_cs.draw_code (& embedded code in struct sp1_cs) pop bc ; bc = draw function ld hl,-10 add hl,bc ; hl = embedded draw function code ld bc,10 ; length of draw code ldir ; copy draw code into struct sp1_cs ld a,(SP1V_TEMP_IX) add a,8 ld (ix+6),a ; store & struct sp1_ss + 8 (& embedded code in struct sp1_ss) ld a,(SP1V_TEMP_IX + 1) adc a,0 ld (ix+7),a pop hl ; hl = graphics ptr ld (ix+9),l ; store graphics ptr ld (ix+10),h .loop ; (SP1_TEMP_IX) = struct sp1_ss, ix = last struct sp1_cs added to sprite pop hl ; hl = & next struct sp1_cs to add ld a,h or l jr z, done push hl ld (ix+0),h ; store ptr to next struct sp1_cs ld (ix+1),l ld e,ixl ld d,ixh ex de,hl ; hl = last struct sp1_cs, de = new struct sp1_cs ld bc,22 ; sizeof(struct sp1_cs) ldir ; make copy of last one into new one ld e,(ix+9) ld d,(ix+10) ; de = graphics ptr from last struct sp1_cs pop ix ; ix = new struct sp1_cs ld (ix+0),c ; place 0 into struct sp1_cs.next_in_spr to indicate ld (ix+1),c ; this is currently last struct sp1_cs in sprite ld hl,(SP1V_TEMP_IX) ; hl = struct sp1_ss * ld bc,4 add hl,bc bit 7,(hl) ld hl,8 ; offset to next character in sprite graphic def jr z, onebyte2 ld l,16 ; if 2-byte def, offset is 16 bytes .onebyte2 add hl,de ld (ix+9),l ; store correct graphics ptr for this struct sp1_cs ld (ix+10),h jp loop .done set 5,(ix+5) ; indicate last struct sp1_cs added is in the last row of sprite ld hl,(SP1V_TEMP_IX) ; hl = struct sp1_ss * scf ; indicate success ret .fail pop bc .faillp pop hl ; hl = allocated memory block ld a,h or l ret z ; if 0 done freeing, ret with nc for failure push hl call _u_free ; free the block pop hl jp faillp DEFC ASMDISP_SP1_CREATESPR_CALLEE = asmentry - sp1_CreateSpr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_InitCharStruct.asm0000644000175000017500000000111310760516260027037 0ustar tygrystygrys; void sp1_InitCharStruct(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane) ; CALLER linkage for function pointers XLIB sp1_InitCharStruct LIB sp1_InitCharStruct_callee XREF ASMDISP_SP1_INITCHARSTRUCT_CALLEE .sp1_InitCharStruct ld hl,2 add hl,sp ld a,(hl) ld ixl,a inc hl inc hl ld c,(hl) inc hl ld b,(hl) inc hl ld a,(hl) ld ixh,a inc hl inc hl ld e,(hl) inc hl ld d,(hl) inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ld a,ixh jp sp1_InitCharStruct_callee + ASMDISP_SP1_INITCHARSTRUCT_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_InitCharStruct_callee.asm0000644000175000017500000000351210760516260030351 0ustar tygrystygrys; void __CALLEE__ sp1_InitCharStruct_callee(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB sp1_InitCharStruct_callee XDEF ASMDISP_SP1_INITCHARSTRUCT_CALLEE LIB _sp1_struct_cs_prototype XREF SP1V_ROTTBL .sp1_InitCharStruct_callee pop hl pop bc ld ixl,c pop bc pop de ld a,e pop de ex (sp),hl ; enter : ixl= plane ; a = type ; hl = struct sp1_cs * ; de = address of sprite draw function ; bc = graphic ; uses : af, bc, de, hl .asmentry push bc ; save graphic push de ; save draw function ex de,hl ; de = struct sp1_cs * ld hl,_sp1_struct_cs_prototype ld bc,22 ldir ; copy prototype struct sp1_cs into sp1_cs ld hl,-5 add hl,de ; hl = & sp1_cs.draw + 1b pop de dec de ; de = & last byte of draw function data ex de,hl ldd ; copy draw function data into struct sp1_cs ldd ldd dec hl dec hl dec de dec de ldd ldd pop bc ; bc = graphic ex de,hl ld (hl),b dec hl ld (hl),c dec hl dec de dec de ex de,hl ldd ex de,hl ; hl = & sp1_cs.ss_draw + 1b ld (hl),sp1_ss_embedded / 256 dec hl ld (hl),sp1_ss_embedded % 256 dec hl ; hl = & sp1_cs.type ld (hl),a ; store type dec hl ld a,ixl ld (hl),a ; store plane ret .sp1_ss_embedded ld a,SP1V_ROTTBL/256 + 8 ; use rotation of four pixels if user selects a non-NR draw function ld bc,0 ex de,hl jp (hl) DEFC ASMDISP_SP1_INITCHARSTRUCT_CALLEE = asmentry - sp1_InitCharStruct_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_MoveSprAbs.asm0000644000175000017500000000105310760516260026155 0ustar tygrystygrys; void sp1_MoveSprAbs(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot) ; CALLER linkage for function pointers XLIB sp1_MoveSprAbs LIB sp1_MoveSprAbs_callee XREF ASMDISP_SP1_MOVESPRABS_CALLEE XREF SP1V_TEMP_IY .sp1_MoveSprAbs pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop ix ld (SP1V_TEMP_IY),ix pop ix push hl push hl push hl push hl push de push bc push de push af jp sp1_MoveSprAbs_callee + ASMDISP_SP1_MOVESPRABS_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_MoveSprAbs_callee.asm0000644000175000017500000001237710760516260027475 0ustar tygrystygrys; void __CALLEE__ sp1_MoveSprAbs_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version ; *** PLEASE HELP ME I'VE BEEN MADE UGLY BY BUGFIXES XLIB sp1_MoveSprAbs_callee XDEF ASMDISP_SP1_MOVESPRABS_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE XREF SP1V_ROTTBL, SP1V_DISPWIDTH, SP1V_UPDATELISTT XREF SP1V_TEMP_AF, SP1V_TEMP_IX, SP1V_TEMP_IY LIB SP1AddSprChar, SP1RemoveSprChar .sp1_MoveSprAbs_callee pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop ix ld (SP1V_TEMP_IY),ix pop ix push af .asmentry ; enter: ix = & struct sp1_ss ; hl = sprite frame address (0 = no change) ; d = new row coord in chars ; e = new col coord in chars ; b = new horizontal rotation (0..7) ie horizontal pixel position ; c = new vertical rotation (0..7) ie vertical pixel position ; (SP1V_TEMP_IY) = clipping rectangle entirely on screen ; (..+0) = row, (..+1) = col, (..+2) = width, (..+3) = height ; uses : all except iy, af' .SP1MoveSprAbs ld (SP1V_TEMP_IX),ix ld (ix+5),b ; store new horizontal rotation ld a,b cp (ix+17) ; decide if last col should draw, result in b rl b add a,a add a,SP1V_ROTTBL/256 ld (ix+9),a ; store effective horizontal rotation (MSB of lookup table to use) xor a sub c ; a = - (vertical rotation in pixels) bit 7,(ix+4) jp z, onebytedef sub c ; a = - 2*(vertical rotation) for 2-byte definitions set 7,c .onebytedef ld (ix+4),c ; store new vertical rotation ld c,a ; c = vertical rotation offset for graphics ptrs ld a,(ix+4) ; decide if last row should draw and $07 cp (ix+18) ld a,b rla ld (SP1V_TEMP_AF + 1),a ld a,h or l jr nz, newframe ld l,(ix+6) ld h,(ix+7) ; hl = old sprite frame pointer jp framerejoin .newframe ld (ix+6),l ld (ix+7),h ; store new frame pointer .framerejoin ld a,c or a jr z, skipadj ld b,$ff ; bc = negative vertical rotation offset add hl,bc ; add vertical rotation offset .skipadj ld (ix+11),l ld (ix+12),h ; store new effective offset for graphics pointers ; d = new row coord (chars) ; e = new col coord (chars) ; ix = & struct sp1_ss ; iy = clipping rectangle ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; ; 329 cycles to this point worst case ld (ix+19),0 ld a,(ix+0) ; has the row coord changed? cp d jp nz, changing0 ld a,(ix+1) ; has the col coord changed? cp e jp nz, changing1 ; not changing character coordinate, no need to remove sprite from update struct lists ; ///////////////////////////////////////////////////////////////////////////////// ; MOVE SPRITE, CHARACTER COORDINATES NOT CHANGING ; ///////////////////////////////////////////////////////////////////////////////// ld h,(ix+15) ld l,(ix+16) push de exx pop de ld hl,(SP1V_UPDATELISTT) ld bc,5 add hl,bc push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ld b,(ix+0) pop de push hl push de ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; iy = & clipping rectangle ; ix = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row INCLUDE "./zx81hr/sprites/MoveNC.asm" .done exx ld de,-5 add hl,de ; hl = & last struct sp1_update.ulist in invalidated list ld (SP1V_UPDATELISTT),hl ret ; changing character coordinate, must remove and place sprite in update struct lists ; ///////////////////////////////////////////////////////////////////////////////// ; MOVE SPRITE, CHANGING CHARACTER COORDINATES ; ///////////////////////////////////////////////////////////////////////////////// .changing0 ld (ix+0),d ; write new row coord .changing1 ld (ix+1),e ; write new col coord ; d = new row coord (chars) ; e = new col coord (chars) ; ix = & struct sp1_ss ; iy = & clipping rectangle ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ld h,(ix+15) ld l,(ix+16) push de exx pop de ld hl,(SP1V_UPDATELISTT) ld bc,5 add hl,bc push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ld b,(ix+0) pop de push hl push de ; b = row coord ; c = col coord (in column loop) ; hl = struct sp1_update ; hl'= & struct sp1_cs ; a' = bit 0 = 1 if last row should not draw, bit 1 = 1 if last col should not draw ; iy = & clipping rectangle ; ix = & struct sp1_ss ; stack = & struct sp1_update.ulist (tail of invalidated list), row INCLUDE "./zx81hr/sprites/MoveC.asm" ; jumps to done for exit inside INCLUDE DEFC ASMDISP_SP1_MOVESPRABS_CALLEE = asmentry - sp1_MoveSprAbs_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_MoveSprPix.asm0000644000175000017500000000071710760516260026216 0ustar tygrystygrys; void sp1_MoveSprPix(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uint x, uint y) ; CALLER linkage for function pointers XLIB sp1_MoveSprPix LIB sp1_MoveSprPix_callee XREF ASMDISP_SP1_MOVESPRPIX_CALLEE XREF SP1V_TEMP_IY .sp1_MoveSprPix pop af pop bc pop de pop hl pop ix ld (SP1V_TEMP_IY),ix pop ix push hl push hl push hl push de push bc push af jp sp1_MoveSprPix_callee + ASMDISP_SP1_MOVESPRPIX_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_MoveSprPix_callee.asm0000644000175000017500000000277210760516260027526 0ustar tygrystygrys; void __CALLEE__ sp1_MoveSprPix_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uint x, uint y) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB sp1_MoveSprPix_callee XDEF ASMDISP_SP1_MOVESPRPIX_CALLEE LIB sp1_MoveSprAbs_callee XREF ASMDISP_SP1_MOVESPRABS_CALLEE XREF SP1V_TEMP_IY .sp1_MoveSprPix_callee pop af pop bc pop de pop hl pop ix ld (SP1V_TEMP_IY),ix pop ix push af .asmentry ; Move sprite to an absolute pixel location. ; ; enter: ix = sprite structure address ; (SP1V_TEMP_IY) = clipping rectangle, absolute coords and entirely on screen ; (..+0) = row, (..+1) = col, (..+2) = width, (..+3) = height ; de = pixel x coordinate (0..2047 is meaningful) ; bc = pixel y coordinate (0..2047 is meaningful) ; hl = next sprite frame (0 for no change) ; uses : af, bc, de + SP1MoveSprAbs .SP1MoveSprPix ld a,e and $07 srl d ; compute: de = de / 8, a = de % 8 rr e srl d rr e srl d rr e ; e = new col coord in chars ld d,b ld b,a ; b = new horizontal rotation (0..7) ; dc = y coord ld a,c and $07 srl d ; compute: dc = dc / 8, a = dc % 8 rr c srl d rr c srl d rr c ld d,c ; d = new row coord in chars ld c,a ; c = new vertical rotation (0..7) jp sp1_MoveSprAbs_callee + ASMDISP_SP1_MOVESPRABS_CALLEE DEFC ASMDISP_SP1_MOVESPRPIX_CALLEE = asmentry - sp1_MoveSprPix_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_MoveSprRel.asm0000644000175000017500000000106610760516260026176 0ustar tygrystygrys; void sp1_MoveSprRel(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot) ; CALLER linkage for function pointers XLIB sp1_MoveSprRel LIB sp1_MoveSprRel_callee XREF ASMDISP_SP1_MOVESPRREL_CALLEE XREF SP1V_TEMP_IY .sp1_MoveSprRel pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop ix ld (SP1V_TEMP_IY),ix pop ix push hl push hl push hl push hl push de push bc push de push af jp sp1_MoveSprRel_callee + ASMDISP_SP1_MOVESPRREL_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_MoveSprRel_callee.asm0000644000175000017500000000356310760516260027507 0ustar tygrystygrys; void __CALLEE__ sp1_MoveSprRel_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB sp1_MoveSprRel_callee XDEF ASMDISP_SP1_MOVESPRREL_CALLEE LIB sp1_MoveSprAbs_callee XREF ASMDISP_SP1_MOVESPRABS_CALLEE XREF SP1V_TEMP_IY .sp1_MoveSprRel_callee pop af pop de pop bc ld b,e pop de pop hl ld d,l pop hl pop ix ld (SP1V_TEMP_IY),ix pop ix push af .asmentry ; Move sprite a relative distance from current position. ; ; enter: ix = sprite structure address ; hl = next sprite frame address (0 for no change) ; d = relative row coord, signed byte ; e = relative col coord, signed byte ; b = relative horizontal pixel movement, signed byte ; c = relative vertical pixel movement, signed byte ; (SP1V_TEMP_IY) = clipping rectangle absolute coords and entirely on screen ; (..+0) = row, (..+1) = col, (..+2) = width, (..+3) = height ; uses : af, bc, de + SP1MoveSprAbs .SP1MoveSprRel ld a,(ix+5) ; current horizontal rotation add a,b ld b,a sra a sra a sra a add a,e add a,(ix+1) ld e,a ; e = absolute column position ld a,b cp $80 jp c, mvpos1 add a,8 .mvpos1 and $07 ld b,a ; b = absolute horizontal rotation ld a,(ix+4) ; current vertical rotation and $07 ; get rid of flag in bit 7 add a,c ld c,a sra a sra a sra a add a,d add a,(ix+0) ld d,a ; d = absolute row position ld a,c cp $80 jp c, mvpos2 add a,8 .mvpos2 and $07 ld c,a ; c = absolute vertical rotation jp sp1_MoveSprAbs_callee + ASMDISP_SP1_MOVESPRABS_CALLEE DEFC ASMDISP_SP1_MOVESPRREL_CALLEE = asmentry - sp1_MoveSprRel_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_PreShiftSpr.asm0000644000175000017500000000111410760516260026343 0ustar tygrystygrys; void *sp1_PreShiftSpr(uchar flag, uchar height, uchar width, void *srcframe, void *destframe, uchar rshift) ; CALLER linkage for function pointers XLIB sp1_PreShiftSpr LIB sp1_PreShiftSpr_callee XREF ASMDISP_SP1_PRESHIFTSPR_CALLEE .sp1_PreShiftSpr ld hl,2 add hl,sp ld c,(hl) inc hl inc hl ld e,(hl) inc hl ld d,(hl) inc hl ld ixl,e ld ixh,d ld e,(hl) inc hl ld d,(hl) inc hl ld b,(hl) inc hl inc hl ld a,(hl) inc hl inc hl ld h,(hl) ld l,a ld a,c jp sp1_PreShiftSpr_callee + ASMDISP_SP1_PRESHIFTSPR_CALLEE z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/sprites/sp1_PreShiftSpr_callee.asm0000644000175000017500000000526710760516260027665 0ustar tygrystygrys; void __CALLEE__ *sp1_PreShiftSpr_callee(uchar flag, uchar height, uchar width, void *srcframe, void *destframe, uchar rshift) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB sp1_PreShiftSpr_callee XDEF ASMDISP_SP1_PRESHIFTSPR_CALLEE .sp1_PreShiftSpr_callee pop af exx pop bc exx pop ix pop de pop bc ld b,c pop hl ld c,l pop hl push af ld h,l ld l,c exx ld a,c exx .asmentry ; enter : a = right shift amount (0-7) ; b = width in characters (# columns) ; h = zero for 1-byte definition; otherwise 2-byte ; de = source frame graphic ; ix = destination frame address ; l = height in characters ; exit : hl = next available address ; uses : af, bc, de, hl, b', ix .SP1PreShiftSpr and $07 inc a ld c,a ; c = right shift amount + 1 ld a,l inc h dec h ld hl,dummy1byte ; point at two 0 bytes if 1-byte def jr z, onebyte add a,a ld hl,dummy2byte ; point at (255,0) pair if 2-byte def .onebyte add a,a add a,a add a,a ; a = # bytes in graphic definition in each column .dofirstcol ; first column has no graphics on left, will use dummy bytes for left push de ; save top of first column exx ld b,a push bc ; save height of column in bytes .firstcolloop exx push bc ; save width and rotation amount ld b,c ; b = right shift + 1 ld c,(hl) ; c = graphic byte from col on left ld a,1 xor l ld l,a ld a,(de) ; a = graphic byte in current col inc de djnz firstsloop jp firstdoneshift .firstsloop rr c rra djnz firstsloop .firstdoneshift ld (ix+0),a ; store shifted graphic in destination frame inc ix pop bc exx djnz, firstcolloop pop bc exx pop hl djnz nextcol push ix pop hl ret .nextcol ; do rest of columns push de exx push bc ; b' = height in pixels ; de = graphic definition for this column ; hl = graphic definition for column to left ; b = width remaining in characters ; c = right shift amount + 1 .colloop exx push bc ld b,c ld a,(de) inc de ld c,(hl) inc hl djnz sloop jp doneshift .sloop rr c rra djnz sloop .doneshift ld (ix+0),a inc ix pop bc exx djnz, colloop pop bc exx pop hl djnz nextcol push ix pop hl ret defb 0 .dummy1byte defb 0,0 .dummy2byte defb 255,0 DEFC ASMDISP_SP1_PRESHIFTSPR_CALLEE = asmentry - sp1_PreShiftSpr_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/tiles/0000755000175000017500000000000010765202715022301 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/tiles/sp1_ClearRectInv_callee.asm0000644000175000017500000000465410761347455027434 0ustar tygrystygrys; void __CALLEE__ sp1_ClearRectInv_callee(struct sp1_Rect *r, uchar tile, uchar rflag) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB sp1_ClearRectInv_callee XDEF ASMDISP_SP1_CLEARRECTINV_CALLEE LIB sp1_GetUpdateStruct_callee, sp1_ClearRect_callee, l_jpix XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE, ASMDISP_SP1CRSELECT XREF SP1V_DISPWIDTH, SP1V_UPDATELISTT .sp1_ClearRectInv_callee pop af pop bc pop hl pop de push af ld a,c push hl ex de,hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl .asmentry ; Clear a rectangular area on screen, erasing sprites, ; changing tile and changing colour depending on flags. ; Invalidate the area so that it is drawn in the next update. ; ; enter : d = row coord ; e = col coord ; b = width ; c = height ; l = tile ; a = bit 0 set for tiles, bit 1 set for tile colours, bit 2 set for sprites ; uses : af, bc, de, hl, ix .SP1ClearRectInv and $07 ret z ; ret if all flags reset push hl call sp1_ClearRect_callee + ASMDISP_SP1CRSELECT ; ix = address of operation code (depending on flags passed in) call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct update pop de ; d = attr, e = tile push ix ld ix,(SP1V_UPDATELISTT) ; ix = last struct sp1_update in draw queue .rowloop push bc ; save b = width push hl ; save update position .colloop ld a,$80 xor (hl) jp p, alreadyinv ; if this update struct already invalidated, skip ahead ld (hl),a ld (ix+5),h ; store link in last invalidated update struct to this struct update ld (ix+6),l ld a,l ; make this update struct the last one in invalidated list ld ixl,a ; "ld iyl,l" is likely taken as "ld iyl,iyl" ld a,h ld ixh,a .alreadyinv ex (sp),ix ; stack = update list tail call l_jpix ; apply operation on hl, advance hl to next struct sp1_update to the right ex (sp),ix djnz colloop pop hl ld bc,9*SP1V_DISPWIDTH add hl,bc pop bc dec c jp nz, rowloop ld (ix+5),0 ld (SP1V_UPDATELISTT),ix pop ix ret DEFC ASMDISP_SP1_CLEARRECTINV_CALLEE = asmentry - sp1_ClearRectInv_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/tiles/sp1_PutTilesInv_callee.asm0000644000175000017500000000501610760516260027321 0ustar tygrystygrys; void __CALLEE__ sp1_PutTilesInv_callee(struct sp1_Rect *r, struct sp1_tp *src) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB sp1_PutTilesInv_callee XDEF ASMDISP_SP1_PUTTILESINV_CALLEE LIB sp1_GetUpdateStruct_callee XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE XREF SP1V_DISPWIDTH, SP1V_UPDATELISTT, SP1V_TEMP_AF .sp1_PutTilesInv_callee pop af pop hl ex (sp),hl ld d,(hl) inc hl ld e,(hl) inc hl ld b,(hl) inc hl ld c,(hl) pop hl push af .asmentry ; Copy a rectangular set of tiles and colours to screen. The ; source array can be filled in by SP1GetTiles. Invalidate ; the rectangular area so that it is drawn in the next update. ; ; enter : hl = struct sp1_tp[] array of attr/tile pairs ; d = row coord ; e = col coord ; b = width ; c = height ; uses : af, bc, de, hl, ix .SP1PutTilesInv push hl call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ; hl = & struct sp1_update pop de ; de = struct sp1_tp * ex de,hl ; hl = struct sp1_tp *, de = & struct sp1_update ld a,c ; a = height ld c,$ff ld ix,(SP1V_UPDATELISTT) .rowloop push bc ; save b = width push de ; save update position ld (SP1V_TEMP_AF + 1),a ; a' = height .colloop ld a,(de) xor $80 jp p, skipinval ; bit 7 now reset if already invalidated ld (de),a ld (ix+5),d ; this struct sp1_update to end of list ld (ix+6),e ld ixl,e ld ixh,d .skipinval inc de ldi ; copy colour tile from struct sp1_tp[] ldi ; into struct sp1_update ld a,6 add a,e ld e,a jp nc, noinc inc d ; de = next struct sp1_update * one column to right .noinc djnz colloop ex (sp),hl ; hl = struct sp1_update * in same row but leftmost column ld bc,9*SP1V_DISPWIDTH add hl,bc ; hl = struct sp1_update * one row down leftmost column pop de ex de,hl ; de = struct sp1_update * down one row, hl = struct sp1_tp[] pop bc ; b = width ld a,(SP1V_TEMP_AF + 1) ; a = height dec a jp nz, rowloop ld (ix+5),0 ld (SP1V_UPDATELISTT),ix ret DEFC ASMDISP_SP1_PUTTILESINV_CALLEE = asmentry - sp1_PutTilesInv_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/tiles/SP1PrintString.asm0000644000175000017500000002345010763354025025616 0ustar tygrystygrys; m/c entry point for print string function ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB SP1PrintString LIB sp1_GetUpdateStruct_callee, l_jpix XREF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE XREF SP1V_UPDATELISTT, SP1V_DISPWIDTH XREF SP1V_TEMP_IX, SP1V_TEMP_AF ; A sophisticated print string function ; ; The string to print is pointed at by HL and terminates with a 0 byte. ; Characters are printed as background tiles ; with the following special character codes understood: ; ; code meaning ; ---- ------- ; 0 terminate string ; 1 NOP N* [other ports: logically AND into attribute mask N*] ; 2 gotoy N* (goto y coordinate on same column) ; 3 ywrap N* ; 4 NOP N* [other ports: attribute mask N*] ; 5 16-bit tile code follows W* ; 6 gotox N* (goto x coordinate on same line) ; 7 print string at address W* (like a subroutine call / macro for printstrings; see also 26,28) ; 8 left ; 9 right ; 10 up ; 11 down ; 12 home (to top left of bounds rectangle) ; 13 carriage return (move to start of next line in bounds rectangle) ; 14 repeat N* ; 15 endrepeat ; 16 NOP N* [other ports: ink N*] ; 17 NOP N* [other ports: paper N*] ; 18 NOP N* [other ports: flash N*] ; 19 NOP N* [other ports: bright N*] ; 20 NOP N* [other ports: attribute N*] ; 21 invalidate N* ; 22 AT y(N*),x(N*) (relative to bounds rectangle) ; 23 AT dy(N*), dx(N*) (relative to current position in bounds rectangle) ; 24 xwrap N* ; 25 yinc N* ; 26 push state ; 27 escape, next char is literal not special code ; 28 pop state ; 29 transparent char ; 30 NOP N* [other ports: logically OR into attribute mask N*] ; 31 visit : call function pointed at by ix with current struct_sp1_update as parameter ; ; * N is a single byte parameter following the code. ; * W is a 16-bit parameter following the code. ; ; All printing is done within a bounds rectangle. No printing outside this ; bounds rectangle will occur. ; ; enter: HL = address of string to print ; E = flags (bit 0 = invalidate?, bit 1 = xwrap?, bit 2 = yinc?, bit3 = ywrap?) ; B = current x coordinate (relative to bounds rect IX) ; C = current y coordinate (relative to bounds rect IX) ; ( HL' = & tail struct sp1_update.ulist in invalidated list ) loaded here, not entry condition ; DE' = current struct sp1_update * ; (SP1V_TEMP_IX) = visit function ; IX+0 = row coordinate \ ; IX+1 = col coordinate | Bounds Rectangle ; IX+2 = width in chars | Must Fit On Screen ; IX+3 = height in chars / ; exit : same as enter ; uses : all except af', iy ; ; The C API maintains a structure to retain the print state between calls. ; Doing something similar from assembly language may be helpful. .SP1PrintString exx ld hl,(SP1V_UPDATELISTT) ld bc,5 add hl,bc exx .psloop ld a,(hl) or a jr z, alldone inc hl cp 32 jp nc, printable ; here we have a special code [1,31] push hl ld d,a add a,a ; get address of handler from jump table ld h,jumptbl/256 add a,jumptbl%256 ld l,a jp nc, nospill inc h .nospill ld a,(hl) inc hl ld h,(hl) ld l,a ld a,d ; restore A to code ex (sp),hl ret .alldone exx ld (hl),0 ld bc,-5 add hl,bc ld (SP1V_UPDATELISTT),hl exx ret .jumptbl defw NOP0, NOP1, codeGotoY, codeYWrap defw NOP1, codeTC, codeGotoX, codePString defw codeLeft, codeRight, codeUp, codeDown defw codeHome, codeReturn, codeRepeat, codeEndRepeat defw NOP1, NOP1, NOP1, NOP1 defw NOP1, codeInvalidate, codeAt, codeAtRel defw codeXWrap, codeYInc, codePush, codeEscape defw codePop, codeTransparent, NOP1, codeVisit .NOP1 inc hl ; consume a single byte parameter ; fall through to NOP0 .NOP0 jp psloop ; on to the next byte to interpret .codeVisit ld a,b ; only visit if inbounds cp (ix+2) jp nc, psloop ld a,c cp (ix+3) jp nc, psloop push ix push bc push de push hl exx push hl push de ex de,hl ld ix,(SP1V_TEMP_IX) call l_jpix pop de pop hl exx pop hl pop de pop bc pop ix jp psloop .codeYWrap ld a,(hl) ; parameter following YWRAP (0/1) inc hl rra jp nc, noywrap set 3,e jp psloop .noywrap res 3,e jp psloop .codeEscape ld a,(hl) ; char following ESCAPE inc hl jp printable .codePop exx pop de exx pop de pop bc jp psloop .codePush push bc push de exx push de exx jp psloop .codeYInc ld a,(hl) ; parameter following YINC (0/1) inc hl rra jp nc, noywrap5 set 2,e jp psloop .noywrap5 res 2,e jp psloop .codeXWrap ld a,(hl) ; parameter following XWRAP (0/1) inc hl rra jp nc, noxwrap set 1,e jp psloop .noxwrap res 1,e jp psloop .codeAtRel ld a,(hl) add a,c ld c,a inc hl ld a,(hl) add a,b ld b,a inc hl jp computenewupdate .codeAt ld c,(hl) inc hl ld b,(hl) inc hl jp computenewupdate .codeGotoX ld b,(hl) inc hl jp computenewupdate .codeGotoY ld c,(hl) inc hl jp computenewupdate .codePString ld a,(hl) inc hl ld d,(hl) inc hl push hl ld h,d ld l,a call psloop pop hl jp psloop .codeInvalidate ld a,(hl) ; parameter following INVALIDATE (0/1) inc hl srl e rra rl e jp psloop .codeHome ld bc,0 jp computenewupdate .codeReturn ld b,0 inc c jp computenewupdate .codeRepeat ld a,(hl) ; # times to repeat inc hl .reploop push hl ; save string position at start of repeat block push af ; save # remaining iterations call psloop ; returns after endrepeat or 0 terminator pop af dec a ; any more iterations? jr z, nomoreiter pop hl ; restore string pointer for next repeat jp reploop .nomoreiter pop af ; trash saved string position jp psloop .codeEndRepeat ret .codeTC ; a 16 bit tile code follows ; first check if in bounds ld a,b cp (ix+2) jr nc, codeRight2 ld a,c cp (ix+3) jr nc, codeRight2 ; are we invalidating? bit 0,e push hl exx jr z, noinvalidation2 ; invalidate the char ld a,(de) xor $80 jp p, noinvalidation2 ; if already invalidated, skip ld (de),a ld (hl),d inc hl ld (hl),e ld hl,5 add hl,de .noinvalidation2 pop bc ; bc = & 16-bit tile ld a,(bc) inc de ld (de),a ; write tile into sp1_update inc bc ld a,(bc) inc de ld (de),a dec de dec de exx .codeRight2 ; skip 16-bit tile code in string inc hl inc hl ; advance to next char on right jp codeRight .codeTransparent ; are we invalidating? bit 0,e jp z, codeRight ; invalidate the char exx ld a,(de) xor $80 jp p, noinvalidation20 ; if already invalidated, skip ld (de),a ld (hl),d inc hl ld (hl),e ld hl,5 add hl,de .noinvalidation20 exx jp codeRight .printable ; a = tile# ld (SP1V_TEMP_AF + 1),a ; first check if in bounds ld a,b cp (ix+2) jr nc, codeRight ld a,c cp (ix+3) jr nc, codeRight ; are we invalidating? bit 0,e exx jr z, noinvalidation ; invalidate the char ld a,(de) xor $80 jp p, noinvalidation ; if already invalidated, skip ld (de),a ld (hl),d inc hl ld (hl),e ld hl,5 add hl,de .noinvalidation ex de,hl inc hl ld a,(SP1V_TEMP_AF + 1) ld (hl),a ; store tile inc hl ld (hl),0 ; advance to next char on right dec hl dec hl ex de,hl exx .codeRight inc b ; increase x coord bit 1,e ; are we doing x wrap? jr nz, yesxwrap .inxbounds exx ; move update struct to right ld a,9 add a,e ld e,a jp nc, noinc1 inc d .noinc1 exx jp psloop .yesxwrap ld a,b cp (ix+2) jr c, inxbounds ld b,0 bit 2,e ; are we doing yinc? jr z, noyinc inc c bit 3,e ; are we doing ywrap? jr z, noyinc ld a,c cp (ix+3) jr c, noyinc ld c,0 .noyinc .computenewupdate ; need to compute struct sp1_update for new coords push bc exx ex (sp),hl ld a,(ix+0) add a,l ld d,a ld a,(ix+1) add a,h ld e,a call sp1_GetUpdateStruct_callee + ASMDISP_SP1_GETUPDATESTRUCT_CALLEE ex de,hl pop hl exx jp psloop .codeLeft dec b bit 1,e jr nz, yesxwrap2 .inxbounds2 exx ld a,-9 add a,e ld e,a ld a,$ff adc a,d ld d,a exx jp psloop .yesxwrap2 ld a,b cp (ix+2) jr c, inxbounds2 ld b,(ix+2) dec b bit 2,e jr z, computenewupdate dec c bit 3,e jr z, computenewupdate ld a,c cp (ix+3) jr c, computenewupdate ld c,(ix+3) dec c jp computenewupdate .codeUp dec c bit 3,e jr nz, yesywrap .inybounds exx ld a,-SP1V_DISPWIDTH*9 add a,e ld e,a ld a,#(((SP1V_DISPWIDTH*9):$ffff)+1)/256 adc a,d ld d,a exx jp psloop .yesywrap ld a,c cp (ix+3) jr c, inybounds ld c,(ix+3) dec c jp computenewupdate .codeDown inc c bit 3,e jr nz, yesywrap2 .inybounds2 exx ld a,0+(SP1V_DISPWIDTH*9)%256 add a,e ld e,a ld a,0+(SP1V_DISPWIDTH*9)/256 adc a,d ld d,a exx jp psloop .yesywrap2 ld a,c cp (ix+3) jr c, inybounds2 ld c,0 jp computenewupdate z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/tiles/SP1PSPOP.asm0000644000175000017500000000214110763353743024234 0ustar tygrystygrys; subroutine for reading the contents of a "struct sp1_pss" into registers ; 02.2008 aralbrec ; zx81 hi-res version XLIB SP1PSPOP XREF SP1V_TEMP_IX ; enter : de = & string to print (or something else) ; hl = & struct sp1_pss to read ; ; exit : de' = & struct sp1_update ; e = flags ; c = y coordinate ; b = x coordinate ; ix = & bounds rectangle ; hl = & string to print (or something else) ; (SP1V_TEMP_IX) = & visit function .SP1PSPOP ld a,(hl) ld ixl,a inc hl ld a,(hl) ld ixh,a ; ix = & bounds rectangle inc hl ld a,(hl) ; a = flags inc hl ld b,(hl) ; b = x coordinate inc hl ld c,(hl) ; c = y coordinate inc hl push hl ex de,hl ; hl = & string ld e,a ; e = flags exx pop hl ld e,(hl) inc hl ld d,(hl) ; de' = & struct sp1_update inc hl ld a,(hl) ld (SP1V_TEMP_IX),a inc hl ld a,(hl) ld (SP1V_TEMP_IX + 1),a ; (SP1V_TEMP_IX) = visit function exx ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/tiles/SP1PSPUSH.asm0000644000175000017500000000157510763353743024367 0ustar tygrystygrys; subroutine for writing registers to "struct sp1_pss" ; 02.2008 aralbrec ; zx81 hi-res version XLIB SP1PSPUSH XREF SP1V_TEMP_IX ; enter : hl = & struct sp1_pss to write to ; de' = & struct sp1_update ; e = flags ; c = y coordinate ; b = x coordinate ; ix = & bounds rectangle ; (SP1V_TEMP_IX) = & visit function .SP1PSPUSH ld a,ixl ; write bounds rectangle ld (hl),a inc hl ld a,ixh ld (hl),a inc hl ld (hl),e ; write flags inc hl ld (hl),b ; write x coordinate inc hl ld (hl),c ; write y coordinate inc hl push hl exx pop hl ld (hl),e ; write sp1_update inc hl ld (hl),d inc hl ld a,(SP1V_TEMP_IX) ; write visit function ld (hl),a inc hl ld a,(SP1V_TEMP_IX + 1) ld (hl),a ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/updater/0000755000175000017500000000000010765202715022625 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/updater/sp1_GetUpdateStruct_callee.asm0000644000175000017500000000555210760516260030513 0ustar tygrystygrys; struct sp1_update __CALLEE__ *sp1_GetUpdateStruct_callee(uchar row, uchar col) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version INCLUDE "zx81hr/customize.asm" XLIB sp1_GetUpdateStruct_callee XDEF ASMDISP_SP1_GETUPDATESTRUCT_CALLEE .sp1_GetUpdateStruct_callee pop hl pop de ex (sp),hl ld d,l .asmentry ; Return struct_sp1_update for row,col coordinate given ; 9 * (SP1V_DISPWIDTH * ROW + COL) + SP1V_UPDATEARRAY ; ; enter : d = row coord ; e = col coord ; exit : hl = struct update * ; uses : af, de, hl .SP1GetUpdateStruct ld l,d ld h,0 ld a,d ld d,h cp SP1V_DISPHEIGHT jp c, nohtadj dec h .nohtadj IF SP1V_DISPWIDTH=16 add hl,hl add hl,hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de ; hl = 16 * ROW + COL ENDIF IF SP1V_DISPWIDTH=24 add hl,hl add hl,hl add hl,hl push hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de ; hl = 24 * ROW + COL ENDIF IF SP1V_DISPWIDTH=32 add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de ; hl = 32 * ROW + COL ENDIF IF SP1V_DISPWIDTH=40 add hl,hl add hl,hl add hl,hl push hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de ; hl = 40 * ROW + COL ENDIF IF SP1V_DISPWIDTH=48 add hl,hl add hl,hl add hl,hl add hl,hl push hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de ; hl = 48 * ROW + COL ENDIF IF SP1V_DISPWIDTH=56 add hl,hl add hl,hl add hl,hl push hl add hl,hl push hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de pop de add hl,de pop de add hl,de ; hl = 56 * ROW + COL ENDIF IF SP1V_DISPWIDTH=64 add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl add hl,hl ld a,e cp SP1V_DISPWIDTH jp c, nowiadj dec d .nowiadj add hl,de ; hl = 64 * ROW + COL ENDIF ld d,h ld e,l add hl,hl add hl,hl add hl,hl add hl,de ; hl = 9 * (SP1V_DISPWIDTH * ROW + COL) ld de,SP1V_UPDATEARRAY add hl,de ret DEFC ASMDISP_SP1_GETUPDATESTRUCT_CALLEE = asmentry - sp1_GetUpdateStruct_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/updater/sp1_Initialize_callee.asm0000644000175000017500000001330110763607752027526 0ustar tygrystygrys; void __CALLEE__ sp1_Initialize_callee(uchar iflag, uchar tile) ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version INCLUDE "zx81hr/customize.asm" XLIB sp1_Initialize_callee XDEF ASMDISP_SP1_INITIALIZE_CALLEE XREF base_graphics LIB zx81toasc XDEF SP1V_DISPORIGX XDEF SP1V_DISPORIGY XDEF SP1V_DISPWIDTH XDEF SP1V_DISPHEIGHT XDEF SP1V_PIXELBUFFER XDEF SP1V_TILEARRAY XDEF SP1V_UPDATEARRAY XDEF SP1V_ROTTBL XDEF SP1V_UPDATELISTH XDEF SP1V_UPDATELISTT XDEF SP1V_TEMP_IX XDEF SP1V_TEMP_IY XDEF SP1V_TEMP_AF .sp1_Initialize_callee pop bc pop hl pop de ld a,e push bc .asmentry ; 1. Constructs the rotation table if SP1_IFLAG_MAKE_ROTTBL flag set ; 2. Initializes tile array so that ROM character set is used by ; default - if SP1_IFLAG_OVERWRITE_TILES flag is set will not alter ; graphic pointers for character codes set previously (any non-zero ; pointer is not touched) ; 3. Resets the invalidated list to empty ; 4. Resets the update array, generating display file addresses for ; each char square if SP1_IFLAG_OVERWRITE_DFILE flag is set ; ; enter : hl= startup background tile ; a = flag, bit 0 = 1 if rotation table needed, bit 1 = 1 to overwrite all tile defs ; bit 2 = 1 to overwrite screen addresses in update structs ; used : af, bc, de, hl .SP1Initialize push hl ; save tile bit 0,a jr z, norottbl ; if flag bit not set, do not construct rotation table ; construct the rotation table ld c,7 ; rotate by c bits push af .rottbllp ld a,c add a,a or SP1V_ROTTBL/256 ld h,a ld l,0 .entrylp ld b,c ld e,l xor a .rotlp srl e rra djnz rotlp ld (hl),e inc h ld (hl),a dec h inc l jp nz, entrylp dec c jp nz, rottbllp pop af .norottbl ; Initialize tile array to point to characters in ROM ; The problem here is that the zx81 character set is not ; in ascii sequence and the bitmaps stored in ROM are in ; the zx81 character set sequence. So here we step through ; all 64 bitmap definitions, convert the associated zx81 ; code (0-63) to an ascii code and then store the bitmap ; address for that ascii code into the tile map. ; ; The zx81 does not contain bitmap definitions for lower ; case letters so in the second phase we copy the bitmaps ; for the upper case letters into the lower case tile maps. ; This way, initially, all alpha chars both upper and lower ; case will at least display as upper case letters. ; a = flag ld c,a ld b,64 ld d,SP1V_TILEARRAY/256 ld hl,$1e00 ; zx81 rom char bitmaps .tileloop ld a,64 sub b cp 11 jr c, codeok ; if it's a block graphic, leave in 0-10 call zx81toasc+1 ; convert zx81 code in A to ascii .codeok ld e,a ; de = tile array entry for ascii code ex de,hl ; hl = tile array entry, de = zx81 rom bitmap ld a,(hl) ; if a tile address is already present (ie non-zero entry) inc h ; then we will skip it bit 1,c jr nz, overwrite ; unless overwrite flag set or (hl) jr nz, tilepresent .overwrite ld (hl),d dec h ld (hl),e inc h .tilepresent dec h ld a,8 add a,e ld e,a ld a,0 adc a,d ld d,a ex de,hl djnz tileloop ; now copy upper case tiles to lower case tiles ld de,SP1V_TILEARRAY + 'A' ; tile entry for 'A' ld hl,SP1V_TILEARRAY + 'a' ; tile entry for 'a' ld b,26 ; 26 letters in the english alphabet .tileloop2 ld a,(hl) ; if a tile address is already present (ie non-zero entry) inc h ; then we will skip it bit 1,c jr nz, overwrite2 ; unless overwrite flag set or (hl) jr nz, tilepresent2 .overwrite2 inc d ld a,(de) ld (hl),a dec h dec d ld a,(de) ld (hl),a inc h .tilepresent2 dec h inc hl inc de djnz tileloop2 ; init the invalidated list ld hl,SP1V_UPDATELISTH ; this variable points at a dummy struct sp1_update that is ld (SP1V_UPDATELISTT),hl ld hl,0 ld (SP1V_UPDATELISTH+5),hl ; nothing in invalidate list ; initialize the update array pop de ; de = tile code ld b,SP1V_DISPORIGY ; b = current row coord ld hl,SP1V_UPDATEARRAY ; hl = current struct sp1_update bit 2,c push af .rowloop ld c,SP1V_DISPORIGX ; c = current col coord .colloop ld (hl),1 ; # of occluding sprites in this tile + 1 inc hl ld (hl),e ; write tile code inc hl ld (hl),0 inc hl ld (hl),0 inc hl ld (hl),0 ; no sprites in the tile inc hl ld (hl),0 inc hl ld (hl),0 ; not in invalidated list inc hl pop af jr z, skipscrnaddr push af ld a,(base_graphics) ; compute screen address for char coord (b,c) add a,c ld (hl),a inc hl ld a,(base_graphics + 1) adc a,b ld (hl),a .rejoinscrnaddr inc hl ; hl points at next struct sp1_update inc c ; next column ld a,c cp SP1V_DISPORIGX + SP1V_DISPWIDTH jr c, colloop inc b ; next row ld a,b cp SP1V_DISPORIGY + SP1V_DISPHEIGHT jr c, rowloop pop af ret .skipscrnaddr push af inc hl jp rejoinscrnaddr DEFC ASMDISP_SP1_INITIALIZE_CALLEE = asmentry - sp1_Initialize_callee z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/updater/SP1DrawUpdateStruct.asm0000644000175000017500000001260410761347455027132 0ustar tygrystygrys; SP1DrawUpdateStruct ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res version XLIB SP1DrawUpdateStruct XDEF SP1RETSPRDRAW XREF SP1V_PIXELBUFFER, SP1V_TILEARRAY ; Draw the tile described by the indicated update struct ; to screen -- not meant to be called directly, just a ; code fragment called from other functions. ; ; enter : b = # occluding sprites in char + 1 ; hl = & struct sp1_update ; exit : bc = & next sp1_update in update list .haveocclspr ; there are occluding sprites in this char ; b = # occl sprites ; de = 16-bit tile code ; hl = & update.slist inc hl push hl dec hl push de jp skiplp .skipthisone ; don't need to draw this sprite ld hl,13 add hl,de ; stack = & update.slist + 1b, 16-bit tile code .skiplp ld d,(hl) inc hl ld e,(hl) ; de = & sp1_cs.ss_draw dec de ; de = & sp1_cs.type ld a,(de) rla ; is this an occluding sprite? jr nc, skipthisone ; if no skip it djnz skipthisone ; if haven't seen all occl sprites yet, skip this one too ; de = & sp1_cs.type ; a = sprite type rotated left one bit ; stack = & update.slist + 1b, 16-bit tile code and $20 ; type has been rot left one bit, check orig bit 4 if should clear pixel buff pop hl ; hl = 16-bit tile code jr z, noclearbuff ; clear pixel buffer ; de = & sp1_cs.type ; hl = 16-bit tile code ; stack = & update.slist + 1b ld a,h or a jr nz, havetiledef2 ; if MSB of tile code != 0 we have & tile definition already ld h,SP1V_TILEARRAY/256 ld a,(hl) inc h ld h,(hl) ld l,a ; hl = & tile definition .havetiledef2 push de ld de,SP1V_PIXELBUFFER ldi ; copy background tile graphics into pixel buffer ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a pop de .noclearbuff ; de = & sp1_cs.type ; stack = & update.slist + 1b ex de,hl inc hl ; hl = & sp1_cs.ss_draw jp spritedraw .SP1DrawUpdateStruct ; b = # occluding sprites in char + 1 ; hl = & struct sp1_update inc hl ; hl = & update.tile ld e,(hl) inc hl ld d,(hl) inc hl djnz haveocclspr ; deal with case of occluding sprites ex de,hl ; hl = 16-bit tile code, de = & update.slist ld a,h or a jr nz, havetiledef ; if MSB of tile code != 0 we have & tile definition already ld h,SP1V_TILEARRAY/256 ld a,(hl) inc h ld h,(hl) ld l,a ; hl = & tile definition ; de = & update.slist .havetiledef ld a,(de) or a jr z, drawtileonly ; if there are no sprites in this char, just draw background tile push de ; save & update.slist ld de,SP1V_PIXELBUFFER ldi ; copy background tile graphics into pixel buffer ldi ldi ldi ldi ldi ldi ld a,(hl) ld (de),a pop hl ; hl = & update.slist ld a,(hl) inc hl push hl ; save & update.slist + 1b .spritedrawlp ; hl = & sp1_cs.next_in_upd + 1b ; a = MSB of next sp1_cs.ss_draw ld l,(hl) ld h,a ; hl = & sp1_cs.ss_draw .spritedraw ; hl = & sp1_cs.ss_draw ; stack = & update.slist + 1b ld e,(hl) inc hl ld d,(hl) inc hl ex de,hl ; de = & sp1_cs.draw_code, hl = & sp1_ss.draw_code jp (hl) ; jump into sp1_ss's draw code .drawtileonly ; hl = & tile definition ; de = & update.slist ex de,hl inc hl inc hl ld b,(hl) inc hl ld c,(hl) ; bc = & next sp1_update in update list inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = screen address for char ; de = tile definition push bc ld bc,32 ld a,(de) ; copy tile directly to screen ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a add hl,bc inc de ld a,(de) ld (hl),a pop bc ; bc = & next sp1_update in update list ret .SP1RETSPRDRAW ; return here after sprite char drawn pop hl ; hl = & sp1_cs.next_in_upd (pushed by sprite draw code) ld a,(hl) inc hl or a jr nz, spritedrawlp ; if there are more sprites in this char go draw them pop hl ; hl = & update.slist + 1b .donesprites inc hl ld b,(hl) inc hl ld c,(hl) ; bc = & next sp1_update in update list inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl = screen address for this char cell push bc ld bc,32 ld de,(SP1V_PIXELBUFFER+0) ; copy final graphic in pixel buffer to screen ld (hl),e add hl,bc ld (hl),d add hl,bc ld de,(SP1V_PIXELBUFFER+2) ld (hl),e add hl,bc ld (hl),d add hl,bc ld de,(SP1V_PIXELBUFFER+4) ld (hl),e add hl,bc ld (hl),d add hl,bc ld de,(SP1V_PIXELBUFFER+6) ld (hl),e add hl,bc ld (hl),d pop bc ; bc = & next sp1_update in update list ret z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/zx81hr-customize.asm0000644000175000017500000000740410761503745025057 0ustar tygrystygrys ; CUSTOMIZATION TEMPLATE FOR SP1 ; 02.2008 aralbrec, Sprite Pack v3.0 ; zx81 hi-res-graphics version ; This customization file is intended for a 64k ; zx96 computer with memory map as follows: ; ; 0000 - 1fff : 8k : ROM ; 2000 - 3fff : 8k : RAM or EPROM/EEPROM (m/c possible) ; 4000 - 7fff : 16k : RAM (basic, m/c possible) ; 8000 - bfff : 16k : RAM (basic, m/c possible) ; c000 - ffff : 16k : RAM/RAM-echo (only data, no m/c) ; ; For other targets you must select a different ; and appropriate memory map by making changes below. ; At least 32k RAM is recommended. ; ; Keep in mind that the "struct sp1_ss" and "struct sp1_cs" ; that the library allocates when creating sprites contain ; executable code, meaning they must be allocated out of a ; memory block capable of executing m/c. ; /////////////////////// ; Display Characteristics ; /////////////////////// defc SP1V_DISPORIGX = 0 ; x coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPORIGY = 0 ; y coordinate of top left corner of area managed by sp1 in characters defc SP1V_DISPWIDTH = 32 ; width of area managed by sp1 in characters (16, 24, 32 ok as of now) defc SP1V_DISPHEIGHT = 24 ; height of area managed by sp1 in characters (anything reasonable ok) ; /////////////////////// ; Buffers ; /////////////////////// defc SP1V_PIXELBUFFER = $bcf8 ; address of an 8-byte buffer to hold intermediate pixel-draw results ; /////////////////////// ; Temp Variables ; /////////////////////// defc SP1V_TEMP_AF = $bcf2 defc SP1V_TEMP_IX = $bcf6 defc SP1V_TEMP_IY = $bced ; /////////////////////// ; Data Structures ; /////////////////////// defc SP1V_TILEARRAY = $f000 ; address of the 512-byte tile array associating character codes with tile graphics, must lie on 256-byte boundary (LSB=0) defc SP1V_UPDATEARRAY = $d500 ; address of the 9*SP1V_DISPWIDTH*SP1V_DISPHEIGHT byte update array defc SP1V_ROTTBL = $f000 ; location of the 3584-byte rotation table. Must lie on 256-byte boundary (LSB=0). Table begins $0200 bytes ahead of this ; pointer ($f200-$ffff in this default case). Set to $0000 if the table is not needed (if, for example, all sprites ; are drawn at exact horizontal character coordinates or you use pre-shifted sprites only). ; /////////////////////// ; SP1 Variables ; /////////////////////// defc SP1V_UPDATELISTH = $bcef ; address of 9-byte area holding a dummy struct_sp1_update that is always the "first" in list of screen tiles to be drawn defc SP1V_UPDATELISTT = $bcf0 ; address of 2-byte variable holding the address of the last struct_sp1_update in list of screen tiles to be drawn ; NOTE: SP1V_UPDATELISTT is located inside the dummy struct_sp1_update pointed at by SP1V_UPDATELISTH ; /////////////////////// ; DEFAULT MEMORY MAP ; /////////////////////// ; With these default settings the memory map is: ; ; ADDRESS (HEX) LIBRARY DESCRIPTION ; ; f200 - ffff SP1.LIB horizontal rotation tables ; f000 - f1ff SP1.LIB tile array ; d500 - efff SP1.LIB update array for 32x24 display ; bd00 - d4ff ZX81HRG 256x192 display file (suggested, least significant 5 bits of address must be 0) ; bcf8 - bcff SP1.LIB pixel buffer ; bcef - bcf7 SP1.LIB update list head - a dummy struct sp1_update acting as first in invalidated list ; * bcf0 - bcf1 SP1.LIB update list tail pointer (inside dummy struct sp1_update) ; * bcf2 - bcf3 SP1.LIB SP1V_TEMP_AF (inside dummy struct sp1_update) ; * bcf6 - bcf7 SP1.LIB SP1V_TEMP_IX (inside dummy struct sp1_update) ; bced - bcee SP1.LIB SP1V_TEMP_IY z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr/zx81hr-sp1.h0000644000175000017500000005352310760624551023210 0ustar tygrystygrys #ifndef _SP1_H #define _SP1_H /////////////////////////////////////////////////////////// // SPRITE PACK v3.0 // // ZX81 Hi-Res-Graphics Version // // aralbrec - Feb 2008 // // ported from timex sinclair 2068 hi-res version // /////////////////////////////////////////////////////////// // // // See the wiki for documentation details // // http://www.z88dk.org/wiki // // // /////////////////////////////////////////////////////////// #include #include /////////////////////////////////////////////////////////// // DATA STRUCTURES // /////////////////////////////////////////////////////////// struct sp1_Rect { uchar row; uchar col; uchar width; uchar height; }; struct sp1_update; struct sp1_ss; struct sp1_cs; struct sp1_update { // "update structs" - 9 bytes - Every tile in the display area managed by SP1 is described by one of these uchar nload; // +0 bit 7 = 1 for invalidated, bit 6 = 1 for removed, bits 5:0 = number of occluding sprites present + 1 uint tile; // +1 background 16-bit tile code (if MSB != 0 taken as address of graphic, else lookup in tile array) struct sp1_cs *slist; // +3 BIG ENDIAN ; list of sprites occupying this tile (MSB = 0 if none) points at struct sp1_cs.ss_draw struct sp1_update *ulist; // +5 BIG ENDIAN ; next update struct in list of update structs queued for draw (MSB = 0 if none) uchar *screen; // +7 address in display file where this tile is drawn }; struct sp1_ss { // "sprite structs" - 20 bytes - Every sprite is described by one of these uchar row; // +0 current y tile-coordinate uchar col; // +1 current x tile-coordinate uchar width; // +2 width of sprite in tiles uchar height; // +3 height of sprite in tiles uchar vrot; // +4 bit 7 = 1 for 2-byte graphical definition else 1-byte, bits 2:0 = current vertical rotation (0..7) uchar hrot; // +5 current horizontal rotation (0..7) uchar *frame; // +6 current sprite frame address added to graphic pointers uchar res0; // +8 "LD A,n" opcode uchar e_hrot; // +9 effective horizontal rotation = MSB of rotation table to use uchar res1; // +10 "LD BC,nn" opcode uint e_offset; // +11 effective offset to add to graphic pointers, equals result of vertical rotation + frame addr uchar res2; // +13 "EX DE,HL" opcode uchar res3; // +14 "JP (HL)" opcode struct sp1_cs *first; // +15 BIG ENDIAN ; first struct sp1_cs of this sprite uchar xthresh; // +17 hrot must be at least this number of pixels for last column of sprite to be drawn (1 default) uchar ythresh; // +18 vrot must be at least this number of pixels for last row of sprite to be drawn (1 default) uchar nactive; // +19 number of struct sp1_cs cells on display (written by sp1_MoveSpr*) }; struct sp1_cs { // "char structs" - 22 bytes - Every sprite is broken into pieces fitting into a tile, each of which is described by one of these struct sp1_cs *next_in_spr; // +0 BIG ENDIAN ; next sprite char within same sprite in row major order (MSB = 0 if none) struct sp1_update *update; // +2 BIG ENDIAN ; tile this sprite char currently occupies (MSB = 0 if none) uchar plane; // +4 plane sprite occupies, 0 = closest to viewer uchar type; // +5 bit 7 = 1 occluding, bit 6 = 1 last column, bit 5 = 1 last row, bit 4 = 1 clear pixelbuffer void *ss_draw; // +6 struct sp1_ss + 8 bytes ; points at code embedded in sprite struct sp1_ss uchar res0; // +8 typically "LD HL,nn" opcode uchar *def; // +9 graphic definition pointer uchar res1; // +11 typically "LD IY,nn" opcode uchar res2; // +12 uchar *l_def; // +13 graphic definition pointer for sprite character to left of this one uchar res3; // +15 typically "CALL nn" opcode void *draw; // +16 & draw function for this sprite char struct sp1_cs *next_in_upd; // +18 BIG ENDIAN ; & sp1_cs.ss_draw of next sprite occupying the same tile (MSB = 0 if none) struct sp1_cs *prev_in_upd; // +20 BIG ENDIAN ; & sp1_cs.next_in_upd of previous sprite occupying the same tile }; struct sp1_tp { // "tile list" - 2 bytes - A struct to hold a 16-bit tile code uint tile; // +0 tile code }; struct sp1_pss { // "print string struct" - 9 bytes - A struct holding print state information struct sp1_Rect *bounds; // +0 rectangular boundary within which printing will be allowed uchar flags; // +2 bit 0=invalidate?, 1=xwrap?, 2=yinc?, 3=ywrap? uchar x; // +3 current x coordinate of cursor with respect to top left corner of bounds uchar y; // +4 current y coordinate of cursor with respect to top left corner of bounds struct sp1_update *pos; // +5 RESERVED struct sp1_update associated with current cursor coordinates void *visit; // +7 void (*visit)(struct sp1_update *) function, set to 0 for none }; /////////////////////////////////////////////////////////// // SPRITES // /////////////////////////////////////////////////////////// // sprite type bits #define SP1_TYPE_OCCLUDE 0x80 // background and sprites underneath will not be drawn #define SP1_TYPE_BGNDCLR 0x10 // for occluding sprites, copy background tile into pixel buffer before draw #define SP1_TYPE_2BYTE 0x40 // sprite graphic consists of (mask,graph) pairs, valid only in sp1_CreateSpr() #define SP1_TYPE_1BYTE 0x00 // sprite graphic consists of graph only, valid only in sp1_CreateSpr() // prototype struct_sp1_ss and struct_sp1_cs that can be used to initialize empty structures extern struct sp1_cs sp1_struct_cs_prototype; extern struct sp1_ss sp1_struct_ss_prototype; // draw functions for sprites with two-byte graphical definitions, ie (mask,graphic) pairs extern void __LIB__ SP1_DRAW_MASK2(void); // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation will use MASK2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_MASK2NR(void); // masked sprite 2-byte definition (mask,graph) pairs ; no rotation applied, graphic always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_MASK2LB(void); // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation as MASK2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_MASK2RB(void); // masked sprite 2-byte definition (mask,graph) pairs ; sw rotation as MASK2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD2(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use LOAD2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_LOAD2NR(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_LOAD2LB(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD2RB(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_OR2(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use OR2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_OR2NR(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_OR2LB(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as OR2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_OR2RB(void); // or sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as OR2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_XOR2(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation will use XOR2_NR if no rotation necessary extern void __LIB__ SP1_DRAW_XOR2NR(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_XOR2LB(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as XOR2 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_XOR2RB(void); // xor sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as XOR2 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD2LBIM(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for left boundary of sprite w/ implied mask extern void __LIB__ SP1_DRAW_LOAD2RBIM(void); // load sprite 2-byte definition (mask,graph) pairs mask ignored; sw rotation as LOAD2 but for right boundary of sprite w/ implied mask // draw functions for sprites with one-byte graphical definitions, ie no mask just graphics extern void __LIB__ SP1_DRAW_LOAD1(void); // load sprite 1-byte definition graph only no mask; sw rotation will use LOAD1_NR if no rotation necessary extern void __LIB__ SP1_DRAW_LOAD1NR(void); // load sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_LOAD1LB(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD1RB(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_OR1(void); // or sprite 1-byte definition graph only no mask; sw rotation will use OR1_NR if no rotation necessary extern void __LIB__ SP1_DRAW_OR1NR(void); // or sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_OR1LB(void); // or sprite 1-byte definition graph only no mask; sw rotation as OR1 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_OR1RB(void); // or sprite 1-byte definition graph only no mask; sw rotation as OR1 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_XOR1(void); // xor sprite 1-byte definition graph only no mask; sw rotation will use XOR1_NR if no rotation necessary extern void __LIB__ SP1_DRAW_XOR1NR(void); // xor sprite 1-byte definition graph only no mask; no rotation applied, always drawn at exact tile boundary extern void __LIB__ SP1_DRAW_XOR1LB(void); // xor sprite 1-byte definition graph only no mask; sw rotation as XOR1 but for left boundary of sprite only extern void __LIB__ SP1_DRAW_XOR1RB(void); // xor sprite 1-byte definition graph only no mask; sw rotation as XOR1 but for right boundary of sprite only extern void __LIB__ SP1_DRAW_LOAD1LBIM(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for left boundary of sprite with implied mask extern void __LIB__ SP1_DRAW_LOAD1RBIM(void); // load sprite 1-byte definition graph only no mask; sw rotation as LOAD1 but for right boundary of sprite with implied mask // void *hook1 <-> void [ __FASTCALL__ ] (*hook1)(uint count, struct sp1_cs *c) // if __FASTCALL__ only struct sp1_cs* passed // void *hook2 <-> void [ __FASTCALL__ ] (*hook2)(uint count, struct sp1_update *u) // if __FASTCALL__ only struct sp1_update* passed // // void *drawf <-> void (*drawf)(void) // sprite draw function containing draw code and data for struct_sp1_cs extern struct sp1_ss __LIB__ *sp1_CreateSpr(void *drawf, uchar type, uchar height, int graphic, uchar plane); extern uint __LIB__ sp1_AddColSpr(struct sp1_ss *s, void *drawf, uchar type, int graphic, uchar plane); extern void __LIB__ sp1_ChangeSprType(struct sp1_cs *c, void *drawf); extern void __FASTCALL__ __LIB__ sp1_DeleteSpr(struct sp1_ss *s); // only call after sprite is moved off screen extern void __LIB__ sp1_MoveSprAbs(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot); extern void __LIB__ sp1_MoveSprRel(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot); extern void __LIB__ sp1_MoveSprPix(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uint x, uint y); extern void __LIB__ sp1_IterateSprChar(struct sp1_ss *s, void *hook1); extern void __LIB__ sp1_IterateUpdateSpr(struct sp1_ss *s, void *hook2); extern void __LIB__ *sp1_PreShiftSpr(uchar flag, uchar height, uchar width, void *srcframe, void *destframe, uchar rshift); // some functions for displaying independent struct_sp1_cs not connected with any sprites; useful as foreground elements // if not using a no-rotate (NR) type sprite draw function, must manually init the sp1_cs.ldef member after calling sp1_InitCharStruct() extern void __LIB__ sp1_InitCharStruct(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane); extern void __LIB__ sp1_InsertCharStruct(struct sp1_update *u, struct sp1_cs *cs); extern void __FASTCALL__ __LIB__ sp1_RemoveCharStruct(struct sp1_cs *cs); /* CALLEE LINKAGE */ extern struct sp1_ss __CALLEE__ __LIB__ *sp1_CreateSpr_callee(void *drawf, uchar type, uchar height, int graphic, uchar plane); extern uint __CALLEE__ __LIB__ sp1_AddColSpr_callee(struct sp1_ss *s, void *drawf, uchar type, int graphic, uchar plane); extern void __CALLEE__ __LIB__ sp1_MoveSprAbs_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uchar row, uchar col, uchar vrot, uchar hrot); extern void __CALLEE__ __LIB__ sp1_MoveSprRel_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot); extern void __CALLEE__ __LIB__ sp1_MoveSprPix_callee(struct sp1_ss *s, struct sp1_Rect *clip, uchar *frame, uint x, uint y); extern void __CALLEE__ __LIB__ sp1_IterateSprChar_callee(struct sp1_ss *s, void *hook1); extern void __CALLEE__ __LIB__ sp1_IterateUpdateSpr_callee(struct sp1_ss *s, void *hook2); extern void __CALLEE__ __LIB__ sp1_ChangeSprType_callee(struct sp1_cs *c, void *drawf); extern void __CALLEE__ __LIB__ *sp1_PreShiftSpr_callee(uchar flag, uchar height, uchar width, void *srcframe, void *destframe, uchar rshift); extern void __CALLEE__ __LIB__ sp1_InitCharStruct_callee(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane); extern void __CALLEE__ __LIB__ sp1_InsertCharStruct_callee(struct sp1_update *u, struct sp1_cs *cs); #define sp1_CreateSpr(a,b,c,d,e) sp1_CreateSpr_callee(a,b,c,d,e) #define sp1_AddColSpr(a,b,c,d,e) sp1_AddColSpr_callee(a,b,c,d,e) #define sp1_MoveSprAbs(a,b,c,d,e,f,g) sp1_MoveSprAbs_callee(a,b,c,d,e,f,g) #define sp1_MoveSprRel(a,b,c,d,e,f,g) sp1_MoveSprRel_callee(a,b,c,d,e,f,g) #define sp1_MoveSprPix(a,b,c,d,e) sp1_MoveSprPix_callee(a,b,c,d,e) #define sp1_IterateSprChar(a,b) sp1_IterateSprChar_callee(a,b) #define sp1_IterateUpdateSpr(a,b) sp1_IterateUpdateSpr_callee(a,b) #define sp1_ChangeSprType(a,b) sp1_ChangeSprType_callee(a,b) #define sp1_PreShiftSpr(a,b,c,d,e,f) sp1_PreShiftSpr_callee(a,b,c,d,e,f) #define sp1_InitCharStruct(a,b,c,d,e) sp1_InitCharStruct_callee(a,b,c,d,e) #define sp1_InsertCharStruct(a,b) sp1_InsertCharStruct_callee(a,b) /////////////////////////////////////////////////////////// // COLLISION DETECTION // /////////////////////////////////////////////////////////// // BEING REVIEWED FOR CHANGES /////////////////////////////////////////////////////////// // TILES // /////////////////////////////////////////////////////////// #define SP1_RFLAG_TILE 0x01 #define SP1_RFLAG_SPRITE 0x04 #define SP1_PSSFLAG_INVALIDATE 0x01 #define SP1_PSSFLAG_XWRAP 0x02 #define SP1_PSSFLAG_YINC 0x04 #define SP1_PSSFLAG_YWRAP 0x08 extern void __LIB__ *sp1_TileEntry(uchar c, void *def); extern void __LIB__ sp1_PrintAt(uchar row, uchar col, uint tile); extern void __LIB__ sp1_PrintAtInv(uchar row, uchar col, uint tile); extern uint __LIB__ sp1_ScreenStr(uchar row, uchar col); extern void __LIB__ sp1_PrintString(struct sp1_pss *ps, uchar *s); extern void __LIB__ sp1_SetPrintPos(struct sp1_pss *ps, uchar row, uchar col); extern void __LIB__ sp1_GetTiles(struct sp1_Rect *r, struct sp1_tp *dest); extern void __LIB__ sp1_PutTiles(struct sp1_Rect *r, struct sp1_tp *src); extern void __LIB__ sp1_PutTilesInv(struct sp1_Rect *r, struct sp1_tp *src); extern void __LIB__ sp1_ClearRect(struct sp1_Rect *r, uchar tile, uchar rflag); extern void __LIB__ sp1_ClearRectInv(struct sp1_Rect *r, uchar tile, uchar rflag); /* CALLEE LINKAGE */ extern void __CALLEE__ __LIB__ *sp1_TileEntry_callee(uchar c, void *def); extern void __CALLEE__ __LIB__ sp1_PrintAt_callee(uchar row, uchar col, uint tile); extern void __CALLEE__ __LIB__ sp1_PrintAtInv_callee(uchar row, uchar col, uint tile); extern uint __CALLEE__ __LIB__ sp1_ScreenStr_callee(uchar row, uchar col); extern void __CALLEE__ __LIB__ sp1_PrintString_callee(struct sp1_pss *ps, uchar *s); extern void __CALLEE__ __LIB__ sp1_SetPrintPos_callee(struct sp1_pss *ps, uchar row, uchar col); extern void __CALLEE__ __LIB__ sp1_GetTiles_callee(struct sp1_Rect *r, struct sp1_tp *dest); extern void __CALLEE__ __LIB__ sp1_PutTiles_callee(struct sp1_Rect *r, struct sp1_tp *src); extern void __CALLEE__ __LIB__ sp1_PutTilesInv_callee(struct sp1_Rect *r, struct sp1_tp *src); extern void __CALLEE__ __LIB__ sp1_ClearRect_callee(struct sp1_Rect *r, uchar tile, uchar rflag); extern void __CALLEE__ __LIB__ sp1_ClearRectInv_callee(struct sp1_Rect *r, uchar tile, uchar rflag); #define sp1_TileEntry(a,b) sp1_TileEntry_callee(a,b) #define sp1_PrintAt(a,b,c) sp1_PrintAt_callee(a,b,c) #define sp1_PrintAtInv(a,b,c) sp1_PrintAtInv_callee(a,b,c) #define sp1_ScreenStr(a,b) sp1_ScreenStr_callee(a,b) #define sp1_PrintString(a,b) sp1_PrintString_callee(a,b) #define sp1_SetPrintPos(a,b,c) sp1_SetPrintPos_callee(a,b,c) #define sp1_GetTiles(a,b) sp1_GetTiles_callee(a,b) #define sp1_PutTiles(a,b) sp1_PutTiles_callee(a,b) #define sp1_PutTilesInv(a,b) sp1_PutTilesInv_callee(a,b) #define sp1_ClearRect(a,b,c) sp1_ClearRect_callee(a,b,c) #define sp1_ClearRectInv(a,b,c) sp1_ClearRectInv_callee(a,b,c) /////////////////////////////////////////////////////////// // UPDATER // /////////////////////////////////////////////////////////// #define SP1_IFLAG_MAKE_ROTTBL 0x01 #define SP1_IFLAG_OVERWRITE_TILES 0x02 #define SP1_IFLAG_OVERWRITE_DFILE 0x04 // void *hook <-> void [ __FASTCALL__ ] (*hook)(struct sp1_update *u) extern void __LIB__ sp1_Initialize(uchar iflag, uchar tile); extern void __LIB__ sp1_UpdateNow(void); extern struct sp1_update __LIB__ *sp1_GetUpdateStruct(uchar row, uchar col); extern void __LIB__ sp1_IterateUpdateArr(struct sp1_update **ua, void *hook); // zero terminated array extern void __LIB__ sp1_IterateUpdateRect(struct sp1_Rect *r, void *hook); extern void __FASTCALL__ __LIB__ sp1_InvUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_ValUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructIfInv(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructIfVal(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructIfNotRem(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_DrawUpdateStructAlways(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_RemoveUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_RestoreUpdateStruct(struct sp1_update *u); extern void __FASTCALL__ __LIB__ sp1_Invalidate(struct sp1_Rect *r); extern void __FASTCALL__ __LIB__ sp1_Validate(struct sp1_Rect *r); /* CALLEE LINKAGE */ extern void __CALLEE__ __LIB__ sp1_Initialize_callee(uchar iflag, uchar tile); extern struct sp1_update __CALLEE__ __LIB__ *sp1_GetUpdateStruct_callee(uchar row, uchar col); extern void __CALLEE__ __LIB__ sp1_IterateUpdateArr_callee(struct sp1_update **ua, void *hook); extern void __CALLEE__ __LIB__ sp1_IterateUpdateRect_callee(struct sp1_Rect *r, void *hook); #define sp1_Initialize(a,b) sp1_Initialize_callee(a,b) #define sp1_GetUpdateStruct(a,b) sp1_GetUpdateStruct_callee(a,b) #define sp1_IterateUpdateArr(a,b) sp1_IterateUpdateArr_callee(a,b) #define sp1_IterateUpdateRect(a,b) sp1_IterateUpdateRect_callee(a,b) #endif z88dk-1.8.ds1/libsrc/sprites/software/sp1/zx81hr.lst0000644000175000017500000000734010763607735021722 0ustar tygrystygrysts2068hr/sprites/_sp1_struct_cs_prototype spectrum/sprites/_sp1_struct_ss_prototype spectrum/sprites/sp1_AddColSpr zx81hr/sprites/sp1_AddColSpr_callee spectrum/sprites/sp1_ChangeSprType ts2068hr/sprites/sp1_ChangeSprType_callee spectrum/sprites/sp1_CreateSpr zx81hr/sprites/sp1_CreateSpr_callee spectrum/sprites/sp1_DeleteSpr zx81hr/sprites/sp1_InitCharStruct zx81hr/sprites/sp1_InitCharStruct_callee spectrum/sprites/sp1_InsertCharStruct ts2068hr/sprites/sp1_InsertCharStruct_callee spectrum/sprites/sp1_IterateSprChar spectrum/sprites/sp1_IterateSprChar_callee spectrum/sprites/sp1_IterateUpdateSpr spectrum/sprites/sp1_IterateUpdateSpr_callee zx81hr/sprites/sp1_MoveSprAbs zx81hr/sprites/sp1_MoveSprAbs_callee zx81hr/sprites/sp1_MoveSprPix zx81hr/sprites/sp1_MoveSprPix_callee zx81hr/sprites/sp1_MoveSprRel zx81hr/sprites/sp1_MoveSprRel_callee zx81hr/sprites/sp1_PreShiftSpr zx81hr/sprites/sp1_PreShiftSpr_callee ts2068hr/sprites/sp1_RemoveCharStruct ts2068hr/sprites/SP1AddSprChar ts2068hr/sprites/SP1RemoveSprChar spectrum/sprites/draw/SP1_DRAW_LOAD1 spectrum/sprites/draw/SP1_DRAW_LOAD1LB spectrum/sprites/draw/SP1_DRAW_LOAD1LBIM spectrum/sprites/draw/SP1_DRAW_LOAD1NR spectrum/sprites/draw/SP1_DRAW_LOAD1RB spectrum/sprites/draw/SP1_DRAW_LOAD1RBIM spectrum/sprites/draw/SP1_DRAW_LOAD2 spectrum/sprites/draw/SP1_DRAW_LOAD2LB spectrum/sprites/draw/SP1_DRAW_LOAD2LBIM spectrum/sprites/draw/SP1_DRAW_LOAD2NR spectrum/sprites/draw/SP1_DRAW_LOAD2RB spectrum/sprites/draw/SP1_DRAW_LOAD2RBIM spectrum/sprites/draw/SP1_DRAW_MASK2 spectrum/sprites/draw/SP1_DRAW_MASK2LB spectrum/sprites/draw/SP1_DRAW_MASK2NR spectrum/sprites/draw/SP1_DRAW_MASK2RB spectrum/sprites/draw/SP1_DRAW_OR1 spectrum/sprites/draw/SP1_DRAW_OR1LB spectrum/sprites/draw/SP1_DRAW_OR1NR spectrum/sprites/draw/SP1_DRAW_OR1RB spectrum/sprites/draw/SP1_DRAW_OR2 spectrum/sprites/draw/SP1_DRAW_OR2LB spectrum/sprites/draw/SP1_DRAW_OR2NR spectrum/sprites/draw/SP1_DRAW_OR2RB spectrum/sprites/draw/SP1_DRAW_XOR1 spectrum/sprites/draw/SP1_DRAW_XOR1LB spectrum/sprites/draw/SP1_DRAW_XOR1NR spectrum/sprites/draw/SP1_DRAW_XOR1RB spectrum/sprites/draw/SP1_DRAW_XOR2 spectrum/sprites/draw/SP1_DRAW_XOR2LB spectrum/sprites/draw/SP1_DRAW_XOR2NR spectrum/sprites/draw/SP1_DRAW_XOR2RB ts2068hr/tiles/sp1_ClearRect ts2068hr/tiles/sp1_ClearRect_callee ts2068hr/tiles/sp1_ClearRectInv zx81hr/tiles/sp1_ClearRectInv_callee spectrum/tiles/sp1_GetTiles ts2068hr/tiles/sp1_GetTiles_callee ts2068hr/tiles/sp1_PrintAt ts2068hr/tiles/sp1_PrintAt_callee ts2068hr/tiles/sp1_PrintAtInv ts2068hr/tiles/sp1_PrintAtInv_callee spectrum/tiles/sp1_PrintString spectrum/tiles/sp1_PrintString_callee spectrum/tiles/sp1_PutTiles ts2068hr/tiles/sp1_PutTiles_callee spectrum/tiles/sp1_PutTilesInv zx81hr/tiles/sp1_PutTilesInv_callee spectrum/tiles/sp1_ScreenStr ts2068hr/tiles/sp1_ScreenStr_callee spectrum/tiles/sp1_SetPrintPos ts2068hr/tiles/sp1_SetPrintPos_callee spectrum/tiles/sp1_TileEntry spectrum/tiles/sp1_TileEntry_callee zx81hr/tiles/SP1PrintString zx81hr/tiles/SP1PSPOP zx81hr/tiles/SP1PSPUSH spectrum/updater/sp1_DrawUpdateStructAlways spectrum/updater/sp1_DrawUpdateStructIfInv spectrum/updater/sp1_DrawUpdateStructIfNotRem spectrum/updater/sp1_DrawUpdateStructIfVal spectrum/updater/sp1_GetUpdateStruct zx81hr/updater/sp1_GetUpdateStruct_callee ts2068hr/updater/sp1_Initialize zx81hr/updater/sp1_Initialize_callee ts2068hr/updater/sp1_Invalidate ts2068hr/updater/sp1_InvUpdateStruct spectrum/updater/sp1_IterateUpdateArr spectrum/updater/sp1_IterateUpdateArr_callee spectrum/updater/sp1_IterateUpdateRect ts2068hr/updater/sp1_IterateUpdateRect_callee ts2068hr/updater/sp1_RemoveUpdateStruct spectrum/updater/sp1_RestoreUpdateStruct ts2068hr/updater/sp1_UpdateNow ts2068hr/updater/sp1_Validate spectrum/updater/sp1_ValUpdateStruct zx81hr/updater/SP1DrawUpdateStruct z88dk-1.8.ds1/libsrc/sprites/software/sp2/0000755000175000017500000000000010765202715020016 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/sprites/software/sp2/readme.txt0000644000175000017500000000005510415667775022031 0ustar tygrystygrysPlaceholder for low resolution sprite engine z88dk-1.8.ds1/libsrc/standard/0000755000175000017500000000000010765202715015567 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/standard/README0000644000175000017500000000035507130401722016441 0ustar tygrystygrysDue to clashing labels, standard.lib is no longer needed by z88dk (all relevant functions have been placed in gfx.lib) if you want the source for standard.lib then grab it from Z88 Forever: http://www.menaxus.demon.co.uk/z88/z88home/htm z88dk-1.8.ds1/libsrc/stdio/0000755000175000017500000000000010765202715015111 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/8080/0000755000175000017500000000000010765202715015510 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/8080/fabandon.c0000644000175000017500000000122307466725110017425 0ustar tygrystygrys/* * Abandon file * * fabandon(FILE *fp) * * djm 1/4/2000 * * If implemented this routine should obviously check that * it's alright to close a file (i.e. not string or default * std*) * * -------- * $Id: fabandon.c,v 1.1 2002/05/10 11:08:56 dom Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include void fabandon(FILE *fp) { /* Z88 has no abandon file command, just reset fp */ #ifdef Z80 #asm pop de pop hl push hl push de xor a ld (hl),a ;fp_desc inc hl ld (hl),a ;fp_desc+1 inc hl ld (hl),a ;fp_ungetc inc hl ld (hl),a ;fp_flags #endasm #else fp->desc.fd=0; fp->flags=0; fp->ungetc=0; #endif } z88dk-1.8.ds1/libsrc/stdio/8080/fchkstd.c0000644000175000017500000000140707466725110017307 0ustar tygrystygrys/* * Short routine to check for std* channels * * This is implemented in order to use different routines * for console input/output * * Returns: 0 = not console, c * 1 = input, nc * -1 = output, nc * -------- * $Id: fchkstd.c,v 1.1 2002/05/10 11:08:56 dom Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include int fchkstd(FILE *fp) { #ifdef Z80 #asm pop af pop de push de push af ld hl,0 inc de inc de ;de=&fp_flags ld a,(de) and _IOSYSTEM scf ret z ;non system return 0 dec hl ;-1 ld a,(de) ;de=&fp_flags and _IOREAD and a ;don`t think this is necessary ret nz inc hl inc hl ;write, return 1 and a #endasm #else if ( fp->flags&_IOSYSTEM == 0 ) return 0; return ( fp->flags&_IOREAD ? -1 : 1 ); #endif } z88dk-1.8.ds1/libsrc/stdio/8080/fclose.c0000644000175000017500000000242107466725110017131 0ustar tygrystygrys/* * New stdio functions for Small C+ * * djm 4/5/99 * * -------- * $Id: fclose.c,v 1.1 2002/05/10 11:08:56 dom Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include #include int __FASTCALL__ fclose(FILE *fp) { #ifdef Z80 #asm pop bc pop de push de push bc ld hl,-1 ;EOF inc de inc de ld a,(de) ;de = &fp_flags dec de dec de ;de=&fp_desc ld c,a and _IOUSE ;is it defined ret z ;no ld a,c and _IOSTRING ;string? jr nz,is_closed ;yes #ifdef NET_STDIO ld a,c and _IONETWORK jr z,no_net ex de,hl ld e,(hl) inc hl ld d,(hl) dec hl ex de,hl ;de = &fp_desc hl = *fp_desc push de push hl call closenet jr ckclosed .no_net #endif push de call fchkstd pop de jr nc,is_closed ;was std* (def setup) ex de,hl ld e,(hl) inc hl ld d,(hl) dec hl ex de,hl ;de = &fp_desc hl = *fp_desc push de push hl call close .ckclosed pop bc pop de ld a,h or l ret nz .is_closed ex de,hl ld de,0 ld (hl),e ;fp_desc inc hl ld (hl),e ;fp_desc+1 inc hl ld (hl),e ;fp_flags ex de,hl ;hl = 0 = success #endasm #else if ( (fp->flags&_IOUSE ==0 ) || (fp->flags&_IOSTRING) ) return(EOF); if (fchkstd(fp) == 0 ) { if (close(fp->desc.fd) ) return EOF; } fp->desc.fd=0; fp->flags=0; return 0; #endif } z88dk-1.8.ds1/libsrc/stdio/8080/fgetc.c0000644000175000017500000000443407466725110016754 0ustar tygrystygrys/* * New stdio functions for Small C+ * * djm 4/5/99 * * -------- * $Id: fgetc.c,v 1.1 2002/05/10 11:08:56 dom Exp $ */ #define ANSI_STDIO #define STDIO_ASM #include #include /* * struct fp { * union xx { * int fd; * char *str; * } desc; * u8_t error; * u8_t flags; * u8_t ungetc; */ int fgetc(FILE *fp) { #ifdef Z80 #asm pop bc pop de ;fp push de push bc ld hl,-1 ;EOF inc de inc de ld a,(de) ;de = &fp_flags get flags and a ret z and _IOWRITE | _IOEOF ;check we`re not write/EOF ret nz inc de ;de=&fp_ungetc ld a,(de) ;check for ungot char and a jr z,no_ungetc ex de,hl ld e,a ld d,0 ld (hl),d ;set no ungetc character ex de,hl ret .no_ungetc ; Now do strings dec de ;de=&fp_flags ld a,(de) and _IOSTRING jr z,no_string ;not a string ex de,hl dec hl ;fp_desc+1 ld d,(hl) dec hl ;fp_desc ld e,(hl) ld a,(de) inc de ld (hl),e inc hl ;fp_desc+1 ld (hl),d ex de,hl ld hl,-1 ;EOF and a ;test for zero ret z ;return EOF if so ld l,a ;else return character ld h,0 ret .no_string #ifdef NET_STDIO ld a,(de) ;*fp_flags and _IONETWORK jr z,no_net ex de,hl ld d,(hl) ;fp_desc+1 dec hl ld e,(hl) ;fp_desc ex de,hl push de push hl call fgetc_net pop bc pop de ret nc jr seteof ;EOF reached (sock closed?) .no_net #endif dec de ;fp_desc+1 dec de ;fp_desc push de ;preserve fp call fchkstd ;check for stdin (stdout/err have failed already) pop de ;ix back jr c,no_stdin call fgetc_cons ;get from console ret ;always succeeds - never EOF .no_stdin ex de,hl ld e,(hl) inc hl ;fp_desc+1 ld d,(hl) dec hl ;fp_desc ex de,hl push de ; push hl ;dont think this push/pop is needed call readbyte ;readbyte sorts out stack (fastcall) ; pop bc ;dump handle pop de ;get fp back ret nc ;no error so return (make sure other ;implementations respect this!) .seteof inc de inc de ;fp_flags ld a,(de) or _IOEOF ld (de),a ;set EOF, return with EOF #endasm #else int c; if ( fp->flags == 0 || (fp->flags & _IOWRITE) ) return EOF; if (c=fp->ungetc) { fp->ungetc=0; return(c); } if ( fp->flags & _IOSTRING ) { c=*fp->desc.ptr++; return ( c ? c : EOF);} if ( (c=readbyte(fp->fd)) == EOF) fp->flags&=_IOEOF; return(c); #endif } z88dk-1.8.ds1/libsrc/stdio/8080/fputc.c0000644000175000017500000000302107466725110016774 0ustar tygrystygrys/* * New stdio functions for Small C+ * * djm 4/5/99 * * -------- * $Id: fputc.c,v 1.1 2002/05/10 11:08:56 dom Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include #include int fputc(int c,FILE *fp) { #ifdef Z80 #asm pop hl pop de ;fp pop bc ;c push bc push de push hl ld hl,-1 ;EOF inc de inc de ;fp_flags ld a,(de) and a ;no thing ret z and _IOREAD ret nz ;don`t want reading streams ld a,(de) and _IOSTRING jr z,no_string ex de,hl dec hl ;fp_desc+1 ld d,(hl) dec hl ;&fp_desc ld e,(hl) ld a,c ;store character ld (de),a inc de ;inc pointer and store ld (hl),e inc hl ;fp_desc+1 ld (hl),d ld l,c ;load char to return ld h,0 ret .no_string #ifdef NET_STDIO ld a,(de) ;fp_flags and _IONETWORK jr z,no_net ex de,hl dec hl ld d,(hl) dec hl ;fp_desc ld e,(hl) push de ;socket push bc ;byte call fputc_net pop bc pop bc ret .no_net #endif dec de dec de ;fp_desc push de call fchkstd ;preserves bc pop de jr c,no_cons ; Output to console push bc call fputc_cons pop hl ret .no_cons ; Output to file ex de,hl ld e,(hl) ;fp_desc inc hl ld d,(hl) push de ;fd push bc ;c call writebyte pop bc ;discard values pop bc #endasm #else if ( fp->flags == 0 || fp->flags & _IOREAD ) return EOF; if ( fp->flags & _IOSTRING ) { *fp->desc.ptr++=(char) c; return(c); } #ifdef NET_STDIO if ( fp->flags & _IONETWORK) return(fputc_net(fp->fd,c) #endif return (writebyte(fp->fd,c)); #endif } z88dk-1.8.ds1/libsrc/stdio/8080/fputs.c0000644000175000017500000000133607466725110017023 0ustar tygrystygrys/* * New stdio functions for Small C+ * * fputc handles all types * * djm 4/5/99 * * -------- * $Id: fputs.c,v 1.1 2002/05/10 11:08:56 dom Exp $ */ #include #include int fputs(unsigned char *s,FILE *fp) { #ifdef Z80 #asm pop hl ;ret pop de ;fp pop bc ;s push bc push de push hl .loop ld hl,1 ;non -ve number ld a,(bc) ;*s and a ret z ;end of string ld l,a ld h,0 inc bc ;s++ push bc ;keep s push hl ;send *s++ push de ;send fp call fputc pop de ;get fp back pop bc ;discard hl pop bc ;get s back ld a,l ;test for EOF returned and h inc a ret z jr loop #endasm #else while (*s) { if ( fputc(*s++,fp) == EOF) return(EOF); } #endif } z88dk-1.8.ds1/libsrc/stdio/8080/Makefile0000644000175000017500000000100410763607753017154 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.6 2008/03/05 20:35:48 dom Exp $ # include ../../Make.config STDCFILES = \ fabandon.c \ fchkstd.c \ fclose.c \ fgetc.c \ fputc.c \ fputs.c \ ungetc.c \ vfprintf_mini.c AFILES = $(STDCFILES:.c=.asm) $(NETCFILES:.c=.asm) STDOBJECTS = $(STDCFILES:.c=.o) generic: gen gen: $(STDOBJECTS) z88_x: cd z88 ; $(MAKE) ; cd .. .c.o: zcc +test $(CFLAGS) $*.c clean: $(RM) *.o* *.sym *.map zcc_opt.def *.i $(AFILES) z88dk-1.8.ds1/libsrc/stdio/8080/ungetc.c0000644000175000017500000000140007736631120017134 0ustar tygrystygrys/* * New stdio functions for Small C+ * * djm 4/5/99 * * -------- * $Id: ungetc.c,v 1.2 2003/10/01 20:00:16 dom Exp $ */ #define ANSI_STDIO #define STDIO_ASM #include int ungetc(int c, FILE *fp) { #ifdef Z80 #asm pop hl ;ret pop de ;fp pop bc ;c push bc push de push hl ld hl,-1 ;EOF inc de inc de ld a,(de) ;fp_flags ld b,a and _IOUSE ret z ;not being used ld a,b and _IOEOF |_IOWRITE ret nz ;cant push back after EOF (or for write stream) inc de ld a,(de) ;fp_ungetc and a ret nz ld a,c ld (de),a ;store the char ld l,c ;return it ld h,0 #endasm #else if (fp == 0 || c == EOF || fp->ungetc || fp->flags&_IOWRITE ) return(EOF); fp->ungetc=(unsigned char)c; return(c); #endif } z88dk-1.8.ds1/libsrc/stdio/8080/vfprintf_mini.c0000644000175000017500000000461307466442631020541 0ustar tygrystygrys/* * An alternate miniprintf core which can print * longs and unsigned values correctly. * * djm 26/2/2000 * * Error in last digit - I'm not sure why - this occurs * for *large* numbers.. * * djm 3/3/2000 * This routine is infact a vfprintf, so naming as such... * * djm 9/5/2002 * Cut down version for z88 that only handles ints * * -------- * $Id: vfprintf_mini.c,v 1.1 2002/05/09 09:47:05 dom Exp $ */ #define ANSI_STDIO #include /* * Once over to Small C this isn't negotiable! * Arguments go downwards instead of upwards (we push from * left to right, not right to left, so we do a - instead of a + * to step to the next one.. */ static void miniprintn(int number, FILE *fil, unsigned char flag); int vfprintf_mini(FILE *fp, unsigned char *fmt,void *ap) { unsigned char c; unsigned char k; unsigned char *s; while ((c = *fmt++) != '\0') { if (c != '%') fputc(c,fp); else { c = *fmt++; switch (c) { case 'd': miniprintn((unsigned int)*(int *)ap,fp,1); ap -= sizeof(int); break; case 'u': miniprintn((unsigned int)*(unsigned int *)ap,fp,0); ap -= sizeof(int); break; case 's': s = *(char **)ap; while ((k = *s++) != '\0') fputc(k,fp); ap -= sizeof(char *); break; case 'c': fputc(*(int *)ap,fp); ap -= sizeof(int); break; default: fputc(c,fp); } } } return(0); } static void miniprintn(int number, FILE *file, unsigned char flag) { unsigned int i; if (flag && number < 0 ){ fputc('-', file); number = -number; } if ((i =(unsigned int) number / 10) != 0) miniprintn(i,file,flag); fputc((unsigned int)number%10+'0', file); } z88dk-1.8.ds1/libsrc/stdio/abc80/0000755000175000017500000000000010765202715016006 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/abc80/fgetc_cons.asm0000644000175000017500000000044007265604647020633 0ustar tygrystygrys; ; ABC80 Routines ; ; getkey() Wait for keypress ; ; Maj 2000 - Stefano Bodrato ; ; ; $Id: fgetc_cons.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons in a,(56) bit 7,a jr nz,fgetc_cons .wkey in a,(56) bit 7,a jr z,wkey sub 128 ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/abc80/fputc_cons.asm0000644000175000017500000000071110537315652020654 0ustar tygrystygrys; ; ABC80 Routines ; ; Print character to the screen ; ; We can corrupt any register ; ; ; $Id: fputc_cons.asm,v 1.3 2006/12/11 17:55:54 stefano Exp $ ; XLIB fputc_cons ; ; Entry: char to print ; .fputc_cons ld hl,2 add hl,sp ld a,(hl); Now A contains the char to be printed cp 13 jr nz,nocrlf ld a,13 call printchar ld a,10 .nocrlf cp 12 ; CLS jp z,$276 .printchar ld bc,1 ld hl,mychar ld (hl),a jp 1a8h .mychar defb 0 z88dk-1.8.ds1/libsrc/stdio/abc80/getk.asm0000644000175000017500000000040107265604647017450 0ustar tygrystygrys; ; ABC80 Routines ; ; getk() Read key status ; ; Maj 2000 - Stefano Bodrato ; ; ; $Id: getk.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB getk .getk in a,(56) bit 7,a jr z,nokey sub 128 jr keyread .nokey xor a .keyread ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/abc800/0000755000175000017500000000000010765202715016066 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/abc800/fgetc_cons.asm0000755000175000017500000000032410714614446020706 0ustar tygrystygrys; ; ABC800 Routines ; ; getkey() Wait for keypress ; ; Oct. 2007 - Stefano Bodrato ; ; ; $Id: fgetc_cons.asm,v 1.1 2007/11/08 14:11:50 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons call 2 ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/abc800/fputc_cons.asm0000755000175000017500000000072010714614446020737 0ustar tygrystygrys; ; ABC800 Routines ; ; Print character to the screen ; ; Oct. 2007 - Stefano Bodrato ; ; We can corrupt any register ; ; ; $Id: fputc_cons.asm,v 1.1 2007/11/08 14:11:50 stefano Exp $ ; XLIB fputc_cons ; ; Entry: char to print ; .fputc_cons ld hl,2 add hl,sp ld a,(hl); Now A contains the char to be printed cp 13 jr nz,nocrlf ld a,13 call printchar ld a,10 .nocrlf .printchar ld bc,1 ld hl,mychar ld (hl),a jp 11 .mychar defb 0 z88dk-1.8.ds1/libsrc/stdio/abc800/getk.asm0000755000175000017500000000027510714614447017534 0ustar tygrystygrys; ; ABC800 Routines ; ; getk() Read key status ; ; Oct 2007 - Stefano Bodrato ; ; ; $Id: getk.asm,v 1.1 2007/11/08 14:11:51 stefano Exp $ ; XLIB getk .getk call 2 ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/ace/0000755000175000017500000000000010765202715015641 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ace/fgetc_cons.asm0000644000175000017500000000054307364764003020463 0ustar tygrystygrys; ; Basic keyboard handling for the Jupiter ACE ; By Stefano Bodrato Feb. 2001 ; ; getkey() Wait for keypress ; ; ; $Id: fgetc_cons.asm,v 1.3 2001/10/22 09:33:55 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons .kwait call $336 and a jr nz,kwait .kwait1 call $336 and a jr z,kwait1 cp 5 ; Delete? jr nz,nodel ld a,8 .nodel ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/ace/getk.asm0000644000175000017500000000041307364764003017277 0ustar tygrystygrys; ; Basic keyboard handling for the Jupiter ACE ; By Stefano Bodrato Feb. 2001 ; ; getk() Read key status ; ; ; $Id: getk.asm,v 1.3 2001/10/22 09:33:55 stefano Exp $ ; XLIB getk .getk call $336 cp 5 ; Delete? jr nz,nodel ld a,8 .nodel ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/ansi/0000755000175000017500000000000010765202715016043 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/abc80/0000755000175000017500000000000010765202715016740 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/abc80/f_ansi_attr.asm0000644000175000017500000000053707265604647021753 0ustar tygrystygrys; ; ANSI Video handling for the ABC80 ; Leaving empty, for now. ; ; Text Attributes ; m - Set Graphic Rendition ; ; The most difficult thing to port: ; Be careful here... ; ; ; $Id: f_ansi_attr.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_attr .ansi_attr and a jr nz,noreset ret .noreset ret z88dk-1.8.ds1/libsrc/stdio/ansi/abc80/f_ansi_bel.asm0000644000175000017500000000033210712105313021505 0ustar tygrystygrys; ; ANSI Video handling for the ABC80 ; ; BEL - chr(7) Beep it out ; ; ; $Id: f_ansi_bel.asm,v 1.3 2007/10/31 14:01:47 stefano Exp $ ; XLIB ansi_BEL .ansi_BEL ; Put here the BEEP code ld a,7 jp 1a8h z88dk-1.8.ds1/libsrc/stdio/ansi/abc80/f_ansi_char.asm0000644000175000017500000000155610712105313021671 0ustar tygrystygrys; ; ANSI Video handling for the ABC80 ; ; set it up with: ; .text_cols = max columns ; .text_rows = max rows ; ; Display a char in location (ansi_ROW),(ansi_COLUMN) ; A=char to display ; ; A slower (but working) method it commented out ; ; ; $Id: f_ansi_char.asm,v 1.3 2007/10/31 14:01:47 stefano Exp $ ; XLIB ansi_CHAR XDEF text_cols XDEF text_rows XREF ansi_ROW XREF ansi_COLUMN .text_cols defb 40 .text_rows defb 24 .ansi_CHAR push af ld a,(ansi_ROW) ld hl,884 ; ROW table in ROM ld d,0 rla ld e,a add hl,de ld a,(hl) inc hl ld h,(hl) ld l,a ; ld hl,31744 ; OLD method (non ROM dependent) ; cp 8 ; jr c,jpvdu ; ld hl,31784 ; sub 8 ; cp 8 ; jr c,jpvdu ; ld hl,31824 ; sub 8 ;.jpvdu ; and a ; jr z,r_zero ; ld b,a ; ld de,128 ;.r_loop ; add hl,de ; djnz r_loop .r_zero ld a,(ansi_COLUMN) ; ld d,0 ld e,a add hl,de pop af ld (hl),a ret z88dk-1.8.ds1/libsrc/stdio/ansi/abc80/f_ansi_cls.asm0000644000175000017500000000031510712105313021525 0ustar tygrystygrys; ; ANSI Video handling for the ABC80 ; ; CLS - Clear the screen ; ; ; Stefano Bodrato - May 2000 ; ; ; $Id: f_ansi_cls.asm,v 1.3 2007/10/31 14:01:47 stefano Exp $ ; XLIB ansi_cls .ansi_cls jp $276 z88dk-1.8.ds1/libsrc/stdio/ansi/abc80/f_ansi_dline.asm0000644000175000017500000000051710712105313022043 0ustar tygrystygrys; ; ANSI Video handling for the ABC80 ; ; Clean a text line ; ; Stefano Bodrato - may 2000 ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.3 2007/10/31 14:01:47 stefano Exp $ ; XLIB ansi_del_line .ansi_del_line ld hl,$374 ; ROW table in ROM ld d,0 rla ld e,a add hl,de ld e,(hl) inc hl ld d,(hl) jp $267 z88dk-1.8.ds1/libsrc/stdio/ansi/abc80/f_ansi_scrollup.asm0000644000175000017500000000025410712105313022611 0ustar tygrystygrys; ; ANSI Video handling for the ABC80 ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.3 2007/10/31 14:01:47 stefano Exp $ ; XLIB ansi_SCROLLUP .ansi_SCROLLUP jp $241z88dk-1.8.ds1/libsrc/stdio/ansi/ace/0000755000175000017500000000000010765202715016573 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/ace/f_ansi_attr.asm0000644000175000017500000000353207364764003021575 0ustar tygrystygrys; ; ANSI Video handling for the Jupiter ACE ; ; Text Attributes ; m - Set Graphic Rendition ; ; The most difficult thing to port: ; Be careful here... ; ; Stefano Bodrato - Feb. 2001 ; ; ; $Id: f_ansi_attr.asm,v 1.4 2001/10/22 09:33:55 stefano Exp $ ; XLIB ansi_attr XDEF ace_inverse .ace_inverse defb 0 .ansi_attr and a jr nz,noreset ld (ace_inverse),a ret .noreset cp 1 jr nz,nobold ld a,@10000000 ld (ace_inverse),a ret .nobold cp 2 jr z,dim cp 8 jr nz,nodim .dim xor a ld (ace_inverse),a ret .nodim cp 5 jr nz,nounderline ld a,@10000000 ld (ace_inverse),a ret .nounderline cp 24 jr nz,noCunderline xor a ld (ace_inverse),a ret .noCunderline cp 5 jr nz,noblink ld a,@10000000 ld (ace_inverse),a ret .noblink cp 25 jr nz,nocblink xor a ld (ace_inverse),a ret .nocblink cp 7 jr nz,noreverse ld a,@10000000 ld (ace_inverse),a ret .noreverse cp 27 jr nz,noCreverse xor a ld (ace_inverse),a ret .noCreverse cp 8 ; invisible CHAR? jr nz,noinvis ret .noinvis cp 28 ; cancel invisibility jr nz,nocinvis ret .nocinvis cp 30 jp m,nofore cp 37+1 jp p,nofore ret .nofore cp 40 jp m,noback cp 47+1 jp p,noback sub 40 cp 4 jr c,nowmn ld a,@10000000 jr nocry .nowmn xor a .nocry ld (ace_inverse),a .noback ret z88dk-1.8.ds1/libsrc/stdio/ansi/ace/f_ansi_bel.asm0000644000175000017500000000036307265604647021373 0ustar tygrystygrys; ; ANSI Video handling for the Jupiter ACE ; ; BEL - chr(7) Beep it out ; ; ; Stefano Bodrato - Feb. 2001 ; ; ; $Id: f_ansi_bel.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_BEL ; No sound, for now! .ansi_BEL ret z88dk-1.8.ds1/libsrc/stdio/ansi/ace/f_ansi_char.asm0000644000175000017500000000125407364764003021537 0ustar tygrystygrys; ; ANSI Video handling for the Jupiter ACE ; ; Stefano Bodrato - Feb. 2001 ; ; ; set it up with: ; .text_cols = max columns ; .text_rows = max rows ; ; Display a char in location (ansi_ROW),(ansi_COLUMN) ; A=char to display ; ; ; $Id: f_ansi_char.asm,v 1.4 2001/10/22 09:33:55 stefano Exp $ ; XLIB ansi_CHAR XDEF text_cols XDEF text_rows XREF ansi_ROW XREF ansi_COLUMN XREF ace_inverse .text_cols defb 32 .text_rows defb 24 .ansi_CHAR ld hl,ace_inverse or (hl) .setout push af ld hl,$2400 ld a,(ansi_ROW) and a jr z,r_zero ld b,a ld de,32 .r_loop add hl,de djnz r_loop .r_zero ld a,(ansi_COLUMN) ld d,0 ld e,a add hl,de pop af ld (hl),a ret z88dk-1.8.ds1/libsrc/stdio/ansi/ace/f_ansi_cls.asm0000644000175000017500000000050507265604647021410 0ustar tygrystygrys; ; ANSI Video handling for the Jupiter ACE ; ; CLS - Clear the screen ; ; ; Stefano Bodrato - Feb. 2001 ; ; ; $Id: f_ansi_cls.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_cls .ansi_cls ld hl,$2400 ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,32*24 ldir ;;; ;;; The ROM cls call: ;;; call 457 ;;; ret z88dk-1.8.ds1/libsrc/stdio/ansi/ace/f_ansi_dline.asm0000644000175000017500000000056707265604647021732 0ustar tygrystygrys; ; ; ANSI Video handling for the Jupiter ACE ; ; ; Clean a text line ; ; Stefano Bodrato - Feb. 2001 ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_del_line .ansi_del_line ret ld hl,$2400 .sum_loop ld de,32 add hl,de dec a jr nz,sum_loop ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,31 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/ace/f_ansi_scrollup.asm0000644000175000017500000000060407363571706022470 0ustar tygrystygrys; ; ANSI Video handling for the Jupiter ACE ; ; Stefano Bodrato - Feb. 2001 ; ; Handles colors referring to current PAPER/INK/etc. settings ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.3 2001/10/18 15:22:46 stefano Exp $ ; XLIB ansi_SCROLLUP .ansi_SCROLLUP ld hl,$2420 ld de,$2400 ld bc,736 ldir ld hl,$2400+736 ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,31 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/aquarius/0000755000175000017500000000000010765202715017675 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/aquarius/f_ansi_attr.asm0000644000175000017500000000634407412565575022712 0ustar tygrystygrys; ; ANSI Video handling for the Mattel Aquarius ; ; Text Attributes ; m - Set Graphic Rendition ; ; The most difficult thing to port: ; Be careful here... ; ; Stefano Bodrato - Dec. 2000 ; ; ; $Id: f_ansi_attr.asm,v 1.1 2001/12/27 09:35:57 stefano Exp $ ; XLIB ansi_attr XDEF aquarius_attr XDEF aquarius_inverse .aquarius_inverse defb 0 .aquarius_attr defb $70 ; White on Black .ansi_attr and a jr nz,noreset ld a,$70 ld (aquarius_attr),a ret .noreset cp 1 jr nz,nobold ld a,(aquarius_attr) or @00001000 ld (aquarius_attr),a ret .nobold cp 2 jr z,dim cp 8 jr nz,nodim .dim ld a,(aquarius_attr) and @11110111 ld (aquarius_attr),a ret .nodim cp 4 jr nz,nounderline ld a,(aquarius_attr) ; Underline or @00001000 ld (aquarius_attr),a ret .nounderline cp 24 jr nz,noCunderline ld a,(aquarius_attr) ; Cancel Underline and @11110111 ld (aquarius_attr),a ret .noCunderline cp 5 jr nz,noblink ld a,(aquarius_attr) or @10000000 ld (aquarius_attr),a ret .noblink cp 25 jr nz,nocblink ld a,(aquarius_attr) and @01111111 ld (aquarius_attr),a ret .nocblink cp 7 jr nz,noreverse ld a,(aquarius_inverse) and a ret nz ld a,1 ld (aquarius_inverse),a ; inverse 1 .attrswap ld a,(aquarius_attr) rla rla rla rla and @11110000 ld e,a ld a,(aquarius_attr) rra rra rra rra and @1111 or e ld (aquarius_attr),a ret .noreverse cp 27 jr nz,noCreverse ld a,(aquarius_inverse) and a ret z xor a ld (aquarius_inverse),a ; inverse 1 jr attrswap .noCreverse cp 8 jr nz,noinvis ld a,(aquarius_attr) ld (oldattr),a and @1111 ld e,a rla rla rla rla or e ld (aquarius_attr),a ret .oldattr defb 0 .noinvis cp 28 jr nz,nocinvis ld a,(oldattr) ld (aquarius_attr),a ret .nocinvis cp 30 jp m,nofore cp 37+1 jp p,nofore sub 30 ;'' Palette Handling '' and 7 ;'''''''''''''''''''''' rla rla rla rla ld e,a ld a,(aquarius_attr) and @10001111 or e ld (aquarius_attr),a .nofore cp 40 jp m,noback cp 47+1 jp p,noback sub 40 ;'' Palette Handling '' and 7 ;'''''''''''''''''''''' ld e,a ld a,(aquarius_attr) and @11111000 or e ld (aquarius_attr),a ret .noback ret z88dk-1.8.ds1/libsrc/stdio/ansi/aquarius/f_ansi_bel.asm0000644000175000017500000000034707412565575022477 0ustar tygrystygrys; ; ANSI Video handling for the Mattel Aquarius ; ; BEL - chr(7) Beep it out ; ; ; Stefano Bodrato - Dec. 2000 ; ; ; $Id: f_ansi_bel.asm,v 1.1 2001/12/27 09:35:57 stefano Exp $ ; XLIB ansi_BEL .ansi_BEL ld a,7 jp $1d94 z88dk-1.8.ds1/libsrc/stdio/ansi/aquarius/f_ansi_char.asm0000644000175000017500000000130507412565575022645 0ustar tygrystygrys; ; ANSI Video handling for the Mattel Aquarius ; ; set it up with: ; .text_cols = max columns ; .text_rows = max rows ; ; Display a char in location (ansi_ROW),(ansi_COLUMN) ; A=char to display ; ; ; $Id: f_ansi_char.asm,v 1.1 2001/12/27 09:35:57 stefano Exp $ ; XLIB ansi_CHAR XDEF text_cols XDEF text_rows XREF ansi_ROW XREF ansi_COLUMN XREF aquarius_attr .text_cols defb 40 .text_rows defb 24 .ansi_CHAR push af ld hl,$3000 ld a,(ansi_ROW) inc a ; we skip the first line to avoid border problems ld b,a ld de,40 .r_loop add hl,de djnz r_loop ld a,(ansi_COLUMN) ld d,0 ld e,a add hl,de pop af ld (hl),a ld de,1000+24 add hl,de ld a,(aquarius_attr) ld (hl),a ret z88dk-1.8.ds1/libsrc/stdio/ansi/aquarius/f_ansi_cls.asm0000644000175000017500000000062607412565575022516 0ustar tygrystygrys; ; ANSI Video handling for the Mattel Aquarius ; ; CLS - Clear the screen ; ; ; Stefano Bodrato - Dec. 2001 ; ; ; $Id: f_ansi_cls.asm,v 1.1 2001/12/27 09:35:57 stefano Exp $ ; XLIB ansi_cls XREF aquarius_attr .ansi_cls ld hl,$3000 ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,999 ldir ld hl,$3400 ;ld a,(aquarius_attr) ld a,$70 ld (hl),a ld d,h ld e,l inc de ld bc,999 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/aquarius/f_ansi_dline.asm0000644000175000017500000000102107412565575023016 0ustar tygrystygrys; ; ; ANSI Video handling for the Mattel Aquarius ; ; ; Clean a text line ; ; Stefano Bodrato - Dec. 2001 ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.1 2001/12/27 09:35:57 stefano Exp $ ; XLIB ansi_del_line XREF aquarius_attr .ansi_del_line ld hl,$3000 inc a .sum_loop ld de,40 add hl,de dec a jr nz,sum_loop push hl ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,39 ldir pop hl ld de,$400 add hl,de ;ld a,(aquarius_attr) ld a,$70 ld (hl),a ld d,h ld e,l inc de ld bc,39 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/aquarius/f_ansi_scrollup.asm0000644000175000017500000000073707412565575023603 0ustar tygrystygrys; ; ANSI Video handling for the Mattel Aquarius ; ; Handles colors ; ; Scrollup ; ; Stefano Bodrato - Dec. 2001 ; ; $Id: f_ansi_scrollup.asm,v 1.1 2001/12/27 09:35:57 stefano Exp $ ; XLIB ansi_SCROLLUP XREF aquarius_attr .ansi_SCROLLUP ld hl,$3050 ld de,$3028 ld bc,920 ldir ld h,d ld l,e ld (hl),32 ;' ' inc de ld bc,39 ldir ld hl,$3450 ld de,$3428 ld bc,920 ldir ld h,d ld l,e ;ld a,(aquarius_attr) ld a,$70 ld (hl),a inc de ld bc,39 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/c128/0000755000175000017500000000000010765202715016520 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/c128/f_ansi_attr.asm0000644000175000017500000000457407457364561021541 0ustar tygrystygrys; ; ANSI Video handling for the Commodore 128 (Z80 mode) ; By Stefano Bodrato - 22/08/2001 ; ; Text Attributes ; m - Set Graphic Rendition ; ; $Id: f_ansi_attr.asm,v 1.2 2002/04/17 21:30:25 dom Exp $ ; XLIB ansi_attr XREF INVRS XREF ATTR .ansi_attr and a jr nz,noreset ld a,1 ;White on black ld (ATTR+1),a xor a ld (INVRS+1),a ret .noreset cp 1 jr nz,nobold ld a,128 ld (INVRS+1),a ret .nobold cp 2 jr z,dim cp 8 jr nz,nodim .dim xor a ld (INVRS+1),a ret .nodim cp 4 jr nz,nounderline ld a,128 ld (INVRS+1),a ret .nounderline cp 24 jr nz,noCunderline xor a ld (INVRS+1),a ret .noCunderline cp 5 jr nz,noblink ld a,128 ld (INVRS+1),a ret .noblink cp 25 jr nz,nocblink xor a ld (INVRS+1),a ret .nocblink cp 7 jr nz,noreverse ld a,128 ld (INVRS+1),a ;inverse 1 ret .noreverse cp 27 jr nz,noCreverse xor a ld (INVRS+1),a ; inverse 0 ret .noCreverse cp 8 jr nz,noinvis ld a,(ATTR+1) ld (oldattr),a and @11110000 ld e,a rra rra rra rra or e ld (ATTR+1),a ret .oldattr defb 0 .noinvis cp 28 jr nz,nocinvis ld a,(oldattr) ld (ATTR+1),a ret .nocinvis cp 30 jp m,nofore cp 37+1 jp p,nofore sub 30 call palette ;'''''''''''''''''''''' ld (ATTR+1),a ret .nofore cp 40 jp m,noback cp 47+1 jp p,noback sub 40 ; Workaround for background: we force to inverse video. call palette ; could work in some cases, but isn't much compatible ! ;'''''''''''''''''''''' ; ld (53280),a ;border ; ld (53281),a ;background ld (ATTR+1),a ld a,128 ld (INVRS+1),a .noback ret .palette ;'' Palette Handling '' ld e,a ld d,0 ld hl,attrtab add hl,de ld a,(hl) ret .attrtab defb 0 defb 2 defb 5 defb 7 defb 6 defb 4 defb 3 defb 1 z88dk-1.8.ds1/libsrc/stdio/ansi/c128/f_ansi_bel.asm0000644000175000017500000000036007457364562021317 0ustar tygrystygrys; ; ANSI Video handling for the Commodore 128 (Z80 mode) ; By Stefano Bodrato - 22/08/2001 ; ; BEL - chr(7) Beep it out ; ; $Id: f_ansi_bel.asm,v 1.2 2002/04/17 21:30:26 dom Exp $ ; XLIB ansi_BEL .ansi_BEL ret ; Do nothing z88dk-1.8.ds1/libsrc/stdio/ansi/c128/f_ansi_char.asm0000644000175000017500000000173107457364562021475 0ustar tygrystygrys; ; ANSI Video handling for the Commodore 128 (Z80 mode) ; By Stefano Bodrato - 22/08/2001 ; ; set it up with: ; .text_cols = max columns ; .text_rows = max rows ; ; Display a char in location (ansi_ROW),(ansi_COLUMN) ; A=char to display ; ; ; $Id: f_ansi_char.asm,v 1.3 2002/04/17 21:30:26 dom Exp $ ; XLIB ansi_CHAR XDEF text_cols XDEF text_rows XDEF INVRS XDEF ATTR XREF ansi_ROW XREF ansi_COLUMN .text_cols defb 40 .text_rows defb 25 .ansi_CHAR push af ld hl,$2000 ld a,(ansi_ROW) and a jr z,r_zero ld b,a ld de,40 .r_loop add hl,de djnz r_loop .r_zero ld a,(ansi_COLUMN) ld d,0 ld e,a add hl,de pop af cp 96 jr c,nolower sub 96 jr setout .nolower ; These lines aren't needed when we use the alternate font ; cp 64 ; jr c,noupper ; sub 64 ;.noupper .setout .INVRS or 0 ; This byte is set to 128 when INVERSE is ON ld (hl),a ld de,$1000 sbc hl,de ; Color map location .ATTR ld (hl),1 ; This byte is the current attribute ret z88dk-1.8.ds1/libsrc/stdio/ansi/c128/f_ansi_cls.asm0000644000175000017500000000057007457364562021341 0ustar tygrystygrys; ; ANSI Video handling for the Commodore 128 (Z80 mode) ; By Stefano Bodrato - 22/08/2001 ; ; CLS - Clear the screen ; ; ; $Id: f_ansi_cls.asm,v 1.3 2002/04/17 21:30:26 dom Exp $ ; XLIB ansi_cls .ansi_cls ld hl,$2000 ; Text ld d,h ld e,l inc de ld bc,1023 ld (hl),32 ldir ld hl,$1000 ; Color attributes ld d,h ld e,l inc de ld bc,1023 ld (hl),1 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/c128/f_ansi_dline.asm0000644000175000017500000000061507457364562021653 0ustar tygrystygrys; ; ANSI Video handling for the Commodore 128 (Z80 mode) ; By Stefano Bodrato - 22/08/2001 ; ; Clean a text line ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.2 2002/04/17 21:30:26 dom Exp $ ; XLIB ansi_del_line .ansi_del_line ld hl,$400 and a jr z,isz ld de,40 .sum_loop add hl,de dec a jr nz,sum_loop .isz ld b,39 .dlineloop ld (hl),32 inc hl djnz dlineloop ret z88dk-1.8.ds1/libsrc/stdio/ansi/c128/f_ansi_scrollup.asm0000644000175000017500000000074407457364562022426 0ustar tygrystygrys; ; ANSI Video handling for the Commodore 128 (Z80 mode) ; By Stefano Bodrato - 22/08/2001 ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.3 2002/04/17 21:30:26 dom Exp $ ; XLIB ansi_SCROLLUP .ansi_SCROLLUP ld hl,$2000+40 ; Text ld de,$2000 ld bc,40*24 ldir ld h,d ld l,e ld b,40 .reslloop ld (hl),32 inc hl djnz reslloop ld hl,$1000+40 ; Color attributes ld de,$1000 ld bc,40*24 ldir ld h,d ld l,e ld b,40 .reslloop2 ld (hl),32 inc hl djnz reslloop2 ret z88dk-1.8.ds1/libsrc/stdio/ansi/cpc/0000755000175000017500000000000010765202715016610 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/cpc/f_ansi_attr.asm0000755000175000017500000000671610650475166021625 0ustar tygrystygrys; ; ANSI Video handling for the Amstrad CPC ; ; Text Attributes ; m - Set Graphic Rendition ; ; The most difficult thing to port: ; Be careful here... ; ; Stefano Bodrato - Jul. 2004 ; ; ; $Id: f_ansi_attr.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; XLIB ansi_attr INCLUDE "#cpcfirm.def" XDEF INVRS XDEF UNDRL .UNDRL defb 0 .ansi_attr and a jr nz,noreset xor a ld (UNDRL),a ; underline 0 ld a,2 ; ink bright cyan call firmware defw txt_set_pen xor a ; paper blue call firmware defw txt_set_paper ret .noreset cp 1 jr nz,nobold ld a,1 ; ink bright yellow call firmware defw txt_set_pen ret .nobold cp 2 jr z,dim cp 8 jr nz,nodim .dim ld a,2 ; ink bright cyan call firmware defw txt_set_pen ret .nodim cp 4 jr nz,nounderline ld a,1 ld (UNDRL),a ; underline 1 ret .nounderline cp 24 jr nz,noCunderline xor a ld (UNDRL),a ; underline 0 ret .noCunderline cp 5 jr nz,noblink call firmware defw txt_get_pen xor 3 call firmware defw txt_set_pen ret .noblink cp 25 jr nz,nocblink call firmware defw txt_get_pen xor 3 call firmware defw txt_set_pen ret .nocblink cp 7 jr nz,noreverse .callinverse ld ix,txt_inverse jp firmware .noreverse cp 27 jr z,callinverse .noCreverse cp 8 jr nz,noinvis call firmware defw txt_get_pen ld (oldattr),a call firmware defw txt_get_paper call firmware defw txt_set_pen ret .oldattr defb 0 .noinvis cp 28 jr nz,nocinvis ld a,(oldattr) call firmware defw txt_set_pen ret .nocinvis cp 30 jp m,nofore cp 37+1 jp p,nofore sub 30 ;'' Palette Handling '' call dopal call firmware defw txt_set_pen ret .nofore cp 40 jp m,noback cp 47+1 jp p,noback sub 40 ;'' Palette Handling '' call dopal call firmware defw txt_set_paper .noback ret .dopal ld e,a ld d,0 ld hl,ctable add hl,de ld a,(hl) ret .ctable defb 5,3,12,1,0,7,2,4 ;0 Blue 1 ;1 Bright Yellow 24 ;2 Bright Cyan 20 ;3 Bright Red 6 ;4 Bright White 26 ;5 Black 0 ;6 Bright Blue 2 ;7 Bright Magenta 8 ;8 Cyan 10 ;9 Yellow 12 ;10 Pastel blue 14 ;11 Pink 16 ;12 Bright Green 18 ;13 Pastel Green 22 ; ;0 black 5 ;1 red 3 ;2 green 12-13 ;3 yellow 1 ;4 blue 0 ;5 magenta 7 ;6 cyan 2 ;7 white 4 z88dk-1.8.ds1/libsrc/stdio/ansi/cpc/f_ansi_bel.asm0000755000175000017500000000054010710600504021361 0ustar tygrystygrys; ; ANSI Video handling for the Amstrad CPC ; ; BEL - chr(7) Beep it out ; ; ; Stefano Bodrato - Jul. 2004 ; ; ; $Id: f_ansi_bel.asm,v 1.3 2007/10/27 09:13:40 stefano Exp $ ; XLIB ansi_BEL INCLUDE "#cpcfirm.def" XREF firmware .ansi_BEL ld a,7 call firmware defw txt_output ret z88dk-1.8.ds1/libsrc/stdio/ansi/cpc/f_ansi_char.asm0000755000175000017500000000227310650475166021562 0ustar tygrystygrys; ; ANSI Video handling for the Amstrad CPC ; ; Handles colors referring to current PAPER/INK/etc. settings ; ; set it up with: ; .text_cols = max columns ; .text_rows = max rows ; ; Display a char in location (ansi_ROW),(ansi_COLUMN) ; A=char to display ; ; ; $Id: f_ansi_char.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; XLIB ansi_CHAR INCLUDE "#cpcfirm.def" XREF ansi_ROW XREF ansi_COLUMN XDEF text_cols XDEF text_rows XREF INVRS XREF UNDRL .text_cols defb 80 .text_rows defb 25 .ansi_CHAR ld e,a ld a,(ansi_COLUMN) inc a ld h,a ld a,(ansi_ROW) inc a ld l,a push hl call firmware defw txt_set_cursor ld a,e call firmware defw txt_output pop hl ld a,(UNDRL) and a ret z call firmware defw txt_set_cursor ld a,1 call firmware defw txt_set_back ld a,'_' call firmware defw txt_output xor a call firmware defw txt_set_back ret z88dk-1.8.ds1/libsrc/stdio/ansi/cpc/f_ansi_cls.asm0000755000175000017500000000120310650475166021416 0ustar tygrystygrys; ; ANSI Video handling for the Amstrad CPC ; ; CLS - Clear the screen ; ; Stefano Bodrato - Jul. 2004 ; ; ; $Id: f_ansi_cls.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; XLIB ansi_cls INCLUDE "#cpcfirm.def" .ansi_cls ;ld a,0 ; 20x25x16 text mode ;ld a,1 ; 40x25x4 text mode ;ld a,2 ; 80x25 mono text mode ;call $bc0e ;set mode call firmware defw txt_initialise ld a,2 call firmware defw txt_set_pen xor a call firmware defw txt_set_paper ld a,$0c call firmware defw txt_output ret z88dk-1.8.ds1/libsrc/stdio/ansi/cpc/f_ansi_dline.asm0000755000175000017500000000066010650475166021736 0ustar tygrystygrys; ; ANSI Video handling for the Amstrad CPC ; ; Clean a text line ; ; Stefano Bodrato - Jul. 2004 ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; XLIB ansi_del_line INCLUDE "#cpcfirm.def" .ansi_del_line ld a,$11 call firmware defw txt_output ld a,$12 call firmware defw txt_output ret z88dk-1.8.ds1/libsrc/stdio/ansi/cpc/f_ansi_scrollup.asm0000755000175000017500000000070210650475166022503 0ustar tygrystygrys; ; ANSI Video handling for ZX Spectrum ; ; Handles colors referring to current PAPER/INK/etc. settings ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.2 2007/07/21 21:28:22 dom Exp $ ; XLIB ansi_SCROLLUP INCLUDE "#cpcfirm.def" XREF text_rows .ansi_SCROLLUP ld a,50 call firmware defw txt_set_row ld a,10 call firmware defw txt_output ret z88dk-1.8.ds1/libsrc/stdio/ansi/F3.BIN0000644000175000017500000000340007130401724016633 0ustar tygrystygrys@@@@@@PPPPP@`@ @ @@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@ @@@ @ @ `` @`@ @@@@@@` @@@@@ @@ @ @@ @@@``@ࠠ@@@`ࠠ@@@@@@@@@@ࠠ@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ࠠ@@@@@@@`@@@@@@ @@@@ @@@@@@@@`@@@ @@@@@ ```@@ @@@@@`` @ @@@@@`@@@@@ @@@@@@@@@@ࠠ@ࠠ`p 0`𠠰@@@@@@@@@@` @@@@@@@@@@@@@@@@@`@`@@`@``@@@@@@ `@ P@@@@@@@@@ @@@@`` PPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPP 0 0 0 0 PPPPPPPPPPP@pp@PPPPPPPPPPPP@PPPPPPPPP PPPP PPPPPPPp 0 00 0 pPPPPPPPPPP 0 00000000 0 0 0 0 PPPPPPPPPPP@pp@PPPPPPPPPPPP@PPPPPPPPP PPPP PPPPPPPp 0 00 0 pPPPPPPPPPP 0 00000000z88dk-1.8.ds1/libsrc/stdio/ansi/F4.BIN0000644000175000017500000000340007130401724016634 0ustar tygrystygrys@@@@@@PPPPP@`@ @ @@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@ @@@ @ @ `` @`@ @@@@@@` @@@@@ @@ @ @@ @@@``@ࠠ@@@`ࠠ@@@@@` @ࠠ@@@ @@ @@@@@@@@@@@@@@ @`@@@@@`@@@ ` `@@ @@ ``@` @@@@`` @@@@@@ @@@@@@ࠠ@@`` `@ @@@@@``@@@` @ @@@@ @@@@@@@@`@@P@@@@ ```@` @ `` @@`@`@`@@@@@@@@@@@ࠠ@ࠠ`p 0`𠠰@@@@@@@@@@` @@@@@@@@@@@ @@@@@0 `@@@@@`@@`@``@@@@@@pP0P@@@@@@PPP PPPPpp PPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPP 0 0 0 0 PPPPPPPPPPP@pp@PPPPPPPPPPPP@PPPPPPPPP PPPP PPPPPPPp 0 00 0 pPPPPPPPPPP 0 00000000 0 0 0 0 PPPPPPPPPPP@pp@PPPPPPPPPPPP@PPPPPPPPP PPPP PPPPPPPp 0 00 0 pPPPPPPPPPP 0 00000000z88dk-1.8.ds1/libsrc/stdio/ansi/F4PACK.BIN0000644000175000017500000000060007500073176017301 0ustar tygrystygrys@jD$JD@HHDD@@HDND"DB.hl*$nĤHDFLDD NN B$DdjĪȨΨ䊈Ȋ䤤j*,,JĪĪʎĪĢJJJJJNNJD$$DBBB"&@L ʨ $jf @FJF Ĥ(**,*@@JNNJĪƪƂƨ@@JJJfDJ ,DHDDDDHP z88dk-1.8.ds1/libsrc/stdio/ansi/F5.BIN0000644000175000017500000000340007130401724016635 0ustar tygrystygrys@@@@@@````` 0 @0@@P`@ @@ @ @ pp p `@` @`А` ` p` @ `` ` `0@` @@````p @ @ @  @` @@`p````p𐐐p p`𐐐а```P``` `@`@@@@ @@  P@ А```P``p P@@@@`P`А ` p @` p𐐐А````pЀp`@@@@@0P@`p` @ @  @  @@ ``` @P0`p`pp`pp`pp0`pppp ``p`p`pP` p`` p` p```0 0`𠠰````````PPp``` P@@P@@@@ P@@@@0 0` p0``0Pа`p`` @`@ 0Pp (PP(P(P TTTTTTTT((((((((((((((((((((((((((((((((((((,(((((, << ,((((((((((, ,(((((((((((((((((((<<((((((((((((((,(((((, << ,((((((((((, ,(((((((((((((((((((<<((((((((((z88dk-1.8.ds1/libsrc/stdio/ansi/F6.BIN0000644000175000017500000000340007130401724016636 0ustar tygrystygrys@@@@@@````` 0 @0@@P`@ @@ @ @ pp p `@` @`А` ` p` @ `` ` `0@` @@````p @ @ @  @` @@`p````p𐐐p p`𐐐а```P``` `@`@@@@ @@  P@ А```P``p P@@@@`P`А ` p @` p𐐐А````pЀp`@@@@@0P@`p` @ @  @  @@ ``` @P0`p`pp`pp`pp0`pppp ``p`p`pP` p`` p` p```0 0`𠠰````````PPp``` P@@P@@@@ P@@@@0 0` p0``0Pа`p`` @`@ 0Pp (PP(P(P TTTTTTTT((((((((((((((((((((((((((((((((((((,(((((, << ,((((((((((, ,(((((((((((((((((((<<((((((((((((((,(((((, << ,((((((((((, ,(((((((((((((((((((<<((((((((((z88dk-1.8.ds1/libsrc/stdio/ansi/F8.BIN0000644000175000017500000000340007130401724016640 0ustar tygrystygrys$$$$$~$~$$>@<|bd&F0H0Vv  @@@   D88D| ~ @8  @ ~~B?` .11.|` ,2""b08BB<` $(0(&08vIIII\bBBB@<|| BBBF:AA"AIII6D((DBBB>|| | ` 002L"AA B8088<@@<@@>$ p B|D(||LxDODE|` 8 ~8DD8| @B<~@@~BH)CBJ*_$H$H$$H""""UUUUwwz88dk-1.8.ds1/libsrc/stdio/ansi/f_ansi.asm0000644000175000017500000005553707662450563020033 0ustar tygrystygrys; ; Z80 ANSI Library ; ;--------------------------------------------------- ; ANSI specifics handling. ; (Intel 8086 to Z80 port) ; ; Optimized for speed in the case of multi-character write requests. ; Original NANSI terminal driver (C) 1986 Daniel Kegel - http://www.kegel.com ; Modifications by Tom Almy without restrictions. ; ; - Port to Z80 and some improvement by Stefano Bodrato - 21/4/2000 ; - Small fix on the "set cursor position" range checks - 21/11/2002 ; ; MISSING or surely buggy Escapes: ; I - Cursor up and scroll down if on top ; L - Insert lines: to be completed ; M - Delete lines: to be completed ; ; ; $Id: f_ansi.asm,v 1.6 2003/05/20 16:01:55 stefano Exp $ ; XLIB f_ansi LIB ansi_putc LIB ansi_attr LIB ansi_CHAR LIB ansi_CLS LIB ansi_LF LIB ansi_DSR6 LIB ansi_BEL LIB ansi_del_line XDEF ansi_COLUMN XDEF ansi_ROW XREF text_cols XREF text_rows ;--------------------------------------------------- ; Fire out all the buffer (pointed by HL; len DE) ;--------------------------------------------------- .ansi_COLUMN defb 0 .ansi_ROW defb 0 .f_ansi ld a,d or e ret z .show ; **** Link to ANSI engine **** ld bc,(escvector) ld a,b or c jp nz,f_in_escape ; ***************************** ld a,(hl) inc hl dec de ; **** Link to ANSI engine **** cp 27 jp z,f_escape ; ***************************** ; **** Link to ANSI engine **** ; Un-comment this and the line containing [f_9b:] to activate CSI. ; cp 155 ;h9b ;CSI? jp z,f_9b ; ***************************** ;------------------------ cp 12 ; Form Feed (CLS) ? ;------------------------ jr nz,NoFF push hl push de call ansi_CLS xor a ld (ansi_ROW),a ld (ansi_COLUMN),a pop de pop hl jr loopn .noFF ;------------------------ ; cp 13 ; CR? ;------------------------ ; jr nz,NoCR ; ld a,(ansi_COLUMN) ; xor a ; ld (ansi_COLUMN),a ; jr loopn ;.NoCR ;------------------------ ; Temporary (?) patch. ; CR becomes CR+LF ;------------------------ cp 13 jr z,isLF ;------------------------ cp 10 ; LF? jr nz,NoLF ;------------------------ .isLF ;------------------------ ; push hl push de call ansi_LF pop de pop hl jr loopn .NoLF cp 9 ; TAB? jr nz,NoTAB push hl push de ld a,(ansi_COLUMN) rra rra inc a rla rla push hl ld hl,text_cols cp (hl) pop hl jp p,OutTAB ld (ansi_COLUMN),a .OutTAB pop de pop hl jr loopn .NoTAB ;------------------------ cp 7 ; BEL? ;------------------------ jr nz,NoBEL push hl push de call ansi_BEL pop de pop hl jr loopn .NoBEL ;------------------------ cp 8 ; BackSpace ;------------------------ jr nz,NoBS ld a,(ansi_COLUMN) and a jr z,firstc ; are we in the first column? dec a ld (ansi_COLUMN),a jr loopn .firstc ld a,(ansi_ROW) and a jr z,loopn dec a ld (ansi_ROW),a ld a,(text_cols) dec a ld (ansi_COLUMN),a jr loopn .NoBS ; **** Link to ANSI engine **** .f_not_ANSI ; push hl push de call ansi_putc pop de pop hl ; ***************************** .loopn ; I'm not sure about this three lines ;------------------------------------ ld a,d or e jp nz,show ; **** Link to ANSI engine **** .f_loopdone ; ***************************** ret ; A state machine implementation of the mechanics of ANSI terminal control ; string parsing. ; ; Entered with a jump to f_escape when driver finds an escape, or ; to f_in_escape when the last string written to this device ended in the ; middle of an escape sequence. ; ; Exits by jumping to f_ANSI_exit when an escape sequence ends, or ; to f_not_ANSI when a bad escape sequence is found, or (after saving state) ; to f_loopdone when the write ends in the middle of an escape sequence. ; ; Parameters are stored as bytes in param_buffer. If a parameter is ; omitted, it is stored as zero. Each character in a keyboard reassignment ; command counts as one parameter. ; ; When a complete escape sequence has been parsed, the address of the ; ANSI routine to call is found in ansi_fn_table. ; ; Register usage during parsing: ; HL points to the incoming string. ; DE holds the length remaining in the incoming string. ; BC is the (incrementing) pointer to param_buffer ;----------------------------------------- ; Variables declaration ;----------------------------------------- .escvector defw 0 .cur_parm_ptr defw 0 .eat_key defb 0 .string_term defb 0 .param_buffer defs 40 .param_end defw 0 .f_ANSI_exit ld bc,0 ld (escvector), bc jp loopn ;----- f_in_escape --------------------------------------------------- ; Main loop noticed that escvector was not zero. ; Recall value of BC saved when sleep was jumped to, and jump into parser. .f_in_escape ld bc, (escvector) push bc ld bc, (cur_parm_ptr) ret ;----- syntax_error --------------------------------------- ; A character was rejected by the state machine. Exit to ; main loop, and print offending character. Let main loop ; decrement DE (length of input string). .syntax_error ld bc,0 ld (escvector), bc jp f_not_ANSI ; exit, print offending char ;----- f_escape ------------------------------------------------------ ; We found an escape. Next character should be a left bracket. .f_escape ; next_is f_bracket ld a,d or e jr nz, f_bracket ld bc, f_bracket ld (escvector), bc jp f_loopdone ;----- f_bracket ----------------------------------------------------- ; Last char was an escape. This one should be a [; if not, print it. ; Next char should begin a parameter string. .f_bracket ld a, (hl) inc hl dec de cp '[' jr nz, syntax_error .f_9b ; Entry for CSI. (Eq. ESC[) ; Set up for getting a parameter string. ld bc, param_buffer xor a ; zero ld (bc), a ; default first char dec bc ; point buffer before start ld (eat_key), a ; no eaten key ; next_is f_get_args ld a,d or e jr nz, f_get_args ld (cur_parm_ptr), bc ld bc, f_get_args ld (escvector), bc jp f_loopdone ;----- f_get_args --------------------------------------------------- ; Last char was a [. If the current char is a '=' or a '?', save ; it for SET/RESET MODE, and then proceed to f_get_param. .f_get_args ld a,(hl) inc hl dec de cp '=' jr z, fga_ignore cp '?' jr nz, get_param_B .fga_ignore ld (eat_key), a ; save = or ? ; next_is f_get_param ld a,d or e jr nz, f_get_param ld (cur_parm_ptr), bc ld bc, f_get_param ld (escvector), bc jp f_loopdone ;----- f_get_param --------------------------------------------------- ; Last char was one of the four characters "]?=;". ; We are getting the first digit of a parameter, a quoted string, ; a ;, or a command. .f_get_param ld a,(hl) inc hl dec de .get_param_B ; jump to here if no fetch of character cp '0' jp m, fgp_may_quote cp '9'+1 jp p, fgp_may_quote ; if bc set to 1 first parameter (B is still = 0) inc b dec b jr nz,no_default push af ld hl,param_buffer ld a,1 ld (hl),a pop af .no_default ; Command interpreter ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% m %%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%%%%%%%% Set graphic rendition %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cp 'm' jp nz,no_m inc b dec b jr nz,m_nodefault ld hl,param_buffer ld a,0 ld (hl),a inc b .m_nodefault ld hl,param_buffer .loop_m ld a,(hl) call ansi_attr inc hl dec b jp nz,loop_m jp f_cmd_exit .no_m ;.temp jp f_cmd_exit ;%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% C %%%%%%%%%%%%%%%%%%%%%% ;%%%%%%%% Cursor forward %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%%% cp 'C' ; CUF - Cursor foreward jr nz,no_C ld hl,param_buffer ld a,(ansi_COLUMN) add a,(hl) push bc push af ld a,(text_cols) ld b,a pop af inc b cp b pop bc jp p, no_C_FWD ld (ansi_COLUMN),a jp f_cmd_exit .no_C_FWD ld a,(text_cols) dec a ld (ansi_COLUMN),a jp f_cmd_exit .no_C ;%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% D %%%%%%%%%%%%%%%%%%%%%%% ;%%%%%%%% Cursor backward %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%%%% cp 'D' ; CUB - Cursor backward jr nz,no_D ld hl,param_buffer ld a,(ansi_COLUMN) sub (hl) jp nc, no_D_TOP xor a .no_D_TOP ld (ansi_COLUMN),a jp f_cmd_exit .no_D ;%%%%%%%%%%%%%%%%%%%%%% ;%% A %%%%%%%%%%%%%%%%% ;%%%%%%%% Cursor UP %%% ;%%%%%%%%%%%%%%%%%%%%%% cp 'A' ; CUU - Cursor up jr nz,no_A ld hl,param_buffer .f_ansi_cup ld a,(ansi_ROW) sub (hl) jp p, no_A_TOP xor a .no_A_TOP ld (ansi_ROW),a jp f_cmd_exit .no_A ;%%%%%%%%%%%%%%%%%%%%%%%% ;%% B %%%%%%%%%%%%%%%%%%% ;%%%%%%%% Cursor DOWN %%% ;%%%%%%%%%%%%%%%%%%%%%%%% cp 'B' ; CUD - Cursor down jr nz,no_B ld hl,param_buffer ld a,(ansi_ROW) add a,(hl) inc a ld hl,text_rows cp (hl) jp p,B_ok ld a,(text_rows) .B_ok dec a ld (ansi_ROW),a jp f_cmd_exit .no_B ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% s - j %%%%%%%%%%%%%%%%%%%% ;%%%%%%%% save cursor pos. %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cp 's' ; SCP - Save cursor position jr z,do_s cp 'j' jr nz,no_s .do_s ld a,(ansi_COLUMN) ld (scp_x),a ld a,(ansi_ROW) ld (scp_y),a jp f_cmd_exit .scp_x defb 0 .scp_y defb 0 .no_s ;%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% u - k %%%%%%%%%%%%%%%%%% ;%%%%%%%% r. cursor pos. %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%%% cp 'u' ; RCP - Restore cursor position jr z,do_u cp 'k' jr nz,no_u .do_u ld a,(scp_x) ld (ansi_COLUMN),a ld a,(scp_y) ld (ansi_ROW),a jp f_cmd_exit .no_u ;%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% H %%%%%%%%%%%%%%%%%%%%%%% ;%%%%%%%% SET cursor pos. %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%%%% cp 'f' ; HVP not fully functional jr z,IsHVP cp 'H' ; CUP - Cursor position jr nz,no_H .IsHVP inc b dec b jr nz,H_Nodeflt ld hl,param_buffer ld a,1 ld (hl),a inc hl ld (hl),a .H_Nodeflt dec b jr nz,H_nodef1 ld hl,param_buffer inc hl ld a,1 ld (hl),a .H_nodef1 ld hl,param_buffer ld a,(hl) push hl ld hl,text_rows cp (hl) pop hl jp m,HLineOK ld a,(text_rows) ;; 19/11/2002 Stefano - was: dec c dec a .HLineOK ld (ansi_ROW),a inc hl ld a,(hl) dec a ld hl,text_cols cp (hl) jp m,HColOK ld a,(hl) dec a .HColOK ld (ansi_COLUMN),a jp f_cmd_exit .no_H ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% b %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%%%%%%%% Erase from start of display %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cp 'b' jr z,is_J1_b ;%%%%%%%%%%%%%%%% ;%% J %%%%%%%%%%% ;%%%%%%%% CLS %%% ;%%%%%%%%%%%%%%%% cp 'J' ; ED - Erase in display jp nz,no_J inc b dec b jr nz,J_nodefault ld hl,param_buffer ld a,0 ld (hl),a ; inc b --not useful (1 parameter only) .J_nodefault ld hl,param_buffer ld a,(hl) and a ; from cursor to end of screen jr nz,no_J_0 ; First, from cursor to EOL ld a,(ansi_ROW) push af ld a,(ansi_COLUMN) push af .j0loop push af ld a,32 ;' ' ; BLANK call ansi_CHAR ; The low level video routine pop af inc a ld (ansi_COLUMN),a ld hl,text_cols cp (hl) jp m,j0loop pop af ld (ansi_COLUMN),a ; restore orig. cursor pos. pop af ld (ansi_ROW),a ; restore orig. cursor pos. ; Then, from the cursor line + 1 up to the last line .j0LineLoop inc a inc a ld hl,text_rows cp (hl) jp z,f_cmd_exit ;dec a push af call ansi_del_line pop af jr j0LineLoop .no_J_0 cp 1 ; from (0;0) to cursor jr nz,no_J_1 .is_J1_b ; First, from cursor to 0 ld a,(ansi_ROW) push af ld a,(ansi_COLUMN) push af .j1loop push af ld a,32 ;' ' ; BLANK call ansi_CHAR ; The low level video routine pop af dec a ld (ansi_COLUMN),a cp 0 jp p,j1loop pop af ld (ansi_COLUMN),a ; restore orig. cursor pos. pop af ld (ansi_ROW),a ; restore orig. cursor pos. ; Then, from the cursor line - 1 up to 0 and a jp z,f_cmd_exit .j1LineLoop dec a push af call ansi_del_line pop af cp 0 jp p,j1LineLoop jp f_cmd_exit .no_J_1 cp 2 ; entire screen (+home cursor [non-standard]) jp nz,f_cmd_exit ; Syntax Error! ; clear all screen push bc push de call ansi_cls pop de pop bc ; HOME xor a ld (ansi_ROW),a ld (ansi_COLUMN),a jp f_cmd_exit .no_J ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% o %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%%%%%%%% Erase from start of line %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cp 'o' jr z,is_K1_o ;%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% K %%%%%%%%%%%%%%%%%%%%% ;%%%%%%%% Erase in line %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%% cp 'K' ; EL - Erase in line jp nz,no_K inc b dec b jr nz,K_nodefault ld hl,param_buffer ld a,0 ld (hl),a ; inc b --not useful (1 parameter only) .K_nodefault ld hl,param_buffer ld a,(hl) and a ; From cursor to end of line jr nz,no_K_0 ld a,(ansi_COLUMN) push af .K0loop push af ld a,32 ; ' ' ; BLANK call ansi_CHAR ; The low level video routine pop af inc a ld (ansi_COLUMN),a ld hl,text_cols cp (hl) jp m,K0loop pop af ld (ansi_COLUMN),a ; restore orig. cursor pos. .no_K_0 cp 1 ; From beginning of line to cursor jr nz,no_K_1 .is_K1_o ld a,(ansi_COLUMN) push af .K1loop push af ld a,32 ;' ' ; BLANK call ansi_CHAR ; The low level video routine pop af dec a ld (ansi_COLUMN),a cp 0 jp p,K1loop pop af ld (ansi_COLUMN),a ; restore orig. cursor pos. jp f_cmd_exit .no_K_1 cp 2 ; entire screen (+home cursor [non-standard]) jp nz,f_cmd_exit ; Syntax Error! ld a,(ansi_ROW) call ansi_del_line jp f_cmd_exit .no_K ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% l %%%%%%%%%%%%%%%%%%%%%%%%%% ;%%%%%%%% Erase current line %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cp 'l' jr nz,noecl ld a,(ansi_ROW) call ansi_del_line jp f_cmd_exit .noecl ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%% n %%%%%%%%%%%%%%%%%%%%%%%%%%%% ;%%%%%%%% Device Status Report %%% ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cp 'n' ; DSR - Device status report jp nz,no_n inc b dec b jp z, f_cmd_exit ; only mode 6 is supported .n_nodefault ld hl,param_buffer ld a,(hl) cp 6 jp z, f_cmd_exit ; only mode 6 is supported call ansi_dsr6 jp f_cmd_exit .no_n ;%%%%%%%%%%%%%%%%%%%%%%%%% ;%% L %%%%%%%%%%%%%%%%%%%% ;%%%%%%%% Insert Lines %%% ;%%%%%%%%%%%%%%%%%%%%%%%%% cp 'L' ; IL - Insert lines jr nz,no_L ld hl,param_buffer ld b,(hl) ld a,(ansi_ROW) jp f_cmd_exit .no_L ;%%%%%%%%%%%%%%%%%%%%%%%%% ;%% M %%%%%%%%%%%%%%%%%%%% ;%%%%%%%% Delete Lines %%% ;%%%%%%%%%%%%%%%%%%%%%%%%% cp 'M' ; DL - Delete lines jr nz,no_MM ld hl,param_buffer ld a,(hl) .no_MM ;%% E X I T %% .f_cmd_exit pop de pop hl jp f_ANSI_exit z88dk-1.8.ds1/libsrc/stdio/ansi/f_ansi_dsr6.asm0000644000175000017500000000051707265604647020760 0ustar tygrystygrys; ; Z80 ANSI Library ; ;--------------------------------------------------- ; Device status report - 6 ; Give the cursor position: ; Should reply with {ESC}[x;yR ; ; Stefano Bodrato - Apr. 2000 ; ; $Id: f_ansi_dsr6.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_DSR6 .ansi_DSR6 ; No TalkBack, at the moment ret z88dk-1.8.ds1/libsrc/stdio/ansi/f_ansi_lf.asm0000644000175000017500000000107007265604647020476 0ustar tygrystygrys; ; Z80 ANSI Library ; ;--------------------------------------------------- ; LF - chr(10) Line Feed ; Do also a Carriage return. ; ; Stefano Bodrato - 21/4/2000 ; ; $Id: f_ansi_lf.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_LF XREF ansi_ROW XREF ansi_COLUMN XREF text_rows LIB ansi_SCROLLUP .ansi_LF xor a ; yes, ld (ansi_COLUMN),a ; automatic CR ld a,(ansi_ROW) inc a ld (ansi_ROW),a ld hl,text_rows cp (hl) ; Out of screen? ret nz ; no, return ld a,(text_rows) dec a ; yes! ld (ansi_ROW),a jp ansi_SCROLLUP z88dk-1.8.ds1/libsrc/stdio/ansi/f_ansi_putc.asm0000644000175000017500000000075607265604647021062 0ustar tygrystygrys; ; Z80 ANSI Library ; ;--------------------------------------------------- ; Character output ; x,y coordinates and LineFeed handling ; ; Stefano Bodrato - 21/4/2000 ; ; $Id: f_ansi_putc.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_putc XREF ansi_COLUMN XREF text_cols LIB ansi_CHAR LIB ansi_LF .ansi_putc call ansi_CHAR ld a,(text_cols) ld d,a ld a,(ansi_COLUMN) inc a ld (ansi_COLUMN),a cp d ; last column ? ret nz ; no, return jp ansi_LF z88dk-1.8.ds1/libsrc/stdio/ansi/FONT3.BIN0000644000175000017500000000400007340500341017207 0ustar tygrystygryspЀРp@@@@@@@@@@@@@@@@@@@``````0`@@@@@`@`@@pPpPP@@@@ `` @@@@pPPP`@@ @@@@@@@@@@@@@@ @@@ @@@@@@@@PPPPP@`@ @ @@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@ @@@ @ @ `` @`@ @@@@@@` @@@@@ @@ @ @@ @@@``@ࠠ@@@`ࠠ@@@@@@@@@@ࠠ@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ࠠ@@@@@@@`@@@@@@ @@@@ @@@@@@@@`@@@ @@@@@ ```@@ @@@@@`` @ @@@@@`@@@@@ @@@@@@@@@@ࠠ@ࠠ`p 0`𠠰@@@@@@@@@@` @@@@@@@@@@@@@@@@@`@`@@`@``@@@@@@ `@ P@@@@@@@@@ @@@@`` PPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPP 0 0 0 0 PPPPPPPPPPP@pp@PPPPPPPPPPPP@PPPPPPPPP PPPP PPPPPPPp 0 00 0 pPPPPPPPPPP 0 00000000 ࠀ𠠠ࠀ@p@@@@@@@@@` ` `@``````@@@@ @ @@ @ @@@PP@@``@0 ` @````z88dk-1.8.ds1/libsrc/stdio/ansi/FONT4.BIN0000644000175000017500000000400007340500341017210 0ustar tygrystygryspЀРp@@@@@@@@@@@@@@@@@@@``````0`@@@@@`@`@@pPpPP@@@@ `` @@@@pPPP`@@ @@@@@@@@@@@@@@ @@@ @@@@@@@@PPPPP@`@ @ @@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@ @@@ @ @ `` @`@ @@@@@@` @@@@@ @@ @ @@ @@@``@ࠠ@@@`ࠠ@@@@@` @ࠠ@@@ @@ @@@@@@@@@@@@@@ @`@@@@@`@@@ ` `@@ @@ ``@` @@@@`` @@@@@@ @@@@@@ࠠ@@`` `@ @@@@@``@@@` @ @@@@ @@@@@@@@`@@P@@@@ ```@` @ `` @@`@`@`@@@@@@@@@@@ࠠ@ࠠ`p 0`𠠰@@@@@@@@@@` @@@@@@@@@@@ @@@@@0 `@@@@@`@@`@``@@@@@@pP0P@@@@@@PPP PPPPpp PPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPP 0 0 0 0 PPPPPPPPPPP@pp@PPPPPPPPPPPP@PPPPPPPPP PPPP PPPPPPPp 0 00 0 pPPPPPPPPPP 0 00000000PPࠀ𠠠ࠀ@p@@@@@@@@@` ` `@``````@@@@ @ @@ @ @@@PP@@``@0 ` @````z88dk-1.8.ds1/libsrc/stdio/ansi/FONT5.BIN0000644000175000017500000000400007340500341017211 0ustar tygrystygrysp؈pppPp pp pP p p p pp ؈ PP ب8h@pp xHx@@@xHxHHX pp 0pp0 p p PPPPPPxh(((`P ` p p p p  @@ PP pp @@@@@@````` 0 @0@@P`@ @@ @ @ pp p `@` @`А` ` p` @ `` ` `0@` @@````p @ @ @  @` @@`p````p𐐐p p`𐐐а```P``` `@`@@@@ @@  P@ А```P``p P@@@@`P`А ` p @` p𐐐А````pЀp`@@@@@0P@`p` @ @  @  @@ ``` @P0`p`pp`pp`pp0`pppp ``p`p`pP` p`` p` p```0 0`𠠰````````PPp``` P@@P@@@@ P@@@@0 0` p0``0Pа`p`` @`@ 0Pp (PP(P(P TTTTTTTT((((((((((((((((((((((((((((((((((((,(((((, << ,((((((((((, ,(((((((((((((((((((<<((((((((((PP`𰀀PPPPP@ @p@PPPPh pp PP PPP0@0ppppppppp @  @ @@ 8( ```` 8 ` 0`ppppz88dk-1.8.ds1/libsrc/stdio/ansi/FONT6.BIN0000644000175000017500000000400007340500341017212 0ustar tygrystygrysp؈pppPp pp pP p p p pp ؈ PP ب8h@pp xHx@@@xHxHHX pp xx p p xh(((0HP(HH0 p p p p  @@ PP pp PPPPPPPP xp(  @@@h00 @ @@@ @  @ pp 00 @00 @pȈp ` ppp0p0Pp8@p @ppppx @ @ @  @p0 px Pppxxp p8`بȨppph𠐈ppp pP PP PP p@x@@@@@x@ xx P`` `pxȈȰpphhpp( p phpȈ ` p`` pШȈppȰhhȀxp (hP PP Pxp @ @  @  @@ p؈pp`hpx`px`px`px0`pxxx0pxpxpx(080H08`08P P P0|x|><~~<$$$$$$r>c8DD8x~~~<~~<8|TT|8 0``0@@@~$ff$8||8$$$$$~$~$$>@<|bd&F0H0Vv  @@@   D88D| ~ @8  @ ~~B?` .11.|` ,2""b08BB<` $(0(&08vIIII\bBBB@<|| BBBF:AA"AIII6D((DBBB>|| | ` 002L"AA B8088<@@<@@>$ p B|D(||LxDODE|` 8 ~8DD8| @B<~@@~BH)CBJ*_$H$H$$H""""UUUUww1JDJ1HHH0DDDz@@3L|8DD8|$B~B$$BB$$f ',$57 defb '\',$59 defb '!',$61 defb '"',$62 defb '#',$63 defb '$',$64 defb '%',$65 defb '&',$66 defb 39,$67 defb 96,$67 defb '(',$68 defb ')',$69 defb '+',$6a defb '*',$6b defb '|',$79 defb 0 z88dk-1.8.ds1/libsrc/stdio/ansi/sharp-mz/f_ansi_cls.asm0000644000175000017500000000057707265604647022432 0ustar tygrystygrys; ; ANSI Video handling for the Sharp MZ ; ; CLS - Clear the screen ; ; ; Stefano Bodrato - Maj 2000 ; ; ; $Id: f_ansi_cls.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_cls .ansi_cls ld hl,$D000 ld (hl),0 ;' ' ld d,h ld e,l inc de ld bc,40*25 ldir ld hl,$D800 ld (hl),$70 ld d,h ld e,l inc de ld bc,40*25 ldir ; ld (hl),$70 ; ld bc,40*25 ; ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/sharp-mz/f_ansi_dline.asm0000644000175000017500000000056407265604647022740 0ustar tygrystygrys; ; ; ANSI Video handling for the Sharp MZ ; ; ; Clean a text line ; ; Stefano Bodrato - Maj 2000 ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_del_line .ansi_del_line ret ld hl,$D000 .sum_loop ld de,40 add hl,de dec a jr nz,sum_loop ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,39 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/sharp-mz/f_ansi_scrollup.asm0000644000175000017500000000072507265604647023507 0ustar tygrystygrys; ; ANSI Video handling for the Sharp MZ ; ; Handles colors referring to current PAPER/INK/etc. settings ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_SCROLLUP .ansi_SCROLLUP ld hl,$D028 ld de,$D000 ld bc,960 ldir ld hl,$D000+960 ld (hl),0 ;' ' ld d,h ld e,l inc de ld bc,39 ldir ld hl,$D828 ld de,$D800 ld bc,960 ldir ld hl,$D800+960 ld (hl),$70 ld d,h ld e,l inc de ld bc,39 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/spectrum/0000755000175000017500000000000010765202715017705 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/spectrum/f_ansi_attr.asm0000644000175000017500000000537707265604647022727 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; Text Attributes ; m - Set Graphic Rendition ; ; The most difficult thing to port: ; Be careful here... ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: f_ansi_attr.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_attr XREF INVRS .ansi_attr and a jr nz,noreset ld a,7 ld (23693),a ret .noreset cp 1 jr nz,nobold ld a,(23693) or @01000000 ld (23693),a ret .nobold cp 2 jr z,dim cp 8 jr nz,nodim .dim ld a,(23693) and @10111111 ld (23693),a ret .nodim cp 4 jr nz,nounderline ld a,32 ld (INVRS+2),a ; underline 1 ret .nounderline cp 24 jr nz,noCunderline ld a, 24 ld (INVRS+2),a ; underline 0 ret .noCunderline cp 5 jr nz,noblink ld a,(23693) or @10000000 ld (23693),a ret .noblink cp 25 jr nz,nocblink ld a,(23693) and @01111111 ld (23693),a ret .nocblink cp 7 jr nz,noreverse ld a,47 ld (INVRS),a ; inverse 1 ret .noreverse cp 27 jr nz,noCreverse xor a ld (INVRS),a ; inverse 0 ret .noCreverse cp 8 jr nz,noinvis ld a,(23693) ld (oldattr),a and @00111000 ld e,a rra rra rra or e ld (23693),a ret .oldattr defb 0 .noinvis cp 28 jr nz,nocinvis ld a,(oldattr) ld (23693),a ret .nocinvis cp 30 jp m,nofore cp 37+1 jp p,nofore sub 30 ;'' Palette Handling '' rla bit 3,a jr z,ZFR set 0,a and 7 .ZFR ;'''''''''''''''''''''' ld e,a ld a,(23693) and @11111000 or e ld (23693),a ret .nofore cp 40 jp m,noback cp 47+1 jp p,noback sub 40 ;'' Palette Handling '' rla bit 3,a jr z,ZBK set 0,a and 7 .ZBK ;'''''''''''''''''''''' rla rla rla ld e,a ld a,(23693) and @11000111 or e ld (23693),a .noback ret z88dk-1.8.ds1/libsrc/stdio/ansi/spectrum/f_ansi_bel.asm0000644000175000017500000000125707265604647022510 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; BEL - chr(7) Beep it out ; ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: f_ansi_bel.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_BEL ; A fine double frequency beep for BEL .ansi_BEL ld a,(23624) rra rra rra .BEL_LENGHT ld b,70 ld c,254 .BEL_loop dec h jr nz,BEL_jump xor 16 out (c),a .BEL_FREQ_1 ld h,165 .BEL_jump dec l jr nz,BEL_loop xor 16 out (c),a .BEL_FR_2 ld l,180 djnz BEL_loop ret z88dk-1.8.ds1/libsrc/stdio/ansi/spectrum/f_ansi_char.asm0000644000175000017500000001025010216017421022626 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; Handles colors referring to current PAPER/INK/etc. settings ; ; ** alternate (smaller) 4bit font capability: ; ** use the -DPACKEDFONT flag ; ** ROM font -DROMFONT ; ; set it up with: ; .text_cols = max columns ; .text_rows = max rows ; .DOTS+1 = char size ; .font = font file ; ; Display a char in location (ansi_ROW),(ansi_COLUMN) ; A=char to display ; ; ; $Id: f_ansi_char.asm,v 1.7 2005/03/16 11:57:05 stefano Exp $ ; XLIB ansi_CHAR XREF ansi_ROW XREF ansi_COLUMN XDEF text_cols XDEF text_rows ; Dirty thing for self modifying code XDEF INVRS IF A128COL .text_cols defb 128 ENDIF IF A80COL .text_cols defb 80 ENDIF IF A85COL .text_cols defb 85 ENDIF IF A64COL .text_cols defb 64 ENDIF IF A51COL .text_cols defb 51 ENDIF IF A42COL .text_cols defb 42 ENDIF IF A40COL .text_cols defb 40 ENDIF IF A36COL .text_cols defb 36 ENDIF IF A32COL .text_cols defb 32 ENDIF IF A28COL .text_cols defb 28 ENDIF IF A24COL .text_cols defb 24 ENDIF .text_rows defb 24 .ansi_CHAR ld (char+1),a ld a,(ansi_ROW) ; Line text position push af and 24 ld d,a pop af and 7 rrca rrca rrca ld e,a ld hl,16384 add hl,de ld (RIGA+1),hl ; xor a ld hl,DOTS+1 ld b,(hl) ld hl,0 ld a,(ansi_COLUMN) ; Column text position ld e,a ld d,0 or d jr z,ZCL .LP add hl,de djnz LP ld b,3 .LDIV srl h rr l rra djnz LDIV ; Added for color handling push hl push af ld de,22528-32 add hl,de ld a,(ansi_ROW) inc a ld de,32 .CLP add hl,de dec a jr nz,CLP ld a,(23693) ;Current color attributes ld (hl),a pop af pop hl ; end of color handling ld b,5 .RGTA srl a djnz RGTA .ZCL ld (PRE+1),a ld e,a ld a,(DOTS+1) add a,e ld e,a ld a,16 sub e .NOC ld (POST+1),a .RIGA ; Location on screen ld de,16384 add hl,de push hl pop ix .char ld b,'A' ; Put here the character to be printed IF ROMFONT ld hl,15360 ELSE IF PACKEDFONT xor a rr b jr c,even ld a,4 .even ld (ROLL+1),a ld hl,font-128 ELSE ld hl,font-256 ENDIF ENDIF ld de,8 .LFONT add hl,de djnz LFONT ld de,256 ld c,8 .PRE ld b,4 rl (ix+1) rl (ix+0) inc b dec b jr z,DTS .L1 rl (ix+1) rl (ix+0) djnz L1 .DTS ld a,(hl) IF ROMFONT ; nothing here ! ELSE IF PACKEDFONT .ROLL jr INVRS rla rla rla rla ENDIF ENDIF .INVRS ; cpl ; Set to NOP to disable INVERSE nop ; Underlined text handling dec c ; jr nz,UNDRL ; Set to JR UNDRL to disable underlined text (loc. INVRS+2) jr UNDRL ld a,255 .UNDRL inc c ; end of underlined text handling .DOTS IF A128COL ld b,2 ENDIF IF A80COL ld b,3 ENDIF IF A85COL ld b,3 ENDIF IF A64COL ld b,4 ENDIF IF A51COL ld b,5 ENDIF IF A42COL ld b,6 ENDIF IF A40COL ld b,6 ENDIF IF A36COL ld b,7 ENDIF IF A32COL ld b,8 ENDIF IF A28COL ld b,8 ENDIF IF A24COL ld b,9 ENDIF .L2 rla rl (ix+1) rl (ix+0) djnz L2 .POST ld b,6 inc b dec b jr z,NEXT .L3 rl (ix+1) rl (ix+0) djnz L3 .NEXT add ix,de inc hl dec c jr nz,PRE ret ; The font ; 9 dots: MAX 28 columns ; 8 dots: MAX 32 columns The only one perfecly color aligned ; 7 dots: MAX 36 columns ; 6 dots: MAX 42 columns Good matching with color attributes ; 5 dots: MAX 51 columns ; 4 dots: MAX 64 columns Matched with color attributes (2 by 2) ; 3 dots: MAX 85 columns Just readable! ; 2 dots: MAX 128 columns (useful for ANSI graphics only.. maybe) ; Address 15360 for ROM Font .font IF ROMFONT ; nothing here ! ELSE IF PACKEDFONT BINARY "stdio/ansi/F4PACK.BIN" ELSE IF A128COL BINARY "stdio/ansi/F3.BIN" ENDIF IF A80COL BINARY "stdio/ansi/F4.BIN" ENDIF IF A85COL BINARY "stdio/ansi/F4.BIN" ENDIF IF A64COL BINARY "stdio/ansi/F4.BIN" ENDIF IF A51COL BINARY "stdio/ansi/F5.BIN" ENDIF IF A42COL BINARY "stdio/ansi/F6.BIN" ENDIF IF A40COL BINARY "stdio/ansi/F6.BIN" ENDIF IF A36COL BINARY "stdio/ansi/F8.BIN" ENDIF IF A32COL BINARY "stdio/ansi/F8.BIN" ENDIF IF A28COL BINARY "stdio/ansi/F8.BIN" ENDIF IF A24COL BINARY "stdio/ansi/F8.BIN" ENDIF ENDIF ENDIF z88dk-1.8.ds1/libsrc/stdio/ansi/spectrum/f_ansi_cls.asm0000644000175000017500000000076707632074504022523 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; CLS - Clear the screen ; ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: f_ansi_cls.asm,v 1.3 2003/03/07 10:49:40 dom Exp $ ; XLIB ansi_cls .ansi_cls ld hl,16384 ld de,16385 ld (hl),0 ld bc,6143 ldir ; clear attributes ld a,(23693) ld hl,22528 ld (hl),a ld de,22529 ld bc,767 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/spectrum/f_ansi_dline.asm0000644000175000017500000000136707265604647023043 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; Clean a text line ; ; Stefano Bodrato - Apr. 2000 ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_del_line .ansi_del_line push af and 24 ld d,a pop af push af and 7 rrca rrca rrca ld e,a ld hl,16384 add hl,de ;Line address in HL ld d,h ld e,l inc de ld b,8 .loop_dl push bc push hl push de ld (hl),0 ld bc,31 ldir pop de pop hl inc d inc h pop bc djnz loop_dl pop af ld d,0 ld e,a rr e rr d rr e rr d rr e rr d ld hl,22528 add hl,de ld d,h ld e,l inc de ld a,(23693) ; Use the default attributes ld (hl),a ld bc,31 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/spectrum/f_ansi_scrollup.asm0000644000175000017500000000050607265604647023605 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; Handles colors referring to current PAPER/INK/etc. settings ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_SCROLLUP .ansi_SCROLLUP ld a,(23693) ld (23624),a call 3582 ;scrollup ret z88dk-1.8.ds1/libsrc/stdio/ansi/sprinter/0000755000175000017500000000000010765202715017711 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/sprinter/f_ansi_attr.asm0000644000175000017500000000327007551374456022721 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; Text Attributes ; m - Set Graphic Rendition ; ; The most difficult thing to port: ; Be careful here... ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: f_ansi_attr.asm,v 1.2 2002/10/10 22:03:26 dom Exp $ ; XLIB ansi_attr XDEF text_attr ; 0 = reset all attributes ; 1 = bold on ; 2 = dim ; 4 = underline ; 5 = blink on ; 7 = reverse on ; 8 = invisible (dim again?) ; 8 = tim off ; 24 = underline off ; 25 = blink off ; 27 = reverse off ; 28 = invisible off ; 30 - 37 = foreground colour ; 40 - 47 = background colour .ansi_attr and a jr nz,noreset ld a,15 ld (text_attr),a ret .noreset cp 2 jr z,dim cp 8 jr nz,nodim .dim ld a,(text_attr) and @01110111 ld (text_attr),a ret .nodim cp 5 jr nz,noblinkon ld hl,text_attr set 7,(hl) inc hl set 7,(hl) ret .noblinkon cp 25 jr nz,noblinkoff ld hl,text_attr res 7,(hl) inc hl res 7,(hl) ret .noblinkoff cp 7 jr z,switchreverse cp 27 jr nz,noreverse .switchreverse ld hl,text_attr ld e,(hl) inc hl ld d,(hl) ld (hl),e dec hl ld (hl),d ret .noreverse cp 30 ret m cp 37+1 jp p,background sub 30 ld e,a ld a,(text_attr) and @11111000 or e ld (text_attr),a jr calcinverse .background cp 40 ret m cp 47+1 ret p sub 40 ld d,a rlca rlca rlca rlca and @01110000 ld e,a ld a,(text_attr) and @10001111 or e ld (text_attr),a .calcinverse ld e,a rlca rlca rlca rlca and @01110000 ;ink goes to paper ld d,a ld a,e rrca rrca rrca rrca and @00000111 or d ld d,a ;d holds paper and ink ld a,e and @10001000 or d ld (inverse_attr),a ret .text_attr defb @00001111 ;bright white on black .inverse_attr defb @01111000 ;grey on white z88dk-1.8.ds1/libsrc/stdio/ansi/sprinter/f_ansi_bel.asm0000644000175000017500000000035207551362476022506 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; BEL - chr(7) Beep it out ; ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: f_ansi_bel.asm,v 1.1 2002/10/10 20:38:22 dom Exp $ ; XLIB ansi_BEL .ansi_BEL ret z88dk-1.8.ds1/libsrc/stdio/ansi/sprinter/f_ansi_char.asm0000644000175000017500000000073407551362476022665 0ustar tygrystygrys; ; Sprinter C Library ; ; ANSI Video handling for Sprinter ; ; $Id: f_ansi_char.asm,v 1.1 2002/10/10 20:38:22 dom Exp $ ; XLIB ansi_CHAR XREF ansi_ROW XREF ansi_COLUMN XDEF text_cols XDEF text_rows XREF text_attr .text_rows defb 32 .text_cols defb 80 ; a = character to print - need to handle attributes .ansi_CHAR ex af,af ld a,(ansi_ROW) ld d,a ld a,(ansi_COLUMN) ld e,a ld a,(text_attr) ld b,a ex af,af ld c,$58 ;PUTCHAR rst $10 ret z88dk-1.8.ds1/libsrc/stdio/ansi/sprinter/f_ansi_cls.asm0000644000175000017500000000057407551374456022534 0ustar tygrystygrys; ; Sprinter C Library ; ; ANSI Video handling for Sprinter ; ; CLS - Clear the screen ; ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: f_ansi_cls.asm,v 1.2 2002/10/10 22:03:26 dom Exp $ ; XLIB ansi_cls .ansi_cls ld d,0 ;top left x ld e,0 ;top left y ld h,32 ;height ld l,80 ;depth xor a ;fill character ld b,7 ;clear colour? ld c,$57 ;CLEAR rst $10 ret z88dk-1.8.ds1/libsrc/stdio/ansi/sprinter/f_ansi_dline.asm0000644000175000017500000000061407551374456023041 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; Clean a text line ; ; Stefano Bodrato - Apr. 2000 ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.2 2002/10/10 22:03:26 dom Exp $ ; XLIB ansi_del_line ; a = line .ansi_del_line ld d,a ;y cooard ld e,0 ;x coord ld h,1 ;height ld l,80 ;width ld b,7 ;colour ld a,0 ld c,$56 ;CLEAR rst $10 ret z88dk-1.8.ds1/libsrc/stdio/ansi/sprinter/f_ansi_scrollup.asm0000644000175000017500000000054207551362476023610 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; Handles colors referring to current PAPER/INK/etc. settings ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.1 2002/10/10 20:38:22 dom Exp $ ; XLIB ansi_SCROLLUP .ansi_SCROLLUP ld de,0 ;top xy ld h,32 ld l,80 ld b,1 xor a ;clear line ld c,$55 ;SCROLL rst $10 ret z88dk-1.8.ds1/libsrc/stdio/ansi/ticalc/0000755000175000017500000000000010765202715017302 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/ticalc/f_ansi_attr.asm0000644000175000017500000000260307457364562022313 0ustar tygrystygrys; ; ANSI Video handling for the TI calculators ; By Stefano Bodrato - Dec. 2000 ; ; Text Attributes ; m - Set Graphic Rendition ; ; The most difficult thing to port: ; Be careful here... ; ; ; $Id: f_ansi_attr.asm,v 1.3 2002/04/17 21:30:26 dom Exp $ ; XLIB ansi_attr XREF INVRS .ansi_attr ; and a ; jr nz,noreset ; ret ;.noreset ; cp 1 ; jr nz,nobold ; ret ;.nobold ; cp 2 ; jr z,dim ; cp 8 ; jr nz,nodim .dim ; ret ;.nodim cp 4 jr nz,nounderline ld a,32 ld (INVRS+2),a ; underline 1 ret .nounderline cp 24 jr nz,noCunderline ld a, 24 ld (INVRS+2),a ; underline 0 ret .noCunderline cp 5 jr nz,noblink ld a,32 ld (INVRS+2),a ; underline (blink emulation) 1 ret .noblink cp 25 jr nz,nocblink ld a, 24 ld (INVRS+2),a ; underline (blink emulation) 0 ret .nocblink cp 7 jr nz,noreverse ld a,47 ld (INVRS),a ; inverse 1 ret .noreverse cp 27 jr nz,noCreverse xor a ld (INVRS),a ; inverse 0 ret .noCreverse ret z88dk-1.8.ds1/libsrc/stdio/ansi/ticalc/f_ansi_bel.asm0000644000175000017500000000033207457364562022100 0ustar tygrystygrys; ; ANSI Video handling for the TI calculators ; By Stefano Bodrato - Dec. 2000 ; ; BEL - chr(7) Beep it out ; ; ; $Id: f_ansi_bel.asm,v 1.3 2002/04/17 21:30:26 dom Exp $ ; XLIB ansi_BEL .ansi_BEL ret z88dk-1.8.ds1/libsrc/stdio/ansi/ticalc/f_ansi_char.asm0000644000175000017500000000543707457364562022266 0ustar tygrystygrys; ; ANSI Video handling for the TI calculators ; By Stefano Bodrato - Dec. 2000 ; ; Handles Attributes INVERSE + UNDERLINED ; ; ** alternate (smaller) 4bit font capability: ; ** use the -DPACKEDFONT flag ; ; set it up with: ; .text_cols = max columns ; .text_rows = max rows ; .DOTS+1 = char size ; .font = font file ; ; Display a char in location (ansi_ROW),(ansi_COLUMN) ; A=char to display ; ; ; $Id: f_ansi_char.asm,v 1.6 2002/04/17 21:30:26 dom Exp $ ; INCLUDE "stdio/ansi/ticalc/ticalc.inc" XLIB ansi_CHAR XREF ansi_ROW XREF ansi_COLUMN XREF base_graphics XREF cpygraph XDEF text_cols XDEF text_rows ; Dirty thing for self modifying code XDEF INVRS .text_cols defb columns .text_rows defb 8 .ansi_CHAR ld (char+1),a ld hl,(base_graphics) ld a,(ansi_ROW) and a jr z,ZROW add a,a add a,a add a,a ld b,a ; b=a*8 (8 is the font height) ld de,row_bytes .Rloop add hl,de djnz Rloop .ZROW ld (RIGA+1),hl ; RIGA+1=ROW Location ld hl,DOTS+1 ld b,(hl) ; b=DOTS ld hl,0 ld a,(ansi_COLUMN) ; Column text position ld e,a ld d,0 or d jr z,ZCL .LP add hl,de djnz LP ld b,3 .LDIV srl h rr l rra djnz LDIV ld b,5 .RGTA srl a djnz RGTA .ZCL ld (PRE+1),a ld e,a ld a,(DOTS+1) add a,e ld e,a ld a,16 sub e .NOC ld (POST+1),a .RIGA ld de,0 ; ROW Location on screen add hl,de push hl pop ix .char ld b,'A' ; Put here the character to be printed IF PACKEDFONT xor a rr b jr c,even ld a,4 .even ld (ROLL+1),a ld hl,font-128 ELSE ld hl,font ENDIF ld de,8 .LFONT add hl,de djnz LFONT ld de,row_bytes ; ROW Lenght (in bytes) ld c,8 .PRE ld b,4 rl (ix+1) rl (ix+0) inc b dec b jr z,DTS .L1 rl (ix+1) rl (ix+0) djnz L1 .DTS ld a,(hl) IF PACKEDFONT .ROLL jr INVRS rla rla rla rla ENDIF ; --- --- Inverse text handling .INVRS ; cpl ; Set to NOP to disable INVERSE nop ; --- --- ; --- --- Underlined text handling dec c ; jr nz,UNDRL ; Set to JR UNDRL to disable underlined text (loc. INVRS+2) jr UNDRL ld a,255 .UNDRL inc c ; --- --- end of underlined text handling .DOTS ld b,char_dots ; character FONT width in pixel .L2 rla rl (ix+1) rl (ix+0) djnz L2 .POST ld b,6 inc b dec b jr z,NEXT .L3 rl (ix+1) rl (ix+0) djnz L3 .NEXT add ix,de inc hl dec c jr nz,PRE jp cpygraph ; Copy GRAPH_MEM to LCD, then return ; The font ; To keep the same text metrics on both calc ; families I suggest 32 or 24 columns. ; Here we go with 32... ; TI 82-83 ; 6 dots: MAX 16 columns ; 5 dots: MAX 19 columns ; 4 dots: MAX 24 columns ; 3 dots: MAX 32 columns ; TI 85-86 ; 6 dots: MAX 21 columns ; 5 dots: MAX 25 columns ; 4 dots: MAX 32 columns ; 3 dots: MAX 42 columns .font BINARY "stdio/ansi/F4PACK.BIN" z88dk-1.8.ds1/libsrc/stdio/ansi/ticalc/f_ansi_cls.asm0000644000175000017500000000063607457364562022126 0ustar tygrystygrys; ; ANSI Video handling for the TI calculators ; By Stefano Bodrato - Dec. 2000 ; ; CLS - Clear the screen ; ; ; $Id: f_ansi_cls.asm,v 1.4 2002/04/17 21:30:26 dom Exp $ ; INCLUDE "stdio/ansi/ticalc/ticalc.inc" XLIB ansi_cls XREF base_graphics XREF cpygraph .ansi_cls ld hl,(base_graphics) ld (hl),0 ld d,h ld e,l inc de ld bc,row_bytes*64 ldir jp cpygraph ; Copy GRAPH_MEM to LCD, then return z88dk-1.8.ds1/libsrc/stdio/ansi/ticalc/f_ansi_dline.asm0000644000175000017500000000102307457364562022427 0ustar tygrystygrys; ; ANSI Video handling for the TI calculators ; By Stefano Bodrato - Dec. 2000 ; ; Clean a text line ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.4 2002/04/17 21:30:26 dom Exp $ ; INCLUDE "stdio/ansi/ticalc/ticalc.inc" XLIB ansi_del_line XREF base_graphics XREF cpygraph .ansi_del_line ld de,row_bytes*8 ld b,a ld hl,(base_graphics) and a jr z,zline .lloop add hl,de djnz lloop .zline ld d,h ld e,l inc de ld (hl),0 ld bc,row_bytes*8 ldir jp cpygraph ; Copy GRAPH_MEM to LCD, then return z88dk-1.8.ds1/libsrc/stdio/ansi/ticalc/f_ansi_scrollup.asm0000644000175000017500000000235207457364562023205 0ustar tygrystygrys; ; ANSI Video handling for the TI calculators ; By Stefano Bodrato - Dec. 2000 ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.5 2002/04/17 21:30:26 dom Exp $ ; INCLUDE "stdio/ansi/ticalc/ticalc.inc" XLIB ansi_SCROLLUP XREF base_graphics XREF TIdi XREF TIei LIB ansi_del_line LIB fgetc_cons .ansi_SCROLLUP ; These are called before scrolling: we wait for any keypress. ; We don't use getkey when possible. call TIei IF FORti82 .kloop ld hl,$8004 bit 2,(hl) jr z,kloop ENDIF IF FORti83 ; Thanks to Red Picasso (Brandon Whaley) for his dirinput.inc ; We use getkey to wait for a key .kloop ld hl,krowptr .kloop1 ld a,$ff ; Reset the keyport (kinda) out (1),a ld a,(hl) and a jr z,kloop out (1),a in a,(1) cp 255 jr nz,kok inc hl jr kloop1 .krowptr defb $fe defb $fd defb $fb defb $f7 defb $ef defb $df defb $bf defb 0 .kok ENDIF IF FORti83p .kloop ld a,($843F) ; Keyboard ScanCODE address and a jr z,kloop ENDIF IF FORti85 .kloop ld a,($8001) and a jr z,kloop ENDIF IF FORti86 ; We use getkey to wait for a key .kloop call getkey and a jr z,kloop ENDIF call TIdi ld hl,8*row_bytes ld de,(base_graphics) add hl,de ld bc,row_bytes*8*7 ldir ld a,7 jp ansi_del_line z88dk-1.8.ds1/libsrc/stdio/ansi/ticalc/ticalc.inc0000644000175000017500000000316307457364562021254 0ustar tygrystygrys; ; TI calc defines ; used by VT 100/ANSI code ; ; Define for char size and number of columns ; + specific display metrics ; ; ; $Id: ticalc.inc,v 1.7 2002/04/17 21:30:26 dom Exp $ ; defc columns = 32 IF FORti82 defc row_bytes = 12 defc char_dots = 3 defc TIALPHAKEY = $30 ; Not used ! CrASH does the job. ;ROM key handler ;defc getkey = $01D4 ;CRASH key handler defc getkey = $8D91 defc ti_putchar = $39D2 defc ti_scroll = $377A defc ti_x_text = $800D defc ti_y_text = $800C defc ti_maxx_t = 15 defc ti_maxy_t = 7 ENDIF IF FORti83 defc row_bytes = 12 defc char_dots = 3 defc TIALPHAKEY = $30 defc getkey = $4CFE defc ti_putchar = $4705 defc ti_scroll = $473D defc ti_x_text = $800D defc ti_y_text = $800C defc ti_maxx_t = 15 defc ti_maxy_t = 7 ENDIF IF FORti83p defc row_bytes = 12 defc char_dots = 3 defc TIALPHAKEY = $30 ; To be checked defc getkey = $4972 defc ti_putchar = $4504 defc ti_scroll = $452E defc ti_x_text = $800D defc ti_y_text = $800C defc ti_maxx_t = 15 defc ti_maxy_t = 7 ENDIF ; TI 85 and TI 86 can go up to 42 columns if char_dots is set to 3 IF FORti85 defc row_bytes = 16 defc char_dots = 4 defc TIALPHAKEY = $30 defc getkey = $01BE ;defc getkey = $0168 defc ti_putchar = 0 defc ti_scroll = 6 defc ti_x_text = $800D defc ti_y_text = $800C defc ti_maxx_t = 20 defc ti_maxy_t = 7 ENDIF IF FORti86 defc row_bytes = 16 defc char_dots = 4 defc TIALPHAKEY = $30 ;;?? To be checked. defc getkey = $55AA defc ti_putchar = $4A2B defc ti_scroll = $4A5F defc ti_x_text = $C010 defc ti_y_text = $C00F defc ti_maxx_t = 20 defc ti_maxy_t = 7 ENDIF z88dk-1.8.ds1/libsrc/stdio/ansi/ts2068/0000755000175000017500000000000010765202715017011 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/ts2068/f_ansi_scrollup.asm0000755000175000017500000000034510600320740022665 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; TS2068 port ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.1 2007/03/21 21:21:36 stefano Exp $ ; XLIB ansi_SCROLLUP .ansi_SCROLLUP jp $939 ;scrollup z88dk-1.8.ds1/libsrc/stdio/ansi/vz200/0000755000175000017500000000000010765202715016724 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/vz200/f_ansi_attr.asm0000644000175000017500000000215307265604647021733 0ustar tygrystygrys; ; ANSI Video handling for the VZ200 ; ; Text Attributes ; m - Set Graphic Rendition ; ; The most difficult thing to port: ; Be careful here... ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: f_ansi_attr.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_attr XDEF vz_inverse .vz_inverse defb 0 .ansi_attr and a jr nz,noreset ld (vz_inverse),a ret .noreset cp 1 jr nz,nobold ld a,@01000000 ld (vz_inverse),a ret .nobold cp 2 jr z,dim cp 8 jr nz,nodim .dim xor a ld (vz_inverse),a ret .nodim cp 5 jr nz,noblink ld a,@01000000 ld (vz_inverse),a ret .noblink cp 25 jr nz,nocblink xor a ld (vz_inverse),a ret .nocblink cp 7 jr nz,noreverse ld a,@01000000 ld (vz_inverse),a ret .noreverse cp 27 jr nz,noCreverse xor a ld (vz_inverse),a ret .noCreverse ret z88dk-1.8.ds1/libsrc/stdio/ansi/vz200/f_ansi_bel.asm0000644000175000017500000000034207265604647021521 0ustar tygrystygrys; ; ANSI Video handling for the VZ200 ; ; BEL - chr(7) Beep it out ; ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: f_ansi_bel.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_BEL .ansi_BEL call 13392 ret z88dk-1.8.ds1/libsrc/stdio/ansi/vz200/f_ansi_char.asm0000644000175000017500000000153107265604647021675 0ustar tygrystygrys; ; ANSI Video handling for the VZ200 ; ; set it up with: ; .text_cols = max columns ; .text_rows = max rows ; ; Display a char in location (ansi_ROW),(ansi_COLUMN) ; A=char to display ; ; ; $Id: f_ansi_char.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_CHAR XDEF text_cols XDEF text_rows XREF ansi_ROW XREF ansi_COLUMN XREF vz_inverse .text_cols defb 32 .text_rows defb 16 .ansi_CHAR ; 193 Inverse characters starting from "@". ; 64 "@" char (as normal). ; 127-192 Pseudo-Graphics Chars (like ZX81) ; Some undercase text? Transform in UPPER ! cp 97 jr c,isupper sub 32 .isupper and @00111111 ld hl,vz_inverse or (hl) .setout push af ld hl,$7000 ld a,(ansi_ROW) and a jr z,r_zero ld b,a ld de,32 .r_loop add hl,de djnz r_loop .r_zero ld a,(ansi_COLUMN) ld d,0 ld e,a add hl,de pop af ld (hl),a ret z88dk-1.8.ds1/libsrc/stdio/ansi/vz200/f_ansi_cls.asm0000644000175000017500000000054707736254620021542 0ustar tygrystygrys; ; ANSI Video handling for the VZ200 ; ; CLS - Clear the screen ; ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: f_ansi_cls.asm,v 1.3 2003/09/30 10:23:12 stefano Exp $ ; XLIB ansi_cls .ansi_cls ld a,0 ld (6800h),a ; force TEXT mode ld hl,$7000 ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,511 ldir ;;; ;;; The ROM cls call: ;;; call 457 ;;; ret z88dk-1.8.ds1/libsrc/stdio/ansi/vz200/f_ansi_dline.asm0000644000175000017500000000056207265604647022056 0ustar tygrystygrys; ; ; ANSI Video handling for the VZ200 ; ; ; Clean a text line ; ; Stefano Bodrato - Apr. 2000 ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_del_line .ansi_del_line ret ld hl,$7000 .sum_loop ld de,32 add hl,de dec a jr nz,sum_loop ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,31 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/vz200/f_ansi_scrollup.asm0000644000175000017500000000053707265604647022630 0ustar tygrystygrys; ; ANSI Video handling for the VZ200 ; ; Handles colors referring to current PAPER/INK/etc. settings ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_SCROLLUP .ansi_SCROLLUP ld hl,$7020 ld de,$7000 ld bc,480 ldir ld hl,$7000+480 ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,31 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/z88/0000755000175000017500000000000010765202715016474 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/z88/f_ansi_attr.asm0000644000175000017500000000534307273750657021511 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for z88 ; ; Text Attributes ; m - Set Graphic Rendition ; ; The most difficult thing to port: ; Be careful here... ; ; djm 6/6/2000 ; ; ; $Id: f_ansi_attr.asm,v 1.3 2001/05/02 09:21:51 dom Exp $ ; XLIB ansi_attr XREF invrs INCLUDE "#stdio.def" .ansi_attr and a jr nz,noreset ld a,1 call_oz(os_out) ld a,127 call_oz(os_out) ret .noreset cp 1 jr nz,nobold ld hl,boldtxt call_oz(gn_sop) ret .boldtxt defb 1,'2','+','B',0 .nobold cp 2 jr z,dim cp 8 jr nz,nodim .dim ld hl,dimtxt call_oz(gn_sop) ret .dimtxt defb 1,'2','-','B',0 .nodim cp 4 jr nz,nounderline ld hl,undertxt call_oz(gn_sop) ret .undertxt defb 1,'2','+','U',0 .nounderline cp 24 jr nz,noCunderline ld hl,noundertxt call_oz(gn_sop) ret .noundertxt defb 1,'2','-','U',0 .noCunderline cp 5 jr nz,noblink ld hl,blinktxt call_oz(gn_sop) ret .blinktxt defb 1,'2','+','F',0 .noblink cp 25 jr nz,nocblink ld hl,noblinktxt call_oz(gn_sop) ret .noblinktxt defb 1,'2','-','F',0 .nocblink cp 7 jr nz,noreverse ld hl,invstxt call_oz(gn_sop) ret ; ld (INVRS),a ; inverse 1 .invstxt defb 1,'2','+','R',0 .noreverse cp 27 jr nz,noCreverse ld hl,noinvstxt call_oz(gn_sop) ret .noinvstxt defb 1,'2','-','R',0 .noCreverse cp 8 jr nz,noinvis ; Pass, make the text invisible..(tiny) ld hl,tinytext call_oz(gn_sop) ret .tinytext defb 1,'3','+','G','T',0 .noinvis cp 28 jr nz,nocinvis ; Pass, make text visible again ld hl,notinytxt call_oz(gn_sop) ret .notinytxt defb 1,'3','-','G','T',0 .nocinvis ret IF colours cp 30 jp m,nofore cp 37+1 jp p,nofore sub 30 ;'' Palette Handling '' rla bit 3,a jr z,ZFR set 0,a and 7 .ZFR ;'''''''''''''''''''''' ld e,a ld a,(23693) and @11111000 or e ld (23693),a ret .nofore cp 40 jp m,noback cp 47+1 jp p,noback sub 40 ;'' Palette Handling '' rla bit 3,a jr z,ZBK set 0,a and 7 .ZBK ;'''''''''''''''''''''' rla rla rla ld e,a ld a,(23693) and @11000111 or e ld (23693),a .noback ret ENDIF z88dk-1.8.ds1/libsrc/stdio/ansi/z88/f_ansi_bel.asm0000644000175000017500000000030707265604647021272 0ustar tygrystygrys; ; Bell for the ANSI terminal ; ; djm 6/6/2000 ; ; ; $Id: f_ansi_bel.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_BEL INCLUDE "#stdio.def" .ansi_BEL ld a,7 call_oz(os_out) ret z88dk-1.8.ds1/libsrc/stdio/ansi/z88/f_ansi_char.asm0000644000175000017500000000110007273750657021437 0ustar tygrystygrys; ; Print a character at ansi_ROW, ansi_COLUMNUMN ; Enter with char in a ; ; djm 6/6/2000 ; ; This ain't pretty..we do far too many calls to oz for my liking.. ; ; ; $Id: f_ansi_char.asm,v 1.3 2001/05/02 09:21:51 dom Exp $ ; XLIB ansi_char INCLUDE "#stdio.def" XREF ansi_ROW XREF ansi_COLUMN XDEF text_rows XDEF text_cols .text_rows defb 8 .text_cols defb 80 .ansi_char push af ld hl,start call_oz(gn_sop) ld a,(ansi_COLUMN) add a,32 call_oz(os_out) ld a,(ansi_ROW) add a,32 call_oz(os_out) pop af call_oz(os_out) ret .start defb 1,'3','@',0 z88dk-1.8.ds1/libsrc/stdio/ansi/z88/f_ansi_cls.asm0000644000175000017500000000045607265604647021316 0ustar tygrystygrys; ; f_ansi_cls ; ; Clear the screen ; ; djm 6/6/2000 ; ; ; $Id: f_ansi_cls.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_CLS INCLUDE "#stdio.def" .ansi_CLS ld a,$0c call_oz(os_out) ret IF Blah ld hl,clstxt call_oz(gn_sop) ret .clstxt defb 1,'3','@',32,32,1,'2','C',254,0 ENDIF z88dk-1.8.ds1/libsrc/stdio/ansi/z88/f_ansi_dline.asm0000644000175000017500000000057607273750657021635 0ustar tygrystygrys; ; f_ansi_dline - clear line ; ; djm 6/6/2000 ; ; Entry: a = row ; ; ; $Id: f_ansi_dline.asm,v 1.3 2001/05/02 09:21:51 dom Exp $ ; INCLUDE "#stdio.def" XLIB ansi_del_line .ansi_del_line push af ld a,1 call_oz(os_out) ld a,'3' call_oz(os_out) ld a,'@' call_oz(os_out) pop af add a,32 call_oz(os_out) ld hl,rest call_oz(gn_sop) ret .rest defb 32,1,'2','C',253,0 z88dk-1.8.ds1/libsrc/stdio/ansi/z88/f_ansi_scrollup.asm0000644000175000017500000000043007273750657022372 0ustar tygrystygrys; ; f_ansi_scrollup ; ; Scroll screen up one line ; ; We set the window to none-scrolling.. ; ; ; $Id: f_ansi_scrollup.asm,v 1.3 2001/05/02 09:21:51 dom Exp $ ; XLIB ansi_SCROLLUP INCLUDE "#stdio.def" .ansi_SCROLLUP ld a,1 call_oz(os_out) ld a,255 call_oz(os_out) ret z88dk-1.8.ds1/libsrc/stdio/ansi/z88/README0000644000175000017500000000011207265604647017361 0ustar tygrystygrys($Id: README,v 1.2 2001/04/13 14:13:59 stefano Exp $) Not yet complete! z88dk-1.8.ds1/libsrc/stdio/ansi/zx81/0000755000175000017500000000000010765202715016655 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ansi/zx81/f_ansi_attr.asm0000644000175000017500000000323710701741657021660 0ustar tygrystygrys; ; ANSI Video handling for the ZX81 ; By Stefano Bodrato - Sep. 2007 ; ; Text Attributes ; m - Set Graphic Rendition ; ; The most difficult thing to port: ; Be careful here... ; ; ; $Id: f_ansi_attr.asm,v 1.4 2007/10/06 17:19:43 stefano Exp $ ; XLIB ansi_attr XREF INVRS XREF BOLD .ansi_attr and a jr nz,noreset ld (BOLD),a ld (BOLD+1),a xor a ld (INVRS),a ; inverse 0 ld a, 24 ld (INVRS+2),a ; underline 0 ret .noreset cp 1 jr nz,nobold ld a,23 ld (BOLD),a ld a,182 ld (BOLD+1),a ret .nobold cp 2 jr z,dim cp 8 jr nz,nodim .dim xor a ld (BOLD),a ld (BOLD+1),a ret .nodim cp 4 jr nz,nounderline ld a,32 ld (INVRS+2),a ; underline 1 ret .nounderline cp 24 jr nz,noCunderline ld a, 24 ld (INVRS+2),a ; underline 0 ret .noCunderline cp 5 jr nz,noblink ld a,32 ld (INVRS+2),a ; underline (blink emulation) 1 ret .noblink cp 25 jr nz,nocblink ld a, 24 ld (INVRS+2),a ; underline (blink emulation) 0 ret .nocblink cp 7 jr nz,noreverse ld a,47 ld (INVRS),a ; inverse 1 ret .noreverse cp 27 jr nz,noCreverse xor a ld (INVRS),a ; inverse 0 ret .noCreverse ret z88dk-1.8.ds1/libsrc/stdio/ansi/zx81/f_ansi_bel.asm0000644000175000017500000000036307265604647021455 0ustar tygrystygrys; ; ANSI Video handling for the ZX81 ; By Stefano Bodrato - Apr. 2000 ; ; BEL - chr(7) Beep it out ; ; ; $Id: f_ansi_bel.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB ansi_BEL .ansi_BEL ;No sound support on the ZX81 ret z88dk-1.8.ds1/libsrc/stdio/ansi/zx81/f_ansi_char.asm0000644000175000017500000001023010707307314021604 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX Spectrum ; ; Handles colors referring to current PAPER/INK/etc. settings ; ; ** alternate (smaller) 4bit font capability: ; ** use the -DPACKEDFONT flag ; ** ROM font -DROMFONT ; ; set it up with: ; .text_cols = max columns ; .text_rows = max rows ; .DOTS+1 = char size ; .font = font file ; ; Display a char in location (ansi_ROW),(ansi_COLUMN) ; A=char to display ; ; ; $Id: f_ansi_char.asm,v 1.6 2007/10/23 06:03:56 stefano Exp $ ; XLIB ansi_CHAR IF ROMFONT LIB asctozx81 ENDIF XREF base_graphics XREF ansi_ROW XREF ansi_COLUMN XDEF text_cols ;XDEF text_rows ; Dirty thing for self modifying code XDEF INVRS XDEF BOLD IF A128COL .text_cols defb 128 ENDIF IF A80COL .text_cols defb 80 ENDIF IF A85COL .text_cols defb 85 ENDIF IF A64COL .text_cols defb 64 ENDIF IF A51COL .text_cols defb 51 ENDIF IF A42COL .text_cols defb 42 ENDIF IF A40COL .text_cols defb 40 ENDIF IF A36COL .text_cols defb 36 ENDIF IF A32COL .text_cols defb 32 ENDIF IF A28COL .text_cols defb 28 ENDIF IF A24COL .text_cols defb 24 ENDIF ;text_rows defb 24 .ansi_CHAR ; --- TO USE ROM FONT WE NEED TO MAP TO THE ASCII CODES --- IF ROMFONT ld hl,char+1 ld (hl),a call asctozx81 ENDIF ; --- END OF ROM FONT ADAPTER --- ld (char+1),a ld a,(ansi_ROW) ; Line text position ld d,a ld e,0 ;push af ;and 24 ;ld d,a ;pop af ;and 7 ;rrca ;rrca ;rrca ;ld e,a ld hl,(base_graphics) add hl,de ld (RIGA+1),hl ; xor a ld hl,DOTS+1 ld b,(hl) ld hl,0 ld a,(ansi_COLUMN) ; Column text position ld e,a ld d,0 or d jr z,ZCL .LP add hl,de djnz LP ld b,3 .LDIV srl h rr l rra djnz LDIV ld b,5 .RGTA srl a djnz RGTA .ZCL ld (PRE+1),a ld e,a ld a,(DOTS+1) add a,e ld e,a ld a,16 sub e .NOC ld (POST+1),a .RIGA ; Location on screen ld de,16384 add hl,de push hl pop ix .char ld b,'A' ; Put here the character to be printed IF ROMFONT ld hl,$1e00 xor a add b jr z,NOLFONT ELSE IF PACKEDFONT xor a rr b jr c,even ld a,4 .even ld (ROLL+1),a ld hl,font-128 ELSE ld hl,font-256 ENDIF ENDIF ld de,8 .LFONT add hl,de djnz LFONT .NOLFONT ld de,32 ; next row ld c,8 .PRE ld b,4 rl (ix+1) rl (ix+0) inc b dec b jr z,DTS .L1 rl (ix+1) rl (ix+0) djnz L1 .DTS ld a,(hl) .BOLD nop ; rla nop ; or (hl) IF ROMFONT ; nothing here ! ELSE IF PACKEDFONT .ROLL jr INVRS rla rla rla rla ENDIF ENDIF .INVRS ; cpl ; Set to NOP to disable INVERSE nop ; Underlined text handling dec c ; jr nz,UNDRL ; Set to JR UNDRL to disable underlined text (loc. INVRS+2) jr UNDRL ld a,255 .UNDRL inc c ; end of underlined text handling .DOTS IF A128COL ld b,2 ENDIF IF A80COL ld b,3 ENDIF IF A85COL ld b,3 ENDIF IF A64COL ld b,4 ENDIF IF A51COL ld b,5 ENDIF IF A42COL ld b,6 ENDIF IF A40COL ld b,6 ENDIF IF A36COL ld b,7 ENDIF IF A32COL ld b,8 ENDIF IF A28COL ld b,8 ENDIF IF A24COL ld b,9 ENDIF .L2 rla rl (ix+1) rl (ix+0) djnz L2 .POST ld b,6 inc b dec b jr z,NEXT .L3 rl (ix+1) rl (ix+0) djnz L3 .NEXT add ix,de inc hl dec c jr nz,PRE ret ; The font ; 9 dots: MAX 28 columns ; 8 dots: MAX 32 columns ; 7 dots: MAX 36 columns ; 6 dots: MAX 42 columns ; 5 dots: MAX 51 columns ; 4 dots: MAX 64 columns ; 3 dots: MAX 85 columns Just readable! ; 2 dots: MAX 128 columns (useful for ANSI graphics only.. maybe) ; No file for ROM Font .font IF ROMFONT ; nothing here ! ELSE IF PACKEDFONT BINARY "stdio/ansi/F4PACK.BIN" ELSE IF A128COL BINARY "stdio/ansi/F3.BIN" ENDIF IF A80COL BINARY "stdio/ansi/F4.BIN" ENDIF IF A85COL BINARY "stdio/ansi/F4.BIN" ENDIF IF A64COL BINARY "stdio/ansi/F4.BIN" ENDIF IF A51COL BINARY "stdio/ansi/F5.BIN" ENDIF IF A42COL BINARY "stdio/ansi/F6.BIN" ENDIF IF A40COL BINARY "stdio/ansi/F6.BIN" ENDIF IF A36COL BINARY "stdio/ansi/F8.BIN" ENDIF IF A32COL BINARY "stdio/ansi/F8.BIN" ENDIF IF A28COL BINARY "stdio/ansi/F8.BIN" ENDIF IF A24COL BINARY "stdio/ansi/F8.BIN" ENDIF ENDIF ENDIF z88dk-1.8.ds1/libsrc/stdio/ansi/zx81/f_ansi_cls.asm0000644000175000017500000000037710700730453021460 0ustar tygrystygrys; ; ANSI Video handling for the ZX81 ; By Stefano Bodrato - Sept 2007 ; ; CLS - Clear the screen ; ; ; $Id: f_ansi_cls.asm,v 1.3 2007/10/03 15:11:39 stefano Exp $ ; XLIB ansi_cls LIB _clg_hr ; we use the graphics CLS routine .ansi_cls jp _clg_hr z88dk-1.8.ds1/libsrc/stdio/ansi/zx81/f_ansi_dline.asm0000644000175000017500000000062610700730453021767 0ustar tygrystygrys; ; Spectrum C Library ; ; ANSI Video handling for ZX 81 ; ; Clean a text line ; ; Stefano Bodrato - Sept. 2007 ; ; in: A = text row number ; ; ; $Id: f_ansi_dline.asm,v 1.3 2007/10/03 15:11:39 stefano Exp $ ; XLIB ansi_del_line XREF base_graphics .ansi_del_line ld d,a ld e,0 ld hl,(base_graphics) add hl,de ;Line address in HL ld (hl),e ld d,h ld e,l inc de ld bc,255 ldir ret z88dk-1.8.ds1/libsrc/stdio/ansi/zx81/f_ansi_scrollup.asm0000644000175000017500000000063310701736433022542 0ustar tygrystygrys; ; ANSI Video handling for the ZX81 ; By Stefano Bodrato - Sept. 2007 ; ; Scrollup ; ; ; $Id: f_ansi_scrollup.asm,v 1.4 2007/10/06 16:51:39 stefano Exp $ ; XLIB ansi_SCROLLUP LIB ansi_del_line XREF base_graphics XREF text_rows .ansi_SCROLLUP ld hl,(base_graphics) ld d,h ld e,l inc h ld a,(text_rows) ld b,a ld c,0 dec b ;ld bc,6144-256 ldir ld a,(text_rows) dec a call ansi_del_line ret z88dk-1.8.ds1/libsrc/stdio/aquarius/0000755000175000017500000000000010765202715016743 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/aquarius/fgetc_cons.asm0000644000175000017500000000043607411626074021564 0ustar tygrystygrys; ; Mattel AQUARIUS Routines ; ; getkey() Wait for keypress ; ; Dec 2001 - Stefano Bodrato ; ; ; $Id: fgetc_cons.asm,v 1.1 2001/12/24 13:23:08 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons call $1e80 and a jr nz,fgetc_cons .wkey call $1e80 and a jr z,wkey ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/aquarius/fputc_cons.asm0000644000175000017500000000063407411626074021615 0ustar tygrystygrys; ; Mattel Aquarius Routines ; ; Print character to the screen ; ; We can corrupt any register ; ; ; $Id: fputc_cons.asm,v 1.1 2001/12/24 13:23:08 stefano Exp $ ; XLIB fputc_cons ; ; Entry: char to print ; .fputc_cons ld hl,2 add hl,sp ld a,(hl); Now A contains the char cp 13 jr nz,nocrlf call $1d72 ld a,10 jp $1d72 .nocrlf cp 12 jr nz,nocls ld a,$b .nocls ;rst $18 ;ret jp $1d72 z88dk-1.8.ds1/libsrc/stdio/aquarius/getk.asm0000644000175000017500000000031107411626074020374 0ustar tygrystygrys; ; Mattel AQUARIUS Routines ; ; getk() Read key status ; ; Dec 200i - Stefano Bodrato ; ; ; $Id: getk.asm,v 1.1 2001/12/24 13:23:08 stefano Exp $ ; XLIB getk .getk call $1e80 ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/c128/0000755000175000017500000000000010765202715015566 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/c128/fgetc_cons.asm0000644000175000017500000000050307457364562020415 0ustar tygrystygrys; ; Keyboard routines for the Commodore 128 (Z80 mode) ; By Stefano Bodrato - 27/08/2001 ; ; getkey() Wait for keypress ; ; $Id: fgetc_cons.asm,v 1.2 2002/04/17 21:30:26 dom Exp $ ; XLIB fgetc_cons LIB getk .fgetc_cons call getk and a jr nz,fgetc_cons .kwait call getk and a jr z,kwait ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/c128/getk.asm0000644000175000017500000000145507457364562017244 0ustar tygrystygrys; ; Keyboard routines for the Commodore 128 (Z80 mode) ; By Stefano Bodrato - 27/08/2001 ; ; getk() Read key status ; ; $Id: getk.asm,v 1.2 2002/04/17 21:30:26 dom Exp $ ; XLIB getk .getk ld hl,keytab ld de,8 ld a,@01111111 ld bc,$dc00 .kloop1 out (c),a ld e,a inc bc in a,(c) dec bc cp 255 jr nz,scanline ld a,e scf rra jr nc,nokey ld e,8 add hl,de jr kloop1 .scanline rla jr nc,readtab inc hl jr scanline .readtab ld a,(hl) jr done .nokey xor a .done ld h,0 ld l,a ret .keytab defb 3,'Q','c',' ','2','c','a','1' defb '/','^','=','r','h',';','*','_' defb ',','@',':','.','-','L','P','+' defb 'N','O','K','M','0','J','I','9' defb 'V','U','H','B','8','G','Y','7' defb 'X','T','F','C','6','D','R','5' defb 'l','E','S','Z','4','A','W','3' defb '_','5','3','1','7','_', 13, 12 z88dk-1.8.ds1/libsrc/stdio/closeall.c0000644000175000017500000000104207265604646017062 0ustar tygrystygrys/* * Generic z88dk C Library: closeall() * * Closeall openfiles (called by startup code on exit) * * We try to fclose, if that fails we abandon them (machine * specific routine - z88 don't have one, +3 does) * * djm 1/4/2000 * * -------- * $Id: closeall.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #include void closeall(void) { FILE *fp; for (fp= _sgoioblk; fp < _sgoioblk+FOPEN_MAX ; ++fp) { if (fp->flags) { if ( fclose(fp) ) fabandon(fp); } } } z88dk-1.8.ds1/libsrc/stdio/cpc/0000755000175000017500000000000010765202715015656 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/cpc/fgetc_cons.asm0000644000175000017500000000053610650475166020503 0ustar tygrystygrys; ; Amstrad CPC Stdio ; ; getkey() Wait for keypress ; ; Stefano Bodrato - 8/6/2001 ; ; ; $Id: fgetc_cons.asm,v 1.3 2007/07/21 21:28:22 dom Exp $ ; XLIB fgetc_cons INCLUDE "#cpcfirm.def" .fgetc_cons call firmware defw km_wait_char ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/stdio/cpc/fputc_cons.asm0000644000175000017500000000076010650475166020533 0ustar tygrystygrys; ; Amstrad CPC Stdio ; ; putchar - puts a character ; (HL)=char to display ; ; Stefano Bodrato - 8/6/2001 ; ; ; $Id: fputc_cons.asm,v 1.3 2007/07/21 21:28:22 dom Exp $ ; XLIB fputc_cons INCLUDE "#cpcfirm.def" .fputc_cons ld hl,2 add hl,sp ld a,(hl) cp 13 jr nz,nocr call firmware defw txt_output ld a,10 .nocr call firmware defw txt_output ret z88dk-1.8.ds1/libsrc/stdio/cpc/getk.asm0000644000175000017500000000050310650475166017315 0ustar tygrystygrys; ; Amstrad CPC Stdio ; ; getk() Read key status ; ; Stefano Bodrato - 8/6/2001 ; ; ; $Id: getk.asm,v 1.3 2007/07/21 21:28:22 dom Exp $ ; XLIB getk INCLUDE "#cpcfirm.def" .getk call firmware defw km_read_char ld hl,0 ret nc ld l,a ret z88dk-1.8.ds1/libsrc/stdio/cpm/0000755000175000017500000000000010765202715015670 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/cpm/fgetc_cons.asm0000644000175000017500000000047710027024010020471 0ustar tygrystygrys; ; CPM Stdio ; ; getkey() Wait for keypress ; ; Stefano Bodrato - Apr. 2000 ; Stefano Bodrato - Mar. 2004 - removed the BS trick ; ; ; $Id: fgetc_cons.asm,v 1.4 2004/03/20 11:16:24 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons LD c,6 ld e,255 call 5 ld h,0 ld l,a and a jr z,fgetc_cons ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/cpm/fputc_cons.asm0000644000175000017500000000105207273540112020527 0ustar tygrystygrys; ; CPM Library ; ; Fputc_cons ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: fputc_cons.asm,v 1.3 2001/05/01 13:55:22 dom Exp $ ; XLIB fputc_cons ; ; Entry: hl = points to char ; .fputc_cons ld hl,2 add hl,sp ld a,(hl) cp 12 ; FF (CLS) ? jr z,docls cp 13 ; CR ? jr nz,nocrlf ld de,10 ; Add a LineFeed ld c,2 push af call 5 pop af .nocrlf ld e,a ; Send the character ld d,0 ld c,2 jp 5 .docls ; This is the ANSI CLS call ld e,27 ld c,2 call 5 ld e,'[' ld c,2 call 5 ld e,'J' ld c,2 jp 5 z88dk-1.8.ds1/libsrc/stdio/cpm/getk.asm0000644000175000017500000000036210027024010017302 0ustar tygrystygrys; ; CPM Stdio ; ; getk() Read key status ; ; Stefano Bodrato - Apr. 2000 ; Stefano Bodrato - Mar. 2004 - fixed ; ; ; $Id: getk.asm,v 1.3 2004/03/20 11:16:24 stefano Exp $ ; XLIB getk .getk LD c,6 ld e,255 call 5 ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/stdio/embedded/0000755000175000017500000000000010765202715016642 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/fabandon.c0000644000175000017500000000117307265604646017041 0ustar tygrystygrys/* * Abandon file * * fabandon(FILE *fp) * * djm 1/4/2000 * * If implemented this routine should obviously check that * it's alright to close a file (i.e. not string or default * std*) * * -------- * $Id: fabandon.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include void fabandon(FILE *fp) { /* Z88 has no abandon file command, just reset fp */ #ifdef Z80 #asm pop de pop ix push ix push de xor a ld (ix+fp_desc),a ld (ix+fp_desc+1),a ld (ix+fp_ungetc),a ld (ix+fp_flags),a #endasm #else fp->desc.fd=0; fp->flags=0; fp->ungetc=0; #endif } z88dk-1.8.ds1/libsrc/stdio/fchkstd.c0000644000175000017500000000136107265604646016716 0ustar tygrystygrys/* * Short routine to check for std* channels * * This is implemented in order to use different routines * for console input/output * * Returns: 0 = not console, c * 1 = input, nc * -1 = output, nc * -------- * $Id: fchkstd.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include int fchkstd(FILE *fp) { #ifdef Z80 #asm pop de pop ix push ix push de ld hl,0 ld a,(ix+fp_flags) and _IOSYSTEM scf ret z ;non system return 0 dec hl ;-1 ld a,(ix+fp_flags) and _IOREAD and a ;don`t think this is necessary ret nz inc hl inc hl ;write, return 1 and a #endasm #else if ( fp->flags&_IOSYSTEM == 0 ) return 0; return ( fp->flags&_IOREAD ? -1 : 1 ); #endif } z88dk-1.8.ds1/libsrc/stdio/fclose.c0000644000175000017500000000211207265604646016536 0ustar tygrystygrys/* * New stdio functions for Small C+ * * djm 4/5/99 * * -------- * $Id: fclose.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include #include int __FASTCALL__ fclose(FILE *fp) { #ifdef Z80 #asm pop de pop ix push ix push de ld hl,-1 ;EOF ld a,(ix+fp_flags) ld c,a and _IOUSE ;is it defined ret z ;no ld a,c and _IOSTRING ;string? jr nz,is_closed ;yes #ifdef NET_STDIO ld a,c and _IONETWORK jr z,no_net ld l,(ix+fp_desc) ld h,(ix+fp_desc+1) push ix push hl call closenet jr ckclosed .no_net #endif push ix call fchkstd pop ix jr nc,is_closed ;was std* (def setup) ld l,(ix+fp_desc) ld h,(ix+fp_desc+1) push ix push hl call close .ckclosed pop bc pop ix ld a,h or l ret nz .is_closed ld hl,0 ld (ix+fp_flags),l ld (ix+fp_desc),l ld (ix+fp_desc+1),h #endasm #else if ( (fp->flags&_IOUSE ==0 ) || (fp->flags&_IOSTRING) ) return(EOF); if (fchkstd(fp) == 0 ) { if (close(fp->desc.fd) ) return EOF; } fp->desc.fd=0; fp->flags=0; return 0; #endif } z88dk-1.8.ds1/libsrc/stdio/fdopen.c0000644000175000017500000000137607265604646016551 0ustar tygrystygrys/* * Associate a file handle with a stream * * 20/4/2000 djm * * -------- * $Id: fdopen.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #include FILE *fdopen(int fildes, char *mode) { int flags; FILE *fp; for (fp= _sgoioblk; fp < _sgoioblk+FOPEN_MAX ; ++fp) if (fp->flags == 0 ) break; if (fp >= _sgoioblk+FOPEN_MAX) return NULL; /* No free slots */ switch ((unsigned char )*mode) { case 'r': flags=_IOREAD | _IOUSE; break; case 'w': flags = _IOWRITE | _IOUSE; break; case 'a': flags = _IOWRITE | _IOUSE; break; default: return (FILE *)NULL; } fp->desc.fd=fildes; fp->ungetc=0; fp->flags=flags; return (FILE *)fp; } z88dk-1.8.ds1/libsrc/stdio/feof.c0000644000175000017500000000040207265604646016202 0ustar tygrystygrys/* * Check for end of file * * Return 1 = EOF 0 = not eof * * djm 1/4/2000 * * -------- * $Id: feof.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #include int feof(FILE *fp) { return (fp->flags&_IOEOF ? 1 : 0 ); } z88dk-1.8.ds1/libsrc/stdio/fflush.c0000644000175000017500000000125107265604646016555 0ustar tygrystygrys/* * fflush(fp) * * Only really valid for TCP net connections * * -------- * $Id: fflush.c,v 1.3 2001/04/13 14:13:58 stefano Exp $ */ #ifdef Z80 #define STDIO_ASM #endif #include int fflush(FILE *fp) { #ifdef Z80 #asm #ifdef NET_STDIO pop bc pop ix push ix push bc ld hl,-1 ;EOF ld a,(ix+fp_flags) ld c,a and _IOUSE ret z ;not used ld a,c and _IONETWORK ret z ;not network ld l,(ix+fp_desc) ld h,(ix+fp_desc+1) push hl call fflush_net pop bc #else ld hl,0 #endif #endasm #else #ifdef NET_STDIO if (fp->flags&(_IOUSE|_IONETWORK) == _IOUSE|_IONETWORK ) { return (fflush_net(fp->desc.fd)); } return 0; #else return 0; #endif #endif } z88dk-1.8.ds1/libsrc/stdio/fgetc.c0000644000175000017500000000440607500670226016350 0ustar tygrystygrys/* * New stdio functions for Small C+ * * djm 4/5/99 * * -------- * $Id: fgetc.c,v 1.5 2002/06/09 15:13:26 dom Exp $ */ #define ANSI_STDIO #define STDIO_ASM #include #include /* * struct fp { * union xx { * int fd; * char *str; * } desc; * u8_t error; * u8_t flags; * u8_t ungetc; */ int fgetc(FILE *fp) { #ifdef Z80 #asm pop bc pop ix ;fp push ix push bc ld hl,-1 ;EOF ld a,(ix+fp_flags) ;get flags and a ret z and _IOWRITE | _IOEOF ;check we`re not write/EOF ret nz ld a,(ix+fp_ungetc) ;check for ungot char and a jr z,no_ungetc ld l,a ld h,0 ld (ix+fp_ungetc),h ret .no_ungetc ; Now do strings ld a,(ix+fp_flags) and _IOSTRING jr z,no_string ;not a string ld e,(ix+fp_desc) ld d,(ix+fp_desc+1) ld a,(de) inc de ld (ix+fp_desc),e ld (ix+fp_desc+1),d ld hl,-1 ;EOF and a ;test for zero ret z ;return EOF if so ld l,a ;else return character ld h,0 ret .no_string #ifdef NET_STDIO ld a,(ix+fp_flags) and _IONETWORK jr z,no_net ld l,(ix+fp_desc) ld h,(ix+fp_desc+1) push ix push hl call fgetc_net pop bc pop ix ret nc jr seteof ;EOF reached (sock closed?) .no_net #endif push ix ;preserve fp call fchkstd ;check for stdin (stdout/err have failed already) pop ix ;ix back jr c,no_stdin call fgetc_cons ;get from console ret ;always succeeds - never EOF .no_stdin ld l,(ix+fp_desc) ld h,(ix+fp_desc+1) push ix ; push hl ;dont think this push/pop is needed call readbyte ;readbyte sorts out stack (fastcall) ; pop bc ;dump handle pop ix ;get fp back #ifdef __STDIO_BINARY ld a,_IOTEXT ;check for text mode and (ix+fp_flags) ret z ld a,l ;load bytes sub __STDIO_EOFMARKER ;compare with the EOF marker and a ;reset carry ret nz ld hl,-1 ;signify EOF #else ret nc ;no error so return (make sure other ;implementations respect this!) #endif .seteof ld a,(ix+fp_flags) or _IOEOF ld (ix+fp_flags),a ;set EOF, return with EOF #endasm #else int c; if ( fp->flags == 0 || (fp->flags & _IOWRITE) ) return EOF; if (c=fp->ungetc) { fp->ungetc=0; return(c); } if ( fp->flags & _IOSTRING ) { c=*fp->desc.ptr++; return ( c ? c : EOF);} if ( (c=readbyte(fp->fd)) == EOF) fp->flags&=_IOEOF; return(c); #endif } z88dk-1.8.ds1/libsrc/stdio/fgetpos.c0000644000175000017500000000143307742626617016741 0ustar tygrystygrys/* * Get the position of a file * * int fgetpos(FILE *fp, fpos_t *posn) * * Calls some machine dependent routine to do the dirty work * * djm 1/4/2000 * * -------- * $Id: fgetpos.c,v 1.3 2003/10/13 22:56:15 dom Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include int fgetpos(FILE *fp, fpos_t *posn) { #ifdef Z80 #asm pop de ;ret pop bc ;&posn pop ix ;fp push ix push bc push de ld a,(ix+fp_flags) and _IOUSE jr z,fgetpos_abort push ix call fchkstd pop ix jr nc,fgetpos_abort ;std* system ld l,(ix+fp_desc) ld h,(ix+fp_desc) push hl ;fd push bc ;&posn call fdgetpos pop bc pop bc ret .fgetpos_abort ld hl,-1 #endasm #else if ( fp->flags&_IOUSE && fchkstd(fp)== 0 ) { return (fdgetpos(fp->fd,posn)); } return -1; #endif } z88dk-1.8.ds1/libsrc/stdio/fgets.c0000644000175000017500000000111107265604646016371 0ustar tygrystygrys/* * New stdio functions for Small C+ * * djm 4/5/99 * * -------- * $Id: fgets.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #include char *fgets(unsigned char *s,int n,FILE *f) { unsigned char *p=s; int k=0; if(n<=0) return s; if (fchkstd(f) == -1 ) { /* i.e. stdin */ return(fgets_cons(s,n)); } while (--n) { /* Handle those annoying CR/LF conventions */ if (k=='\n' || k=='\r') break; k=fgetc(f); if(k==EOF) break; *p++=(char)k; } *p=0; if (k==EOF) return 0; return s; } z88dk-1.8.ds1/libsrc/stdio/fgets_cons.c0000644000175000017500000000132707615016544017415 0ustar tygrystygrys/* * Spectrum C library * * 23/1/2000 djm * 24/1/2003 minor fixes by chriscowley * * This is as usual my slightly non standard gets() * which takes a length argument.. * * -------- * $Id: fgets_cons.c,v 1.6 2003/01/26 17:39:48 dom Exp $ */ #include int fgets_cons(unsigned char *str, int max) { unsigned char c; int ptr; ptr=0; while (1) { c = fgetc_cons(); if (ptr == max-1) return str; if (c == 12 || c == 8 ) { if ( ptr > 0 ) { str[--ptr] = 0; fputc_cons(8); fputc_cons(32); fputc_cons(8); } } else { str[ptr++] = c; str[ptr] = 0; fputc_cons(c); if (c == '\n' || c == '\r') return str; } } } z88dk-1.8.ds1/libsrc/stdio/fopen.c0000644000175000017500000000104107500435647016365 0ustar tygrystygrys/* * fopen.c - open a stream * * Vaguely, vaguely based upon K&R p177 * * djm 4/5/99 * * -------- * $Id: fopen.c,v 1.3 2002/06/08 17:15:19 dom Exp $ */ #define ANSI_STDIO #include FILE * fopen(far char *name, unsigned char *mode) { char buf[10]; FILE *fp; for (fp= _sgoioblk; fp < _sgoioblk+FOPEN_MAX ; ++fp) { if (fp->flags == 0 ) break; } if (fp >= _sgoioblk+FOPEN_MAX) { return NULL; /* No free slots */ } return (freopen_z88(name,mode,fp,buf,9)); } z88dk-1.8.ds1/libsrc/stdio/fopen_z88.c0000644000175000017500000000106407265604646017110 0ustar tygrystygrys/* * fopen.c - open a stream * * Vaguely, vaguely based upon K&R p177 * * djm 4/5/99 * * -------- * $Id: fopen_z88.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #include FILE * fopen_z88(far char *name, unsigned char *mode, unsigned char *buf, size_t len) { FILE *fp; for (fp= _sgoioblk; fp < _sgoioblk+FOPEN_MAX ; ++fp) if (fp->flags == 0 ) break; if (fp >= _sgoioblk+FOPEN_MAX) return NULL; /* No free slots */ return (freopen_z88(name,mode,fp,buf,len)); } z88dk-1.8.ds1/libsrc/stdio/fputc.c0000644000175000017500000000261007265604646016407 0ustar tygrystygrys/* * New stdio functions for Small C+ * * djm 4/5/99 * * -------- * $Id: fputc.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include #include int fputc(int c,FILE *fp) { #ifdef Z80 #asm pop de pop ix ;fp pop bc ;c push bc push ix push de ld hl,-1 ;EOF ld a,(ix+fp_flags) and a ;no thing ret z and _IOREAD ret nz ;don`t want reading streams ld a,(ix+fp_flags) and _IOSTRING jr z,no_string ld l,(ix+fp_desc) ld h,(ix+fp_desc+1) ld (hl),c inc hl ld (ix+fp_desc),l ld (ix+fp_desc+1),h ld l,c ;load char to return ld h,0 ret .no_string #ifdef NET_STDIO ld a,(ix+fp_flags) and _IONETWORK jr z,no_net ld l,(ix+fp_desc) ld h,(ix+fp_desc+1) push hl ;socket push bc ;byte call fputc_net pop bc pop bc ret .no_net #endif push ix call fchkstd ;preserves bc pop ix jr c,no_cons ; Output to console push bc call fputc_cons pop hl ret .no_cons ; Output to file ld l,(ix+fp_desc) ld h,(ix+fp_desc+1) push hl ;fd push bc ;c call writebyte pop bc ;discard values pop bc #endasm #else if ( fp->flags == 0 || fp->flags & _IOREAD ) return EOF; if ( fp->flags & _IOSTRING ) { *fp->desc.ptr++=(char) c; return(c); } #ifdef NET_STDIO if ( fp->flags & _IONETWORK) return(fputc_net(fp->fd,c) #endif return (writebyte(fp->fd,c)); #endif } z88dk-1.8.ds1/libsrc/stdio/fputs.c0000644000175000017500000000134007265604646016426 0ustar tygrystygrys/* * New stdio functions for Small C+ * * fputc handles all types * * djm 4/5/99 * * -------- * $Id: fputs.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #include #include int fputs(unsigned char *s,FILE *fp) { #ifdef Z80 #asm pop hl ;ret pop ix ;fp pop de ;s push de push ix push hl .loop ld hl,1 ;non -ve number ld a,(de) ;*s and a ret z ;end of string ld l,a ld h,0 inc de ;s++ push de ;keep s push hl ;send *s++ push ix ;send fp call fputc pop ix ;get fp back pop bc ;discard hl pop de ;get s back ld a,l ;test for EOF returned and h inc a ret z jr loop #endasm #else while (*s) { if ( fputc(*s++,fp) == EOF) return(EOF); } #endif } z88dk-1.8.ds1/libsrc/stdio/fread.c0000644000175000017500000000213307742625254016345 0ustar tygrystygrys/* * Read from a file * * int fread(void *ptr, size_t size, size_t nmemb, FILE *fp) * * Calls read() in fcntl to do the dirty work * * Returns number of members readen * * We have to take account of ungotten characters * * djm 1/4/2000 * * -------- * $Id: fread.c,v 1.6 2003/10/13 22:43:56 dom Exp $ */ #define ANSI_STDIO #include int fread(void *ptr, size_t size, size_t nmemb, FILE *fp) { if ( (fp->flags&(_IOUSE|_IOREAD)==(_IOUSE|_IOREAD)) && \ fchkstd(fp)== 0) { int readen = size*nmemb; int count = 0; #ifdef __STDIO_BINARY while ( count < readen ) { int c = fgetc(fp); if ( c == EOF ) { break; } *ptr++ = (unsigned char)c; ++count; } return ( count / size ); /* Relies on 0 / x != EXCEPTION */ #else if (readen) { /* Pick up ungot character */ int c = fgetc(fp); /* Horrible hack around here */ if ( c >= 0 ) { *ptr = (unsigned char )c; readen=read(fp->desc.fd,ptr+1,readen-1); ++readen; /* Return number of members read */ return (readen/size); } } #endif } return 0; } z88dk-1.8.ds1/libsrc/stdio/freopen.c0000644000175000017500000000057607265604646016735 0ustar tygrystygrys/* * freopen.c - open a stream * * This sets up a temporary buffer then calls the real stuff * in freopen_z88 * * djm 1/4/2000 * * -------- * $Id: freopen.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #include FILE *freopen(far char *name, unsigned char *mode, FILE *fp) { char buf[10]; return (freopen_z88(name,mode,fp,buf,9)); } z88dk-1.8.ds1/libsrc/stdio/freopen_z88.c0000644000175000017500000000224307500670226017424 0ustar tygrystygrys/* * Open a file (stdio library) returning the explicit * filename (this reuses a filebuffer) * * Only hands r,w,a types (no modifiers) * * djm 24/3/2000 * * djm 1/4/2000 Modified to enable file structures * * -------- * $Id: freopen_z88.c,v 1.4 2002/06/09 15:13:26 dom Exp $ */ #define ANSI_STDIO #include #include FILE *freopen_z88(far char *name, char *mode, FILE *fp, char *explicit, size_t len) { int access; int flags; switch (*(unsigned char *)mode) { case 'r': access=O_RDONLY; flags=_IOREAD | _IOUSE| _IOTEXT; break; case 'w': access=O_WRONLY; flags = _IOWRITE | _IOUSE | _IOTEXT; break; case 'a': access=O_APPEND; flags = _IOWRITE | _IOUSE | _IOTEXT; break; default: return (FILE *)NULL; } #ifdef __STDIO_BINARY if ( *(unsigned char *) (mode+1) == 'b' ) flags ^= _IOTEXT; #endif #ifdef NET_STDIO if (opennet(fp,name,explicit,len) ) return (fp); #endif { int fd=open_z88(name,access,0,explicit,len); FILE *fp2=fp; if (fd == - 1 ) return (FILE *)NULL; fp2->desc.fd=fd; fp2->ungetc=0; fp2->flags=flags; return (FILE *)fp2; } } z88dk-1.8.ds1/libsrc/stdio/fseek.c0000644000175000017500000000074007265604646016365 0ustar tygrystygrys/* * Get the position of a file * * long ftell(FILE *fp) * * Calls some machine dependent routine to do the dirty work * * djm 1/4/2000 * * -------- * $Id: fseek.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include #include int fseek(FILE *fp, fpos_t posn, int whence) { if ( fp->flags&_IOUSE && fchkstd(fp)== 0 ) { if (lseek(fp->fd,posn,whence) != -1L ) return 0; } return 1; } z88dk-1.8.ds1/libsrc/stdio/ftell.c0000644000175000017500000000131007265604646016370 0ustar tygrystygrys/* * Get the position of a file * * long ftell(FILE *fp) * * Calls some machine dependent routine to do the dirty work * * djm 1/4/2000 * * -------- * $Id: ftell.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #ifdef Z80 #define STDIO_ASM #endif #include fpos_t ftell(FILE *fp) { #ifdef Z80 #asm pop bc pop ix push ix push bc ld a,(ix+fp_flags) and _IOUSE jr z,ftell_abort push ix call fchkstd pop ix jr nc,ftell_abort ;system ld l,(ix+fp_desc) ld h,(ix+fp_desc) push hl call fdtell pop bc ret .ftell_abort ld de,65535 ;-1 ld l,e ld h,d #endasm #else if ( fp->flags&_IOUSE && fchkstd(fp)== 0 ) { return (fdtell(fp->fd)); } return -1L; #endif } z88dk-1.8.ds1/libsrc/stdio/fwrite.c0000644000175000017500000000111207265604646016562 0ustar tygrystygrys/* * Write to a file * * int fwrite(void *ptr, size_t size, size_t nmemb, FILE *fp) * * Calls write() in fcntl to do the dirty work * * Returns number of members written * * djm 1/4/2000 * * -------- * $Id: fwrite.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #include int fwrite(void *ptr, size_t size, size_t nmemb, FILE *fp) { if ( (fp->flags&(_IOUSE|_IOWRITE)==(_IOUSE|_IOWRITE)) && \ fchkstd(fp)== 0 ) { int written=write(fp->fd,ptr,size*nmemb); /* Return number of members written */ return (written/size); } return 0; } z88dk-1.8.ds1/libsrc/stdio/gets.c0000644000175000017500000000104107615016544016216 0ustar tygrystygrys/* * New stdio functions for Small C+ * * $Id: gets.c,v 1.1 2003/01/26 17:39:48 dom Exp $ */ #define ANSI_STDIO #include char *gets(unsigned char *str) { unsigned char c; int ptr; ptr=0; while (1) { c = fgetc_cons(); if (c == '\n' || c == '\r') return str; if (c == 12 || c == 8 ) { if ( ptr > 0 ) { str[--ptr] = 0; fputc_cons(8); fputc_cons(32); fputc_cons(8); } } else { str[ptr++] = c; str[ptr] = 0; fputc_cons(c); } } } z88dk-1.8.ds1/libsrc/stdio/m5/0000755000175000017500000000000010765202715015432 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/m5/fgetc_cons.asm0000644000175000017500000000032007457364562020256 0ustar tygrystygrys; ; SORD M5 Stdio ; ; getkey() Wait for keypress ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: fgetc_cons.asm,v 1.2 2002/04/17 21:30:26 dom Exp $ ; XLIB fgetc_cons .fgetc_cons call $845 ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/stdio/m5/fputc_cons.asm0000644000175000017500000000031207457364562020310 0ustar tygrystygrys; ; Basic video handling for the SORD M5 ; ; (HL)=char to display ; ; $Id: fputc_cons.asm,v 1.2 2002/04/17 21:30:26 dom Exp $ ; XLIB fputc_cons .fputc_cons ld hl,2 add hl,sp ld a,(hl) jp $1088 z88dk-1.8.ds1/libsrc/stdio/m5/getk.asm0000644000175000017500000000027207457364562017104 0ustar tygrystygrys; ; SORD M5 Stdio ; ; getk() Read key status ; ; Stefano Bodrato - 18/5/2001 ; ; ; $Id: getk.asm,v 1.2 2002/04/17 21:30:26 dom Exp $ ; XLIB getk .getk call $845 ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/stdio/m5/README0000644000175000017500000000041607457364562016330 0ustar tygrystygrys$Id: README,v 1.2 2002/04/17 21:30:26 dom Exp $ Sord M5 non ANSI Libs by Stefano Bodrato. This platform is a mixture between a PRE-MSX machine and a Sinclair machine. I tested the thing under SORDEMU + ROM BASIC. Found the calls by looking into the disassembled ROM! z88dk-1.8.ds1/libsrc/stdio/Makefile0000644000175000017500000000656610763607752016576 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.24 2008/03/05 20:35:48 dom Exp $ # include ../Make.config STDCFILES = \ closeall.c \ fabandon.c \ fchkstd.c \ fdopen.c \ feof.c \ fgetpos.c \ fgets.c \ fgets_cons.c \ fopen.c \ fopen_z88.c \ fputs.c \ freopen.c \ fseek.c \ ftell.c \ gets.c \ fwrite.c \ printk.c \ printn.c \ puts.c \ ungetc.c \ vfprintf_mini.c GENCFILES = \ fclose.c \ fgetc.c \ fputc.c \ freopen_z88.c \ fread.c NETCFILES = $(GENCFILES) \ fflush.c # stdio_fp.c AFILES = $(STDCFILES:.c=.asm) $(NETCFILES:.c=.asm) STDOBJECTS = $(STDCFILES:.c=.o) GENCOBJECTS = $(GENCFILES:.c=.o) generic: std gen lcpm: std gen cpm lz88: std gen z88_x lz88net: std net z88_x net: zcc +z88 $(CFLAGS) -DNET_STDIO fclose.c zcc +z88 $(CFLAGS) -DNET_STDIO fgetc.c zcc +z88 $(CFLAGS) -DNET_STDIO fputc.c zcc +z88 $(CFLAGS) -DNET_STDIO freopen_z88.c zcc +z88 $(CFLAGS) -DNET_STDIO fflush.c zcc +z88 $(CFLAGS) -DNET_STDIO fread.c cd zsock ; $(MAKE) ; cd .. cpm: $(GENCOBJECTS) zcc +cpm $(CFLAGS) -D__CPM__ fclose.c zcc +cpm $(CFLAGS) -D__CPM__ fgetc.c zcc +cpm $(CFLAGS) -D__CPM__ fputc.c zcc +cpm $(CFLAGS) -D__CPM__ freopen_z88.c zcc +cpm $(CFLAGS) -D__CPM__ fread.c gen: zcc +test $(CFLAGS) fclose.c zcc +test $(CFLAGS) fgetc.c zcc +test $(CFLAGS) fputc.c zcc +test $(CFLAGS) freopen_z88.c zcc +test $(CFLAGS) fread.c cd 8080; $(MAKE) ; cd .. std: $(STDOBJECTS) generic_iy: #stdc zcc +test $(CFLAGS) -Ca-IXIY closeall.c zcc +test $(CFLAGS) -Ca-IXIY fabandon.c zcc +test $(CFLAGS) -Ca-IXIY fchkstd.c zcc +test $(CFLAGS) -Ca-IXIY fdopen.c zcc +test $(CFLAGS) -Ca-IXIY feof.c zcc +test $(CFLAGS) -Ca-IXIY fgetpos.c zcc +test $(CFLAGS) -Ca-IXIY fgets.c zcc +test $(CFLAGS) -Ca-IXIY fgets_cons.c zcc +test $(CFLAGS) -Ca-IXIY fopen.c zcc +test $(CFLAGS) -Ca-IXIY fopen_z88.c zcc +test $(CFLAGS) -Ca-IXIY fputs.c zcc +test $(CFLAGS) -Ca-IXIY freopen.c zcc +test $(CFLAGS) -Ca-IXIY fseek.c zcc +test $(CFLAGS) -Ca-IXIY ftell.c zcc +test $(CFLAGS) -Ca-IXIY gets.c zcc +test $(CFLAGS) -Ca-IXIY fwrite.c zcc +test $(CFLAGS) -Ca-IXIY printk.c zcc +test $(CFLAGS) -Ca-IXIY printn.c zcc +test $(CFLAGS) -Ca-IXIY puts.c zcc +test $(CFLAGS) -Ca-IXIY ungetc.c zcc +test $(CFLAGS) -Ca-IXIY vfprintf_mini.c #gen zcc +test $(CFLAGS) -Ca-IXIY fclose.c zcc +test $(CFLAGS) -Ca-IXIY fgetc.c zcc +test $(CFLAGS) -Ca-IXIY fputc.c zcc +test $(CFLAGS) -Ca-IXIY freopen_z88.c zcc +test $(CFLAGS) -Ca-IXIY fread.c z88_x: cd z88 ; $(MAKE) ; cd .. .c.o: zcc +test $(CFLAGS) $*.c clean: $(RM) *.o* *.sym *.map zcc_opt.def *.i $(AFILES) $(RM) ansi/*.o $(RM) ansi/abc80/*.o $(RM) ansi/ace/*.o $(RM) ansi/aquarius/*.o $(RM) ansi/c128/*.o $(RM) ansi/cpc/*.o $(RM) ansi/generic/*.o $(RM) ansi/nascom/*.o $(RM) ansi/oz/*.o $(RM) ansi/sam/*.o $(RM) ansi/sharp-mz/*.o $(RM) ansi/spectrum/*.o $(RM) ansi/ts2068/*.o $(RM) ansi/sprinter/*.o $(RM) ansi/vz200/*.o $(RM) ansi/z88/*.o $(RM) ansi/zx81/*.o $(RM) abc80/*.o $(RM) abc800/*.o $(RM) ace/*.o $(RM) aquarius/*.o $(RM) c128/*.o $(RM) cpc/*.o $(RM) cpm/*.o $(RM) m5/*.o $(RM) msx/*.o $(RM) mz/*.o $(RM) nascom/*.o $(RM) nc100/*.o $(RM) newbrain/*.o $(RM) oz/*.o $(RM) sam/*.o $(RM) spectrum/*.o $(RM) ts2068/*.o $(RM) sprinter/*.o $(RM) svi/*.o $(RM) vz200/*.o $(RM) z88/*.o $(RM) zx81/*.o $(RM) rcmx000/*.o cd zsock ; $(MAKE) clean ; cd .. cd 8080 ; $(MAKE) clean ; cd .. z88dk-1.8.ds1/libsrc/stdio/msx/0000755000175000017500000000000010765202715015720 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/msx/fgetc_cons.asm0000644000175000017500000000043010726227173020533 0ustar tygrystygrys; ; MSX C Library ; ; getkey() Wait for keypress ; ; Stefano Bodrato - Apr. 2001 ; ; ; $Id: fgetc_cons.asm,v 1.4 2007/12/07 11:28:59 stefano Exp $ ; XLIB fgetc_cons LIB msxbios INCLUDE "#msxbios.def" .fgetc_cons ld ix,CHGET call msxbios ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/msx/fputc_cons.asm0000644000175000017500000000070110726227173020565 0ustar tygrystygrys; ; MSX C Library ; ; Fputc_cons ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: fputc_cons.asm,v 1.4 2007/12/07 11:28:59 stefano Exp $ ; XLIB fputc_cons LIB msxbios INCLUDE "#msxbios.def" ; ; Entry: hl = points to char ; .fputc_cons ld hl,2 add hl,sp ld a,(hl) ld ix,CHPUT ; Print char cp 13 jr nz,nocrlf call msxbios ld a,10 .nocrlf cp 12 ; CLS ? jr nz,nocls ld ix,CLS .nocls jp msxbios z88dk-1.8.ds1/libsrc/stdio/msx/getk.asm0000644000175000017500000000045710726227173017364 0ustar tygrystygrys; ; MSX C Library ; ; getk() Read key status ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: getk.asm,v 1.4 2007/12/07 11:28:59 stefano Exp $ ; XLIB getk LIB fgetc_cons LIB msxbios INCLUDE "#msxbios.def" .getk ld ix,CHSNS call msxbios ret z ; exit if no key in buffer jp fgetc_cons z88dk-1.8.ds1/libsrc/stdio/mz/0000755000175000017500000000000010765202715015537 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/mz/fgetc_cons.asm0000644000175000017500000000062707265604647020373 0ustar tygrystygrys; ; Sharp MZ Routines ; ; fgetc_cons() Wait for keypress ; ; Stefano Bodrato - 5/5/2000 ; ; No auto-repeat for now. ; Maybe someone wants to improve this ? ; ; ; $Id: fgetc_cons.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons call $9b3 ; wait for a key call $bce ; convert it to ASCII cp $66 ; was it ENTER ? jr nz,noenter ld a,13 .noenter ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/mz/fputc_cons.asm0000644000175000017500000000076407265604647020426 0ustar tygrystygrys; ; Sharp MZ C Library ; ; Print character to the screen ; ; We will corrupt any register ; ; ; Sharp MZ Routines ; ; Stefano Bodrato - 5/5/2000 ; ; ; $Id: fputc_cons.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB fputc_cons ; ; Entry: hl points char to print ; .savesp defw 0 .fputc_cons ex af,af' pop af push af ld hl,2 add hl,sp ld a,(hl) cp 12 ; Clear screen ? jr nz,nocls ;ld a,$16 .nocls ld (savesp),sp call $12 ld sp,(savesp) retz88dk-1.8.ds1/libsrc/stdio/mz/getk.asm0000644000175000017500000000042007265604647017202 0ustar tygrystygrys; ; Sharp MZ Routines ; ; getk() Read key status ; ; Stefano Bodrato - 5/5/2000 ; ; ; $Id: getk.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB getk .getk call $1B ;get key cp $66 ;was it ENTER ? jr nz,noenter ld a,13 .noenter ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/nascom/0000755000175000017500000000000010765202715016371 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/nascom/fgetc_cons.asm0000755000175000017500000000071107677047335021224 0ustar tygrystygrys; ; Keyboard routines for the NASCOM1/2 ; By Stefano Bodrato - 23/05/2003 ; ; getkey() Wait for keypress ; ; ; $Id: fgetc_cons.asm,v 1.1 2003/06/27 14:04:13 stefano Exp $ ; XLIB fgetc_cons LIB montest .fgetc_cons call montest jr nz,nassys ; NASBUG 'T' monitor .tin call c4dh jr nc,tin cp 1dh jr nz,notbs ld a,8 .notbs cp 1fh jr nz,notcr ld a,13 .notcr jr fgetcc_exit ; NASSYS monitor .nassys rst 8 .fgetcc_exit ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/nascom/fputc_cons.asm0000755000175000017500000000067607677047335021267 0ustar tygrystygrys; ; ROM Console routine for the NASCOM1/2 ; By Stefano Bodrato - 19/6/2003 ; ; $Id: fputc_cons.asm,v 1.1 2003/06/27 14:04:13 stefano Exp $ ; XLIB fputc_cons LIB montest .fputc_cons ld hl,2 add hl,sp ld a,(hl) push af call montest jr nz,nassys ; T monitor pop af cp 12 jr nz,notcls ld a,1eh .notcls cp 13 jr nz,notcr ld a,1fh .notcr jp c4ah .nassys ; NASSYS monitor pop af cp 12 jr nz,nocls ld a,0ch .nocls defb f7h ret z88dk-1.8.ds1/libsrc/stdio/nascom/getk.asm0000755000175000017500000000050707677047335020047 0ustar tygrystygrys; ; Keyboard routines for the NASCOM1/2 ; By Stefano Bodrato - 23/05/2003 ; ; getk() Read key status ; ; ; $Id: getk.asm,v 1.1 2003/06/27 14:04:13 stefano Exp $ ; XLIB getk LIB montest .getk call montest jr nz,nassys ; T monitor call c4dh jr gkret ; NASSYS monitor .nassys defw 62dfh .gkret ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/nc100/0000755000175000017500000000000010765202715015732 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/nc100/fgetc_cons.asm0000644000175000017500000000115307265604647020561 0ustar tygrystygrys; ; Read character from console ; ; ; int fgetc_cons() ; ; djm 17/4/2000 ; On an nc100 we have to test for "yellow" ; ; $Id: fgetc_cons.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB fgetc_cons XREF cleanup ;in crt0 .fgetc_cons call $B9B3 ;kmreadchar jr nc,fgetc_cons ;no key available...try again ld l,c ld h,b ld a,b and a ret z ;no token sub 2 ret nz ;not b=2 ld a,c cp $FC ret nz ; We've got here so we have just received escape so check yellow push hl ;keep this in case call $B8d2 ;kmgetyellow pop hl ;get it back ret nc ;no yellow jp cleanup ;was yellow so outta here z88dk-1.8.ds1/libsrc/stdio/nc100/fputc_cons.asm0000644000175000017500000000032607265604647020613 0ustar tygrystygrys; ; Put character to console ; ; fputc_cons(char c) ; ; ; $Id: fputc_cons.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB fputc_cons .fputc_cons ld hl,2 add hl,sp ld a,(hl) call $B833 ;txtoutput ret z88dk-1.8.ds1/libsrc/stdio/nc100/getk.asm0000644000175000017500000000112107265604647017374 0ustar tygrystygrys; ; Read character from console - don't wait ; ; ; int getk() ; ; djm 17/4/2000 ; On an nc100 we have to test for "yellow" ; ; $Id: getk.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB getk XREF cleanup ;in crt0 .getk call $B9B3 ;kmreadchar ld hl,0 ret nc ;no key pressed ld l,c ld h,b ld a,b and a ret z ;no token sub 2 ret nz ;not b=2 ld a,c cp $FC ret nz ; We've got here so we have just received escape so check yellow push hl ;keep this in case call $B8d2 ;kmgetyellow pop hl ;get it back ret nc ;no yellow jp cleanup ;was yellow so outta here z88dk-1.8.ds1/libsrc/stdio/newbrain/0000755000175000017500000000000010765202715016716 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/newbrain/fgetc_cons.asm0000755000175000017500000000067310622054316021535 0ustar tygrystygrys; ; Basic keyboard handling for the Grundy Newbrain ; By Stefano Bodrato May 2005 ; ; getkey() Wait for keypress, blinking cursor, etc.. ; ; ; $Id: fgetc_cons.asm,v 1.2 2007/05/14 12:40:46 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons .nokey rst 20h defb 39h jr c,nokey rst 20h ; Convert Key code defb 3Ah ld h,0 ld l,a ret ;ld e,0 ; already waits for ENTER, then pushes all the keys. ;rst 20h ;defb 31h ;ld h,0 ;ld l,a ;ret z88dk-1.8.ds1/libsrc/stdio/newbrain/fputc_cons.asm0000755000175000017500000000104710631471703021565 0ustar tygrystygrys; ; Basic video handling for the Grundy Newbrain ; By Stefano Bodrato May 2005 ; ; (HL)=char to display ; ; ; $Id: fputc_cons.asm,v 1.3 2007/06/06 08:43:47 stefano Exp $ ; XLIB fputc_cons .fputc_cons ld hl,2 add hl,sp ld a,(hl) cp 12 jr nz,nocls ld a,31 ; clear screen .nocls ; This fix works for 80 columns, but it wouldn't scroll anymore in default mode ; ; cp 13 ; jr nz,nocrlf ; ld a,10 ; line feed ; call doprint ; ld a,$1c ; cursor home left (13 wasn't good in 80 columns mode) ;.nocrlf .doprint ld e,0 rst 20h defb 30h ret z88dk-1.8.ds1/libsrc/stdio/newbrain/getk.asm0000755000175000017500000000042610622054317020352 0ustar tygrystygrys; ; Basic keyboard handling for the Grundy Newbrain ; By Stefano Bodrato May 2005 ; ; getk() Read key status ; ; ; $Id: getk.asm,v 1.2 2007/05/14 12:40:47 stefano Exp $ ; XLIB getk .getk ;ld e,0 rst 20h defb 38h rst 20h ; Convert Key code defb 3Ah ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/stdio/oz/0000755000175000017500000000000010765202715015541 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/oz/fgetc_cons.asm0000644000175000017500000000052207662450564020365 0ustar tygrystygrys; ; OZ 700 console library ; ; getkey() Wait for keypress ; ; $Id: fgetc_cons.asm,v 1.2 2003/05/20 16:01:56 stefano Exp $ ; ;XREF KeyBufGetPos ;XREF KeyBufPutPos ;XREF EnableKeyboard XLIB fgetc_cons LIB getk .fgetc_cons call getk ld a,l and a jr nz,fgetc_cons .kwait call getk ld a,l and a jr z,kwait ret z88dk-1.8.ds1/libsrc/stdio/oz/getk.asm0000644000175000017500000000421307721414037017175 0ustar tygrystygrys; ; OZ 700 console library ; ; getk() Read key status ; ; $Id: getk.asm,v 1.3 2003/08/22 13:18:23 dom Exp $ ; XLIB getk .getk ld a,1 out (11h),a in a,(10h) bit 6,a jr z,nosym call nocaps ld a,l and a jr z,3 sub 16 ld l,a ld de,symtab .sytablp ld a,(de) and a ret z cp l jr nz,ntsym inc de ld a,(de) ld l,a ret .ntsym inc de inc de jr sytablp .nosym and 32 ; test bit 5 jr nz,caps ld a,64 out (11h),a in a,(10h) and 8 jr z,nocaps .caps call nocaps ld a,l and a jr z,3 cp 'a' jr c,numsym sub 20h ld l,a ret .numsym cp '.' jr nz,3 ld a,':'+16 cp ',' jr nz,3 ld a,39+16 sub 16 ld l,a ret .nocaps ld c,1 .tabptr ld hl,cnvtab ld d,0 .rowloop ld a,c out (11h),a in a,(10h) push hl ld b,8 ld e,0 .increm rra jr nc,ngotbit add hl,de ld a,(hl) and a jr z,ngotbit ; SHIFT or similar.. go over pop hl ld h,0 ld l,a ret .ngotbit inc e djnz increm pop hl ld e,8 add hl,de rl c jr nc,rowloop ld hl,0 ret .cnvtab defb 27,'q', 0,'g','a', 0, 0, 0 ; 1 defb '1','w','y','h','s','z', 3, 0 ; 2 defb '2','e','u','j','d','x', 4, 0 ; 4 defb '3','r','i','k','f','c', 5, 0 ; 8 defb '4','t','o','l', 6,'v',' ', 0 ; 16 defb '5','8','p', 13, 7,'b','-', 0 ; 32 defb '6','9', 12, 0, 8,'n', 13, 0 ; 64 defb '7','0','.',',', 9,'m', 0, 0 ; 128 .symtab defb 'q' defb '+' defb 'w' defb '-' defb 'e' defb '*' defb 'r' defb '/' defb 't' defb '+' defb 'i' defb '?' defb 'o' defb '"' defb 'p' defb ';' defb 'l' defb '~' defb 'n' defb '^' defb 0 ; support@it.colt.net ; Special codes: ; 1 - shift ; 2 - 2nd ; 3 - menu ; 4 - new ; 5 - eject symbol ; 6 - left ; 7 - down ; 8 - right ; defb 27,'q', 0,'g','a', 1, 2, 0 ; 1 ; defb '1','w','y','h','s','z', 3, 0 ; 2 ; defb '2','e','u','j','d','x', 4, 0 ; 4 ; defb '3','r','i','k','f','c', 5, 0 ; 8 ; defb '4','t','o','l', 6,'v',' ', 0 ; 16 ; defb '5','8','p', 13, 7,'b','-', 0 ; 32 ; defb '6','9', 12, 1, 8,'n', 13, 0 ; 64 ; defb '7','0','.',',', 9,'m', 0, 0 ; 128 z88dk-1.8.ds1/libsrc/stdio/printk.c0000644000175000017500000000505407265604646016602 0ustar tygrystygrys/* * "Kernel" printf - bypasses files and outputs directly to console * (this is useful for debugging packages) * * djm 24/4/2000 * * -------- * $Id: printk.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #include /* * Cheating somewhat, this will cause a barf in the compiler...bigtime.. * nevermind... */ void printk(char *fmt,...) { int *ct; ct= (getarg()*2)+&fmt-4; printk1(*ct,ct-1); } /* * Once over to Small C this isn't negotiable! * Arguments go downwards instead of upwards (we push from * left to right, not right to left, so we do a - instead of a + * to step to the next one.. */ static void miniprintn(long number,unsigned char flag); int printk1(unsigned char *fmt,void *ap) { unsigned char c; unsigned char k; unsigned char *s; while ((c = *fmt++) != '\0') { if (c != '%') fputc_cons(c); else { c = *fmt++; switch (c) { case 'l': c=*fmt++; switch (c) { case 'd': case 'u': ap-=sizeof(int); miniprintn((long)*(long *)ap,c=='d'); ap -= sizeof(int); break; } break; case 'd': miniprintn((long)*(int *)ap,1); ap -= sizeof(int); break; case 'u': miniprintn((unsigned long)*(unsigned int *)ap,0); ap -= sizeof(int); break; case 's': s = *(char **)ap; while ((k = *s++) != '\0') fputc_cons(k); ap -= sizeof(char *); break; case 'c': fputc_cons(*(int *)ap); ap -= sizeof(int); break; default: fputc_cons(c); } } } return(0); } static void miniprintn(long number, unsigned char flag) { unsigned long i; if (flag && number < 0 ){ fputc_cons('-'); number = -number; } if ((i =(unsigned long) number / 10L) != 0) miniprintn(i,flag); fputc_cons(number%10+'0'); } z88dk-1.8.ds1/libsrc/stdio/printn.c0000644000175000017500000000117107265604646016601 0ustar tygrystygrys/* * Small C+ Runtime Library * * printn(int number, int radix, FILE *file) * * Liberated from an unknown source * * Added to z88dk archive 11/4/99 djm * * -------- * $Id: printn.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #include unsigned char dig[]= "0123456789ABCDEF"; printn(int number, int radix,FILE *file) { int i; if (number < 0 && radix == 10){ fputc('-', file); number = -number; } if ((i = number / radix) != 0) printn(i, radix, file); fputc(dig[number % radix], file); } z88dk-1.8.ds1/libsrc/stdio/puts.c0000644000175000017500000000043007265604646016257 0ustar tygrystygrys/* * Generic stdio library * * puts(blah) - print blah to stdout with trailing LF * * djm 2/4/2000 * * -------- * $Id: puts.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #include int puts(char *s) { fputs(s,stdout); fputc('\n',stdout); } z88dk-1.8.ds1/libsrc/stdio/puts_cons.asm0000644000175000017500000000072410701140137017620 0ustar tygrystygrys; ; Devilishly simple routines for the Spectrum ; ; puts(char *s) - put string to screen ; ; ; $Id: puts_cons.asm,v 1.1 2007/10/04 10:28:47 stefano Exp $ ; XLIB puts_cons LIB fputc_cons ; Enter in with hl holding the address of string to print .puts_cons pop bc pop hl push hl push bc .puts0 ld a,(hl) and a jr z,puts1 push hl ld e,a push de call fputc_cons pop de pop hl inc hl jr puts0 .puts1 ld e,13 push de call fputc_cons pop de ret z88dk-1.8.ds1/libsrc/stdio/rcmx000/0000755000175000017500000000000010765202715016302 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/rcmx000/cnvtab.asm0000755000175000017500000000002310571263045020255 0ustar tygrystygrys ; Placeholder... z88dk-1.8.ds1/libsrc/stdio/rcmx000/fgetc_cons.asm0000755000175000017500000000046710571263045021126 0ustar tygrystygrys; ; RCM2/3000 Stdio ; ; $Id: fgetc_cons.asm,v 1.1 2007/02/28 11:23:17 stefano Exp $ ; XLIB fgetc_cons LIB rcmx000_cnvtab XREF __recvchar .fgetc_cons ; extern int __LIB__ fgetc(FILE *fp); ; return result in HL, when done ; We ignore FILE* fp (in BC) for now call __recvchar ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/stdio/rcmx000/fputc_cons.asm0000755000175000017500000000112410571263053021145 0ustar tygrystygrys; ; Basic I/O for RCM2/3000, use serial port or so!! ; TODO: Write me!! ; ; (HL)=char to display ; ; No text scroll with this: ; simply your code will STOP when the last line is reached!! ; ; With this you'll save a bit more than 1 Kbyte. ; Useful if you want to use the 3K expansion. ; ; ; $Id: fputc_cons.asm,v 1.1 2007/02/28 11:23:23 stefano Exp $ ; XLIB fputc_cons LIB rcmx000_cnvtab XREF __sendchar .fputc_cons ; extern int __LIB__ fputc(int c, FILE *fp); ; int c is in register BC (i.e. C) ; We ignore FILE* fp (in DE) for now ld a,c call __sendchar ld hl,0 ret z88dk-1.8.ds1/libsrc/stdio/rcmx000/getk.asm0000755000175000017500000000044510571263053017741 0ustar tygrystygrys; ; RCM2/3000 Stdio ; ; $Id: getk.asm,v 1.1 2007/02/28 11:23:23 stefano Exp $ ; XLIB getk LIB rcmx000_cnvtab XREF __recvchar .getk ; extern int __LIB__ fgetc(FILE *fp); ; return result in HL, when done ; We ignore FILE* fp (in BC) for now call __recvchar ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/stdio/rcmx000/readme.txt0000755000175000017500000000006510571263053020301 0ustar tygrystygrysSupport for the Rabbit Control Modules RCM2000/3000. z88dk-1.8.ds1/libsrc/stdio/README0000644000175000017500000000154507265604646016010 0ustar tygrystygrys($Id: README,v 1.2 2001/04/13 14:13:58 stefano Exp $) The stdio library needs a couple of machine specific routines These are all located in {machine}/ directory below this one. ie z88/ for the z88 routines Also in the {machine}/ directory are other stdio routines which are non-portable eg rename/remove fputc_cons - Write a character to the console fgetc_cons - Get a character from the console fgets_cons - Read a string from console fabandon - Abandon file (can be null fn - z88's is really) fdtell - Get file position for filehandle fd (ret long) fdgetpos - Get file position into mem (ptr supplied) Other routines needed from fcntl.h open_z88 close readbyte writebyte read write lseek The _z88 routines allow the return of the explicit filename for the opened file. If you're porting then it might be a nice idea to support this concept across machines. z88dk-1.8.ds1/libsrc/stdio/sam/0000755000175000017500000000000010765202715015671 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/sam/fgetc_cons.asm0000644000175000017500000000042607265604647020522 0ustar tygrystygrys; ; SAM Coupe C Library ; ; getkey() Wait for keypress ; ; We will corrupt any register ; ; Stefano Bodrato - Mar.2001 ; ; ; $Id: fgetc_cons.asm,v 1.2 2001/04/13 14:13:59 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons call $016C ld h,0 ld l,a ret z88dk-1.8.ds1/libsrc/stdio/sam/fputc_cons.asm0000644000175000017500000000060507617701601020537 0ustar tygrystygrys; ; SAM Coup C Library ; ; Print character to the screen ; ; We will corrupt any register ; ; ; Frode Tenneb - 29/12/2002 ; ; $Id: fputc_cons.asm,v 1.3 2003/02/04 09:10:25 stefano Exp $ ; XLIB fputc_cons ; ; Entry: char to print on stack ; .fputc_cons ld hl,2 add hl,sp ld a,(hl) cp 12 ; CLS ? jr nz,nocls xor a jp $014E .nocls jp $10 z88dk-1.8.ds1/libsrc/stdio/sam/getk.asm0000644000175000017500000000044407443162506017331 0ustar tygrystygrys; ; SAM Coupe C Library ; ; getk() Read key status ; ; We will corrupt any register ; ; Stefano Bodrato - Mar.2001 ; ; ; $Id: getk.asm,v 1.3 2002/03/11 17:11:34 stefano Exp $ ; XLIB getk .getk call $0169 ld h,0 jr nz,gotkey ld l,h ret .gotkey ld l,a ret z88dk-1.8.ds1/libsrc/stdio/sms/0000755000175000017500000000000010765202715015713 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/sms/fputc_cons.asm0000755000175000017500000000174610630364751020573 0ustar tygrystygrys XLIB fputc_cons INCLUDE "sms/sms.hdr" XREF fputc_vdp_offs LIB VRamToHL .fputc_cons ld a, (fputc_vdp_offs) ld l, a ld a, (fputc_vdp_offs+1) ld h, a ; Loads char offset ld de, NameTableAddress add hl, de ; Calculates name table address call VRamToHL ld hl,2 add hl,sp ld a,(hl) cp 13 jr nz,nocrlf ; Line break ld a, (fputc_vdp_offs) ld l, a ld a, (fputc_vdp_offs+1) ld h, a ; Loads char offset ld a, l and a, $C0 ld l, a ; Calculates start of line ld de, 64 add hl, de ; Calculates address of next line ld a, l ld (fputc_vdp_offs), a ld a, h ld (fputc_vdp_offs+1), a ; Saves char offset ret ; Nothing more to do .nocrlf cp 12 ; CLS ? jr nz,nocls ; TODO: Implement CLS .nocls out ($be), a ; Outputs character ld a, (fputc_vdp_offs) ld l, a ld a, (fputc_vdp_offs+1) ld h, a ; Loads char offset inc hl inc hl ; offset += 2 ld a, l ld (fputc_vdp_offs), a ld a, h ld (fputc_vdp_offs+1), a ; Saves char offset ret z88dk-1.8.ds1/libsrc/stdio/spectrum/0000755000175000017500000000000010765202715016753 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/spectrum/fgetc_cons.asm0000644000175000017500000000054107265604650021574 0ustar tygrystygrys; ; Devilishly simple Spectrum Routines ; ; getkey() Wait for keypress ; ; 17/5/99 djm ; ; 22/3/2000 djm Rechristened getchar ; 1/4/2000 djm Rechristened fgetc_cons ; ; ; $Id: fgetc_cons.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons xor a ld (23560),a .getkey1 ld a,(23560) and a jr z,getkey1 ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/spectrum/font64.bin0000644000175000017500000000140007130401725020552 0ustar tygrystygrys"""""UU"w"w""wDww"DD"D"U"f"D"DDDD"D""""DU"w"U""w""""Dwff""DDwUUUUw"f"""w"U"Dwfff3UUwwDff3DfUU"w""DDwU"UUw"UU3f"""""D"D"wwD""D"U""fݪw"UUwUUfUfUUf3DDDD3fUUUUfwDfDDwwDfDDD"UDwU"UUwUUUw""""wUU"UUffUUDDDDDwUwwwUUwUUUUU"UUUU"fUUfDDwUUUwwwUUfUU3D"fw"""""UUUUUwUUUUU"Uwwww"UU""UUUUU"""w""DwwDDDDwDD""ww"w"""""UDDfwUwDDfUUf3DDD33UU3"UfD33DfDDD3UU3fDDfUUU"f""wU"DUffUUDDDDD3UwwwUfUUUU"UUU"fUUfDD3UU33DDDD3D"f"w"""UUUUwUUUU"Uwww"UU"UUUUU3fw"Dw3"D""3""""""f"""fUwwz88dk-1.8.ds1/libsrc/stdio/spectrum/fputc_cons.asm0000644000175000017500000002050210637523155021621 0ustar tygrystygrys; ; Spectrum C Library ; ; Print character to the screen in either 32/64 col mode ; ; We will corrupt any register ; ; Scrolling is now achieved by calling ROM3 routine 3582 ; ; We print over 24 lines at 64 columns ; ; djm 3/3/2000 ; ; ; $Id: fputc_cons.asm,v 1.5 2007/06/24 17:14:21 dom Exp $ ; XLIB fputc_cons XREF call_rom3 ; ; Entry: a= char to print ; .fputc_cons ld hl,2 add hl,sp ld a,(hl) ex af,af' ld a,(flags) and a jp z,putit_out1 ;no parameters pending ; Set up so dump into params so first param is at highest posn ld l,a ld h,0 ld de,params-1 add hl,de dec a ld (flags),a ex af,af' ld (hl),a ex af,af' and a ret nz ld hl,(flagrout) jp (hl) .putit_out1 ex af,af' bit 7,a jr z,putit_out2 ; deal with UDGs here sub 128 ld l,a ld h,0 add hl,hl add hl,hl add hl,hl .udgaddr ld de,65368 add hl,de jp print32_entry .putit_out2 cp 32 .print1 jp nc,print64 ; Control characters and 31 add a,a ;x2 ld l,a ld h,0 ld de,code_table add hl,de ld e,(hl) inc hl ld d,(hl) ld hl,(chrloc) ;most of them will need the position push de ret ;Normal print routine... ;Exit with carry set if OK.. .print64 ld l,a ld h,0 add hl,hl add hl,hl add hl,hl ld de,font-256 add hl,de exx ;Get screen address in hl from ;64 column position in bc ld bc,(chrloc) srl c ex af,af' ld a,b and 248 add a,64 ld h,a ld a,b and 7 rrca rrca rrca add a,c ld l,a ex af,af' ld a,240 jr c,gotpos ld a,15 .gotpos ld c,a exx cpl ld c,a ;c=char mask, hl=char addr ;c'=scr mask, hl'=scr addr ld b,8 .char1 ld a,(hl) .invers1 defb 0 and c inc hl exx ; screen ld b,a ld a,(hl) and c or b ld (hl),a inc h exx djnz char1 exx ld a,h dec a rrca rrca rrca and 3 or 88 ld h,a ld a,(attr) ld (hl),a .cbak ld hl,(chrloc) inc l .posncheck bit 6,l jr z,char4 .cbak1 ld l,0 inc h ld a,h cp 24 jr nz,char4 call scrollup ld hl,23*256 .char4 ld (chrloc),hl ret ; 32 column print routine..quick 'n' dirty..we take ; x posn and divide by two to get our real position .print32 sub 32 ;subtract 32 to get space = 0 ld l,a ld h,0 add hl,hl add hl,hl add hl,hl .fontaddr ld bc,15616 add hl,bc .print32_entry ld bc,(chrloc) srl c ex af,af' ld a,b and 248 add a,64 ld d,a ld a,b and 7 rrca rrca rrca add a,c ld e,a ; Screen posn in de, now get font ex af,af ld b,8 .loop32 ld a,(hl) .invers2 defb 0 ld (de),a inc d ;down screen row inc hl djnz loop32 ld a,d dec a rrca rrca rrca and 3 or 88 ld d,a ld a,(attr) ld (de),a ld hl,(chrloc) inc l inc l jp posncheck ; Ooops..ain't written this yet! ; We should scroll the screen up one character here ; Blanking the bottom row.. .scrollup call call_rom3 defw 3582 ret ; This nastily inefficient table is the code table for the routines ; Done this way for future! Expansion .code_table defw noop ; 0 - NUL defw switch ; 1 - SOH defw setfont32 ; 2 defw setudg ; 3 defw noop ; 4 defw noop ; 5 defw noop ; 6 defw noop ; 7 - BEL defw left ; 8 - BS defw right ; 9 - HT defw down ;10 - LF defw up ;11 - UP defw cls ;12 = FF (and HOME) defw cr ;13 - CR (+NL) defw noop ;14 defw noop ;15 defw setink ;16 - ink defw setpaper;17 - paper defw setflash;18 - flash defw setbright;19 - bright defw setinverse ;20 - inverse defw noop ;21 - over defw setposn ;22 defw noop ;23 defw noop ;24 defw noop ;25 defw noop ;26 defw noop ;27 defw noop ;28 defw noop ;29 defw noop ;30 defw noop ;31 ; And now the magic routines ; No operation .noop ret ; Move print position left .left ld a,l and a ret z dec l ld (chrloc),hl ret ;Move print position right .right ld a,l cp 63 ret z inc l ld (chrloc),hl ret ;Move print position up .up ld a,h and a ret z dec h ld (chrloc),hl ret ;Move print position down .down ld a,h cp 23 ret z inc h ld (chrloc),hl ret ; Clear screen and move to home .cls ld hl,16384 ld de,16385 ld bc,6144 ld (hl),l ldir ld a,(attr) ld (hl),a ld bc,767 ldir ld hl,0 ld (chrloc),hl ret ;Move to new line .cr ld a,h cp 23 jr nz,cr_1 call scrollup ld h,22 .cr_1 inc h ld l,0 ld (chrloc),hl ret ; Set attributes etc .doinverse ld a,(params) ld b,47 ;cpl rrca jr c,doinverse1 ld b,0 ;nop .doinverse1 ld a,b ld (invers1),a ld (invers2),a ret .dobright ld hl,attr ld a,(params) rrca jr c,dobright1 res 6,(hl) ret .dobright1 set 6,(hl) ret .doflash ld hl,attr ld a,(params) rrca jr c,doflash1 res 7,(hl) ret .doflash1 set 7,(hl) ret .dopaper ld hl,attr ld a,(hl) and @11000111 ld c,a ld a,(params) rlca rlca rlca and @00111000 or c ld (hl),a ret .doink ld hl,attr ld a,(hl) and @11111000 ld c,a ld a,(params) and 7 ;doesn't matter what chars were used.. or c ld (hl),a ret .dofont ld hl,(params) ld (fontaddr+1),hl ret .doudg ld hl,(params) ld (udgaddr+1),hl ret .setfont32 ld hl,dofont ld a,2 jr setparams .setudg ld hl,doudg ld a,2 jr setparams .setinverse ld hl,doinverse jr setink1 .setbright ld hl,dobright jr setink1 .setflash ld hl,doflash jr setink1 .setpaper ld hl,dopaper jr setink1 .setink ld hl,doink .setink1 ld a,1 ;number to expect .setparams ld (flags),a ld (flagrout),hl ret ; Set xy position ; Code 22,y,x (as per ZX) .setposn ld a,2 ;number to expect ld hl,doposn jr setparams ; Setting the position ; We only care .doposn ld hl,(params) ld de,$2020 and a sbc hl,de ld a,h ;y position cp 24 ret nc bit 6,l ;is x > 64 ret nz ld (chrloc),hl ret ; Switch between 64 & 32 column text .switch ld a,1 ld (flags),a ld hl,doswitch ld (flagrout),hl ret .doswitch ld a,(params) ld hl,print64 ld (print1+1),hl cp 64 ret z ld hl,print32 ld (print1+1),hl ret ; Variables ; Because we're on a Spectrum we can scatter statics all over the place! .chrloc defw 0 ; Attribute to use .attr defb 56 ; Flags..used for incoming bit sequences .flags defb 0 ; Routine to jump to when we have all the parameters .flagrout defw 0 ; Buffer for reading in parameters - 5 should be enuff ATM? .params defs 5 ; The font .font BINARY "stdio/spectrum/font64.bin" z88dk-1.8.ds1/libsrc/stdio/spectrum/getk.asm0000644000175000017500000000035007614345061020406 0ustar tygrystygrys; ; Devilishly simple Spectrum Routines ; ; getk() Read key status ; ; 17/5/99 djm ; ; ; $Id: getk.asm,v 1.3 2003/01/24 23:20:17 dom Exp $ ; XLIB getk .getk ld h,0 ld a,(23560) ld l,a and a ret z xor a ld (23560),a ret z88dk-1.8.ds1/libsrc/stdio/spectrum/README0000644000175000017500000000025007265604650017635 0ustar tygrystygrys$Id: README,v 1.2 2001/04/13 14:14:00 stefano Exp $ Spectrum specific routines for stdio No true file i/o yet but we still have a fake fabandon so closeall will work z88dk-1.8.ds1/libsrc/stdio/sprinter/0000755000175000017500000000000010765202715016757 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/sprinter/fgetc_cons.asm0000644000175000017500000000064607546324315021605 0ustar tygrystygrys;Z88 Small C Library functions, linked using the z80 module assembler ;Small C Z88 converted by Dominic Morris ; ;22/3/2000 - This was getkey() renamed to getchar ; ;1/4/2000 - Renamed to fgetc_cons ; ; ; $Id: fgetc_cons.asm,v 1.1 2002/10/01 13:53:17 dom Exp $ ; XLIB fgetc_cons .fgetc_cons ld b,$30 ;WAITKEY ld c,$35 ;K_CLEAR rst $10 ld l,e ;e= = ascii code ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/sprinter/fputc_cons.asm0000644000175000017500000000113507546553323021633 0ustar tygrystygrys; ; Small C+ Library Functions ; ; Renamed once more and rechristened for ANSIstdio ; ; This outputs a character to the console ; ; 1/4/2000 (Original Aug 98) ; ; ; ; $Id: fputc_cons.asm,v 1.2 2002/10/02 11:21:55 dom Exp $ ; XLIB fputc_cons ;Print char .fputc_cons ld hl,2 add hl,sp ld a,(hl) cp 8 jr nz,fputc_cons1 ld c,$53 ;CURSOR rst $10 ld a,e and a ret z dec e ld c,$52 ;LOCATE rst $10 ret .fputc_cons1 cp 13 jr nz,fputc_cons2 ld a,10 ld c,$5b ;PUTCHAR rst $10 ld a,13 .fputc_cons2 ld c,$5b ;PUTCHAR rst $10 ret z88dk-1.8.ds1/libsrc/stdio/sprinter/getk.asm0000644000175000017500000000056607546324315020426 0ustar tygrystygrys;Z88 Small C Library functions, linked using the z80 module assembler ;Small C Z88 converted by Dominic Morris ; ;11/3/99 djm Saved two bytes by removing useless ld h,0 ; ; ; $Id: getk.asm,v 1.1 2002/10/01 13:53:17 dom Exp $ ; XLIB getk ;Read keys .getk ld c,$31 ;SCANKEY rst $10 ld hl,0 ret nz ;no key pressed ld l,e ret z88dk-1.8.ds1/libsrc/stdio/sprinter/puts_cons.asm0000644000175000017500000000066007546324315021504 0ustar tygrystygrys; ; Small C+ Z88 Internal Routine ; Puts a string to the console - mapping \n to \n\l as we ; go and appending \n\l to the end of the line ; ; Non standard (for short programs) ; ; djm 2/4/99 ; ; ; $Id: puts_cons.asm,v 1.1 2002/10/01 13:53:17 dom Exp $ ; INCLUDE "#stdio.def" XLIB puts_cons .puts_cons pop bc pop hl push hl push bc ld c,$5c ;PCHARS rst $10 ret z88dk-1.8.ds1/libsrc/stdio/stdio_fp.c0000644000175000017500000000107507265604646017101 0ustar tygrystygrys/* * This is the table of entries for stdio * * Not actually a library routine - placed in * {z88dk}/lib/stdio_fp.asm and included by the _crt0 * code as required * * -------- * $Id: stdio_fp.c,v 1.2 2001/04/13 14:13:58 stefano Exp $ */ #define ANSI_STDIO #include struct filestr _sgioblk[FOPEN_MAX]= { { 0 , _IOSYSTEM | _IOREAD | _IOUSE , 0 }, { 0 , _IOSYSTEM | _IOWRITE | _IOUSE , 0 }, { 0 , _IOSYSTEM | _IOWRITE | _IOUSE , 0 }, { 0 , 0 , 0 }, { 0 , 0 , 0 }, { 0 , 0 , 0 }, { 0 , 0 , 0 }, { 0 , 0 , 0 }, { 0 , 0 , 0 }, { 0 , 0 , 0 } }; z88dk-1.8.ds1/libsrc/stdio/svi/0000755000175000017500000000000010765202715015712 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/svi/fgetc_cons.asm0000644000175000017500000000034007265604650020530 0ustar tygrystygrys; ; Spectravideo SVI C Library ; ; getkey() Wait for keypress ; ; Stefano Bodrato - Apr. 2001 ; ; ; $Id: fgetc_cons.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons call $3e ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/svi/fputc_cons.asm0000644000175000017500000000051007265604650020560 0ustar tygrystygrys; ; Spectravideo SVI C Library ; ; Fputc_cons ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: fputc_cons.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; XLIB fputc_cons ; ; Entry: hl = points to char ; .fputc_cons ld hl,2 add hl,sp ld a,(hl) cp 13 jr nz,nocrlf rst $18 ld a,10 .nocrlf jp $18 z88dk-1.8.ds1/libsrc/stdio/svi/getk.asm0000644000175000017500000000032507265604650017353 0ustar tygrystygrys; ; Spectravideo SVI C Library ; ; getk() Read key status ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: getk.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; XLIB getk .getk ld hl,0 ret ; I have no idea for this.. z88dk-1.8.ds1/libsrc/stdio/test/0000755000175000017500000000000010765202715016070 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/test/fgetc_cons.asm0000644000175000017500000000032010702216056020671 0ustar tygrystygrys; ; Put character to console ; ; fputc_cons(char c) ; ; ; $Id: fgetc_cons.asm,v 1.1 2007/10/07 17:49:34 dom Exp $ ; XLIB fgetc_cons INCLUDE "#test_cmds.def" .fgetc_cons ld a,CMD_READKEY rst 8 ret z88dk-1.8.ds1/libsrc/stdio/test/fputc_cons.asm0000644000175000017500000000037110702216056020730 0ustar tygrystygrys; ; Put character to console ; ; fputc_cons(char c) ; ; ; $Id: fputc_cons.asm,v 1.1 2007/10/07 17:49:34 dom Exp $ ; XLIB fputc_cons INCLUDE "#test_cmds.def" .fputc_cons ld hl,2 add hl,sp ld l,(hl) ld h,0 ld a,CMD_PRINTCHAR rst 8 ret z88dk-1.8.ds1/libsrc/stdio/test/puts_cons.asm0000644000175000017500000000072010702216056020600 0ustar tygrystygrys; ; Devilishly simple routines for the Spectrum ; ; puts(char *s) - put string to screen ; ; ; $Id: puts_cons.asm,v 1.1 2007/10/07 17:49:34 dom Exp $ ; XLIB puts_cons LIB fputc_cons ; Enter in with hl holding the address of string to print .puts_cons pop bc pop hl push hl push bc .puts0 ld a,(hl) and a jr z,puts1 push hl ld e,a push de call fputc_cons pop de pop hl inc hl jr puts0 .puts1 ld e,13 push de call fputc_cons pop de ret z88dk-1.8.ds1/libsrc/stdio/ti86/0000755000175000017500000000000010765202715015703 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ticalc/0000755000175000017500000000000010765202715016350 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ticalc/fgetc_cons.asm0000644000175000017500000000103607457364562021201 0ustar tygrystygrys; ; TI calc Routines ; ; fgetc_cons() Wait for keypress ; ; Stefano Bodrato - Dec 2000 ; ; ; $Id: fgetc_cons.asm,v 1.6 2002/04/17 21:30:26 dom Exp $ ; XLIB fgetc_cons LIB getk_decode XREF TIei XREF TIdi INCLUDE "stdio/ansi/ticalc/ticalc.inc" .fgetc_cons call TIei .kloop halt ; Power saving (?? maybe. Surely true on ti86) IF FORti83p rst $28 defw getkey ELSE IF FORti82 ld hl,($800C) push hl ENDIF call getkey IF FORti82 pop hl ld ($800C),hl ENDIF ENDIF and a jr z,kloop call TIdi jp getk_decode z88dk-1.8.ds1/libsrc/stdio/ticalc/fputc_cons.asm0000644000175000017500000000260607371460037021223 0ustar tygrystygrys; ; TI calc Routines ; ; fgetc_cons() Wait for keypress ; ; Stefano Bodrato - Apr 2001 ; ; ; $Id: fputc_cons.asm,v 1.3 2001/11/05 09:47:11 stefano Exp $ ; XLIB fputc_cons INCLUDE "stdio/ansi/ticalc/ticalc.inc" .fputc_cons ld hl,2 add hl,sp ld a,(hl) cp 12 ; CLS/FF jr nz,nocls ld b,8 .clsloop push bc IF FORti82 call $8D74 defw ti_scroll ELSE call scrollup ENDIF pop bc djnz clsloop IF FORti82 ; Nothing to do ELSE ld a,0 ld (ti_x_text),a ld (ti_y_text),a ENDIF ret ; Linefeed or Carriage return ? .nocls cp 13 ;CR jr z,docrlf cp 10 jr nz,nocrlf .docrlf IF FORti82 call $8D74 defw ti_scroll ret ELSE ld a,0 ld (ti_x_text),a ld a,(ti_y_text) cp ti_maxy_t jr z,scrollup inc a ld (ti_y_text),a ret ENDIF ; It's a char ! ; Check current position, do linefeed when necessary, and display it. .nocrlf IF FORti82 call $8D74 defw ti_putchar ret ELSE push af ld a,(ti_x_text) cp ti_maxx_t jr nz,notlimit ld a,(ti_y_text) cp ti_maxy_t jr nz,notlimit call scrollup ld a,0 ld (ti_x_text),a .notlimit pop af IF FORti83p rst $28 defw ti_putchar ret ELSE IF FORti85 call $8C09 defb ti_putchar ret ELSE jp ti_putchar ENDIF ENDIF ENDIF .scrollup IF FORti82 ; Nothing here !! ELSE IF FORti83p rst $28 defw ti_scroll ret ELSE IF FORti85 call $8C09 defb ti_scroll ret ELSE jp ti_scroll ENDIF ENDIF ENDIF z88dk-1.8.ds1/libsrc/stdio/ticalc/getk.asm0000644000175000017500000000052707457364562020025 0ustar tygrystygrys; ; TI calc Routines ; ; getk() Read key status ; ; Stefano Bodrato - Dec 2000 ; ; ; $Id: getk.asm,v 1.5 2002/04/17 21:30:26 dom Exp $ ; XLIB getk LIB getk_decode XREF TIdi XREF TIei INCLUDE "stdio/ansi/ticalc/ticalc.inc" .getk call TIei IF FORti83p rst $28 defw getkey ELSE call getkey ENDIF call TIdi jp getk_decode z88dk-1.8.ds1/libsrc/stdio/ticalc/getk_decode.asm0000644000175000017500000000430707457364562021330 0ustar tygrystygrys; ; TI calc Routines ; ; getk_decode() Translates key code ; ; Stefano Bodrato - Dec 2000 ; ; ; $Id: getk_decode.asm,v 1.5 2002/04/17 21:30:26 dom Exp $ ; XLIB getk_decode INCLUDE "stdio/ansi/ticalc/ticalc.inc" .getk_decode IF FORti82 ; **** If we have a TI82 and we use CRASH, **** ; **** letters and numbers are in sequence **** ; ; Numbers. cp 143 ; >= '0' ? jr c,isntnum cp 153 jr nc,isntnum ; < '9'+1 sub a,95 ; Ok, re-code to the ASCII charset jr setout .isntnum cp 155 ; Between A and Z ? jr c,isntupper cp 181 jr nc,isntupper sub a,90 ; Ok, re-code to the ASCII charset jr setout .isntupper ; **** End of TI82 specific key handling **** ENDIF IF FORti86 ; **** We have a TI86. Letters and numbers are in sequence **** ; ; Numbers. (XZ81 has the same number coding !) cp 28 ; Between 0 and 9 ? jr c,isntnum cp 38 jr nc,isntnum add a,20 ; Ok, re-code to the ASCII charset jr setout .isntnum cp $28 ; Between A and Z ? jr c,isntupper cp $42 jr nc,isntupper add a,25 ; Ok, re-code to the ASCII charset jr setout .isntupper cp $42 ; Between a and z ? jr c,isntlower cp $5C jr nc,isntlower dec a ; Ok, re-code to the ASCII charset jr setout .isntlower ; **** End of TI86 specific key handling **** ENDIF ; - **** ALPHA KEY **** - Switch Numeric / Alphanumeric key tables - cp TIALPHAKEY jr nz,no2nd ld a,(KFlag) xor 255 ld (KFlag),a jr z,KFReset ld hl,TiKeyTab1 ld (KTabPointer+1),hl jr KFSet .KFReset ld hl,TiKeyTab2 ld (KTabPointer+1),hl .KFSet xor a jr setout .no2nd ; - **** ALPHA KEY **** - END - .KTabPointer ld hl,TiKeyTab1 .symloop cp (hl) jr z,chfound inc hl inc hl push af xor a or (hl) jr z,isntsym pop af jr symloop .chfound inc hl ld a,(hl) jr setout .isntsym pop af .setout ld l,a ld h,0 ret .KFlag defb 0 ; TI82 ROM key handler ;IF FORti82 ; INCLUDE "stdio/ticalc/ti82tab.inc" ;ENDIF ; CRASH re-written key handler IF FORti82 INCLUDE "stdio/ticalc/ti82crtab.inc" ENDIF IF FORti83 INCLUDE "stdio/ticalc/ti83tab.inc" ENDIF IF FORti83p INCLUDE "stdio/ticalc/ti83tab.inc" ENDIF IF FORti85 INCLUDE "stdio/ticalc/ti85tab.inc" ENDIF IF FORti86 INCLUDE "stdio/ticalc/ti86tab.inc" ENDIF z88dk-1.8.ds1/libsrc/stdio/ticalc/ti82crtab.inc0000644000175000017500000000114507457364562020663 0ustar tygrystygrys; ; TI 82 Key Table ; ; ; $Id: ti82crtab.inc,v 1.3 2002/04/17 21:30:26 dom Exp $ ; .TiKeyTab1 defb $04 ;Down defb 10 defb $02 ;Left defb 8 defb $01 ;Right defb 9 defb $03 ;Up defb 11 defb $05 ;ENTER defb 13 defb $7 ;DEL defb 8 defb 129; K_PLUS defb '+' defb 130; K_MINUS defb '-' defb 131 defb '*' defb 132 defb '/' defb 133 defb '^' defb 134 defb '(' defb 135 defb ')' defb 140 defb ',' defb 142 defb '.' defb 237 defb '(' defb 238 defb ')' defb 0 .TiKeyTab2 defb $04 ;Down defb 10 defb $02 ;Left defb 8 defb $01 ;Right defb 9 defb $03 ;Up defb 11 defb $05 ;ENTER defb 13 defb $7 ;DEL defb 8 defb 0 z88dk-1.8.ds1/libsrc/stdio/ticalc/ti82tab.inc0000644000175000017500000000260207457364562020335 0ustar tygrystygrys; ; TI 82 Key Table ; ; ; $Id: ti82tab.inc,v 1.3 2002/04/17 21:30:26 dom Exp $ ; .TiKeyTab1 defb $01 ;Down defb 10 defb $02 ;Left defb 8 defb $03 ;Right defb 9 defb $04 ;Up defb 11 defb $09 ;ENTER defb 13 defb $0A defb '+' defb $0B defb '-' defb $0C defb '*' defb $0D defb '/' defb $0E defb '^' ; G_CLEAR $0F CLEAR ; G_NEG $11 (-) defb $12 defb '3' defb $13 defb '6' defb $14 defb '9' defb $15 defb ')' defb $19 defb '.' defb $1A defb '2' defb $1B defb '5' defb $1C defb '8' defb $1D defb '(' defb $21 defb '0' defb $22 defb '1' defb $23 defb '4' defb $24 defb '7' defb $25 defb ',' ; G_ON $29 ON defb $38 ;DEL defb 8 defb 0 .TiKeyTab2 defb $01 ;Down defb 10 defb $02 ;Left defb 8 defb $03 ;Right defb 9 defb $04 ;Up defb 11 defb $09 ;ENTER defb 13 defb $0A defb '"' defb $0B defb 'W' defb $0C defb 'R' defb $0D defb 'M' defb $0E defb 'H' ; G_CLEAR $0F CLEAR ; G_NEG $11 (-) defb $11 defb '?' defb $12 defb '!' defb $13 defb 'V' defb $14 defb 'Q' defb $15 defb 'L' defb $16 defb 'G' defb $19 defb ':' defb $1A defb 'Z' defb $1B defb 'U' defb $1C defb 'P' defb $1D defb 'K' defb $1E defb 'F' defb $1F defb 'C' defb $21 defb ' ' defb $22 defb 'Y' defb $23 defb 'T' defb $24 defb 'O' defb $25 defb 'J' defb $26 defb 'E' defb $27 defb 'B' defb $2F defb 'A' defb $2E defb 'D' defb $2D defb 'I' defb $2C defb 'N' defb $2B defb 'S' defb $2A defb 'X' ; G_ON $29 ON defb $38 ;DEL defb 8 defb 0 z88dk-1.8.ds1/libsrc/stdio/ticalc/ti83tab.inc0000644000175000017500000000237507457364562020345 0ustar tygrystygrys; ; TI 83 Key Table ; ; ; $Id: ti83tab.inc,v 1.3 2002/04/17 21:30:26 dom Exp $ ; .TiKeyTab1 defb $04 ;Down defb 10 defb $02 ;Left defb 8 defb $01 ;Right defb 9 defb $03 ;Up defb 11 defb $05 ;ENTER defb 13 defb $80 ;kAdd defb '+' defb $81 defb '-' defb $82 defb '*' defb $83 defb '/' defb $84 defb '^' defb $8E defb '0' defb $8F defb '1' defb $90 defb '2' defb $91 defb '3' defb $92 defb '4' defb $93 defb '5' defb $94 defb '6' defb $95 defb '7' defb $96 defb '8' defb $97 defb '9' defb $86 defb ')' defb $8D defb '.' defb $85 defb '(' defb $8B defb ',' defb $0A ;DEL defb 8 ;---- defb $04 ;AlphaDown defb 10 defb $03 ;AlphaUp defb 11 defb $06 ;AlphaENTER defb 13 defb $CB defb 39 ;quote ' defb $C6 defb ':' ;colon defb $99 defb ' ' ;SPACE defb $9A defb 'A' defb $9B defb 'B' defb $9C defb 'C' defb $9D defb 'D' defb $9E defb 'E' defb $9F defb 'F' defb $A0 defb 'G' defb $A1 defb 'H' defb $A2 defb 'I' defb $A3 defb 'J' defb $A4 defb 'K' defb $A5 defb 'L' defb $A6 defb 'M' defb $A7 defb 'N' defb $A8 defb 'O' defb $A9 defb 'P' defb $AA defb 'Q' defb $AB defb 'R' defb $AC defb 'S' defb $AD defb 'T' defb $AE defb 'U' defb $AF defb 'V' defb $B0 defb 'W' defb $B1 defb 'X' defb $B2 defb 'Y' defb $B3 defb 'Z' defb 0 .TiKeyTab2 defb $05 ;ENTER defb 13 defb 0 z88dk-1.8.ds1/libsrc/stdio/ticalc/ti85tab.inc0000644000175000017500000000227407457364562020345 0ustar tygrystygrys; ; TI 85 Key Table ; ; ; $Id: ti85tab.inc,v 1.3 2002/04/17 21:30:26 dom Exp $ ; .TiKeyTab1 defb $01 ;Down defb 10 defb $02 ;Left defb 8 defb $03 ;Right defb 9 defb $04 ;Up defb 11 defb $09 ;ENTER defb 13 defb $0A defb '+' defb $0B defb '-' defb $0C defb '*' defb $0D defb '/' defb $0E defb '^' defb $0F ;Clear defb 8 defb $20 ;DEL defb 8 defb $12 defb '3' defb $13 defb '6' defb $14 defb '9' defb $15 defb ')' defb $19 defb '.' defb $1A defb '2' defb $1B defb '5' defb $1C defb '8' defb $1D defb '(' defb $21 defb '0' defb $22 defb '1' defb $23 defb '4' defb $24 defb '7' defb $2B defb ',' defb 0 .TiKeyTab2 defb $09 ;ENTER defb 13 defb $0A defb 'X' defb $0B defb 'T' defb $0C defb 'O' defb $0D defb 'J' defb $0E defb 'E' defb $0F ;Clear defb 12 defb $20 ;DEL defb 8 defb $11 defb ' ' defb $12 defb 'W' defb $13 defb 'S' defb $14 defb 'N' defb $15 defb 'I' defb $16 defb 'D' defb $19 defb 'Z' defb $1A defb 'V' defb $1B defb 'R' defb $1C defb 'M' defb $1D defb 'H' defb $1E defb 'C' defb $21 defb 'Y' defb $22 defb 'U' defb $23 defb 'Q' defb $24 defb 'L' defb $25 defb 'G' defb $26 defb 'B' defb $2A defb '=' defb $2B defb 'P' defb $2C defb 'K' defb $2D defb 'F' defb $2E defb 'A' defb 0 z88dk-1.8.ds1/libsrc/stdio/ticalc/ti86tab.inc0000644000175000017500000000104407457364562020340 0ustar tygrystygrys; ; TI 86 Key Table ; ; ; $Id: ti86tab.inc,v 1.3 2002/04/17 21:30:26 dom Exp $ ; .TiKeyTab1 defb $04 ;Down defb 10 defb $02 ;Left defb 8 defb $01 ;Right defb 9 defb $03 ;Up defb 11 defb $06 ;ENTER defb 13 defb $05 defb ':' defb $08 ;clear defb 12 defb $09 ;del defb 8 defb $0C defb '+' defb $0D defb '-' defb $0E defb '*' defb $0F defb '/' defb $10 defb '^' defb $11 defb '(' defb $12 defb ')' defb $13 defb '[' defb $14 defb ']' defb $15 defb '=' defb $18 defb ',' defb $1B defb '.' defb $27 ;space defb ' ' defb 0 .TiKeyTab2 defb 0 z88dk-1.8.ds1/libsrc/stdio/ts2068/0000755000175000017500000000000010765202715016057 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/ts2068/fputc_cons.asm0000755000175000017500000002042610600320741020717 0ustar tygrystygrys; ; Spectrum C Library - TS2068 version ; ; Print character to the screen in either 32/64 col mode ; ; We will corrupt any register ; ; Scrolling is achieved by calling ROM routine $939 ; ; We print over 24 lines at 64 columns ; ; djm 3/3/2000 ; ; ; $Id: fputc_cons.asm,v 1.1 2007/03/21 21:21:37 stefano Exp $ ; XLIB fputc_cons ; ; Entry: a= char to print ; .fputc_cons ld hl,2 add hl,sp ld a,(hl) ex af,af' ld a,(flags) and a jp z,putit_out1 ;no parameters pending ; Set up so dump into params so first param is at highest posn ld l,a ld h,0 ld de,params-1 add hl,de dec a ld (flags),a ex af,af' ld (hl),a ex af,af' and a ret nz ld hl,(flagrout) jp (hl) .putit_out1 ex af,af' bit 7,a jr z,putit_out2 ; deal with UDGs here sub 128 ld l,a ld h,0 add hl,hl add hl,hl add hl,hl .udgaddr ld de,65368 add hl,de jp print32_entry .putit_out2 cp 32 .print1 jp nc,print64 ; Control characters and 31 add a,a ;x2 ld l,a ld h,0 ld de,code_table add hl,de ld e,(hl) inc hl ld d,(hl) ld hl,(chrloc) ;most of them will need the position push de ret ;Normal print routine... ;Exit with carry set if OK.. .print64 ld l,a ld h,0 add hl,hl add hl,hl add hl,hl ld de,font-256 add hl,de exx ;Get screen address in hl from ;64 column position in bc ld bc,(chrloc) srl c ex af,af' ld a,b and 248 add a,64 ld h,a ld a,b and 7 rrca rrca rrca add a,c ld l,a ex af,af' ld a,240 jr c,gotpos ld a,15 .gotpos ld c,a exx cpl ld c,a ;c=char mask, hl=char addr ;c'=scr mask, hl'=scr addr ld b,8 .char1 ld a,(hl) .invers1 defb 0 and c inc hl exx ; screen ld b,a ld a,(hl) and c or b ld (hl),a inc h exx djnz char1 exx ld a,h dec a rrca rrca rrca and 3 or 88 ld h,a ld a,(attr) ld (hl),a .cbak ld hl,(chrloc) inc l .posncheck bit 6,l jr z,char4 .cbak1 ld l,0 inc h ld a,h cp 24 jr nz,char4 call scrollup ld hl,23*256 .char4 ld (chrloc),hl ret ; 32 column print routine..quick 'n' dirty..we take ; x posn and divide by two to get our real position .print32 sub 32 ;subtract 32 to get space = 0 ld l,a ld h,0 add hl,hl add hl,hl add hl,hl .fontaddr ld bc,15616 add hl,bc .print32_entry ld bc,(chrloc) srl c ex af,af' ld a,b and 248 add a,64 ld d,a ld a,b and 7 rrca rrca rrca add a,c ld e,a ; Screen posn in de, now get font ex af,af ld b,8 .loop32 ld a,(hl) .invers2 defb 0 ld (de),a inc d ;down screen row inc hl djnz loop32 ld a,d dec a rrca rrca rrca and 3 or 88 ld d,a ld a,(attr) ld (de),a ld hl,(chrloc) inc l inc l jp posncheck ; Ooops..ain't written this yet! ; We should scroll the screen up one character here ; Blanking the bottom row.. .scrollup jp $939 ; This nastily inefficient table is the code table for the routines ; Done this way for future! Expansion .code_table defw noop ; 0 - NUL defw switch ; 1 - SOH defw setfont32 ; 2 defw setudg ; 3 defw noop ; 4 defw noop ; 5 defw noop ; 6 defw noop ; 7 - BEL defw left ; 8 - BS defw right ; 9 - HT defw down ;10 - LF defw up ;11 - UP defw cls ;12 = FF (and HOME) defw cr ;13 - CR (+NL) defw noop ;14 defw noop ;15 defw setink ;16 - ink defw setpaper;17 - paper defw setflash;18 - flash defw setbright;19 - bright defw setinverse ;20 - inverse defw noop ;21 - over defw setposn ;22 defw noop ;23 defw noop ;24 defw noop ;25 defw noop ;26 defw noop ;27 defw noop ;28 defw noop ;29 defw noop ;30 defw noop ;31 ; And now the magic routines ; No operation .noop ret ; Move print position left .left ld a,l and a ret z dec l ld (chrloc),hl ret ;Move print position right .right ld a,l cp 63 ret z inc l ld (chrloc),hl ret ;Move print position up .up ld a,h and a ret z dec h ld (chrloc),hl ret ;Move print position down .down ld a,h cp 23 ret z inc h ld (chrloc),hl ret ; Clear screen and move to home .cls ld hl,16384 ld de,16385 ld bc,6144 ld (hl),l ldir ld a,(attr) ld (hl),a ld bc,767 ldir ld hl,0 ld (chrloc),hl ret ;Move to new line .cr ld a,h cp 23 jr nz,cr_1 call scrollup ld h,22 .cr_1 inc h ld l,0 ld (chrloc),hl ret ; Set attributes etc .doinverse ld a,(params) ld b,47 ;cpl rrca jr c,doinverse1 ld b,0 ;nop .doinverse1 ld a,b ld (invers1),a ld (invers2),a ret .dobright ld hl,attr ld a,(params) rrca jr c,dobright1 res 6,(hl) ret .dobright1 set 6,(hl) ret .doflash ld hl,attr ld a,(params) rrca jr c,doflash1 res 7,(hl) ret .doflash1 set 7,(hl) ret .dopaper ld hl,attr ld a,(hl) and @11000111 ld c,a ld a,(params) rlca rlca rlca and @00111000 or c ld (hl),a ret .doink ld hl,attr ld a,(hl) and @11111000 ld c,a ld a,(params) and 7 ;doesn't matter what chars were used.. or c ld (hl),a ret .dofont ld hl,(params) ld (fontaddr+1),hl ret .doudg ld hl,(params) ld (udgaddr+1),hl ret .setfont32 ld hl,dofont ld a,2 jr setparams .setudg ld hl,doudg ld a,2 jr setparams .setinverse ld hl,doinverse jr setink1 .setbright ld hl,dobright jr setink1 .setflash ld hl,doflash jr setink1 .setpaper ld hl,dopaper jr setink1 .setink ld hl,doink .setink1 ld a,1 ;number to expect .setparams ld (flags),a ld (flagrout),hl ret ; Set xy position ; Code 22,y,x (as per ZX) .setposn ld a,2 ;number to expect ld hl,doposn jr setparams ; Setting the position ; We only care .doposn ld hl,(params) ld de,$2020 and a sbc hl,de ld a,h ;y position cp 24 ret nc bit 6,l ;is x > 64 ret nz ld (chrloc),hl ret ; Switch between 64 & 32 column text .switch ld a,1 ld (flags),a ld hl,doswitch ld (flagrout),hl ret .doswitch ld a,(params) ld hl,print64 ld (print1+1),hl cp 64 ret z ld hl,print32 ld (print1+1),hl ret ; Variables ; Because we're on a Spectrum we can scatter statics all over the place! .chrloc defw 0 ; Attribute to use .attr defb 56 ; Flags..used for incoming bit sequences .flags defb 0 ; Routine to jump to when we have all the parameters .flagrout defw 0 ; Buffer for reading in parameters - 5 should be enuff ATM? .params defs 5 ; The font .font BINARY "stdio/spectrum/font64.bin" z88dk-1.8.ds1/libsrc/stdio/ungetc.c0000644000175000017500000000135007736631120016541 0ustar tygrystygrys/* * New stdio functions for Small C+ * * djm 4/5/99 * * -------- * $Id: ungetc.c,v 1.3 2003/10/01 20:00:16 dom Exp $ */ #define ANSI_STDIO #define STDIO_ASM #include int ungetc(int c, FILE *fp) { #ifdef Z80 #asm pop de ;ret pop ix ;fp pop bc ;c push bc push ix push de ld hl,-1 ;EOF ld a,(ix+fp_flags) ld b,a and _IOUSE ret z ;not being used ld a,b and _IOEOF |_IOWRITE ret nz ;cant push back after EOF (or for write stream) ld a,(ix+fp_ungetc) and a ret nz ld (ix+fp_ungetc),c ;store the char ld l,c ;return it ld h,0 #endasm #else if (fp == 0 || c == EOF || fp->ungetc || fp->flags&_IOWRITE ) return(EOF); fp->ungetc=(unsigned char)c; return(c); #endif } z88dk-1.8.ds1/libsrc/stdio/unused/0000755000175000017500000000000010765202715016414 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/unused/minifprintf.c0000644000175000017500000000103007265604650021104 0ustar tygrystygrys/* * Printf style formatting. (Borrowed from MicroEmacs by Dave Conroy.) * A lot smaller than the full fledged printf. * * Liberated once more and inserted into Small C+ 29/4/99 djm * * $Id: minifprintf.c,v 1.2 2001/04/13 14:14:00 stefano Exp $ */ #define ANSI_STDIO #include /* * Cheating somewhat, this will cause a barf in the compiler...bigtime.. * nevermind... */ void minifprintf(FILE *fp, char *fmt,...) { int *ct; ct= (getarg()*2)+&fmt-4; minivfprintf(*ct,*(ct-1),ct-2); } z88dk-1.8.ds1/libsrc/stdio/unused/miniprintf.c0000644000175000017500000000101307265604650020737 0ustar tygrystygrys/* * Printf style formatting. (Borrowed from MicroEmacs by Dave Conroy.) * A lot smaller than the full fledged printf. * * Liberated once more and inserted into Small C+ 29/4/99 djm * * $Id: miniprintf.c,v 1.2 2001/04/13 14:14:00 stefano Exp $ */ #define ANSI_STDIO #include /* * Cheating somewhat, this will cause a barf in the compiler...bigtime.. * nevermind... */ void miniprintf(char *fmt,...) { int *ct; ct= (getarg()*2)+&fmt-4; minivfprintf(stdout,*ct,ct-1); } z88dk-1.8.ds1/libsrc/stdio/unused/minisprintf.c0000644000175000017500000000137707265604650021137 0ustar tygrystygrys/* * Minix source: src/commands/simple/uud.c * * Printf style formatting. (Borrowed from MicroEmacs by Dave Conroy.) * A lot smaller than the full fledged printf. * * Liberated once more and inserted into Small C+ 29/4/99 djm * * This routine is quite long also, hopefully it'll become a lot * shorter with the new io routines * * New I/O version, we fake up a file channel which is in fact * a string djm 1/4/2000 * * $Id: minisprintf.c,v 1.2 2001/04/13 14:14:00 stefano Exp $ */ #define ANSI_STDIO #include void minisprintf(char *str,char *fmt,...) { FILE temp; int *ct; ct= (getarg()*2)+&fmt-4; temp.desc.ptr=*ct; temp.flags=_IOWRITE|_IOSTRING; minivfprintf(temp,*(ct-1),ct-2); *(temp.desc.ptr)=0; } z88dk-1.8.ds1/libsrc/stdio/unused/minivsprintf.c0000644000175000017500000000051107265604650021312 0ustar tygrystygrys/* * Generic z88dk stdio library * * * $Id: minivsprintf.c,v 1.2 2001/04/13 14:14:00 stefano Exp $ */ #define ANSI_STDIO #include void minivsprintf(char *str,unsigned char *a, void *b) { FILE temp; temp.desc.ptr=str; temp.flags=_IOWRITE|_IOSTRING; minivfprintf(temp,a,b); *(temp.desc.ptr)=0; } z88dk-1.8.ds1/libsrc/stdio/vfprintf_mini.c0000644000175000017500000000507407434024031020125 0ustar tygrystygrys/* * An alternate miniprintf core which can print * longs and unsigned values correctly. * * djm 26/2/2000 * * Error in last digit - I'm not sure why - this occurs * for *large* numbers.. * * djm 3/3/2000 * This routine is infact a vfprintf, so naming as such... * * -------- * $Id: vfprintf_mini.c,v 1.3 2002/02/17 22:00:57 dom Exp $ */ #define ANSI_STDIO #include /* * Once over to Small C this isn't negotiable! * Arguments go downwards instead of upwards (we push from * left to right, not right to left, so we do a - instead of a + * to step to the next one.. */ static void miniprintn(long number, FILE *fil, unsigned char flag); int vfprintf_mini(FILE *fp, unsigned char *fmt,void *ap) { unsigned char c; unsigned char k; unsigned char *s; while ((c = *fmt++) != '\0') { if (c != '%') fputc(c,fp); else { c = *fmt++; switch (c) { case 'l': c=*fmt++; switch (c) { case 'd': case 'u': ap-=sizeof(int); miniprintn((long)*(long *)ap,fp,c=='d'); ap -= sizeof(int); break; } break; case 'd': miniprintn((long)*(int *)ap,fp,1); ap -= sizeof(int); break; case 'u': miniprintn((unsigned long)*(unsigned int *)ap,fp,0); ap -= sizeof(int); break; case 's': s = *(char **)ap; while ((k = *s++) != '\0') fputc(k,fp); ap -= sizeof(char *); break; case 'c': fputc(*(int *)ap,fp); ap -= sizeof(int); break; default: fputc(c,fp); } } } return(0); } static void miniprintn(long number, FILE *file, unsigned char flag) { unsigned long i; if (flag && number < 0 ){ fputc('-', file); number = -number; } if ((i =(unsigned long) number / 10L) != 0) miniprintn(i,file,flag); fputc((unsigned long)number%10+'0', file); } z88dk-1.8.ds1/libsrc/stdio/vz200/0000755000175000017500000000000010765202715015772 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/vz200/fgetc_cons.asm0000644000175000017500000000070107265604650020611 0ustar tygrystygrys; ; Devilishly simple VZ Routines ; ; getkey() Wait for keypress ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: fgetc_cons.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; XLIB fgetc_cons .fgetc_cons ld b,50 ; Horrible workaround... .sillyloop push bc call 12020 ; Wait for Key release pop bc and a djnz sillyloop jr nz,fgetc_cons .fgetc_cons1 call 12020 ; Wait for Key press, now and a jr z,fgetc_cons1 ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/vz200/fputc_cons.asm0000644000175000017500000000150307736254620020644 0ustar tygrystygrys; ; VZ C Library ; ; Print character to the screen ; ; We will corrupt any register ; ; We print over 16 lines at 32 columns ; ; Stefano Bodrato - Apr.2000 ; ; ; $Id: fputc_cons.asm,v 1.3 2003/09/30 10:23:12 stefano Exp $ ; XLIB fputc_cons ; ; Entry: hl points char to print ; ; 193 Inverse characters starting from "@". ; 64 "@" char (as normal). ; 127-192 Pseudo-Graphics Chars (like ZX81) .fputc_cons ld hl,2 add hl,sp ld a,(hl) cp 12 jr nz,nocls ld a,0 ld (6800h),a ; force TEXT mode jp 457 .nocls ; Some undercase text? Transform in UPPER ! cp 97 jr c,nounder sub 32 jr setout .nounder ; Transform the UPPER to INVERSE TEXT ; Naah! That was orrible! ;cp 65 ;jr c,noupper ;add a,128 .noupper ; Some more char remapping can stay here... .setout call 826 ret z88dk-1.8.ds1/libsrc/stdio/vz200/getk.asm0000644000175000017500000000035207265604650017433 0ustar tygrystygrys; ; Devilishly simple VZ Routines ; ; getk() Read key status ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: getk.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; XLIB getk .getk call 12020 ;scan keyboard once ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/vz200/readme.txt0000644000175000017500000000117107265604650017775 0ustar tygrystygrys$Id: readme.txt,v 1.2 2001/04/13 14:14:00 stefano Exp $ How pass the code to the VZ emulator. - Get the VZ emulator from: http://www.powerup.com.au/~intertek/VZ200/vz.htm - Get the utilities, also - Set the environment variables correctly - Compile your code (to a.bas) - Use the rbinary utility (Rbinary.exe a.bas a.vz) - Run the emulator - Type: POKE 30862,0:POKE 30863,128 - Press F10, then 1 (Load Program) - Chose a.vz - Return to the emulator (press ENTER) - Type: X=USR(0) Enjoy it ! The most difficult thing is to "understand" the VZ keyboard. It is also possible to create a .WAV file for passing the program on tape. z88dk-1.8.ds1/libsrc/stdio/z88/0000755000175000017500000000000010765202715015542 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/z88/fgetc_cons.asm0000644000175000017500000000111107265604650020355 0ustar tygrystygrys;Z88 Small C Library functions, linked using the z80 module assembler ;Small C Z88 converted by Dominic Morris ; ;22/3/2000 - This was getkey() renamed to getchar ; ;1/4/2000 - Renamed to fgetc_cons ; ; ; $Id: fgetc_cons.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; INCLUDE "#stdio.def" XLIB fgetc_cons LIB getcmd ;process command sequence .fgetc_cons .gkloop call_oz(os_in) jr c,gkloop and a jp z,getcmd ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/z88/fgets_cons.asm0000644000175000017500000000464407615016544020411 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; 22 August 1998 ** UNTESTED ** ; ; 11/3/99 Revised to allow input from stdin ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; ; Is this better now garry?!?! djm 1/4/2000 ; ; Now goes back to the correct print position ; ; ; $Id: fgets_cons.asm,v 1.3 2003/01/26 17:39:48 dom Exp $ ; INCLUDE "#stdio.def" INCLUDE "#syspar.def" XLIB fgets_cons XREF processcmd ; ; Read a string from the console ; .fgets_cons xor a ld bc,NQ_Wcur call_oz(os_nq) ;gives x in c, y in b push bc ;keep it ld hl,4 add hl,sp ld b,(hl) ;backwards cos OZ wants length in b inc hl ld a,b or (hl) ;high byte of to read jr z,fgets_abort ;none required inc hl ;step up to buffer ld e,(hl) ;buffer inc hl ld d,(hl) ld c,0 ;cursor position ld a,8 ;allow return of ctrl chars dec b ;decrement count so we can put in a \n .loopyloo push de ;preserve buffer call_oz(gn_sip) pop hl push af cp $80 jr nc,fgets_gotcmd ; trapped a cmd pop af jr nc,fgets_stripeol jr fgets_abort ; return hl=0 - error .fgets_gotcmd pop af call processcmd .fgets_abort ld hl,0 .fgets_out pop bc ;xy posn ret .fgets_stripeol cp 1 ;escape jr z,fgets_abort cp 13 ;terminating char jr nz,fgets_unknown ;exit (NULL set by gn_sip) ; We now have to insert a \n into the line push hl ;save hl ld c,b ld b,0 add hl,bc ;points to one beyond terminating NULL ld (hl),0 ;terminating null dec hl ld (hl),13 ;put in the \n pop hl ;get start of string back jr fgets_out .fgets_unknown ; Okay, unexpected thing, so go back in ; We've got ATP: hl=buffer ; b=line length (inputted) ; c=cursor position pop de ;xy posn push hl ;preserve stuff push bc ld hl,xystr call_oz(gn_sop) ld a,e add a,32 call_oz(os_out) ld a,d add a,32 call_oz(os_out) pop bc pop hl push de ;keep xy posn on the stack once more ex de,hl ;de=buffer now ld hl,4 ;cos we now have xy posn on stack add hl,sp ld b,(hl) ;max length of buffer ld a,8 | 1 ;return ctrl + buffer got data jr loopyloo .xystr defb 1,'3','@',0 z88dk-1.8.ds1/libsrc/stdio/z88/fputc_cons.asm0000644000175000017500000000104407265604650020413 0ustar tygrystygrys; ; Small C+ Library Functions ; ; Renamed once more and rechristened for ANSIstdio ; ; This outputs a character to the console ; ; 1/4/2000 (Original Aug 98) ; ; ; ; $Id: fputc_cons.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; INCLUDE "#stdio.def" XLIB fputc_cons ;Print char .fputc_cons ld hl,2 add hl,sp ld a,(hl) cp 13 jr z,putchar1 call_oz(os_out) ld l,a ld h,0 ret .putchar1 call_oz(gn_nln) ld hl,13 ret z88dk-1.8.ds1/libsrc/stdio/z88/getcmd.asm0000644000175000017500000000123407265604650017514 0ustar tygrystygrys; ; Routine to handle menu options ; ; Called from getk() getkey() ; ; We've just read in 0 from os_*in so we need to get the command ; code - this should never occur from BASIC, so the basic crt0 ; file can just be a ret ; ; ; $Id: getcmd.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; XLIB getcmd XREF processcmd INCLUDE "#stdio.def" .getcmd call_oz(os_in) ld l,a ;hl=0 no key pressed if exit ld h,0 and a ret z cp $B1 ;[]ENTER ret nc ;command code ret with code jp processcmd ; in crt0 z88dk-1.8.ds1/libsrc/stdio/z88/getk.asm0000644000175000017500000000102307265604650017177 0ustar tygrystygrys;Z88 Small C Library functions, linked using the z80 module assembler ;Small C Z88 converted by Dominic Morris ; ;11/3/99 djm Saved two bytes by removing useless ld h,0 ; ; ; $Id: getk.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; INCLUDE "#stdio.def" XLIB getk ;Read keys LIB getcmd .getk ld bc,0 call_oz(os_tin) ld hl,0 ret c and a jp z,getcmd ld l,a ret z88dk-1.8.ds1/libsrc/stdio/z88/gets.asm0000644000175000017500000000367707615016544017226 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; 22 August 1998 ** UNTESTED ** ; ; 11/3/99 Revised to allow input from stdin ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; ; Is this better now garry?!?! djm 1/4/2000 ; ; Now goes back to the correct print position ; ; ; $Id: gets.asm,v 1.1 2003/01/26 17:39:48 dom Exp $ ; INCLUDE "#stdio.def" INCLUDE "#syspar.def" XLIB gets XREF processcmd ; ; Read a string from the console - this is limited to 255 characters ; .gets xor a ld bc,NQ_Wcur call_oz(os_nq) ;gives x in c, y in b push bc ;keep it ld hl,4 add hl,sp ld e,(hl) ;buffer inc hl ld d,(hl) ld c,0 ;cursor position ld a,8 ;allow return of ctrl chars ld b,255 ;max length we can read .loopyloo push de ;preserve buffer call_oz(gn_sip) pop hl push af cp $80 jr nc,gets_gotcmd ; trapped a cmd pop af jr nc,gets_stripeol jr gets_abort ; return hl=0 - error .gets_gotcmd pop af call processcmd .gets_abort ld hl,0 .gets_out pop bc ;xy posn ret .gets_stripeol cp 1 ;escape jr z,gets_abort cp 13 ;terminating char jr z,gets_out ;exit (NULL set by gn_sip) ; Okay, unexpected thing, so go back in ; We've got ATP: hl=buffer ; b=line length (inputted) ; c=cursor position pop de ;xy posn push hl ;preserve stuff push bc ld hl,xystr call_oz(gn_sop) ld a,e add a,32 call_oz(os_out) ld a,d add a,32 call_oz(os_out) pop bc pop hl push de ;keep xy posn on the stack once more ex de,hl ;de=buffer now ld hl,4 ;cos we now have xy posn on stack add hl,sp ld b,(hl) ;max length of buffer ld a,8 | 1 ;return ctrl + buffer got data jr loopyloo .xystr defb 1,'3','@',0 z88dk-1.8.ds1/libsrc/stdio/z88/Makefile0000644000175000017500000000025407555321705017207 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.4 2002/10/22 19:15:17 dom Exp $ # all: echo '' clean: $(RM) *.o* *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/stdio/z88/puts_cons.asm0000644000175000017500000000137507265604650020274 0ustar tygrystygrys; ; Small C+ Z88 Internal Routine ; Puts a string to the console - mapping \n to \n\l as we ; go and appending \n\l to the end of the line ; ; Non standard (for short programs) ; ; djm 2/4/99 ; ; ; $Id: puts_cons.asm,v 1.2 2001/04/13 14:14:00 stefano Exp $ ; INCLUDE "#stdio.def" XLIB puts_cons .puts_cons pop bc pop hl push hl push bc .putconsole0 ld a,(hl) and a jr z,putconsole_out cp 13 jr z,putconsole_nl call_oz(os_out) .putconsole_lp inc hl jr putconsole0 .putconsole_out call_oz(gn_nln) ret .putconsole_nl call_oz(gn_nln) jr putconsole_lp z88dk-1.8.ds1/libsrc/stdio/z88/README0000644000175000017500000000015107265604650016424 0ustar tygrystygrys$Id: README,v 1.2 2001/04/13 14:14:00 stefano Exp $ Machine specific routines for the z88 stdio library z88dk-1.8.ds1/libsrc/stdio/zsock/0000755000175000017500000000000010765202715016242 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/zsock/closenet.c0000644000175000017500000000053207265604650020227 0ustar tygrystygrys/* * Close a network socket (stdio) * * djm 25/4/2000 * * $Id: closenet.c,v 1.2 2001/04/13 14:14:00 stefano Exp $ */ #include #include #include int closenet(SOCKET *s) { printf("Entered closenet\n"); sock_close(s); sock_waitclose(s); printf("calling shutdoen"); sock_shutdown(s); return 0; } z88dk-1.8.ds1/libsrc/stdio/zsock/fflush_net.c0000644000175000017500000000036707265604650020556 0ustar tygrystygrys/* * Flush a network connection * * djm 27/4/2000 * * $Id: fflush_net.c,v 1.2 2001/04/13 14:14:00 stefano Exp $ */ #include #include int fflush_net(SOCKET *s) { sock_flush(s); iferror return EOF; return 0; } z88dk-1.8.ds1/libsrc/stdio/zsock/fgetc_net.c0000644000175000017500000000061407265604650020352 0ustar tygrystygrys/* * Read a byte from the network * * djm 25/4/2000 * * $Id: fgetc_net.c,v 1.2 2001/04/13 14:14:00 stefano Exp $ */ #include #include #include int fgetc_net(SOCKET *s) { char pad; unsigned char c; int num=0; while (1) { GoTCP(); if (sock_dataready(s) ) break; if (sock_closed(s) ) return_nc -1; } sock_read(s,&c,1); return_nc(c); } z88dk-1.8.ds1/libsrc/stdio/zsock/fputc_net.c0000644000175000017500000000052707265604650020406 0ustar tygrystygrys/* * Write byte to socket using stdio library * * djm 25/4/2000 * * $Id: fputc_net.c,v 1.2 2001/04/13 14:14:00 stefano Exp $ */ #include #include #include int fputc_net(SOCKET *s, int c) { int num=0; while (num==0) { GoTCP(); num=sock_putc(c,s); iferror return EOF; } return(c); } z88dk-1.8.ds1/libsrc/stdio/zsock/Makefile0000644000175000017500000000052110763610013017670 0ustar tygrystygrys# $Id: Makefile,v 1.7 2008/03/05 20:35:48 dom Exp $ include ../../Make.config CFILES = \ closenet.c \ fflush_net.c \ fgetc_net.c \ fputc_net.c \ opennet.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: $(OBJECTS) .c.o: zcc +z88 $(CFLAGS) -DNET_STDIO $*.c clean: $(RM) *.o* zcc_opt.def *.sym *.map *.i $(AFILES) z88dk-1.8.ds1/libsrc/stdio/zsock/opennet.c0000644000175000017500000000233407265604650020065 0ustar tygrystygrys/* * Open a TCP/UDP connection based on fileio * * djm 25/4/2000 * * $Id: opennet.c,v 1.2 2001/04/13 14:14:00 stefano Exp $ */ #include #include #include #include #include int opennet(FILE *fp,char *name,char *explicit, size_t max) { char host[50]; int proto; char *next,*next2; int len; if (strncmp(name,":UDP",4) == 0 ) proto=17; else if (strncmp(name,":TCP",4) == 0 ) proto=6; else return 0; if ( (next=strchr(name,'/') ) == 0 ) return 0; if ( (next2=strchr(++next,'/') ) == 0 ) return 0; len=next2-next; if (len > 49 ) return 0; strncpy(host,next,len); host[len]=0; len=open_net1(host,atoi(++next2),proto); if ( len ) { strncpy(explicit,name,max); fp->desc.ptr=(char *)len; fp->flags=_IONETWORK|_IOUSE; fp->ungetc=0; return 1; } return 0; /* Failed */ } int open_net1(char *host, int port, int proto) { ipaddr_t addr; SOCKET *s; int ret; addr=resolve(host); if (addr == 0L ) return 0; s=sock_open(addr,port,0,proto); if (s == 0 ) { return 0; /* No socket created */ } switch ( (char) sock_waitopen(s) ) { case 0: /* Closed */ case -1: /* abort */ sock_shutdown(s); return 0; case 1: return s; } } z88dk-1.8.ds1/libsrc/stdio/zx81/0000755000175000017500000000000010765202715015723 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdio/zx81/fgetc_cons.asm0000644000175000017500000000061610710147036020534 0ustar tygrystygrys; ; ZX81 Stdio ; ; getkey() Wait for keypress ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: fgetc_cons.asm,v 1.5 2007/10/25 17:10:54 stefano Exp $ ; XLIB fgetc_cons LIB zx81toasc XREF restore81 .fgetc_cons call restore81 .fgcloop call 699 ld a,h add a,2 jr nc,fgcloop .wloop call 699 ld a,h add a,2 jr c,wloop ld b,h ld c,l call 1981 call zx81toasc ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/zx81/fputc_cons.asm0000644000175000017500000000300010732671610020557 0ustar tygrystygrys; ; Basic video handling for the ZX81 ; ; (HL)=char to display ; ; $Id: fputc_cons.asm,v 1.7 2007/12/21 08:04:24 stefano Exp $ ; XLIB fputc_cons LIB asctozx81 XREF restore81 DEFC ROWS=24 DEFC COLUMNS=32 .ROW defb 0 .COLUMN defb 0 .fputc_cons ld hl,2 add hl,sp ld (charpos+1),hl ld a,(hl) cp 12 jr nz,nocls xor a ld (ROW),a ld (COLUMN),a call restore81 ; Assembler will swap it to iy jp 2602 ; CLS .nocls cp 13 ; CR jr z,isLF cp 10 ; LF? jr nz,NoLF .isLF xor a ld (COLUMN),a ; automatic CR ld a,(ROW) inc a ld (ROW),a cp ROWS ; Out of screen? ret nz ; no, return ld a,ROWS-1 ld (ROW),a ; scroll up ld hl,(16396) inc hl ld d,h ld e,l ld bc,33 add hl,bc ld bc,33*23-1 ldir ld h,d ; clean last line ld l,e inc hl inc de inc de ld (hl),0 ld c,31 ldir ret .NoLF cp 8 ; BackSpace jr nz,NoBS ld hl,COLUMN xor a push hl call charput ; a=0 -> blank pop hl cp (hl) jr z,firstc ; are we in the first column? dec (hl) ret .firstc ld a,(ROW) and a ret z dec a ld (ROW),a ld a,COLUMNS-1 ld (COLUMN),a ret .NoBS .charpos ld hl,0 call asctozx81 bit 6,a ; filter the dangerous codes ret nz call charput ld a,(COLUMN) inc a ld (COLUMN),a cp COLUMNS ; last column ? ret nz ; no, return jp isLF .charput push af ld hl,(16396) inc hl ld a,(ROW) and a jr z,r_zero ld b,a ld de,33 ; 32+1. Every text line ends with an HALT .r_loop add hl,de djnz r_loop .r_zero ld a,(COLUMN) ld d,0 ld e,a add hl,de pop af ld (hl),a ret z88dk-1.8.ds1/libsrc/stdio/zx81/getk.asm0000644000175000017500000000051710710147036017354 0ustar tygrystygrys; ; ZX81 Stdio ; ; getk() Read key status ; ; Stefano Bodrato - 8/5/2000 ; ; ; $Id: getk.asm,v 1.4 2007/10/25 17:10:54 stefano Exp $ ; XLIB getk LIB zx81toasc XREF restore81 .getk call restore81 call 699 ld a,h add a,2 ld b,h ld c,l ld a,0 jr c,nokey call 1981 call zx81toasc nokey: ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/stdio/zx81/readme.txt0000644000175000017500000000125307265604650017727 0ustar tygrystygrys$Id: readme.txt,v 1.2 2001/04/13 14:14:00 stefano Exp $ Tah-da !! The ZX81 support. You can choose between a VT emulation (white text on black background, scrolling, ESC sequences) and the (tiny and puny) ROM code (the execution stops when last line is reached, so do frequent CLS !). The ANSI VT support still corrupts something on the BASIC memory, so probably you won't be able to return cleanly to the prompt if you use it. After compiling you can use the bin2p utility to create a loadable basic program with your code included in a rem line. Such program can be saved on tape also, using the ZXtape utility. Take your copy at: http://edge.edge.net/~krbaker/zxtape.zip z88dk-1.8.ds1/libsrc/stdlib/0000755000175000017500000000000010765202715015250 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdlib/abs.asm0000644000175000017500000000043710551120402016504 0ustar tygrystygrys; ; Small C z88 Misc functions ; ; Return absolute value ; This is interesting method, but so much quicker than what a compiled ; version would do.. ; ; ----- ; $Id: abs.asm,v 1.5 2007/01/10 08:17:06 aralbrec Exp $ XLIB abs LIB l_neg ; FASTCALL .abs bit 7,h ret z jp l_neg z88dk-1.8.ds1/libsrc/stdlib/atexit.asm0000644000175000017500000000173210551120402017234 0ustar tygrystygrys; Small C+ Z88 stdlib functions ; ; Provides for a routine to be executed on exit ; ; 18/10/98 djm ; 27/11/98 djm - allows upto 32 levels of exit routines ; ; ----- ; $Id: atexit.asm,v 1.5 2007/01/10 08:17:06 aralbrec Exp $ ; int atexit((void *)(void)) ; FASTCALL XLIB atexit XREF exitsp, exitcount ; enter : hl = atexit function ; exit : hl !=0 and no carry if can't register ; hl =0 and carry set if successful .atexit ex de,hl ; de = function to register ld hl,exitcount ld a,(hl) cp 32 ; can only hold 32 levels.. ret nc ; if full returns with hl!=0 inc (hl) ; increment number of levels add a,a ; compute index in exit stack ld c,a ld b,0 ld hl,(exitsp) add hl,bc ld (hl),e ; write atexit function inc hl ld (hl),d ld h,b ld l,b ; indicate success scf ret z88dk-1.8.ds1/libsrc/stdlib/atoi.asm0000644000175000017500000000301610553245376016713 0ustar tygrystygrys;/* ; * int atoi (char *) ; * ; * Convert ascii string to integer... ; * ; * equivalent to stroul(ptr,NULL,10) ; * ; * But this should be shorter... ; * ; * Almost k&r but not quite.. ; * ; * djm 5/1/2000 ; * ; * ----- ; * $Id: atoi.asm,v 1.6 2007/01/16 22:00:30 aralbrec Exp $ ; * ; */ XLIB atoi LIB l_neg ; FASTCALL ; enter : hl = char* ; exit : hl = int result ; de = & next char to interpret in char* .atoi ld a,(hl) ; eat whitespace inc hl cp 32 ; inlined isspace jr z, atoi cp 7 jr z, atoi cp 10 jr z, atoi cp 13 jr z, atoi ; ate up one too many chars, see if it's a sign cp '+' jr z, signdone dec hl cp '-' jr nz, signdone inc hl ; this is a negative number call signdone ; do atoi but come back here to negate result jp l_neg ; hl = -hl .signdone ld de,0 ex de,hl dec de .loop inc de ld a,(de) sub '0' ; inlined isdigit ret c cp 10 ret nc add hl,hl ; hl = hl*10 ld c,l ld b,h add hl,hl add hl,hl add hl,bc add a,l ld l,a jp nc, loop inc h jp loop ; #include ; #include ; ; int atoi(char *s) ; { ; int sign; ; int n; ; unsigned char *ptr; ; ; ptr=s; ; while (isspace(*ptr) ) ++ptr; ; ; sign = (*ptr == '-' ) ? -1 : 1; ; if (*ptr=='+' || *ptr=='-' ) ++ptr; ; ; for (n=0; isdigit(*ptr); ++ptr) ; n = 10*n + (*ptr-'0'); ; return sign*n; ;} ;z88dk-1.8.ds1/libsrc/stdlib/atol.asm0000644000175000017500000000246610601577227016723 0ustar tygrystygrys; long __FASTCALL__ atol(char *s) ; 12.2006 aralbrec XLIB atol LIB l_long_neg ; FASTCALL ; enter : hl = char* ; exit : dehl = long result ; bc = & next char to interpret in char* .atol ld a,(hl) ; eat whitespace inc hl cp 32 ; inlined isspace jr z, atol cp 7 jr z, atol cp 10 jr z, atol cp 13 jr z, atol ; ate up one too many chars, see if it's a sign cp '+' jr z, signdone dec hl cp '-' jr nz, signdone inc hl ; this is a negative number call signdone ; do atol but come back here to negate result jp l_long_neg ; dehl = -dehl .signdone ld b,h ld c,l ld de,0 ld l,e ld h,d ; bc = char * ; dehl = result dec bc .loop inc bc ld a,(bc) sub '0' ; inlined isdigit ret c cp 10 ret nc ; dehl *= 10 add hl,hl ex de,hl adc hl,hl ex de,hl push de push hl ; save dehl*2 add hl,hl ex de,hl adc hl,hl ex de,hl add hl,hl ex de,hl adc hl,hl ; long is hlde ex (sp),hl add hl,de pop de ex (sp),hl adc hl,de ex de,hl pop hl add a,l ld l,a jp nc, loop inc h jp nz, loop inc de jp loop z88dk-1.8.ds1/libsrc/stdlib/bpeek.asm0000644000175000017500000000015510551120402017022 0ustar tygrystygrys; uchar __FASTCALL__ bpeek(void *addr) ; 11.2006 aralbrec XLIB bpeek .bpeek ld l,(hl) ld h,0 ret z88dk-1.8.ds1/libsrc/stdlib/bpoke.asm0000644000175000017500000000032510551120402017033 0ustar tygrystygrys; CALLER linkage for function pointers XLIB bpoke LIB bpoke_callee XREF ASMDISP_BPOKE_CALLEE .bpoke pop af pop de pop hl push hl push de push af jp bpoke_callee + ASMDISP_BPOKE_CALLEE z88dk-1.8.ds1/libsrc/stdlib/bpoke_callee.asm0000644000175000017500000000040110577177144020362 0ustar tygrystygrys; void __CALLEE__ bpoke_callee(void *addr, uchar byte) ; 11.2006 aralbrec XLIB bpoke_callee XDEF ASMDISP_BPOKE_CALLEE .bpoke_callee pop hl pop de ex (sp),hl .asmentry ld (hl),e ret DEFC ASMDISP_BPOKE_CALLEE = asmentry - bpoke_callee z88dk-1.8.ds1/libsrc/stdlib/delay.asm0000644000175000017500000000207310632617641017053 0ustar tygrystygrys; void __FASTCALL__ delay(unsigned int tstates) XLIB delay ; Z80 delay routine ; by JB, z88dk artistic license ; ; Delays an exact amount of time measured in Z80 cycles. ; This time includes the CALL to and RET from this ; subroutine. ; ; enter : hl = delay in T states (at least 160) ; uses : af, de, hl .delay .b0 ld a, l rra jr c, b1 nop ; bit 0 set : 20 T ; bit 0 reset : 19 T .b1 rra jr nc, b2 jr nc, b2 ; never taken ; bit 1 set : 18 T ; bit 1 reset : 16 T .b2 rra jr nc, b3 ret nc nop ; bit 2 set : 20 T ; bit 2 reset : 16 T .b3 rra jr nc, b4 jr nc, b4 ; never taken dec de ; bit 3 set : 24 T ; bit 3 reset : 16 T .b4 rra jr nc, preploop jr nc, preploop ; never taken or a ld de,0 ; bit 4 set : 32 T ; bit 4 reset : 16 T ; carry flag reset .preploop ex de,hl ld hl,191 ld hl,191 sbc hl,de ld de,32 ; loop prep : 49 T ; loop time = 11 + n*32 T (n = # times through loop) .loop ret nc add hl,de ccf jr loop z88dk-1.8.ds1/libsrc/stdlib/div.asm0000644000175000017500000000033610551120402016517 0ustar tygrystygrys; CALLER linkage for function pointers XLIB div LIB div_callee XREF ASMDISP_DIV_CALLEE .div pop af pop hl pop de pop bc push bc push de push hl push af jp div_callee + ASMDISP_DIV_CALLEE z88dk-1.8.ds1/libsrc/stdlib/div_callee.asm0000644000175000017500000000101410551120402020016 0ustar tygrystygrys; void __CALLEE__ div_callee(div_t *d, int num, int denom) ; 12.2006 aralbrec XLIB div_callee XDEF ASMDISP_DIV_CALLEE LIB l_div .div_callee pop af pop hl pop de pop bc push af ; enter : bc = div_t *d ; de = int num ; hl = int denom .asmentry push bc call l_div ; hl = q, de = r ex de,hl ex (sp),hl ld (hl),e inc hl ld (hl),d inc hl pop de ld (hl),e inc hl ld (hl),d ret DEFC ASMDISP_DIV_CALLEE = asmentry - div_callee z88dk-1.8.ds1/libsrc/stdlib/exit.asm0000644000175000017500000000302110551007415016710 0ustar tygrystygrys;Z88 Small C Library functions, linked using the z80 module assembler ;Small C Z88 converted by Dominic Morris ; ;Exit routine, rewritten 27/11/98 so to traverse the atexit stack ; ;Constantly revisited through April ;Some of the opt rules cause this routine to be jumped to instead ;of called, so we don't use the stack, instead we use hl as our ;entrance variable...we're buggered if we define a pointer to here ;though... ; ; ----- ; $Id: exit.asm,v 1.5 2007/01/09 21:54:21 stefano Exp $ XLIB exit XREF cleanup, exitsp, exitcount LIB l_jphl XDEF ASMDISP_EXIT ; FASTCALL ;This also allows for an atexit function to print a bye bye message ;or whatever... - no parameters are passed into it... .exit push hl ; save exit value ld a,(exitcount) or a jr z, end ld b,a ; b = number of registered functions add a,a ld e,a ld d,0 ld hl,(exitsp) ; hl = & atexit stack add hl,de ; hl = & last function in exit stack + 2b .loop ; now traverse atexit stack in reverse order push bc dec hl ld a,(hl) dec hl push hl ld l,(hl) ld h,a ; hl = atexit function call l_jphl pop hl pop bc djnz loop .end ; disrupt stack completely and exit with error value pop hl ld a,l ; was here so left as is, something to do with z88? jp cleanup ; perhaps should be in the z88 crt0? DEFC ASMDISP_EXIT = 0 z88dk-1.8.ds1/libsrc/stdlib/getopt.c0000644000175000017500000000734207565744417016742 0ustar tygrystygrys/* * Copyright (c) 1987, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char *rcsid = "$OpenBSD: getopt.c,v 1.2 1996/08/19 08:33:32 tholo Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include #include int opterr = 1, /* if error message should be printed */ optind = 1, /* index into parent argv vector */ optopt, /* character checked for validity */ optreset; /* reset getopt */ char *optarg; /* argument associated with option */ #define BADCH (int)'?' #define BADARG (int)':' #define EMSG "" /* * getopt -- * Parse argc/argv argument vector. */ int getopt(int nargc, char **nargv, const char *ostr) { static char *place = EMSG; /* option letter processing */ char *oli; /* option letter list index */ if (optreset || !*place) { /* update scanning pointer */ optreset = 0; if (optind >= nargc || *(place = nargv[optind]) != '-') { place = EMSG; return (-1); } if (place[1] && *++place == '-') { /* found "--" */ ++optind; place = EMSG; return (-1); } } /* option letter okay? */ if ((optopt = (int)*place++) == (int)':' || !(oli = strchr(ostr, optopt))) { /* * if the user didn't specify '-' as an option, * assume it means -1. */ if (optopt == (int)'-') return (-1); if (!*place) ++optind; if (opterr && *ostr != ':') (void)fprintf(stderr, " illegal option -- %c\n", optopt); return (BADCH); } if (*++oli != ':') { /* don't need argument */ optarg = NULL; if (!*place) ++optind; } else { /* need an argument */ if (*place) /* no white space */ optarg = place; else if (nargc <= ++optind) { /* no arg */ place = EMSG; if (*ostr == ':') return (BADARG); if (opterr) (void)fprintf(stderr, "option requires an argument -- %c\n", optopt); return (BADCH); } else /* white space */ optarg = nargv[optind]; place = EMSG; ++optind; } return (optopt); /* dump back option letter */ } z88dk-1.8.ds1/libsrc/stdlib/inp.asm0000644000175000017500000000017110551120402016520 0ustar tygrystygrys; uchar __FASTCALL__ inp(uint port) ; 09.2005 aralbrec XLIB inp .inp ld c,l ld b,h in l,(c) ld h,0 ret z88dk-1.8.ds1/libsrc/stdlib/isqrt.asm0000644000175000017500000000224510552120262017105 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** XLIB isqrt ; ----- uint __FASTCALL__ isqrt(uint val) .isqrt ld b,l ; b = LSB of val ld l,h ; l = MSB of val xor a ; result ld h,a ld de,1 .sqrt1 or a sbc hl,de jr c, sqrt2 inc de inc de add a,$10 ; result += 16 jp sqrt1 .sqrt2 add hl,de ; take back SBC HL, DE ld c,a ; save result ld e,a ; save result * 16 in E inc a ; result * 16 + 1 add a,e ; add to E ld e,a ; start subtracting here ld d,0 ld a,c ; get result ld h,l ; val <<= 8 ld l,b ; + LSB(val) .sqrt3 or a sbc hl,de jr c, sqrt4 inc de inc de inc a ; result += 1 jp sqrt3 .sqrt4 add hl,de ; take back SBC HL, DE ld l,a ; result in HL ret z88dk-1.8.ds1/libsrc/stdlib/itoa.asm0000644000175000017500000000031710551120402016670 0ustar tygrystygrys; CALLER linkage for function pointers XLIB itoa LIB itoa_callee XREF ASMDISP_ITOA_CALLEE .itoa pop bc pop de pop hl push hl push de push bc jp itoa_callee + ASMDISP_ITOA_CALLEE z88dk-1.8.ds1/libsrc/stdlib/itoa_callee.asm0000644000175000017500000000355210615577316020226 0ustar tygrystygrys; char __CALLEE__ *itoa_callee(char *s, int num) ; convert int to string and store in s ; 12.2006 aralbrec XLIB itoa_callee XDEF ASMDISP_ITOA_CALLEE XDEF ASMDISP2_ITOA_CALLEE LIB l_deneg .itoa_callee pop hl pop de ex (sp),hl ; enter : de = int num ; hl = char *s ; exit : hl = char *s ; de = addr of terminating '\0' in s ; uses : af, bc, de .asmentry push hl bit 7,d ; is num negative? jr z, notneg ld (hl),'-' ; write negative sign inc hl call l_deneg ; negate number .notneg ex de,hl ld bc,constants push bc ; de = char * ; hl = int ; stack = constants .skipleading0 ex (sp),hl ; hl = & constant ld c,(hl) inc hl ld b,(hl) ; bc = constant ld a,b or c jr z, write1 ; if constant == 0, reached end inc hl ex (sp),hl ; hl = int, stack = & next constant call divide ; a = hl/bc + '0', hl = hl%bc cp '0' jp z, skipleading0 .write ld (de),a ; write digit into string inc de ex (sp),hl ld c,(hl) inc hl ld b,(hl) ld a,b or c jr z, write1 inc hl ex (sp),hl call divide jp write .write1 ; reached 1s position, write out last digit pop hl ; hl = int ld a,l add a,'0' ld (de),a ; write last digit inc de xor a ; terminate string with '\0' ld (de),a pop hl ; hl = char *s ret .divide ld a,'0'-1 .divloop inc a sbc hl,bc jr nc, divloop add hl,bc ret .constants defw 10000, 1000, 100, 10, 0 DEFC ASMDISP_ITOA_CALLEE = asmentry - itoa_callee DEFC ASMDISP2_ITOA_CALLEE = notneg - itoa_callee z88dk-1.8.ds1/libsrc/stdlib/l_bsearch.asm0000644000175000017500000000042610551120402017657 0ustar tygrystygrys; CALLER linkage for function pointers XLIB l_bsearch LIB l_bsearch_callee XREF ASMDISP_L_BSEARCH_CALLEE .l_bsearch pop af pop iy pop hl pop de pop bc push bc push de push hl push hl push af jp l_bsearch_callee + ASMDISP_L_BSEARCH_CALLEE z88dk-1.8.ds1/libsrc/stdlib/l_bsearch_callee.asm0000644000175000017500000000072310551120402021164 0ustar tygrystygrys; void __CALLEE__ *l_bsearch_callee(void *key, void *base, unsigned int n, void *cmp) ; 01.2007 aralbrec XLIB l_bsearch_callee XDEF ASMDISP_L_BSEARCH_CALLEE LIB Lbsearch, l_jpiy .l_bsearch_callee pop af pop iy pop hl pop de pop bc push af .centry ld ix,compare jp Lbsearch .compare push de push bc push hl call l_jpiy ld a,l pop hl pop bc pop de ret DEFC ASMDISP_L_BSEARCH_CALLEE = centry - l_bsearch_callee z88dk-1.8.ds1/libsrc/stdlib/l_qsort.asm0000644000175000017500000000036510551120402017422 0ustar tygrystygrys; CALLER linkage for function pointers XLIB l_qsort LIB l_qsort_callee XREF ASMDISP_L_QSORT_CALLEE .l_qsort pop de pop iy pop hl pop bc push bc push hl push hl push de jp l_qsort_callee + ASMDISP_L_QSORT_CALLEE z88dk-1.8.ds1/libsrc/stdlib/l_qsort_callee.asm0000644000175000017500000000066310551120402020730 0ustar tygrystygrys; void __CALLEE__ l_qsort_callee(void *base, unsigned int size, void *cmp) ; 01.2007 aralbrec XLIB l_qsort_callee XDEF ASMDISP_L_QSORT_CALLEE LIB Lqsort, l_jpiy .l_qsort_callee pop de pop iy pop hl pop bc push de .centry ld ix,compare jp Lqsort .compare push hl push de push bc call l_jpiy ld a,l pop bc pop de pop hl ret DEFC ASMDISP_L_QSORT_CALLEE = centry - l_qsort_callee z88dk-1.8.ds1/libsrc/stdlib/labs.asm0000644000175000017500000000031610551120402016654 0ustar tygrystygrys; CALLER linkage for function pointers XLIB labs LIB labs_callee XREF ASMDISP_LABS_CALLEE .labs pop af pop hl pop de push de push hl push af jp labs_callee + ASMDISP_LABS_CALLEE z88dk-1.8.ds1/libsrc/stdlib/labs_callee.asm0000644000175000017500000000055210551120402020163 0ustar tygrystygrys; ; Small C z88 stdlib functions ; ; Return absolute value of long ; ; ----- ; $Id: labs_callee.asm,v 1.1 2007/01/10 08:17:06 aralbrec Exp $ XLIB labs_callee LIB l_long_neg XDEF ASMDISP_LABS_CALLEE .labs_callee pop af pop hl pop de push af .asmentry bit 7,d ret z jp l_long_neg DEFC ASMDISP_LABS_CALLEE = asmentry - labs_callee z88dk-1.8.ds1/libsrc/stdlib/Lbsearch.asm0000644000175000017500000000411310551120402017455 0ustar tygrystygrys; 05.2005 aralbrec ; binary search XLIB Lbsearch LIB l_jpix ; The ansi-C bsearch function searches an array of n-byte items. ; This is a 'little' version that searches arrays of 2-byte items. ; Those 2-byte items can be integers or pointers to objects. The ; reason for the 'little' version is that a full ansi implementation ; would require either one multiply or one div operation for each ; array slice -- these are things that would be very time consuming ; on a z80 and hence not worthwhile implementing. I have only ever ; used bsearch on arrays of pointers to objects and this z80 version ; will do that just fine. ; enter: bc = key ; de = base address of array ; hl = size of array ; ix = cmp function (BC=key, HL=datum ; result in A (see ".compare"), ; MUST PRESERVE BC,DE,HL,IX registers) ; exit : hl = address of found item ; carry set indicates item not found with HL=0 ; uses : af, de, hl ; ; Call Lbsearch + 3 if you prefer to enter with hl = last item in array .Lbsearch dec hl add hl,hl add hl,de ; HL = right side .loop ; DE = left, HL = right ld a,d ; is left <= right or are we done? cp h jr c, slice jr nz, done ld a,e cp l jr nc, done .slice push hl ; stack right side add hl,de ; HL = left + right rr h rr l ; HL = unrounded address of middle item ld a,l ; shenanigans to ensure HL aligns on item xor e rra jr nc, compare dec hl .compare ; is key < datum? call l_jpix ; returns A<0 for less, A==0 for equals, A>0 for greater or a jr z, caseEqual jp m, caseLess .caseGreater pop de inc hl inc hl ex de,hl ; middle becomes left, right is still right jp loop .caseLess pop af ; throw away stacked right side dec hl dec hl jp loop ; middle becomes right, left is still left .caseEqual pop de ; clear stack ret ; HL = address of found item .done ; failed to find scf ld hl,0 ret z88dk-1.8.ds1/libsrc/stdlib/ldiv.asm0000644000175000017500000000125710623253460016711 0ustar tygrystygrys; void ldiv(ldiv_t *d, long num, long denom) ; 12.2006 aralbrec ; CALLER linkage for function pointers XLIB ldiv LIB l_long_div .ldiv ; setup for l_long_div: dehl = denom, stack = num pop af ex af,af ; af' = return address pop hl pop de call l_long_div ; dehl = q, de'hl' = r ex de,hl ex (sp),hl ; hl = ldiv_t * ld (hl),e inc hl ld (hl),d inc hl pop de ld (hl),e inc hl ld (hl),d inc hl push hl exx ex de,hl ex (sp),hl ld (hl),e inc hl ld (hl),d inc hl pop de ld (hl),e inc hl ld (hl),d ld hl,-6 add hl,sp ld sp,hl ex af,af push af ret z88dk-1.8.ds1/libsrc/stdlib/ldiv_callee.asm0000644000175000017500000000120510623253460020207 0ustar tygrystygrys; void __CALLEE__ ldiv_callee(ldiv_t *d, long num, long denom) ; 12.2006 aralbrec XLIB ldiv_callee LIB l_long_div .ldiv_callee ; setup for l_long_div: dehl = denom, stack = num pop af ex af,af ; af' = return address pop hl pop de call l_long_div ; dehl = q, de'hl' = r ex de,hl ex (sp),hl ; hl = ldiv_t * ld (hl),e inc hl ld (hl),d inc hl pop de ld (hl),e inc hl ld (hl),d inc hl push hl exx ex de,hl ex (sp),hl ld (hl),e inc hl ld (hl),d inc hl pop de ld (hl),e inc hl ld (hl),d ex af,af push af ret z88dk-1.8.ds1/libsrc/stdlib/Lqsort.asm0000644000175000017500000000727110551120402017226 0ustar tygrystygrys; 05.2005 aralbrec ; iterative qsort, partition element taken from middle XLIB Lqsort LIB l_jpix ; The ansi-C qsort function sorts an array of n-byte items. ; This is a 'little' version that sorts arrays of 2-byte items. ; Those 2-byte items can be integers or pointers to objects. The ; reason for the 'little' version is that a full ansi implementation ; would require either one multiply or one div operation for each ; array slice -- these are things that would be very time consuming ; on a z80 and hence not worthwhile implementing. I have only ever ; used qsort on arrays of pointers to objects and this z80 version ; will do that just fine. ; enter: bc = base address of array ; hl = size of array ; ix = cmp function (DE=key, BC=datum ; result in A (see ".compare"), ; MUST PRESERVE BC,DE,HL,IX registers) ; uses : AF,BC,DE,HL,AF' ; ; If you prefer to enter with hl = last item in array, call Lqsort+3 .Lqsort dec hl add hl,hl add hl,bc ; bc = left, hl = right ld de,0 push de ; mark end of qsort -- empty stack jp qsort2 .qsort1 ; check stack for pending qsorts pop bc ; bc = left ld a,b or c ret z ; if 0, done pop hl ; hl = right .qsort2 ; qsort(bc=left,hl=right) ld a,b ; left < right? bc < hl? cp h jr c, swap3 jr nz, qsort1 ld a,c cp l jr nc, qsort1 ; picking middle item as partition element .swap3 ; swap(left,(left+right)/2) ld e,l ld d,h ; de = right add hl,bc rr h rr l ; hl = unrounded (left+right)/2 ld a,l ; shenanigans to ensure HL aligns on item xor c rra jr nc, doswap dec hl .doswap ; move partition element to start of array ld a,(bc) ex af,af ld a,(hl) ld (bc),a ex af,af ld (hl),a inc hl inc bc ; bc = left+1b, de=right ld a,(bc) ex af,af ld a,(hl) ld (bc),a ex af,af ld (hl),a inc bc push bc ; stack = left+1 = last+1 ld l,c ld h,b ex de,hl ; de = left+1, hl = right dec bc dec bc ; bc = left jp ent ; de = i, bc = left, hl = right, stack = last+1 .partition inc de ; i++ inc de .ent ld a,h ; i <= right? de <= hl ? cp d jr c, endlp jr nz, compare ld a,l cp e jr c, endlp .compare ; is v[i] < v[left]? (de) < (bc) ? call l_jpix ; returns A<0 for less, A==0 for equals, A>0 for greater or a jp p, partition .swap1 ; swap(i,++last) ex (sp),hl ; hl = ++last, stack = right ld a,(de) ex af,af ld a,(hl) ld (de),a ex af,af ld (hl),a inc hl inc de ld a,(de) ex af,af ld a,(hl) ld (de),a ex af,af ld (hl),a inc hl inc de ex (sp),hl ; hl = right, stack = last+1, de=i++ jp ent .endlp ; bc = left, hl = right, stack = last+1 ex (sp),hl ; hl = last+1 push hl ; qsort(l=last+1,r=right) <==> stack = right,last+1 .swap2 ; swap(left,last) inc bc ; bc = left+1b dec hl ; hl = last+1b ld a,(bc) ex af,af ld a,(hl) ld (bc),a ex af,af ld (hl),a dec hl ; hl = last dec bc ; bc = left ld a,(bc) ex af,af ld a,(hl) ld (bc),a ex af,af ld (hl),a dec hl dec hl ; hl = last-1 jp qsort2 ; qsort(l=bc=left,r=hl=last-1) z88dk-1.8.ds1/libsrc/stdlib/ltoa.asm0000644000175000017500000000034410604122722016701 0ustar tygrystygrys; CALLER linkage for function pointers XLIB ltoa LIB ltoa_callee XREF ASMDISP_LTOA_CALLEE .ltoa pop af pop hl pop de pop bc push bc push de push hl push af jp ltoa_callee + ASMDISP_LTOA_CALLEE z88dk-1.8.ds1/libsrc/stdlib/ltoa_callee.asm0000644000175000017500000000467010615577433020233 0ustar tygrystygrys; char __CALLEE__ *ltoa_callee(char *s, long num) ; convert long to string and store in s ; 04.2007 aralbrec XLIB ltoa_callee XDEF ASMDISP_LTOA_CALLEE XDEF ASMDISP2_LTOA_CALLEE LIB l_long_neg .ltoa_callee pop af pop hl pop de pop bc push af .asmentry ; dehl = long num ; bc = char *s push bc bit 7,d ; negative num? jr z, notneg ld a,'-' ; write negative sign ld (bc),a inc bc call l_long_neg ; make it positive, bc okay .notneg push de exx pop hl exx ld de,constants push de .skipleading0 ; hl'hl = num ; bc = char * ; stack = constants ex (sp),hl ld e,(hl) inc hl ld d,(hl) inc hl ex (sp),hl exx ex (sp),hl ld e,(hl) inc hl ld d,(hl) inc hl ex (sp),hl ld a,d or e exx or d or e jr z, writelast ; hl'hl = arg1 ; de'de = arg2 call divide cp '0' jp z, skipleading0 .write ; a = ascii code of digit to write ; bc = char * ; hl'hl = num ; stack = constants ld (bc),a inc bc ex (sp),hl ld e,(hl) inc hl ld d,(hl) inc hl ex (sp),hl exx ex (sp),hl ld e,(hl) inc hl ld d,(hl) inc hl ex (sp),hl ld a,d or e exx or d or e jr z, writelast ; hl'hl = arg1 ; de'de = arg2 call divide jp write .writelast ; hl = remaining num ; bc = char * ; stack = constants ld a,l add a,'0' ld (bc),a inc bc xor a ld (bc),a pop hl pop hl ret .divide ld a,'0'-1 .divloop ; hl'hl = arg1 ; de'de = arg2 ; exit : hl'hl = arg1 % arg2 ; a = ascii arg1/arg2 inc a sbc hl,de exx sbc hl,de exx jr nc, divloop add hl,de exx adc hl,de exx ret .constants ; little endian defw $ca00, $3b9a ; 1,000,000,000 defw $e100, $05f5 ; 100,000,000 defw $9680, $0098 ; 10,000,000 defw $4240, $000f ; 1,000,000 defw $86a0, $0001 ; 100,000 defw $2710, $0000 ; 10,000 defw $03e8, $0000 ; 1,000 defw $0064, $0000 ; 100 defw $000a, $0000 ; 10 defw $0000, $0000 ; end of table DEFC ASMDISP_LTOA_CALLEE = asmentry - ltoa_callee DEFC ASMDISP2_LTOA_CALLEE = notneg - ltoa_callee z88dk-1.8.ds1/libsrc/stdlib/Makefile0000644000175000017500000000106210763610014016700 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.18 2008/03/05 20:35:48 dom Exp $ include ../Make.config GENCFILES = \ sleep.c \ getopt.c AFILES = $(GENCFILES:.c=.asm) GENOBJECTS = $(GENCFILES:.c=.o) lz88: z88_stdlib lzx: zx_stdlib gen: $(GENOBJECTS) .c.o: zcc +test $(CFLAGS) $*.c z88_stdlib: zcc +z88 $(CFLAGS) *.c cd z88 ; cd .. zx_stdlib: zcc +zx $(CFLAGS) *.c cd spectrum ; cd .. clean: $(RM) *.o* *.sym *.map zcc_opt.def *.i $(AFILES) cd z88 ; $(MAKE) clean ; cd .. cd spectrum ; $(MAKE) clean ; cd .. z88dk-1.8.ds1/libsrc/stdlib/outp.asm0000644000175000017500000000031610551120402016722 0ustar tygrystygrys; CALLER linkage for function pointers XLIB outp LIB outp_callee XREF ASMDISP_OUTP_CALLEE .outp pop af pop de pop bc push bc push de push af jp outp_callee + ASMDISP_OUTP_CALLEE z88dk-1.8.ds1/libsrc/stdlib/outp_callee.asm0000644000175000017500000000042110551120402020224 0ustar tygrystygrys; void outp_callee(uint port, uchar byte) ; 09.2005 aralbrec XLIB outp_callee XDEF ASMDISP_OUTP_CALLEE .outp_callee pop af pop de pop bc push af .asmentry ; bc = port ; e = byte out (c),e ret DEFC ASMDISP_OUTP_CALLEE = asmentry - outp_callee z88dk-1.8.ds1/libsrc/stdlib/rand.asm0000644000175000017500000000432010742246040016667 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Random number generator ; ; int rand(void) ; ; Liberated from ticalc.org, mods to standard z80 by djm 11/4/99 ; ; ----- ; $Id: rand.asm,v 1.7 2008/01/12 23:24:16 aralbrec Exp $ ; you must declare an integer C variable "std_seed" to hold the ; 16-bit seed in your main.c file ; ; int std_seed; XLIB rand XREF _std_seed ; My contribution to randon number generators (by Risto Jrvinen) ; ------------------------------------------- ; ; Here's two simple 16-bit random number generators. I originally made ; them on PC but since ZShell doesn't support ROM-random generator I converted ; them to Z80. ; My generators were kind of quick'n'dirty hacks on PC, but acceptable on ; Z80. Their advantage was their small size, but on Z80-assembler they are ; giant-sized. If you (too) think that these generators are wasting TI's ; resources use random generators provided by Chris Busch (rand.asm found on ; many ZShell-sites). ; I still use the first generator with demo coding (on PC). It uses two ; 16-bit seeds. It rotates first seed three bits left and adds some trash ; bits then it rotates second seed (first seed and %1111) bits left and adds ; some trash bits. Easy and compact on PC, quite a gonzo-routine on Z80. This ; could be considered as resource wasting on TI. The second generator uses ; only the first seed of the first generator. ; Both generators start with zeroed seed(s). If you wish to use randoms for ; anything make your program save & restore seed(s) upon leaving & entry. ; 16-bit seed random generator ; ---------------------------- ; Faster than previous routine. ; Uses only one 16-bit variable, seed. ; Read and cut the result out of variable seed. .rand ld hl,(_std_seed) ld a,h add a,a ;Set highest bit of seed to carry rl l ;rotate L left (C<=L<=C) rl h ;rotate H left (C<=L<=C) add a,a ;Set second highest bit of seed to carry rl l rl h add a,a rl l rl h ld bc,$7415 add hl,bc ;Add $7415 to HL ld (_std_seed),hl res 7,h ;force to be +ve ret z88dk-1.8.ds1/libsrc/stdlib/randomize.asm0000755000175000017500000000130410712616525017743 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Random number generator for seed ; generic version, ; ; void randomize() - randomize the seed for rand() ; ; ----- ; $Id: randomize.asm,v 1.1 2007/11/02 12:51:33 stefano Exp $ XLIB randomize XREF _std_seed XREF cleanup ; you must declare an integer named "std_seed" in your ; main.c file to hold the seed. ; ; int std_seed; .randomize ld hl,0 add hl,sp call agarble ld e,a ld hl,cleanup ; we fall into the CRT0 stub ld bc,1024 sbc hl,bc call agarble ld h,a ld a,r xor e ld l,a ld (_std_seed),hl ret .agarble ld bc,$FF04 .sloop add (hl) inc hl djnz,sloop dec c jr nz,sloop retz88dk-1.8.ds1/libsrc/stdlib/sleep.c0000644000175000017500000000057307362577245016545 0ustar tygrystygrys/* * Generic sleep() function, relies on an implemented clock() * function * * djm 15/10/2001 * * $Id: sleep.c,v 1.1 2001/10/15 15:20:05 dom Exp $ */ #include #include int sleep(int secs) { long start = clock(); long per = secs * CLOCKS_PER_SEC; while ( (clock() - start) < per ) ; return 0; } z88dk-1.8.ds1/libsrc/stdlib/spectrum/0000755000175000017500000000000010765202715017112 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdlib/spectrum/Makefile0000644000175000017500000000026010546033135020543 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.5 2006/12/31 22:14:53 aralbrec Exp $ all: @echo '' clean: $(RM) *.o* *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/stdlib/srand.asm0000644000175000017500000000063310547026364017065 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Random number generator ; ; void srand(int) - seed "random" number ; ; ----- ; $Id: srand.asm,v 1.5 2007/01/03 22:23:48 aralbrec Exp $ XLIB srand XREF _std_seed XDEF ASMDISP_SRAND ; FASTCALL ; you must declare an integer named "std_seed" in your ; main.c file to hold the seed. ; ; int std_seed; .srand ld (_std_seed),hl ret DEFC ASMDISP_SRAND = 0 z88dk-1.8.ds1/libsrc/stdlib/strtol.asm0000644000175000017500000000035710551120402017267 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strtol LIB strtol_callee XREF ASMDISP_STRTOL_CALLEE .strtol pop af pop bc pop de pop hl push hl push de push bc push af jp strtol_callee + ASMDISP_STRTOL_CALLEE z88dk-1.8.ds1/libsrc/stdlib/strtol_callee.asm0000644000175000017500000001073610765023020020603 0ustar tygrystygrys;/* ; * strtol(char *s, char **endp, int base) ; * ; * Taken from vbcc archive ; * ; * Added to Small C+ 27/4/99 djm ; * ; * ----- ; * $Id: strtol_callee.asm,v 1.6 2008/03/08 11:28:15 aralbrec Exp $ ; * ; */ ; ; rewritten in asm and lost the overflow check in process ; 12.2006 aralbrec ; Uses all registers except iy ; long result in dehl XLIB strtol_callee LIB l_long_neg, l_long_mult XDEF ASMDISP_STRTOL_CALLEE .strtol_callee pop hl pop bc pop de ex (sp),hl ; bc = base ; de = char **endp ; hl = char *s .asmentry ld a,d or e jr z, noendp push de ; push char **endp parameter for writeendp call noendp ; do strtol but return here to write endp .writeendp ; dehl = result ; bc = char * ; stack = char **endp ex (sp),hl ; hl = char **endp ld (hl),c ; write last string position inc hl ; into endp ld (hl),b pop hl ret .noendp ld e,l ld d,h ; bc = base ; hl = char * ; de = start char * .eatws ld a,(hl) ; eat whitespace inc hl cp 32 ; inlined isspace jr z, eatws cp 7 jr z, eatws cp 10 jr z, eatws cp 13 jr z, eatws ; ate up one too many chars, see if it's a sign cp '+' jr z, signdone dec hl cp '-' jr nz, signdone inc hl ; this is a negative number call signdone ; do strtol but return here to negate result jp l_long_neg ; dehl = -dehl .signdone ; bc = base ; hl = char * ; de = start char * ld a,b ; base must be in [0,2-36] or a jp nz, fail ld a,c cp 37 jp nc, fail dec a jp z, fail inc a jr nz, checkhex ; base=0 so need to figure out if it's oct, dec or hex ld a,(hl) ld c,10 cp '0' ; if leading digit not '0' must be decimal jr nz, knownbase inc hl ld a,(hl) ; if next char is a digit must be oct ld c,8 cp '0' jp c, fail cp '7'+1 jr c, knownbase and $df ; toupper(a) ld c,16 cp 'X' ; leading 0x indicates hex jr nz, fail inc hl jp knownbase .checkhex cp 16 jr nz, knownbase ; hex numbers are allowed to begin with 0x or 0X ld a,(hl) cp '0' jr nz, knownbase inc hl ld a,(hl) inc hl cp 'x' jr z, knownbase cp 'X' jr z, knownbase dec hl dec hl .knownbase ld a,(hl) ; make sure there's at least one sub '0' ; digit else fail jr c, fail cp 10 jr c, noadj1 add a,'0' and $df sub 'A' jr c, fail add a,10 .noadj1 cp c ; base jr nc, fail .pass ; a = first number ; bc = base ; hl = char * ld ixh,b ld ixl,c ; ix = base ld d,b ld e,b ld c,l ld b,h ; bc = char * ld h,d ld l,a ; dehl = a = total so far .loop ; bc = char * ; dehl = running total ; ix = base ; first get next digit inc bc ld a,(bc) ; turn next char into digit sub '0' ret c cp 10 jr c, noadj2 add a,'0' and $df sub 'A' ret c add a,10 .noadj2 cp ixl ; base ret nc .havedigit push bc ; save char * push af ld bc,0 ; push base on stack push bc push ix call l_long_mult ; dehl = dehl * base pop af pop bc ; bc = char * ; now add in digit add a,l ld l,a jp nc, loop inc h jp nz, loop inc de jp loop .fail ld c,e ld b,d ; bc = original char * ld de,0 ; dehl = result = 0 ld h,d ld l,e ret DEFC ASMDISP_STRTOL_CALLEE = asmentry - strtol_callee ;#include ;#include ;#include ;#include ; ; ;signed long strtol( ;char *nptr, ;char **endptr, ;int base) ;{ ; ; unsigned long r; ; unsigned char *q; ; unsigned char *p; ; ; p=nptr; ; ; while(isspace(*p)) ; p++; ; r=strtoul(p,(signed char **)&q,base); ; if(endptr!=NULL) ; { if(q==p) ; *endptr=(char *)nptr; ; else ; *endptr=q; ; } ; if(*p=='-') { ; if((signed long)r>0) ; return LONG_MIN; ; else ; return r; ; } else { ; if((signed long)r<0) ; return LONG_MAX; ; else ; return r; ; } ;} z88dk-1.8.ds1/libsrc/stdlib/strtoul.asm0000644000175000017500000000036110551120402017447 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strtoul LIB strtol_callee XREF ASMDISP_STRTOL_CALLEE .strtoul pop af pop bc pop de pop hl push hl push de push bc push af jp strtol_callee + ASMDISP_STRTOL_CALLEE z88dk-1.8.ds1/libsrc/stdlib/swapendian.asm0000644000175000017500000000020310551120402020057 0ustar tygrystygrys; void __FASTCALL__ *swapendian(void *addr) ; 04.2006 aralbrec XLIB swapendian .swapendian ld a,l ld l,h ld h,a ret z88dk-1.8.ds1/libsrc/stdlib/ultoa.asm0000644000175000017500000000036310604122750017070 0ustar tygrystygrys; CALLER linkage for function pointers XLIB ultoa LIB ltoa_callee XREF ASMDISP2_LTOA_CALLEE .ultoa pop af pop hl pop de pop bc push bc push de push hl push af push bc jp ltoa_callee + ASMDISP2_LTOA_CALLEE z88dk-1.8.ds1/libsrc/stdlib/ultoa_callee.asm0000644000175000017500000000047110604122750020375 0ustar tygrystygrys; char __CALLEE__ *ultoa_callee(char *s, unsigned long num) ; convert unsigned long to string and store in s ; 04.2007 aralbrec XLIB ultoa_callee LIB ltoa_callee XREF ASMDISP2_LTOA_CALLEE .ultoa_callee pop af pop hl pop de pop bc push af push bc jp ltoa_callee + ASMDISP2_LTOA_CALLEE z88dk-1.8.ds1/libsrc/stdlib/utoa.asm0000644000175000017500000000033410604122671016714 0ustar tygrystygrys; CALLER linkage for function pointers XLIB utoa LIB itoa_callee XREF ASMDISP2_ITOA_CALLEE .utoa pop bc pop de pop hl push hl push de push bc push hl jp itoa_callee + ASMDISP2_UTOA_CALLEE z88dk-1.8.ds1/libsrc/stdlib/utoa_callee.asm0000644000175000017500000000043410604122671020222 0ustar tygrystygrys; char __CALLEE__ *utoa_callee(char *s, uint num) ; convert unsigned int to string and store in s ; 04.2007 aralbrec XLIB utoa_callee LIB itoa_callee XREF ASMDISP2_ITOA_CALLEE .utoa_callee pop hl pop de ex (sp),hl push hl jp itoa_callee + ASMDISP2_ITOA_CALLEE z88dk-1.8.ds1/libsrc/stdlib/wpeek.asm0000644000175000017500000000020510551120402017043 0ustar tygrystygrys; uint __FASTCALL__ wpeek(void *addr) ; 11.2006 aralbrec XLIB wpeek .wpeek ld e,(hl) inc hl ld d,(hl) ex de,hl ret z88dk-1.8.ds1/libsrc/stdlib/wpoke.asm0000644000175000017500000000032510551120402017060 0ustar tygrystygrys; CALLER linkage for function pointers XLIB wpoke LIB wpoke_callee XREF ASMDISP_WPOKE_CALLEE .wpoke pop af pop de pop hl push hl push de push af jp wpoke_callee + ASMDISP_WPOKE_CALLEE z88dk-1.8.ds1/libsrc/stdlib/wpoke_callee.asm0000644000175000017500000000041110577177144020410 0ustar tygrystygrys; void wpoke_callee(void *addr, uint word) ; 11.2006 aralbrec XLIB wpoke_callee XDEF ASMDISP_WPOKE_CALLEE .wpoke_callee pop hl pop de ex (sp),hl .asmentry ld (hl),e inc hl ld (hl),d ret DEFC ASMDISP_WPOKE_CALLEE = asmentry - wpoke_callee z88dk-1.8.ds1/libsrc/stdlib/z88/0000755000175000017500000000000010765202715015701 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/stdlib/z88/atol.asm0000644000175000017500000000126310547026364017346 0ustar tygrystygrys;/* ; * Z88 Standard Library ; * ; * long __FASTCALL__ atol(char *str) ; * ; * djm 25/2/2001 ; * ; * $Id: atol.asm,v 1.2 2007/01/03 22:23:48 aralbrec Exp $ ; */ ; Removed C front end to make FASTCALL, consistent with ; all other targets. Was atol.c, that file now removed. ; 12.2006 aralbrec XLIB atol XDEF ASMDISP_ATOL .atol INCLUDE "#integer.def" ex de,hl push hl push hl ; make space for a temporary long on stack ld hl,0 add hl,sp ex de,hl ; hl = char*, de = & long ld b,254 call_oz(gn_gdn) pop hl pop de ret z ; was a number ld hl,0 ld d,h ld e,l ret DEFC ASMDISP_ATOL = 0 z88dk-1.8.ds1/libsrc/stdlib/z88/csleep.asm0000644000175000017500000000126210547026364017661 0ustar tygrystygrys; ; Small C z88 Misc functions ; ; sleep(time) ; ; Pause for time centiseconds ; ; djm 1/12/98 ; ; If we can't have usleep we'll have csleep instead! ; ; ----- ; $Id: csleep.asm,v 1.3 2007/01/03 22:23:48 aralbrec Exp $ INCLUDE "#time.def" XLIB csleep XDEF ASMDISP_CSLEEP ;csleep(int time); .csleep pop hl pop bc ;number of centi-seconds.. push bc push hl .asmentry ld a,b or c jr z,csleep1 call_oz(os_dly) ld hl,1 ret c .csleep1 ld hl,0 ret DEFC ASMDISP_CSLEEP = asmentry - csleep z88dk-1.8.ds1/libsrc/stdlib/z88/getcwd.asm0000644000175000017500000000250310547026365017663 0ustar tygrystygrys; ; Z88 Small C+ Library Functions ; ; Find current directory ; ; Added to Small C archive 12/3/99 ; ; char *getcwd(char *buffer, int maxlen) ; ; *** Z88 SPECIFIC ROUTINE - UNTESTED!!! *** ; ; ; ----- ; $Id: getcwd.asm,v 1.5 2007/01/03 22:23:49 aralbrec Exp $ INCLUDE "#syspar.def" INCLUDE "#memory.def" XLIB getcwd LIB readbyte ;standard.lib XDEF ASMDISP_GETCWD .getcwd pop hl pop bc pop de push de push bc push hl .asmentry ; bc = int maxlen ; de = char *buffer push de push bc ld bc,NQ_dir ;ask for current directory call_oz(os_nq) exx pop bc ;max len pop de ;buffer ld hl,0 ret c ;error ld l,d ;keep buffer safe in hl ld h,e ;Copying loop here.. .getcwd2 ld a,c or b ret z ;we've filled our buffer exx call_oz(gn_rbe) inc hl exx ld (de),a and a ret z ;end of dir string inc de dec bc jr getcwd2 DEFC ASMDISP_GETCWD = asmentry - getcwd z88dk-1.8.ds1/libsrc/stdlib/z88/Makefile0000644000175000017500000000026110546033135017333 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.11 2006/12/31 22:14:53 aralbrec Exp $ all: @echo '' clean: $(RM) *.o* *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/stdlib/z88/mkdir.asm0000644000175000017500000000324307267305730017517 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; 30 September 1998 ** UNTESTED ** ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; This doesn't check for validity of filename at all. ; ; ----- ; $Id: mkdir.asm,v 1.3 2001/04/18 12:43:04 stefano Exp $ INCLUDE "#fileio.def" INCLUDE "#stdio.def" INCLUDE "#dor.def" INCLUDE "#error.def" XLIB mkdir ;int mkdir(char *s1,int mode) ;on stack: ;return address,mode,s1 ;s1=filename of directory to make .mkdir ;Repeating stuff from fopen, very bad but... ld d,op_dir ;make directory ;Try to open the file ;d=access mode.. ;Create some room on the stack for the filename to be expanded into.. .fopen_try ld hl,-10 add hl,sp ld sp,hl ;So, d=mode, hl=where to expand filename to... ld b,d ;keep open specifier ex de,hl ;put this in final place ld c,8 ;max chars to expand.. ;Now, find the filename! ld hl,4+10 add hl,sp ld a,(hl) inc hl ld h,(hl) ld l,a ;hl should point to filename ld a,b ;open type ld b,0 ;absolute page call_oz(gn_opf) ex af,af' ;keep our flags! ld hl,10 add hl,sp ld sp,hl ;restore our stack (we did nothing to it!) ex af,af' ;ix is our dor handle ld hl,1 ret c ;Now we have to free the directory dor ld a,dr_fre call_oz(os_dor) ld hl,0 ;NULL ret z88dk-1.8.ds1/libsrc/stdlib/z88/sleep.asm0000644000175000017500000000137410547026365017523 0ustar tygrystygrys; ; Small C z88 Misc functions ; ; sleep(time) ; ; Pause for time seconds ; ; djm 22/3/2000 Rewritten to: ; - Not loop (was causing problems) ; - Return number of seconds left ; ; ----- ; $Id: sleep.asm,v 1.3 2007/01/03 22:23:49 aralbrec Exp $ INCLUDE "#time.def" XLIB sleep LIB l_mult LIB l_div_u XDEF ASMDISP_SLEEP ;sleep(int time); .sleep pop hl pop de ;number of seconds.. push de push hl .asmentry ld hl,100 call l_mult ld c,l ld b,h call_oz(os_dly) ld hl,0 ret nc ;NULL - normal ; Now found out how long is left to sleep for.. ld e,c ld d,b ld hl,100 call l_div_u ld c,l ld b,h ret DEFC ASMDISP_SLEEP = asmentry - sleep z88dk-1.8.ds1/libsrc/strings/0000755000175000017500000000000010765202715015460 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/strings/bcmp.asm0000644000175000017500000000035310641310213017066 0ustar tygrystygrys; CALLER linkage for function pointers XLIB bcmp LIB memcmp_callee XREF ASMDISP_MEMCMP_CALLEE .bcmp pop af pop bc pop de pop hl push hl push de push bc push af jp memcmp_callee + ASMDISP_MEMCMP_CALLEE z88dk-1.8.ds1/libsrc/strings/bcopy.asm0000644000175000017500000000035510641310213017263 0ustar tygrystygrys; CALLER linkage for function pointers XLIB bcopy LIB memcpy_callee XREF ASMDISP_MEMCPY_CALLEE .bcopy pop af pop bc pop hl pop de push de push hl push bc push af jp memcpy_callee + ASMDISP_MEMCPY_CALLEE z88dk-1.8.ds1/libsrc/strings/bzero.asm0000644000175000017500000000034510641310213017267 0ustar tygrystygrys; CALLER linkage for function pointers XLIB bzero LIB memset_callee XREF ASMDISP_MEMSET_CALLEE .bzero pop de pop bc pop hl push hl push bc push de ld e,0 jp memset_callee + ASMDISP_MEMSET_CALLEE z88dk-1.8.ds1/libsrc/strings/index.asm0000644000175000017500000000033010641310213017247 0ustar tygrystygrys; CALLER linkage for function pointers XLIB index LIB strchr_callee XREF ASMDISP_STRCHR_CALLEE .index pop af pop bc pop hl push hl push bc push af jp strchr_callee + ASMDISP_STRCHR_CALLEE z88dk-1.8.ds1/libsrc/strings/Makefile0000644000175000017500000000026010546717675017133 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.8 2007/01/03 12:21:17 aralbrec Exp $ all: @echo '' clean: $(RM) *.o* *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/strings/memchr.asm0000644000175000017500000000036410550526360017435 0ustar tygrystygrys; CALLER linkage for function pointers XLIB memchr LIB memchr_callee XREF ASMDISP_MEMCHR_CALLEE .memchr pop af pop bc pop de pop hl push hl push de push bc push af jp memchar_callee + ASMDISP_MEMCHR_CALLEE - 1 z88dk-1.8.ds1/libsrc/strings/memchr_callee.asm0000644000175000017500000000112510647203164020737 0ustar tygrystygrys; void __CALLEE__ *memchr_callee(char *s, char c, uint n) ; return ptr to first occurence of c in s ; 12.1999 djm, 12.2006 aralbrec XLIB memchr_callee XDEF ASMDISP_MEMCHR_CALLEE LIB rcmx_cpir .memchr_callee pop hl pop bc pop de ex (sp),hl ld a,e ; enter : hl = char *s ; a = char c ; bc = uint n ; exit : found: hl = ptr to c in s, Z flag set ; else : hl = 0, NZ flag set ; uses : f, bc, hl .asmentry cpir dec hl ret z ld h,b ld l,c ret DEFC ASMDISP_MEMCHR_CALLEE = asmentry - memchr_callee z88dk-1.8.ds1/libsrc/strings/memcmp.asm0000644000175000017500000000035710550526360017442 0ustar tygrystygrys; CALLER linkage for function pointers XLIB memcmp LIB memcmp_callee XREF ASMDISP_MEMCMP_CALLEE .memcmp pop af pop bc pop de pop hl push hl push de push bc push af jp memcmp_callee + ASMDISP_MEMCMP_CALLEE z88dk-1.8.ds1/libsrc/strings/memcmp_callee.asm0000644000175000017500000000142010647203164020740 0ustar tygrystygrys; int __CALLEE__ memcmp_callee(void *s1, void *s2, uint n) ; compare first n chars of s1 and s2 ; 11.1999 djm, 12.2006 aralbrec XLIB memcmp_callee XDEF ASMDISP_MEMCMP_CALLEE LIB rcmx_cpi .memcmp_callee pop hl pop bc pop de ex (sp),hl ; enter : bc = uint n ; de = void *s2 ; hl = void *s1 ; exit : if s==ct : hl = 0, Z flag set ; if s<>ct : hl > 0, C+NZ flag set ; uses : af, bc, de, hl .asmentry ld a,b or c jr z, equal .loop ld a,(de) inc de cpi jr nz, different jp pe, loop .equal ld h,b ld l,c ret .different dec hl cp (hl) ld h,$80 ret nc dec h ret DEFC ASMDISP_MEMCMP_CALLEE = asmentry - memcmp_callee z88dk-1.8.ds1/libsrc/strings/memcpy.asm0000644000175000017500000000035710550526360017456 0ustar tygrystygrys; CALLER linkage for function pointers XLIB memcpy LIB memcpy_callee XREF ASMDISP_MEMCPY_CALLEE .memcpy pop af pop bc pop de pop hl push hl push de push bc push af jp memcpy_callee + ASMDISP_MEMCPY_CALLEE z88dk-1.8.ds1/libsrc/strings/memcpy_callee.asm0000644000175000017500000000075410577177144020777 0ustar tygrystygrys; void __CALLEE__ *memcpy_callee(void *s1, void *s2, uint n) ; copy n chars from s2 to s1 ; 11.1999 djm XLIB memcpy_callee XDEF ASMDISP_MEMCPY_CALLEE .memcpy_callee pop hl pop bc pop de ex (sp),hl ; enter : bc = uint n ; de = void *s2 ; hl = void *s1 ; exit : hl = void *s1 ; uses : af, bc, de .asmentry ld a,b or c ret z ex de,hl push de ldir pop hl ret DEFC ASMDISP_MEMCPY_CALLEE = asmentry - memcpy_callee z88dk-1.8.ds1/libsrc/strings/memmove.asm0000644000175000017500000000036610550526427017635 0ustar tygrystygrys; CALLER linkage for function pointers XLIB memmove LIB memmove_callee XREF ASMDISP_MEMMOVE_CALLEE .memmove pop af pop bc pop de pop hl push hl push de push bc push af jp memmove_callee + ASMDISP_MEMMOVE_CALLEE z88dk-1.8.ds1/libsrc/strings/memmove_callee.asm0000644000175000017500000000173010577177144021145 0ustar tygrystygrys; void __CALLEE__ *memmove_callee(void *s1, void *s2, uint n) ; copy n chars from s2 to s1, overlap safe ; 01.2007 aralbrec XLIB memmove_callee XDEF ASMDISP_MEMMOVE_CALLEE .memmove_callee pop hl pop bc pop de ex (sp),hl ; enter : bc = uint n ; de = void *s2 ; hl = void *s1 ; exit : hl = void *s1 ; uses : af, bc, de, hl .asmentry ld a,b or c ret z ; Because of the possibility of overlap between ; dst and src, we have two scenarios: ; 1 - (dstsrc) in which case must lddr from end ld a,h cp d jr c, must_ldir jr nz, must_lddr ld a,l cp e jr c, must_ldir ret z ; don't bother if dst=src .must_lddr push hl dec bc add hl,bc ex de,hl add hl,bc inc bc lddr pop hl ret .must_ldir push hl ex de,hl ldir pop hl ret DEFC ASMDISP_MEMMOVE_CALLEE = asmentry - memmove_callee z88dk-1.8.ds1/libsrc/strings/memopd.asm0000644000175000017500000000040410642611356017440 0ustar tygrystygrys; CALLER linkage for function pointers XLIB memopd LIB memopd_callee XREF ASMDISP_MEMOPD_CALLEE .memopd pop af pop ix pop bc pop de pop hl push hl push de push bc push bc push af jp memopd_callee + ASMDISP_MEMOPD_CALLEE z88dk-1.8.ds1/libsrc/strings/memopd_callee.asm0000644000175000017500000000266610642611357020762 0ustar tygrystygrys; void __CALLEE__ *memopd(void *dst, void *src, uint n, uint op) ; *dst = *src OP *dst, decreasing src and dst addresses ; OP: 0=load, 1=or, 2=xor, 3=and, 4=add, 5 = adc, 6=sub, 7 = sbc, 8 = rls, 9 = rrs else address of OP function ; 05.2007 aralbrec XLIB memopd_callee XDEF ASMDISP_MEMOPD_CALLEE LIB l_jpix, memops .memopd_callee pop hl pop ix pop bc pop de ex (sp),hl .asmentry ; enter : ix = OP ; bc = uint n ; de = src ; hl = dst ld a,b or c ret z push hl ld a,ixh or a jr nz, func ld a,ixl cp 10 jr nc, func add a,a add a,memops%256 ld ixl,a ld a,0 adc a,memops/256 ld ixh,a ; ix = addr of op function .loop ld a,(de) call l_jpix .return ld (hl),a dec hl dec de dec bc ; must not mess with carry flag in loop inc c dec c jp nz, loop inc b djnz loop pop hl ret .func push bc push de push hl ld a,(de) ld e,a ld d,0 ld l,(hl) ld h,d push hl push de call l_jpix ; (func)(uchar dst_byte, uchar src_byte) ld a,l pop de pop hl pop hl pop de pop bc ld (hl),a dec hl dec de dec bc ; must not mess with carry flag in loop inc c dec c jp nz, func inc b djnz func pop hl ret DEFC ASMDISP_MEMOPD_CALLEE = asmentry - memopd_callee z88dk-1.8.ds1/libsrc/strings/memopi.asm0000644000175000017500000000040410642611357017446 0ustar tygrystygrys; CALLER linkage for function pointers XLIB memopi LIB memopi_callee XREF ASMDISP_MEMOPI_CALLEE .memopi pop af pop ix pop bc pop de pop hl push hl push de push bc push bc push af jp memopi_callee + ASMDISP_MEMOPI_CALLEE z88dk-1.8.ds1/libsrc/strings/memopi_callee.asm0000644000175000017500000000266610642611357020767 0ustar tygrystygrys; void __CALLEE__ *memopi(void *dst, void *src, uint n, uint op) ; *dst = *src OP *dst, increasing src and dst addresses ; OP: 0=load, 1=or, 2=xor, 3=and, 4=add, 5 = adc, 6=sub, 7 = sbc, 8 = rls, 9 = rrs else address of OP function ; 05.2007 aralbrec XLIB memopi_callee XDEF ASMDISP_MEMOPI_CALLEE LIB l_jpix, memops .memopi_callee pop hl pop ix pop bc pop de ex (sp),hl .asmentry ; enter : ix = OP ; bc = uint n ; de = src ; hl = dst ld a,b or c ret z push hl ld a,ixh or a jr nz, func ld a,ixl cp 10 jr nc, func add a,a add a,memops%256 ld ixl,a ld a,0 adc a,memops/256 ld ixh,a ; ix = addr of op function .loop ld a,(de) call l_jpix .return ld (hl),a inc hl inc de dec bc ; must not mess with carry flag in loop inc c dec c jp nz, loop inc b djnz loop pop hl ret .func push bc push de push hl ld a,(de) ld e,a ld d,0 ld l,(hl) ld h,d push hl push de call l_jpix ; (func)(uchar dst_byte, uchar src_byte) ld a,l pop de pop hl pop hl pop de pop bc ld (hl),a inc hl inc de dec bc ; must not mess with carry flag in loop inc c dec c jp nz, func inc b djnz func pop hl ret DEFC ASMDISP_MEMOPI_CALLEE = asmentry - memopi_callee z88dk-1.8.ds1/libsrc/strings/memops.asm0000644000175000017500000000054010642611357017461 0ustar tygrystygrys; operations for memopi() and memopd() ; 06.2007 aralbrec XLIB memops .memops .opload nop ret .opor or (hl) ret .opxor xor (hl) ret .opand and (hl) ret .opadd add a,(hl) ret .opadc adc a,(hl) ret .opsub sub (hl) ret .opsbc sbc a,(hl) ret .oprls rla ret .oprrs rra ret z88dk-1.8.ds1/libsrc/strings/memset.asm0000644000175000017500000000036010550526360017450 0ustar tygrystygrys; CALLER linkage for function pointers XLIB memset LIB memset_callee XREF ASMDISP_MEMSET_CALLEE .memset pop af pop bc pop de pop hl push hl push de push bc push af jp memset_callee + ASMDISP_MEMSET_CALLEE z88dk-1.8.ds1/libsrc/strings/memset_callee.asm0000644000175000017500000000111010577177144020762 0ustar tygrystygrys; void __CALLEE__ *memset_callee(void *s, char c, uint n) ; write c into first n chars of s ; 04.2001 djm, 12.2006 aralbrec XLIB memset_callee XDEF ASMDISP_MEMSET_CALLEE .memset_callee pop hl pop bc pop de ex (sp),hl ; enter : hl = void *s ; e = char c ; bc = uint n ; exit : hl = void *s ; uses : af, bc, de .asmentry ld a,b or c ret z ld (hl),e dec bc ld a,b or c ret z push hl ld e,l ld d,h inc de ldir pop hl ret DEFC ASMDISP_MEMSET_CALLEE = asmentry - memset_callee z88dk-1.8.ds1/libsrc/strings/memswap.asm0000644000175000017500000000036510551013147017627 0ustar tygrystygrys; CALLER linkage for function pointers XLIB memswap LIB memswap_callee XREF ASMDISP_MEMSWAP_CALLEE .memswap pop af pop bc pop de pop hl push hl push de push bc push af jp memswap_callee + ASMDISP_MEMSWAP_CALLEE z88dk-1.8.ds1/libsrc/strings/memswap_callee.asm0000644000175000017500000000105010577177144021144 0ustar tygrystygrys; void __CALLEE__ *memswap_callee(void *s1, void *s2, uint n) ; swap N bytes in the two memory regions ; 01.2007 aralbrec XLIB memswap_callee XDEF ASMDISP_MEMSWAP_CALLEE .memswap_callee pop hl pop bc pop de ex (sp),hl ; enter : bc = uint n ; de = void *s2 ; hl = void *s1 ; uses : af, bc, de, hl .asmentry ld a,b or c ret z push hl .loop ld a,(de) ldi dec hl ld (hl),a inc hl jp pe, loop pop hl ret DEFC ASMDISP_MEMSWAP_CALLEE = asmentry - memswap_callee z88dk-1.8.ds1/libsrc/strings/README0000644000175000017500000000100410550526360016330 0ustar tygrystygrysAll routines in this directory are machine independent! strtok contains a static variable!!! This routine CANNOT be ROM'd as is! A ROMable version would refer to a global C variable declared by the user. There are two entry points for each function: the usual CALLER linkage with a call to name() and the CALLEE linkage name_callee(). The latter is much better and macros defined in the header file ensure that callee linkage is used by default. The CALLER linkage functions are there for function pointers. z88dk-1.8.ds1/libsrc/strings/rindex.asm0000644000175000017500000000033610641310213017437 0ustar tygrystygrys; CALLER linkage for function pointers XLIB rindex LIB strrchr_callee XREF ASMDISP_STRRCHR_CALLEE .rindex pop hl pop bc pop de push de push bc push hl jp strrchr_callee + ASMDISP_STRRCHR_CALLEE z88dk-1.8.ds1/libsrc/strings/strcasecmp.asm0000644000175000017500000000034610641310213020313 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strcasecmp LIB stricmp_callee XREF ASMDISP_STRICMP_CALLEE .strcasecmp pop bc pop de pop hl push hl push de push bc jp stricmp_callee + ASMDISP_STRICMP_CALLEE z88dk-1.8.ds1/libsrc/strings/strcat.asm0000644000175000017500000000033310550526360017456 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strcat LIB strcat_callee XREF ASMDISP_STRCAT_CALLEE .strcat pop bc pop de pop hl push hl push de push bc jp strcat_callee + ASMDISP_STRCAT_CALLEE z88dk-1.8.ds1/libsrc/strings/strcat_callee.asm0000644000175000017500000000135310647203164020767 0ustar tygrystygrys; char __CALLEE__ *strcat_callee(char *dst, char *src) ; copy src to end of dst ; 12.2006 aralbrec XLIB strcat_callee XDEF ASMDISP_STRCAT_CALLEE LIB rcmx_cpir .strcat_callee pop hl pop de ex (sp),hl ; enter : de = char *src ; hl = char *dst ; exit : hl = char *dst ; uses : af, bc, de .asmentry push hl ; save char *dst xor a ; first find end of char *dst ld c,a ld b,a cpir dec hl ex de,hl .loop ; next copy char *src to end of char *dst ld a,(hl) ldi or a jp nz, loop pop hl ; return with hl = char *s ret DEFC ASMDISP_STRCAT_CALLEE = asmentry - strcat_callee z88dk-1.8.ds1/libsrc/strings/strchr.asm0000644000175000017500000000033310550526360017463 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strchr LIB strchr_callee XREF ASMDISP_STRCHR_CALLEE .strchr pop af pop bc pop hl push hl push bc push af jp strchr_callee + ASMDISP_STRCHR_CALLEE z88dk-1.8.ds1/libsrc/strings/strchr_callee.asm0000644000175000017500000000104110622024040020751 0ustar tygrystygrys; char __CALLEE__ *strchr_callee(char *s, char c) ; return ptr to first occurrence of c in s ; 04.2001 dom XLIB strchr_callee XDEF ASMDISP_STRCHR_CALLEE .strchr_callee pop hl pop bc ex (sp),hl ; enter : c = char c ; hl = char *s ; exit : found : hl = ptr, NC flag set ; else : hl = 0, C flag set ; uses : af, hl .asmentry .loop ld a,(hl) cp c ret z inc hl or a jp nz, loop ld l,a ld h,a scf ret DEFC ASMDISP_STRCHR_CALLEE = asmentry - strchr_callee z88dk-1.8.ds1/libsrc/strings/strcmp.asm0000644000175000017500000000033310550526360017466 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strcmp LIB strcmp_callee XREF ASMDISP_STRCMP_CALLEE .strcmp pop bc pop de pop hl push hl push de push bc jp strcmp_callee + ASMDISP_STRCMP_CALLEE z88dk-1.8.ds1/libsrc/strings/strcmp_callee.asm0000644000175000017500000000256310577177144021015 0ustar tygrystygrys; char __CALLEE__ *strcmp_callee(char *s1, char *s2) ; compare strings s1 and s2 ; ; Apr 25 1999 djm - Previously would return non ; zero if the two strings matched (it ignored ; the \0 at the end!) ; ; Jan 12 2002 Graham R. Cobb - Rewritten, ; previously strcmp("A","AB") would return 0. ; ; Mar 24 2002 Graham R. Cobb - Fix to above. ; Make sure positive return really is > 0 (not = 0) ; ; Jun 09 2002 Benjamin Green - Use CPI and ; rearrange loop slightly ; ; Dec 30 2006 aralbrec - Stop using cpi as that ; is slower than cp (hl) + inc hl combination! XLIB strcmp_callee XDEF ASMDISP_STRCMP_CALLEE .strcmp_callee pop hl pop de ex (sp),hl ; enter : hl = char *s1 ; de = char *s2 ; exit : if s1==s2 : hl = 0, Z flag set ; if s1<>s2 : hl > 0, C+NZ flag set ; uses : af, de, hl .asmentry .strcmp1 ld a,(de) inc de cp (hl) ; compare with s1 jr nz,strcmp2 inc hl and a ; check for end of strings jp nz, strcmp1 ld l,a ; both strings ended simultaneously ld h,a ; it's a match! ret .strcmp2 ; strings are different ld h,$80 ret nc dec h ret DEFC ASMDISP_STRCMP_CALLEE = asmentry - strcmp_callee z88dk-1.8.ds1/libsrc/strings/strcpy.asm0000644000175000017500000000033310550526360017502 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strcpy LIB strcpy_callee XREF ASMDISP_STRCPY_CALLEE .strcpy pop bc pop hl pop de push de push hl push bc jp strcpy_callee + ASMDISP_STRCPY_CALLEE z88dk-1.8.ds1/libsrc/strings/strcpy_callee.asm0000644000175000017500000000076410645124020021007 0ustar tygrystygrys; char __CALLEE__ *strcpy_callee(char *dst, char *src) ; copy src to dst including '\0' ; 03.1999 djm, 12.2006 aralbrec XLIB strcpy_callee XDEF ASMDISP_STRCPY_CALLEE .strcpy_callee pop hl pop de ex (sp),hl ex de,hl ; enter : hl = char *src ; de = char *dst ; exit : hl = char *dst ; uses : af, bc, de, hl .asmentry push de .loop ld a,(hl) ldi or a jp nz, loop pop hl ret DEFC ASMDISP_STRCPY_CALLEE = asmentry - strcpy_callee z88dk-1.8.ds1/libsrc/strings/strcspn.asm0000644000175000017500000000034110550526360017651 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strcspn LIB strcspn_callee XREF ASMDISP_STRCSPN_CALLEE .strcspn pop bc pop de pop hl push hl push de push bc jp strcspn_callee + ASMDISP_STRCSPN_CALLEE z88dk-1.8.ds1/libsrc/strings/strcspn_callee.asm0000644000175000017500000000135410577177144021176 0ustar tygrystygrys; int __CALLEE__ strcspn_callee(char *s1, char *s2) ; return length of prefix of s1 NOT containing chars in s2 ; 01.2007 aralbrec XLIB strcspn_callee XDEF ASMDISP_STRCSPN_CALLEE LIB strchr_callee XREF ASMDISP_STRCHR_CALLEE .strcspn_callee pop hl pop de ex (sp),hl ; enter : de = char *s2 ; hl = char *s1 ; exit : hl = prefix length ; uses : af, bc, hl .asmentry ld bc,0 ; counter .loop ld a,(hl) or a jr z, done push bc push hl ld c,a ld l,e ld h,d call strchr_callee + ASMDISP_STRCHR_CALLEE pop hl pop bc jr nc, done inc bc inc hl jp loop .done ld l,c ld h,b ret DEFC ASMDISP_STRCSPN_CALLEE = asmentry - strcspn_callee z88dk-1.8.ds1/libsrc/strings/stricmp.asm0000644000175000017500000000034010550526360017635 0ustar tygrystygrys; CALLER linkage for function pointers XLIB stricmp LIB stricmp_callee XREF ASMDISP_STRICMP_CALLEE .stricmp pop bc pop de pop hl push hl push de push bc jp stricmp_callee + ASMDISP_STRICMP_CALLEE z88dk-1.8.ds1/libsrc/strings/stricmp_callee.asm0000644000175000017500000000163210641310275021144 0ustar tygrystygrys; char __CALLEE__ *stricmp_callee(char *s1, char *s2) ; a caseless string comparison ; 12.2006 aralbrec XLIB stricmp_callee XDEF ASMDISP_STRICMP_CALLEE .stricmp_callee pop hl pop de ex (sp),hl ; enter : hl = char *s1 ; de = char *s2 ; exit : if s1==s2 : hl = 0, Z flag set ; if s1<>s2 : hl > 0, C+NZ flag set ; uses : af, c, de, hl .asmentry .stricmp1 ld a,(hl) inc hl cp 'A' jr c, ASMPC+8 cp 'Z'+1 jr nc, ASMPC+4 or $20 ld c,a ld a,(de) inc de cp 'A' jr c, ASMPC+8 cp 'Z'+1 jr nc, ASMPC+4 or $20 cp c jr nz, different or a jp nz, stricmp1 ; here strings are equal ld l,a ld h,a ret .different ; effectively performed *s2 - *s1 ld h,$80 ret nc dec h ret DEFC ASMDISP_STRICMP_CALLEE = asmentry - stricmp_callee z88dk-1.8.ds1/libsrc/strings/strlen.asm0000644000175000017500000000057410647203164017475 0ustar tygrystygrys; int __FASTCALL__ strlen(char *s) ; return length of s ; 12.2006 aralbrec XLIB strlen XDEF ASMDISP_STRLEN LIB rcmx_cpir ; A funky version that's quicker than the ; usual implementation for lengths > 1 ; enter: hl = char *s ; exit : hl = length ; uses : af, bc, hl .strlen xor a ld c,a ld b,a cpir ld hl,$ffff sbc hl,bc ret DEFC ASMDISP_STRLEN = 0 z88dk-1.8.ds1/libsrc/strings/strlwr.asm0000644000175000017500000000061310546717675017534 0ustar tygrystygrys; char __FASTCALL__ *strlwr(char *s) ; change string to lower case ; 12.2006 aralbrec ; enter: hl = char *s ; exit : hl = char *s ; uses : af XLIB strlwr XDEF ASMDISP_STRLWR .strlwr push hl dec hl .loop inc hl ld a,(hl) or a jr z, exit cp 'A' jr c, loop cp 'Z'+1 jr nc, loop or 32 ld (hl),a jp loop .exit pop hl ret DEFC ASMDISP_STRLWR = 0 z88dk-1.8.ds1/libsrc/strings/strncasecmp.asm0000644000175000017500000000040110641310213020461 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strncasecmp LIB strnicmp_callee XREF ASMDISP_STRNICMP_CALLEE .strncasecmp pop af pop bc pop de pop hl push hl push de push bc push af jp strnicmp_callee + ASMDISP_STRNICMP_CALLEE z88dk-1.8.ds1/libsrc/strings/strncat.asm0000644000175000017500000000036610550526360017642 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strncat LIB strncat_callee XREF ASMDISP_STRNCAT_CALLEE .strncat pop af pop bc pop hl pop de push de push hl push bc push af jp strncat_callee + ASMDISP_STRNCAT_CALLEE z88dk-1.8.ds1/libsrc/strings/strncat_callee.asm0000644000175000017500000000152710555743313021153 0ustar tygrystygrys; char __CALEE__ *strncat_callee(char *dst, char *src, uint n) ; copy src to dst but no more than n chars, add '\0' ; 04.2001 dom, 12.2006 aralbrec XLIB strncat_callee XDEF ASMDISP_STRNCAT_CALLEE .strncat_callee pop af pop bc pop hl pop de push af ; enter : hl = char *src ; de = char *dst ; bc = uint n ; exit : hl = char *dst ; uses : af, bc, de, hl .asmentry push de ld a,b or c ; if n=0 don't do anything jr z, exit ; first find the end of string s1 .loop1 ld a,(de) inc de or a jp nz, loop1 dec de ; now append s2 to s1 but no more than n chars .loop2 ld a,(hl) or a jr z, done ldi jp pe, loop2 xor a .done ld (de),a .exit pop hl ret DEFC ASMDISP_STRNCAT_CALLEE = asmentry - strncat_callee z88dk-1.8.ds1/libsrc/strings/strncmp.asm0000644000175000017500000000036610550526360017652 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strncmp LIB strncmp_callee XREF ASMDISP_STRNCMP_CALLEE .strncmp pop af pop bc pop de pop hl push hl push de push bc push af jp strncmp_callee + ASMDISP_STRNCMP_CALLEE z88dk-1.8.ds1/libsrc/strings/strncmp_callee.asm0000644000175000017500000000150110647203164021150 0ustar tygrystygrys; int __CALLEE__ strncmp_callee(char *s1, char *s2, uint n) ; compare at most n chars of string s1 to string s2 ; 05.2002 dom, 12.2006 aralbrec XLIB strncmp_callee XDEF ASMDISP_STRNCMP_CALLEE LIB rcmx_cpi .strncmp_callee pop hl pop bc pop de ex (sp),hl ; enter : bc = uint n ; de = char *s2 ; hl = char *s1 ; exit : if s1==s2 : hl = 0, Z flag set ; if s1<>s2 : hl > 0, C+NZ flag set ; uses : af, de, hl .asmentry ld a,b or c jr z, equal .strncmp1 ld a,(de) inc de cpi jr nz, different jp po, equal or a jp nz, strncmp1 .equal ld hl,0 ret .different dec hl cp (hl) ld h,$80 ret nc dec h ret DEFC ASMDISP_STRNCMP_CALLEE = asmentry - strncmp_callee z88dk-1.8.ds1/libsrc/strings/strncpy.asm0000644000175000017500000000036610550526360017666 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strncpy LIB strncpy_callee XREF ASMDISP_STRNCPY_CALLEE .strncpy pop af pop bc pop hl pop de push de push hl push bc push af jp strncpy_callee + ASMDISP_STRNCPY_CALLEE z88dk-1.8.ds1/libsrc/strings/strncpy_callee.asm0000644000175000017500000000142610555743153021177 0ustar tygrystygrys; char __CALLEE__ *strncpy_callee(char *dst, char *src, uint n) ; copy at most n chars from src to dst and padding with '\0' if nec ; 04.2001 dom, 12.2006 aralbrec XLIB strncpy_callee XDEF ASMDISP_STRNCPY_CALLEE .strncpy_callee pop af pop bc pop hl pop de push af ; enter : de = char *dst ; hl = char *src ; bc = uint n ; exit : hl = char *dst ; uses : af, bc, de, hl .asmentry push de ld a,b or c jr z, done ; first copy src into dst .loopcpy ld a,(hl) ldi jp po, done ; reached max number of chars or a jp nz, loopcpy ; now pad with zeroes ld l,e ld h,d dec hl ldir .done pop hl ret DEFC ASMDISP_STRNCPY_CALLEE = asmentry - strncpy_callee z88dk-1.8.ds1/libsrc/strings/strnicmp.asm0000644000175000017500000000037410550526360020022 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strnicmp LIB strnicmp_callee XREF ASMDISP_STRNICMP_CALLEE .strnicmp pop af pop bc pop de pop hl push hl push de push bc push af jp strnicmp_callee + ASMDISP_STRNICMP_CALLEE z88dk-1.8.ds1/libsrc/strings/strnicmp_callee.asm0000644000175000017500000000175510641310275021330 0ustar tygrystygrys; int __CALLEE__ strnicmp_callee(char *s1, char *s2, uint n) ; caseless compare ; 12.2006 aralbrec XLIB strnicmp_callee XDEF ASMDISP_STRNICMP_CALLEE .strnicmp_callee pop hl pop bc pop de ex (sp),hl ; enter : bc = uint n ; de = char *s2 ; hl = char *s1 ; exit : if s1==s2 : hl = 0, Z flag set ; if s1<>s2 : hl > 0, C+NZ flag set ; uses : af, bc, de, hl .asmentry .strnicmp1 ld a,b or c jr z, equal push bc ld a,(hl) inc hl cp 'A' jr c, ASMPC+8 cp 'Z'+1 jr nc, ASMPC+4 or $20 ld c,a ld a,(de) inc de cp 'A' jr c, ASMPC+8 cp 'Z'+1 jr nc, ASMPC+4 or $20 cp c pop bc jr nz, different dec bc or a jp nz, strnicmp1 .equal ld hl,0 ret .different ; effectively performed *s2 - *s1 ld h,$80 ret nc dec h ret DEFC ASMDISP_STRNICMP_CALLEE = asmentry - strnicmp_callee z88dk-1.8.ds1/libsrc/strings/strpbrk.asm0000644000175000017500000000034410550526360017647 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strpbrk LIB strpbrk_callee XREF ASMDISP_STRPBRK_CALLEE .strpbrk pop bc pop de pop hl push hl push de push bc jp strpbrk_callee + ASMDISP_STRPBRK_CALLEE z88dk-1.8.ds1/libsrc/strings/strpbrk_callee.asm0000644000175000017500000000134010577177144021164 0ustar tygrystygrys; char __CALLEE__ *strpbrk_callee(char *s, char *match) ; return ptr to first occurrence in s1 of any char in match ; 01.2007 aralbrec XLIB strpbrk_callee XDEF ASMDISP_STRPBRK_CALLEE LIB strchr_callee XREF ASMDISP_STRCHR_CALLEE .strpbrk_callee pop hl pop de ex (sp),hl ; enter : hl = char *s ; de = char *match ; exit : found : hl = ptr, NC flag set ; else : hl = 0, C flag set ; uses : af, c, hl .asmentry .loop ld a,(hl) or a jr z, fail push hl ld l,e ld h,d ld c,a call strchr_callee + ASMDISP_STRCHR_CALLEE pop hl ret nc inc hl jp loop .fail ld l,a ld h,a scf ret DEFC ASMDISP_STRPBRK_CALLEE = asmentry - strpbrk_callee z88dk-1.8.ds1/libsrc/strings/strpos.asm0000644000175000017500000000033310550526360017510 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strpos LIB strpos_callee XREF ASMDISP_STRPOS_CALLEE .strpos pop hl pop de pop bc push bc push de push hl jp strpos_callee + ASMDISP_STRPOS_CALLEE z88dk-1.8.ds1/libsrc/strings/strpos_callee.asm0000644000175000017500000000130610550526360021016 0ustar tygrystygrys; int __CALLEE__ strpos_callee(char *s, char c) ; find index of first occurrence of c in s ; 01.2007 aralbrec XLIB strpos_callee XDEF ASMDISP_STRPOS_CALLEE .strpos_callee pop hl pop de pop bc push hl ; enter : e = char c ; bc = char *s ; exit : found : hl = index of char c, NC flag set ; else : hl = -1, C flag set ; uses : af, bc, hl .asmentry ld hl,0 .loop ld a,(bc) cp e ; putting this first allows ret z ; search for '\0' or a jr z, fail inc bc inc hl jp loop .fail dec a ld l,a ld h,a scf ret DEFC ASMDISP_STRPOS_CALLEE = asmentry - strpos_callee z88dk-1.8.ds1/libsrc/strings/strrchr.asm0000644000175000017500000000034110550526360017644 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strrchr LIB strrchr_callee XREF ASMDISP_STRRCHR_CALLEE .strrchr pop hl pop bc pop de push de push bc push hl jp strrchr_callee + ASMDISP_STRRCHR_CALLEE z88dk-1.8.ds1/libsrc/strings/strrchr_callee.asm0000644000175000017500000000110010550700634021141 0ustar tygrystygrys; char __CALLEE__ *strrchr_callee(char *s, char c) ; return ptr to last occurrence of c in s ; 04.2001 dom, 01.2007 aralbrec XLIB strrchr_callee XDEF ASMDISP_STRRCHR_CALLEE .strrchr_callee pop hl pop bc pop de push hl ; enter : c = char c ; de = char *s ; exit : found : hl = ptr ; else : hl = 0 ; uses : af, de, hl .asmentry ld hl,0 .loop ld a,(de) cp c jp nz, nomatch ld l,e ld h,d .nomatch or a inc de jp nz, loop ret DEFC ASMDISP_STRRCHR_CALLEE = asmentry - strrchr_callee z88dk-1.8.ds1/libsrc/strings/strrev.asm0000644000175000017500000000112710647203164017506 0ustar tygrystygrys; char __FASTCALL__ *strrev(char *s) ; reverse string ; 12.2006 aralbrec ; enter: hl = char *s ; exit : hl = char *s ; uses : af, bc, de XLIB strrev XDEF ASMDISP_STRREV LIB rcmx_cpir .strrev xor a ld c,a ld b,a ld e,l ld d,h cpir ; find end of string dec hl dec hl push de ld a,b ; bc = -(bc/2)-1 sra a rr c cpl ld b,a ld a,c cpl ld c,a or b jr z, exit .revlp ld a,(de) ldi dec hl ld (hl),a dec hl jp pe, revlp .exit pop hl ret DEFC ASMDISP_STRREV = 0 z88dk-1.8.ds1/libsrc/strings/strrstr.asm0000644000175000017500000000034010550526360017677 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strrstr LIB strrstr_callee XREF ASMDISP_STRRSTR_CALLEE .strrstr pop bc pop de pop hl push hl push de push bc jp strrstr_callee + ASMDISP_STRRSTR_CALLEE z88dk-1.8.ds1/libsrc/strings/strrstr_callee.asm0000644000175000017500000000215710647203164021215 0ustar tygrystygrys; char __CALLEE__ *strrstr_callee(char *s, char *w) ; return ptr to last occurrence of string w in s ; 01.2007 aralbrec XLIB strrstr_callee XDEF ASMDISP_STRRSTR_CALLEE LIB rcmx_cpir .strrstr_callee pop hl pop de ex (sp),hl ; enter : de = char *w ; hl = char *s ; exit : found : hl = ptr, NC flag set ; else : hl = ptr to '\0' in s, C flag set ; uses : af, bc, hl .asmentry ; first find end of s and len(s) xor a ld c,a ld b,a cpir dec hl ; de = char *w ; hl = terminating '\0' in char *s ; bc = -(length of char *s)-1 ; degenerate case ld a,(de) or a ret z .loop1 dec hl inc bc ld a,b or c jr z, nomatch ld a,(de) cp (hl) jp nz, loop1 push hl ; save char *s push de ; save char *w .loop2 inc de ld a,(de) or a jr z, match inc hl cp (hl) jp z, loop2 pop de pop hl jp loop1 .nomatch ld l,c ld h,b scf ret .match pop de pop hl ret DEFC ASMDISP_STRRSTR_CALLEE = asmentry - strrstr_callee z88dk-1.8.ds1/libsrc/strings/strrstrip.asm0000644000175000017500000000035510550526360020236 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strrstrip LIB strrstrip_callee XREF ASMDISP_STRRSTRIP_CALLEE .strrstrip pop de pop bc pop hl push hl push bc push de jp strrstrip_callee + ASMDISP_STRRSTRIP_CALLEE z88dk-1.8.ds1/libsrc/strings/strrstrip_callee.asm0000644000175000017500000000130010577177145021546 0ustar tygrystygrys; char __CALLEE__ *strrstrip_callee(char *s, char c) ; remove any occurrences of c at the end of s ; 01.2007 aralbrec XLIB strrstrip_callee XDEF ASMDISP_STRRSTRIP_CALLEE .strrstrip_callee pop hl pop bc ex (sp),hl ; enter : c = char c ; hl = char *s ; exit : hl = char *s ; uses : af, de .asmentry push hl .failloop ld a,(hl) or a jr z, fail inc hl cp c jp nz, failloop ld e,l ld d,h dec de .passloop ld a,(hl) or a jr z,pass inc hl cp c jr nz, failloop jp passloop .pass xor a ld (de),a .fail pop hl ret DEFC ASMDISP_STRRSTRIP_CALLEE = asmentry - strrstrip_callee z88dk-1.8.ds1/libsrc/strings/strspn.asm0000644000175000017500000000033310550526360017507 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strspn LIB strspn_callee XREF ASMDISP_STRSPN_CALLEE .strspn pop bc pop de pop hl push hl push de push bc jp strspn_callee + ASMDISP_STRSPN_CALLEE z88dk-1.8.ds1/libsrc/strings/strspn_callee.asm0000644000175000017500000000131010577177145021024 0ustar tygrystygrys; int __CALLEE__ strspn_callee(char *s1, char *s2) ; return length of prefix in s1 containing chars in s2 ; 01.2007 aralbrec XLIB strspn_callee XDEF ASMDISP_STRSPN_CALLEE LIB strchr_callee XREF ASMDISP_STRCHR_CALLEE .strspn_callee pop hl pop de ex (sp),hl ; enter : de = char *s2 ; hl = char *s1 ; exit : hl = prefix length ; uses : af, bc, hl .asmentry ld bc,0 .loop ld a,(hl) or a jr z, done push bc push hl ld c,a ld l,e ld h,d call strchr_callee + ASMDISP_STRCHR_CALLEE pop hl pop bc jr c, done inc bc inc hl jp loop .done ld l,c ld h,b ret DEFC ASMDISP_STRSPN_CALLEE = asmentry - strspn_callee z88dk-1.8.ds1/libsrc/strings/strstr.asm0000644000175000017500000000033210550526360017516 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strstr LIB strstr_callee XREF ASMDISP_STRSTR_CALLEE .strstr pop af pop hl pop de push de push hl push af jp strstr_callee + ASMDISP_STRSTR_CALLEE z88dk-1.8.ds1/libsrc/strings/strstr_callee.asm0000644000175000017500000000156110550526360021030 0ustar tygrystygrys; char __CALLEE__ *strstr_callee(char *s, char *w) ; return ptr to first occurrence of string w in s ; 01.2007 aralbrec XLIB strstr_callee XDEF ASMDISP_STRSTR_CALLEE .strstr_callee pop af pop hl pop de push af ; enter : de = char *s ; hl = char *w ; exit : found : hl = ptr, NC flag set ; else : hl = 0, C flag set ; uses : af, de, hl .asmentry dec de .loop1 inc de ld a,(de) cp (hl) jr z, maybe or a jp nz, loop1 .fail ld l,a ld h,a scf ret .maybe push hl ; save char *w push de ; save char *s ex de,hl .loop2 ld a,(de) or a jr z, match inc de cp (hl) inc hl jp z, loop2 pop de pop hl jp loop1 .match pop hl pop de ret DEFC ASMDISP_STRSTR_CALLEE = asmentry - strstr_callee z88dk-1.8.ds1/libsrc/strings/strstrip.asm0000644000175000017500000000034710550526360020055 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strstrip LIB strstrip_callee XREF ASMDISP_STRSTRIP_CALLEE .strstrip pop bc pop de pop hl push hl push de push bc jp strstrip_callee + ASMDISP_STRSTRIP_CALLEE z88dk-1.8.ds1/libsrc/strings/strstrip_callee.asm0000644000175000017500000000136110577177145021373 0ustar tygrystygrys; char __CALLEE__ *strstrip_callee(char *s, char c) ; remove occurences of leading char c from string s ; 01.2007 aralbrec XLIB strstrip_callee XDEF ASMDISP_STRSTRIP_CALLEE .strstrip_callee pop hl pop de ex (sp),hl ld a,e ; enter : a = char c ; hl = char *s ; exit : hl = char *s ; uses : af, bc, de, hl .asmentry ld e,l ld d,h .skip cp (hl) inc hl jp z, skip dec hl ; the case where there are no unwanted chars is common... ld a,l cp e jr nz, copy ld a,h cp d jr nz, copy ex de,hl ret .copy push de .copyloop ld a,(hl) ldi or a jp nz, copyloop pop hl ret DEFC ASMDISP_STRSTRIP_CALLEE = asmentry - strstrip_callee z88dk-1.8.ds1/libsrc/strings/strtok.asm0000644000175000017500000000033310550526360017504 0ustar tygrystygrys; CALLER linkage for function pointers XLIB strtok LIB strtok_callee XREF ASMDISP_STRTOK_CALLEE .strtok pop af pop de pop hl push hl push de push af jp strtok_callee + ASMDISP_STRTOK_CALLEE z88dk-1.8.ds1/libsrc/strings/strtok_callee.asm0000644000175000017500000000212310577177145021024 0ustar tygrystygrys; char __CALLEE__ *strtok_callee(char *s, char *delim) ; on each call, return next token in s using delimiters from string delim ; 01.2007 aralbrec XLIB strtok_callee XDEF ASMDISP_STRTOK_CALLEE LIB strchr_callee XREF ASMDISP_STRCHR_CALLEE ; static data stored here, not ROMable .strtok_callee pop hl pop de ex (sp),hl ; enter : de = char *delim ; hl = char *s ; exit : token found : hl = ptr, C flag set ; else : hl = 0, NC flag set ; uses : af, c, de, hl .asmentry ld a,h or l jr nz, newstart ld hl,(lastpos) ld a,h or l ret z .newstart ex de,hl ; hl = char *delim ; de = char *s push de .loop ld a,(de) or a jr z, endstring ld c,a push hl call strchr_callee + ASMDISP_STRCHR_CALLEE pop hl jr nc, endtoken inc de jp loop .endstring ld l,a ld h,a ld (lastpos),hl pop hl scf ret .endtoken ex de,hl ld (hl),0 inc hl ld (lastpos),hl pop hl scf ret .lastpos defw 0 DEFC ASMDISP_STRTOK_CALLEE = asmentry - strtok_callee z88dk-1.8.ds1/libsrc/strings/strupr.asm0000644000175000017500000000061610546717675017541 0ustar tygrystygrys; char __FASTCALL__ *strupr(char *s) ; change string to upper case ; 01.2007 aralbrec ; enter: hl = char *s ; exit : hl = char *s ; uses : af XLIB strupr XDEF ASMDISP_STRUPR .strupr push hl dec hl .loop inc hl ld a,(hl) or a jr z, exit cp 'a' jr c, loop cp 'z'+1 jr nc, loop and $df ld (hl),a jp loop .exit pop hl ret DEFC ASMDISP_STRUPR = 0 z88dk-1.8.ds1/libsrc/svi.lst0000644000175000017500000000646510725453054015327 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/svi/fgetc_cons stdio/fgets_cons stdio/svi/getk stdio/puts_cons stdio/svi/fputc_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy graphics/vz200/pixladdr graphics/vz200/swapgfxbk graphics/vz200/clsgraph printflike/ltoa_any games/joystick z88dk-1.8.ds1/libsrc/test.lst0000644000175000017500000000013610763607601015473 0ustar tygrystygrysstdio/test/fgetc_cons.asm stdio/test/fputc_cons.asm stdio/fgets_cons stdio/puts_cons @z80.lst z88dk-1.8.ds1/libsrc/ticalc/0000755000175000017500000000000010765202715015226 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/ticalc/generic/0000755000175000017500000000000010765202715016642 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/ticalc/ti82/0000755000175000017500000000000010765202715016014 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/ticalc/ti83/0000755000175000017500000000000010765202715016015 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/ticalc/ti85/0000755000175000017500000000000010765202715016017 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/ticalc/ti86/0000755000175000017500000000000010765202715016020 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/ticalc/ti8x/0000755000175000017500000000000010765202715016122 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/ticalc.lst0000644000175000017500000000736510712616525015765 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/ticalc/fputc_cons stdio/puts_cons stdio/ticalc/fgetc_cons stdio/fgets_cons stdio/ticalc/getk stdio/ticalc/getk_decode stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/ticalc/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorpixl graphics/xorplot graphics/setxy graphics/fill graphics/dfill graphics/ticalc/putsprite graphics/getsprite graphics/ticalc/bksave graphics/ticalc/bkrestore graphics/ticalc/pixladdr graphics/ticalc/swapgfxbk games/ticalc/joystick games/ticalc/bit_open games/ticalc/bit_open_di games/ticalc/bit_close games/ticalc/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/beeper printflike/ltoa_any z88dk-1.8.ds1/libsrc/ticansi.lst0000644000175000017500000000777010712616525016160 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/ticalc/fgetc_cons stdio/fgets_cons stdio/ticalc/getk stdio/ticalc/getk_decode stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/ticalc/f_ansi_attr stdio/ansi/ticalc/f_ansi_bel stdio/ansi/ticalc/f_ansi_char stdio/ansi/ticalc/f_ansi_cls stdio/ansi/ticalc/f_ansi_dline stdio/ansi/ticalc/f_ansi_scrollup stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/ticalc/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorpixl graphics/xorplot graphics/setxy graphics/fill graphics/dfill graphics/ticalc/putsprite graphics/getsprite graphics/ticalc/bksave graphics/ticalc/bkrestore graphics/ticalc/pixladdr graphics/ticalc/swapgfxbk games/ticalc/joystick games/ticalc/bit_open games/ticalc/bit_open_di games/ticalc/bit_close games/ticalc/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/beeper printflike/ltoa_any z88dk-1.8.ds1/libsrc/tigray.lst0000644000175000017500000000031010070537404015777 0ustar tygrystygrysgraphics/gray/g_circle graphics/gray/ticalc/g_clg graphics/gray/g_draw graphics/gray/g_drawb graphics/gray/g_drawr graphics/gray/g_page graphics/gray/grpage graphics/gray/g_plot graphics/gray/g_point z88dk-1.8.ds1/libsrc/time/0000755000175000017500000000000010765202715014725 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/time/gmtime-bak.c0000644000175000017500000000410507267305447017117 0ustar tygrystygrys/* * gmtime() - Taken from VBCC archive * * Contains a static variable!! * ..can't wait for new z80asm!! * * This is ginormous! ~ 1000 bytes * * -------- * $Id: gmtime-bak.c,v 1.2 2001/04/18 12:40:07 stefano Exp $ */ #include /* Rules for leap-years: * 1. every 4th year is a leap year * 2. every 100th year is none * 3. every 400th is one * 4. 1900 was none, 2000 is one */ extern int __dstflag; static char monthtable[]= { 31,29,31,30,31,30,31,31,30,31,30 }; struct tm *gmtime(const time_t *t) { static struct tm utim; signed long tim; int leapday=0,leapyear=0,i; tim=*t; utim.tm_sec=tim%60; tim/=60; utim.tm_min=tim%60; tim/=60; utim.tm_hour=tim%24; tim=tim/24+719162L; utim.tm_wday=(tim+1)%7; utim.tm_year=tim/146097L*400-1899; tim%=146097; if(tim>=145731L) { leapyear++; /* The day is in one of the 400th */ if(tim==146096L) { tim--; /* Be careful: The last of the 4 centuries is 1 day longer */ leapday++; } } utim.tm_year+=tim/36524L*100L; tim%=36524; if(tim>=36159) leapyear--; /* The day is in one of the 100th */ utim.tm_year+=tim/1461L*4L; tim%=1461; if(tim>=1095) { leapyear++; /* The day is in one of the 4th */ if(tim==1460) { tim--; /* Be careful: The 4th year is 1 day longer */ leapday++; } } utim.tm_year+=tim/365; tim=tim%365+leapday; utim.tm_yday=tim; if(!leapyear&&tim>=31+28) tim++; /* add 1 for 29-Feb if no leap year */ for(i=0;i<11;i++) if(tim #define SECS_PER_MINUTE ((time_t)60) #define SECS_PER_HOUR ((time_t)(60 * SECS_PER_MINUTE)) #define SECS_PER_DAY ((time_t)(24 * SECS_PER_HOUR)) #define SECS_PER_YEAR ((time_t)(365 * SECS_PER_DAY)) #define SECS_PER_LEAP ((time_t)(SECS_PER_YEAR+SECS_PER_DAY)) static int is_leap( int year ) { year += 1900; /* Get year, as ordinary humans know it */ /* * The rules for leap years are not * as simple as "every fourth year * is leap year": */ if( (unsigned int)year % 100 == 0 ) { return (unsigned int)year % 400 == 0; } return (unsigned int)year % 4 == 0; } int __days_per_month[] = {31,28,31,30,31,30,31,31,30,31,30,31}; struct tm *gmtime (time_t *tp) { static struct tm tm2; time_t t,secs_this_year; t = *tp; tm2.tm_sec = 0; tm2.tm_min = 0; tm2.tm_hour = 0; tm2.tm_mday = 1; tm2.tm_mon = 0; tm2.tm_year = 70; tm2.tm_wday = ( t / SECS_PER_DAY + 4 ) % 7; /* 01.01.70 was Thu */ tm2.tm_isdst = -1; /* * This loop handles dates in 1970 and later */ while ( t >= ( secs_this_year = is_leap(tm2.tm_year) ? SECS_PER_LEAP : SECS_PER_YEAR ) ) { t -= secs_this_year; tm2.tm_year++; } /* * This loop handles dates before 1970 */ while ( t < 0 ) t += is_leap(--tm2.tm_year) ? SECS_PER_LEAP : SECS_PER_YEAR; tm2.tm_yday = t / SECS_PER_DAY; /* days since Jan 1 */ if ( is_leap(tm2.tm_year) ) /* leap year ? */ __days_per_month[1]++; while ( t >= __days_per_month[tm2.tm_mon] * SECS_PER_DAY ) { t -= __days_per_month[tm2.tm_mon++] * SECS_PER_DAY; } if ( is_leap(tm2.tm_year) ) /* leap year ? restore Feb */ __days_per_month[1]--; while ( t >= SECS_PER_DAY ) { t -= SECS_PER_DAY; tm2.tm_mday++; } while ( t >= SECS_PER_HOUR ) { t -= SECS_PER_HOUR; tm2.tm_hour++; } while ( t >= SECS_PER_MINUTE ) { t -= SECS_PER_MINUTE; tm2.tm_min++; } tm2.tm_sec = t; return( &tm2); } #ifdef TESTING #include main() { struct tm2 *tm2 time_t readtime; while (1) { printf ("Enter a raw time value: \n"); scanf ("%d\n",&readtime); tm2= gmtime(&readtime); printf ("tm2sec=%d\n",tm2>tm2sec); printf ("tm2min=%d\n",tm2>tm2min); printf ("tm2hour=%d\n",tm2>tm2hour); printf ("tm2mday=%d\n",tm2>tm2mday); printf ("tm2mon=%d\n",tm2>tm2mon); printf ("tm2year=%d\n",tm2>tm2year); printf ("tm2wday=%d\n",tm2>tm2wday); printf ("tm2yday=%d\n",tm2>tm2yday); printf ("tm2isdst=%d\n",tm2>tm2isdst); } } #endif /* TESTING */ z88dk-1.8.ds1/libsrc/time/localtime.c0000644000175000017500000000055507267305447017060 0ustar tygrystygrys/* * Taken from vbcc archive * * djm 13/3/2000 * * -------- * $Id: localtime.c,v 1.2 2001/04/18 12:40:07 stefano Exp $ */ #include /* z88 doesn't hold timezone details :( * Define this to hold number of minutess off GMT */ #define GMTOFFSET 0 struct tm *localtime(const time_t *t) { time_t ti=*t; ti-=GMTOFFSET*60; return gmtime(&ti); } z88dk-1.8.ds1/libsrc/time/Makefile0000644000175000017500000000113510763610021016354 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.14 2008/03/05 20:35:48 dom Exp $ include ../Make.config lz88: time z88_time lpps: time pps_time lzx: spectrum_time time: gmtime.o localtime.o mktime.o .c.o: zcc +test $(CFLAGS) $*.c pps_time: cd sprinter ; $(MAKE) ; cd .. z88_time: cd z88 ; $(MAKE) ; cd .. spectrum_time: cd spectrum ; $(MAKE) ; cd .. clean: $(RM) *.o* *.i *.sym *.map zcc_opt.def $(RM) zx81/*.o* $(RM) newbrain/*.o* $(RM) rcmx000/*.o* cd z88 ; $(MAKE) clean ; cd .. cd spectrum ; $(MAKE) clean ; cd .. cd sprinter ; $(MAKE) clean ; cd .. z88dk-1.8.ds1/libsrc/time/mktime.c0000644000175000017500000000262107567134410016362 0ustar tygrystygrys/* Nicely hacked mktime.c - assumes a valid struct tp */ #include #include #define EPOCH_YEAR 1970 #define SECS_PER_DAY 86400UL #define SECS_PER_HOUR 3600UL #define SECS_PER_MIN 60UL #define DAYS_PER_YEAR 365UL const int _tot[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; static int is_leap( int year ) { if( year % 100 == 0 ) { return year % 400 == 0; } return year % 4 == 0; } #ifdef TEST time_t mktime2(struct tm *tp) #else time_t mktime(struct tm *tp) #endif { unsigned long days; int i,j,year; if ( tp->tm_year < EPOCH_YEAR - 1900 ) return -1L; days = ( tp->tm_year - ( EPOCH_YEAR - 1900 ) ) * DAYS_PER_YEAR; /* Now chase up the leap years */ for ( i = EPOCH_YEAR; i < ( tp->tm_year + 1900 ); i++ ) { if ( is_leap(i) ) ++days; } days += _tot[tp->tm_mon]; if ( is_leap(tp->tm_year) ) ++days; days += (tp->tm_mday - 1); /* So days has the number of days since the epoch */ days *= SECS_PER_DAY; days += ( tp->tm_hour * SECS_PER_HOUR ) + ( tp->tm_min * SECS_PER_MIN ) + tp->tm_sec; return days; } #ifdef TEST int main() { time_t tim = time(NULL); time_t tim2; struct tm *tp; tp = gmtime(&tim); printf("unix gives %ld\n",tim); tim2 = mktime2(tp); printf("routines gives %ld\n",tim2); printf("%d\n",(tim2-tim)/86400); } #endif z88dk-1.8.ds1/libsrc/time/newbrain/0000755000175000017500000000000010765202715016532 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/time/newbrain/clock.asm0000755000175000017500000000041210631471703020324 0ustar tygrystygrys; ; Grundy NewBrain clock() ; ; stefano 5/4/2007 ; ; ------ ; $Id: clock.asm,v 1.2 2007/06/06 08:43:47 stefano Exp $ ; XLIB clock XREF nbclockptr .clock ld hl,(nbclockptr) ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) ld h,b ld l,c ret z88dk-1.8.ds1/libsrc/time/newbrain/Makefile0000755000175000017500000000035510623101021020155 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.1 2007/05/17 16:25:53 stefano Exp $ all: @echo '' @echo 'Nowt todo here (clock is asm)' @echo '' @echo '' clean: $(RM) *.o* *.i *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/time/rcmx000/0000755000175000017500000000000010765202715016116 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/time/rcmx000/clock.asm0000755000175000017500000000055110571263054017715 0ustar tygrystygrys; ; RCM2/3000 clock() function ; ; -------- ; $Id: clock.asm,v 1.1 2007/02/28 11:23:24 stefano Exp $ ;; TODO: WRITE ME !!! use rtc in some way.. XLIB clock .clock ; 16436/7 word running backwards from 65535 to 32768 (bit 15 always set). ; It is reset by basic if running a PAUSE statement. ld hl,65535 ld de,(16436) scf ccf sbc hl,de ld de,0 ret z88dk-1.8.ds1/libsrc/time/spectrum/0000755000175000017500000000000010765202715016567 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/time/spectrum/clock.asm0000644000175000017500000000036007267305447020374 0ustar tygrystygrys; ; clock() ; Goodness knows it this is right..ages since ; I used a spectrum... ; ; djm 12/1/2000 ; ; ------ ; $Id: clock.asm,v 1.2 2001/04/18 12:40:07 stefano Exp $ ; XLIB clock .clock ld hl,(23672) ld a,(23674) ld e,a ld d,0 ret z88dk-1.8.ds1/libsrc/time/spectrum/Makefile0000644000175000017500000000035107555321714020232 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.3 2002/10/22 19:15:24 dom Exp $ all: @echo '' @echo 'Nowt todo here (clock is asm)' @echo '' @echo '' clean: $(RM) *.o* *.i *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/time/sprinter/0000755000175000017500000000000010765202715016573 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/time/sprinter/clock.c0000644000175000017500000000242007566775553020054 0ustar tygrystygrys/* * clock() function * * Return the current time basically * Typically used to find amount of CPU time * used by a program. * * ANSI allows any time at start of program so * properly written programs should call this fn * twice and take the difference * * djm 9/1/2000 * * -------- * $Id: clock.c,v 1.1 2002/11/20 21:15:23 dom Exp $ */ #include /* * Get the current time */ clock_t clock() { #asm ld c,$21 ;SYSTIME rst $10 ;h=hour,l=minute,b=second ld c,h push bc ;save hour,second ld h,0 ld de,60 ;seconds in minute call l_mult ;hl now is number of seconds pop bc push bc ld c,b ld b,0 add hl,bc ;hl now is seconds + mins * 60 pop bc ;get hours back push hl ;save hl ld l,c ld h,0 ld de,0 push de push hl ld hl,3600 ;seconds in hours (de=0) call l_long_mult pop bc ;get seconds + mins back push de push hl ld l,c ld h,b ld de,0 call l_long_add #endasm } z88dk-1.8.ds1/libsrc/time/sprinter/Makefile0000644000175000017500000000037110763610027020231 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.5 2008/03/05 20:35:48 dom Exp $ include ../../Make.config all: clock.o time.o .c.o: zcc +pps $(CFLAGS) $*.c clean: $(RM) *.o* *.i *.sym *.map zcc_opt.def *.asm z88dk-1.8.ds1/libsrc/time/sprinter/time.c0000644000175000017500000000153607567134410017704 0ustar tygrystygrys/* * time_t time(time_t *) * * Return number of seconds since epoch * * Our epoch is the UNIX epoch of 00:00:00 1/1/1970 * * -------- * $Id: time.c,v 1.2 2002/11/21 10:44:24 dom Exp $ */ #include static void gettm(struct tm *tp); time_t time(time_t *store) { struct tm tmp; time_t tim; gettm(&tmp); tim = mktime(&tmp); if ( store ) *store = tim; return tim; } static void gettm(struct tm *tp) { #asm pop bc pop de push de push bc push de ld c,$21 ;SYSTIME rst $10 pop iy ;ick - tp pointer ld (iy+0),b ;seconds ld (iy+1),0 ld (iy+2),l ;min ld (iy+3),0 ld (iy+4),h ;hour ld (iy+5),0 ld (iy+6),d ;month day ld (iy+7),0 dec e ld (iy+8),e ;month ld (iy+9),0 push ix pop hl ld de,1900 and a sbc hl,de ld (iy+10),l ld (iy+11),h ld a,c cp 7 jr nz,skip ld c,0 .skip ld (iy+12),c ld (iy+13),0 #endasm } z88dk-1.8.ds1/libsrc/time/z88/0000755000175000017500000000000010765202715015356 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/time/z88/clock.c0000644000175000017500000000110707267305447016625 0ustar tygrystygrys/* * clock() function * * Return the current time basically * Typically used to find amount of CPU time * used by a program. * * ANSI allows any time at start of program so * properly written programs should call this fn * twice and take the difference * * djm 9/1/2000 * * -------- * $Id: clock.c,v 1.2 2001/04/18 12:40:07 stefano Exp $ */ #include /* * Get the current time */ clock_t clock() { #asm INCLUDE "#time.def" ld de,2 ;FIX djm 13/3/2000 DN3.23 states de=1 is illegal call_oz(gn_gmt) ;abc, a=MSB ld d,0 ld e,a ld h,b ld l,c #endasm } z88dk-1.8.ds1/libsrc/time/z88/Makefile0000644000175000017500000000035710763610032017014 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.9 2008/03/05 20:35:48 dom Exp $ include ../../Make.config all: clock.o time.o .c.o: zcc +z88 $(CFLAGS) $*.c clean: $(RM) *.o* *.i *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/time/z88/time.c0000644000175000017500000000110307267305447016464 0ustar tygrystygrys/* * time_t time(time_t *) * * Return number of seconds since epoch * * Our epoch is the UNIX epoch of 00:00:00 1/1/1970 * * -------- * $Id: time.c,v 1.3 2001/04/18 12:40:07 stefano Exp $ */ #include #define JD0101970 2440588 long gtoy(); time_t time(time_t *store) { long days; time_t tim; days = (gtoy() - JD0101970)*86400; tim=days+(clock()/CLOCKS_PER_SEC); if (store) *store=tim; return (tim); } /* Get Julian day */ long gtoy() { #asm INCLUDE "#time.def" ld de,2 call_oz(gn_gmd) ;abc, a=MSB ld d,0 ld e,a ld h,b ld l,c #endasm } z88dk-1.8.ds1/libsrc/time/zx81/0000755000175000017500000000000010765202715015537 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/time/zx81/clock.asm0000644000175000017500000000045010701140140017312 0ustar tygrystygrys; ; ZX81 clock() function ; By Stefano Bodrato - Oct. 2007 ; New version based on custom interrupt driver ; (doesn't work in FAST MODE) ; ; -------- ; $Id: clock.asm,v 1.5 2007/10/04 10:28:48 stefano Exp $ XLIB clock XREF frames .clock ld hl,(frames) ld a,(frames+1) ld e,a ld d,0 ret z88dk-1.8.ds1/libsrc/ts2068/0000755000175000017500000000000010765202715014735 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/ts2068/ts_vmod.asm0000644000175000017500000000052610757251210017110 0ustar tygrystygrys; void __FASTCALL__ ts_vmod(uchar mode) ; 02.2008 aralbrec XLIB ts_vmod .ts_vmod ld a,l and $3f xor $38 ; invert paper bits to settings expected by port $ff ld l,a in a,($ff) and $c0 ; preserve current local bank selection and interrupt state or l out ($ff),a ret z88dk-1.8.ds1/libsrc/ts2068.lst0000755000175000017500000001525110763607601015471 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper input/spectrum/in_GetKey input/spectrum/in_GetKeyReset input/spectrum/in_Inkey input/spectrum/in_JoyFuller input/spectrum/in_JoyKempston input/spectrum/in_JoyKeyboard input/spectrum/in_JoySinclair1 input/spectrum/in_JoySinclair2 input/spectrum/in_JoyTimex1 input/spectrum/in_JoyTimex2 input/spectrum/in_KeyPressed input/spectrum/in_keytranstbl input/spectrum/in_LookupKey input/spectrum/in_MouseAMX input/spectrum/in_MouseAMX_callee input/spectrum/in_MouseAMXInit input/spectrum/in_MouseAMXInit_callee input/spectrum/in_MouseAMXSetPos input/spectrum/in_MouseAMXSetPos_callee input/spectrum/in_MouseKemp input/spectrum/in_MouseKemp_callee input/spectrum/in_MouseKempInit input/spectrum/in_MouseKempSetPos input/spectrum/in_MouseKempSetPos_callee input/spectrum/in_MouseSim input/spectrum/in_MouseSim_callee input/spectrum/in_MouseSimInit input/spectrum/in_MouseSimInit_fastcall input/spectrum/in_MouseSimSetPos input/spectrum/in_MouseSimSetPos_callee input/spectrum/in_Pause input/spectrum/in_Wait input/spectrum/in_WaitForKey input/spectrum/in_WaitForNoKey input/spectrum/INMouseAMX input/spectrum/INMouseKemp input/spectrum/INMouseSim stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/fseek stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/spectrum/fgetc_cons stdio/fgets_cons stdio/ts2068/fputc_cons stdio/spectrum/getk stdio/puts_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp time/spectrum/clock setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/spectrum/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy graphics/fill graphics/dfill graphics/getsprite graphics/spectrum/putsprite graphics/spectrum/bksave graphics/spectrum/bkrestore graphics/spectrum/rowtab graphics/spectrum/pixladdr2 graphics/spectrum/swapgfxbk graphics/xorborder graphics/xorpixl graphics/xorplot games/spectrum/joystick games/spectrum/bit_open games/spectrum/bit_open_di games/spectrum/bit_close games/spectrum/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/beeper spectrum/zx_attr spectrum/zx_attr_callee spectrum/zx_border spectrum/zx_break spectrum/zx_screenstr spectrum/zx_screenstr_callee spectrum/currah_detect spectrum/currah_direct spectrum/currah_speech spectrum/tape_load_block spectrum/tape_load_block_callee spectrum/tape_save_block spectrum/tape_save_block_callee spectrum/zx_128mode spectrum/zx_aaddr2cx spectrum/zx_aaddr2cy spectrum/zx_aaddr2px spectrum/zx_aaddr2py spectrum/zx_aaddr2saddr spectrum/zx_aaddrcdown spectrum/zx_aaddrcleft spectrum/zx_aaddrcright spectrum/zx_aaddrcup spectrum/zx_basemem spectrum/zx_basic_length spectrum/zx_cy2aaddr spectrum/zx_cy2saddr spectrum/zx_cyx2aaddr spectrum/zx_cyx2aaddr_callee spectrum/zx_cyx2saddr spectrum/zx_cyx2saddr_callee spectrum/zx_extsys spectrum/zx_fullerstick spectrum/zx_getint spectrum/zx_getstr spectrum/zx_getstr_callee spectrum/zx_goto spectrum/zx_iss_stick spectrum/zx_issue3 spectrum/zx_kempston spectrum/zx_kempstonmouse spectrum/zx_locatenum spectrum/zx_model spectrum/zx_multiface spectrum/zx_plus3fdc spectrum/zx_printer spectrum/zx_pxy2aaddr spectrum/zx_pxy2aaddr_callee spectrum/zx_pxy2saddr spectrum/zx_pxy2saddr_callee spectrum/zx_py2aaddr spectrum/zx_py2saddr spectrum/zx_saddr2aaddr spectrum/zx_saddr2cx spectrum/zx_saddr2cy spectrum/zx_saddr2px spectrum/zx_saddr2px_callee spectrum/zx_saddr2py spectrum/zx_saddrcdown spectrum/zx_saddrcleft spectrum/zx_saddrcright spectrum/zx_saddrcup spectrum/zx_saddrpdown spectrum/zx_saddrpleft spectrum/zx_saddrpleft_callee spectrum/zx_saddrpright spectrum/zx_saddrpright_callee spectrum/zx_saddrpup spectrum/zx_setint spectrum/zx_setint_callee spectrum/zx_setstr spectrum/zx_setstr_callee spectrum/zx_soundchip spectrum/zx_timexsound spectrum/zx_type spectrum/zx_var_length spectrum/tape_save spectrum/disciple/zx_disciple.asm ts2068/ts_vmod printflike/ltoa_any z88dk-1.8.ds1/libsrc/ts2068an.lst0000755000175000017500000001566110763607601016015 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper input/spectrum/in_GetKey input/spectrum/in_GetKeyReset input/spectrum/in_Inkey input/spectrum/in_JoyFuller input/spectrum/in_JoyKempston input/spectrum/in_JoyKeyboard input/spectrum/in_JoySinclair1 input/spectrum/in_JoySinclair2 input/spectrum/in_JoyTimex1 input/spectrum/in_JoyTimex2 input/spectrum/in_KeyPressed input/spectrum/in_keytranstbl input/spectrum/in_LookupKey input/spectrum/in_MouseAMX input/spectrum/in_MouseAMX_callee input/spectrum/in_MouseAMXInit input/spectrum/in_MouseAMXInit_callee input/spectrum/in_MouseAMXSetPos input/spectrum/in_MouseAMXSetPos_callee input/spectrum/in_MouseKemp input/spectrum/in_MouseKemp_callee input/spectrum/in_MouseKempInit input/spectrum/in_MouseKempSetPos input/spectrum/in_MouseKempSetPos_callee input/spectrum/in_MouseSim input/spectrum/in_MouseSim_callee input/spectrum/in_MouseSimInit input/spectrum/in_MouseSimInit_fastcall input/spectrum/in_MouseSimSetPos input/spectrum/in_MouseSimSetPos_callee input/spectrum/in_Pause input/spectrum/in_Wait input/spectrum/in_WaitForKey input/spectrum/in_WaitForNoKey input/spectrum/INMouseAMX input/spectrum/INMouseKemp input/spectrum/INMouseSim stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/fseek stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/spectrum/fgetc_cons stdio/fgets_cons stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/spectrum/f_ansi_attr stdio/ansi/spectrum/f_ansi_bel stdio/ansi/spectrum/f_ansi_char stdio/ansi/spectrum/f_ansi_cls stdio/ansi/spectrum/f_ansi_dline stdio/ansi/ts2068/f_ansi_scrollup stdio/spectrum/getk stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp time/spectrum/clock setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/spectrum/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy graphics/fill graphics/dfill graphics/getsprite graphics/spectrum/putsprite graphics/spectrum/bksave graphics/spectrum/bkrestore graphics/spectrum/rowtab graphics/spectrum/pixladdr2 graphics/spectrum/swapgfxbk graphics/xorborder graphics/xorplot graphics/xorpixl games/spectrum/joystick games/spectrum/bit_open games/spectrum/bit_open_di games/spectrum/bit_close games/spectrum/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/beeper spectrum/zx_attr spectrum/zx_attr_callee spectrum/zx_border spectrum/zx_break spectrum/zx_screenstr spectrum/zx_screenstr_callee spectrum/currah_detect spectrum/currah_direct spectrum/currah_speech spectrum/tape_load_block spectrum/tape_load_block_callee spectrum/tape_save_block spectrum/tape_save_block_callee spectrum/zx_128mode spectrum/zx_aaddr2cx spectrum/zx_aaddr2cy spectrum/zx_aaddr2px spectrum/zx_aaddr2py spectrum/zx_aaddr2saddr spectrum/zx_aaddrcdown spectrum/zx_aaddrcleft spectrum/zx_aaddrcright spectrum/zx_aaddrcup spectrum/zx_basemem spectrum/zx_basic_length spectrum/zx_cy2aaddr spectrum/zx_cy2saddr spectrum/zx_cyx2aaddr spectrum/zx_cyx2aaddr_callee spectrum/zx_cyx2saddr spectrum/zx_cyx2saddr_callee spectrum/zx_extsys spectrum/zx_fullerstick spectrum/zx_getint spectrum/zx_getstr spectrum/zx_getstr_callee spectrum/zx_goto spectrum/zx_iss_stick spectrum/zx_issue3 spectrum/zx_kempston spectrum/zx_kempstonmouse spectrum/zx_locatenum spectrum/zx_model spectrum/zx_multiface spectrum/zx_plus3fdc spectrum/zx_printer spectrum/zx_pxy2aaddr spectrum/zx_pxy2aaddr_callee spectrum/zx_pxy2saddr spectrum/zx_pxy2saddr_callee spectrum/zx_py2aaddr spectrum/zx_py2saddr spectrum/zx_saddr2aaddr spectrum/zx_saddr2cx spectrum/zx_saddr2cy spectrum/zx_saddr2px spectrum/zx_saddr2px_callee spectrum/zx_saddr2py spectrum/zx_saddrcdown spectrum/zx_saddrcleft spectrum/zx_saddrcright spectrum/zx_saddrcup spectrum/zx_saddrpdown spectrum/zx_saddrpleft spectrum/zx_saddrpleft_callee spectrum/zx_saddrpright spectrum/zx_saddrpright_callee spectrum/zx_saddrpup spectrum/zx_setint spectrum/zx_setint_callee spectrum/zx_setstr spectrum/zx_setstr_callee spectrum/zx_soundchip spectrum/zx_timexsound spectrum/zx_type spectrum/zx_var_length spectrum/tape_save spectrum/disciple/zx_disciple.asm ts2068/ts_vmod printflike/ltoa_any z88dk-1.8.ds1/libsrc/vz/0000755000175000017500000000000010765202715014426 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/vz/vz_bgrd.asm0000644000175000017500000000063510552125160016561 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __FASTCALL__ vz_bgrd(int n) XLIB vz_bgrd .vz_bgrd ld a,h or l ld hl,$783b ld a,(hl) set 4,a jr nz, bgrd1 and $ef ; res 4,a .bgrd1 ld (hl),a ld ($6800),a ret z88dk-1.8.ds1/libsrc/vz/vz_brick.asm0000644000175000017500000000034610552125160016734 0ustar tygrystygrys; CALLER LINKAGE FOR FUNCTION POINTERS XLIB vz_brick LIB vz_brick_callee XREF ASMDISP_VZ_BRICK_CALLEE .vz_brick pop hl pop bc pop de push de push bc push hl jp vz_brick_callee + ASMDISP_VZ_BRICK_CALLEE z88dk-1.8.ds1/libsrc/vz/vz_brick_callee.asm0000644000175000017500000000227010552125160020237 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __CALLEE__ vz_brick_callee(void *addr, char byte) XLIB vz_brick_callee XDEF ASMDISP_VZ_BRICK_CALLEE .vz_brick_callee pop hl pop bc pop de push hl ; c = byte ; de = addr .asmentry ld a,c ; bc = 6*c add a,a ld c,a add a,a add a,c ld c,a ld b,0 ld hl,bricks add hl,bc ld c,6 .showit ldi ret po ld a,31 add a,e ld e,a jp nc, showit inc d jp showit .bricks ; 0 defb 000, 000, 000, 000, 000, 000 ; 1 defb 085, 084, 085, 084, 085, 084 ; 2 defb 255, 252, 255, 252, 255, 252 ; 3 defb 087, 084, 087, 084, 087, 084 ; 4 defb 253, 252, 253, 252, 253, 252 ; 5 defb 085, 084, 255, 252, 085, 084 ; 6 defb 255, 252, 085, 084, 255, 252 ; 7 defb 245, 124, 245, 124, 245, 124 ; 8 defb 170, 168, 165, 104, 170, 168 ; 9 defb 170, 168, 175, 232, 170, 168 DEFC ASMDISP_VZ_BRICK_CALLEE = asmentry - vz_brick_callee z88dk-1.8.ds1/libsrc/vz/vz_char_draw.asm0000644000175000017500000000173610552125160017600 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void vz_char_draw(int x, int y, int c, char ch) XLIB vz_char_draw LIB vz_shape XREF char_shape ; This one tied to vz_shape so can't ween off the stack ; without fixing vz_shape -- so left as is .vz_char_draw ld ix, 0 add ix, sp ld l,(ix+8) ; get x ld h,(ix+9) push hl ld l, (ix+6) ; get y ld h, (ix+7) push hl ld hl, 5 push hl ; width push hl ; height ld l, (ix+4) ; get c ld h, (ix+5) push hl ld a, (ix+2) ; get ch cp $20 jr nc, char_shape1 ld a, $20 char_shape1: cp $80 jr c, char_shape2 ld a, $20 char_shape2: sub $20 ld l, a ; * 5 ld h, 0 ld e, l ld d, h add hl, hl add hl, hl add hl, de ld de, char_shape add hl, de push hl ; *data push ix call vz_shape pop hl ld sp, hl ; clean up stack ret z88dk-1.8.ds1/libsrc/vz/vz_clrscr.asm0000644000175000017500000000067510552125160017137 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void vz_clrscr(void) XLIB vz_clrscr .vz_clrscr ; almost same as clg() except ROM call might behave differently ; for text mode and won't set graphics mode jp $01c9 ; clear screen z88dk-1.8.ds1/libsrc/vz/vz_color.asm0000644000175000017500000000045610552125160016762 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __FASTCALL__ vz_color(int n) XLIB vz_color .vz_color ld a,l and $07 ld ($ffff),a ret z88dk-1.8.ds1/libsrc/vz/vz_getch.asm0000644000175000017500000000057310552125160016736 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- int vz_getch(void) XLIB vz_getch .vz_getch call $0049 ; wait for keyboard ld l,a rla ; sign extend into h sbc a,a ld h,a ret z88dk-1.8.ds1/libsrc/vz/vz_gotoxy.asm0000644000175000017500000000035410552125160017172 0ustar tygrystygrys; CALLER LINKAGE FOR FUNCTION POINTERS XLIB vz_gotoxy LIB vz_gotoxy_callee XREF ASMDISP_VZ_GOTOXY_CALLEE .vz_gotoxy pop bc pop hl pop de push de push hl push bc jp vz_gotoxy_callee + ASMDISP_VZ_GOTOXY_CALLEE z88dk-1.8.ds1/libsrc/vz/vz_gotoxy_callee.asm0000644000175000017500000000140610552125160020476 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __CALLEE__ vz_gotoxy_callee(int x, int y) XLIB vz_gotoxy_callee XDEF ASMDISP_VZ_GOTOXY_CALLEE .vz_gotoxy_callee pop bc pop hl pop de push bc ; hl = y ; de = x .asmentry ld a,l cp 16 ; y < 16? jr c, gxy_a ld hl,-1 ; -1 + 16 -> 15 .gxy_a ld bc,16 add hl,bc add hl,hl ; * 32 add hl,hl add hl,hl add hl,hl add hl,hl add hl,de ld ($7820),hl ; set cursor position ret DEFC ASMDISP_VZ_GOTOXY_CALLEE = asmentry - vz_gotoxy_callee z88dk-1.8.ds1/libsrc/vz/vz_inch.asm0000644000175000017500000000063710552125160016566 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- int vz_inch(void) XLIB vz_inch .vz_inch ; almost same as getk() except for the sign extension call $2ef4 ld l,a rla ; sign extend into h sbc a,a ld h,a ret z88dk-1.8.ds1/libsrc/vz/vz_line.asm0000644000175000017500000000053710552231467016603 0ustar tygrystygrys; CALLER LINKAGE FOR FUNCTION POINTERS XLIB vz_line LIB vz_line_callee XREF ASMDISP_VZ_LINE_CALLEE .vz_line pop af pop bc pop de pop hl ld d,e ld e,l pop hl ex af,af ld a,l pop hl ld h,a push hl push hl push hl push de push bc ex af,af push af jp vz_line_callee + ASMDISP_VZ_LINE_CALLEE z88dk-1.8.ds1/libsrc/vz/vz_line_callee.asm0000644000175000017500000000611110552231467020102 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __CALLEE__ vz_line_callee(int x1, int y1, int x2, int y2, int c) XLIB vz_line_callee XDEF ASMDISP_VZ_LINE_CALLEE LIB vz_plot_callee XREF ASMDISP_VZ_PLOT_CALLEE .vz_line_callee pop af pop bc pop de pop hl ld d,e ld e,l pop hl ex af,af ld a,l pop hl ld h,a ex af,af push af ; c = colour ; l = x1 ; h = y1 ; e = x2 ; d = y2 .asmentry ld a,e cp l jr nc, line1 ex de,hl ; swap so that x1 < x2 .line1 ld a,e sub l ; dx ld e,a ; save dx ld a,d sub h jp c, lup ; negative (up) .ldn ld d,a ; save dy cp e ; dy < dx ? jr c, ldnx .ldny ld b,a ; count = dy srl a ; /2 -> overflow .ldny1 push af push bc push de push hl call vz_plot_callee + ASMDISP_VZ_PLOT_CALLEE pop hl pop de pop bc pop af dec b ; done? ret m inc h ; y++ sub e ; overflow -= dx jr nc, ldny1 inc l ; x++ add a,d ; overflow += dy jp ldny1 .ldnx ld a,e ; get dx ld b,a ; count = dx srl a ; /2 -> overflow .ldnx1 push af push bc push de push hl call vz_plot_callee + ASMDISP_VZ_PLOT_CALLEE pop hl pop de pop bc pop af dec b ; done? ret m inc l ; x++ sub d ; overflow -= dy jr nc, ldnx1 inc h ; y++ add a,e ; overflow += dx jp ldnx1 .lup neg ; make dy positive ld d,a ; save dy cp e ; dy < dx ? jr c, lupx .lupy ld b,a ; count = dy srl a ; /2 -> overflow .lupy1 push af push bc push de push hl call vz_plot_callee + ASMDISP_VZ_PLOT_CALLEE pop hl pop de pop bc pop af dec b ; done? ret m dec h ; y-- sub e ; overflow -= dx jr nc, lupy1 inc l ; x++ add a,d ; overflow += dy jp lupy1 .lupx ld a,e ; get dx ld b,a ; count = dx srl a ; /2 -> overflow .lupx1 push af push bc push de push hl call vz_plot_callee + ASMDISP_VZ_PLOT_CALLEE pop hl pop de pop bc pop af dec b ; done? ret m inc l ; x++ sub d ; overflow -= dy jr nc, lupx1 dec h ; y-- add a,e ; overflow += dx jp lupx1 DEFC ASMDISP_VZ_LINE_CALLEE = asmentry - vz_line_callee z88dk-1.8.ds1/libsrc/vz/vz_midstr.asm0000644000175000017500000000035510552125161017145 0ustar tygrystygrys; CALLER LINKAGE FOR FUNCTION POINTERS XLIB vz_midstr LIB vz_midstr_callee XREF ASMDISP_VZ_MIDSTR_CALLEE .vz_midstr pop af pop de pop hl push hl push de push af jp vz_midstr_callee + ASMDISP_VZ_MIDSTR_CALLEE z88dk-1.8.ds1/libsrc/vz/vz_midstr_callee.asm0000644000175000017500000000101210552125161020441 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- char __CALLEE__ *vz_midstr_callee(char *str, int pos) XLIB vz_midstr_callee XDEF ASMDISP_VZ_MIDSTR_CALLEE .vz_midstr_callee pop af pop de pop hl push af ; de = int pos ; hl = char *str .asmentry add hl,de ld l,(hl) ld h,0 ret DEFC ASMDISP_VZ_MIDSTR_CALLEE = asmentry - vz_midstr_callee z88dk-1.8.ds1/libsrc/vz/vz_mode.asm0000644000175000017500000000111010552125161016555 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __FASTCALL__ vz_mode(int n) XLIB vz_mode .vz_mode ld a,h or l ld hl,$783b ld a,(hl) jr nz, mode1 .mode0 and $f7 ; res 3,a ld (hl),a ld ($6800),a jp $01c9 ; cls .mode1 or $08 ; set 3,a ld (hl),a ld ($6800),a ld hl,$7000 ld de,$7001 ld bc,$7ff ld (hl),0 ldir ret z88dk-1.8.ds1/libsrc/vz/vz_plot.asm0000644000175000017500000000037410552231467016631 0ustar tygrystygrys; CALLER LINKAGE FOR FUNCTION POINTERS XLIB vz_plot LIB vz_plot_callee XREF ASMDISP_VZ_PLOT_CALLEE .vz_plot pop af pop bc pop de pop hl push hl push de push bc push af ld h,e jp vz_plot_callee + ASMDISP_VZ_PLOT_CALLEE z88dk-1.8.ds1/libsrc/vz/vz_plot_callee.asm0000644000175000017500000000156710552231467020143 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __CALLEE__ vz_plot_callee(int x, int y, int c) XLIB vz_plot_callee XDEF ASMDISP_VZ_PLOT_CALLEE XREF scrbase .vz_plot_callee pop af pop bc pop de pop hl push af ld h,e ; l = x ; h = y ; c = colour .asmentry ld a,h cp 64 ret nc ld a,l cp 128 ret nc sla l ; calculate screen offset srl h rr l srl h rr l srl h rr l and $03 ; pixel offset inc a ld b,a ld a,$fc .pset1 rrca rrca rrc c rrc c djnz pset1 ld de,(scrbase) add hl,de and (hl) or c ld (hl),a ret DEFC ASMDISP_VZ_PLOT_CALLEE = asmentry - vz_plot_callee z88dk-1.8.ds1/libsrc/vz/vz_score.asm0000644000175000017500000000034610552125161016756 0ustar tygrystygrys; CALLER LINKAGE FOR FUNCTION POINTERS XLIB vz_score LIB vz_score_callee XREF ASMDISP_VZ_SCORE_CALLEE .vz_score pop hl pop bc pop de push de push bc push hl jp vz_score_callee + ASMDISP_VZ_SCORE_CALLEE z88dk-1.8.ds1/libsrc/vz/vz_score_callee.asm0000644000175000017500000000217510552125161020265 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __CALLEE__ vz_score_callee(void *addr, char byte) XLIB vz_score_callee XREF ASMDISP_VZ_SCORE_CALLEE .vz_score_callee pop hl pop bc pop de push hl ; c = byte ; de = addr .asmentry ld a,c ; bc = 5*c add a,a add a,c ld c,a ld b,0 ld hl,numbers add hl,bc ld c,5 .showit ldi ret po ld a,31 add a,e ld e,a jp nc, showit inc d jp showit .numbers ; 0 defb $3f, $33, $33, $33, $3f ; 1 defb $3c, $0c, $0c, $0c, $3f ; 2 defb $3f, $03, $0c, $30, $3f ; 3 defb $3f, $03, $0f, $03, $3f ; 4 defb $33, $33, $3f, $03, $03 ; 5 defb $3f, $30, $0c, $03, $3f ; 6 defb $3f, $30, $3f, $33, $3f ; 7 defb $3f, $03, $03, $03, $03 ; 8 defb $3f, $33, $0c, $33, $3f ; 9 defb $3f, $33, $3f, $03, $3f DEFC ASMDISP_VZ_SCORE_CALLEE = asmentry - vz_score_callee z88dk-1.8.ds1/libsrc/vz/vz_setbase.asm0000644000175000017500000000051610552125161017270 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __FASTCALL__ vz_setbase(void *start) XLIB vz_setbase XDEF scrbase .vz_setbase ld (scrbase),hl ret .scrbase defw $7000 z88dk-1.8.ds1/libsrc/vz/vz_shape.asm0000644000175000017500000001275010700457552016754 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void vz_shape(int x, int y, int w, int h, int c, char *data) XLIB vz_shape XDEF char_shape XREF scrbase ; This one is difficult to ween off the stack so left ; as is for another enterprising person to improve .vz_shape ld ix, -2 ; old compiler had an extra word on stack add ix, sp ld e, (ix+4) ; get *data ld d, (ix+5) ld iy, 0 add iy, de ; to IY ld h,(ix+12) ; y coordinate ld l,(ix+14) ; x coordinate ; convert HL to screen offset sla l sra h rr l sra h rr l sra h rr l ld de, (scrbase) add hl, de ld a, (ix+6) ; color and 3 ; only 0..3 allowed ld c, a ld b, $fc ; pixel mask ld a,(ix+14) ; x offset and 3 ; mask lower two bits of x xor 3 ; flip 3->0, 2->1, 1->2, 0->3 jr z, shape1 ; offset was 3, done shape0: rlc c ; shift color left rlc c rlc b ; shift mask left rlc b dec a ; more shifts? jr nz, shape0 shape1: ld a,(ix+12) ; get y or a ; negative ? jp m, shape8 ; next row cp 64 ; above 64 ? jp nc, shapex ; leave function ld e,(ix+10) ; get width shape2: push bc ; save mask/color push hl ; save screen offset shape3: ld d, (iy+0) ; get data byte inc iy ; increment data pointer ld a, (hl) ; get screen contents shape4: rlc d ; next bit set? jr nc, shape5 ; no, skip and b ; remove old pixel or c ; set new pixel shape5: rrc c ; rotate color rrc c rrc b ; rotate mask rrc b jr c, shape6 ; mask not yet through? skip ld (hl), a ; store screen contents inc hl ; increment screen address ld a, (hl) ; get screen contents shape6: dec e ; decrement width jr z, shape7 ; zero: row done bit 0, e jr nz, shape4 ; odd count bit 1, e jr nz, shape4 ; odd count bit 2, e jr nz, shape4 ; odd count ld (hl), a ; store screen contents jr shape3 ; fetch next datum shape7: ld (hl), a ; store screen contents pop hl ; get back screen offset pop bc ; get back mask/color jr shape9 shape8: ld e,(ix+10) ; get width ld d,0 ld a,7 ; + 7 add a,e ld e,a ld a,d adc a,0 ld d,a sra d ; / 8 rr e sra d rr e sra d rr e add iy,de ; skip data bytes shape9: ld de, 32 ; one row down add hl, de inc (ix+12) ; increment y dec (ix+8) ; decrement h jp nz, shape1 ; more rows? shapex: ret char_shape: defb $00,$00,$00,$00,$00 ; space defb $20,$20,$20,$00,$20 ; ! defb $50,$50,$00,$00,$00 ; " defb $50,$f8,$50,$f8,$50 ; # defb $78,$a0,$70,$28,$f0 ; $ defb $c8,$d0,$20,$58,$98 ; % defb $40,$a0,$68,$90,$68 ; & defb $20,$20,$40,$00,$00 ; ' defb $30,$40,$40,$40,$30 ; ( defb $60,$10,$10,$10,$60 ; ) defb $a8,$70,$f8,$70,$a8 ; * defb $20,$20,$f8,$20,$20 ; + defb $00,$00,$20,$20,$40 ; , defb $00,$00,$f8,$00,$00 ; - defb $00,$00,$00,$60,$60 ; . defb $08,$10,$20,$40,$80 ; / defb $70,$88,$a8,$88,$70 ; 0 defb $20,$60,$20,$20,$70 ; 1 defb $f0,$08,$70,$80,$f8 ; 2 defb $f8,$10,$70,$08,$f0 ; 3 defb $10,$30,$50,$f8,$10 ; 4 defb $f8,$80,$f0,$08,$f0 ; 5 defb $70,$80,$f0,$88,$70 ; 6 defb $f8,$10,$20,$40,$80 ; 7 defb $70,$88,$70,$88,$70 ; 8 defb $70,$88,$78,$08,$70 ; 9 defb $00,$20,$00,$20,$00 ; : defb $00,$20,$00,$20,$40 ; ; defb $10,$20,$40,$20,$10 ; < defb $00,$f8,$00,$f8,$00 ; = defb $40,$20,$10,$20,$40 ; > defb $70,$88,$30,$00,$20 ; ? defb $70,$88,$b8,$80,$70 ; @ defb $70,$88,$f8,$88,$88 ; A defb $f0,$88,$f0,$88,$f0 ; B defb $70,$88,$80,$88,$70 ; C defb $e0,$90,$88,$90,$e0 ; D defb $f8,$80,$f0,$80,$f8 ; E defb $f8,$80,$f0,$80,$80 ; F defb $78,$80,$b8,$88,$78 ; G defb $88,$88,$f8,$88,$88 ; H defb $70,$20,$20,$20,$70 ; I defb $f8,$08,$08,$88,$70 ; J defb $88,$90,$e0,$90,$88 ; K defb $80,$80,$80,$80,$f8 ; L defb $88,$d8,$a8,$88,$88 ; M defb $88,$c8,$a8,$98,$88 ; N defb $70,$88,$88,$88,$70 ; O defb $f0,$88,$f0,$80,$80 ; P defb $70,$88,$a8,$90,$68 ; Q defb $f0,$88,$f0,$90,$88 ; R defb $78,$80,$70,$08,$f0 ; S defb $f8,$20,$20,$20,$20 ; T defb $88,$88,$88,$88,$70 ; U defb $88,$88,$88,$50,$20 ; V defb $88,$88,$a8,$d8,$88 ; W defb $88,$50,$20,$50,$88 ; X defb $88,$50,$20,$20,$20 ; Y defb $f8,$10,$20,$40,$f8 ; Z defb $78,$60,$60,$60,$78 ; [ defb $80,$40,$20,$10,$08 ; \ defb $f0,$30,$30,$30,$f0 ; ] defb $20,$70,$a8,$20,$20 ; ^ defb $00,$00,$00,$00,$f8 ; _ defb $20,$20,$10,$00,$00 ; ` defb $00,$78,$88,$88,$78 ; a defb $80,$f0,$88,$88,$f0 ; b defb $00,$70,$80,$80,$78 ; c defb $08,$78,$88,$88,$78 ; d defb $00,$70,$f8,$80,$70 ; e defb $18,$20,$78,$20,$20 ; f defb $00,$78,$f8,$08,$70 ; g defb $80,$f0,$88,$88,$88 ; h defb $20,$60,$20,$20,$70 ; i defb $08,$18,$08,$08,$38 ; j defb $80,$90,$e0,$90,$88 ; k defb $60,$20,$20,$20,$70 ; l defb $00,$d0,$a8,$88,$88 ; m defb $00,$f0,$88,$88,$88 ; n defb $00,$70,$88,$88,$70 ; o defb $00,$f0,$88,$f0,$80 ; p defb $00,$78,$88,$78,$08 ; q defb $00,$f0,$88,$80,$80 ; r defb $00,$78,$e0,$38,$f0 ; s defb $20,$78,$20,$20,$18 ; t defb $00,$88,$88,$88,$78 ; u defb $00,$88,$88,$50,$20 ; v defb $00,$88,$a8,$d8,$88 ; w defb $00,$88,$70,$88,$88 ; x defb $00,$88,$78,$08,$70 ; y defb $00,$f8,$20,$40,$f8 ; z defb $18,$20,$c0,$20,$18 ; { defb $20,$20,$20,$20,$20 ; | defb $c0,$20,$18,$20,$c0 ; } defb $68,$b0,$00,$00,$00 ; ~ defb $f8,$f8,$f8,$f8,$f8 ; block z88dk-1.8.ds1/libsrc/vz/vz_sound.asm0000644000175000017500000000034710552125161016774 0ustar tygrystygrys; CALLER LINKAGE FOR FUNCTION POINTERS XLIB vz_sound LIB vz_sound_callee XREF ASMDISP_VZ_SOUND_CALLEE .vz_sound pop de pop bc pop hl push hl push bc push de jp vz_sound_callee + ASMDISP_VZ_SOUND_CALLEE z88dk-1.8.ds1/libsrc/vz/vz_sound_callee.asm0000644000175000017500000000105710552125161020300 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __CALLEE__ vz_sound_callee(int freq, int cycles) XLIB vz_sound_callee XREF ASMDISP_VZ_SOUND_CALLEE .vz_sound_callee pop de pop bc pop hl push de ; bc = cycles ; hl = freq .asmentry ; similar to z88dk bit_beep() jp $345c ; sound DEFC ASMDISP_VZ_SOUND_CALLEE = asmentry - vz_sound_callee z88dk-1.8.ds1/libsrc/vz/vz_soundcopy.asm0000644000175000017500000000055210552125161017665 0ustar tygrystygrys; CALLER LINKAGE FOR FUNCTION POINTERS XLIB vz_soundcopy LIB vz_soundcopy_callee XREF ASMDISP_VZ_SOUNDCOPY_CALLEE .vz_soundcopy pop af pop bc pop de ld b,e exx pop bc pop hl pop de push de push hl push bc exx push de push bc push af jp vz_soundcopy_callee + ASMDISP_VZ_SOUNDCOPY_CALLEE z88dk-1.8.ds1/libsrc/vz/vz_soundcopy_callee.asm0000644000175000017500000000334410552125161021174 0ustar tygrystygrys;***************************************************** ; ; Video Technology library for small C compiler ; ; Juergen Buchmueller ; ;***************************************************** ; ----- void __CALLEE__ vz_soundcopy_callee(char *dst, char *src, int size, int sound1, int sound2); XLIB vz_soundcopy_callee XDEF ASMDISP_VZ_SOUNDCOPY_CALLEE XREF _std_seed .vz_soundcopy_callee pop af pop bc pop de ld b,e exx pop bc pop hl pop de push af exx ; bc' = int size ; hl' = char *src ; de' = char *dst ; c = sound 2 ; b = sound 1 .asmentry ld e,c ld d,b ld hl,(_std_seed) ld a,b or c ; both off? exx ld a,($783b) ; get latch data jp nz, soundcopy1 ; sound is on ldir ret .soundcopy1 exx inc d ; tone ? dec d jr z, soundcopy2 ; nope, skip dec d ; counted down? jr nz, soundcopy2 ; nope ld d,b ; reset counter xor $21 ; toggle output ld ($6800),a .soundcopy2 inc e ; noise ? dec e jr z, soundcopy3 ; nope, skip dec e ; counted down? jr nz, soundcopy3 ; nope ld e,c ; reset counter add hl,hl ; rotate 16 random bits jr nc, soundcopy3 ; not set inc l ; set bit 0 agaon xor $21 ; toggle output ld ($6800),a .soundcopy3 exx ldi ; transfer 4 bytes ldi ldi ldi jp pe, soundcopy1 ; until done ld ($783b),a ret DEFC ASMDISP_VZ_SOUNDCOPY_CALLEE = asmentry - vz_soundcopy_callee z88dk-1.8.ds1/libsrc/vz200.lst0000644000175000017500000000753110712620314015371 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/vz200/fgetc_cons stdio/fgets_cons stdio/vz200/fputc_cons stdio/vz200/getk stdio/puts_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorpixl graphics/xorplot graphics/setxy graphics/fill graphics/dfill graphics/vz200/putsprite graphics/getsprite graphics/vz200/bksave graphics/vz200/bkrestore graphics/vz200/pixladdr graphics/vz200/swapgfxbk graphics/vz200/clsgraph games/joystick printflike/ltoa_any vz/vz_bgrd vz/vz_brick vz/vz_brick_callee vz/vz_char_draw vz/vz_clrscr vz/vz_color vz/vz_getch vz/vz_gotoxy vz/vz_gotoxy_callee vz/vz_inch vz/vz_line vz/vz_line_callee vz/vz_midstr vz/vz_midstr_callee vz/vz_mode vz/vz_plot vz/vz_plot_callee vz/vz_score vz/vz_score_callee vz/vz_setbase vz/vz_shape vz/vz_sound vz/vz_sound_callee vz/vz_soundcopy vz/vz_soundcopy_callee z88dk-1.8.ds1/libsrc/vzansi.lst0000644000175000017500000001012510712620314016013 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/vz200/fgetc_cons stdio/fgets_cons stdio/vz200/getk stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/vz200/f_ansi_attr stdio/ansi/vz200/f_ansi_bel stdio/ansi/vz200/f_ansi_char stdio/ansi/vz200/f_ansi_cls stdio/ansi/vz200/f_ansi_dline stdio/ansi/vz200/f_ansi_scrollup stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/xorborder graphics/xorpixl graphics/xorplot graphics/setxy graphics/fill graphics/dfill graphics/vz200/putsprite graphics/getsprite graphics/vz200/bksave graphics/vz200/bkrestore graphics/vz200/pixladdr graphics/vz200/swapgfxbk graphics/vz200/clsgraph games/joystick printflike/ltoa_any vz/vz_bgrd vz/vz_brick vz/vz_brick_callee vz/vz_char_draw vz/vz_clrscr vz/vz_color vz/vz_getch vz/vz_gotoxy vz/vz_gotoxy_callee vz/vz_inch vz/vz_line vz/vz_line_callee vz/vz_midstr vz/vz_midstr_callee vz/vz_mode vz/vz_plot vz/vz_plot_callee vz/vz_score vz/vz_score_callee vz/vz_setbase vz/vz_shape vz/vz_sound vz/vz_sound_callee vz/vz_soundcopy vz/vz_soundcopy_callee z88dk-1.8.ds1/libsrc/z80.lst0000644000175000017500000000535110765022543015137 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fdopen stdio/fgets_cons stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/fseek stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/fgets_cons stdio/puts_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/vfscanf printflike/vsscanf printflike/sscanf printflike/fscanf printflike/ltoa_any z88dk-1.8.ds1/libsrc/z80_crt0s/0000755000175000017500000000000010765202715015523 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/z80_crt0s/crt0/0000755000175000017500000000000010765202715016373 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/z80_crt0s/crt0/getarg.asm0000644000175000017500000000047107130401725020342 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; This routine is needed by printf & scanf etc ; Added 10/10/98 djm XLIB getarg LIB l_sxt .getarg jp l_sxt z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/htons.asm0000644000175000017500000000035607130401725020226 0ustar tygrystygrys; ; Small C+ TCP Implementation ; ; htons() Convert host to network format and back again! ; ; djm 24/4/99 XLIB htons .htons ld a,l ld l,h ld h,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_and.asm0000644000175000017500000000051007130401725020140 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_and ; "and" HL and DE into HL .l_and ld a,l and e ld l,a ld a,h and d ld h,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_asl.asm0000644000175000017500000000053410553134061020162 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_asl ; shift DE left arithmetically by HL, move to HL .l_asl ex de,hl .l_asl1 dec e ret m add hl,hl jp l_asl1 z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_asr.asm0000644000175000017500000000110110553134131020155 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm ; ; 22/3/99 djm Rewritten to be shorter.. XLIB l_asr .l_asr ex de,hl .l_asr1 dec e ret m sra h rr l jp l_asr1 IF ARCHAIC .l_asr ex de,hl .l_asr1 dec e ret m ld a,h rla ld a,h rra ld h,a ld a,l rra ld l,a jr l_asr1 ENDIF z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_asr_u.asm0000644000175000017500000000113310553134204020507 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm ; ; 22/3/99 djm Rewritten to be shorter.. unsigned version XLIB l_asr_u .l_asr_u ex de,hl .l_asr_u_1 dec e ret m srl h rr l jp l_asr_u_1 IF ARCHAIC .l_asr ex de,hl .l_asr1 dec e ret m ld a,h rla ld a,h rra ld h,a ld a,l rra ld l,a jr l_asr1 ENDIF z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_bcneg.asm0000644000175000017500000000051307130401725020457 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_bcneg ; {BC = -BC} .l_bcneg ld a,b cpl ld b,a ld a,c cpl ld c,a inc bc ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_bool.asm0000644000175000017500000000041407130401725020334 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_bool .l_bool ld a,h or l ret z ld hl,1 ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_case.asm0000644000175000017500000000124507130401725020317 0ustar tygrystygrys; Small C+ Z80 Run time library ; The new case statement..maybe things will work now! ; 13/10/98 XLIB l_case .l_case ex de,hl ;de = switch value pop hl ;hl -> switch table .swloop ld c,(hl) inc hl ld b,(hl) ;bc -> case addr, else 0 inc hl ld a,b or c jr z,swend ;default or continuation code ld a,(hl) inc hl cp e ld a,(hl) inc hl jr nz,swloop cp d jr nz,swloop ld h,b ;cases matched ld l,c .swend jp (hl) z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_cm_bc.asm0000644000175000017500000000056510553134613020455 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_cm_bc .l_cm_bc ld a,b or a ret p cpl ld b,a ld a,c cpl ld c,a inc bc ret ; ld a,b ; or a ; ret p ; call l_bcneg ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_cm_de.asm0000644000175000017500000000057010553134613020455 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_cm_de .l_cm_de ld a,d or a ret p cpl ld d,a ld a,e cpl ld e,a inc de ret ; ld a,d ; or a ; ret p ; call l_deneg ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_cmp.asm0000644000175000017500000000050707435244277020202 0ustar tygrystygrys; ; Z80 Runtime Library ; ; Signed integer compare ; ; $Id: l_cmp.asm,v 1.7 2002/02/21 19:21:35 dom Exp $: XLIB l_cmp ; signed compare of DE and HL ; carry is sign of difference [set => DE < HL] ; zero is zero/non-zero .l_cmp ld a,h add $80 ld b,a ld a,d add $80 cp b ret nz ld a,e cp l ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_com.asm0000644000175000017500000000046107130401725020161 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_com ; HL = ~HL .l_com ld a,h cpl ld h,a ld a,l cpl ld l,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_deneg.asm0000644000175000017500000000050707130401725020466 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_deneg ; {DE = -DE} .l_deneg ld a,d cpl ld d,a ld a,e cpl ld e,a inc de ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_div.asm0000644000175000017500000000556710623254714020206 0ustar tygrystygrys; ; Z88 Runtime library ; ; Moved from z88_crt0.asm to library function ; XLIB l_div LIB l_div_u XREF L_DIVENTRY IF !ARCHAIC ; The old routine was so cumbersome, so come up with a new one which ; will hopefully be a lot quicker and nicer! ; hl = hl/de de= hl % de - signed! ;oops, it's the other way round! ; hl = de/hl de=de % hl - hence the ex de,hl as first line! .l_div ; Check for dividing by zero beforehand ld a,h or l ret z ex de,hl ;First have to obtain signs for quotient and remainder ld a,h ;dividend and 128 ld b,a ;b = sgn(divisor) jr z,l_div0 ;if -ve make into positive number! sub a sub l ld l,a sbc a,a sub h ld h,a .l_div0 ld a,d ;divisor and 128 ld c,a ;c = sgn(quotient) jr z,l_div01 sub a sub e ld e,a sbc a,a sub d ld d,a .l_div01 or a push bc ;save signs call l_div_u + L_DIVENTRY ; unsigned divide but skip zero check ;Now do the signs.. pop bc ;c = sgn(quotient), b = sgn(divisor) ex de,hl ;de holds quotient, hl holds remainder ld a,c xor b call m, dosign ;quotient ld a,b ex de,hl ;remainder (into de) ;Do the signs - de holds number to sign, a holds sign and 128 ret z ;not negative so okay.. .dosign sub a sub e ld e,a sbc a,a sub d ld d,a ret ENDIF IF ARCHAIC ;These are now in libraries! LIB l_deneg LIB l_bcneg ; HL = DE / HL, DE = DE % HL .l_div ld b,h ld c,l ld a,d xor b push af call m,l_deneg ; call CALL_ ; .dw cm_de call m,l_bcneg ; ZShell mod ; call CALL_ ; .dw cm_bc ld a,16 push af ex de,hl ld de,0 .l_div1 add hl,hl ; {DE arg1 rla adc hl,hl ;res1 << 1 -> res1 sbc hl,de ;res1 - arg2 -> res1 jr nc,l_div2 add hl,de ;res1 + arg2 -> res1 .l_div2 ccf djnz l_div1 rl c ;arg1 << 1 -> arg1 rla ;Have to return arg1 in hl and res1 in de ld d,a ld e,c ex de,hl ret DEFC L_DIVENTRY = entry - l_div_u z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_eq.asm0000644000175000017500000000071010601576314020011 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm ; 13/5/99 djm Added carry conditions... XLIB l_eq LIB l_cmp ; ; ; DE == HL ; carry set if true .l_eq and a sbc hl,de ccf ret z and a ret IF 0 call l_cmp scf ret z ccf dec hl ret ENDIF z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_gchar.asm0000644000175000017500000000052607130401725020471 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_gchar ; fetch char from (HL) and sign extend into HL .l_gchar ld a,(hl) .l_sxt ld l,a rlca sbc a,a ld h,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_ge.asm0000644000175000017500000000063410601576314020004 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_ge ; ; DE >= HL [signed] ; set carry if true .l_ge ld a,h add a,$80 ld b,a ld a,d add a,$80 cp b ccf ret nz ld a,e cp l ccf ret ; call l_cmp ;invert carry condition ; ccf ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_getptr.asm0000644000175000017500000000036110601576314020713 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; ; Get Long Pointer from Near Memory XLIB l_getptr ;Fetch long from (hl) .l_getptr ld e,(hl) inc hl ld d,(hl) inc hl ld l,(hl) ld h,0 ex de,hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_ghtonsint.asm0000644000175000017500000000046507130401725021424 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; Quicky to make network progs quicker XLIB l_ghtonsint .l_ghtonsint ld a,(hl) inc hl ld l,(hl) ld h,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_gint.asm0000644000175000017500000000042707130401725020346 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_gint .l_gint ld a,(hl) inc hl ld h,(hl) ld l,a retz88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_gint_eq.asm0000644000175000017500000000064607130401725021036 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm ; ; 13/5/99 djm Optimizer routine to test against zero ; Returns z=0 nz otherwise as well as the int in hl XLIB l_gint_eq .l_gint_eq ld a,(hl) inc hl ld h,(hl) ld l,a or h retz88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_glong.asm0000644000175000017500000000035010601576314020512 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_glong ;Fetch long dehl from (hl) .l_glong ld e,(hl) inc hl ld d,(hl) inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ex de,hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_gt.asm0000644000175000017500000000063310601576314020022 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_gt ; ; DE > HL [signed] ; set carry if true .l_gt ld a,d add a,$80 ld b,a ld a,h add a,$80 cp b ret nz ld a,l cp e ret ; ex de,hl ; call l_cmp ; ret c ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_jphl.asm0000644000175000017500000000022310302466742020341 0ustar tygrystygrys; 05.2005 aralbrec ; 'call JPHL' shows up so often that a jp(hl) function ; needs to be part of the z80 library. XLIB l_jphl .l_jphl jp (hl) z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_jpix.asm0000644000175000017500000000022310302466742020356 0ustar tygrystygrys; 05.2005 aralbrec ; 'call JPIX' shows up so often that a jp(ix) function ; needs to be part of the z80 library. XLIB l_jpix .l_jpix jp (ix) z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_jpiy.asm0000644000175000017500000000022310302466742020357 0ustar tygrystygrys; 05.2005 aralbrec ; 'call JPIY' shows up so often that a jp(iy) function ; needs to be part of the z80 library. XLIB l_jpiy .l_jpiy jp (iy) z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_le.asm0000644000175000017500000000066410601576314020014 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_le ; ; DE <= HL [signed] ; set carry if true .l_le ld a,d add a,$80 ld b,a ld a,h add a,$80 cp b ccf ret nz ld a,l cp e ccf ret ; call l_cmp ; ret c ; scf ; ret z ; ccf ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_lneg.asm0000644000175000017500000000066710601576314020344 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_lneg ; HL = !HL ; set carry if result true .l_lneg ld a,h or l ret nz scf ret ; ld a,h ; or l ; jr z,l_lneg1 ; ld hl,0 ; and a ;reset c (already done by or l) ; ret ;.l_lneg1 ; inc l ; scf ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_lt.asm0000644000175000017500000000057210601576314020031 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_lt ; ; DE < HL [signed] ; set carry if true .l_lt ld a,h add a,$80 ld b,a ld a,d add a,$80 cp b ret nz ld a,e cp l ret ; call l_cmp ; ret c ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_mul.asm0000644000175000017500000000161207130401725020177 0ustar tygrystygrys; ; Small C Z88 runtime library ; ; Multiply two 16 bit numbers hl=hl*de ((un)signed) XLIB l_mult ;New version 15/11/98 based on Spectrum ROM routine .l_mult ld b,16 ld a,h ld c,l ld hl,0 .l_mult1 add hl,hl rl c rla ;DLE 27/11/98 jr nc,l_mult2 add hl,de .l_mult2 djnz l_mult1 ret IF ARCHAIC .l_mult ld b,h ld c,l ld hl,0 .l_mul1 ld a,c rrca jr nc,l_mul2 add hl,de .l_mul2 xor a ld a,b rra ld b,a ld a,c rra ld c,a or b ret z xor a ld a,e rla ld e,a ld a,d rla ld d,a or e ret z jr l_mul1 ENDIFz88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_ne.asm0000644000175000017500000000061010601576314020005 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_ne LIB l_cmp ; ; DE != HL ; set carry if true .l_ne or a sbc hl,de scf ret nz ccf ret ; call l_cmp ; scf ; ret nz ; ccf ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_neg.asm0000644000175000017500000000041010601576314020152 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_neg ; HL = -HL .l_neg ld a,h cpl ld h,a ld a,l cpl ld l,a inc hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_or.asm0000644000175000017500000000047707130401726020033 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_or ; "or" HL and DE into HL .l_or ld a,l or e ld l,a ld a,h or d ld h,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_pint.asm0000644000175000017500000000050407130401726020354 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_pint ; store int from HL into (DE) .l_pint ld a,l ld (de),a inc de ld a,h ld (de),a retz88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_pint_eq.asm0000644000175000017500000000056707130401726021052 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm ; ; Optimization...check for equality XLIB l_pint_eq ; store int from HL into (DE) .l_pint_eq ld a,l ld (de),a inc de ld a,h ld (de),a or l ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_pint_ex.asm0000644000175000017500000000043107237752755021072 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 23/1/2001 djm XLIB l_pint_ex ; store int from HL into (DE) .l_pint_ex ex de,hl ld (hl),e inc hl ld (hl),d ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_pint_pop.asm0000644000175000017500000000050307237752755021254 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 23/1/2001 djm XLIB l_pint_pop LIB l_pint ; store int from HL into (DE) .l_pint_pop pop bc ;return address pop de ;where to put it push bc jp l_pint z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_plong.asm0000644000175000017500000000053607130401726020526 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_plong .l_plong ld a,l ld (bc),a inc bc ld a,h ld (bc),a inc bc ld a,e ld (bc),a inc bc ld a,d ld (bc),a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_putptr.asm0000644000175000017500000000044207130401726020741 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_putptr .l_putptr ld a,l ld (bc),a inc bc ld a,h ld (bc),a inc bc ld a,e ld (bc),a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_setmem.asm0000644000175000017500000000127610550676664020722 0ustar tygrystygrys; 01.2007 aralbrec XLIB l_setmem ; Many places in the library have functions ; that initialize structures to 0. This ; consolidates all those initializations into ; one quick routine. ; enter: a = init char, hl = top of struct ; usage: call l_setmem - 2*bytes + 1 ; where bytes = # bytes to write, up to 16 ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a inc hl ld (hl),a .l_setmem ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_sub.asm0000644000175000017500000000055407433557613020215 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_sub ; HL = DE - HL .l_sub ex de,hl and a sbc hl,de ret IF 0 ld a,e sub l ld l,a ld a,d sbc a,h ld h,a ret ENDIF z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_sxt.asm0000644000175000017500000000042107130401726020216 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_sxt .l_sxt ld l,a rlca sbc a,a ld h,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_ucmp.asm0000644000175000017500000000053407435244277020367 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm ; XLIB l_ucmp ; unsigned compare of DE and HL ; carry is sign of difference [set => DE < HL] ; zero is zero/non-zero .l_ucmp ld a,d cp h ret nz ld a,e cp l ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_uge.asm0000644000175000017500000000060310601576314020165 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm ; ; 13/5/99 djm, inverted carry conditions XLIB l_uge ; ; DE >= HL [unsigned] ; set carry if true .l_uge ld a,d cp h ccf ret nz ld a,e cp l ccf ret ; call l_ucmp ; ccf ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_ugt.asm0000644000175000017500000000050010601576314020200 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_ugt ; ; DE > HL [unsigned] ; set carry if true .l_ugt ld a,h cp d ret nz ld a,l cp e ret ; ex de,hl ; jp l_ucmp z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_ule.asm0000644000175000017500000000061610601576314020176 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_ule ; ; DE <= HL [unsigned] ; set carry if true .l_ule ld a,h cp d ccf ret nz ld a,l cp e ccf ret ; call l_ucmp ; ret c ; ret nz ;nc is set ; scf ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_ult.asm0000644000175000017500000000044610601576314020216 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_ult ; ; DE < HL [unsigned] ; set carry if true .l_ult ld a,d cp h ret nz ld a,e cp l ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0/l_xor.asm0000644000175000017500000000050707130401726020215 0ustar tygrystygrys; Z88 Small C+ Run time Library ; Moved functions over to proper libdefs ; To make startup code smaller and neater! ; ; 6/9/98 djm XLIB l_xor ; "xor" HL and DE into HL .l_xor ld a,l xor e ld l,a ld a,h xor d ld h,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/0000755000175000017500000000000010765202715017412 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/8080/0000755000175000017500000000000010765202715020011 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/8080/l_long_add.asm0000644000175000017500000000144607464170422022603 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; "8080" mode ; Stefano - 29/4/2002 ; $Id: l_long_add.asm,v 1.2 2002/05/02 07:56:02 stefano Exp $ ; XLIB l_long_add ;primary = secondary + primary ;enter with secondary, primary on stack .l_long_add ex (sp),hl ld (retloc+1),hl pop bc ld hl,0 add hl,sp ;points to hl on stack ld a,(hl) add c inc hl ld c,a ld a,(hl) adc a,b inc hl ld b,a ld a,(hl) adc a,e inc hl ld e,a ld a,(hl) adc a,d inc hl ld d,a ld sp,hl ld l,c ;get the lower 16 back into hl ld h,b .retloc jp 0 z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/8080/l_long_and.asm0000644000175000017500000000135707463524714022624 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; "8080" mode ; Stefano - 29/4/2002 ; XLIB l_long_and ;Logical routines for long functions dehl ;first opr on stack .l_long_and ex (sp),hl ld (retloc+1),hl pop bc ld hl,0 add hl,sp ;points to hl on stack ld a,c and (hl) inc hl ld c,a ld a,b and (hl) inc hl ld b,a ld a,e and (hl) inc hl ld e,a ld a,d and (hl) inc hl ld d,a ld sp,hl ld l,c ;get the lower 16 back into hl ld h,b .retloc jp 0 z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/8080/l_long_case.asm0000644000175000017500000000145507463516720022772 0ustar tygrystygrys; Small C+ Z80 Run time library ; case statement.. "8080" mode ; Stefano - 29/4/2002 XLIB l_long_case ;Case statement for longs ;Enter with dehl=number to check against.. .l_long_case ld b,h ;we need HL, so move it to BC ld c,l pop hl ;switch table location .swloop push hl ld a,(hl) inc hl ld h,(hl) ld l,a ld (retloc+1),hl pop hl ;ld a,(hl) ;inc hl or (hl) ; is addr 0 ? inc hl jr nz,noz jp (hl) ; fall out to default .noz push hl ld a,(hl) cp c jr nz,swfalse inc hl ld a,(hl) cp b jr nz,swfalse inc hl ld a,(hl) cp e jr nz,swfalse inc hl ld a,(hl) cp d .swfalse pop hl inc hl inc hl inc hl inc hl ; +4 bytes jr nz,swloop ;Have had a match here... .retloc jp 0 z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/8080/l_long_or.asm0000644000175000017500000000141407463524714022474 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; "8080" mode ; Stefano - 29/4/2002 ; XLIB l_long_or ;Logical routines for long functions dehl ;first opr on stack ; "or" deHL' and dehl into HLde' .l_long_or ex (sp),hl ld (retloc+1),hl pop bc ld hl,0 add hl,sp ;points to hl on stack ld a,c or (hl) inc hl ld c,a ld a,b or (hl) inc hl ld b,a ld a,e or (hl) inc hl ld e,a ld a,d or (hl) inc hl ld d,a ld sp,hl ld l,c ;get the lower 16 back into hl ld h,b .retloc jp 0 z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/8080/l_long_sub.asm0000644000175000017500000000146207464170422022642 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; "8080" mode ; Stefano - 29/4/2002 ; $Id: l_long_sub.asm,v 1.2 2002/05/02 07:56:02 stefano Exp $ ; XLIB l_long_sub ;primary = secondary - primary ;enter with secondary, primary on stack .l_long_sub ex (sp),hl ld (retloc+1),hl pop bc ld hl,0 add hl,sp ;points to hl on stack ld a,(hl) sub c inc hl ld c,a ld a,(hl) sbc a,b inc hl ld b,a ld a,(hl) sbc a,e inc hl ld e,a ld a,(hl) sbc a,d inc hl ld d,a ld sp,hl ld l,c ;get the lower 16 back into hl ld h,b .retloc jp 0 z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/8080/l_long_ucmp.asm0000644000175000017500000000316207464170422023014 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long support functions ; "8080" mode ; Stefano - 30/4/2002 ; $Id: l_long_ucmp.asm,v 1.1 2002/05/02 07:56:02 stefano Exp $ ; XLIB l_long_ucmp ; Unsigned compare of dehl (stack) and dehl (registers) ; ; Entry: primary = (under two return addresses on stack) ; secondary= dehl ; ; Exit: z = numbers the same ; nz = numbers different ; c/nc = sign of difference [set if secondary > primary] ; ; Code takes secondary from primary .l_long_ucmp ex (sp),hl ld (retloc+1),hl pop bc ld hl,0 add hl,sp ;points to hl on stack ld a,(hl) sub c inc hl ld a,(hl) sbc a,b inc hl ld a,(hl) sbc a,e inc hl ld a,(hl) sbc a,d inc hl ld sp,hl ;ld l,c ;get the lower 16 back into hl ;ld h,b ; ATP we have done the comparision and are left with dehl = result of ; primary - secondary, if we have a carry then secondary > primary jr c,l_long_ucmp1 ; ; Primary was larger, return nc ld a,h or l or d or e ld hl,1 ; Saves some mem in comparison functions scf ; Replace with and a? ccf jr retloc ; Secondary was larger, return c .l_long_ucmp1 ld a,h or l or d or e scf ld hl,1 ; Saves some mem in comparision unfunctions .retloc jp 0 z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/8080/l_long_xor.asm0000644000175000017500000000141707463524714022667 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; "8080" mode ; Stefano - 29/4/2002 ; XLIB l_long_xor ;Logical routines for long functions dehl ;first opr on stack ; "xor" deHL' and dehl into HLde' .l_long_xor ex (sp),hl ld (retloc+1),hl pop bc ld hl,0 add hl,sp ;points to hl on stack ld a,c xor (hl) inc hl ld c,a ld a,b xor (hl) inc hl ld b,a ld a,e xor (hl) inc hl ld e,a ld a,d xor (hl) inc hl ld d,a ld sp,hl ld l,c ;get the lower 16 back into hl ld h,b .retloc jp 0 z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/8080/lpush2.asm0000644000175000017500000000072207463516720021736 0ustar tygrystygrys; ; Small C+ Compiler ; ; Long Support Library ; "8080" mode ; ; 29/4/2002 - Stefano ; This routine is used to push longs on the stack for a ; call to a function defined as a pointer. XLIB lpush2 .lpush2 pop bc ld (retloc+1),bc pop bc ;save next item on stack push de ;dump our long push hl push bc ;store back "next item on stack" .retloc jp 0 z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/htonl.asm0000644000175000017500000000056207130401726021236 0ustar tygrystygrys; ; Small C+ TCP Implementation ; ; htonl() Convert host to network format and back again! ; ; djm 24/4/99 XLIB htonl .htonl ex de,hl ;exchange order of bytes ld a,l ;swap within bytes ld l,h ld h,a ld a,e ld e,d ld d,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/int2long_s.asm0000644000175000017500000000041207130401726022162 0ustar tygrystygrys; Small C+ Z88 Support Library ; ; Convert signed int to long XLIB l_int2long_s ; If MSB of h sets de to 255, if not sets de=0 .l_int2long_s ld de,0 bit 7,h ret z dec de ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_declong.asm0000644000175000017500000000063307130401726022037 0ustar tygrystygrys; Small C+ Z88 Support Library ; ; Decrement long by 1 ; ; djm 21/2/99 ; Rewritten so that I know it works XLIB l_declong .l_declong ld a,h or l dec hl ret nz dec de ret IF ARCHAIC .l_declong ld bc,-1 add hl,bc ret nc dec de ret ENDIF z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_inclong.asm0000644000175000017500000000074510604414450022057 0ustar tygrystygrys; Small C+ Z88 Support Library ; ; Increment long by 1 ; ; djm 21/2/99 ; Rewritten so that I know it works properly! XLIB l_inclong .l_inclong inc l ret nz inc h ret nz inc de ret ; inc hl ; ld a,h ; or l ; ret nz ; inc de ; ret IF ARCHAIC .l_inclong ld bc,1 add hl,bc ret nc inc de ret ENDIF z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_add.asm0000644000175000017500000000276110604414450022175 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_add .l_long_add ; dehl = primary ; stack = secondary, ret ; 76 cycles hurrah! pop ix ; ix = ret addr pop bc ; bc = secondary LSW add hl,bc ex de,hl ; de = result LSW pop bc ; bc = secondary MSW adc hl,bc ex de,hl ; dehl = result jp (ix) ; dehl = primary ; stack = secondary, ret ; 123 cycles ; ; pop bc ; bc holds ret address ; ex de,hl ; primary = hlde ; ex (sp),hl ; hl = secondary LSW, stack = primary MSW ; add hl,de ; add LSWs ; pop de ; de = primary MSW ; ex (sp),hl ; hl = secondary MSW, stack = result LSW ; adc hl,de ; add MSWs ; ex de,hl ; de = result MSW ; pop hl ; hl = result LSW ; push bc ; ret ; This routine appears to cause horrendous crashes, but I'm not ; sure why...mysterious! ; 127 cycles ;.l_long_add ; ; ld a,l ; exx ;2 ; pop bc ;ret address ; pop hl ;secondary ; pop de ; push bc ; add a,l ; ld l,a ; ld a,h ; exx ;1 ; adc a,h ; exx ;2 ; ld h,a ; ld a,e ; exx ;1 ; adc a,e ; exx ;2 ; ld e,a ; ld a,d ; exx ;1 ; adc a,d ; exx ;2 ; ld d,a ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_and.asm0000644000175000017500000000221210604414450022176 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_and ; primary = dehl ; stack = secondary, ret ; 90 cycles .l_long_and pop ix pop bc ld a,c and l ld l,a ld a,b and h ld h,a pop bc ld a,c and e ld e,a ld a,b and d ld d,a jp (ix) ; 127 cycles ; ;.l_long_and ; ld a,d ; exx ;primary ; pop bc; ; pop hl ; pop de ; push bc ; and d ; ld d,a ; ld a,e ; exx ;2nd ; and e ; exx ;1st ; ld e,a ; ld a,h ; exx ;2nd ; and h ; exx ;1st ; ld h,a ; ld a,l ; exx ;2nd ; and l ; exx ;1st ; ld l,a ; ret ; primary = dehl ; stack = secondary, ret addr ; 141 cycles but doesn't use EXX ; ;.l_long_and ; ; pop bc ; ex de,hl ; ex (sp),hl ; ld a,l ; and e ; ld l,a ; ld a,h ; and d ; ld h,a ; pop de ; ex (sp),hl ; ld a,l ; and e ; ld e,a ; ld a,h ; and d ; ld d,a ; pop hl ; push bc ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_asl.asm0000644000175000017500000000123310604414450022215 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long support functions ; ; djm 25/2/99 ; Made work! - Seems a little messed up previously (still untested) ; ; aralbrec 01/2007 ; shifts are faster than doubling and ex with de/hl XLIB l_long_asl ; Shift primary left by secondary ; ; Primary is on the stack, and is 32 bits long therefore we need only ; concern ourselves with l (secondary) as our counter .l_long_asl pop ix ld a,l ; counter pop hl pop de or a jr z, done ld b,a ld a,e ; primary = dahl .loop add hl,hl rla rl d djnz loop ld e,a .done jp (ix) z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_aslo.asm0000644000175000017500000000140710604414450022377 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long support functions ; ; djm 25/2/99 ; Made work! - Seems a little messed up previously (still untested) ; ; djm 7/5/99 ; This version is called when the optimizer has had a look at ; the code ; ; aralbrec 01/2007 ; switched to shifts from slower doubling using de/hl XLIB l_long_aslo ; Shift primary left by secondary ; ; Primary is on the stack, and is 32 bits long therefore we need only ; concern ourselves with l (secondary) as our counter ; ; For optimized version we enter with the word in dehl and the shift ; counter in a .l_long_aslo or a ret z ld b,a ld a,e ; primary = dahl .loop add hl,hl rla rl d djnz loop ld e,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_asr.asm0000644000175000017500000000131610604414450022225 0ustar tygrystygrys; ; Z88 Small C+ Run Time Library ; Long support functions ; ; djm 25/2/99 ; Rewritten for size and speed (untested, but should be OK) ; ; aralbrec 01/2007 ; sped up some more XLIB l_long_asr ; Shift primary (on stack) right by secondary, ; We can only shift a maximum of 32 bits (or so), so the counter can ; go in c .l_long_asr pop ix ld a,l ;temporary store for counter pop hl pop de or a jr z, done ld b,a ld a,e ; primary = dahl .loop sra d rra rr h rr l djnz loop ld e,a .done jp (ix) z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_asr_u.asm0000644000175000017500000000140410604414450022547 0ustar tygrystygrys; ; Z88 Small C+ Run Time Library ; Long support functions ; ; ; aralbrec 01/2007 ; sped up some more ; ; djm 25/2/99 ; Rewritten for size and speed (untested, but should be OK) ; ; djm 22/3/99 Unsigned version XLIB l_long_asr_u ; Shift primary (on stack) right by secondary, ; We can only shift a maximum of 32 bits (or so), so the counter can ; go in c .l_long_asr_u pop ix ld a,l ;temporary store for counter pop hl pop de or a jr z, done ld b,a ld a,e ; primary = dahl .loop srl d rra rr h rr l djnz loop ld e,a .done jp (ix) z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_asr_uo.asm0000644000175000017500000000145410604414450022733 0ustar tygrystygrys; ; Z88 Small C+ Run Time Library ; Long support functions ; ; djm 25/2/99 ; Rewritten for size and speed (untested, but should be OK) ; ; djm 22/3/99 Unsigned version ; ; djm 7/5/99 Optimizer version, enter with dehl = long c=counter ; ; aralbrec 01/2007 Sped up, would be better with a or b = counter XLIB l_long_asr_uo ; Shift primary (on stack) right by secondary, ; We can only shift a maximum of 32 bits (or so), so the counter can ; go in c ; it's better to have the counter in a, maybe something to change in compiler .l_long_asr_uo ld a,c or a ret z ld b,a ld a,e ; primary in dahl .loop srl d rra rr h rr l djnz loop ld e,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_asro.asm0000644000175000017500000000132310604414450022402 0ustar tygrystygrys; ; Z88 Small C+ Run Time Library ; Long support functions ; ; djm 25/2/99 ; Rewritten for size and speed (untested, but should be OK) ; ; djm 7/6/99 ; The optimizer version! Entered with long in dehl and counter in c ; ; aralbrec 01/2007 ; Sped up, would be better with counter in a or b XLIB l_long_asro ; Shift primary (on stack) right by secondary, ; We can only shift a maximum of 32 bits (or so), so the counter can ; go in c .l_long_asro ld a,c or a ret z ld b,a ld a,e ; primary = dahl .loop sra d rra rr h rr l djnz loop ld e,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_bool.asm0000644000175000017500000000037710604414450022401 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_bool ; HL = !!HL .l_long_bool ld a,h or l or e or d ret z ld hl,1 ld e,h ld d,h ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_case.asm0000644000175000017500000000201207463451117022357 0ustar tygrystygrys; Small C+ Z80 Run time library ; The new case statement..maybe things will work now! ; 13/10/98 XLIB l_long_case ;Case statement for longs ;Enter with dehl=number to check against.. .l_long_case pop ix ;switch table .swloop ld a,(ix+0) or (ix+1) inc ix inc ix jr z,swend ;enod of table ;Now, have to check our values ld bc,4 add ix,bc ;points to next entry,, ld a,(ix-4) cp l jr nz,swloop ld a,(ix-3) cp h jr nz,swloop ld a,(ix-2) cp e jr nz,swloop ld a,(ix-1) cp d jr nz,swloop ;Have had a match here...so, load up address, and get there IF Z80S183 ld e,(ix-6) ;low byte ld d,(ix-5) ;high push de pop ix ELSE ld a,(ix-6) ;low byte ld ixh,(ix-5) ld ixl,a ENDIF .swend jp (ix) z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_cmp.asm0000644000175000017500000000600307130401726022217 0ustar tygrystygrys; ; ; Small C+ C Compiler ; ; Long Support Functions ; ; 26/2/99 djm ; ; I've realised that all the old long comparision functions were ; (to be polite) fubarred, so I'm endeavouring to rewrite ; the core so that we get some decent answers out - this is ; helped no end by having a l_long_sub function which works ; the right way round! ; ; Anyway, on with the show; this is the generic compare routine ; used for all signed long comparisons. ; Entry: dehl=secondary ; onstack (under two return addresses) = primary ; ; ; Exit: z=number is zero ; (nz)=number is non-zero ; c=number is negative ; nc=number is positive XLIB l_long_cmp .l_long_cmp pop bc ;return address from this function ;this leaves return address to real program ;and the primary on the stack ; Code cut from l_long_sub here exx ;2nd pop bc pop hl pop de push bc ;return address to program ld a,l exx push bc ;return address from function sub l ld l,a exx ;1st ld a,h exx ;2nd sbc a,h ld h,a exx ;1st ld a,e exx '2md sbc a,e ld e,a exx ;1st ld a,d exx ;2nd sbc a,d ld d,a ; ATP we have done the comparision and are left with dehl = result of ; primary - secondary bit 7,d jr z,l_long_cmp1 ; Negative numbers ld a,h or l or d or e ld hl,1 ; Saves some mem in comparison functions scf ret ; Number is positive .l_long_cmp1 ld a,h or l or d or e scf ; Could this be replaced by and a? ccf ld hl,1 ; Saves some mem in comparision unfunctions ret IF ARCHAIC .l_long_cmp pop bc ;return to calling function exx ;1st pop bc ;return to program proper pop hl ;primary number pop de push bc ;return to program proper ld a,l exx push bc sub l ld l,a exx ld a,h exx ;1st sbc a,h ld h,a exx ld a,e exx ;1st sbc a,e ld e,a exx ld a,d exx ;1st sbc a,d ld d,a ;Now, the test ld de,1 ex de,hl jr c,l_long_cmp1 or e ret .l_long_cmp1 or e scf ret ENDIF z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_cmp_new.asm0000644000175000017500000000425507130401726023077 0ustar tygrystygrys; ; ; Small C+ C Compiler ; ; Long Support Functions ; ; 26/2/99 djm ; ; I've realised that all the old long comparision functions were ; (to be polite) fubarred, so I'm endeavouring to rewrite ; the core so that we get some decent answers out - this is ; helped no end by having a l_long_sub function which works ; the right way round! ; ; Anyway, on with the show; this is the generic compare routine ; used for all long comparisons. ; Entry: dehl=secondary ; onstack (under two return addresses) = primary ; ; ; Exit: z=number is zero ; (nz)=number is non-zero ; c=number is negative ; nc=number is positive XLIB l_long_cmp .l_long_cmp pop bc ;return address from this function ;this leaves return address to real program ;and the primary on the stack ; Code cut from l_long_sub here exx ;2nd pop bc pop hl pop de push bc ;return address to program ld a,l exx push bc ;return address from function sub l ld l,a exx ;1st ld a,h exx ;2nd sbc a,h ld h,a exx ;1st ld a,e exx '2md sbc a,e ld e,a exx ;1st ld a,d exx ;2nd sbc a,d ld d,a ; ATP we have done the comparision and are left with dehl = result of ; primary - secondary bit 7.d jr z,l_long_cmp1 ; Negative numbers ld a,h or l or d or e ld hl,1 ; Saves some mem in comparison functions scf ret ; Number is positive .l_long_cmp1 ld a,h or l or d or e scf ; Could this be replaced by and a? ccf ld hl,1 ; Saves some mem in comparision unfunctions ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_com.asm0000644000175000017500000000052007130401726022214 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_com ; deHL = ~deHL .l_long_com ld a,h cpl ld h,a ld a,l cpl ld l,a ld a,d cpl ld d,a ld a,e cpl ld e,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_dec.asm0000644000175000017500000000047210605604761022204 0ustar tygrystygrys; Small C+ Z88 Support Library ; ; Decrement long on hl ; Kept little endian ; ; djm 26/2/2000 XLIB l_long_dec .l_long_dec ld a,$ff dec (hl) cp (hl) ret nz inc hl dec (hl) cp (hl) ret nz inc hl dec (hl) cp (hl) ret nz inc hl dec (hl) ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_div.asm0000644000175000017500000000312210617310237022221 0ustar tygrystygrys; ; Small C+ Long Library Functions ; ; Divide 2 32 bit numbers ; ; Hopefully this routine does work! ; ; I think the use of ix is unavoidable in this case..unless you know ; otherwise! ; ; Replaced use of ix with bcbc' XLIB l_long_div LIB l_long_div_u, l_long_neg XREF L_LONG_DIVIDE0, L_LONG_DIVENTRY ; 32 bit division ; enter: ; dehl = arg2 ; stack = arg1, ret ; exit: ; dehl = arg1/arg2 ; de'hl'= arg1%arg2 .l_long_div ld a,d or e or h or l jp z, l_long_div_u + L_LONG_DIVIDE0 pop af push hl exx pop de pop bc ld hl,0 exx pop bc ld hl,0 push af ; bcbc' = arg1 ; hlhl' = res ; dede' = arg2 ; some nastiness to deal with signs ld a,c ld c,d push bc ; b = sgn(arg1), c = sgn(arg2) ld c,a bit 7,b jr z, skipnegbcbc .negbcbc exx ld a,c cpl ld c,a ld a,b cpl ld b,a ld a,b or c inc bc exx ld a,c cpl ld c,a ld a,b cpl ld b,a jr nz, skipnegbcbc inc bc .skipnegbcbc bit 7,d jr z, skipnegdede .negdede exx ld a,e cpl ld e,a ld a,d cpl ld d,a ld a,d or e inc de exx ld a,e cpl ld e,a ld a,d cpl ld d,a jr nz, skipnegdede inc de .skipnegdede call l_long_div_u + L_LONG_DIVENTRY ; dehl = quotient ; de'hl' = remainder ; deal with the signs pop bc ; b = sgn(arg1), c = sgn(arg2) ld a,b xor c call m, l_long_neg ld a,b and $80 ret p exx call l_long_neg exx ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_div_u.asm0000644000175000017500000000307210617310165022551 0ustar tygrystygrys; ; Small C+ Long Library Functions ; ; Divide 2 32 bit numbers ; ; Hopefully this routine does work! ; ; I think the use of ix is unavoidable in this case..unless you know ; otherwise! ; ; This is for unsigned quantities..separate routine for signed.. ; ; Replaced use of ix with bcbc' XLIB l_long_div_u XDEF L_LONG_DIVIDE0, L_LONG_DIVENTRY ; 32 bit division ; enter: ; dehl = arg2 ; stack = arg1, ret ; exit: ; dehl = arg1/arg2 ; de'hl'= arg1%arg2 .l_long_div_u ld a,d or e or h or l jr z, divide0 pop af push hl exx pop de pop bc ld hl,0 exx pop bc ld hl,0 push af .entry ld a,32 or a ; bcbc' = arg1 ; hlhl' = res ; dede' = arg2 .l_long_div1 exx ; arg1 <<= 1 rl c rl b exx rl c rl b exx ; res <<= 1 adc hl,hl exx adc hl,hl exx ; res -= arg2 sbc hl,de exx sbc hl,de jr nc, l_long_div2 exx ; res += arg2 add hl,de exx adc hl,de .l_long_div2 ccf dec a jp nz, l_long_div1 exx ; arg1 <<= 1 rl c rl b exx rl c rl b ; looking to return: ; dehl = quotient = arg1 ; de'hl' = remainder = res push hl exx pop de push bc exx pop hl ld e,c ld d,b ret .divide0 exx pop bc pop hl pop de push bc exx ret DEFC L_LONG_DIVIDE0 = divide0 - l_long_div_u DEFC L_LONG_DIVENTRY = entry - l_long_div_u z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_eq.asm0000644000175000017500000000122610756156123022055 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_eq ; ; DEHL == secondary ; set carry if result true ; stack = secondary MSW, secondary LSW, ret .l_long_eq pop ix ; return address pop bc ; secondary LSW ld a,c cp l jp nz, notequal0 ld a,b cp h jp nz, notequal0 pop bc ; secondary MSW ld a,c cp e jp nz, notequal1 ld a,b cp d jp nz, notequal1 scf jp (ix) .notequal0 pop bc .notequal1 or a jp (ix) ; call l_long_cmp ; scf ; ret z ; dec hl ; and a ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_ge.asm0000644000175000017500000000057607130401726022044 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_ge LIB l_long_cmp ; ;......logical operations: HL set to 0 (false) or 1 (true) ; ; DE >= HL [signed] .l_long_ge call l_long_cmp ccf ret c ; ret nc scf ret z ccf dec hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_gt.asm0000644000175000017500000000065707536656447022111 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_gt LIB l_long_cmp ; ;......logical operations: HL set to 0 (false) or 1 (true) ; ; dehl (stack) > dehl (reg) ; if true, then the resulting number from l_long_cmp will be +ve .l_long_gt call l_long_cmp jr z,l_long_gt1 ccf ;true ret c .l_long_gt1 dec hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_inc.asm0000644000175000017500000000043110604414425022210 0ustar tygrystygrys; Small C+ Z88 Support Library ; ; Increment long on hl ; Kept little endian ; ; djm 26/2/2000 ; aralbrec 01/2007 XLIB l_long_inc .l_long_inc inc (hl) ret nz inc hl inc (hl) ret nz inc hl inc (hl) ret nz inc hl inc (hl) ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_le.asm0000644000175000017500000000053607130401726022045 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_le LIB l_long_cmp ; ;......logical operations: HL set to 0 (false) or 1 (true) ; ; DE <= HL [signed] .l_long_le call l_long_cmp ret c scf ret z ccf dec hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_lneg.asm0000644000175000017500000000054610604414450022371 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_lneg ; deHL = !deHL ; set carry if result true and return val in dehl .l_long_lneg ld a,h or l or e or d jr z,l_long_lneg1 ld hl,0 ld d,h ld e,l ret .l_long_lneg1 inc l scf ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_lt.asm0000644000175000017500000000046407130401726022064 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_lt LIB l_long_cmp ; ;......logical operations: HL set to 0 (false) or 1 (true) ; ; DE < HL [signed] .l_long_lt call l_long_cmp ret c dec hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_mult.asm0000644000175000017500000000202010605605047022417 0ustar tygrystygrys; ; Small C+ Long Library Functions ; ; Multiply 32 bit numbers ; ; Entry: dehl=arg1 ; Staci: return address, arg2 ; ; Exit: dehl=result ; djm note I don't particularly like the use of ix as a pointer to the ; second argument, however it makes it quite a short routine, alternate ; method might be to use bc and bc' to hold arg2 and use a as a loop ; counter - please feel free to experiment! ; aralbrec advice taken! XLIB l_long_mult ; dehl = arg1 ; stack = arg2, ret .l_long_mult pop af push hl exx pop de pop bc ld hl,0 exx pop bc ld hl,0 push af ; dede' = arg1 ; bcbc' = arg2 ; hlhl' = res ld a,32 .l_long_mult1 srl b ; arg2 >>= 1 rr c exx rr b rr c jr nc, l_long_mult2 add hl,de ; res += arg1 exx adc hl,de exx .l_long_mult2 sla e ; arg1 <<= 1 rl d exx rl e rl d dec a jp nz, l_long_mult1 push hl exx pop de ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_ne.asm0000644000175000017500000000133010756156123022046 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_ne ; ; DEHL != secondary ; set carry if result true ; stack = secondary MSW, secondary LSW, ret .l_long_ne pop ix ; return address pop bc ; secondary LSW ld a,c cp l jp nz, notequal0 ld a,b cp h jp nz, notequal0 pop bc ; secondary MSW ld a,c cp e jp nz, notequal1 ld a,b cp d jr z, equal .notequal1 scf .equal jp (ix) .notequal0 pop bc ; clear secondary MSW from stack scf jp (ix) ; call l_long_cmp ; scf ; ret nz ; ccf ; dec hl ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_neg.asm0000644000175000017500000000061510604414450022212 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_neg ; deHL = -deHL .l_long_neg ld a,l cpl ld l,a ld a,h cpl ld h,a ld a,e cpl ld e,a ld a,d cpl ld d,a inc l ret nz inc h ret nz inc de ret ; call l_long_com ; inc hl ; ld a,h ; or l ; ret nz ; inc de ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_or.asm0000644000175000017500000000154510604414450022064 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_or ; "or" primary and secondary into dehl ; dehl = primary ; stack = secondary, ret .l_long_or pop ix pop bc ld a,c or l ld l,a ld a,b or h ld h,a pop bc ld a,c or e ld e,a ld a,b or d ld d,a jp (ix) ;.l_long_or ; ld a,d ; exx ;primary; ; pop bc ; pop hl ; pop de ; push bc ; or d ; ld d,a ; ld a,e ; exx ;2nd ; or e ; exx ;1st ; ld e,a ; ld a,h ; exx ;2nd ; or h ; exx ;1st ; ld h,a ; ld a,l ; exx ;2nd ; or l ; exx ;1st ; ld l,a ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_sub.asm0000644000175000017500000000410210604414450022225 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; ; djm 21/2/99 ; The old routine is fubarred! Written a new one now..but ; I'm mystified! XLIB l_long_sub ; dehl = primary ; stack = secondary, ret ; exit: dehl = secondary - primary .l_long_sub ; 100 cycles pop ix ; ix = ret address ld c,l ld b,h ; bc = primary LSW pop hl ; hl = secondary LSW or a sbc hl,bc ex de,hl ; de = result LSW ld c,l ld b,h ; bc = primary MSW pop hl ; hl = secondary MSW sbc hl,bc ex de,hl ; dehl = result jp (ix) ; 131 cycles ; exx ;2nd ; pop bc ; pop hl ; pop de ; push bc ; ld a,l ; exx ; sub l ; ld l,a ; exx ;1st ; ld a,h ; exx ;2nd ; sbc a,h ; ld h,a ; exx ;1st ; ld a,e ; exx '2md ; sbc a,e ; ld e,a ; exx ;1st ; ld a,d ; exx ;2nd ; sbc a,d ; ld d,a ; ret IF ARCHAIC ; 174 cycles .l_long_add ld b,h ;store lower 16 in bc temporarily ld c,l ld hl,2 add hl,sp ;points to hl on stack ld a,c sub a,(hl) inc hl ld c,a ld a,b sbc a,(hl) inc hl ld b,a ld a,e sbc a,(hl) inc hl ld e,a ld a,d sbc a,(hl) ld d,a ;Done the adding, now do some tidying up! exx pop bc ;return address pop hl ;discard entry long pop hl push bc ;dump return address back exx ld l,c ;get the lower 16 back into hl ld h,b ret ENDIF z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_ucmp.asm0000644000175000017500000000565707130401726022422 0ustar tygrystygrys; ; Z88 Small C+ Run Time Library ; Long support functions ; ; 25/2/99 djm ; Rewritten to use subtraction and use carry at end to figure ; out which one was larger ; XLIB l_long_ucmp ; Unsigned compare of dehl (stack) and dehl (registers) ; ; Entry: primary = (under two return addresses on stack) ; secondary= dehl ; ; Exit: z = numbers the same ; nz = numbers different ; c/nc = sign of difference [set if secondary > primary] ; ; Code takes secondary from primary .l_long_ucmp pop bc ;return address from this function ;this leaves return address to real program ;and the primary on the stack ; Code cut from l_long_sub here exx ;2nd pop bc pop hl pop de push bc ;return address to program ld a,l exx push bc ;return address from function sub l ld l,a exx ;1st ld a,h exx ;2nd sbc a,h ld h,a exx ;1st ld a,e exx '2md sbc a,e ld e,a exx ;1st ld a,d exx ;2nd sbc a,d ld d,a ; ATP we have done the comparision and are left with dehl = result of ; primary - secondary, if we have a carry then secondary > primary jr c,l_long_ucmp1 ; ; Primary was larger, return nc ld a,h or l or d or e ld hl,1 ; Saves some mem in comparison functions scf ; Replace with and a? ccf ret ; Secondary was larger, return nc .l_long_ucmp1 ld a,h or l or d or e scf ld hl,1 ; Saves some mem in comparision unfunctions ret IF ARCHAIC .l_long_ucmp ld a,d pop bc ;return to calling function exx pop bc ;return to program pop hl ;value pop de push bc ;calling program ; pop exx, push exx is quicker than pop ix push ox (same length as well) exx push bc ;calling function exx ;1st cp d jr nz,l_long_ucmp1 exx ;2nd ld a,e exx ;1st cp e jr nz,l_long_ucmp1 exx ;2nd ld a,h exx ;1st cp h jr nz,l_long_ucmp1 exx ;2nd ld a,l exx ;1st cp l .l_long_ucmp1 ccf ;flip carry flag to match other routines ld hl,1 ;preset true ret ENDIF z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_uge.asm0000644000175000017500000000062607130401726022225 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_uge LIB l_long_ucmp ; ;......logical operations: HL set to 0 (false) or 1 (true) ; ; primary (stack) >= secondary (dehl) .l_long_uge call l_long_ucmp ccf ret c scf ret z ; ret nc ccf dec hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_ugt.asm0000644000175000017500000000062307536656447022267 0ustar tygrystygrys; ; Z88 Small C+ Run Time Library ; Long library functions ; XLIB l_long_ugt LIB l_long_ucmp ; ;......logical operations: HL set to 0 (false) or 1 (true) ; ; primary (stack) > secondary (dehl) .l_long_ugt call l_long_ucmp jr z,l_long_ugt1 ccf ret c ; ret nc .l_long_ugt1 dec hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_ule.asm0000644000175000017500000000054507130401726022232 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_ule LIB l_long_ucmp ; ;......logical operations: HL set to 0 (false) or 1 (true) ; ; DE <= HL [unsigned] .l_long_ule call l_long_ucmp ret c scf ret z ccf dec hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_ult.asm0000644000175000017500000000047507130401726022253 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_ult LIB l_long_ucmp ; ;......logical operations: HL set to 0 (false) or 1 (true) ; ; DE < HL [unsigned] .l_long_ult call l_long_ucmp ret c dec hl ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/l_long_xor.asm0000644000175000017500000000151210604414450022246 0ustar tygrystygrys; Z88 Small C+ Run Time Library ; Long functions ; XLIB l_long_xor ; dehl = primary ; stack = secondary, ret .l_long_xor pop ix pop bc ld a,c xor l ld l,a ld a,b xor h ld h,a pop bc ld a,c xor e ld e,a ld a,b xor d ld d,a jp (ix) ;.l_long_xor ; ld a,d ; exx ;primary; ; pop bc; ; pop hl ; pop de ; push bc ; xor d ; ld d,a ; ld a,e ; exx ;2nd ; xor e ; exx ;1st ; ld e,a ; ld a,h ; exx ;2nd ; xor h ; exx ;1st ; ld h,a ; ld a,l ; exx ;2nd ; xor l ; exx ;1st ; ld l,a ; ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/long2int_s.asm0000644000175000017500000000057410604414450022171 0ustar tygrystygrys; Small C+ Z88 Support Library ; ; Convert signed long to int ; NB. This routine will only work if long < +/-32767ish (obvious) XLIB l_long2int_s ;This routine picks up the sign in d (MSB) sticks into the MSB of h ;Perhaps this routine could be inlined? Certainly short enough! .l_long2int_s ld a,d xor h ret p and $80 xor h ld h,a ret z88dk-1.8.ds1/libsrc/z80_crt0s/crt0_long/lpush2.asm0000644000175000017500000000141210604414450021320 0ustar tygrystygrys; ; Small C+ Compiler ; ; Long Support Library ; ; 1/3/99 djm ; This routine is used to push longs on the stack for a ; call to a function defined as a pointer. To make the ; routine shorter (by one byte) we could use ix - pop ix/jp(ix) ; but we'd lose 6T - give me your thoughts as to whether it's ; worth it... ; actually use of ix saves us 4T XLIB lpush2 .lpush2 pop ix pop bc push de push hl push bc jp (ix) ; exx ; pop hl ;save return address ; exx ; pop bc ;save next item on stack ; push de ;dump our long ; push hl ; push bc ;store back "next item on stack" ; exx ; jp (hl) z88dk-1.8.ds1/libsrc/z80_crt0s/crt0list0000644000175000017500000000261210605604632017210 0ustar tygrystygryscrt0/getarg crt0/htons crt0/l_and crt0/l_asl crt0/l_asr crt0/l_asr_u crt0/l_bcneg crt0/l_bool crt0/l_case crt0/l_cmp crt0/l_cm_bc crt0/l_cm_de crt0/l_com crt0/l_deneg crt0/l_div crt0/l_div_u crt0/l_eq crt0/l_gchar crt0/l_ge crt0/l_getptr crt0/l_gint crt0/l_gint_eq crt0/l_ghtonsint crt0/l_glong crt0/l_gt crt0/l_jphl crt0/l_jpix crt0/l_jpiy crt0/l_le crt0/l_lneg crt0/l_lt crt0/l_mul crt0/l_ne crt0/l_neg crt0/l_or crt0/l_pint crt0/l_pint_eq crt0/l_pint_pop crt0/l_pint_ex crt0/l_plong crt0/l_putptr crt0/l_setmem crt0/l_sub crt0/l_sxt crt0/l_ucmp crt0/l_uge crt0/l_ugt crt0/l_ule crt0/l_ult crt0/l_xor crt0_long/htonl crt0_long/int2long_s crt0_long/l_declong crt0_long/l_inclong crt0_long/l_long_add crt0_long/l_long_and crt0_long/l_long_asl crt0_long/l_long_aslo crt0_long/l_long_asr crt0_long/l_long_asr_u crt0_long/l_long_asr_uo crt0_long/l_long_asro crt0_long/l_long_bool crt0_long/l_long_case crt0_long/l_long_cmp crt0_long/l_long_com crt0_long/l_long_dec crt0_long/l_long_div crt0_long/l_long_div_u crt0_long/l_long_eq crt0_long/l_long_ge crt0_long/l_long_gt crt0_long/l_long_inc crt0_long/l_long_le crt0_long/l_long_lneg crt0_long/l_long_lt crt0_long/l_long_mult crt0_long/l_long_ne crt0_long/l_long_neg crt0_long/l_long_or crt0_long/l_long_sub crt0_long/l_long_ucmp crt0_long/l_long_uge crt0_long/l_long_ugt crt0_long/l_long_ule crt0_long/l_long_ult crt0_long/l_long_xor crt0_long/long2int_s crt0_long/lpush2 z88dk-1.8.ds1/libsrc/z80_crt0s/Makefile0000644000175000017500000000122610701140140017143 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../Make.config all: crt0s crtz80s183 crt0iy crt0s: @$(RM) crt0_long/l_long_case.o $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/z80_crt0 @crt0list # this one uses iy in place of ix crt0iy: $(MAKE) clean @$(RM) crt0_long/l_long_case.o $(LIBLINKER) -IXIY -DZ80S183 -x../$(OUTPUT_DIRECTORY)/z80iy_crt0 @crt0list $(MAKE) clean crtz80s183: @$(RM) crt0_long/l_long_case.o $(LIBLINKER) -DZ80S183 -x../$(OUTPUT_DIRECTORY)/z80s183_crt0 @crt0list clean: $(RM) crt0/*.o* crt0/*.sym crt0/*.map $(RM) crt0_long/*.o* crt0_long/*.sym crt0_long/*.map $(RM) z80_emu/*.o* z80_emu/*.sym z80_emu/*.map z88dk-1.8.ds1/libsrc/z80_crt0s/z80_emu/0000755000175000017500000000000010765202715017012 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/z80_crt0s/z80_emu/afswap.asm0000755000175000017500000000044410712572764021010 0ustar tygrystygrys; ; Replacement for "ex af,af" ; ; $Id: afswap.asm,v 1.1 2007/11/02 10:03:32 stefano Exp $: XLIB afswap .af1 defw 0 .afswap ;EX AF,AF' push hl push af ld hl,(af1) ex (sp),hl ld (af1),hl pop af pop hl retz88dk-1.8.ds1/libsrc/z80_crt0s/z80_emu/exxswap.asm0000755000175000017500000000071210712572764021224 0ustar tygrystygrys; ; Replacement for "exx" ; ; $Id: exxswap.asm,v 1.1 2007/11/02 10:03:32 stefano Exp $: XLIB exxswap .altregs defs 6 .exxswap push hl ld hl,(altregs) ex (sp),hl ld (altregs),hl push bc ld hl,(altregs+2) ex (sp),hl ld (altregs+2),hl pop bc push de ld hl,(altregs+4) ex (sp),hl ld (altregs+4),hl pop de pop hl retz88dk-1.8.ds1/libsrc/z80_crt0s/z80_emu/rcmx_cpd.asm0000644000175000017500000000060210635135654021314 0ustar tygrystygrys ; Substitute for z80 cpd instruction ; aralbrec 06.2007 XLIB rcmx_cpd .rcmx_cpd jr c, cpdwcarry cp (hl) dec hl dec bc push af ex (sp),hl res 0,l .rejoin set 2,l ld a,b or c jp nz, exitcpd res 2,l .exitcpd ex (sp),hl pop af ret .cpdwcarry cp (hl) dec hl dec bc push af ex (sp),hl set 0,l jp rejoin z88dk-1.8.ds1/libsrc/z80_crt0s/z80_emu/rcmx_cpdr.asm0000644000175000017500000000106510763610050021470 0ustar tygrystygrys ; Substitute for z80 cpdr instruction ; aralbrec 02.2008 ; flag-perfect emulation of cpdr XLIB rcmx_cpdr .rcmx_cpdr jr nc, enterloop call enterloop scf ret .loop dec hl .enterloop dec bc cp (hl) jr z, match inc c dec c jp nz, loop inc b djnz loop .nomatch cp (hl) dec hl push af .joinbc0 ex (sp),hl res 0,l res 2,l ex (sp),hl pop af ret .match dec hl push af ld a,b or c jr z, joinbc0 ex (sp),hl res 0,l set 2,l ex (sp),hl pop af ret z88dk-1.8.ds1/libsrc/z80_crt0s/z80_emu/rcmx_cpi.asm0000644000175000017500000000060210635135654021321 0ustar tygrystygrys ; Substitute for z80 cpi instruction ; aralbrec 06.2007 XLIB rcmx_cpi .rcmx_cpi jr c, cpiwcarry cp (hl) inc hl dec bc push af ex (sp),hl res 0,l .rejoin set 2,l ld a,b or c jp nz, exitcpi res 2,l .exitcpi ex (sp),hl pop af ret .cpiwcarry cp (hl) inc hl dec bc push af ex (sp),hl set 0,l jp rejoin z88dk-1.8.ds1/libsrc/z80_crt0s/z80_emu/rcmx_cpir.asm0000644000175000017500000000107010763610050021471 0ustar tygrystygrys ; Substitute for z80 cpir instruction ; aralbrec 02.2008 ; flag-perfect emulation of cpir XLIB rcmx_cpir .rcmx_cpir jr nc, enterloop call enterloop scf ret .loop inc hl .enterloop dec bc cp (hl) jr z, match inc c dec c jp nz, loop inc b djnz loop .nomatch cp (hl) inc hl push af .joinbc0 ex (sp),hl res 0,l res 2,l ex (sp),hl pop af ret .match inc hl push af ld a,b or c jr z, joinbc0 ex (sp),hl res 0,l set 2,l ex (sp),hl pop af ret z88dk-1.8.ds1/libsrc/z80_crt0s/z80_emu/rcmx_rld.asm0000644000175000017500000000056410635135654021336 0ustar tygrystygrys ; Substitute for z80 rld instruction ; aralbrec 06.2007 XLIB rcmx_rld .rcmx_rld jr nc, dorld call dorld scf ret .dorld rlca rlca rlca rlca ; a = bits 32107654 sla a rl (hl) adc a,0 rla rl (hl) adc a,0 rla rl (hl) adc a,0 rla rl (hl) adc a,0 or a ret z88dk-1.8.ds1/libsrc/z80_crt0s/z80_emu/rcmx_rrd.asm0000644000175000017500000000055610635135654021345 0ustar tygrystygrys ; Substitute for z80 rrd instruction ; aralbrec 06.2007 XLIB rcmx_rrd .rcmx_rrd jr nc, dorrd call dorrd scf ret .dorrd srl a rr (hl) rra rr (hl) rra rr (hl) rra rr (hl) ; a = [bits(HL):210, 0, bits(A):7654], carry = bit 3 of (HL) rra rra rra rra rra or a ret z88dk-1.8.ds1/libsrc/z88/0000755000175000017500000000000010765202715014420 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/z88/DeRegisterInt.c0000644000175000017500000000073307130401726017272 0ustar tygrystygrys/* * Deregister an interrupt * This is on an application basis (sorry!) * * Global is done on another basis...(so not * covered here) * * djm 9/2/2000 */ #include int DeRegisterInt(void) { #pragma asm INCLUDE "#packages.def" ; First of all check that package system is there call_pkg(pkg_ayt) ld hl,0 ;Failure ret c ;We failed ; Aha..we packages are there...good... ld a,int_prc call_pkg(pkg_intd) ld hl,1 ret nc ;Success dec hl #pragma endasm } z88dk-1.8.ds1/libsrc/z88/di.asm0000644000175000017500000000056407130401726015516 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Z88 Application functions ; ; *** Z88 SPECIFIC FUNCTION - probably no equiv for your machine! *** ; ; 11/4/99 ; ; Disable interruptes ; int di(void) XLIB di INCLUDE "#interrpt.def" .di call oz_di push af pop hl ret z88dk-1.8.ds1/libsrc/z88/ei.asm0000644000175000017500000000066407130401726015520 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Z88 Application functions ; ; *** Z88 SPECIFIC FUNCTION - probably no equiv for your machine! *** ; ; 11/4/99 ; ; Enable interrupts (used with di to get value) ; void ei(int) XLIB ei INCLUDE "#interrpt.def" .ei pop bc pop af push af push bc call oz_ei ret z88dk-1.8.ds1/libsrc/z88/exec_cli.c0000644000175000017500000000065407130401726016337 0ustar tygrystygrys/* * Execute a CLI string * * Now I've never ever used a CLI but someone out there * might have done... * * djm 22/3/2000 */ #include #include int exec_cli(char *str) { return (exec_cli_i(str,strlen(str))); } int exec_cli_i(char *str, size_t len) { #asm INCLUDE "#director.def" pop de pop bc pop hl push hl push bc push de call_oz(dc_icl) ld hl,0 ret nc dec hl ;-1 - FAIL #endasm } z88dk-1.8.ds1/libsrc/z88/fdstdio/0000755000175000017500000000000010765202715016054 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/z88/fdstdio/fchkhdl.c0000644000175000017500000000035607130401726017622 0ustar tygrystygrys/* * Check the file handle is okay... * * djm 25/1/2000 * * Used by fread/fwrite */ #include int fchkhdl(FILE *fp) { #asm LIB fhand_ck pop de push de call fhand_ck ld hl,0 ;failure... ret z inc hl #endasm } z88dk-1.8.ds1/libsrc/z88/fdstdio/fdfeof.asm0000644000175000017500000000160007130401726017777 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; 22 August 1998 ** UNTESTED ** ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; ; 11/3/99 Visited to fix, jp nz,feof_abort was jp z,feof_abort ; if we enter in with a std* stream then we exit with error ; INCLUDE "#fileio.def" XLIB fdfeof LIB fhand_ck ;*feof(fp) ;int fp ;on stack ;return address,fp ;fp file handle to query if at end of file .fdfeof ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) call fhand_ck jr nz,feof1 .feof_abort ld hl,-1 ;error! ret .feof1 push de pop ix ld a,fa_eof call_oz(os_frm) jp nz,feof_abort jp c,feof_abort ld hl,0 ret z88dk-1.8.ds1/libsrc/z88/fdstdio/fdfgetc.asm0000644000175000017500000000220307130401726020150 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; 22 August 1998 ** UNTESTED ** ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; ; 11/3/99 Fixed for stdin ; ; 22/3/2000 Now calls getchar() for stdin stuff instead of doing ; os_in itself INCLUDE "#fileio.def" INCLUDE "#stdio.def" INCLUDE "libdefs.def" XLIB fdfgetc LIB fgetc_cons LIB fhand_ck ;fgetc(fp) ;FILE *fp ;on stack ;return address,fp ;fp=filepointer ; ;fgetc - read byte from file - also handles stdin .fdfgetc ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ld a,d or e jp nz,fgetc1 .fgetc_abort ld hl,EOF ret .fgetc1 call fhand_ck jr nz,fgetc_file ld hl,stdin and a sbc hl,de jp nz,fgetc_abort jp fgetc_cons .fgetc_file push de pop ix call_oz(os_gb) jp c,fgetc_abort ld l,a ld h,0 ret z88dk-1.8.ds1/libsrc/z88/fdstdio/fdfgets.asm0000644000175000017500000000630307130401726020175 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; 22 August 1998 ** UNTESTED ** ; ; 11/3/99 Revised to allow input from stdin ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** INCLUDE "#fileio.def" INCLUDE "#stdio.def" INCLUDE "libdefs.def" XLIB fdfgets XREF processcmd ;char *fgets(s1,n,fp) ;char s1 int n int fp ;on stack ;return address,fp,n,s1 ;s1 = buffer, n=bytes to read, fp=filepointer ; ;fgets - read bytes from file.. ;these routines should check for stdin/out/err .fdfgets ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ld a,d or e jr nz,fgets1 .fgets_abort ld hl,0 ;reply null for EOF ret .fgets1 ; Check for stdin etc ld hl,stdout and a sbc hl,de jr z,fgets_abort ld hl,stderr and a sbc hl,de jr z,fgets_abort ld hl,stdin and a sbc hl,de jp z,fdgets_cons push de pop ix ld hl,4 add hl,sp ld c,(hl) inc hl ld b,(hl) ;number of bytes to read ld a,c or b jr z,fgets_abort ;none required inc hl ;step up to buffer ld a,(hl) inc hl ld h,(hl) ld l,a ;our buffer .fgets2 call_oz(os_gb) jr c,fgets_abort dec bc ;This isn't strictly ansi, but it don't 'alf help the z88! cp 13 jr z,fgets_endrd cp 10 jr z,fgets_endrd ld (hl),a inc hl ld a,b or c jp nz,fgets2 .fgets_endrd ld (hl),0 ;terminate string .fgets_endrd1 pop bc pop hl ;get s1 back push hl push bc ret ; ; Read a string from the console ; .fdgets_cons ld hl,4 add hl,sp ld b,(hl) inc hl ld c,(hl) ;number of bytes to read ld a,c or b jr z,fgets_abort ;none required inc hl ;step up to buffer ld e,(hl) ;buffer inc hl ld d,(hl) ld c,0 ;cursor position ld a,8 ;allow return of ctrl chars push de ;preserve buffer call_oz(gn_sip) pop hl push af cp $80 jr nc,fgets_gotcmd ; trapped a cmd pop af jr nc,fgets_stripeol jr fgets_abort ; return hl=0 - error .fgets_gotcmd pop af call processcmd jr fgets_abort ; return NULL .fgets_stripeol cp 13 ;terminating char jr nz,fgets_endrd1 dec hl ld c,b ld b,0 add hl,bc jr fgets_endrd ;normal exit, with null z88dk-1.8.ds1/libsrc/z88/fdstdio/fdfputc.asm0000644000175000017500000000306207130401726020205 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; 22 August 1998 ** UNTESTED ** ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; ; 11/3/99 djm - revised INCLUDE "#fileio.def" INCLUDE "#stdio.def" INCLUDE "libdefs.def" XLIB fdfputc ;*fputc(n,fp) ;int n int fp ;on stack ;return address,fp,n ;n=byte to write, fp=filepointer ; ;fputc - put byte to file, should return written byte/EOF if error ; If we come across a \n for stdout/err we call gn_nln .fdfputc ld hl,2 add hl,sp ld e,(hl) ;filehandle inc hl ld d,(hl) inc hl ld c,(hl) ;byte to put ld a,d or e jr nz,fputc1 .fputc_abort ld hl,EOF ret .fputc1 ld hl,stdout and a sbc hl,de jr z,fdputc_cons ld hl,stdin and a sbc hl,de jr z,fputc_abort ld hl,stderr and a sbc hl,de jr nz,fputc_file ;Output to stdin/out here .fdputc_cons ld a,c cp 13 jr nz,fputc_cons1 call_oz(gn_nln) ld hl,13 ret .fputc_cons1 call_oz(os_out) ld l,c ld h,0 ret .fputc_file push de pop ix ld a,c call_oz(os_pb) jr c,fputc_abort ld l,c ld h,0 ret z88dk-1.8.ds1/libsrc/z88/fdstdio/fdfputs.asm0000644000175000017500000000262007130401726020224 0ustar tygrystygrys; ; Small C z88 File functions ; Written by Dominic Morris ; 22 August 1998 ** UNTESTED ** ; ; *** THIS IS A Z88 SPECIFIC ROUTINE!!! *** ; ; Few little bugs sorted out 13/10/98 INCLUDE "#fileio.def" INCLUDE "#stdio.def" INCLUDE "libdefs.def" XLIB fdfputs LIB putconsole ;*fputs(s1,fp) ;char s1 int fp ;on stack ;return address,fp,s1 ;s1 = buffer, fp=filepointer ; ;fputs - read bytes from file.. ;these routines should check for stdin/out/err .fdfputs ld hl,2 add hl,sp ld e,(hl) inc hl ld d,(hl) ld a,d or e jp nz,fputs1 .fputs_abort ld hl,0 ;there is no return value really.. ret .fputs1 inc hl ld c,(hl) inc hl ld b,(hl) ;bc=out buffer ld hl,stdout and a sbc hl,de jr z,fputs_cons ld hl,stderr and a sbc hl,de jr nz,fputs_file .fputs_cons ld l,c ld h,b xor a jp putconsole .fputs_file push de pop ix .fputs_file1 ld a,(bc) and a ret z call_oz(os_pb) inc bc jp fputs_file1 z88dk-1.8.ds1/libsrc/z88/fdstdio/fdfread.c0000644000175000017500000000063607130401726017613 0ustar tygrystygrys/* * Z88 stdio library * * fread(void *ptr,size_t size,size_t numb); * * djm 25/1/2000 * * This is a major fudge and plays on the inept library * for i/o of z88dk */ #define FDSTDIO #include #include #include int fdfread(void *ptr, int size, int num, FILE *fp) { if (fchkhdl(fp)) return (read((int)fp,ptr,size*num)); /* fchkhdl exits with hl=0 for bad handle.. */ } z88dk-1.8.ds1/libsrc/z88/fdstdio/fdfwrite.c0000644000175000017500000000064007130401726020025 0ustar tygrystygrys/* * Z88 stdio library * * fread(void *ptr,size_t size,size_t numb); * * djm 25/1/2000 * * This is a major fudge and plays on the inept library * for i/o of z88dk */ #define FDSTDIO #include #include #include int fdfwrite(void *ptr, int size, int num, FILE *fp) { if (fchkhdl(fp)) return (write((int)fp,ptr,size*num)); /* fchkhdl exits with hl=0 for bad handle.. */ } z88dk-1.8.ds1/libsrc/z88/fdstdio/fdprintn.c0000644000175000017500000000110307247713302020037 0ustar tygrystygrys/* * Small C+ Runtime Library * * printn(int number, int radix, FILE *file) * * Liberated from an unknown source * * Added to z88dk archive 11/4/99 djm */ #define FDSTDIO #include unsigned char dig[]= "0123456789ABCDEF"; fdprintn(int number, int radix,FILE *file) { int i; if (number < 0 && radix == 10){ fputc('-', file); number = -number; } if ((i = number / radix) != 0) printn(i, radix, file); fputc(dig[number % radix], file); } z88dk-1.8.ds1/libsrc/z88/fdstdio/fdputs.asm0000644000175000017500000000066107130401726020061 0ustar tygrystygrys;Z88 Small C Library functions, linked using the z80 module assembler ;Small C Z88 converted by Dominic Morris INCLUDE "#stdio.def" XLIB fdputs ;Print string LIB putconsole .fdputs pop de ;return address pop hl ;address of string.. push hl push de ld a,1 jp putconsole z88dk-1.8.ds1/libsrc/z88/fdstdio/fhand_ck.asm0000644000175000017500000000104207130401726020303 0ustar tygrystygrys; ; Small C+ Library Functions ; ; djm 11/3/99 ; ; Check whether a file handle is null or std* ; If so ret with z=1 INCLUDE "libdefs.def" XLIB fhand_ck ;Entry: de=handle .fhand_ck ld a,d or e ret z ld hl,stdin and a sbc hl,de ret z ld hl,stdout and a sbc hl,de ret z ld hl,stderr and a sbc hl,de ret z88dk-1.8.ds1/libsrc/z88/fdstdio/Makefile0000644000175000017500000000063510763610052017513 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.6 2008/03/05 20:35:48 dom Exp $ include ../../Make.config CFILES = \ fchkhdl.c \ fdfread.c \ fdfwrite.c \ fdprintn.c \ zfdopen.c \ zfdopen_z88.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: fdstdio fdstdio: $(OBJECTS) .c.o: zcc +z88 $(CFLAGS) $*.c clean: $(RM) *.o* *.sym *.map zcc_opt.def *.i $(AFILES) z88dk-1.8.ds1/libsrc/z88/fdstdio/putcons.asm0000644000175000017500000000151407130401726020245 0ustar tygrystygrys; ; Small C+ Z88 Internal Routine ; Puts a string to the console - mapping \n to \n\l as we ; go and appending \n\l to the end of the line ; ; Called by puts and fputs - near routine!! ; ; djm 2/4/99 INCLUDE "#stdio.def" XLIB putconsole ;Entry: hl=string, a print nl at end or not (0=no) .putconsole push af .putconsole0 ld a,(hl) and a jr z,putconsole_out push hl cp 13 jr z,putconsole_nl call_oz(os_out) .putconsole_lp pop hl inc hl jr putconsole0 .putconsole_out pop af and a ret z call_oz(gn_nln) ret .putconsole_nl call_oz(gn_nln) jr putconsole_lp z88dk-1.8.ds1/libsrc/z88/fdstdio/putn.asm0000644000175000017500000000223207130401726017536 0ustar tygrystygrys;Z88 Small C Library functions, linked using the z80 module assembler ;Small C Z88 converted by Dominic Morris INCLUDE "#stdio.def" XLIB putn ;Display integer ;Display an integer on screen.. .putn ld hl,2 add hl,sp ld a,(hl) inc hl ld h,(hl) ld l,a ;Now, our kludgy number print.. ld b,254 ld de,10000 call numcal ld de,1000 call numcal ld de,100 call numcal ld de,10 call numcal ld de,1 ld b,0 ;b=0 print norm, b=255 do space ;b=254 don't print .numcal ld a,255 .numca1 inc a and a sbc hl,de jr nc,numca1 add hl,de and a jr z,numca2 ld b,0 .numca2 add a,48 ld c,a ld a,b and a jr z,numca3 inc a ret nz ld c,32 .numca3 ld a,c call_oz(os_out) ret z88dk-1.8.ds1/libsrc/z88/fdstdio/settxy.asm0000644000175000017500000000114407130401726020111 0ustar tygrystygrys;Z88 Small C Library functions, linked using the z80 module assembler ;Small C Z88 converted by Dominic Morris INCLUDE "#stdio.def" XLIB setxy ;Set xy position in window .setxy ld hl,2 add hl,sp ld a,1 call_oz(os_out) ld a,'3' call_oz(os_out) ld a,'@' call_oz(os_out) ld a,(hl) add a,32 call_oz(os_out) ld hl,4 add hl,sp ld a,(hl) add a,32 call_oz(os_out) ret z88dk-1.8.ds1/libsrc/z88/fdstdio/zfdopen.c0000644000175000017500000000051607130401726017662 0ustar tygrystygrys/* * Open a file (stdio library) calls fopen_z88 to do * the dirty work * * Only hands r,w,a types (no modifiers) * * djm 24/3/2000 */ #define FDSTDIO #include #include FILE *zfdopen(far char *name, char *mode) { char buffer[10]; /* Temporary buffer */ return (zfdopen_z88(name,mode,buffer,8)); } z88dk-1.8.ds1/libsrc/z88/fdstdio/zfdopen_z88.c0000644000175000017500000000112707130401726020372 0ustar tygrystygrys/* * Open a file (stdio library) returning the explicit * filename * * Only hands r,w,a types (no modifiers) * * djm 24/3/2000 */ #define FDSTDIO #include #include FILE *zfdopen_z88(far char *name, char *mode, char *explicit, size_t len) { int access; switch ((unsigned char )*mode) { case 'r': access=O_RDONLY; break; case 'w': access=O_WRONLY; break; case 'a': access=O_APPEND; break; default: return (FILE *)NULL; } { int fd=open_z88(name,access,0,explicit,len); if (fd == - 1 ) return (FILE *)NULL; return (FILE *)fd; } } z88dk-1.8.ds1/libsrc/z88/fnexpand.c0000644000175000017500000000102507460223637016371 0ustar tygrystygrys/* * Open a wild char handler * * djm 22/3/2000 * */ #include char *fnexpand(far char *string, char *buffer, size_t size) { #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld l,(ix+6) ;filename ld h,(ix+7) ld e,(ix+8) ld d,0 push de push hl call _cpfar2near ;get it to near spec ld b,0 ;local ld e,(ix+4) ;where to put it ld d,(ix+5) ld c,(ix+2) ;max size call_oz(gn_fex) ld hl,0 ;NULL - error ret c xor a ;terminate just in case ld (de),a ld l,(ix+4) ;where we expanded it to ld h,(ix+5) #endasm } z88dk-1.8.ds1/libsrc/z88/freescr.asm0000644000175000017500000000106407130401726016547 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Z88 Application functions ; ; *** Z88 SPECIFIC FUNCTION - probably no equiv for your machine! *** ; ; 11/4/99 ; ; Save User Screen ; ; int freescr(int handle) ; ; Returns 0 on failure, or 1 on success XLIB freescr INCLUDE "#saverst.def" .freescr pop bc pop ix push ix push bc ld a,SR_FUS call_oz(os_sr) ld hl,0 ret c ld hl,1 ret z88dk-1.8.ds1/libsrc/z88/getpid.c0000644000175000017500000000050407130401726016032 0ustar tygrystygrys/* * Get process PID * * Uses the package system * * djm 9/12/99 * Returns -1 on failure */ #include pid_t getpid(void) { #pragma asm INCLUDE "#packages.def" call_pkg(pkg_ayt) ld hl,-1 ;failure ret c ;failed call_pkg(pkg_pid) ;always succeeds ld l,a ;pkg_pid returns in a ld h,0 #pragma endasm } z88dk-1.8.ds1/libsrc/z88/libdefs.def0000644000175000017500000000026207130401726016503 0ustar tygrystygrys; A few definitions for the fdstdio routines ; defc EOF = -1 defc STDERR = -10 defc STDIN = -11 defc STDOUT = -12 z88dk-1.8.ds1/libsrc/z88/Makefile0000644000175000017500000000124610763610051016055 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # # $Id: Makefile,v 1.15 2008/03/05 20:35:48 dom Exp $ include ../Make.config CFILES = \ DeRegisterInt.c \ exec_cli.c \ fnexpand.c \ getpid.c \ nameapp.c \ openpopup.c \ opentitled.c \ openwindow.c \ QueryPackage.c \ RegisterInt.c \ stripdev.c \ strippath.c \ wcclose.c \ wcnext.c \ wcopen.c \ AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: blah z88 blah: cd fdstdio ; $(MAKE) ; cd .. z88: $(OBJECTS) $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/z88 @z88list .c.o: zcc +z88 $(CFLAGS) $*.c clean: $(RM) *.obj *.sym *.map *.o* *~ zcc_opt.def *.i $(AFILES) cd fdstdio ; $(MAKE) clean ; cd .. z88dk-1.8.ds1/libsrc/z88/nameapp.c0000644000175000017500000000025407130401726016201 0ustar tygrystygrys/* * Name a z88 application */ #include void nameapp(char *name) { #asm INCLUDE "#director.def" pop bc pop hl push hl push bc call_oz(dc_nam) #endasm } z88dk-1.8.ds1/libsrc/z88/openpopup.c0000644000175000017500000000235610445264560016620 0ustar tygrystygrys /* * Open a popup window * * GWL 26/3/00 */ #include static char winbot[] = "\x012-S\x012Y"; /* Move to window bottom string */ static char winlin[] = "\x012*I\x013N"; /* Bottom line string */ static char wincrn[] = "\0x5\0x1\2*L"; /* br corner string */ #if 0 #asm ._winbot defm 1&"2-S"&1&"2Y"&0 ; move to window bottom string ._winlin defm 1&"2*I"&1&"3N"&0 ; bottom line string ._wincrn defm 5&1&"2*L"&0 ; br corner string #endasm #endif void openpopup(int wid,int tlx,int tly,int width,int height,char *name) { #asm LIB opwin include "#stdio.def" ld ix,2 ; IX points to name add ix,sp dec (ix+6) ; decrement start row dec (ix+8) ; & left inc (ix+2) ; inc height twice (top/bottom) inc (ix+2) inc (ix+4) inc (ix+4) ld b,128 call opwin ; open window with nothing inc (ix+6) ; restore parameters inc (ix+8) dec (ix+2) dec (ix+2) dec (ix+4) dec (ix+4) ld hl,_winbot call_oz(gn_sop) ld a,(ix+2) add a,$20 call_oz(os_out) ; move to last row ld hl,_winlin call_oz(gn_sop) ; bottom line string ld a,(ix+4) add a,$20 call_oz(os_out) ; for width of window ld hl,_wincrn call_oz(gn_sop) ; bottom right corner string dec (ix+2) ; reduce height jp opentitled ; continue, with titled version #endasm } z88dk-1.8.ds1/libsrc/z88/opentitled.c0000644000175000017500000000153610445264560016741 0ustar tygrystygrys /* * Open a titled window * * GWL 26/3/00 */ #include #if 0 #asm ..winban defm 1&"4+TUR"&1&"2JC"&0 ; banner setup string ._winapl defm 1&"3@ "&1&"2A"&0 ; apply effects string #endasm #else static char winban[] = "\x014+TUR\x012JC"; static char winapl[] = "\x013@ \x012A"; #endif void opentitled(int wid,int tlx,int tly,int width,int height,char *name) { #asm include "#stdio.def" LIB opwin ld ix,2 ; IX points to name add ix,sp ld b,131 ; with shelf brackets call opwin ld hl,_winban call_oz(gn_sop) ; banner setup string ld l,(ix+0) ld h,(ix+1) call_oz(gn_sop) ; display title ld hl,_winapl call_oz(gn_sop) ; apply effects ld a,(ix+4) add a,'0' call_oz(os_out) ; across whole width inc (ix+6) ; increment start row dec (ix+2) ; decrement height ld b,129 ; left/right bars only call opwin ; re-define #endasm } z88dk-1.8.ds1/libsrc/z88/openwindow.c0000644000175000017500000000037007130401726016750 0ustar tygrystygrys /* * Open a plain (left & right bars only) window * * GWL 26/3/00 */ #include void openwindow(int wid,int tlx,int tly,int width,int height) { #asm LIB opwin ld ix,0 add ix,sp ld b,129 ; left & right bars call opwin #endasm } z88dk-1.8.ds1/libsrc/z88/opwin.asm0000644000175000017500000000141510445303314016247 0ustar tygrystygrys; Internal library routine for openwindow, opentitled & openpopup ; 26/3/00 GWL XLIB opwin include "#stdio.def" .opwin ld hl,windef call_oz(gn_sop) ld a,(ix+10) ; window ID add a,'0' call_oz(os_out) ld a,(ix+8) ; tlx add a,$20 call_oz(os_out) ld a,(ix+6) ; tly add a,$20 call_oz(os_out) ld a,(ix+4) ; width add a,$20 call_oz(os_out) ld a,(ix+2) ; height add a,$20 call_oz(os_out) ld a,b ; type call_oz(os_out) ld hl,winclr call_oz(gn_sop) ld a,(ix+10) add a,'0' call_oz(os_out) ; clear & select window ld hl,winmod call_oz(gn_sop) ; set default modes ret .windef defb 1 ;wndow definer defm "7#" defb 0 .winclr defb 1 ;window clear + reset modes defm "2C" defb 0 .winmod defb 1 ;set default modes (cursor + scroll) defm "3+CS" defb 0 z88dk-1.8.ds1/libsrc/z88/pagewait.asm0000644000175000017500000000107407130401726016720 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Z88 Application functions ; ; *** Z88 SPECIFIC FUNCTION - probably no equiv for your machine! *** ; ; 11/4/99 ; ; Page wait routine ; ; int pagewait(void) ; ; Returns with key pressed XLIB pagewait INCLUDE "#saverst.def" .pagewait ld a,SR_pwt call_oz(os_sr) ld l,a ld h,0 ret nc dec a ; rc.esc ld hl,-1 ret z inc hl ret z88dk-1.8.ds1/libsrc/z88/QueryPackage.c0000644000175000017500000000224107130401726017137 0ustar tygrystygrys/* * Open a package for use by the application * * Supply 0 to check package handling is installed * * djm 12/1/2000 */ #include bool_t QueryPackage(char which, char major,char minor) { #pragma asm INCLUDE "#packages.def" call_pkg(pkg_ayt) jr c,openfail ld hl,6 add hl,sp ;points to library number ld a,(hl) ld c,a and a ;0=just check packages jr z,opensuc ;bc holds library, c holds code, so load b with ayt ld b,$2 ;ayt push bc ;keep bc for later push bc pop iy rst 16 ;call package thru iy pop iy ;get bc back into iy jr c,openfail ; Check to see if we need to check the version ; If we or the two together and end up with 0 then we were ; given 0,0 i.e. any will do ld hl,4 add hl,sp ld a,(hl) ;major dec hl dec hl or (hl) ;minor jr z,opensuc ; Now check the version ld iyh,$0 ;inf rst 16 ;version in de ld hl,4 add hl,sp ;points to major required ld a,(hl) cp d jr c,openfail ;major < required jr z,ckminor ;major = required .opensuc ld hl,1 ;success and a ret .ckminor dec hl dec hl ;points to minor required ld a,(hl) cp e ;package minor jr nc,opensuc .openfail ld hl,0 scf #endasm } /* End of file */ z88dk-1.8.ds1/libsrc/z88/readmail.asm0000644000175000017500000000166607130401726016704 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Z88 Application functions ; ; *** Z88 SPECIFIC FUNCTION - probably no equiv for your machine! *** ; ; 11/4/99 ; ; Read Mail ; ; int readmail(char *type, char *info, int length) ; ; Returns 0 on failure, 1 on success XLIB readmail INCLUDE "#saverst.def" .readmail ld hl,2 add hl,sp ;point to length parameter ld c,(hl) inc hl inc hl ld e,(hl) inc hl ld d,(hl) ; lower 16 of info ld b,0 ; we keep it local (near) inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl holds name of info type ex de,hl ; get parameters the right way round ld a,SR_RPD call_oz(os_sr) ld hl,0 ret c inc hl ret z88dk-1.8.ds1/libsrc/z88/README0000644000175000017500000000045407130401726015276 0ustar tygrystygrysThis directory contains routines which are z88 specific and probably have no equivalent on other machines. It's an odd rag-tag bunch of things including: - Application stuff (Mailboxing, screen restore etc) - Package stuff (interrupts/PIDs) - Window stuff (Nice stuff from GWL) - Wildcard handling z88dk-1.8.ds1/libsrc/z88/RegisterInt.c0000644000175000017500000000153307130401726017020 0ustar tygrystygrys/* * Register an interrupt * This is on an application basis (sorry!) * * Global is done on another basis... * * djm 9/2/2000 */ #include int RegisterInt(func,type,tick) void (*func)(); char type; char tick; { #pragma asm INCLUDE "#packages.def" ; First of all check that package system is there call_pkg(pkg_ayt) ld hl,0 ;Failure ret c ;We failed ; Aha..we packages are there...good... ; So..set us up.. ld ix,0 ;offset to func add ix,sp ld e,(ix+6) inc hl ld d,(ix+7) ld (packintrout),de ld c,(ix+2) ;tick ld b,(ix+4) ;type ld hl,introut ld a,int_prc call_pkg(pkg_intr) ld hl,1 ret nc ;Success dec hl ret ; Out interrupt routine..we preserve main registers .introut push hl push de push bc push ix push iy ld hl,(packintrout) call l_dcal ;jp (hl) pop iy pop ix pop bc pop de pop hl ret #pragma endasm } z88dk-1.8.ds1/libsrc/z88/restscr.asm0000644000175000017500000000106407130401726016603 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Z88 Application functions ; ; *** Z88 SPECIFIC FUNCTION - probably no equiv for your machine! *** ; ; 11/4/99 ; ; Save User Screen ; ; int restscr(int handle) ; ; Returns 0 on failure, or 1 on success XLIB restscr INCLUDE "#saverst.def" .restscr pop bc pop ix push ix push bc ld a,SR_RUS call_oz(os_sr) ld hl,0 ret c ld hl,1 ret z88dk-1.8.ds1/libsrc/z88/savescr.asm0000644000175000017500000000077007130401726016567 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Z88 Application functions ; ; *** Z88 SPECIFIC FUNCTION - probably no equiv for your machine! *** ; ; 11/4/99 ; ; Save User Screen ; ; int savescr(void) ; ; Returns 0 on failure, or handle on success XLIB savescr INCLUDE "#saverst.def" .savescr ld a,SR_SUS call_oz(os_sr) ld hl,0 ret c push ix pop hl ret z88dk-1.8.ds1/libsrc/z88/sendmail.asm0000644000175000017500000000170207130401726016711 0ustar tygrystygrys; ; Small C+ Runtime Library ; ; Z88 Application functions ; ; *** Z88 SPECIFIC FUNCTION - probably no equiv for your machine! *** ; ; 11/4/99 ; ; Send Mail ; ; int sendmail(char *type, char *info, int length) ; ; Returns 0 on failure, number of bytes present on success XLIB sendmail INCLUDE "#saverst.def" .sendmail ld hl,2 add hl,sp ;point to length parameter ld c,(hl) inc hl inc hl ld e,(hl) inc hl ld d,(hl) ; lower 16 of info ld b,0 ; keep it near inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ; hl holds name of info type ex de,hl ; get parameters the right way round ld a,SR_WPD call_oz(os_sr) ld hl,0 ret c ld l,c ret z88dk-1.8.ds1/libsrc/z88/stripdev.c0000644000175000017500000000064307130401726016422 0ustar tygrystygrys /* * Strip device from filespec * * GWL 26/3/00 */ #include char *stripdev(char *fspec) { #asm pop bc pop hl ; fspec push hl push bc ld a,(hl) inc hl cp ':' jr nz,nostrip ; exit with original pointer if no device .skipdev ld a,(hl) inc hl cp '/' ret z ; exit if first segment finished cp $5c ret z ; ditto and a jr nz,skipdev .nostrip dec hl ; if end, backup to terminator #endasm } z88dk-1.8.ds1/libsrc/z88/strippath.c0000644000175000017500000000060507130401726016576 0ustar tygrystygrys /* * Strip path from filespec * * GWL 26/3/00 */ #include char *strippath(char *fspec) { #asm pop bc pop hl ; fspec push hl push bc .newseg ld d,h ; DE=current segment start ld e,l .findseg ld a,(hl) inc hl cp '/' jr z,newseg ; back to save next segment start cp $5c jr z,newseg ; ditto and a jr nz,findseg ex de,hl ; HL=pointer to final segment #endasm } z88dk-1.8.ds1/libsrc/z88/unused/0000755000175000017500000000000010765202715015723 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/z88/unused/parsename.c0000644000175000017500000000077007130401726020041 0ustar tygrystygrys/* * Parse a filename * * djm 22/3/2000 */ #include int parsefile(far char *name, wildcard_t *st) { #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld e,(ix+2) ;st ld d,(ix+3) ld l,(ix+4) ;name ld h,(ix+5) ld b,(ix+6) call_oz(gn_prs) ld hl,-1 ret c ex de,hl ex af,af ;keep flags safe ld a,l or l jr z,getout ld (hl),0 ;endptr inc hl ld (hl),0 inc hl ld (hl),b ;segments inc hl ld (hl),c ;length inc hl ld (hl),0 ;DOR .getout ex af,af ld l,a ld h,0 #endasm } z88dk-1.8.ds1/libsrc/z88/unused/parseseg.c0000644000175000017500000000103307130401726017670 0ustar tygrystygrys/* * Parse a filename segment * * djm 22/3/2000 */ #include int parseseg(far char *seg, far char **end) { /* NB far char * is 3 bytes, far char ** is two */ #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld l,(ix+4) ;seg ld h,(ix+5) ld b,(ix+6) call_oz(gn_pfs) ld hl,-1 ret c ex af,af ;keep it safe ex de,hl ld l,(ix+2) ;**end (i.e. address of &end) ld h,(ix+3) ld a,l or l jr z,getout ld (hl),e ;keep end inc hl ld (hl),d inc hl ld (hl),b .getout ex af,af ;get it back ld l,a ld h,0 #endasm } z88dk-1.8.ds1/libsrc/z88/unused/README0000644000175000017500000000006207130401726016574 0ustar tygrystygrysThese routines are unused for one reason or other z88dk-1.8.ds1/libsrc/z88/wcclose.c0000644000175000017500000000037507130401726016223 0ustar tygrystygrys /* * Close a wild card handler * * djm 22/3/2000 */ #include int wcclose(wild_t handle) { #asm INCLUDE "#fileio.def" pop bc pop ix ;handle push ix push bc call_oz(gn_wcl) ld hl,0 ;closed okay ret nc dec hl ;-1 if error #endasm } z88dk-1.8.ds1/libsrc/z88/wcnext.c0000644000175000017500000000134307130401726016070 0ustar tygrystygrys/* * Read the next match for wildcard string * * djm 22/2/2000 */ #include int wcnext(wild_t handle, void *buffer, size_t len, wildcard_t *wst) { #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld c,(ix+4) ;len ld e,(ix+6) ;buffer ld d,(ix+7) ld l,(ix+8) ;handle ld h,(ix+9) push ix ;keep ix safe push hl pop ix call_oz(gn_wfn) pop ix ld hl,-1 ;EOF ret c ;error ex af,af ;keep af safe ld l,(ix+2) ld h,(ix+3) ld a,l or l ret z ;okay! no buffer ex af,af ;get it back push hl ld (hl),e ;last char of explicit name inc hl ld (hl),d inc hl ld (hl),b ;segments in explicit filename inc hl ld (hl),c ;chars in explicit filename inc hl ld (hl),a ;DOR type ld hl,0 ;o error #endasm } z88dk-1.8.ds1/libsrc/z88/wcopen.c0000644000175000017500000000062507130401726016055 0ustar tygrystygrys/* * Open a wild char handler * * djm 22/3/2000 * */ #include wild_t wcopen(far char *string, int mode) { #asm INCLUDE "#fileio.def" ld ix,0 add ix,sp ld l,(ix+4) ld h,(ix+5) ld e,(ix+6) ld d,0 push de push hl call _cpfar2near ;get it to near spec ld b,0 ;local ld a,(ix+2) ;mode and @00000011 call_oz(gn_opw) ld hl,0 ;NULL - error ret c push ix ;handle pop hl #endasm } z88dk-1.8.ds1/libsrc/z88/z88list0000644000175000017500000000072107457364562015705 0ustar tygrystygrysdi ei freescr readmail restscr savescr sendmail pagewait RegisterInt DeRegisterInt QueryPackage getpid nameapp wcopen wcnext wcclose exec_cli openwindow openpopup opentitled stripdev strippath opwin fdstdio/fchkhdl fdstdio/fdfeof fdstdio/fdfgetc fdstdio/fdfgets fdstdio/zfdopen fdstdio/zfdopen_z88 fdstdio/fdfputc fdstdio/fdfread fdstdio/fdfwrite fdstdio/fhand_ck fdstdio/fdprintn fdstdio/fdputs fdstdio/fdfputs fdstdio/putcons fdstdio/putn fdstdio/settxy fnexpand z88dk-1.8.ds1/libsrc/z88.lst0000644000175000017500000000176110763607602015153 0ustar tygrystygrysstdio/z88/fgetc_cons stdio/z88/fgets_cons stdio/z88/fputc_cons stdio/z88/getcmd stdio/z88/getk stdio/z88/gets stdio/z88/puts_cons fcntl/z88/fdgetpos fcntl/z88/fdtell fcntl/z88/rename fcntl/z88/remove fcntl/z88/open fcntl/z88/open_z88 fcntl/z88/close fcntl/z88/lseek fcntl/z88/read fcntl/z88/creat fcntl/z88/write fcntl/z88/readbyte fcntl/z88/writebyte fcntl/z88/stat fcntl/z88/opendor fcntl/z88/closedor fcntl/z88/readdor fcntl/z88/writedor fcntl/z88/deletedor fcntl/z88/sondor fcntl/z88/brotherdor stdlib/z88/atol stdlib/z88/getcwd stdlib/z88/mkdir stdlib/z88/sleep stdlib/z88/csleep time/gmtime time/localtime time/z88/clock time/z88/time games/joystick games/z88/bit_open games/z88/bit_open_di games/z88/bit_close games/z88/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/z88/beeper rs232/z88/rs232_close rs232/z88/rs232_get rs232/z88/rs232_init rs232/z88/rs232_params rs232/z88/rs232_put @z80.lst z88dk-1.8.ds1/libsrc/z88ansi.lst0000644000175000017500000000235510763607602016026 0ustar tygrystygrysstdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/z88/f_ansi_attr stdio/ansi/z88/f_ansi_bel stdio/ansi/z88/f_ansi_char stdio/ansi/z88/f_ansi_cls stdio/ansi/z88/f_ansi_dline stdio/ansi/z88/f_ansi_scrollup stdio/z88/fgetc_cons stdio/z88/fgets_cons stdio/z88/getcmd stdio/z88/getk stdio/z88/gets fcntl/z88/fdgetpos fcntl/z88/fdtell fcntl/z88/rename fcntl/z88/remove fcntl/z88/open fcntl/z88/open_z88 fcntl/z88/close fcntl/z88/lseek fcntl/z88/read fcntl/z88/creat fcntl/z88/write fcntl/z88/readbyte fcntl/z88/writebyte fcntl/z88/stat fcntl/z88/opendor fcntl/z88/closedor fcntl/z88/readdor fcntl/z88/writedor fcntl/z88/deletedor fcntl/z88/sondor fcntl/z88/brotherdor stdlib/z88/atol stdlib/z88/getcwd stdlib/z88/mkdir stdlib/z88/sleep stdlib/z88/csleep time/gmtime time/localtime time/z88/clock time/z88/time games/joystick games/z88/bit_open games/z88/bit_open_di games/z88/bit_close games/z88/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/z88/beeper rs232/z88/rs232_close rs232/z88/rs232_get rs232/z88/rs232_init rs232/z88/rs232_params rs232/z88/rs232_put @z80.lst z88dk-1.8.ds1/libsrc/z88gfx.lst0000644000175000017500000000116510665252466015663 0ustar tygrystygrysgraphics/circle graphics/clg graphics/clga graphics/z88/clrarea graphics/clsgraph graphics/closegfx graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/z88/pixladdr graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/z88/swapgfxbk graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/window graphics/drawbox graphics/setxy graphics/xorborder graphics/xorpixl graphics/xorplot printflike/ltoa_any z88dk-1.8.ds1/libsrc/z88math/0000755000175000017500000000000010765202715015272 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/z88math/acos.asm0000644000175000017500000000052007423075667016731 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double acos(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB acos LIB fsetup LIb stkequ2 .acos call fsetup fpp(FP_ACS) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/amax.asm0000644000175000017500000000170207423075667016735 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double amin(double x,double y) ;y is in the FA ;x is on the stack +8 (+2=y) ; ;returns the larger of x and y INCLUDE "#fpp.def" XLIB amax LIB fsetup LIB stkequ2 XREF fa .amax ld ix,8 add ix,sp ld l,(ix+1) ld h,(ix+2) ld de,(fa+1) exx ;main set ld c,(ix+5) ld l,(ix+3) ld h,(ix+4) ld de,(fa+3) ld a,(fa+5) ld b,a push ix fpp(FP_CMP) ;sets: de=y hl=x pop ix ret p ;de > hl, so okay.. ld l,(ix+1) ld h,(ix+2) exx ld c,(ix+5) ld l,(ix+3) ld h,(ix+4) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/amin.asm0000644000175000017500000000177407423075667016744 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double amin(double x,double y) ;y is in the FA ;x is on the stack +8 (+2=y) ; ;returns the smaller of x and y INCLUDE "#fpp.def" XLIB amin LIB fsetup lIB stkequ2 XREF fa .amin ld ix,8 add ix,sp ld l,(ix+1) ld h,(ix+2) ld de,(fa+1) exx ;main set ld c,(ix+5) ld l,(ix+3) ld h,(ix+4) ld de,(fa+3) ld a,(fa+5) ld b,a push ix fpp(FP_CMP) ;sets: de=y hl=x pop ix jp p,amin2 ret ;hl is bigger than de, de on stack so okay... .amin2 ld l,(ix+1) ld h,(ix+2) exx ld c,(ix+5) ld l,(ix+3) ld h,(ix+4) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/asin.asm0000644000175000017500000000053007130401726016717 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double asin(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB asin XREF fsetup XREF stkequ2 .asin call fsetup fpp(FP_ASN) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/atan.asm0000644000175000017500000000052007423075667016727 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double asin(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB atan LIB fsetup LIB stkequ2 .atan call fsetup fpp(FP_ATN) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/atan2.asm0000644000175000017500000000342607423075667017021 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;* Fixed by Keith Rickard 17/5/1999 ;* ;* If y<>0 then atan2(x/y)=atn(x/y)-PI*(y<0) (true=-1) else atan2(x/y)=PI/2*signum(x) ;double atan2(double x,double y) atan(x/y) ;y is in the FA ;x is on the stack +8 (+2=y) INCLUDE "#fpp.def" XLIB atan2 LIB fsetup LIB stkequ2 XREF fa .atan2 ld ix,8 add ix,sp ld l,(ix+1) ld h,(ix+2) ld de,(fa+1) exx ;main set ld c,(ix+5) ld l,(ix+3) ld h,(ix+4) ld de,(fa+3) ld a,(fa+5) ld b,a ld a,h ;*Put sign of x in A bit 7,d ;*Test the sign of y (0=+ve,1=-ve) push af ;*Put sign info onto stack fpp(FP_DIV) jr nc,atan2_1 ;*Skip if no error fpp(FP_PI) ;*An RC.DVZ error means ATN(X/0)=PI/2 dec c ;*CHLhl = PI/2 pop af ;*Make the result the same sign as x rla ;*CF=0 means +ve, CF=1 means -ve jr nc,atan2_2 ;*Finished if +ve set 7,H ;*Make -ve jr atan2_2 ;*Jump to finish .atan2_1 ;* fpp(FP_ATN) pop af ;*What was the sign of y? jr z,atan2_2 ;*Finished if +ve exx ;*Stack the result atn(x/y) push hl ;*Stack the LSBs exx ;* push hl ;*Next the MSBs push bc ;*And finally the Exp fpp(FP_PI) ;*Get PI into CHLhl ld a,c ;*Keep PI in CHLhl and put atn(x/y) into BDEde pop bc ;*Keep Exp of PI in C and put Exp of atn(x/y) in B ld b,c ;* ld c,a ;* pop de ;*MSBs of atn(x/y) into DE exx ;* pop de ;*LSBs of atn(x/y) into de exx ;* fpp(FP_ADD) ;*CHLhl will now hold atn(x/y)+PI .atan2_2 ;* jp stkequ2 ;Finished! CHLhl holds atan2(x/y) z88dk-1.8.ds1/libsrc/z88math/atof.asm0000644000175000017500000000055407423075667016744 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 30/1/20001 djm ;double atof(char *) - convert string to number, leave in fa INCLUDE "#fpp.def" XLIB atof LIB stkequ2 .atof pop de pop hl ;the string push hl push de fpp(FP_VAL) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/ceil.asm0000644000175000017500000000070607423075667016726 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double ceil(double) ;Number in FA.. ; ;This is implemented as -(floor(-x)) INCLUDE "#fpp.def" XLIB ceil LIB fsetup LIB stkequ2 .ceil call fsetup fpp(FP_NEG) fpp(FP_INT) ;floor it (round down!) fpp(FP_NEG) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/cos.asm0000644000175000017500000000051507423075667016574 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double cos(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB cos LIB fsetup LIB stkequ2 .cos call fsetup fpp(FP_COS) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/cosh.c0000644000175000017500000000021007724165704016372 0ustar tygrystygrys#include #include #include "float.h" double cosh(x) double x; { double e; e = exp(x) ; return 0.5*(e+1.0/e) ; } z88dk-1.8.ds1/libsrc/z88math/dadd.asm0000644000175000017500000000031307423075667016700 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: dadd.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB dadd LIB fsetup LIB stkequ INCLUDE "#fpp.def" .dadd call fsetup fpp(FP_ADD) jp stkequ z88dk-1.8.ds1/libsrc/z88math/ddiv.asm0000644000175000017500000000031307423075667016732 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: ddiv.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB ddiv LIB fsetup LIB stkequ INCLUDE "#fpp.def" .ddiv call fsetup fpp(FP_DIV) jp stkequ z88dk-1.8.ds1/libsrc/z88math/deq.asm0000644000175000017500000000033207576060353016551 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: deq.asm,v 1.1 2002/12/12 10:11:55 dom Exp $ XLIB deq LIB fsetup LIB stkequcmp INCLUDE "#fpp.def" ; TOS != FA? .deq call fsetup fpp(FP_EQ) jp stkequcmp z88dk-1.8.ds1/libsrc/z88math/dge.asm0000644000175000017500000000033307576060353016540 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: dge.asm,v 1.2 2002/12/12 10:11:55 dom Exp $ XLIB dge LIB fsetup LIB stkequcmp INCLUDE "#fpp.def" ; TOS >= FA? .dge call fsetup fpp(FP_GEQ) jp stkequcmp z88dk-1.8.ds1/libsrc/z88math/dgt.asm0000644000175000017500000000033207423075667016563 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: dgt.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB dgt LIB fsetup LIB stkequcmp INCLUDE "#fpp.def" ; TOS >= FA? .dgt call fsetup fpp(FP_GT) jp stkequcmp z88dk-1.8.ds1/libsrc/z88math/dleq.asm0000644000175000017500000000033607423075667016736 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: dleq.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB dleq LIB fsetup LIB stkequcmp INCLUDE "#fpp.def" ; TOS <= FA? .dleq call fsetup fpp(FP_LEQ) jp stkequcmp z88dk-1.8.ds1/libsrc/z88math/dlt.asm0000644000175000017500000000033107423075667016567 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: dlt.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB dlt LIB fsetup LIB stkequcmp INCLUDE "#fpp.def" ; TOS < FA? .dlt call fsetup fpp(FP_LT) jp stkequcmp z88dk-1.8.ds1/libsrc/z88math/dmul.asm0000644000175000017500000000031307423075667016745 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: dmul.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB dmul LIB fsetup LIB stkequ INCLUDE "#fpp.def" .dmul call fsetup fpp(FP_MUL) jp stkequ z88dk-1.8.ds1/libsrc/z88math/dne.asm0000644000175000017500000000062707576060353016555 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: dne.asm,v 1.1 2002/12/12 10:11:55 dom Exp $ XLIB dne LIB fsetup LIB stkequcmp INCLUDE "#fpp.def" ; TOS != FA? .dne call fsetup fpp(FP_EQ) ;Invert the result, not particularly elegant, but it works! ex de,hl ld hl,0 ld a,e or d jp nz,stkequcmp inc hl jp stkequcmp z88dk-1.8.ds1/libsrc/z88math/dsub.asm0000644000175000017500000000031307423075667016741 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: dsub.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB dsub LIB fsetup LIB stkequ INCLUDE "#fpp.def" .dsub call fsetup fpp(FP_SUB) jp stkequ z88dk-1.8.ds1/libsrc/z88math/dswap.asm0000644000175000017500000000070507423075667017127 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: dswap.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB dswap LIB fsetup LIB stkequ2 ; Swaps FA for that on top of stack .dswap call fsetup ;deDEB = FA hlHLC = stacked (caps = this set) call stkequ2 ;place hlHLC in FA, return with alternate set ld ix,2 add ix,sp ; ld (ix+0),0 ;probably unnecessary ld (ix+1),e ld (ix+2),d exx ;go to main set ld (ix+3),e ld (ix+4),d ld (ix+5),b ret z88dk-1.8.ds1/libsrc/z88math/exp.asm0000644000175000017500000000052307423075667016603 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double log10(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB exp LIB fsetup LIB stkequ2 .exp call fsetup fpp(FP_EXP) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/fabs.asm0000644000175000017500000000050407423075667016721 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double fabs(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB fabs LIB fsetup LIB stkequ2 .fabs call fsetup fpp(FP_ABS) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/float.asm0000644000175000017500000000111207130401726017067 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;Convert from integer to FP.. ;We could enter in here with a long in dehl, so, mod to compiler I think! INCLUDE "#fpp.def" XLIB float XREF fa .float push de ;msb exx pop hl ld c,0 ;no exponent fpp(FP_FLT) ld (fa+3),hl ld a,c ld (fa+5),a exx ld (fa+1),hl xor a ld (fa),a ret z88dk-1.8.ds1/libsrc/z88math/floor.asm0000644000175000017500000000057107423075667017133 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double floor(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB floor LIB fsetup LIB stkequ2 .floor call fsetup fpp(FP_INT) ;floor it (round down!) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/fmod.asm0000644000175000017500000000236607423075667016743 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ; ; fmod(z,x) = z-x*floor(z/x) ; if x>0 then 0 <= fmod(z,x) < x ; if x<0 then x < fmod(z,x) <= 0 ; ;x is in the FA ;z is on the stack +8 (+2=x) INCLUDE "#fpp.def" XLIB fmod LIB fsetup LIB stkequ2 XREF fa .fmod ld ix,8 add ix,sp ld l,(ix+1) ld h,(ix+2) ld de,(fa+1) exx ;main set ld c,(ix+5) ld l,(ix+3) ld h,(ix+4) ld de,(fa+3) ld a,(fa+5) ld b,a push ix fpp(FP_DIV) fpp(FP_INT) ;floor ;Load up x from the FA and multiply ld de,(fa+3) ld a,(fa+5) ld b,a exx ld de,(fa+1) exx fpp(FP_MUL) fpp(FP_NEG) ;negate ;load up z again pop ix ld e,(ix+3) ld d,(ix+4) ld b,(ix+5) ;exponent exx ld e,(ix+1) ld d,(ix+2) exx fpp(FP_ADD) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/fsetup.asm0000644000175000017500000000110307423075667017310 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ; Set up the registers for our operation ; Return with main set in XLIB fsetup XREF fa .fsetup ld ix,4 ;ret to this function and ret to code add ix,sp ld l,(ix+1) ld h,(ix+2) ld de,(fa+1) exx ;main set ld l,(ix+3) ld h,(ix+4) ld de,(fa+3) ld c,(ix+5) ld a,(fa+5) ld b,a ret z88dk-1.8.ds1/libsrc/z88math/ftoa.asm0000644000175000017500000000102307423075667016734 0ustar tygrystygrys; Z88 Specific Maths Library ; ; Convert double to string ; ;void ftoa(x,prec,str) ;double x ; /* number to be converted */ ;int prec ; /* # digits after decimal place */ ;char *str ; /* output string */ XLIB ftoa INCLUDE "#fpp.def" .ftoa ld ix,0 add ix,sp exx ld d,2 ;Fixed format ld e,(ix+4) ;digits of d.p. may work who knows? ld l,(ix+6+1) ld h,(ix+6+2) exx ld l,(ix+6+3) ld h,(ix+6+4) ld c,(ix+6+5) ;number ld e,(ix+2) ;buffer ld d,(ix+3) fpp(fp_str) ret z88dk-1.8.ds1/libsrc/z88math/ftoe.asm0000644000175000017500000000103107130401726016717 0ustar tygrystygrys; Z88 Specific Maths Library ; ; Convert double to string ; ;void ftoe(x,prec,str) ;double x ; /* number to be converted */ ;int prec ; /* # digits after decimal place */ ;char *str ; /* output string */ XLIB ftoe INCLUDE "#fpp.def" .ftoe ld ix,0 add ix,sp exx ld d,1 ;exponential format ld e,(ix+4) ;digits of d.p. may work who knows? ld l,(ix+6+1) ld h,(ix+6+2) exx ld l,(ix+6+3) ld h,(ix+6+4) ld c,(ix+6+5) ;number ld e,(ix+2) ;buffer ld d,(ix+3) fpp(fp_str) ret z88dk-1.8.ds1/libsrc/z88math/ifix.asm0000644000175000017500000000073507130401726016733 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;Convert fp in FA to an integer INCLUDE "#fpp.def" XLIB ifix XREF fa .ifix ld hl,(fa+1) exx ld hl,(fa+3) ld a,(fa+5) ld c,a fpp(FP_FIX) push hl ;msb exx pop de ;stick msb in de so we can convert to longs if needed ret z88dk-1.8.ds1/libsrc/z88math/log.asm0000644000175000017500000000053707423075667016575 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double log(double) - natural log ;Number in FA.. INCLUDE "#fpp.def" XLIB log LIB fsetup LIB stkequ2 .log call fsetup fpp(FP_LN) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/log10.asm0000644000175000017500000000052507423075667016733 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double log10(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB log10 LIB fsetup LIB stkequ2 .log10 call fsetup fpp(FP_LOG) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/Makefile0000644000175000017500000000062610763610053016732 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! # include ../Make.config CFILES = \ cosh.c \ sinh.c \ tanh.c AFILES = $(CFILES:.c=.asm) OBJECTS = $(CFILES:.c=.o) all: z88math z88math: $(OBJECTS) $(LIBLINKER) -x../$(OUTPUT_DIRECTORY)/z88_math @z88list .c.o: zcc +zx $(CFLAGS) -math-z88 -D__Z88__ -D__NATIVE_MATH__ $*.c clean: $(RM) *.o* *.sym *.map *.err zcc_opt.def *.i $(AFILES) z88dk-1.8.ds1/libsrc/z88math/minusfa.asm0000644000175000017500000000057407423075667017457 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;minusfa(double) (internal function, negate number in FA) ;Number in FA.. INCLUDE "#fpp.def" XLIB minusfa LIB fsetup LIB stkequ2 .minusfa call fsetup fpp(FP_NEG) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/pi.asm0000644000175000017500000000052207724165704016412 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 30th August 2003 ; ; $Id: pi.asm,v 1.1 2003/08/30 18:24:04 dom Exp $ ;double pi(void) - returns the value of pi INCLUDE "#fpp.def" XLIB pi LIB stkequ2 .pi fpp(FP_PI) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/pow.asm0000644000175000017500000000125607423075667016620 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double pow(double x,double y) ;y is in the FA ;x is on the stack +8 (+2=y) INCLUDE "#fpp.def" XLIB pow LIB fsetup LIB stkequ2 XREF fa .pow ld ix,8 add ix,sp ld l,(ix+1) ld h,(ix+2) ld de,(fa+1) exx ;main set ld c,(ix+5) ld l,(ix+3) ld h,(ix+4) ld de,(fa+3) ld a,(fa+5) ld b,a fpp(FP_PWR) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/qfloat.asm0000644000175000017500000000107307130401726017256 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;Convert from integer to FP.. ;We could enter in here with a long in dehl, so, mod to compiler I think! INCLUDE "#fpp.def" XLIB qfloat XREF fa .qfloat push de ;msb exx pop hl ld c,0 ;no exponent fpp(FP_FLT) ld (fa+3),hl ld a,c ld (fa+5),a exx ld (fa+1),hl xor a ld (fa),a ret z88dk-1.8.ds1/libsrc/z88math/sin.asm0000644000175000017500000000051507423075667016601 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double sin(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB sin LIB fsetup LIB stkequ2 .sin call fsetup fpp(FP_SIN) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/sinh.c0000644000175000017500000000021007724165704016377 0ustar tygrystygrys#include #include #include "float.h" double sinh(x) double x; { double e; e = exp(x) ; return 0.5*(e-1.0/e) ; } z88dk-1.8.ds1/libsrc/z88math/sqrt.asm0000644000175000017500000000052207423075667016777 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double sqrt(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB sqrt LIB fsetup LIB stkequ2 .sqrt call fsetup fpp(FP_SQR) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/stkequ.asm0000644000175000017500000000077407423075667017333 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: stkequ.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB stkequ XREF fa ;Equalise the stack, and put the calculated value into FA .stkequ ld (fa+3),hl ld a,c ld (fa+5),a exx ld (fa+1),hl ; xor a ; ld (fa),a pop hl ;ret to program pop bc ;get rid of fp number pop bc pop bc jp (hl) ;outa here back to program z88dk-1.8.ds1/libsrc/z88math/stkequ2.asm0000644000175000017500000000053007423075667017403 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: stkequ2.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB stkequ2 XREF fa ; Store the FP number in FA after executing a routine .stkequ2 ld (fa+3),hl ld a,c ld (fa+5),a exx ld (fa+1),hl ; xor a ; ld (fa),a ret z88dk-1.8.ds1/libsrc/z88math/stkequcmp.asm0000644000175000017500000000063107423075667020023 0ustar tygrystygrys; ; Z88dk Z88 Maths Library ; ; ; $Id: stkequcmp.asm,v 1.1 2002/01/21 20:36:07 dom Exp $ XLIB stkequcmp .stkequcmp pop de ;return address pop bc ;dump number.. pop bc pop bc push de ;put it back ld a,h or l ;sets nc ret z ld hl,1 scf ret z88dk-1.8.ds1/libsrc/z88math/tan.asm0000644000175000017500000000051507423075667016572 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;double tan(double) ;Number in FA.. INCLUDE "#fpp.def" XLIB tan LIB fsetup LIB stkequ2 .tan call fsetup fpp(FP_TAN) jp stkequ2 z88dk-1.8.ds1/libsrc/z88math/tanh.c0000644000175000017500000000021307724165704016373 0ustar tygrystygrys#include #include #include "float.h" double tanh(double x) { double e; e = exp(x) ; return (e-1.0/e)/(e+1.0/e) ; } z88dk-1.8.ds1/libsrc/z88math/ufloat.asm0000644000175000017500000000143607130401726017265 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;Convert from integer to FP.. ;We could enter in here with a long in dehl, so, mod to compiler I think! INCLUDE "#fpp.def" XLIB ufloat XREF fa .ufloat push de ;msb exx pop hl ld c,0 ;no exponent ld a,h push af res 7,h fpp(FP_FLT) pop af rlca jr nc,ufloat_out ;no high bit ;to multiply by two, increment the exponent inc c .ufloat_out ld (fa+3),hl ld a,c ld (fa+5),a exx ld (fa+1),hl xor a ld (fa),a ret z88dk-1.8.ds1/libsrc/z88math/z88list0000644000175000017500000000035407724165704016553 0ustar tygrystygrysacos amax amin asin atan2 atan atof ceil cos cosh dadd ddiv deq dge dgt dleq dlt dmul dne dsub dswap exp fabs float floor fmod fsetup ftoa ftoe ifix log10 log minusfa pow qfloat sin sinh sqrt stkequ2 stkequ stkequcmp tan tanh ufloat pi z88dk-1.8.ds1/libsrc/z88net.lst0000644000175000017500000000211610763607602015655 0ustar tygrystygrysstdio/z88/fgetc_cons stdio/z88/fgets_cons stdio/z88/fputc_cons stdio/z88/getcmd stdio/z88/getk stdio/z88/puts_cons stdio/zsock/opennet stdio/zsock/closenet stdio/zsock/fgetc_net stdio/zsock/fputc_net stdio/zsock/fflush_net fcntl/z88/fdgetpos fcntl/z88/fdtell fcntl/z88/rename fcntl/z88/remove fcntl/z88/open fcntl/z88/open_z88 fcntl/z88/close fcntl/z88/lseek fcntl/z88/read fcntl/z88/creat fcntl/z88/write fcntl/z88/readbyte fcntl/z88/writebyte fcntl/z88/stat fcntl/z88/opendor fcntl/z88/closedor fcntl/z88/readdor fcntl/z88/writedor fcntl/z88/deletedor fcntl/z88/sondor fcntl/z88/brotherdor stdlib/z88/atol stdlib/z88/getcwd stdlib/z88/mkdir stdlib/z88/sleep stdlib/z88/csleep time/gmtime time/localtime time/z88/clock time/z88/time games/joystick games/z88/bit_open games/z88/bit_open_di games/z88/bit_close games/z88/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/z88/beeper rs232/z88/rs232_close rs232/z88/rs232_get rs232/z88/rs232_init rs232/z88/rs232_params rs232/z88/rs232_put @z80.lst z88dk-1.8.ds1/libsrc/zx.lst0000644000175000017500000001675610763607603015176 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper input/spectrum/in_GetKey input/spectrum/in_GetKeyReset input/spectrum/in_Inkey input/spectrum/in_JoyFuller input/spectrum/in_JoyKempston input/spectrum/in_JoyKeyboard input/spectrum/in_JoySinclair1 input/spectrum/in_JoySinclair2 input/spectrum/in_JoyTimex1 input/spectrum/in_JoyTimex2 input/spectrum/in_KeyPressed input/spectrum/in_keytranstbl input/spectrum/in_LookupKey input/spectrum/in_MouseAMX input/spectrum/in_MouseAMX_callee input/spectrum/in_MouseAMXInit input/spectrum/in_MouseAMXInit_callee input/spectrum/in_MouseAMXSetPos input/spectrum/in_MouseAMXSetPos_callee input/spectrum/in_MouseKemp input/spectrum/in_MouseKemp_callee input/spectrum/in_MouseKempInit input/spectrum/in_MouseKempSetPos input/spectrum/in_MouseKempSetPos_callee input/spectrum/in_MouseSim input/spectrum/in_MouseSim_callee input/spectrum/in_MouseSimInit input/spectrum/in_MouseSimInit_fastcall input/spectrum/in_MouseSimSetPos input/spectrum/in_MouseSimSetPos_callee input/spectrum/in_Pause input/spectrum/in_Wait input/spectrum/in_WaitForKey input/spectrum/in_WaitForNoKey input/spectrum/INMouseAMX input/spectrum/INMouseKemp input/spectrum/INMouseSim stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/fseek stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/spectrum/fgetc_cons stdio/fgets_cons stdio/spectrum/fputc_cons stdio/spectrum/getk stdio/puts_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp time/spectrum/clock setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/spectrum/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy graphics/fill graphics/dfill graphics/getsprite graphics/spectrum/putsprite graphics/spectrum/bksave graphics/spectrum/bkrestore graphics/spectrum/rowtab graphics/spectrum/pixladdr2 graphics/spectrum/swapgfxbk graphics/xorborder graphics/xorpixl graphics/xorplot games/spectrum/joystick games/spectrum/bit_open games/spectrum/bit_open_di games/spectrum/bit_close games/spectrum/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/spectrum/beeper spectrum/zx_attr spectrum/zx_attr_callee spectrum/zx_border spectrum/zx_break spectrum/zx_screenstr spectrum/zx_screenstr_callee spectrum/currah_detect spectrum/currah_direct spectrum/currah_speech spectrum/if1_checkblock spectrum/if1_checksum spectrum/if1_find_sector spectrum/if1_find_sector_map spectrum/if1_from_mdv spectrum/if1_getname spectrum/if1_init_file spectrum/if1_installed spectrum/if1_load_record spectrum/if1_load_sector spectrum/if1_mdv_status spectrum/if1_remove_file spectrum/if1_rommap spectrum/if1_setname spectrum/if1_touch_file spectrum/if1_update_map spectrum/if1_write_record spectrum/if1_write_sector spectrum/tape_load_block spectrum/tape_load_block_callee spectrum/tape_save_block spectrum/tape_save_block_callee spectrum/zx_128mode spectrum/zx_aaddr2cx spectrum/zx_aaddr2cy spectrum/zx_aaddr2px spectrum/zx_aaddr2py spectrum/zx_aaddr2saddr spectrum/zx_aaddrcdown spectrum/zx_aaddrcleft spectrum/zx_aaddrcright spectrum/zx_aaddrcup spectrum/zx_basemem spectrum/zx_basic_length spectrum/zx_cy2aaddr spectrum/zx_cy2saddr spectrum/zx_cyx2aaddr spectrum/zx_cyx2aaddr_callee spectrum/zx_cyx2saddr spectrum/zx_cyx2saddr_callee spectrum/zx_extsys spectrum/zx_floatingbus spectrum/zx_fullerstick spectrum/zx_getint spectrum/zx_getstr spectrum/zx_getstr_callee spectrum/zx_goto spectrum/zx_iss_stick spectrum/zx_issue3 spectrum/zx_interface1 spectrum/zx_kempston spectrum/zx_kempstonmouse spectrum/zx_locatenum spectrum/zx_mb02 spectrum/zx_model spectrum/zx_multiface spectrum/zx_plus3fdc spectrum/zx_printer spectrum/zx_pxy2aaddr spectrum/zx_pxy2aaddr_callee spectrum/zx_pxy2saddr spectrum/zx_pxy2saddr_callee spectrum/zx_py2aaddr spectrum/zx_py2saddr spectrum/zx_saddr2aaddr spectrum/zx_saddr2cx spectrum/zx_saddr2cy spectrum/zx_saddr2px spectrum/zx_saddr2px_callee spectrum/zx_saddr2py spectrum/zx_saddrcdown spectrum/zx_saddrcleft spectrum/zx_saddrcright spectrum/zx_saddrcup spectrum/zx_saddrpdown spectrum/zx_saddrpleft spectrum/zx_saddrpleft_callee spectrum/zx_saddrpright spectrum/zx_saddrpright_callee spectrum/zx_saddrpup spectrum/zx_setint spectrum/zx_setint_callee spectrum/zx_setstr spectrum/zx_setstr_callee spectrum/zx_soundchip spectrum/zx_syntax spectrum/zx_timexsound spectrum/zx_type spectrum/zx_var_length spectrum/tape_save spectrum/beta/trdos_installed spectrum/beta/zx_betadisk spectrum/opus/opus_6116 spectrum/opus/opus_getblocks spectrum/opus/opus_getblocksize spectrum/opus/opus_lptread spectrum/opus/opus_lptwrite spectrum/opus/opus_rommap spectrum/opus/opus_testchannel spectrum/opus/opus_version spectrum/opus/set_kempston spectrum/opus/zx_opus spectrum/disciple/zx_disciple.asm printflike/ltoa_any z88dk-1.8.ds1/libsrc/zx81/0000755000175000017500000000000010765202715014601 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/zx81/_clg_hr.asm0000644000175000017500000000227510700424570016700 0ustar tygrystygrys;-------------------------------------------------------------- ; This code comes from the 'HRG_Tool' ; by Matthias Swatosch ;-------------------------------------------------------------- ; ; Fast CLS for hi-rez ZX81 ; ; Stefano - 10/1/2007 ; ; ; $Id: _clg_hr.asm,v 1.1 2007/10/02 11:20:24 stefano Exp $ ; XLIB _clg_hr XREF base_graphics XREF hr_rows ._clg_hr ;---------------------------------------------------------------- ; ; HRG_Tool_Clear ; hl = pointer to display array ; ; to fill hr_rows lines by 32 characters ; here we use the stack (!) to fill hr_rows x 8 x 16 words with push ; ;---------------------------------------------------------------- ld hl,(base_graphics) ld a,(hr_rows) ; 8 or 24 ld b,a ; * 256 ld c,0 add hl,bc ld (HRG_ClearSpReg),sp ld sp,hl ld hl,0 add a ; 8 or 24 add a add a ; * 8 ld b,a HRG_ClearLoop: push hl push hl push hl push hl push hl push hl push hl push hl push hl push hl push hl push hl push hl push hl push hl push hl djnz HRG_ClearLoop ld sp,(HRG_ClearSpReg) ret HRG_ClearSpReg: defw 0 z88dk-1.8.ds1/libsrc/zx81/ascii_zx.asm0000644000175000017500000000066710727277402017130 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; convert ASCII character to ZX81 char code ; ; char ascii_zx(char character); ; ; ; $Id: ascii_zx.asm,v 1.3 2007/12/10 18:01:38 stefano Exp $ ; XLIB ascii_zx LIB asctozx81 ascii_zx: ld hl,asctozx81+1 ld a,(hl) push af push hl ld a,229 ; push hl ld (hl),a ld hl,6 add hl,sp ; location of char call asctozx81 pop bc ld h,0 ld l,a pop af ld (bc),a ret z88dk-1.8.ds1/libsrc/zx81/asctozx81.asm0000755000175000017500000000172210707154205017150 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Internal code to convert a character from ASCII to ZX81 ; in: source character in (HL) ; out: A = converted character ; ; $Id: asctozx81.asm,v 1.1 2007/10/22 17:06:13 stefano Exp $ ; XLIB asctozx81 LIB zx81_cnvtab .asctozx81 ld a,(hl) push hl cp 48 ; Between 0 and 9 ? jr c,isntnum cp 58 jr nc,isntnum sub 20 ; Ok, re-code to the ZX81 charset jr setout ; .. and put it out .isntnum cp 97 ; Between a and z ? jr c,isntlower cp 123 jr nc,isntlower sub 32 ; Then transform in UPPER ! .isntlower cp 65 ; Between A and Z ? jr c,isntchar cp 91 jr nc,isntchar sub 27 ; Ok, re-code to the ZX81 charset jr setout ; .. and put it out .isntchar ld hl,zx81_cnvtab .symloop inc hl cp (hl) jr z,chfound inc hl push af xor a or (hl) jr z,isntsym pop af jr symloop .chfound dec hl ld a,(hl) jr setout .isntsym pop af ld a,0 ; Else (space, exclamation mark, ..), blank. .setout pop hl ret z88dk-1.8.ds1/libsrc/zx81/cnvtab.asm0000755000175000017500000000143310732257527016571 0ustar tygrystygrys; ; ZX81 Stdio ; ; ASCII-ZX81 conversion Table ; used by fgetc_cons and fputc_cons ; ; Stefano Bodrato - Apr. 2000 ; ; ; $Id: cnvtab.asm,v 1.2 2007/12/19 18:13:43 stefano Exp $ ; XLIB zx81_cnvtab .zx81_cnvtab defb 114 ; cursor-left defb 8 defb 115 ; cursor-right defb 9 defb 112 ; cursor-up defb 11 defb 113 ; cursor-down defb 10 defb 119 ; Rubout defb 12 defb 118 ; Newline defb 13 defb 11 defb '"' defb 12 defb '' defb 13 defb '$' defb 14 defb ':' defb 15 defb '?' defb 16 defb '(' defb 17 defb ')' defb 18 defb '>' defb 19 defb '<' defb 20 defb '=' defb 21 defb '+' defb 22 defb '-' defb 23 defb '*' defb 24 defb '/' defb 25 defb ';' defb 26 defb ',' defb 27 defb '.' defb 1 defb 39 ;"'" defw 0 z88dk-1.8.ds1/libsrc/zx81/copytxt.asm0000644000175000017500000000344710700163606017017 0ustar tygrystygrys; ; ZX81 libraries ; ;-------------------------------------------------------------- ; This code comes from the 'HRG_Tool' ; by Matthias Swatosch ; Original function name: "HRG_Tool_TXTcopy" ;-------------------------------------------------------------- ; ; $Id: copytxt.asm,v 1.1 2007/10/01 12:26:46 stefano Exp $ ; ;---------------------------------------------------------------- ; ; HRG_Tool_TXTcopy ; hl = pointer to display array ; ; copies the textscreen (DFILE) into HRG ; ;---------------------------------------------------------------- XLIB copytxt XREF base_graphics copytxt: ld (ovmode),hl ld hl,(base_graphics) ld de,($400C) ; D_FILE inc de IF FORzx81hrg64 ld b,8 ELSE ld b,24 ENDIF ld c,0 HRG_TXTcopyLoop: ld a,(de) or a jr z,HRG_TXTcopyNextChar cp 118 jr z,HRG_TXTcopyNextLine push hl ; HL points to byte in HRG push de ; A is character push bc cp $40 ; inverse? push af ld de,$1e00 ; start of characters in ROM ld b,0 and $3f ld c,a or a rl c ; multiply BC by 8 rl b rl c rl b rl c rl b ex de,hl add hl,bc ex de,hl ; now DE is pointer to pixel code ld c,$00 ; C stores invers character information pop af ; inverse? jr c,HRG_TXTcopyNormal dec c ; if inverse character then C is $ff HRG_TXTcopyNormal: ld b,8 ; counter HRG_TXTcopyLoop2: ld a,(de) xor c ovmode: nop nop ;or (hl) ; plot the character to HRG ld (hl),a push bc ld bc,32 add hl,bc pop bc inc de djnz HRG_TXTcopyLoop2 pop bc pop de pop hl HRG_TXTcopyNextChar: inc de inc hl jr HRG_TXTcopyLoop HRG_TXTcopyNextLine: inc c inc de ld hl,(base_graphics) push bc ld b,c ld c,0 add hl,bc pop bc djnz HRG_TXTcopyLoop ret z88dk-1.8.ds1/libsrc/zx81/invtxt.asm0000644000175000017500000000212210700163606016626 0ustar tygrystygrys; ; ZX81 libraries ; ;-------------------------------------------------------------- ; This code comes from the FidoNET Sinclair newsgroup ;-------------------------------------------------------------- ; ; $Id: invtxt.asm,v 1.1 2007/10/01 12:26:46 stefano Exp $ ; ;---------------------------------------------------------------- ; ; invtxt() - invert text display ; ;---------------------------------------------------------------- XLIB invtxt invtxt: LD HL,(400CH) ; DFILE ADDR LD C,16H ; LINES=22 LOOP2: LD B,20H ; CHARS=32 LOOP1: INC HL ; INC DFILE LD A,(HL) ; DFILE CHAR ADD A,80H ; IN A/ADD 80 LD (HL),A ; POKE DFILE DJNZ LOOP1 ; LINE COUNTER INC HL ; NEW LINE DEC C ; UNTIL C=0 JR NZ, LOOP2 ; UNTIL B=0 RET z88dk-1.8.ds1/libsrc/zx81/mirrortxt.asm0000644000175000017500000000246310703704554017362 0ustar tygrystygrys; ; ZX81 libraries ; ;-------------------------------------------------------------- ; This code comes from the FidoNET Sinclair newsgroup ;-------------------------------------------------------------- ; ; $Id: mirrortxt.asm,v 1.1 2007/10/12 14:49:16 stefano Exp $ ; ;---------------------------------------------------------------- ; ; mirrortxt() - mirror text display ; ;---------------------------------------------------------------- XLIB mirrortxt mirrortxt: LD HL,(400CH) ; Puts the adress of the displayfile in HL LD DE,0010H ; This is the middle of the screen ADD HL,DE ; Add to displayfile LD D,H ; leave result in DE LD E,L ; INC DE ; counting up LD B,16H ; B as counter 22 lines .MIR1 LD A,(HL) ; Character in accumulator CP 76H ; look for end line JR Z,MIR2 ; If b not 0 goto 409E EX DE,HL ; temporary storage LD C,(HL) ; LD (HL),A ; Print to Dfile EX DE,HL ; get value back again LD (HL),C ; print to Dfile DEC HL ; counting down INC DE ; JR MIR1 ; Get next character .MIR2 LD DE,0031H ; Go to middle of next line ADD HL,DE ; LD D,H ; LD E,L ; INC DE ; DJNZ MIR1 ; until screen full repeat routine RET z88dk-1.8.ds1/libsrc/zx81/zx81toasc.asm0000755000175000017500000000157610711311664017156 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Internal code to convert a character from ZX81 to ASCII ; in: source character in (HL) ; out: A = converter character ; ; $Id: zx81toasc.asm,v 1.2 2007/10/29 08:03:00 stefano Exp $ ; XLIB zx81toasc LIB zx81_cnvtab .zx81toasc ld a,(hl) push hl and a ; space ? jr nz,testnum ld a,' ' jr setout .testnum cp 28 ; Between 0 and 9 ? jr c,isntnum cp 38 jr nc,isntnum add 20 ; Ok, re-code to the ZX81 charset jr setout ; .. and put it out .isntnum cp 38 ; Between A and Z ? jr c,isntchar cp 64 jr nc,isntchar add 27 ; Ok, re-code to the ZX81 charset jr setout ; .. and put it out .isntchar ld hl,zx81_cnvtab .symloop ;inc hl cp (hl) jr z,chfound push af xor a or (hl) jr z,isntsym pop af inc hl jr symloop .chfound inc hl ld a,(hl) jr setout .isntsym pop af ld a,0 ; Else blank. .setout pop hl ret z88dk-1.8.ds1/libsrc/zx81/zx_ascii.asm0000644000175000017500000000064310727277402017122 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; convert char to ASCII ; ; char zx_ascii(char character); ; ; ; $Id: zx_ascii.asm,v 1.3 2007/12/10 18:01:38 stefano Exp $ ; XLIB zx_ascii LIB zx81toasc zx_ascii: ld hl,zx81toasc+1 ld a,(hl) push af push hl ld a,229 ; push hl ld (hl),a ld hl,6 add hl,sp ; location of char call zx81toasc pop bc ld h,0 ld l,a pop af ld (bc),a ret z88dk-1.8.ds1/libsrc/zx81/zx_asciimode.asm0000644000175000017500000000075610725175563017777 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Activates /deactivates the ZX81<->ASCII converter ; mode=0 ..disable ; other values ..enable ; ; int __FASTCALL__ zx_asciimode(int mode); ; ; ; $Id: zx_asciimode.asm,v 1.2 2007/12/04 07:02:11 stefano Exp $ ; XLIB zx_asciimode LIB asctozx81 LIB zx81toasc zx_asciimode: xor a or l ld hl,asctozx81+1 push hl ld hl,zx81toasc+1 ld a,201 ; ret jr z,off on: ld a,229 ; push hl off: ld (hl),a pop hl ld (hl),a ret z88dk-1.8.ds1/libsrc/zx81/zx_basic_length.asm0000755000175000017500000000066510707154205020454 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; This routine gives the length of the current BASIC program. ; Memory used by variables is not included. ; ; $Id: zx_basic_length.asm,v 1.1 2007/10/22 17:06:13 stefano Exp $ ; XLIB zx_basic_length zx_basic_length: ld de,$407D ; location of BASIC program (just after system variables) ld hl,($400C) ; Display file is end of program sbc hl,de ret z88dk-1.8.ds1/libsrc/zx81/zx_fast.asm0000644000175000017500000000035410710126720016752 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Goes in FAST mode ; ; void zx_fast(); ; ; ; $Id: zx_fast.asm,v 1.1 2007/10/25 14:53:04 stefano Exp $ ; XLIB zx_fast LIB hrg_off zx_fast: call hrg_off jp $F23 ; FAST ! z88dk-1.8.ds1/libsrc/zx81/zx_getstr.asm0000755000175000017500000000043110707154205017331 0ustar tygrystygrys; int zx_getstr(char variable, char *value) ; CALLER linkage for function pointers XLIB zx_getstr LIB zx_getstr_callee XREF ASMDISP_ZX_GETSTR_CALLEE .zx_getstr pop bc pop hl pop de push de push hl push bc jp zx_getstr_callee + ASMDISP_ZX_GETSTR_CALLEE z88dk-1.8.ds1/libsrc/zx81/zx_getstr_callee.asm0000755000175000017500000000176510707455254020661 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Copy a variable from basic ; ; int __CALLEE__ zx_getstr_callee(char variable, char *value); ; ; ; $Id: zx_getstr_callee.asm,v 1.2 2007/10/23 20:33:48 stefano Exp $ ; XLIB zx_getstr_callee XDEF ASMDISP_ZX_GETSTR_CALLEE LIB zx81toasc zx_getstr_callee: pop bc pop hl pop de push bc ; enter : hl = char *value ; e = char variable .asmentry ld a,e and 31 add 69 ld (morevar+1),a ld (pointer+1),hl ld hl,($4010) ; VARS loop: ld a,(hl) cp 128 jr nz,morevar ld hl,-1 ; variable not found ret morevar: cp 0 jr nz,nextvar inc hl ld c,(hl) inc hl ld b,(hl) inc hl pointer: ld de,0 ;----------------------------- .outloop call zx81toasc ld (de),a inc hl inc de dec bc ld a,b or c jr nz,outloop ;------------------------------ ; ldir inc de xor a ld (de),a ld hl,0 ret nextvar: call $09F2 ;get next variable start ex de,hl jr loop DEFC ASMDISP_ZX_GETSTR_CALLEE = asmentry - zx_getstr_callee z88dk-1.8.ds1/libsrc/zx81/zx_line.asm0000755000175000017500000000167310707154205016761 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; int __FASTCALL__ zx_line(int line); ; ; Execute a single BASIC program line. ; Returns with BASIC error code. ; 0=OK,... -1=no program lines found ; ; $Id: zx_line.asm,v 1.1 2007/10/22 17:06:13 stefano Exp $ ; XLIB zx_line XREF restore81 ; enter : hl = line number zx_line: call $09D8 ; routine LINE-ADDR cp 118 jr nz,havelines ld hl,-1 ; no program lines to point to ! ret havelines: inc hl inc hl inc hl inc hl ld ($4016),hl ; CH_ADD call restore81 ld bc,($4002) push bc ; save original ERR_SP ld bc,return push bc ld ($4002),sp ; update error handling routine jp $cc1 ; single line return: ld h,0 ld a,($4000) ld l,a ; error code (hope so !) ld a,255 ld ($4000),a ; reset ERR_NR inc l ; return with error code (0=OK, etc..) exitgoto: pop bc ld ($4002),bc ; restore orginal ERR_SP ret z88dk-1.8.ds1/libsrc/zx81/zx_setstr.asm0000755000175000017500000000043110707154205017345 0ustar tygrystygrys; int zx_setstr(char variable, char *value) ; CALLER linkage for function pointers XLIB zx_setstr LIB zx_setstr_callee XREF ASMDISP_ZX_SETSTR_CALLEE .zx_setstr pop bc pop hl pop de push de push hl push bc jp zx_setstr_callee + ASMDISP_ZX_SETSTR_CALLEE z88dk-1.8.ds1/libsrc/zx81/zx_setstr_callee.asm0000755000175000017500000000250210707455255020664 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Copy a string to a BASIC variable ; ; int __CALLEE__ zx_setstr_callee(char variable, char *value); ; ; ; $Id: zx_setstr_callee.asm,v 1.2 2007/10/23 20:33:49 stefano Exp $ ; XLIB zx_setstr_callee XDEF ASMDISP_ZX_SETSTR_CALLEE LIB asctozx81 zx_setstr_callee: pop bc pop hl pop de push bc ; enter : hl = char *value ; e = char variable .asmentry ld a,e and 31 add 69 ld (morevar+1),a ld (pointer+1),hl ld hl,($4010) ; VARS loop: ld a,(hl) cp 128 jr nz,morevar jr store ; variable not found morevar: cp 0 jr nz,nextvar call $09F2 ; get next variable start call $0A60 ; reclaim space (delete) store: ld bc,0 pointer: ld de,0 ; point to the string push de lenloop: inc bc ; string length counter inc de ld a,(de) and a jr nz,lenloop push hl push bc inc bc inc bc inc bc call $099E ; MAKE-ROOM pop bc pop hl ld a,(morevar+1) ld (hl),a inc hl ld (hl),c inc hl ld (hl),b inc hl pop de ex de,hl ;ldir ;----------------------------- .outloop call asctozx81 ld (de),a inc hl inc de dec bc ld a,b or c jr nz,outloop ;------------------------------ ret nextvar: call $09F2 ;get next variable start ex de,hl jr loop DEFC ASMDISP_ZX_SETSTR_CALLEE = asmentry - zx_setstr_callee z88dk-1.8.ds1/libsrc/zx81/zx_slow.asm0000644000175000017500000000032610710126720017000 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; Goes in SLOW mode ; ; void zx_slow(); ; ; ; $Id: zx_slow.asm,v 1.1 2007/10/25 14:53:04 stefano Exp $ ; XLIB zx_slow LIB hrg_on zx_slow: jp hrg_on z88dk-1.8.ds1/libsrc/zx81/zx_var_length.asm0000755000175000017500000000060510707154205020155 0ustar tygrystygrys; ; ZX 81 specific routines ; by Stefano Bodrato, Oct 2007 ; ; This routine gives the size of memory used by BASIC variables ; ; $Id: zx_var_length.asm,v 1.1 2007/10/22 17:06:13 stefano Exp $ ; XLIB zx_var_length zx_var_length: ld de,($4010) ; VARS : location of variables ld hl,($4014) ; E-Line is end of VARS sbc hl,de dec hl ; let's make it simple... ret z88dk-1.8.ds1/libsrc/zx81.lst0000644000175000017500000000721010763607603015330 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper input/spectrum/in_GetKey input/spectrum/in_GetKeyReset input/zx81/in_Inkey input/spectrum/in_JoyKeyboard input/zx81/in_KeyPressed input/zx81/in_keytranstbl input/zx81/in_LookupKey input/spectrum/in_MouseSim input/spectrum/in_MouseSim_callee input/spectrum/in_MouseSimInit input/spectrum/in_MouseSimInit_fastcall input/spectrum/in_MouseSimSetPos input/spectrum/in_MouseSimSetPos_callee input/spectrum/in_Pause input/spectrum/in_Wait input/spectrum/in_WaitForKey input/spectrum/in_WaitForNoKey input/zx81/INMouseSim stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/fseek stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/zx81/fgetc_cons stdio/fgets_cons stdio/zx81/getk stdio/puts_cons stdio/zx81/fputc_cons stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp time/zx81/clock setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf printflike/ltoa_any games/joystick zx81/cnvtab zx81/copytxt zx81/invtxt zx81/mirrortxt zx81/_clg_hr zx81/zx_basic_length.asm zx81/zx_getstr.asm zx81/zx_getstr_callee.asm zx81/zx_line.asm zx81/zx_setstr.asm zx81/zx_setstr_callee.asm zx81/zx_var_length.asm zx81/zx81toasc zx81/asctozx81 zx81/zx_ascii zx81/ascii_zx zx81/zx_asciimode zx81/zx_fast zx81/zx_slow z88dk-1.8.ds1/libsrc/zx81ansi.lst0000644000175000017500000000761510763607603016214 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper input/spectrum/in_GetKey input/spectrum/in_GetKeyReset input/zx81/in_Inkey input/spectrum/in_JoyKeyboard input/zx81/in_KeyPressed input/zx81/in_keytranstbl input/zx81/in_LookupKey input/spectrum/in_MouseSim input/spectrum/in_MouseSim_callee input/spectrum/in_MouseSimInit input/spectrum/in_MouseSimInit_fastcall input/spectrum/in_MouseSimSetPos input/spectrum/in_MouseSimSetPos_callee input/spectrum/in_Pause input/spectrum/in_Wait input/spectrum/in_WaitForKey input/spectrum/in_WaitForNoKey input/zx81/INMouseSim stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/fseek stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/zx81/fgetc_cons stdio/fgets_cons stdio/zx81/getk stdio/ansi/puts_cons stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/zx81/f_ansi_attr stdio/ansi/zx81/f_ansi_bel stdio/ansi/zx81/f_ansi_char stdio/ansi/zx81/f_ansi_cls stdio/ansi/zx81/f_ansi_dline stdio/ansi/zx81/f_ansi_scrollup stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp time/zx81/clock setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf printflike/ltoa_any games/joystick zx81/cnvtab zx81/copytxt zx81/invtxt zx81/mirrortxt zx81/_clg_hr zx81/zx_basic_length.asm zx81/zx_getstr.asm zx81/zx_getstr_callee.asm zx81/zx_line.asm zx81/zx_setstr.asm zx81/zx_setstr_callee.asm zx81/zx_var_length.asm zx81/zx81toasc zx81/asctozx81 zx81/zx_ascii zx81/ascii_zx zx81/zx_asciimode zx81/zx_fast zx81/zx_slow z88dk-1.8.ds1/libsrc/zxansi.lst0000644000175000017500000001731710763607603016043 0ustar tygrystygrysctype/isalpha ctype/isalnum ctype/isascii ctype/iscntrl ctype/isdigit ctype/isgraph ctype/islower ctype/isprint ctype/ispunct ctype/isspace ctype/isupper ctype/isxdigit ctype/toascii ctype/tolower ctype/toupper input/spectrum/in_GetKey input/spectrum/in_GetKeyReset input/spectrum/in_Inkey input/spectrum/in_JoyFuller input/spectrum/in_JoyKempston input/spectrum/in_JoyKeyboard input/spectrum/in_JoySinclair1 input/spectrum/in_JoySinclair2 input/spectrum/in_JoyTimex1 input/spectrum/in_JoyTimex2 input/spectrum/in_KeyPressed input/spectrum/in_keytranstbl input/spectrum/in_LookupKey input/spectrum/in_MouseAMX input/spectrum/in_MouseAMX_callee input/spectrum/in_MouseAMXInit input/spectrum/in_MouseAMXInit_callee input/spectrum/in_MouseAMXSetPos input/spectrum/in_MouseAMXSetPos_callee input/spectrum/in_MouseKemp input/spectrum/in_MouseKemp_callee input/spectrum/in_MouseKempInit input/spectrum/in_MouseKempSetPos input/spectrum/in_MouseKempSetPos_callee input/spectrum/in_MouseSim input/spectrum/in_MouseSim_callee input/spectrum/in_MouseSimInit input/spectrum/in_MouseSimInit_fastcall input/spectrum/in_MouseSimSetPos input/spectrum/in_MouseSimSetPos_callee input/spectrum/in_Pause input/spectrum/in_Wait input/spectrum/in_WaitForKey input/spectrum/in_WaitForNoKey input/spectrum/INMouseAMX input/spectrum/INMouseKemp input/spectrum/INMouseSim stdio/closeall stdio/fchkstd stdio/fclose stdio/feof stdio/fgetc stdio/fgetpos stdio/fgets stdio/fopen stdio/fopen_z88 stdio/fputc stdio/fputs stdio/fread stdio/freopen stdio/freopen_z88 stdio/fseek stdio/ftell stdio/fwrite stdio/gets stdio/vfprintf_mini stdio/printk stdio/printn stdio/puts stdio/ungetc stdio/fabandon stdio/spectrum/fgetc_cons stdio/fgets_cons stdio/ansi/f_ansi stdio/ansi/f_ansi_lf stdio/ansi/f_ansi_putc stdio/ansi/fputc_cons stdio/ansi/puts_cons stdio/ansi/f_ansi_dsr6 stdio/ansi/spectrum/f_ansi_attr stdio/ansi/spectrum/f_ansi_bel stdio/ansi/spectrum/f_ansi_char stdio/ansi/spectrum/f_ansi_cls stdio/ansi/spectrum/f_ansi_dline stdio/ansi/spectrum/f_ansi_scrollup stdio/spectrum/getk stdlib/abs stdlib/atexit stdlib/atoi stdlib/atol stdlib/bpeek stdlib/bpoke stdlib/bpoke_callee stdlib/delay stdlib/div stdlib/div_callee stdlib/exit stdlib/inp stdlib/itoa stdlib/itoa_callee stdlib/l_bsearch stdlib/l_bsearch_callee stdlib/l_qsort stdlib/l_qsort_callee stdlib/labs stdlib/labs_callee stdlib/Lbsearch stdlib/ldiv stdlib/ldiv_callee stdlib/Lqsort stdlib/ltoa stdlib/ltoa_callee stdlib/outp stdlib/outp_callee stdlib/rand stdlib/randomize stdlib/srand stdlib/strtol stdlib/strtol_callee stdlib/strtoul stdlib/swapendian stdlib/ultoa stdlib/ultoa_callee stdlib/utoa stdlib/utoa_callee stdlib/wpeek stdlib/wpoke stdlib/wpoke_callee stdlib/getopt stdlib/sleep strings/memchr strings/memcmp strings/memcpy strings/memmove strings/memopi strings/memopd strings/memops strings/memset strings/memswap strings/strcat strings/strchr strings/strcmp strings/strcpy strings/strcspn strings/stricmp strings/strlen strings/strlwr strings/strncat strings/strncmp strings/strncpy strings/strnicmp strings/strpbrk strings/strpos strings/strrchr strings/strrev strings/strrstr strings/strrstrip strings/strspn strings/strstr strings/strstrip strings/strtok strings/strupr strings/memchr_callee strings/memcmp_callee strings/memcpy_callee strings/memmove_callee strings/memopd_callee strings/memopi_callee strings/memset_callee strings/memswap_callee strings/strcat_callee strings/strchr_callee strings/strcmp_callee strings/strcpy_callee strings/strcspn_callee strings/stricmp_callee strings/strncat_callee strings/strncmp_callee strings/strncpy_callee strings/strnicmp_callee strings/strpbrk_callee strings/strpos_callee strings/strrchr_callee strings/strrstr_callee strings/strrstrip_callee strings/strspn_callee strings/strstr_callee strings/strstrip_callee strings/strtok_callee strings/bcmp strings/bcopy strings/bzero strings/index strings/rindex strings/strcasecmp strings/strncasecmp time/spectrum/clock setjmp/longjmp setjmp/setjmp assert/assert printflike/printf printflike/fprintf printflike/sprintf printflike/vfprintf_comp printflike/vfprintf_fp printflike/vsprintf printflike/itod printflike/itou printflike/itox printflike/utoi printflike/scanf printflike/sscanf printflike/fscanf printflike/vfscanf printflike/vsscanf graphics/circle graphics/spectrum/clg graphics/clga graphics/clrarea graphics/dcircle graphics/draw graphics/drawb graphics/drawr graphics/lbitmask graphics/lftscrol graphics/line graphics/liner graphics/lscroll graphics/plot graphics/plotpixl graphics/point graphics/pointxy graphics/multipoint graphics/rbitmask graphics/respixl graphics/rscroll graphics/uncircle graphics/undraw graphics/undrawb graphics/undrawr graphics/unplot graphics/drawbox graphics/setxy graphics/fill graphics/dfill graphics/getsprite graphics/spectrum/putsprite graphics/spectrum/bksave graphics/spectrum/bkrestore graphics/spectrum/rowtab graphics/spectrum/pixladdr2 graphics/spectrum/swapgfxbk graphics/xorborder graphics/xorplot graphics/xorpixl games/spectrum/joystick games/spectrum/bit_open games/spectrum/bit_open_di games/spectrum/bit_close games/spectrum/bit_close_ei games/bit_click games/bit_play games/bit_fx games/bit_fx2 games/bit_fx3 games/bit_fx4 games/bit_synth games/bit_frequency games/bit_beep games/spectrum/beeper spectrum/zx_attr spectrum/zx_attr_callee spectrum/zx_border spectrum/zx_break spectrum/zx_screenstr spectrum/zx_screenstr_callee spectrum/currah_detect spectrum/currah_direct spectrum/currah_speech spectrum/if1_checkblock spectrum/if1_checksum spectrum/if1_find_sector spectrum/if1_find_sector_map spectrum/if1_from_mdv spectrum/if1_getname spectrum/if1_init_file spectrum/if1_installed spectrum/if1_load_record spectrum/if1_load_sector spectrum/if1_mdv_status spectrum/if1_remove_file spectrum/if1_rommap spectrum/if1_setname spectrum/if1_touch_file spectrum/if1_update_map spectrum/if1_write_record spectrum/if1_write_sector spectrum/tape_load_block spectrum/tape_load_block_callee spectrum/tape_save_block spectrum/tape_save_block_callee spectrum/zx_128mode spectrum/zx_aaddr2cx spectrum/zx_aaddr2cy spectrum/zx_aaddr2px spectrum/zx_aaddr2py spectrum/zx_aaddr2saddr spectrum/zx_aaddrcdown spectrum/zx_aaddrcleft spectrum/zx_aaddrcright spectrum/zx_aaddrcup spectrum/zx_basemem spectrum/zx_basic_length spectrum/zx_cy2aaddr spectrum/zx_cy2saddr spectrum/zx_cyx2aaddr spectrum/zx_cyx2aaddr_callee spectrum/zx_cyx2saddr spectrum/zx_cyx2saddr_callee spectrum/zx_extsys spectrum/zx_floatingbus spectrum/zx_fullerstick spectrum/zx_getint spectrum/zx_getstr spectrum/zx_getstr_callee spectrum/zx_goto spectrum/zx_interface1 spectrum/zx_iss_stick spectrum/zx_issue3 spectrum/zx_kempston spectrum/zx_kempstonmouse spectrum/zx_locatenum spectrum/zx_mb02 spectrum/zx_model spectrum/zx_multiface spectrum/zx_plus3fdc spectrum/zx_printer spectrum/zx_pxy2aaddr spectrum/zx_pxy2aaddr_callee spectrum/zx_pxy2saddr spectrum/zx_pxy2saddr_callee spectrum/zx_py2aaddr spectrum/zx_py2saddr spectrum/zx_saddr2aaddr spectrum/zx_saddr2cx spectrum/zx_saddr2cy spectrum/zx_saddr2px spectrum/zx_saddr2px_callee spectrum/zx_saddr2py spectrum/zx_saddrcdown spectrum/zx_saddrcleft spectrum/zx_saddrcright spectrum/zx_saddrcup spectrum/zx_saddrpdown spectrum/zx_saddrpleft spectrum/zx_saddrpleft_callee spectrum/zx_saddrpright spectrum/zx_saddrpright_callee spectrum/zx_saddrpup spectrum/zx_setint spectrum/zx_setint_callee spectrum/zx_setstr spectrum/zx_setstr_callee spectrum/zx_soundchip spectrum/zx_syntax spectrum/zx_timexsound spectrum/zx_type spectrum/zx_var_length spectrum/tape_save spectrum/opus/opus_6116 spectrum/opus/opus_getblocks spectrum/opus/opus_getblocksize spectrum/opus/opus_lptread spectrum/opus/opus_lptwrite spectrum/opus/opus_rommap spectrum/opus/opus_testchannel spectrum/opus/opus_version spectrum/opus/set_kempston spectrum/opus/zx_opus spectrum/disciple/zx_disciple.asm printflike/ltoa_any z88dk-1.8.ds1/libsrc/zxmath/0000755000175000017500000000000010765202715015302 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/zxmath/acos.asm0000755000175000017500000000064007637546464016754 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 6/12/02 - Stefano Bodrato ; ; $Id: acos.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double acos(double) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB acos LIB fsetup1 LIB stkequ .acos call fsetup1 defb ZXFP_ACS defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/amax.asm0000755000175000017500000000116407637546464016757 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 7/12/02 - Stefano Bodrato ; ; $Id: amax.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double amax (double x,double y) ; ;returns the larger of x and y IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB amax LIB fsetup LIB stkequ .amax call fsetup defb ZXFP_NO_GRTR ; Not greater defb ZXFP_JUMP_TRUE ; Don't exchange defb 2 ; [offset to go over the next byte] defb ZXFP_EXCHANGE defb ZXFP_STK_FETCH ; take away the smaller no from stack defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/amin.asm0000755000175000017500000000115507637546464016755 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 7/12/02 - Stefano Bodrato ; ; $Id: amin.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double amin (double x,double y) ; ;returns the smaller of x and y IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB amin LIB fsetup LIB stkequ .amin call fsetup defb ZXFP_NO_LESS ; Not lesser defb ZXFP_JUMP_TRUE ; Don't exchange defb 2 ; [offset to go over the next byte] defb ZXFP_EXCHANGE defb ZXFP_STK_FETCH ; take away the smaller no from stack defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/asin.asm0000755000175000017500000000063607637546464016766 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 7/12/02 - Stefano Bodrato ; ; $Id: asin.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double asin(double) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB asin LIB fsetup1 LIB stkequ .asin call fsetup1 defb ZXFP_ASN defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/atan.asm0000755000175000017500000000063607637546464016757 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 7/12/02 - Stefano Bodrato ; ; $Id: atan.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double atan(double) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB atan LIB fsetup1 LIB stkequ .atan call fsetup1 defb ZXFP_ATN defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/atof.asm0000755000175000017500000000223607640542700016742 0ustar tygrystygrys; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: atof.asm,v 1.2 2003/03/27 09:34:56 stefano Exp $ ; ;double atof(char *) - convert string to number, leave in fa IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB atof LIB stkequ ;.casave defw 0 .atof pop hl pop de ;the string push de push hl ld hl,(ZXFP_CH_ADD) push hl .nobloop ld a,(de) ; load the first number digit in A cp ' ' ; skip spaces jr nz,noblank inc de jr nobloop .noblank cp '-' push af jr nz,noneg inc de ld a,(de) .noneg IF FORzx ELSE ld hl,txtbuffer push hl .nloop cp 0 jr z,converted sub 20 cp 26 jr nz,nodot ld a,27 .nodot ld (hl),a inc hl inc de ld a,(de) jr nloop .txtbuffer defs 15 .converted ld a,$76 ld (de),a pop de ld a,(de) ENDIF ld (ZXFP_CH_ADD),de ; Init the BASIC interpreter pointer call ZXFP_DEC_TO_FP ; ask BASIC to load the string into a number pop af jr nz,noneg1 rst ZXFP_BEGIN_CALC defb ZXFP_NEGATE defb ZXFP_END_CALC .noneg1 pop hl ld (ZXFP_CH_ADD),hl ; restore the pointer jp stkequ z88dk-1.8.ds1/libsrc/zxmath/ceil.asm0000755000175000017500000000075407637546464016751 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: ceil.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double ceil(double) ;Number in FA.. ; ;This is implemented as -(floor(-x)) IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB ceil LIB fsetup1 LIB stkequ .ceil call fsetup1 defb ZXFP_NEGATE defb ZXFP_INT defb ZXFP_NEGATE defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/cos.asm0000755000175000017500000000063207637546464016614 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: cos.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double cos(double) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB cos LIB fsetup1 LIB stkequ .cos call fsetup1 defb ZXFP_COS defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/cosh.asm0000755000175000017500000000120007637546464016754 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 21/03/03 - Stefano Bodrato ; ; $Id: cosh.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ; ;double cosh(double) ;Number in FA.. ; e = exp(x) ; ; return 0.5*(e+1.0/e) ; ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB cosh LIB fsetup1 LIB stkequ .cosh call fsetup1 defb ZXFP_EXP ; and at the beginning exp (x) defb ZXFP_DUPLICATE defb ZXFP_STK_ONE defb ZXFP_EXCHANGE defb ZXFP_DIVISION ; 1/e defb ZXFP_ADDITION defb ZXFP_STK_HALF defb ZXFP_MULTIPLY defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/dadd.asm0000755000175000017500000000057207637546464016727 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: dadd.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB dadd LIB fsetup LIB stkequ .dadd call fsetup defb ZXFP_ADDITION defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/ddiv.asm0000755000175000017500000000057207637546464016761 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: ddiv.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB ddiv LIB fsetup LIB stkequ .ddiv call fsetup defb ZXFP_DIVISION defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/deq.asm0000755000175000017500000000057410434663134016565 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: deq.asm,v 1.2 2006/05/23 19:45:32 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB deq LIB fsetup LIB f_yesno .deq call fsetup defb ZXFP_SUBTRACT defb ZXFP_NOT defb ZXFP_END_CALC jp f_yesnoz88dk-1.8.ds1/libsrc/zxmath/dge.asm0000755000175000017500000000061710434663134016551 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: dge.asm,v 1.2 2006/05/23 19:45:32 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB dge LIB fsetup LIB f_yesno .dge call fsetup defb ZXFP_SUBTRACT defb ZXFP_LESS_0 defb ZXFP_NOT defb ZXFP_END_CALC jp f_yesnoz88dk-1.8.ds1/libsrc/zxmath/dgt.asm0000755000175000017500000000060310434663134016563 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: dgt.asm,v 1.2 2006/05/23 19:45:32 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB dgt LIB fsetup LIB f_yesno .dgt call fsetup defb ZXFP_SUBTRACT defb ZXFP_GREATER_0 defb ZXFP_END_CALC jp f_yesnoz88dk-1.8.ds1/libsrc/zxmath/dleq.asm0000755000175000017500000000062510434663134016736 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: dleq.asm,v 1.2 2006/05/23 19:45:32 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB dleq LIB fsetup LIB f_yesno .dleq call fsetup defb ZXFP_SUBTRACT defb ZXFP_GREATER_0 defb ZXFP_NOT defb ZXFP_END_CALC jp f_yesnoz88dk-1.8.ds1/libsrc/zxmath/dlt.asm0000755000175000017500000000060010434663134016565 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: dlt.asm,v 1.2 2006/05/23 19:45:32 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB dlt LIB fsetup LIB f_yesno .dlt call fsetup defb ZXFP_SUBTRACT defb ZXFP_LESS_0 defb ZXFP_END_CALC jp f_yesnoz88dk-1.8.ds1/libsrc/zxmath/dmul.asm0000755000175000017500000000057207637546464016774 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: dmul.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB dmul LIB fsetup LIB stkequ .dmul call fsetup defb ZXFP_MULTIPLY defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/dne.asm0000755000175000017500000000061410435120252016543 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: dne.asm,v 1.2 2006/05/24 18:06:34 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB dne LIB fsetup LIB f_yesno .dne call fsetup defb ZXFP_SUBTRACT defb ZXFP_NOT defb ZXFP_NOT defb ZXFP_END_CALC jp f_yesnoz88dk-1.8.ds1/libsrc/zxmath/dsub.asm0000755000175000017500000000057207637546464016770 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: dsub.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB dsub LIB fsetup LIB stkequ .dsub call fsetup defb ZXFP_SUBTRACT defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/dswap.asm0000755000175000017500000000105307637546464017144 0ustar tygrystygrys; ; ZX Maths Routines ; ; Borrowed from the Generic Floating Point Math Library ; ; Exchange FA with top of stack (under ret address) ; ; $Id: dswap.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ XLIB dswap LIB ldfabc XREF dpush .DSWAP POP HL ;return addr POP DE POP IX POP BC EXX ;protect the values CALL DPUSH ;push FA EXX ;recover the values PUSH HL ;replace return addr, fall into... jp ldfabc z88dk-1.8.ds1/libsrc/zxmath/exp.asm0000755000175000017500000000063307637546464016625 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: exp.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double exp(double) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB exp LIB fsetup1 LIB stkequ .exp call fsetup1 defb ZXFP_EXP defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/f_yesno.asm0000755000175000017500000000071010434663134017446 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 23/05/06 - Stefano Bodrato ; ; $Id: f_yesno.asm,v 1.1 2006/05/23 19:45:32 stefano Exp $ ; ; Support for boolean - save some byte IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB f_yesno .f_yesno call ZXFP_FP_TO_BC IF FORzx ld h,b ld l,c ELSE ld h,c ld l,b ENDIF xor a or l ret z ;sets nc scf ret z88dk-1.8.ds1/libsrc/zxmath/fabs.asm0000755000175000017500000000063607637546464016747 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: fabs.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double fabs(double) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB fabs LIB fsetup1 LIB stkequ .fabs call fsetup1 defb ZXFP_ABS defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/float.asm0000755000175000017500000000265510434663134017123 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: float.asm,v 1.2 2006/05/23 19:45:32 stefano Exp $ ; ;Convert from integer to FP.. ;We could enter in here with a long in dehl, so, mod to compiler I think! ; Note: this could become much smaller (abt 100 bytes saved) if we avoid ; to use long datatypes; if so, just define TINYMODE. ; Stefano 23-05-2006 - now they are less than 100 bytes saved, got rid of the broken ; normalization and added a terrific, compact and slow 256*256*MSW+LSW formula ! ; ; For the Spectrum only a call to RESTACK will be used in stkequ for a real conversion ; (otherwise the ROM keeps the number coded as a 2 bytes word to optimize for speed). IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB float LIB stkequ .float IF TINYMODE ld b,h ld c,l bit 7,d ; is it negative ? push af call ZXFP_STACK_BC pop af jr z,nointneg rst ZXFP_BEGIN_CALC defb ZXFP_negate defb ZXFP_END_CALC .nointneg ELSE ld b,h ld c,l bit 7,d ; is it negative ? push af ld a,127 and d ld d,a push de call ZXFP_STACK_BC ; LSW pop bc call ZXFP_STACK_BC ; MSW ld bc,256 push bc call ZXFP_STACK_BC pop bc call ZXFP_STACK_BC rst ZXFP_BEGIN_CALC defb ZXFP_MULTIPLY defb ZXFP_MULTIPLY defb ZXFP_ADDITION defb ZXFP_END_CALC pop af jr z,nointneg rst ZXFP_BEGIN_CALC defb ZXFP_negate defb ZXFP_END_CALC .nointneg ENDIF jp stkequ z88dk-1.8.ds1/libsrc/zxmath/floor.asm0000755000175000017500000000064407637546464017154 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: floor.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double floor(double) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB floor LIB fsetup1 LIB stkequ .floor call fsetup1 defb ZXFP_INT defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/fmod.asm0000755000175000017500000000063607637546464016761 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: fmod.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double fmod(n,m) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB fmod LIB fsetup LIB stkequ .fmod call fsetup defb ZXFP_N_MOD_M defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/fsetup.asm0000755000175000017500000000134407637546464017337 0ustar tygrystygrys; ; ZX Maths Routines ; ; 6/12/02 - Stefano Bodrato ; ; $Id: fsetup.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ; Set up the registers for our operation ; Peeks the parameter from stack IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB fsetup LIB fsetup1 .fsetup ld hl,9 ; 4 (ret locations) + 5 (mantissa) add hl,sp ;ret to this function and ret to code ld a,(hl) dec hl ld e,(hl) dec hl ld d,(hl) dec hl ld c,(hl) dec hl ld b,(hl) ; load in the FP calculator stack call ZXFP_STK_STORE pop hl ; save the locatrions for ret pop de pop bc ; get rid of fp number pop bc pop bc push de ; restore the locatrions for ret push hl jp fsetup1 z88dk-1.8.ds1/libsrc/zxmath/fsetup1.asm0000755000175000017500000000100407637546464017411 0ustar tygrystygrys; ; ZX Maths Routines ; ; 6/12/02 - Stefano Bodrato ; ; $Id: fsetup1.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ; Set up the registers for our operation ; Peeks the parameter from FA IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB fsetup1 XREF fa .fsetup1 ld hl,fa+5 ld a,(hl) dec hl ld e,(hl) dec hl ld d,(hl) dec hl ld c,(hl) dec hl ld b,(hl) ; load in the FP calculator stack call ZXFP_STK_STORE jp ZXFP_BEGIN_CALC z88dk-1.8.ds1/libsrc/zxmath/fsetupf.asm0000755000175000017500000000113407637546464017502 0ustar tygrystygrys; ; ZX Maths Routines ; ; 30/12/02 - Stefano Bodrato ; ; $Id: fsetupf.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ; Set up the registers for our operation ; Peeks the parameter from stack: C parameter passing mode ; used by pow only, for now. Maybe atan2 in the future. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB fsetupf LIB fsetup1 .fsetupf ld hl,15 add hl,sp ld a,(hl) dec hl ld e,(hl) dec hl ld d,(hl) dec hl ld c,(hl) dec hl ld b,(hl) ; load in the FP calculator stack call ZXFP_STK_STORE jp fsetup1 z88dk-1.8.ds1/libsrc/zxmath/ftoa.asm0000755000175000017500000000344207640542700016742 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: ftoa.asm,v 1.2 2003/03/27 09:34:56 stefano Exp $ ; ; ;void ftoa(x,prec,str) -> Convert double to string ; ;double x ; /* number to be converted */ ;int prec ; /* # digits after decimal place */ ;char *str ; /* output string */ ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB ftoa .ftoa ld hl,2 add hl,sp ld e,(hl) ; buffer inc hl ld d,(hl) inc hl ld c,(hl) ; precision inc hl ld b,(hl) if TINYMODE ; we cut away the precision handling ELSE push hl push de call ZXFP_STACK_BC ; put precision on stack pop de pop hl ENDIF push de inc hl inc hl ld b,(hl) ; float inc hl ld c,(hl) inc hl ld d,(hl) inc hl ld e,(hl) inc hl ld a,(hl) bit 7,e push af ; keep sign res 7,e ; load in the FP calculator stack call ZXFP_STK_STORE if TINYMODE ; we cut away the precision handling ELSE rst ZXFP_BEGIN_CALC ; truncating stuff... defb ZXFP_EXCHANGE defb ZXFP_STK_TEN defb ZXFP_EXCHANGE defb ZXFP_TO_POWER defb ZXFP_ST_MEM_0 defb ZXFP_EXCHANGE defb ZXFP_MULTIPLY ; defb ZXFP_INT ; INT (x*(10^precision)) defb ZXFP_GET_MEM_0 defb ZXFP_DIVISION ; total/(10^precision) defb ZXFP_END_CALC ENDIF pop af ; now, if needed, negate the nuber jr z,noneg rst ZXFP_BEGIN_CALC defb ZXFP_NEGATE defb ZXFP_END_CALC .noneg rst ZXFP_BEGIN_CALC ; Do the string conversion ! defb ZXFP_STRS defb ZXFP_END_CALC call ZXFP_STK_FETCH ex de,hl pop de IF FORzx ldir ret ELSE .nloop ld a,(hl) cp $76 ret z add 20 cp 42 jr nz,nodash ld a,'-' .nodash cp 47 jr nz,nodot ld a,'.' .nodot ld (de),a inc hl inc de jr nloop ENDIF z88dk-1.8.ds1/libsrc/zxmath/ftoe.asm0000755000175000017500000000032707637546464016766 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 12/12/02 - Stefano Bodrato ; ; $Id: ftoe.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ; ; Just a dirty placeholder.. :oP XLIB ftoe LIB ftoa .ftoe jp ftoa z88dk-1.8.ds1/libsrc/zxmath/ifix.asm0000755000175000017500000000462007637546464016770 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 9/12/02 - Stefano Bodrato ; ; $Id: ifix.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ; Convert fp in FA to a long or an integer (if in tiny mode) ; DEHL keeps the value, CARRY has the overflow bit IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB ifix .ifix ; If you want to get rid of the long support, define "TINYMODE". ; I wouldn't suggest it if you have 16K it because only ; 109 bytes with ifix and about the same with "float" are saved. ; So I'll define this mode on the ZX81 only. IF TINYMODE LIB fsetup1 call fsetup1 defb ZXFP_END_CALC call ZXFP_FP_TO_BC ld h,b ld l,c ret ELSE XREF fa LIB l_long_neg ;call fsetup1 ;defb ZXFP_END_CALC ;CALL ZXFP_STK_FETCH ; exponent to A ; ; mantissa to EDCB. ;; ### let's optimize a bit for speed... ### ld hl,fa+5 ld a,(hl) dec hl ld e,(hl) dec hl ld d,(hl) dec hl ld c,(hl) dec hl ld b,(hl) ;; #################################### AND A ; test for value zero. JR NZ,nonzero LD D,A ; zero to D LD E,A ; also to E LD H,A ; also to H LD L,A ; also to L .nonzero ; --- ; EDCB => DEHL ;( EDCB => BCE) push af ld l,b ld h,c ld a,e ld e,d ld d,a pop af sub @10100001 ; subtract 131072 (@10100001) ; was: 65536 (@10010001) CCF ; complement carry flag BIT 7,D ; test sign bit PUSH AF ; push the result SET 7,D ; set the implied bit jr c,doexit ; Too big ! INC A ; increment the exponent and NEG ; negate to make range $00 - $0F CP 32 ; test if four bytes JR C,bigint .byroll ld l,h ; Roll mantissa 8 bits -> right ld h,e ld e,d ld d,0 sub 8 cp 8 jr nc,byroll .bigint and a ; Have we normalized? ; (fractionals) ld c,a ; save exponent in C ld a,l rlca ; rotate most significant bit to carry for ; rounding of an already normal number. jr z,expzero ;; FPBC-NORM .biroll ; Still not, do the bit shifting srl d ; 0->76543210->C rr e ; C->76543210->C rr h ; C->76543210->C rr l ; C->76543210->C dec c ; decrement exponent jr nz,biroll .expzero jr nc,doexit ld bc,1 ; round up add hl,bc ; increment lower pair jr nc,nocround inc de ; inc upper pair if needed .nocround ld a,d ; test result for zero or e or h or l jr nz,doexit pop af scf ; set carry flag to indicate overflow push af .doexit pop af call nz,l_long_neg ; Negate if negative .noneg ret ENDIF z88dk-1.8.ds1/libsrc/zxmath/ldbcfa.asm0000755000175000017500000000026510753010311017207 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; bc ix de = FA XLIB ldbcfa XREF fa .LDBCFA LD DE,(FA) LD IX,(FA+2) LD BC,(FA+4) RET z88dk-1.8.ds1/libsrc/zxmath/ldbchl.asm0000755000175000017500000000064510753010311017226 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; bc ix de = (hl) XLIB ldbchl .ldbchl ld e,(hl) inc hl ld d,(hl) inc hl ld c,(hl) defb $dd ld l,c inc hl ld c,(hl) defb $dd ld h,c inc hl ld c,(hl) inc hl ld b,(hl) inc hl ret z88dk-1.8.ds1/libsrc/zxmath/ldfabc.asm0000755000175000017500000000026410753010311017206 0ustar tygrystygrys; ; Z88dk Generic Floating Point Math Library ; ; FA = bc ix de XLIB ldfabc XREF fa .LDFABC LD (FA),DE LD (FA+2),IX LD (FA+4),BC RET z88dk-1.8.ds1/libsrc/zxmath/log.asm0000755000175000017500000000065407637546464016615 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 10/12/02 - Stefano Bodrato ; ; $Id: log.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double log(double) - natural log ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB log LIB fsetup1 LIB stkequ .log call fsetup1 defb ZXFP_LN defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/log10.asm0000755000175000017500000000076207637546464016756 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 10/12/02 - Stefano Bodrato ; ; $Id: log10.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double log10(double) -- 1/ln(10) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB log10 LIB fsetup1 LIB stkequ .log10 call fsetup1 defb ZXFP_STK_TEN defb ZXFP_LN defb ZXFP_STK_ONE defb ZXFP_DIVISION defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/Makefile0000755000175000017500000000112210701364771016742 0ustar tygrystygrys# # ZX ROM FP math Makefile # $Id: Makefile,v 1.7 2007/10/05 07:38:33 stefano Exp $ # include ../Make.config all: mzx_tiny m81_tiny mzx m81 mzx_tiny: rm -f *.o* ../mzx_tiny.lib $(LIBLINKER) -DFORzx -DTINYMODE -x../$(OUTPUT_DIRECTORY)/mzx_tiny @zxmlist m81_tiny: rm -f *.o* ../m81_tiny.lib $(LIBLINKER) -DFORzx81 -DTINYMODE -x../$(OUTPUT_DIRECTORY)/m81_tiny @zxmlist mzx: rm -f *.o* ../mzx.lib $(LIBLINKER) -DFORzx -x../$(OUTPUT_DIRECTORY)/mzx @zxmlist m81: rm -f *.o* ../m81.lib $(LIBLINKER) -DFORzx81 -x../$(OUTPUT_DIRECTORY)/m81 @zxmlist clean: rm -f *.o* *.sym *.map *.err z88dk-1.8.ds1/libsrc/zxmath/minusfa.asm0000755000175000017500000000143507637546464017474 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 8/1/03 - Stefano Bodrato ; ; $Id: minusfa.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ; Negate a floating point number ; ; Strangely the generic minusfa function doesn't do the job for me ! ; I had to write this small function, but this means that probably ; this FP format differs slightly from the generic one ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB minusfa XREF fa .MINUSFA LD HL,FA+4 LD A,(HL) XOR $80 LD (HL),A RET ; XLIB minusfa ; ; LIB fsetup1 ; LIB stkequ ; ;.minusfa ; call fsetup1 ; defb ZXFP_NEGATE ; defb ZXFP_END_CALC ; jp stkequ ; z88dk-1.8.ds1/libsrc/zxmath/pow.asm0000755000175000017500000000071207637546464016634 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 8/12/02 - Stefano Bodrato ; ; $Id: pow.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double pow(double x,double y) ;y is in the FA ;x is on the stack +8 (+2=y) ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB pow LIB fsetupf LIB stkequ .pow call fsetupf defb ZXFP_TO_POWER defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/README0000755000175000017500000000164407637546464016212 0ustar tygrystygrys$Id: README,v 1.1 2003/03/24 09:17:40 stefano Exp $ ZX ROM based math library - Stefano Bodrato - 24/3/2003 *** WARNING: the ZX81 stuff is still broken *** This is a first release of the library, just to put my work in a safe place :o) It is much smaller than the default library but slower and slightly less complete. The "TINYMODE" flag cuts away the long integers handling and the precision parameter handling of the atof function (BTW no leading zeroes are put even if you prefer the full version). I think that this stuff can be useful for the following: - Make the FP math stuff work on the ZX81 (in the future.. I hope!) - Being a reference for future math libraries on other platforms. - Document the similarities between the ZX81 and the Spectrum, and give the guidelines to use the FP calculator on a ZX machine (see /lib/zxfp.def, /lib/81fp.def, sinh.asm, cosh.asm and tanh.asm). - Save memory z88dk-1.8.ds1/libsrc/zxmath/sin.asm0000755000175000017500000000063407637546464016623 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 10/12/02 - Stefano Bodrato ; ; $Id: sin.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double cos(double) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB sin LIB fsetup1 LIB stkequ .sin call fsetup1 defb ZXFP_SIN defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/sinh.asm0000755000175000017500000000124707637546464016774 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 21/03/03 - Stefano Bodrato ; ; $Id: sinh.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double sinh(double) ; e = exp(x) ; ; return ((e-1.0/e)/2) ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB sinh LIB fsetup1 LIB stkequ .sinh call fsetup1 defb ZXFP_EXP ; and at the beginning exp (x) defb ZXFP_DUPLICATE defb ZXFP_STK_ONE defb ZXFP_EXCHANGE defb ZXFP_DIVISION ; 1/e defb ZXFP_SUBTRACT defb ZXFP_STK_ONE ; STK_TWO :o) defb ZXFP_STK_ONE defb ZXFP_ADDITION defb ZXFP_DIVISION defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/sqrt.asm0000755000175000017500000000064207637546464017022 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 10/12/02 - Stefano Bodrato ; ; $Id: sqrt.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double sqrt(double) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB sqrt LIB fsetup1 LIB stkequ .sqrt call fsetup1 defb ZXFP_SQR defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/stkequ.asm0000755000175000017500000000151307637546464017343 0ustar tygrystygrys; ; ZX Maths Routines ; ; 10/12/02 - Stefano Bodrato ; ; $Id: stkequ.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ; Equalise the ZX FP stack and put the calculated value into FA ; the "real" stack has been already fixed in fsetup. ; XLIB stkequ XREF fa IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF .stkequ ; These three lines are for the ZX Spectrum only: ; if integer, then force the conversion to float. ; HL is updated by the ROM. rst ZXFP_BEGIN_CALC IF FORzx defb ZXFP_RE_STACK ENDIF defb ZXFP_END_CALC ; Now HL points to the float on the FP stack ; Copy in "fa" the result ld (ZXFP_STK_PTR),hl ;update the FP stack pointer (equalise) ld a,(hl) ;exponent ld de,fa+5 ld (de),a inc hl dec de ld b,4 .bloop2 ld a,(hl) ld (de),a inc hl dec de djnz bloop2 ret z88dk-1.8.ds1/libsrc/zxmath/tan.asm0000755000175000017500000000063407637546464016614 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 10/12/02 - Stefano Bodrato ; ; $Id: tan.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double tan(double) ;Number in FA.. IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB tan LIB fsetup1 LIB stkequ .tan call fsetup1 defb ZXFP_TAN defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/tanh.asm0000755000175000017500000000153507637546464016765 0ustar tygrystygrys; ; ; ZX Maths Routines ; ; 21/03/03 - Stefano Bodrato ; ; ; $Id: tanh.asm,v 1.1 2003/03/24 09:17:40 stefano Exp $ ; ;double tanh(double) ; e = exp(x) ; ; return (e-1.0/e)/(e+1.0/e) ; IF FORzx INCLUDE "#zxfp.def" ELSE INCLUDE "#81fp.def" ENDIF XLIB tanh LIB fsetup1 LIB stkequ .tanh call fsetup1 defb ZXFP_EXP ; and at the beginning exp (x) defb ZXFP_ST_MEM_0 defb ZXFP_STK_ONE defb ZXFP_EXCHANGE defb ZXFP_DIVISION ; 1/e defb ZXFP_DUPLICATE defb ZXFP_GET_MEM_0 defb ZXFP_ADDITION defb ZXFP_EXCHANGE defb ZXFP_GET_MEM_0 defb ZXFP_EXCHANGE defb ZXFP_SUBTRACT defb ZXFP_EXCHANGE ; This might be slightly optimized, maybe, but watch out.. ; test it deeply with positive and negative values ! defb ZXFP_DIVISION defb ZXFP_END_CALC jp stkequ z88dk-1.8.ds1/libsrc/zxmath/ufloat.asm0000755000175000017500000000143707637546464017326 0ustar tygrystygrys; ; ; Z88 Maths Routines ; ; C Interface for Small C+ Compiler ; ; 7/12/98 djm ;Convert from integer to FP.. ;We could enter in here with a long in dehl, so, mod to compiler I think! INCLUDE "#fpp.def" XLIB ufloat XREF fa .ufloat push de ;msb exx pop hl ld c,0 ;no exponent ld a,h push af res 7,h fpp(FP_FLT) pop af rlca jr nc,ufloat_out ;no high bit ;to multiply by two, increment the exponent inc c .ufloat_out ld (fa+3),hl ld a,c ld (fa+5),a exx ld (fa+1),hl xor a ld (fa),a ret z88dk-1.8.ds1/libsrc/zxmath/zxmlist0000755000175000017500000000036710753010311016732 0ustar tygrystygrysacos amax amin asin atan atof ceil cos cosh dadd ddiv deq dge dgt dleq dlt dne dmul dsub dswap exp f_yesno fabs float floor fmod fsetup fsetupf fsetup1 ftoa ftoe ifix ldbcfa ldbchl ldfabc log10 log minusfa pow sin sinh sqrt stkequ tan tanh ufloat z88dk-1.8.ds1/libsrc/zxvgs/0000755000175000017500000000000010765202715015150 5ustar tygrystygrysz88dk-1.8.ds1/libsrc/zxvgs/bnkfree.asm0000644000175000017500000000025407637071251017272 0ustar tygrystygrys;ZXVGS specific functions ;020128 (C) created by Yarek XLIB bnkfree ;int bnkfree() ;returns number of free memory banks .bnkfree RST 8 DEFB $BF LD L,A LD H,0 RET z88dk-1.8.ds1/libsrc/zxvgs/j0.asm0000644000175000017500000000025407637071251016167 0ustar tygrystygrys;ZXVGS specific functions ;020121 (C) created by Yarek XLIB j0 ;int j0() ;returns joystick 0 state .j0 RST 8 DEFB $80 LD L,A LD H,0 ;does H have any matter? RET z88dk-1.8.ds1/libsrc/zxvgs/j1.asm0000644000175000017500000000025407637071251016170 0ustar tygrystygrys;ZXVGS specific functions ;020121 (C) created by Yarek XLIB j1 ;int j1() ;returns joystick 1 state .j1 RST 8 DEFB $81 LD L,A LD H,0 ;does H have any matter? RET z88dk-1.8.ds1/libsrc/zxvgs/j2.asm0000644000175000017500000000025407637071251016171 0ustar tygrystygrys;ZXVGS specific functions ;020121 (C) created by Yarek XLIB j2 ;int j2() ;returns joystick 2 state .j2 RST 8 DEFB $82 LD L,A LD H,0 ;does H have any matter? RET z88dk-1.8.ds1/libsrc/zxvgs/j3.asm0000644000175000017500000000025407637071251016172 0ustar tygrystygrys;ZXVGS specific functions ;020121 (C) created by Yarek XLIB j3 ;int j3() ;returns joystick 3 state .j3 RST 8 DEFB $83 LD L,A LD H,0 ;does H have any matter? RET z88dk-1.8.ds1/libsrc/zxvgs/loadany.asm0000644000175000017500000000042107637071251017301 0ustar tygrystygrys;ZXVGS specific functions ;020121 (C) created by Yarek XLIB loadany ;int loadany(char *name, int adr, int len) ;returns 0 if OK .loadany POP AF ;return address POP BC POP HL POP DE PUSH DE PUSH HL PUSH BC PUSH AF RST 8 DEFB $EC AND $7F LD L,A LD H,0 RET z88dk-1.8.ds1/libsrc/zxvgs/Makefile0000755000175000017500000000022210445312214016576 0ustar tygrystygrys# # Wahey, a messed up makefile for building libraries! all: zxvgs zxvgs: @echo Nothing to do! clean: rm -f *.o* *.i *.sym *.map zcc_opt.def z88dk-1.8.ds1/libsrc/zxvgs/opensound.asm0000644000175000017500000000052007637071251017664 0ustar tygrystygrys;ZXVGS specific functions ;020128 created by Yarek XLIB opensound ;int opensound(int device,int mode) ;returns opened mode (0 means the device is closed) .opensound POP BC POP DE ;mode POP HL ;device PUSH HL PUSH DE PUSH BC LD D,L RST 8 DEFB $A5 LD L,E ;temporary for ZXVGS 0.29 ; LD L,A ;remove it later LD H,0 RET z88dk-1.8.ds1/libsrc/zxvgs/saveany.asm0000644000175000017500000000053607637071251017327 0ustar tygrystygrys;ZXVGS specific functions ;020122 now returns the number of saved bytes - 0 means error! ;020121 (C) created by Yarek XLIB saveany ;int saveany(char *name, int adr, int len) ;returns number of saved bytes .saveany POP AF ;return address POP BC POP HL POP DE PUSH DE PUSH HL PUSH BC PUSH AF RST 8 DEFB $ED AND $7F LD L,C LD H,B RET z88dk-1.8.ds1/libsrc/zxvgs.lst0000755000175000017500000000050407637306622015704 0ustar tygrystygryszxvgs/j0 zxvgs/j1 zxvgs/j2 zxvgs/j3 zxvgs/opensound zxvgs/bnkfree zxvgs/loadany zxvgs/saveany fcntl/zxvgs/close fcntl/zxvgs/lseek fcntl/zxvgs/fdtell fcntl/zxvgs/fdgetpos fcntl/zxvgs/open fcntl/zxvgs/open_z88 fcntl/zxvgs/remove fcntl/zxvgs/rename fcntl/zxvgs/write fcntl/zxvgs/read fcntl/zxvgs/readbyte fcntl/zxvgs/writebyte z88dk-1.8.ds1/LICENSE0000644000175000017500000001472707565745306013545 0ustar tygrystygrysUnless otherwise stated in the appropriate file, z88dk is distributed under the following license. The Clarified Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Distribution fee" is a fee you charge for providing a copy of this Package to another party. "Freely Available" means that no fee is charged for the right to use the item, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain, or those made Freely Available, or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major network archive site allowing unrestricted access to them, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. e) permit and encourge anyone who receives a copy of the modified Package permission to make your modifications Freely Available in some specific way. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. e) offer the machine-readable source of the Package, with your modifications, by mail order. 5. You may charge a distribution fee for any distribution of this Package. If you offer support for this Package, you may charge any fee you choose for that support. You may not charge a license fee for the right to use this Package itself. You may distribute this Package in aggregate with other (possibly commercial and possibly nonfree) programs as part of a larger (possibly commercial and possibly nonfree) software distribution, and charge license fees for other parts of that software distribution, provided that you do not advertise this Package as a product of your own. If the Package includes an interpreter, You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of the Standard Version of the Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End z88dk-1.8.ds1/Makefile0000644000175000017500000000671710762270413014161 0ustar tygrystygrys# # # The impromptu compilation makefile for z88dk # # $Id: Makefile,v 1.32 2008/03/01 15:06:51 dom Exp $ # # ---> Configurable parameters are below his point prefix = /usr/local prefix_share = $(prefix)/share # The default machine, the lib/config/DEFAULT.cfg file is copied to zcc.cfg DEFAULT = z88 # --> End of Configurable Options all: setup appmake copt zcpp sccz80 z80asm zcc config # setenv CC "dcc -unixrc -mC -mD" # make -e amiga amiga: clean-bins # Now build the Amiga binaries echo '#define PREFIX "zcc:"' > src/config.h echo '#define AMIGA 1' >> src/config.h mkdir -p z88dk/bin $(MAKE) -C src/appmake $(MAKE) -C src/appmake install PREFIX=`pwd`/z88dk $(MAKE) -C src/appmake clean $(MAKE) -C src/copt $(MAKE) -C src/copt install PREFIX=`pwd`/z88dk $(MAKE) -C src/copt clean $(MAKE) -C src/cpp $(MAKE) -C src/cpp install PREFIX=`pwd`/z88dk $(MAKE) -C src/cpp clean $(MAKE) -C src/sccz80 $(MAKE) -C src/sccz80 install PREFIX=`pwd`/z88dk $(MAKE) -C src/sccz80 clean $(MAKE) -C src/z80asm $(MAKE) -C src/z80asm install PREFIX=`pwd`/z88dk $(MAKE) -C src/z80asm clean $(MAKE) -C src/zcc $(MAKE) -C src/zcc install PREFIX=`pwd`/z88dk $(MAKE) -C src/zcc clean $(MAKE) -C libsrc clean ./config.sh zcc: z88 cp -R libsrc/ include/ lib/ examples/ doc/ support/ src/ z88dk/ cp amiga.patch EXTENSIONS LICENSE Makefile amigabuild.sh z88dk/ cp README.1st z88dk/ cd z88dk ; patch -p0 < amiga.patch setup: echo '#define PREFIX "${prefix}$"/lib/z88dk"' > src/config.h echo '#define UNIX 1' >> src/config.h appmake: $(MAKE) -C src/appmake $(MAKE) -C src/appmake PREFIX=`pwd` install copt: $(MAKE) -C src/copt $(MAKE) -C src/copt PREFIX=`pwd` install zcpp: $(MAKE) -C src/cpp $(MAKE) -C src/cpp PREFIX=`pwd` install sccz80: $(MAKE) -C src/sccz80 $(MAKE) -C src/sccz80 PREFIX=`pwd` install z80asm: echo 'Configure z80asm for ENDIAN status!!' $(MAKE) -C src/z80asm $(MAKE) -C src/z80asm PREFIX=`pwd` install zcc: $(MAKE) -C src/zcc $(MAKE) -C src/zcc PREFIX=`pwd` install config: ./config.sh `pwd`/ $(DEFAULT) libs: cd libsrc ; $(MAKE) cd libsrc ; $(MAKE) install install-libs: mkdir -p $(prefix)/lib/z88dk/lib/clibs cp -R lib/clibs/* $(prefix)/lib/z88dk/lib/clibs/ find $(prefix)/lib/z88dk/lib/clibs -type f | xargs chmod 644 install: mkdir -p -m 755 $(DESTDIR)/$(prefix)/bin $(DESTDIR)/$(prefix_share)/z88dk mkdir -p -m 755 $(DESTDIR)/$(prefix_share)/z88dk/lib mkdir -p -m 755 $(DESTDIR)/$(prefix_share)/z88dk/lib/clibs mkdir -p -m 755 $(DESTDIR)/$(prefix_share)/z88dk/lib/config cd src/appmake ; $(MAKE) PREFIX=$(DESTDIR)/$(prefix) install cd src/copt ; $(MAKE) PREFIX=$(DESTDIR)/$(prefix) install cd src/cpp ; $(MAKE) PREFIX=$(DESTDIR)/$(prefix) install cd src/sccz80 ; $(MAKE) PREFIX=$(DESTDIR)/$(prefix) install cd src/z80asm ; $(MAKE) PREFIX=$(DESTDIR)/$(prefix) install cd src/zcc ; $(MAKE) PREFIX=$(DESTDIR)/$(prefix) install ./config.sh $(prefix_share)/z88dk/ $(DEFAULT) cp -R -p include $(DESTDIR)/$(prefix_share)/z88dk cp -R -p lib $(DESTDIR)/$(prefix_share)/z88dk find $(DESTDIR)/$(prefix_share)/z88dk -type f -exec chmod 644 {} \; find $(DESTDIR)/$(prefix_share)/z88dk -type d -exec chmod 755 {} \; clean: clean-bins cd libsrc ; $(MAKE) clean cd lib/config ; $(RM) *.cfg cd lib/clibs ; $(RM) *.lib find . -name "*.o" -type f -exec rm -f {} \; clean-bins: cd src/appmake ; $(MAKE) clean cd src/copt ; $(MAKE) clean cd src/cpp ; $(MAKE) clean cd src/sccz80 ; $(MAKE) clean cd src/z80asm ; $(MAKE) clean cd src/zcc ; $(MAKE) clean z88dk-1.8.ds1/README.1st0000644000175000017500000003525510762275310014107 0ustar tygrystygrysz88dk - v1.8 XX Mar 2008 ======================== z88dk is a Z80 cross compiler producing binaries for over 20 different z80 based machines. Binaries are supplied for Win32,Amiga and Solaris platforms. This file contains basic install instructions and a guide to compilation of the system for those systems without a binary kit prepared. Binary Kit Instructions ======================= Win32 ----- Run the installer. Source Code Installation ======================== There are two modes of operation for z88dk - within a users home directory and installed on a system wide basis. Preparation ----------- If your compiler is not gcc, ensure that the correct machine type is defined in src/z80asm/config.h and that the ENDIAN status is set accordingly - if you are using gcc on unix machines (including MacOS X) then this will be automatically defined. System wide install ------------------- There's a certain degree of bootstrapping required - here's the procedure for a standard install on UNIX (ensure that you have root permissions). Where make is mentioned, this refers to GNU make. 1. Run ./build.sh - this will build the z88dk system in situ 2. make install 3. make libs 4. make install-libs With a bit of luck z88dk should be installed in /usr/local with important files in /usr/local/lib/z88dk Home Directory Install ---------------------- Before compiling setup the variables Z80_OZFILES to point to {z88dk}/lib/ and ZCCCFG to point to {z88dk}/lib/config/ (Trailing slashes are important!). Additionally add {z88dk}/bin to your path. 1. Type ./build.sh You should be ready to go! --8<-- CHANGES (brief) z88dkv1.8 XX.3.2008 - [sccz80] Bug fixes - [cpp] DATE directive now outputs the date in a sensible format - [lib] crt0: Different versions of the library are built to avoid index registers or alternate registers depending on the target - [lib] A simple Xlib emulation has been imported and is available to ports with graphics capabilities - [lib] CPC: Stability improvements - [lib] ZX: Direct access to Opus Discovery is available - [lib] ZX81: Stability improvements - [lib] ZX81: High Res graphics are available - [lib] ZX81: SP1 sprite ackage support - [lib] TS2068: SP1 sprite package support - [lib] Newbrain: fcntl support - [lib] MSX: Improved support - [lib] MSX: 1 bit sound - [lib] ABC80: graphics - [lib] TEST: New test target for supporting a testing infrastructure z88dkv1.7 15.7.2007 - [sccz80] Bug fixes, tweaks to single parameter function pointer calls - [z80asm] Z80asm supporting Rabbit - [zcpp] End of file fix for win32 - [zcc] -Cz flag to pass through to appmake - [appmake] Support for most z88dk targets - [lib/crt0] Support for Newbrain, Rabbit, Sega Master System SMS, TS2068 - [lib] Much of the library rewritten to use FASTCALL and CALLEE linkage for faster and small library function calls - [lib] malloc library can now allocate from a scattered map of available RAM and supports multiple heaps - [lib] balloc library introduced as a block memory allocator - [lib] interrupt mode 2 library added - [lib] stdlib and strings now completely implemented in assembler and expanded - [lib] abstract data types library introduced initially containing linked list, heap, stack and queue algorithms library begun initially containing an implementation of the A* search algorithm - [lib] ZX Spectrum : SZX basic fcntl driver - [lib] ZX Spectrum : SP1 software sprite engine added - [lib] ZX Spectrum : Improved Spectrum library includes new display functions - [lib] ZX Spectrum : Input library added for direct access to keyboard, joystick and mouse devices z88dkv1.5 16.12.2002 - [sccz80] Optimizations for if/while statements - [sccz80] Many, many bugfixes - [support] ar clone to view the contents of library files - [libs] Many new machines added - [libs] 3 ports now support command line arguments Basically about 18 months of changes! z88dkv1.33 (sccz80v1.10b72) 11.5.2001 - [sccz80] Many changes to #pragma directive - [sccz80] FP division now works! (Helps if I call fdiv instead of fmul!) - [zcpp] Should now understand various LF/CR conventions - [z80asm] Labels can now end in ':' and don't have to start with '.' - [z80asm] The options page is too long, so by default we just print version number, z80asm -h now displays the options - [include] Fixed the annoying csleep prototype problem - [libs] Added support for new machines from Stefano (MSX, SVI etc) - [libs] z88 now has ANSI terminal support - [libs] Untested Spectrum +3 file support - [libs] Xircom Rex support (untested) - mail me (dom) for the includes etc - [doc] Platforms.txt details what is suppported on which machine z88dkv1.32 (sccz80v1.10b71pre4) 6.2.2001 - [sccz80] Fixed long pointer arithmetic - [sccz80] Added int blah @ nnnn type as alternative (and better implemented) version of int blah (nnnn) - [sccz80] Added ability for FP constants to be evaluated at run time - [sccz80] Got rid of *annoying* int<->ptr warning when calling func with difference between two pointers - [zcc] Add -Cp flag to pass through to frontend (for GNU cpp purposes) - [zcc] Added -Ca flag to pass through to assembler - [z80asm] INVOKE opcode for ti calcs - [libs] Added z80s183_crt0.lib (minor change in l_long_case) - [libs] Added Stefano's TI calc support routines - [libs] Fixed things so that compilation is possible - [opt] More rules in level 3 and fixed some as well z88dkv1.31 (sccz80v1.10b71) 3.7.2000 - [sccz80] __SHARED__ no longer implies __LIB__ - [sccz80] long arithmetics sorted out (const on LHS etc) - [sccz80] *argv[{n}] now gets correct offset for near (but not far) types - [libs] strtol fixed - [libs] Fixed open_z88 (ooops!) - [libs/crt0] new support for CP/M, ZX81, Sharp MZ, TI86, ABC80 z88dkv1.3 (sccz80v1.10b70) 20.4.2000 - [sccz80] Long subtraction bug (finally!) fixed - [sccz80] Sane initialisation of auto variables - [sccz80] Little bit of framepointer support (-frameix/-frameiy) - [sccz80] far xx ** type correctly passed to function - [sccz80] unions can now be initialised (first member taken +pad) - [sccz80] stack cleaning on goto fixed - [sccz80/crt0] Improved printf handling [2] - [zcc] Improved config file handling - [lib] new stdio library (see doc/stdio.txt for details) - [lib] new z88 far functions (by Garry Lancaster) - [lib] strncmp finally fixed - [lib] strncpy finally usable - [lib] strchr/strrchr rewritten in asm - [lib] ZX print routine now scrolls - [lib] Start of +3 file routines (not usable at present) - [lib] z88 time routines (untested) - [lib] z88 DOR routines - [lib] z88 stat() routine (check for sanity someone please!) - [lib] fopen_z88/open_z88 to return explicit filename being opened - [lib] z88 wildcard handler routines - [lib] z88 exec_cli routine - [lib] Spectrum ANSI display routine (by Stefano Bodrato) - [lib] Most gfx routines now work on Spectrum - [lib/crt0] VZ200/300 libs and crt0 (by Stefano Bodrato) - [lib/crt0] NC100/200 libs and crt0 - untested (send me one!!) - [inc] getchar() macro added for getkey() - [egs] Artic Adventure A added for ZX (and z88) [1] Handling for ** types is quite flakey in prototypes - I just store the fact that it's a pointer and not a pointer to pointer. Fixing this would require extra storage so it's being left [2] Printf handling has improved greatly with this release - previously it was possible to end up with both sets of printf() functions within the executable, now only one is possible, this is done by having the crt0 file jp to the chosen vfprintf function. These escalate upwards so here's what they can do (in order of complexity): vfprintf_mini - supports %d,u,s,c,%,ld,lu fields vfprintf_comp - supports width specifiers and %d,x,c,s,u,% fields vfprintf_float - As above but with floating point (%e etc), only generic, untested Once a complexity escalation has been made within a project then it's not possible to undo - i.e. if you want to printf longs then don't specify a width anywhere within the project. Sorry, but until I/someone upgrades vfprintf_(comp|float) this limitation will remain. z88dkv1.2p5 (sccz80v1.10b69) xx.3.2000 - z80asm patched so it now accepts '_' as first letter of symbol - Hence the smc_ prefix is now consigned to history - Archaic and obsolete HDRPRTYPE kludge removed - Long standing bug removed in function prototypes - Miniprintf now understands %u, %ld, %lu types - ZSock API & doc distributed - Package support (both utilisation and creation) - More library routines are in C (more efficient than mildly optimised!) - Arrays of pointers to functions now supported - ANSI compliance! Well, in literal escapes at least! - assert.h, setjmp.h features now available - stdarg.h - variadic arguments supported - see note in stdarg.h for caveats - Improved Spectrum library - 32/64 column font routine now usable sccz80v1.10b67 - iferror { } else { } now evaluates first clause(!) - Output in asxx compatible format (Flag=-asxx) - if (always true) bug fixed - Unreachable code warning following above - __CALLEE__ function flag (ask me!) - Internal flag rearrangement - Casts patched up a bit more - Stupid mistake in appmake sorted.. sccz80v1.10b66 - Sorted out coping with initialising xx *[]={ ,, } types - Warnings if these are left empty - Sorted out L,U,S specifiers after constants - Default to int type for wild auto/register defns - Support for #line (supplied by some pre-processors) instead of # - Initialising of auto variables is now supported (not arrays or structs!!!) sccz80v1.10b65 - Added octal parsing for constants (prefix with 0) - Sorted out goto problems (tags now stored on global stack) - Typdef-ing stucts which contain pointers no longer gives out (incorrect) warning z88dkv1.2p3 (sccz80v1.10b64) - Fixed broken compiler (postincrement of structure pointers) - Improved compiler (l_mult no longer pushs/pop de) - More opt rules + fixes - Some mem* routines (see string.h) - Improved spectrum library (miniprintf etc) - Fixed memset, some str* routines - Increased size of structure table (so more structures can be defined) - Addition of return_c return_nc iferror -stackoffset for dealing with packages/shared libs (also __SHAREDC__ ) - zcc.cfg has a default of /lib/cpp for the preprocessor which is usually something with more intelligence than zcpp - Start up file changed to include near malloc variables so apps using them can be ROMmed correctly.. z88dkv1.2p2 (p1 was not widely circulated) Changes (in no particular order): - Removed SEGV when defining external pointers - extern int blah (addr); type - Easy rebuilding of libraries - now makefile'd - Major changes in handling of conditionals - we now use c/nc to detect true or false (logical true or false is also return in hl), this removes two bytes for each expression (except for double expressions, sorted next releasse) - Fixed z88 atan2() by Keith Rickard - Loads of new optimization rules (We now have over 200 in total!) which results in vastly better (smaller & quicker) code - please let me know of any problems. - Fixed a few of the rules as well (stupid(!) mistakes) - Removed annoying error which fails compilation if argument types to a function differ only a sign - a warning is now emitted - New appmake by Dennis Groning that doesn't allocate entire 64k but only allocates what is needed (ideal for MSDOS) - zcc now uses local files instead of temporary files if issued the -notemp flag (ideal for MSDOS) - Always been there but..feature: Use -cc to get the C code interspersed with the assembler, warning: this will clobber some of the opt rules so what you see ain't what you get if you don't use it (still thinking of a way around this) - float is now accepted as a synonym for double - More compile time options - they be breeding! See doc/options.txt for a short guide - Switch stmt for chars is now done by a cp,jp z method - faster than previously (for large switch statements cast to int and old method used (less space but slower)) z88dkv1.2 Improvements & fixes: - Fixed strcmp() - it was the worlds most useless one before - Added goto functionality to the compiler, but just cos its there don't mean you have to use it!!! - Fixed many incorrect warnings that the compiler was giving out - Unfixed the "if symbol not found declare as local routine", it reverts to being an unmet function to not break some programs - Major internal reorganisation - lets say I was ill and wanted to distract myself with something almost completely pointless! - Much improved frontend - we now use tmpnam() files to save garbage in the working directory and copy back when complete, gets round the "writing to {zcc}/lib problem" as well - now you can compile several projects at the same time - Hopefully SEGV bug squashed frontend - Removed -show-errs flag, pointless since it really needs to be on all the time! All errors are shown now, including those that occur during assembly - Z80asm v1.0.7 - this is the only version supported! Source code included with very nice makefile. NB. I will support any new features of z80asm as and when they are ready - so always use the latest version! - Slightly better installation instructions (comments please!) - Added missing l_long_case symbol to z88_crt0.hdr - Another truly pointless demo app - wc.c - It's just better (and bigger :( ) okay? z88dkv1.1p4 I've got tired of endlessly updating html files, so, here's a quick text file detailing whats new for p4 - Fixed exit() routine - this now returns the exit code correctly - More Z88 application features - mail checking, safe data - Fixed bug with long comparisons with 0 - Added a __FASTCALL__ function modifier (see below) - Added a __LIB__ function modifier __FASTCALL__ This is quite a dangerous thing to use, it calls functions without passing parameters on the stack, it instead leaves them in registers or in the case of fp values in the floating point accumulator. Hence this can only be used if the function only has one parameter. This type of call is ideal if you want to make your code smaller (say you call one function a lot of times), or if you're combining machine code and c in a single file - say swapping data between big and little endian formats, it makes the code smaller and can also speed it up. exit() is defined as being __FASTCALL__ (out of necessity really, some of my optimization rules were a bit too clever and did a jp exit instead of a call exit, the saving is worth it though I think). NB. In order for __FASTCALL__ to be effective you have to fully prototype your function, the __FASTCALL__ goes between the type specifer (int, long etc) and the function name. __LIB__ This is a new solution to the "Is the function to be LIB'd or XREF'd problem", the old method #pragma proto is still supported, but for future header files I'll be using the new method, arguable it's a little less kludgey, and also makes it easier to see whats going on. z88dk-1.8.ds1/SETZ88-W95.inf0000644000175000017500000000132407457564720014551 0ustar tygrystygrys;Additions to you your autoexec.bat: ; ;SET Z80_OZFILES={Z88DK}\LIB\ ;SET ZCCCFG={Z88DK}\LIB\CONFIG\ ;SET PATH=%PATH%;{Z88DK}\BIN [Version] Signature=$Chicago$ ;Next line so we support LFN... (M$ didn't implement that in original .inf) AdvancedINF=2.0 [DefaultInstall] ;Must be done in 2 passes... UpdateAutoBat = UnSetAutoBat, AddAutoBat [UnSetAutoBat] UnSet = Z80_OZFILES UnSet = ZCCCFG [AddAutoBat] CmdAdd = SET, "Z80_OZFILES=%1%\Lib\" CmdAdd = SET, "ZCCCFG=%1%\Lib\Config\" CmdAdd = SET, "PATH=%PATH%;%1%\Bin" ;How to remove the {z88dk}\bin dir from the PATH? This won't work: ;PreFixPath = Executable.Files ;RemOldPath = Executable.Files ;[DestinationDirs] ;Executable.Files = 1,Bin z88dk-1.8.ds1/src/0000755000175000017500000000000010765202715013300 5ustar tygrystygrysz88dk-1.8.ds1/src/appmake/0000755000175000017500000000000010765202715014716 5ustar tygrystygrysz88dk-1.8.ds1/src/appmake/abc80.c0000644000175000017500000001011010713546115015746 0ustar tygrystygrys/* * BIN to ABC .BAS file * * Stefano Bodrato 5/2000 * * $Id: abc80.c,v 1.3 2007/11/05 07:54:53 stefano Exp $ */ #include "appmake.h" static char *binname = NULL; static char *crtfile = NULL; static char *outfile = NULL; static int origin = -1; static char help = 0; /* Options that are available for this module */ option_t abc80_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'c', "crt0file", "crt0 file used in linking", OPT_STR, &crtfile }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0 , "org", "Origin of the binary", OPT_INT, &origin }, { 0, NULL, NULL, OPT_NONE, NULL } }; void writeword(unsigned int, FILE *); int abc80_exec() { char filename[FILENAME_MAX+1]; char tmpname[FILENAME_MAX+1]; FILE *fpin, *fpout; int c; int i; int len; int lnum; int blocks; int blcount; int pos; if ( help || binname == NULL || ( crtfile == NULL && origin == -1 ) ) return -1; if ( origin != -1 ) { pos = origin; } else { if ( ( pos = parameter_search(crtfile,".sym","MYZORG") ) == -1 ) { myexit("Could not find parameter ZORG (not z88dk compiled?)\n",1); } } strcpy(tmpname,binname); suffix_change(tmpname,".bas"); if ( outfile == NULL ) { strcpy(filename,binname); suffix_change(filename,".bac"); } else { strcpy(filename,outfile); } if ( (fpin=fopen(binname,"rb") ) == NULL ) { fprintf(stderr,"Can't open input file %s\n",binname); myexit(NULL,1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { fclose(fpin); myexit("Couldn't determine size of file\n",1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(tmpname,"wb") ) == NULL ) { printf("Can't open temp output file %s\n",tmpname); myexit(NULL,1); } /* Write out the file */ fprintf(fpout,"10 B=%i",pos); fputc(13,fpout); fprintf(fpout,"20 FOR I=B To B+%i",len-1); fputc(13,fpout); fprintf(fpout,"30 READ A"); fputc(13,fpout); fprintf(fpout,"40 POKE I,A"); fputc(13,fpout); fprintf(fpout,"50 NEXT I"); fputc(13,fpout); fprintf(fpout,"60 R=CALL(B)"); lnum=100; /* ... M/C ...*/ for (i=0; i saves l bytes from the memory starting at address s as * s l bload loades l bytes to the memory starting at address s as . If s or l is zero will their value be taken from the file. * addr call will call Z80 machine code at addr, should be terminated with a jp (iy) Z80 instruction. * * $Id: ace-byt.c,v 1.1 2003/03/13 14:50:29 dom Exp $ */ #include "appmake.h" static char *binname = NULL; static char *outfile = NULL; static char help = 0; /* Options that are available for this module */ option_t acebyt_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0, NULL, NULL, OPT_NONE, NULL } }; int acebyt_exec(char *target) { char filename[FILENAME_MAX+1]; char name[11]; FILE *fpin, *fpout; int c; int i; int len; if ( help || binname == NULL ) return -1; if ( outfile == NULL ) { strcpy(filename,binname); suffix_change(filename,".byt"); } else { strcpy(filename,outfile); } if ( (fpin=fopen(binname,"rb") ) == NULL ) { printf("Can't open input file %s\n"); myexit(NULL,1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { fclose(fpin); myexit("Couldn't determine size of file\n",1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(filename,"wb") ) == NULL ) { printf("Can't open output file %s\n",filename); myexit(NULL,1); } /* Write out the header file */ writeword(26,fpout); fputc(' ',fpout); /* Deal with the filename */ if (strlen(binname) >= 10 ) { strncpy(name,binname,10); } else { strcpy(name,binname); strncat(name," ",10-strlen(binname)); } for (i=0;i<=9;i++) writebyte(name[i],fpout); writeword(len,fpout); /* Length */ writeword(16384,fpout); /* Start Address */ /* I'm not sure what is it for */ for (i=0;i<=10;i++) writebyte(' ',fpout); writeword(len+1,fpout); /* We append the binary file */ for (i=0; i * * zack 8/2/2000 * * Actually..can be used for any CODE file * And we append so we can create mega files... * * Stefano 23/10/2001 - ORG Parameter added * - Modified for the Jupiter ACE * It's probably buggy but works ! * * $Id: ace-tap.c,v 1.1 2003/03/13 14:50:29 dom Exp $ */ #include "appmake.h" static char *binname = NULL; static char *crtfile = NULL; static char *outfile = NULL; static int origin = -1; static char help = 0; static unsigned char parity; /* Options that are available for this module */ option_t acetap_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'c', "crt0file", "crt0 file used in linking", OPT_STR, &crtfile }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0 , "org", "Origin of the binary", OPT_INT, &origin }, { 0, NULL, NULL, OPT_NONE, NULL } }; int acetap_exec(char *target) { char filename[FILENAME_MAX+1]; char name[11]; FILE *fpin, *fpout; int c; int i; int len; int pos; if ( help ) return -1; if ( binname == NULL || ( crtfile == NULL && origin == -1 ) ) { return -1; } if ( outfile == NULL ) { strcpy(filename,binname); suffix_change(filename,".tap"); } else { strcpy(filename,outfile); } if ( origin != -1 ) { pos = origin; } else { if ( ( pos = parameter_search(crtfile,".sym","MYZORG") ) == -1 ) { myexit("Could not find parameter ZORG (not z88dk compiled?)\n",1); } } if ( (fpin=fopen(binname,"rb") ) == NULL ) { printf("Can't open input file\n"); exit(1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { printf("Couldn't determine size of file\n"); fclose(fpin); exit(1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(filename,"a+b") ) == NULL ) { printf("Can't open output file\n"); exit(1); } /* Write out the header file */ writeword_p(19,fpout,&parity); /* Header len */ writebyte_p(0,fpout,&parity); /* Header is 0 */ parity=0; /* writebyte_p(3,fpout,&parity); Filetype isn't used on the J.ACE */ /* Deal with the filename */ if (strlen(binname) >= 10 ) { strncpy(name,binname,10); } else { strcpy(name,binname); strncat(name," ",10-strlen(binname)); } for (i=0;i<=9;i++) writebyte_p(name[i],fpout,&parity); writeword_p(len,fpout,&parity); writeword_p(pos,fpout,&parity); /* load address */ writeword_p(0,fpout,&parity); /* offset */ writebyte_p(parity,fpout,&parity); /* Now onto the data bit */ writeword_p(len+2,fpout,&parity); /* Length of next block */ parity=0; writebyte_p(255,fpout,&parity); /* Data... */ for (i=0; isopt && argv[i][2] == 0 && argv[i][1] == opt->sopt ) { i = option_set(i,argc,argv,opt); break; } else if ( opt->lopt && argv[i][0] == '-' && argv[i][1] == '-' && strcmp(&argv[i][2],opt->lopt) == 0 ) { i = option_set(i,argc,argv,opt); break; } opt++; } while ( opt->type != OPT_NONE ); } } } static int option_set(int pos, int max, char *argv[], option_t *option) { int val; int ret; switch ( option->type ) { case OPT_BOOL: *(char *)(option->dest) = TRUE; ret = pos; break; case OPT_INT: if ( pos + 1 < max ) { val = atoi(argv[pos+1]); *(int *)(option->dest) = val; ret = pos + 1; } break; case OPT_STR: if ( pos + 1 < max ) { *(char **)(option->dest) = strdup(argv[pos+1]); ret = pos + 1; } break; } return ret; } static void option_print(char *execname, char *ident, char *copyright, char *desc, option_t *opts) { option_t *opt = opts; char optstr[4]; fprintf(stderr,"appmake +%s (%s)\n\n%s\n",ident,execname,copyright); if ( desc && strlen(desc) ) fprintf(stderr,"\n%s\n",desc); fprintf(stderr,"\nOptions:\n\n"); while ( opt->type != OPT_NONE ) { if ( opt->sopt ) { sprintf(optstr,"-%c",opt->sopt); } else { sprintf(optstr," "); } switch ( opt->type ) { case OPT_BOOL: fprintf(stderr,"%s --%-15s (bool) %s\n",optstr,opt->lopt,opt->desc); break; case OPT_INT: fprintf(stderr,"%s --%-15s (integer) %s\n",optstr,opt->lopt,opt->desc); break; case OPT_STR: fprintf(stderr,"%s --%-15s (string) %s\n",optstr,opt->lopt,opt->desc); break; } opt++; } } /* Writing routines */ void writebyte(unsigned char c, FILE *fp) { fputc(c,fp); } void writeword(unsigned int i, FILE *fp) { fputc(i%256,fp); fputc(i/256,fp); } void writestring(char *mystring, FILE *fp) { int c; for (c=0; c < strlen(mystring); c++) { writebyte(mystring[c],fp); } } void writeword_p(unsigned int i, FILE *fp,unsigned char *p) { writebyte_p(i%256,fp,p); writebyte_p(i/256,fp,p); } void writebyte_p(unsigned char c, FILE *fp,unsigned char *p) { fputc(c,fp); *p^=c; } void writestring_p(char *mystring, FILE *fp,unsigned char *p) { int c; for (c=0; c < strlen(mystring); c++) { writebyte_p(mystring[c],fp,p); } } void writebyte_cksum(unsigned char c, FILE *fp, unsigned long *cksum) { *cksum += (unsigned int) c; fputc(c,fp); } void writeword_cksum(unsigned int i, FILE *fp, unsigned long *cksum) { writebyte_cksum(i%256,fp,cksum); writebyte_cksum(i/256,fp,cksum); } z88dk-1.8.ds1/src/appmake/appmake.h0000644000175000017500000001540010637507164016511 0ustar tygrystygrys/* * * z88dk Application Generator (appmake) * * * $Id: appmake.h,v 1.11 2007/06/24 15:32:04 dom Exp $ */ #include #include #include #include #include #include /* Conversion routines */ typedef enum { OPT_NONE, OPT_BOOL, OPT_INT, OPT_STR } type_t; enum { FALSE = 0, TRUE }; typedef struct { char sopt; char *lopt; char *desc; type_t type; void *dest; } option_t; #ifdef MAIN_C extern int abc80_exec(char *target); extern option_t abc80_options; extern int acebyt_exec(char *target); extern option_t acebyt_options; extern int acetap_exec(char *target); extern option_t acetap_options; extern int aquarius_exec(char *target); extern option_t aquarius_options; extern int c128_exec(char *target); extern option_t c128_options; extern int cpc_exec(char *target); extern option_t cpc_options; extern int hex_exec(char *target); extern option_t hex_options; extern int msx_exec(char *target); extern option_t msx_options; extern int mz_exec(char *target); extern option_t mz_options; extern int nascom_exec(char *target); extern option_t nascom_options; extern int newbrain_exec(char *target); extern option_t newbrain_options; extern int rex_exec(char *target); extern option_t rex_options; extern int sms_exec(char *target); extern option_t sms_options; extern int svi_exec(char *target); extern option_t svi_options; extern int tixx_exec(char *target); extern option_t tixx_options; extern int z88_exec(char *target); extern option_t z88_options; extern int z88shell_exec(char *target); extern option_t z88shell_options; extern int zx_exec(char *target); extern option_t zx_options; extern int zxvgs_exec(char *target); extern option_t zxvgs_options; extern int zx81_exec(char *target); extern option_t zx81_options; struct { char *execname; char *ident; char *copyright; char *desc; int (*exec)(); option_t *options; } machines[] = { { "bin2bas", "abc80", "(C) 2000 Stefano Bodrato", "", abc80_exec, &abc80_options }, { "bin2byt", "ace", "(C) 2001 Stefano Bodrato", "Generates a .byt file suitable for loading into emulators", acebyt_exec, &acebyt_options }, { "acetap", "acetap", "(C) 2001 Stefano Bodrato", "Generates a .TAP for the Ace32 emulator", acetap_exec, &acetap_options }, { "bin2caq", "aquarius", "(C) 2001 Stefano Bodrato", "Creates a BASIC loader file and binary stored in variable array format", aquarius_exec, &aquarius_options }, { "bin3000", "c128", "(C) 2001 Stefano Bodrato", "Creates a bin3000 for binary transfer", c128_exec, &c128_options }, { "bin2cpc", "cpc", "(C) 2003 Dominic Morris", "Creates an AMSDOS file suitable for writing to a .DSK image", cpc_exec, &cpc_options }, { "bin2hex", "hex", "(C) 2001 Dominic Morris & Jeff Brown", "Creates an intel hex record suitable for embedded devices", hex_exec, &hex_options }, { "bin2msx", "msx", "(C) 2001 Stefano Bodrato", "Adds a file header to enable the program to be loaded using 'bload \"file.bin\",r", msx_exec, &msx_options }, { "bin2m12", "mz", "(C) 2000 Stefano Bodrato", "", mz_exec, &mz_options }, { "bin2nas", "nas", "(C) 2003 Stefano Bodrato", "Generates a .NAS file suitable for use by emulators", nascom_exec, &nascom_options }, { "bin2nwbn", "newbrain", "(C) 2007 Stefano Bodrato", "BASIC loader + data block in Tape format or plain TXT (less efficient)", newbrain_exec, &newbrain_options }, { "mkaddin", "rex", "(C) 2001 Dominic Morris", "Creates a .rex application using data from a .res file and a .bin file", rex_exec, &rex_options }, { "bin2var", "ti82", "(C) 2000 - 2003 David Phillips et al", "Creates a .82p file", tixx_exec, &tixx_options }, { "bin2var", "ti83", "(C) 2000 - 2003 David Phillips et al", "Creates a .83p file", tixx_exec, &tixx_options }, { "bin2var", "ti8x", "(C) 2000 - 2003 David Phillips et al", "Creates a .8xp file", tixx_exec, &tixx_options }, { "bin2var", "ti85", "(C) 2000 - 2003 David Phillips et al", "Creates a .85p file", tixx_exec, &tixx_options }, { "bin2var", "ti86", "(C) 2000 - 2003 David Phillips et al", "Creates a .86p file", tixx_exec, &tixx_options }, { "bin2var", "ti86s", "(C) 2000 - 2003 David Phillips et al", "Creates a .86s file", tixx_exec, &tixx_options }, { "bin2svi", "svi", "(C) 2001 Stefano Bodrato", "Creates a .cas file loadable with the SVI emulator", svi_exec, &svi_options }, { "bin2tmr", "sms", "(C) 2007 Dominic Morris", "Creates a .tmr file padded out to 32k ", sms_exec, &sms_options }, { "appz88", "z88", "(C) 2000 - 2003 Dominic Morris & Dennis Groning", "Generates .63 and .62 files suitable for burning to EPROM", z88_exec, &z88_options }, { "shellmak", "z88shell", "(C) 2002 - 2003 Dominic Morris", "Patches the header to ensure that the program is recognised by the shell", z88shell_exec,&z88shell_options }, { "appzxvgs", "zxvgs", "(C) 2003 Yarek", "Creates a zxvgs application file", zxvgs_exec, &zxvgs_options}, { "bin2tap", "zx", "(C) 2000 - 2003 Dominic Morris & Stefano Bodrato", "Generates a .TAP file complete with BASIC header", zx_exec, &zx_options }, { "bin2p", "zx81", "(C) 2000 Stefano Bodrato", "Generates a .P file suitable for use by emulators", zx81_exec, &zx81_options }, }; #define APPMAKE_TARGETS 25 #endif #define LINEMAX 80 extern int myexit(char *str,int code); extern long parameter_search(char *filen, char *ext,char *target); extern void suffix_change(char *name, char *suffix); extern void writebyte(unsigned char c, FILE *fp); extern void writeword(unsigned int i, FILE *fp); extern void writestring(char *mystring, FILE *fp); extern void writeword_p(unsigned int i, FILE *fp,unsigned char *p); extern void writebyte_p(unsigned char c, FILE *fp,unsigned char *p); extern void writestring_p(char *mystring, FILE *fp,unsigned char *p); extern void writebyte_cksum(unsigned char c, FILE *fp, unsigned long *cksum); extern void writeword_cksum(unsigned int i, FILE *fp, unsigned long *cksum); z88dk-1.8.ds1/src/appmake/appmake.vcproj0000755000175000017500000001200010762606647017566 0ustar tygrystygrys z88dk-1.8.ds1/src/appmake/aquarius.c0000644000175000017500000001266507634115265016732 0ustar tygrystygrys/* * Mattel Aquarius * This tool creates a BASIC loader file * and a binary file stored in "variable array" format * * The machine code starts at 14712. * The original Mattel loader (now commented out) permitted * little changes in the BASIC loader, but we don't need it. * * Stefano Bodrato - December 2001: first release * * $Id: aquarius.c,v 1.1 2003/03/13 14:50:29 dom Exp $ */ #include "appmake.h" static char *binname = NULL; static char *outfile = NULL; static char help = 0; /* Options that are available for this module */ option_t aquarius_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0, NULL, NULL, OPT_NONE, NULL } }; int aquarius_exec(char *target) { char filename[FILENAME_MAX+1]; char ldr_name[FILENAME_MAX+1]; char mybuf[20]; FILE *fpin, *fpout; int c; int i; int len; int dlen; strcpy(ldr_name,"_"); if ( help || binname == NULL ) return -1; if ( outfile == NULL ) { strcpy(filename,binname); suffix_change(filename,".caq"); } else { strcpy(filename,outfile); } if ( (fpin=fopen(binname,"rb") ) == NULL ) { printf("Can't open input file\n"); exit(1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { printf("Couldn't determine size of file\n"); fclose(fpin); exit(1); } len=ftell(fpin); //dlen=(len+72)/4; dlen=(len)/4; fseek(fpin,0L,SEEK_SET); /****************/ /* BASIC loader */ /****************/ strcat(ldr_name,filename); if ( (fpout=fopen(ldr_name,"wb") ) == NULL ) { printf("Can't create the loader file\n"); exit(1); } /* Write out the header */ for (i=1;i<=12;i++) writebyte(255,fpout); writebyte(0,fpout); writestring("LOADR",fpout); writebyte(0,fpout); for (i=1;i<=12;i++) writebyte(255,fpout); writebyte(0,fpout); writeword(14601,fpout); /* points to line 10 */ writeword(5,fpout); /* 5 U=0 */ writebyte('U',fpout); writebyte(0xB0,fpout); writebyte('0',fpout); writebyte(0,fpout); writeword(14609,fpout); /* points to line 20 */ writeword(10,fpout); /* 10 X=0 */ writebyte('X',fpout); writebyte(0xB0,fpout); writebyte('0',fpout); writebyte(0,fpout); writeword(14621+2,fpout); /* points to line 30 */ writeword(20,fpout); /* 20 DIMA(xxxxx) */ writebyte(0x85,fpout); writebyte('A',fpout); writebyte('(',fpout); sprintf(mybuf,"%i",dlen); for (i=1;i<=(5-strlen(mybuf));i++) writebyte('0',fpout); writestring(mybuf,fpout); writebyte(')',fpout); writebyte(0,fpout); writeword(14629+2,fpout); /* points to line 40 */ writeword(30,fpout); /* 30 CLOAD*A */ writebyte(0x9A,fpout); writebyte(0xAA,fpout); writebyte('A',fpout); writebyte(0,fpout); writeword(14651+2,fpout); /* points to line 50 */ writeword(40,fpout); /* 40 POKE14340,PEEK(14552)+7 */ writebyte(0x94,fpout); writestring("14340,",fpout); writebyte(0xC1,fpout); writestring("(14552)",fpout); writebyte(0xA8,fpout); writebyte('7',fpout); writebyte(0,fpout); writeword(14671+2,fpout); /* points to line 60 */ writeword(50,fpout); /* 50 POKE14341,PEEK(14553) */ writebyte(0x94,fpout); writestring("14341,",fpout); writebyte(0xC1,fpout); writestring("(14553)",fpout); writebyte(0,fpout); writeword(14682+2,fpout); /* points to end of program */ writeword(60,fpout); /* 60 X=USR(0) */ writebyte('X',fpout); writebyte(0xB0,fpout); writebyte(0xB5,fpout); writestring("(0)",fpout); for (i=1;i<=25;i++) writebyte(0,fpout); fclose(fpout); /*********************/ /* Binary array file */ /*********************/ /* Write out the header */ if ( (fpout=fopen(filename,"wb") ) == NULL ) { printf("Can't create the data file\n"); exit(1); } /* Write out the header */ for (i=1;i<=12;i++) writebyte(255,fpout); writebyte(0,fpout); /* Write out the "file name" */ for (i=1;i<=6;i++) writebyte('#',fpout); // writebyte(0,fpout); /* for (i=1;i<=6;i++) writebyte(0,fpout);*/ /* Mattel games loader relocator */ /* writebyte(0x2A,fpout); // ld hl,(14552) writeword(14552,fpout); writebyte(0x23,fpout); // inc hl writebyte(0x23,fpout); // inc hl writebyte(0x4e,fpout); // ld c,(hl) writebyte(0x23,fpout); // inc hl writebyte(0x46,fpout); // ld b,(hl) writebyte(0x11,fpout); // le de,67 writeword(67,fpout); writebyte(0x19,fpout); // add hl,de writebyte(0xe5,fpout); // push hl writebyte(0xc5,fpout); // push bc writebyte(0xe1,fpout); // pop hl writebyte(0xb7,fpout); // or a writebyte(0xed,fpout); // sbc hl,de writebyte(0x52,fpout); writebyte(0xe5,fpout); // push hl writebyte(0xc1,fpout); // pop bc writebyte(0xe1,fpout); // pop hl writebyte(0x23,fpout); // inc hl writebyte(0x7e,fpout); // ld a,(hl) writebyte(0xb7,fpout); // or a writebyte(0x28,fpout); // jr z,-4 writebyte(0xfb,fpout); writebyte(0x11,fpout); // ld de,14768 writeword(14768,fpout); writebyte(0xed,fpout); // ldir writebyte(0xb0,fpout); for (i=1;i<=41;i++) writebyte(0,fpout); */ /* We append the binary file */ for (i=0; i 0) { sum = 0x100 - sum; } return(sum); } static int bin2hex(FILE *input, FILE *output, int address) { unsigned char outbuf[5 + RECSIZE + 1]; unsigned char *inbuf; int byte; int size; int i; inbuf = outbuf + 5; outbuf[0] = ':'; do { printf("%d\n",address); size = 0; while (size < RECSIZE) { byte = fgetc(input); if ( byte == EOF ) { break; } inbuf[size++] = byte; } outbuf[1] = size; if (size > 0) { outbuf[2] = address >> 8; outbuf[3] = address & 0xff; outbuf[4] = 0; } else { outbuf[2] = 0; outbuf[3] = 0; outbuf[4] = 1; } outbuf[5 + size] = checksum(outbuf + 1, size + 4); fputc(outbuf[0], output); for (i=1; i<(size+6); i++) { fprintf(output, "%02X", outbuf[i]); } fprintf(output, "\n"); address += size; } while (!feof(input) || (size > 0)); return(0); } int hex_exec(char *target) { FILE *input, *output; char filename[FILENAME_MAX]; int address; if ( help || binname == NULL ) return -1; if ( outfile == NULL ) { strcpy(filename,binname); suffix_change(filename,".ihx"); } else { strcpy(filename,outfile); } if ( origin != -1 ) address = origin; else address = 0; if ( (input = fopen(binname,"rb") ) == NULL ) { perror("Error opening input file"); myexit(NULL,1); } if ( (output = fopen(filename,"w") ) == NULL ) { perror("Error opening output file"); myexit(NULL,1); } bin2hex(input, output,address); fclose(input); fclose(output); exit(0); } z88dk-1.8.ds1/src/appmake/Makefile0000644000175000017500000000061410630376213016353 0ustar tygrystygrys OBJS = appmake.o z88.o zxvgs.o zx.o z88shell.o abc80.o zx81.o msx.o mz.o \ aquarius.o svi.o ace-byt.o ace-tap.o hex.o rex6000.o tixx.o nascom.o \ cpc.o newbrain.o sms.o c128.o CC = gcc -g all: appmake %.o: %.c appmake.h $(CC) $(CFLAGS) $(INCLUDES) -c $< appmake: $(OBJS) ${CC} -o appmake $(LDFLAGS) $(OBJS) install: install appmake $(PREFIX)/bin clean: $(RM) appmake $(OBJS) core z88dk-1.8.ds1/src/appmake/msx.c0000644000175000017500000000371507634115266015704 0ustar tygrystygrys/* * MSX BIN file * * BLOAD "PROG.BIN",R * * By Stefano Bodrato * * $Id: msx.c,v 1.1 2003/03/13 14:50:30 dom Exp $ */ #include "appmake.h" static char *binname = NULL; static char *outfile = NULL; static char help = 0; /* Options that are available for this module */ option_t msx_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0, NULL, NULL, OPT_NONE, NULL } }; int msx_exec(char *target) { char filename[FILENAME_MAX+1]; char name[11]; FILE *fpin, *fpout; int c; int i; int len; if ( help || binname == NULL ) return -1; if ( outfile == NULL ) { strcpy(filename,binname); suffix_change(filename,".msx"); } else { strcpy(filename,outfile); } if ( (fpin=fopen(binname,"rb") ) == NULL ) { printf("Can't open input file\n"); exit(1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { printf("Couldn't determine size of file\n"); fclose(fpin); exit(1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(filename,"wb") ) == NULL ) { printf("Can't open output file\n"); exit(1); } /* Write out the header file */ fputc(254,fpout); writeword(40000,fpout); /* Start Address */ writeword(40000+len+1,fpout); /* End Address */ writeword(40000,fpout); /* Call Address */ /* We append the binary file */ for (i=0; i0) && ((i%8)==0)) { fprintf(fpout, "%c%c\n",8,8); writehexword(origin,fpout); } c=getc(fpin); fputc(' ',fpout); writehex(c,fpout); origin++; } /* Padding the last 8 bytes block*/ if ( (i % 8) != 0 ) { while ( (i % 8) != 0 ) { fprintf(fpout, " 00"); i++; } fprintf(fpout, "%c%c\n",8,8); } fprintf(fpout, ".\n"); fclose(fpin); fclose(fpout); return 0; } void writehex(unsigned int i,FILE *fp) { if (i/16>9) fputc ((i/16)+55,fp); else fputc ((i/16)+48,fp); if (i%16>9) fputc ((i%16)+55,fp); else fputc ((i%16)+48,fp); } void writehexword(unsigned int i,FILE *fp) { writehex(i/256,fp); writehex(i%256,fp); } z88dk-1.8.ds1/src/appmake/newbrain.c0000755000175000017500000002651010631044052016664 0ustar tygrystygrys/* * BIN to NEWBRAIN .BAS file * * Stefano Bodrato 4/2007 * * $Id: newbrain.c,v 1.3 2007/06/04 17:13:14 stefano Exp $ */ #include "appmake.h" static char *binname = NULL; static char *crtfile = NULL; static char *outfile = NULL; static char *blockname = NULL; static int origin = -1; static char ascii = 0; static char help = 0; /* Options that are available for this module */ option_t newbrain_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'c', "crt0file", "crt0 file used in linking", OPT_STR, &crtfile }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 'a', "ascii", "Generate a BASIC loader in plain text", OPT_BOOL, &outfile }, { 0 , "blockname", "Name of the binary block in tape", OPT_STR, &blockname}, { 0 , "org", "Origin of the binary", OPT_INT, &origin }, { 0, NULL, NULL, OPT_NONE, NULL } }; int newbrain_exec() { char filename[FILENAME_MAX+1]; FILE *fpin, *fpout, *fpout2; int pos; int c; int i,p,l,b; int len; int lnum; int blocks; int blcount; unsigned long checksum; if ( help || binname == NULL || ( crtfile == NULL && origin == -1 ) ) { return -1; } if ( blockname == NULL ) blockname = binname; if ( outfile == NULL ) { strcpy(filename,binname); suffix_change(filename,".txt"); } else { strcpy(filename,outfile); } if ( origin != -1 ) { pos = origin; } else { if ( ( pos = parameter_search(crtfile,".sym","MYZORG") ) == -1 ) { myexit("Could not find parameter ZORG (not z88dk compiled?)\n",1); } } if ( (fpin=fopen(binname,"rb") ) == NULL ) { fprintf(stderr,"Can't open input file %s\n",binname); myexit(NULL,1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { fclose(fpin); myexit("Couldn't determine size of file\n",1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( ascii ) { /* All in a BASIC program */ if ( (fpout=fopen(filename,"w") ) == NULL ) { printf("Can't open output text format file %s\n",filename); myexit(NULL,1); } fprintf(fpout,"10 IF TOP>%i THEN RESERVE TOP-%i\n",pos-1,pos-1); fprintf(fpout,"20 FOR i=0TO%i:READa:POKE%i+i,a:NEXT i\n",len-1,pos); fprintf(fpout,"30 CALL%i\n",pos); fprintf(fpout,"40 END",pos); lnum=100; /* ... M/C ...*/ for (i=0; i (len - 1) ) { /* is last block smaller ? */ p = len - 1; l = len - (b * 1024); } /* Block length*/ writeword_cksum(l, fpout2, &checksum); for (i=p; i>(p-l); i--) { fseek(fpin, i, SEEK_SET); c = getc(fpin); writebyte_cksum(c, fpout2, &checksum); } writebyte_cksum(b+1, fpout2, &checksum); writeword((checksum%65536), fpout2); } for (i=0; i<9;i++) /* tail */ fputc (0,fpout2); fclose(fpin); fclose(fpout2); /* TEMP BASIC loader */ suffix_change(filename,".tmp"); if ( (fpout=fopen(filename,"wb") ) == NULL ) { printf("Can't open temp output file %s\n",filename); myexit(NULL,1); } fputc(0x0d,fpout); fprintf(fpout,"10 "); fputc(0xAC,fpout); /* RESERVE */ fputc(0xA8,fpout); /* TOP */ fputc(0x82,fpout); /* - */ fprintf(fpout,"%i",pos); /* memory location */ fputc(0x0d,fpout); fprintf(fpout,"20 "); fputc('b',fpout); fputc(0x8c,fpout); /* = */ fprintf(fpout,"121:"); /* 121 */ fputc(0x89,fpout); /* IF */ fputc(0xa4,fpout); /* PEEK */ fprintf(fpout,"(51)"); fputc(0x8d,fpout); /* > */ fprintf(fpout,"127"); fputc(0xb4,fpout); /* THEN */ fprintf(fpout,"b"); fputc(0x8c,fpout); /* = */ fputc(0xa4,fpout); /* PEEK */ fprintf(fpout,"(168)"); fputc(0x81,fpout); /* + */ fprintf(fpout,"256"); fputc(0x83,fpout); /* * */ fputc(0xa4,fpout); /* PEEK */ fprintf(fpout,"(169):"); fputc(0x9e,fpout); /* POKE */ fprintf(fpout,"169,"); fputc(0x96,fpout); /* INT */ fprintf(fpout,"((b"); fputc(0x81,fpout); /* + */ fprintf(fpout,"23)"); fputc(0x84,fpout); /* / */ fprintf(fpout,"256):"); fputc(0x9e,fpout); /* POKE */ fprintf(fpout,"168,b"); fputc(0x81,fpout); /* + */ fprintf(fpout,"23"); fputc(0x82,fpout); /* - */ fprintf(fpout,"256"); fputc(0x83,fpout); /* * */ fputc(0xa4,fpout); /* PEEK */ fprintf(fpout,"(169)"); fputc(0x0d,fpout); fprintf(fpout,"30 "); fputc(0x8b,fpout); /* FOR */ fprintf(fpout," i "); fputc(0x8c,fpout); /* = */ fprintf(fpout," 0 "); fputc(0xb6,fpout); /* TO */ fprintf(fpout," 22:"); fputc(0x9c,fpout); /* READ */ fprintf(fpout," c:"); fputc(0x9e,fpout); /* POKE */ fprintf(fpout," b"); fputc(0x81,fpout); /* + */ fprintf(fpout,"i,c:"); fputc(0x8c,fpout); /* NEXT */ fprintf(fpout," i:"); fputc(0x9d,fpout); /* DATA */ fprintf(fpout," 253,110,32,253,102,33,22,0,30,1,1,"); fprintf(fpout,"%i",len%256); /* LSB for Length */ fputc(',',fpout); fprintf(fpout,"%i",len/256); /* MSB for Length */ fprintf(fpout,",231,49,119,35,11,120,177,200,24,246"); fputc(0x0d,fpout); fprintf(fpout,"40 "); fputc(0x97,fpout); /* OPEN */ //fputc(' ',fpout); fputc(0xb3,fpout); /* # */ fprintf(fpout,"1,"); fputc('"',fpout); fprintf(fpout,"%s",blockname); fputc('"',fpout); fputc(0x0d,fpout); fprintf(fpout,"50 "); fputc(0x9f,fpout); /* CALL */ fprintf(fpout," b : "); fputc(0x9f,fpout); /* CALL */ fprintf(fpout," %i",pos); fputc(0x0d,fpout); fputc(0x04,fpout); fputc(0x0d,fpout); fclose(fpout); /* Now convert in tape format */ if ( (fpin=fopen(filename,"rb") ) == NULL ) { fprintf(stderr,"Can't read temp file%s\n",binname); myexit(NULL,1); } if (fseek(fpin,0,SEEK_END)) { fclose(fpin); myexit("Couldn't determine size of temp file\n",1); } len=ftell(fpin); suffix_change(filename,".bas"); if ( (fpout2=fopen(filename,"wb") ) == NULL ) { printf("Can't open output BASIC Binary file %s\n",filename); myexit(NULL,1); } /* header for binary block */ checksum=0x3b; /* Init checksum */ fputc (0,fpout2); writeword_cksum(strlen(filename), fpout2, &checksum); for (i=0; i=0; i--) { fseek(fpin, i, SEEK_SET); c=getc(fpin); writebyte_cksum(c, fpout2, &checksum); } writebyte_cksum(0x41, fpout2, &checksum); writeword((checksum%65536),fpout2); /* block checksum */ for (i=0; i<9;i++) /* tail */ fputc (0,fpout2); fclose(fpin); fclose(fpout2); /* TAPE directory */ if ( (fpout=fopen("_dir.txt","w") ) == NULL ) { printf("Can't open output text format file %s\n",filename); myexit(NULL,1); } fprintf(fpout,"%s\n",filename); suffix_change(filename,".dat"); fprintf(fpout,"%s\n",filename); fclose(fpout); suffix_change(filename,".tmp"); remove(filename); } } z88dk-1.8.ds1/src/appmake/rex6000.c0000644000175000017500000001517110264204363016166 0ustar tygrystygrys/* * Support program to produce Rex Addins * * djm 21/6/2001 after Damjan Marion * * $Id: rex6000.c,v 1.3 2005/07/10 11:39:31 dom Exp $ */ #include "appmake.h" static char icon[5*32]; /* Yes, this icon is stolen from the other Rex SDK */ static char icon_default [5*32] = { 0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0xfe,0x60,0x00, 0x00,0x03,0xf7,0xe0,0x00, 0x00,0x0f,0xc1,0xc0,0x00, 0x00,0x1f,0x80,0xc0,0x00, 0x00,0x3f,0x00,0xc0,0x00, 0x00,0x3e,0x00,0xc0,0x00, 0x00,0x7e,0x00,0x00,0x00, 0x00,0x7c,0x00,0x00,0x00, 0x00,0xfc,0x00,0x00,0x00, 0x00,0xfc,0x00,0x00,0x00, 0x00,0xf8,0x00,0x00,0x00, 0x00,0xf8,0x00,0x0c,0x00, 0x00,0xf8,0x00,0x10,0x00, 0x00,0xf8,0x00,0x38,0x00, 0x00,0x7c,0x03,0x13,0x2c, 0x00,0x7c,0x06,0x14,0xb0, 0x00,0x3f,0x3c,0x14,0xa0, 0x00,0x1f,0xf8,0x14,0xa0, 0x00,0x07,0xe0,0x13,0x20, 0x00,0x00,0x00,0x00,0x00, 0x0f,0xe0,0x7f,0xfc,0x7c, 0x0f,0xfc,0x7f,0xbe,0xf8, 0x0f,0xfc,0xff,0x9e,0xf0, 0x1f,0x3c,0xf0,0x1f,0xe0, 0x1f,0x3c,0x0f,0x0b,0xc0, 0x1e,0x00,0x1f,0x01,0x80, 0x1e,0xf1,0xe0,0x1b,0xc0, 0x3e,0xf1,0xff,0x3f,0xe0, 0x3c,0x7b,0xfe,0x7d,0xf0, 0x3c,0x7b,0xfe,0xf8,0xf8, 0x00,0x00,0x00,0x00,0x00 }; static char *application_name = NULL; static char *application_comment = NULL; static char *binname = NULL; static char *outfile = NULL; static char help = 0; static char do_truncate = 0; static char *application_name_file = NULL; static char *application_comment_file = NULL; /* Options that are available for this module */ option_t rex_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'n', "appname", "Application Name", OPT_STR, &application_name }, { 'c', "comment", "Application Comment", OPT_STR, &application_comment }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0 , "nt", "Don't pad out to 8k addin", OPT_BOOL, &do_truncate }, { 0, NULL, NULL, OPT_NONE, NULL } }; static void icon_form(char *name); static char *cleanup_string(char *orig); /* We get called with [outputfilename] [where the file is for info etc] [-nt] * If -nt is supplied then we don't pad out to 8k boundary */ int rex_exec(char *target) { char output_name[FILENAME_MAX]; FILE *fp; FILE *binfile; long filesize; int rem; int i,c; if ( help || binname == NULL ) return -1; if ( outfile == NULL ) { strcpy(output_name,binname); suffix_change(output_name,".rex"); } else { strcpy(output_name,outfile); } icon_form(binname); if ( application_name == NULL ) { if ( application_name_file == NULL ) { application_name = "z88dkapp"; } else { application_name = application_name_file; } } if ( application_comment == NULL ) { if ( application_comment_file == NULL ) { application_comment = "Made with z88dk"; } else { application_comment = application_comment_file; } } if ( (binfile = fopen(binname,"rb")) == NULL ) { fprintf(stderr,"Couldn't open binary file: %s\n",binfile[1]); myexit(NULL,1); } /* Now we have to do the program length */ if (fseek(binfile, 0, SEEK_END)) { fclose(binfile); myexit("Couldn't determine the size of binary file\n",1); } filesize = ftell(binfile); if ( filesize > 65536L ) { fclose(binfile); myexit("The source binary is over 65,536 bytes in length\n",1); } fseek(binfile, 0, SEEK_SET); if ( (fp = fopen(output_name,"wb")) == NULL ) { fclose(binfile); fprintf(stderr,"Couldn't open output file: %s\n",output_name); myexit(NULL,1); } fprintf(fp,"ApplicationName:Addin\r\n"); fprintf(fp,"%s\r\n",application_name); fprintf(fp,"%s",application_comment); fputc( 0, fp); /* Now write out the program length, little endian */ fputc( filesize%256, fp); fputc( filesize/256, fp); /* Now two bytes that I'm not sure what they do.. */ fputc( 0, fp); fputc( 0, fp); /* Now write the icon out */ for (i=0; i> 8) & 0xFF; fwrite(&memory, sizeof(memory[0]), 32768, fpout); fclose(fpin); fclose(fpout); } z88dk-1.8.ds1/src/appmake/svi.c0000644000175000017500000000454707634115266015702 0ustar tygrystygrys/* * Spectravideo SVI Cassette file * * BLOAD "CAS:",R * * By Stefano Bodrato * * $Id: svi.c,v 1.1 2003/03/13 14:50:30 dom Exp $ */ #include "appmake.h" static char *binname = NULL; static char *outfile = NULL; static char help = 0; /* Options that are available for this module */ option_t svi_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0, NULL, NULL, OPT_NONE, NULL } }; void headtune(FILE *fp); int svi_exec(char *target) { char filename[FILENAME_MAX+1]; char name[11]; FILE *fpin, *fpout; int c; int i; int len; if ( help || binname == NULL ) return -1; if ( outfile == NULL ) { strcpy(filename,binname); suffix_change(filename,".cas"); } else { strcpy(filename,outfile); } if ( (fpin=fopen(binname,"rb") ) == NULL ) { printf("Can't open input file\n"); exit(1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { printf("Couldn't determine size of file\n"); fclose(fpin); exit(1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(filename,"wb") ) == NULL ) { printf("Can't open output file\n"); exit(1); } /* Write out the header file */ headtune (fpout); for (i=0; i<10;i++) writebyte(208,fpout); /* Deal with the filename */ if (strlen(binname) >= 6 ) { strncpy(name,binname,6); } else { strcpy(name,binname); strncat(name," ",6-strlen(binname)); } for (i=0;i<6;i++) writebyte(name[i],fpout); writeword(0,fpout); /* Now, the body */ headtune (fpout); writeword(34816,fpout); /* Start Address */ writeword(34816+len+1,fpout); /* End Address */ writeword(34816,fpout); /* Call Address */ /* (58 bytes written so far...) */ /* We append the binary file */ for (i=0; i Converts binary images to TI Graph Link format files 1.00 -- 08/22/00 * first release * support for 83P, 8XP strcasecmp 1.10 -- 08/23/00 * made code more modular * added support for 82P, 86P, 86S * fixed __MSDOS__ macro spelling to be correct 1.20 -- 08/24/00 * added suport for 85S * corrected header for 8XP * changed error message printing to use stderr Edited by Jeremy Drake to create unsquished 83P and 8XP files with correct "End" and "AsmPrgm" symbols */ #include "appmake.h" static char *conf_comment = NULL; static char *binname = NULL; static char *outfile = NULL; static char help = 0; /* Options that are available for this module */ option_t tixx_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0, "comment", "File comment (42 chars)", OPT_STR, &conf_comment }, { 0, NULL, NULL, OPT_NONE, NULL } }; #ifndef WIN32 #define stricmp strcasecmp #endif enum EXT { E_82P, E_83P, E_8XP, E_85S, E_86P, E_86S }; void die(const char *fmt, ...) { va_list argptr; if (fmt) { va_start(argptr, fmt); vfprintf(stderr, fmt, argptr); va_end(argptr); } myexit(NULL,1); } int fsize(FILE *fp) { int p, size; p = ftell(fp); fseek(fp, 0L, SEEK_END); size = ftell(fp); fseek(fp, p, SEEK_SET); return size; } void cfwritebyte(int i, FILE *fp, unsigned short *chk) { writebyte((i%256),fp); *chk += ( i % 256 ); } void cfwriteword(int i, FILE *fp, unsigned short *chk) { writeword(i,fp); *chk += ( i % 256 ); *chk += ( i / 256 ); } void cfwrite(const void *buf, int len, FILE *fp, unsigned short *chk) { int i; fwrite(buf, len, 1, fp); for(i = 0; i < len; i++) *chk += ((unsigned char *)buf)[i]; } void datawrite(unsigned char *buf, int len, FILE *fp, unsigned short *chk) { int i, n; char charbuffer[5]; for (i = 0; i < len; i++) { n = (unsigned char)buf[i]; sprintf(charbuffer,"%X",n); if( charbuffer[1] == 0 ) { charbuffer[1] = charbuffer[0]; charbuffer[0] = '0'; } fwrite(charbuffer, 2, 1, fp); *chk += charbuffer[0]; *chk += charbuffer[1]; } } void writecomment(FILE *fp, const char *comment) { char str[50]; fwrite(comment, strlen(comment), 1, fp); memset(str, 0, 42); fwrite(str, 42 - strlen(comment), 1, fp); } void genname(const char *fname, char *name) { char str[256], *c; strcpy(str, fname); c = strchr(str, '.'); if ((c - str) > 8) c[8] = 0; else *c = 0; c = str - 1; do { c++; *c = toupper(*c); if (!isalnum(*c)) *c = 0; } while (*c != 0); if (!strlen(str)) die("A valid variable name could not be generated!\n"); strcpy(name, str); } int tixx_exec(char *target) { char filename[FILENAME_MAX+1]; char comment[45]; FILE *fp; char *buf, str[256], *c; char *suffix; int i, n, ext, n2; unsigned short chk; if ( help || binname == NULL ) { return -1; } if (!stricmp(target, "ti82")) { ext = E_82P; suffix = ".82p"; } else if (!stricmp(target, "ti83")) { ext = E_83P; suffix = ".83p"; } else if (!stricmp(target, "ti8x")) { ext = E_8XP; suffix = ".8xp"; } else if (!stricmp(target, "ti85")) { ext = E_85S; suffix = ".85s"; } else if (!stricmp(target, "ti86")) { ext = E_86P; suffix = ".86p"; } else if (!stricmp(target, "ti86s")) { ext = E_86S; suffix = ".86s"; } if ( outfile == NULL ) { strcpy(filename,binname); suffix_change(filename,suffix); } else { strcpy(filename,outfile); } genname(filename, str); if ( conf_comment != NULL ) { strncpy(comment,conf_comment,42); comment[42] = 0; } else { strcpy(comment, "Created with Z88DK - bin2var v1.20"); } fp = fopen(binname, "rb"); if (!fp) die("Failed to open input file: %s\n", binname); n = fsize(fp); buf = (char *)malloc(n); fread(buf, n, 1, fp); if (ferror(fp)) die("Error reading input file: %s\n", binname); fclose(fp); fp = fopen(filename, "wb"); if (!fp) die("Failed to open output file: %s\n", filename); chk = 0; if (ext == E_82P) fwrite("**TI82**\x1a\x0a\x00", 11, 1, fp); else if (ext == E_83P) fwrite("**TI83**\x1a\x0a\x00", 11, 1, fp); else if (ext == E_8XP) fwrite("**TI83F*\x1a\x0a\x00", 11, 1, fp); else if (ext == E_85S) fwrite("**TI85**\x1a\x0c\x00", 11, 1, fp); else if ((ext == E_86P) || (ext == E_86S)) fwrite("**TI86**\x1a\x0a\x00", 11, 1, fp); writecomment(fp, comment); if ((ext == E_82P) || (ext == E_83P)) i = n + 17; else if (ext == E_8XP) i = n + 19; else if (ext == E_85S) i = n + 10 + strlen(str); else i = n + 18; writeword(i, fp); if ((ext == E_82P) || (ext == E_83P) || (ext == E_8XP)) cfwrite("\x0b\0x00", 2, fp, &chk); else if (ext == E_85S) { i = 4 + strlen(str); cfwritebyte(i, fp, &chk); cfwrite("\0x00", 1, fp, &chk); } else cfwrite("\x0c\0x00", 2, fp, &chk); if(ext == E_8XP) i = n + 4; else i = n + 2; cfwriteword(i, fp, &chk); if ((ext == E_82P) || (ext == E_83P) || (ext == E_8XP)) cfwrite("\x06", 1, fp, &chk); else if (ext == E_86P) cfwrite("\x12", 1, fp, &chk); else if ((ext == E_85S) || (ext == E_86S)) cfwrite("\x0c", 1, fp, &chk); i = strlen(str); if ((ext == E_85S) || (ext == E_86P) || (ext == E_86S)) cfwritebyte(i, fp, &chk); cfwrite(str, i, fp, &chk); memset(str, 0, 8); if (ext != E_85S) cfwrite(str, 8 - i, fp, &chk); if (ext == E_8XP) { i = n + 4; n2 = n + 2; } else { i = n + 2; n2 = n; } cfwriteword(i, fp, &chk); cfwriteword(n2, fp, &chk); if(ext == E_8XP) { cfwrite("\xBB", 1, fp, &chk); cfwrite("\x6D", 1, fp, &chk); } cfwrite(buf, n, fp, &chk); writeword(chk, fp); if (ferror(fp)) die("Failed writing output file: %s\n", filename); fclose(fp); free(buf); printf("'%s' successfully converted to '%s'\n", binname, filename); return 0; } z88dk-1.8.ds1/src/appmake/vscmake.bat0000644000175000017500000000036510537314616017044 0ustar tygrystygrys@echo off rem $Id: vscmake.bat,v 1.4 2006/12/11 17:46:54 stefano Exp $ echo ******************** echo * Building appmake * echo ******************** cl /Feappmake -D__WIN32__ -D _CRT_SECURE_NO_DEPRECATE *.c move appmake.exe ..\..\bin del *.obj z88dk-1.8.ds1/src/appmake/z88.c0000644000175000017500000001714110264204365015514 0ustar tygrystygrys/* * Wonderful routine to create a Z88 application * * z88app [binary file] [startup file] [-nt] * * djm 2/4/99 - A very, very quick knock up! * * Application ID number is generated from time() * - if you have a better automatic algorithm let me know! * * djm 12/4/99 * Thanks Dennis! The ROM header was being generated two bytes * lower than it should've been..ooops, and oops again! * * djm 26/4/99 * Implemented some other changes suggested by Dennis, we now * change the suffix for output files, hence default output * will be a.63, a.62 etc * Also added some condition Win/Dos stuff * * djm 28/4/99 * If zorg != page boundary then we save only from zorg upwards * (request from DG) * * dg 17/5/99 * Changes to make more MSDOS friendly * * djm 12/1/2000 * Add option to disallow page truncation * * $Id: z88.c,v 1.2 2005/07/10 11:39:33 dom Exp $ */ #include "appmake.h" #define MAX_ADDR 65472 struct romheader { /* Front DOR */ char parent[3]; char brother[3]; char son[3]; char dortype; char dorlen; char key; char namelen; char name[5]; char termin; char spacer[37]; /* Card header */ char cardid[4]; char cardsize; char subtype; char header[2]; }; /* * Default stuff at the top of the DOR, this is 10 bytes long */ static unsigned char appldef[]={ 19, 8 , 'N', 5 , 'A','P','P','L',0,255 }; static char *binname = NULL; static char *crtfile = NULL; static char *outfile = NULL; static char do_truncate = 0; static char help = 0; static unsigned char *memory; /* Pointer to Z80 memory */ static long zorg; /* Origin of compiler program */ /* Options that are available for this module */ option_t z88_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'c', "crt0file", "crt0 file used in linking", OPT_STR, &crtfile }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0 , "nt", "Do not do_truncate bank 63", OPT_BOOL, &do_truncate }, { 0, NULL, NULL, OPT_NONE, NULL } }; /* Prototypes for our functions */ static void SaveBlock(unsigned offset, char *base, char *ext); /* * Execution starts here */ int z88_exec(char *target) { int pages; /* size of card in banks */ long indor; /* address of app dor */ long indorseg; /* address of seg bindings */ FILE *binfile; /* Read in bin file */ long filesize; struct romheader *hdr; /* Pointer to ROM DOR */ int appdorpg; /* Page where app DOR is */ int appdoroff; /* Offset of where the app DOR is */ int readlen; /* Amount read in */ time_t cardidno; /* Card ID number - construct randomly */ if ( help ) return -1; if ( binname == NULL || crtfile == NULL ) { return -1; } #ifdef MSDOS if ( do_truncate ) { fputs("-nt option not supported under MSDOS..continuing\n",stderr); } #endif if ( outfile == NULL ) outfile = binname; zorg = parameter_search(crtfile,".sym","MYZORG"); if ( zorg == -1 ) myexit("Could not find parameter ZORG (compiled as BASIC?)\n",1); indor = parameter_search(crtfile,".map","IN_DOR"); if ( indor == -1 ) myexit("Could not find parameter IN_DOR - no app dor present\n",1); indorseg = parameter_search(crtfile,".map","IN_DOR_SEG_SETUP"); if ( indorseg == -1 ) myexit("Could not find parameter IN_DOR_SEG_SETUP - no app dor present\n",1); pages = ( (65536L - (long)(zorg+1))/16384L); pages++; if (pages == 4 ) { fputs("Four segments needed for this program - you may have some problems\n",stderr); fputs("running this beast - try and cut it down a little bit!!\n",stderr); } /* * Allocate some memory */ if ( do_truncate == FALSE ) { memory=calloc(1,(unsigned)(65536L-zorg)); } else { memory = calloc(1,65536L); } if (memory == NULL) myexit("Can't allocate memory\n",1); if ( ( binfile = fopen(binname, "rb") ) == NULL ) { myexit("Can't open binary file\n",1); } if ( fseek(binfile, 0, SEEK_END) ) { fclose(binfile); myexit("Couldn't determine the size of the file\n",1); } filesize = ftell(binfile); if ( filesize > 65536L ) { fclose(binfile); myexit("The source binary is over 65,536 bytes in length.\n",1); } fseek(binfile, 0, SEEK_SET); /* Check to see if we will infringe on the ROM header, if not then load it in */ if ( zorg + filesize <= MAX_ADDR ) { if ( do_truncate == FALSE ) readlen = fread(memory,1,filesize,binfile); else readlen = fread(memory+zorg,1,filesize,binfile); if ( filesize != readlen ) { fclose(binfile); myexit("Couldn't read in binary file\n",1); } } else { fclose(binfile); myexit("Binary file too large! Change the org!\n",1); } fclose(binfile); if ( do_truncate ) zorg = 0; /* We've read it in, so now construct the ROM header */ hdr = (struct romheader *)(memory+MAX_ADDR-zorg); /* * Try to create some sort of unique card id number so we don't clash * violently with other apps, we'll use time() which returns the time * since a base - different for different OS, but hopefully consistent * with different flavours of the OS */ cardidno=time(NULL); hdr->cardid[0]=(cardidno%256)&127; hdr->cardid[1]=(cardidno/256)&127; hdr->cardid[2]=(cardidno%65536)&127; hdr->cardid[3]=(cardidno/65336)|128; hdr->cardsize=(char )pages; hdr->subtype=0; hdr->header[0]='O'; hdr->header[1]='Z'; memcpy(&hdr->dortype,appldef,10); /* Now, deal with the dor address */ appdorpg = 63- ( (65536L - (long)(indor+1))/16384L); appdoroff= indor&16383; hdr->son[0]=appdoroff%256; hdr->son[1]=appdoroff/256; hdr->son[2]=appdorpg; /* Now, set up the needed pages in the app DOR */ switch(pages) { case 4: *(memory+indorseg-zorg)=(char)60; case 3: *(memory+indorseg-zorg+1)=(char)61; case 2: *(memory+indorseg-zorg+2)=(char)62; case 1: *(memory+indorseg-zorg+3)=(char)63; } /* Okay, now thats done, we have to save the image as banks.. */ if ( pages == 4 ) SaveBlock(0,outfile,".60"); if ( pages >= 3 ) SaveBlock(16384,outfile,".61"); if ( pages >= 2 ) SaveBlock(32768,outfile,".62"); SaveBlock(49152,outfile,".63"); myexit(0,0); } static void SaveBlock(unsigned offset, char *base, char *ext) { char name[FILENAME_MAX+1]; char buffer[LINEMAX+1]; int length; FILE *fp; strcpy(name,base); suffix_change(name,ext); if ( ( fp = fopen(name,"wb") ) == NULL ) { sprintf(buffer,"Can't open output file %s\n",name); myexit(buffer,1); } if ( (zorg-offset) < 16384 && do_truncate == FALSE ) { /* Saving the segment in which the code is org'd to */ length = 16384-(zorg-offset); } else { length = 16384; } if (fwrite(memory+offset-zorg+16384-length,1,length,fp) != length ) { sprintf(buffer,"Can't write to output file %s\n",name); myexit(buffer,1); } fclose(fp); } z88dk-1.8.ds1/src/appmake/z88shell.c0000644000175000017500000000745210637507164016557 0ustar tygrystygrys/* * Short program to create a z88 shell program * * This simply adds in the length of the program * * * $Id: z88shell.c,v 1.3 2007/06/24 15:32:04 dom Exp $ */ #include "appmake.h" static char *binname = NULL; static char *crtfile = NULL; static char *outfile = NULL; static char help = 0; static unsigned char *memory; /* Pointer to Z80 memory */ static long zorg; /* Origin of compiler program */ /* Options that are available for this module */ option_t z88shell_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'c', "crt0file", "crt0 file used in linking", OPT_STR, &crtfile }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0, NULL, NULL, OPT_NONE, NULL } }; /* Prototypes for our functions */ void save_block(long filesize, char *base, char *ext); /* * Execution starts here */ int z88shell_exec(char *target) { FILE *binfile; /* Read in bin file */ long filesize; long readlen; long header_start; /* Start of file */ long shell_length; /* Where we dump the length */ long start; /* Where we start working from */ long length; unsigned char *ptr; if ( help ) return -1; if ( binname == NULL || crtfile == NULL ) { return -1; } if ( outfile == NULL ) outfile = binname; header_start = parameter_search(crtfile,".map","HEADER_START"); if ( header_start == -1) myexit("Could not find parameter HEADER_START (not a Shell Compile?)\n",1); shell_length = parameter_search(crtfile,".map","SHELL_LENGTH"); if ( shell_length == -1) myexit("Could not find parameter SHELL_LENGTH (not a Shell Compile?)\n",1); start = parameter_search(crtfile,".map","START"); if ( shell_length == -1) myexit("Could not find parameter START (not a Shell Compile?)\n",1); /* allocate some memory */ memory=calloc( 65536 - header_start,1); if (memory == NULL) myexit("Can't allocate memory\n",1); binfile=fopen(binname, "rb"); if (binfile == NULL) myexit("Can't open binary file\n",1); if (fseek(binfile, 0, SEEK_END)) { fclose(binfile); myexit("Couldn't determine the size of the file\n",1); } filesize=ftell(binfile); if (filesize > 65536L ) { fclose(binfile); myexit("The source binary is over 65,536 bytes in length.\n",1); } fseek(binfile, 0, SEEK_SET); readlen = fread(memory,1,filesize,binfile); if ( filesize != readlen ) { fclose(binfile); myexit("Couldn't read in binary file\n",1); } fclose(binfile); /* Get the length as required by the shell (i.e. minus the header */ length = filesize - ( start - header_start ); shell_length -= header_start; /* Write the length */ ptr = memory + shell_length; *ptr++ = ( length & 255 ); *ptr = ( (length >> 8 ) & 255 ); /* Save the file once more */ save_block(filesize,outfile,".com"); myexit(0,0); return 0; } void save_block(long filesize, char *base, char *ext) { char name[FILENAME_MAX+1]; char buffer[LINEMAX+1]; int length; FILE *fp; strcpy(name,base); suffix_change(name,ext); if ( (fp=fopen(name,"wb"))==NULL) { sprintf(buffer,"Can't open output file %s\n",name); myexit(buffer,1); } if (fwrite(memory,1,filesize,fp) != filesize ) { sprintf(buffer,"Can't write to output file %s\n",name); myexit(buffer,1); } fclose(fp); } z88dk-1.8.ds1/src/appmake/zx.c0000644000175000017500000001557110635717762015545 0ustar tygrystygrys/* * Quick 'n' dirty mym to tap converter * * Usage: bin2tap [binfile] [tapfile] * * Dominic Morris - 08/02/2000 - tapmaker * Stefano Bodrato - 03/12/2000 - bin2tap * Stefano Bodrato - 29/05/2001 - ORG parameter added * Dominic Morris - 10/03/2003 - integrated into appmake & options * Stefano Bodrato - 19/07/2007 - BASIC block 'merge' feature * * Creates a new TAP file (overwriting if necessary) just ready to run. * Use tapmaker to customize your work. * * $Id: zx.c,v 1.2 2007/06/19 09:20:50 stefano Exp $ */ #include "appmake.h" static char *binname = NULL; static char *crtfile = NULL; static char *outfile = NULL; static char *blockname = NULL; static char *merge = NULL; static int origin = -1; static char help = 0; static unsigned char parity; /* Options that are available for this module */ option_t zx_options[] = { { 'h', "help", "Display this help", OPT_BOOL, &help}, { 'b', "binfile", "Linked binary file", OPT_STR, &binname }, { 'c', "crt0file", "crt0 file used in linking", OPT_STR, &crtfile }, { 'o', "output", "Name of output file", OPT_STR, &outfile }, { 0 , "merge", "Merge an external TAPE block", OPT_STR, &merge }, { 0 , "org", "Origin of the binary", OPT_INT, &origin }, { 0 , "blockname", "Name of the code block in tap file", OPT_STR, &blockname}, { 0 , NULL, NULL, OPT_NONE, NULL } }; int zx_exec(char *target) { char filename[FILENAME_MAX+1]; char name[11]; char mybuf[20]; FILE *fpin, *fpout, *fpmerge; long pos; int c; int i; int len, mlen; if ( help ) return -1; if ( binname == NULL || ( crtfile == NULL && origin == -1 ) ) { return -1; } if ( outfile == NULL ) { strcpy(filename,binname); suffix_change(filename,".tap"); } else { strcpy(filename,outfile); } if ( blockname == NULL ) blockname = binname; if ( origin != -1 ) { pos = origin; } else { if ( ( pos = parameter_search(crtfile,".sym","MYZORG") ) == -1 ) { myexit("Could not find parameter ZORG (not z88dk compiled?)\n",1); } } if ( (fpin=fopen(binname,"rb") ) == NULL ) { fprintf(stderr,"Can't open input file %s\n",binname); myexit(NULL,1); } /* * Now we try to determine the size of the file * to be converted */ if ( fseek(fpin,0,SEEK_END) ) { fprintf(stderr,"Couldn't determine size of file\n"); fclose(fpin); myexit(NULL,1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(filename,"wb") ) == NULL ) { fclose(fpin); myexit("Can't open output file\n",1); } /* Open and check the optional "merge file" */ mlen=0; if ( merge != NULL ) { if ( (fpmerge=fopen(merge,"rb") ) == NULL ) { printf("File for 'merge' not found: %s\n",merge); fclose(fpin); fclose(fpout); myexit(NULL,1); } /* check the header type (first block must be BASIC) */ fseek(fpmerge,3,SEEK_SET); c=getc(fpmerge); if ( c != 0 ) { fprintf(stderr,"BASIC block not found in file %s\n",merge); fclose(fpin); fclose(fpout); myexit(NULL,1); } fseek(fpmerge,21,SEEK_SET); mlen=getc(fpmerge)+256*getc(fpmerge); /* get block length */ getc(fpmerge); /* skip block type */ } /* BASIC loader */ /* Write out the BASIC header file */ writeword_p(19,fpout,&parity); /* Header len */ writebyte_p(0,fpout,&parity); /* Header is a type 0 block */ parity=0; writebyte_p(0,fpout,&parity); /* Filetype (Basic) */ writestring_p("Loader ",fpout,&parity); writeword_p(0x1e + mlen,fpout,&parity); /* length */ writeword_p(10,fpout,&parity); /* line for auto-start */ writeword_p(0x1e + mlen,fpout,&parity); /* length (?) */ writebyte_p(parity,fpout,&parity); /* Write out the BASIC loader program */ writeword_p(32 + mlen,fpout,&parity); /* block lenght: works if ORG is between 10001 and 65536 (4 digit numbers) */ parity=0; writebyte_p(255,fpout,&parity); /* Data has a block type of 255 */ writebyte_p(0,fpout,&parity); /* MSB of BASIC line number */ writebyte_p(10,fpout,&parity); /* LSB... */ writeword_p(26,fpout,&parity); /* BASIC line length */ writebyte_p(0xfd,fpout,&parity); /* CLEAR */ writebyte_p(0xb0,fpout,&parity); /* VAL */ sprintf(mybuf,"\"%i\":",pos-1); /* location for CLEAR */ writestring_p(mybuf,fpout,&parity); writebyte_p(0xef,fpout,&parity); /* LOAD */ writebyte_p('"',fpout,&parity); writebyte_p('"',fpout,&parity); writebyte_p(0xaf,fpout,&parity); /* CODE */ writebyte_p(':',fpout,&parity); writebyte_p(0xf9,fpout,&parity); /* RANDOMIZE */ writebyte_p(0xc0,fpout,&parity); /* USR */ writebyte_p(0xb0,fpout,&parity); /* VAL */ sprintf(mybuf,"\"%i\"",pos); /* Location for USR */ writestring_p(mybuf,fpout,&parity); writebyte_p(0x0d,fpout,&parity); /* ENTER (end of BASIC line) */ /* Optionally merge a BASIC block from a TAP file */ if ( merge != NULL ) { for (i=0; i= 10 ) { strncpy(name,blockname,10); } else { strcpy(name,blockname); strncat(name," ",10-strlen(blockname)); } for (i=0;i<=9;i++) writebyte_p(name[i],fpout,&parity); writeword_p(len,fpout,&parity); writeword_p(pos,fpout,&parity); /* load address */ writeword_p(0,fpout,&parity); /* offset */ writebyte_p(parity,fpout,&parity); /* Now onto the data bit */ writeword_p(len+2,fpout,&parity); /* Length of next block */ parity=0; writebyte_p(255,fpout,&parity); /* Data has a block type of 255 */ for (i=0; i 49152L ) { fclose(binfile); myexit("The source binary is over 49152 bytes in length.\n",1); } fseek(binfile, 0, SEEK_SET); readlen = fread(memory,1,filesize,binfile); if ( filesize != readlen ) { fclose(binfile); myexit("Couldn't read in binary file\n",1); } fclose(binfile); strcpy(name,outfile); suffix_change(name,".V00"); if ( ( fp = fopen(name,"wb") ) == NULL ) { sprintf(buffer,"Can't open output file %s\n",name); myexit(buffer,1); } sprintf(buffer,"Can't write to output file %s\n",name); header[0]=1; header[1]=zorg/256; header[2]=zorg%256; if (fwrite(&header,1,3,fp)!=3) myexit(buffer,1); position=memory; while (filesize>0) { /* Writing chunk with no compression */ chunk = ( filesize > MAX_CHUNK ) ? MAX_CHUNK : filesize; header[0] = 0xC0 + chunk/256; header[1] = chunk%256; if ( fwrite (&header,1,2,fp) != 2 ) myexit(buffer,1); if ( fwrite(position,1,chunk,fp) != chunk ) myexit(buffer,1); position += chunk; filesize -= chunk; } header[0] = 0; header[1] = zorg/256; header[2] = zorg%256; if ( fwrite(&header,1,3,fp) != 3 ) myexit(buffer,1); fclose(fp); myexit(0,0); } z88dk-1.8.ds1/src/copt/0000755000175000017500000000000010765202715014245 5ustar tygrystygrysz88dk-1.8.ds1/src/copt/copt.10000755000175000017500000001317207460530277015310 0ustar tygrystygrys.de DS .nf .in +3 .sp .. .de DE .sp .in -3 .fi .. .TH copt 1 .SH NAME copt \- peephole optimizer .SH SYNOPSIS \fBcopt\fP [-d] \fIfile\fP ... .SH OPTIONS .TP .B \-\^d Turn on debug modus. Replacements of original patterns will be sent to stderr in the order of execution. .SH DESCRIPTION \fIcopt\fP is a general-purpose peephole optimizer. It reads code from its standard input and writes an improved version to its standard output. \fIcopt\fP reads the named files for its optimizations, which are encoded as follows: .DS ... = ... .DE Pattern matching uses literal string comparison, with these exceptions: ``%%'' matches the ``%'' character, and ``%'' followed by a digit matches everything up to the next occurrence of the next pattern character, though all occurrences of %\fIn\fP must denote the same string. For example, the pattern ``%1=%1.'' matches exactly those strings that begin with a string X, followed by a ``='' (the first), followed by a second occurrence of X, followed by a period. In this way, the input/output pattern .DS mov $%1,r%2 mov *r%2,r%2 = mov %1,r%2 .DE commands \fIcopt\fP to replace runs like .DS mov $_a,r3 mov *r3,r3 .DE with .DS mov _a,r3 .DE Note that a tab or newline can terminate a %\fIn\fP variable. .LP In the input pattern, you can use \fIregular exporessions\fP to match input patterns and generate values for variables. The syntax is .DS %"\fI\fP"\fI\fP .DE where \fI\fP is the (extended) POSIX regular expression and \fI\fP \fIoptional\fP variable ident (as above). If the expression matches input, the matched pattern will be assigned to the variable. If there is at least one subexpression in \fI\fP and a variable is specified, then the match of the \fUfirst\fP subexpression will be taken. Prefix and suffix (if any) will be skipped. Example: .DS \fIj%"."0 %"(.),"1%2\fP matches \fBjr c,l_label\fP and assignes '\fIr\fP' to %0, '\fIc\fP' to %1 and '\fIl_label\fP' to %2. It won't match jr nc,l_label. This can be used to output inverted jumps: \fIj%0 n%1,%2\fP will gain \fIjr nc,l_label\fP. .DE \fBImportant\fP: If setting a variable, you \fImust\fP use the \fIlast\fP occurance of the variable in the input pattern, because copt matches input patterns in reverse order. .LP Occurances of %L, %M or %N in the output pattern will be substituted by unique integers to allow creation of up to 3 labels. For example, the output pattern .DS sbc hl,de jr c,_unique_%L jr z,_unique_%M inc a ._unique_%L inc a ._unique_%M .DE could produce .DS sbc hl,de jr c,_unique_1 jr z,_unique_2 inc a ._unique_1 inc a ._unique_2 .DE .LP If the second part of a rule starts with the line \fI%once\fP, this rule will be "fired" only once. Example: .DS ---- rules ---- ---- source ---- .%0 .l_10 j%"r|p"2 %1 jp l_label = ... %activate jr l_10 .%0 ... j%2 %1 .l_label = ... %activate .%1 ---- result ---- = ... %%once jp l_10 .%0 ... .%1 .l10 %activate .l_label jr %0 ... = jp %0 .DE .LP If the output pattern starts with \fI%activate\fP it has to contain a valid rule that will be "activated" upon first match. \fIcopt\fP first evaluates the contained rule (i.e. replaces %\fIn\fP variables as usual) and then replaces the current rule with the contained one. At the same time, a flag is set, that will cause a new pass through the source after the current pass finishes. Nested activations are allowed. Note that you have to duplicate all \fI%\fP characters with each nesting level. .LP Example rule Source Output --------------- ------------------ ----------------- .%0 jp z,l_label jp z,l_other jp %1 ... ... = ... ... %activate .l_label .l_label .%1 jp l_other jp l_other = ... ... %%activate ... ... jp%%%%0%0 .l_other .l_other = ... ... jp%%%%0%1 .LP You can activate several rules at once, simply by appending further rules, separated by an '%activate' line. .LP Blank lines and lines starting with \fI;;\fP in the first column that occure in front of a rule will be ignored. This allows to comment the rule file and add some blank lines between them for better readability. ;; this is a comment .LP \fIcopt\fP compares each run of input patterns with the current input instruction and its predecessors. If no match is found, it advances to the next input instruction and tries again. Otherwise, it replaces the input instructions with the corresponding output patterns, pattern variables instantiated, and resumes its search with the \fIfirst\fP instruction of the replacement. \fIcopt\fP matches input patterns in reverse order to cascade optimizations without backing up. .SH BUGS Errors in optimization files are always possible. .SH SEE ALSO regex(7) .SH AUTHORS .TP .B \^Christian W. Fraser 1984 copt version 1.00 .TP .B \^DG 1999 Added out of memory checking and ANSI prototyping .TP .B \^Zrin Ziborski 2002 Added comment lines, %L-%N variables, %activate, regexp capability and %check z88dk-1.8.ds1/src/copt/copt.c0000755000175000017500000003403107541137357015371 0ustar tygrystygrys/* copt version 1.00 (C) Copyright Christopher W. Fraser 1984 */ /* Added out of memory checking and ANSI prototyping. DG 1999 */ /* Added %L - %N variables, %activate, regexp, %check. Zrin Z. 2002 */ #include #include #include #include #ifdef USE_REGEXP #include #ifdef LOCAL_REGEXP #include "regex/regex.h" #else #include #endif #endif #if defined(_MSC_VER) || defined(__TURBOC__) #define strcasecmp stricmp #endif #define HSIZE 107 #define MAXLINE 256 #define MAXFIRECOUNT 65535L #define MAX_PASS 16 int debug = 0; int global_again = 0; /* signalize that rule set has changed */ #define FIRSTLAB 'L' #define LASTLAB 'N' int nextlab = 1; /* unique label counter */ int labnum[LASTLAB - FIRSTLAB + 1]; /* unique label numbers */ struct lnode { char *l_text; struct lnode *l_prev, *l_next; }; struct onode { struct lnode *o_old, *o_new; struct onode *o_next; long firecount; } *opts = 0, *activerule = 0; void printlines(struct lnode *beg, struct lnode *end, FILE *out) { struct lnode *p; for (p = beg; p != end; p = p->l_next) fputs(p->l_text, out); } void printrule(struct onode *o, FILE *out) { struct lnode *p = o->o_old; while (p->l_prev) p = p->l_prev; printlines(p, 0, out); fputs("=\n", out); printlines(o->o_new, 0, out); } /* error - report error and quit */ void error(char *s) { fputs(s, stderr); if (activerule) { fputs("active rule:\n", stderr); printrule(activerule, stderr); } exit(1); } /* connect - connect p1 to p2 */ void connect(struct lnode *p1, struct lnode *p2) { if (p1 == 0 || p2 == 0) error("connect: can't happen\n"); p1->l_next = p2; p2->l_prev = p1; } /* install - install str in string table */ char *install(char *str) { register struct hnode *p; register char *p1, *p2, *s; register int i; static struct hnode { char *h_str; struct hnode *h_ptr; } *htab[HSIZE] = {0}; s = str; for (i = 0; *s; i += *s++) ; i %= HSIZE; for (p = htab[i]; p; p = p->h_ptr) for (p1=str, p2=p->h_str; *p1++ == *p2++; ) if (p1[-1] == '\0') return (p->h_str); p = (struct hnode *) malloc(sizeof *p); if(p==NULL) error("install 1: out of memory\n"); p->h_str = (char *) malloc((s-str)+1); if(p->h_str==NULL) error("install 2: out of memory\n"); strcpy(p->h_str, str); p->h_ptr = htab[i]; htab[i] = p; return (p->h_str); } /* insert - insert a new node with text s before node p */ void insert(char *s, struct lnode *p) { struct lnode *n; n = (struct lnode *) malloc(sizeof *n); if(n==NULL) error("insert: out of memory\n"); n->l_text = s; connect(p->l_prev, n); connect(n, p); } /* getlst - link lines from fp in between p1 and p2 */ void getlst(FILE *fp, char *quit, struct lnode *p1, struct lnode *p2) { char *install(), lin[MAXLINE]; connect(p1, p2); while (fgets(lin, MAXLINE, fp) != NULL && strcmp(lin, quit)) { insert(install(lin), p2); } } /* getlst_1 - link lines from fp in between p1 and p2 */ /* skip blank lines and comments at the start */ void getlst_1(FILE *fp, char *quit, struct lnode *p1, struct lnode *p2) { char *install(), lin[MAXLINE]; int firstline = 1; connect(p1, p2); while (fgets(lin, MAXLINE, fp) != NULL && strcmp(lin, quit)) { if (firstline) { char *p = lin; while (isspace(*p)) ++p; if (! *p) continue; if (lin[0] == ';' && lin[1] == ';') continue; firstline = 0; } insert(install(lin), p2); } } /* init - read patterns file */ void init(FILE *fp) { struct lnode head, tail; struct onode *p, **next; next = &opts; while (*next) next = &((*next)->o_next); while (!feof(fp)) { p = (struct onode *) malloc((unsigned) sizeof(struct onode)); if(p==NULL) error("init: out of memory\n"); p->firecount = MAXFIRECOUNT; getlst_1(fp, "=\n", &head, &tail); head.l_next->l_prev = 0; if (tail.l_prev) tail.l_prev->l_next = 0; p->o_old = tail.l_prev; if (p->o_old == NULL) { /* do not create empty rules */ free(p); continue; } getlst(fp, "\n", &head, &tail); tail.l_prev->l_next = 0; if (head.l_next) head.l_next->l_prev = 0; p->o_new = head.l_next; *next = p; next = &p->o_next; } *next = 0; } /* match - check conditions in rules */ /* format: %check min <= %n <= max */ int check(char *pat, char **vars) { int low, high, x; char v; x = sscanf(pat, "%d <= %%%c <= %d", &low, &v, &high); if (x != 3 || !('0' <= v && v <= '9')) { fprintf(stderr, "warning: invalid use of '%%check' in \"%s\"\n", pat); fprintf(stderr, "format is '%%check min <= %%n <= max'\n"); return 0; } if (vars[v - '0'] == 0) { fprintf(stderr, "error in pattern \"%s\"\n", pat); error("variable is not set\n"); } if (sscanf(vars[v - '0'], "%d", &x) != 1) return 0; return low <= x && x <= high; } /* match - match ins against pat and set vars */ int match(char *ins, char *pat, char **vars) { char *p, lin[MAXLINE], *start = pat; #ifdef USE_REGEXP char re[MAXLINE]; /* regular expression */ char *istart = ins; regex_t reg; #define NMATCH 3 regmatch_t match[NMATCH]; char var; int reerr, eflags, mi; #endif while (*ins && *pat) if (pat[0] == '%') { switch (pat[1]) { case '%': if (*pat != *ins++) return 0; pat += 2; break; #ifdef USE_REGEXP case '"': p = pat + 2; for (; *p && (*p != '"' || p[-1] == '\\'); ++p) ; if (*p != '"') { fprintf(stderr, "warning: invalid use of '%%\"..\"n' in \"%s\"\n", start); break; } if (isdigit(p[1])) var = p[1]; else var = 0; if (var && vars[var-'0'] != 0) { fprintf(stderr, "warning: variable %%%c has already a value in \"%s\"\n", p[1], start); fprintf(stderr, "please use REGEXP only on the last occurance of a variable\ in the input pattern\n", p[1], start); goto l_fallthrough; } strncpy(re, pat + 2, p - pat - 2); re[p - pat - 2] = '\0'; pat = p; reerr = regcomp(®, re, REG_EXTENDED); if (reerr != 0) { regerror(reerr, ®, re, sizeof(re)); fprintf(stderr, "error in \"%s\": %s\n", start, re); error("error: invalid rule\n"); } eflags = 0; if (ins != istart) eflags |= REG_NOTBOL; reerr = regexec(®, ins, NMATCH, match, eflags); if (reerr != 0 && reerr != REG_NOMATCH) { regerror(reerr, ®, re, sizeof(re)); fprintf(stderr, "error in \"%s\": %s\n", start, re); error("error: while matching REGEXP\n"); } regfree(®); if (reerr != 0 || match[0].rm_so != 0) return 0; /* not matched */ mi = match[1].rm_eo == -1 ? 0 : 1; /* which match to use */ if (var) { int i = match[mi].rm_eo - match[mi].rm_so; strncpy(re, ins + match[mi].rm_so, i); re[i] = '\0'; ins += match[0].rm_eo; /* eat whole match */ vars[var - '0'] = install(re); pat += 2; } else { ins += match[0].rm_eo; ++pat; } continue; l_fallthrough: #endif case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (pat[2] == '%' && pat[3] != '%') { fprintf(stderr, "error in \"%s\": ", start); error("input pattern %n% is not allowed\n"); } for (p = lin; *ins && *ins != pat[2];) *p++ = *ins++; *p = 0; p = install(lin); if (vars[pat[1]-'0'] == 0) vars[pat[1]-'0'] = p; else if (vars[pat[1]-'0'] != p) return 0; pat += 2; continue; default: break; } if (*pat++ != *ins++) return 0; } else if (*pat++ != *ins++) return 0; return *pat == *ins; /* compare end of string */ } /* subst_imp - return result of substituting vars into pat */ char *subst_imp(char *pat, char **vars) { static char errormsg[80]; static char lin[MAXLINE]; char num[30]; char *s, *start = pat; int i; i = 0; for (;;) if (pat[0] == '%' && pat[1] == '%') { if (i < MAXLINE) { lin[i] = '%'; ++i; } pat += 2; } else if (pat[0] == '%' && pat[1] >= FIRSTLAB && pat[1] <= LASTLAB) { int il = pat[1] - FIRSTLAB; if (! labnum[il]) labnum[il] = nextlab++; sprintf(num, "%d", labnum[il]); for (s = num; i < MAXLINE && (lin[i] = *s++) != 0; ++i) ; pat += 2; } else if (pat[0] == '%' && isdigit(pat[1])) { if (vars[pat[1]-'0'] == 0) { sprintf(errormsg, "error: variable %c is not set in \"%s\"", pat[1], start); error(errormsg); } for (s = vars[pat[1]-'0']; i < MAXLINE && (lin[i] = *s++) != 0; i++) ; pat += 2; } else if (i >= MAXLINE) error("line too long\n"); else if (!(lin[i++] = *pat++)) return &lin[0]; } /* subst - return install(result of substituting vars into pat) */ char *subst(char *pat, char **vars) { return install(subst_imp(pat, vars)); } /* rep - substitute vars into new and replace lines between p1 and p2 */ struct lnode *rep( struct lnode *p1, struct lnode *p2, struct lnode *new, char **vars) { char *exec(), *subst(); int i; struct lnode *p, *psav; for (i = 0; i < LASTLAB - FIRSTLAB + 1; ++i) labnum[i] = 0; for (p = p1->l_next; p != p2; p = psav) { psav = p->l_next; if (debug) fputs(p->l_text, stderr); free(p); } connect(p1, p2); if (debug) fputs("=\n", stderr); for (; new; new = new->l_next) { insert(subst(new->l_text, vars), p2); if (debug) fputs(p2->l_prev->l_text, stderr); } if (debug) putc('\n', stderr); return p1->l_next; } /* copylist - copy activated rule; substitute variables */ struct lnode * copylist( struct lnode *source, struct lnode **pat, struct lnode **sub, char **vars) { struct lnode head, tail, *more = 0; int pattern = 1; /* allow nested rules */ int i; connect(&head, &tail); head.l_prev = tail.l_next = 0; for (i = 0; i < LASTLAB - FIRSTLAB + 1; ++i) labnum[i] = 0; for (; source; source = source->l_next) { if (pattern && strcmp(source->l_text, "=\n") == 0) { pattern = 0; if (head.l_next == &tail) error("error: empty pattern\n"); *pat = tail.l_prev; head.l_next->l_prev = 0; tail.l_prev->l_next = 0; connect(&head, &tail); continue; } if (strcmp(source->l_text, "%activate\n") == 0) { if (pattern) error("error: %activate in pattern (before '=')\n"); more = source->l_next; break; } insert(subst(source->l_text, vars), &tail); } if (head.l_next == &tail) *sub = 0; else { head.l_next->l_prev = 0; tail.l_prev->l_next = 0; *sub = head.l_next; } return more; } /* opt - replace instructions ending at r if possible */ struct lnode *opt(struct lnode *r) { char *vars[10]; int i, lines; struct lnode *c, *p; struct onode *o; static char *activated = "%activated "; for (o = opts; o; o = o->o_next) { activerule = o; if (o->firecount < 1) continue; c = r; p = o->o_old; if (p == 0) continue; /* skip empty rules */ for (i = 0; i < 10; i++) vars[i] = 0; lines = 0; while (p && c) { if (strncmp(p->l_text, "%check", 6) == 0) { if (! check(p->l_text + 6, vars)) break; } else { if (! match(c->l_text, p->l_text, vars)) break; c = c->l_prev; ++lines; } p = p->l_prev; } if (p != 0) continue; /* decrease firecount */ --o->firecount; /* check for %once */ if (o->o_new && strcmp(o->o_new->l_text, "%once\n") == 0) { struct lnode *tmp = o->o_new; /* delete the %once line */ o->o_new = o->o_new->l_next; o->o_new->l_prev = 0; free(tmp); o->firecount = 0; /* never again */ } /* check for activation rules */ if (o->o_new && strcmp(o->o_new->l_text, "%activate\n") == 0) { /* we have to prevent repeated activation of rules */ char signature[160]; struct lnode *lnp; struct onode *nn, *last; int skip = 0; /* since we 'install()' strings, we can compare pointers */ sprintf(signature, "%s%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x\n", activated, vars[0], vars[1], vars[2], vars[3], vars[4], vars[5], vars[6], vars[7], vars[8], vars[9]); lnp = o->o_new->l_next; while (lnp && strncmp(lnp->l_text, activated, strlen(activated)) == 0) { if (strcmp(lnp->l_text, signature) == 0) { skip = 1; break; } lnp = lnp->l_next; } if (! lnp || skip) continue; insert(install(signature), lnp); if (debug) { fputs("matched pattern:\n", stderr); for (p = o->o_old; p->l_prev; p = p->l_prev) ; printlines(p, 0, stderr); fputs("with:\n", stderr); printlines(c->l_next, r->l_next, stderr); } /* allow creation of several rules */ last = o; while (lnp) { nn = (struct onode *) malloc((unsigned) sizeof(struct onode)); if(nn == NULL) error("activate: out of memory\n"); nn->o_old = 0, nn->o_new = 0; nn->firecount = MAXFIRECOUNT; lnp = copylist(lnp, &nn->o_old, &nn->o_new, vars); nn->o_next = last->o_next; last->o_next = nn; last = nn; if (debug) { fputs("activated rule:\n", stderr); printrule(nn, stderr); } } if (debug) fputs("\n", stderr); /* step back to allow (shorter) activated rules to match in the order they appear */ while (--lines && r->l_prev) r = r->l_prev; global_again = 1; /* signalize changes */ continue; } /* fire the rule */ r = rep(c, r->l_next, o->o_new, vars); activerule = 0; return r; } activerule = 0; return r->l_next; } /* #define _TESTING */ /* main - peephole optimizer */ main(int argc, char **argv) { FILE *fp; #ifdef _TESTING FILE *inp; #endif int i, pass; struct lnode head, *p, *opt(), tail; for (i = 1; i < argc; i++) if (strcasecmp(argv[i], "-D") == 0) debug = 1; else if ((fp=fopen(argv[i], "r")) == NULL) error("copt: can't open patterns file\n"); else init(fp); #ifdef _TESTING if ((inp = fopen("input.asm", "r")) == NULL) error("copt: can't open input.asm\n"); getlst(inp, "", &head, &tail); #else getlst(stdin, "", &head, &tail); #endif head.l_text = tail.l_text = ""; pass = 0; do { ++pass; if (debug) fprintf(stderr, "\n--- pass %d ---\n", pass); global_again = 0; for (p = head.l_next; p != &tail; p = opt(p)) ; } while (global_again && pass < MAX_PASS); if (global_again) { fprintf(stderr, "error: maximum of %d passes exceeded\n", MAX_PASS); error(" check for recursive substitutions"); } printlines(head.l_next, &tail, stdout); exit(0); return 1; /* make compiler happy */ } z88dk-1.8.ds1/src/copt/copt.vcproj0000755000175000017500000001124110762606647016452 0ustar tygrystygrys z88dk-1.8.ds1/src/copt/Makefile0000755000175000017500000000027507575162711015722 0ustar tygrystygrys OBJS = copt.o CC = gcc all: copt copt: $(OBJS) $(CC) -o copt $(LDFLAGS) $(OBJS) install: install copt $(PREFIX)/bin clean: $(RM) copt copt.o core #Dependencies copt.o: copt.c z88dk-1.8.ds1/src/copt/regex/0000755000175000017500000000000010765202715015357 5ustar tygrystygrysz88dk-1.8.ds1/src/copt/regex/cclass.h0000644000175000017500000000162507541137357017013 0ustar tygrystygrys/* character-class table */ static struct cclass { char *name; char *chars; char *multis; } cclasses[] = { "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ 0123456789", "", "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "", "blank", " \t", "", "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\ \25\26\27\30\31\32\33\34\35\36\37\177", "", "digit", "0123456789", "", "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "", "lower", "abcdefghijklmnopqrstuvwxyz", "", "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", "", "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "", "space", "\t\n\v\f\r ", "", "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "xdigit", "0123456789ABCDEFabcdef", "", NULL, 0, "" }; z88dk-1.8.ds1/src/copt/regex/cname.h0000644000175000017500000000351207541137357016623 0ustar tygrystygrys/* character-name table */ static struct cname { char *name; char code; } cnames[] = { "NUL", '\0', "SOH", '\001', "STX", '\002', "ETX", '\003', "EOT", '\004', "ENQ", '\005', "ACK", '\006', "BEL", '\007', "alert", '\007', "BS", '\010', "backspace", '\b', "HT", '\011', "tab", '\t', "LF", '\012', "newline", '\n', "VT", '\013', "vertical-tab", '\v', "FF", '\014', "form-feed", '\f', "CR", '\015', "carriage-return", '\r', "SO", '\016', "SI", '\017', "DLE", '\020', "DC1", '\021', "DC2", '\022', "DC3", '\023', "DC4", '\024', "NAK", '\025', "SYN", '\026', "ETB", '\027', "CAN", '\030', "EM", '\031', "SUB", '\032', "ESC", '\033', "IS4", '\034', "FS", '\034', "IS3", '\035', "GS", '\035', "IS2", '\036', "RS", '\036', "IS1", '\037', "US", '\037', "space", ' ', "exclamation-mark", '!', "quotation-mark", '"', "number-sign", '#', "dollar-sign", '$', "percent-sign", '%', "ampersand", '&', "apostrophe", '\'', "left-parenthesis", '(', "right-parenthesis", ')', "asterisk", '*', "plus-sign", '+', "comma", ',', "hyphen", '-', "hyphen-minus", '-', "period", '.', "full-stop", '.', "slash", '/', "solidus", '/', "zero", '0', "one", '1', "two", '2', "three", '3', "four", '4', "five", '5', "six", '6', "seven", '7', "eight", '8', "nine", '9', "colon", ':', "semicolon", ';', "less-than-sign", '<', "equals-sign", '=', "greater-than-sign", '>', "question-mark", '?', "commercial-at", '@', "left-square-bracket", '[', "backslash", '\\', "reverse-solidus", '\\', "right-square-bracket", ']', "circumflex", '^', "circumflex-accent", '^', "underscore", '_', "low-line", '_', "grave-accent", '`', "left-brace", '{', "left-curly-bracket", '{', "vertical-line", '|', "right-brace", '}', "right-curly-bracket", '}', "tilde", '~', "DEL", '\177', NULL, 0, }; z88dk-1.8.ds1/src/copt/regex/COPYRIGHT0000644000175000017500000000167507541137357016672 0ustar tygrystygrysCopyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved. This software is not subject to any license of the American Telephone and Telegraph Company or of the Regents of the University of California. Permission is granted to anyone to use this software for any purpose on any computer system, and to alter it and redistribute it, subject to the following restrictions: 1. The author is not responsible for the consequences of use of this software, no matter how awful, even if they arise from flaws in it. 2. The origin of this software must not be misrepresented, either by explicit claim or by omission. Since few users ever read sources, credits must appear in the documentation. 3. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software. Since few users ever read sources, credits must appear in the documentation. 4. This notice may not be removed or altered. z88dk-1.8.ds1/src/copt/regex/engine.c0000644000175000017500000006171007541137357017004 0ustar tygrystygrys/* * The matching engine and friends. This file is #included by regexec.c * after suitable #defines of a variety of macros used herein, so that * different state representations can be used without duplicating masses * of code. */ #ifdef SNAMES #define matcher smatcher #define fast sfast #define slow sslow #define dissect sdissect #define backref sbackref #define step sstep #define print sprint #define at sat #define match smat #endif #ifdef LNAMES #define matcher lmatcher #define fast lfast #define slow lslow #define dissect ldissect #define backref lbackref #define step lstep #define print lprint #define at lat #define match lmat #endif /* another structure passed up and down to avoid zillions of parameters */ struct match { struct re_guts *g; int eflags; regmatch_t *pmatch; /* [nsub+1] (0 element unused) */ char *offp; /* offsets work from here */ char *beginp; /* start of string -- virtual NUL precedes */ char *endp; /* end of string -- virtual NUL here */ char *coldp; /* can be no match starting before here */ char **lastpos; /* [nplus+1] */ STATEVARS; states st; /* current states */ states fresh; /* states for a fresh start */ states tmp; /* temporary */ states empty; /* empty set of states */ }; #include "engine.h" #ifdef REDEBUG #define SP(t, s, c) print(m, t, s, c, stdout) #define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2) #define NOTE(str) { if (m->eflags®_TRACE) printf("=%s\n", (str)); } #else #define SP(t, s, c) /* nothing */ #define AT(t, p1, p2, s1, s2) /* nothing */ #define NOTE(s) /* nothing */ #endif /* - matcher - the actual matching engine == static int matcher(register struct re_guts *g, char *string, \ == size_t nmatch, regmatch_t pmatch[], int eflags); */ static int /* 0 success, REG_NOMATCH failure */ matcher(g, string, nmatch, pmatch, eflags) register struct re_guts *g; char *string; size_t nmatch; regmatch_t pmatch[]; int eflags; { register char *endp; register int i; struct match mv; register struct match *m = &mv; register char *dp; const register sopno gf = g->firststate+1; /* +1 for OEND */ const register sopno gl = g->laststate; char *start; char *stop; /* simplify the situation where possible */ if (g->cflags®_NOSUB) nmatch = 0; if (eflags®_STARTEND) { start = string + pmatch[0].rm_so; stop = string + pmatch[0].rm_eo; } else { start = string; stop = start + strlen(start); } if (stop < start) return(REG_INVARG); /* prescreening; this does wonders for this rather slow code */ if (g->must != NULL) { for (dp = start; dp < stop; dp++) if (*dp == g->must[0] && stop - dp >= g->mlen && memcmp(dp, g->must, (size_t)g->mlen) == 0) break; if (dp == stop) /* we didn't find g->must */ return(REG_NOMATCH); } /* match struct setup */ m->g = g; m->eflags = eflags; m->pmatch = NULL; m->lastpos = NULL; m->offp = string; m->beginp = start; m->endp = stop; STATESETUP(m, 4); SETUP(m->st); SETUP(m->fresh); SETUP(m->tmp); SETUP(m->empty); CLEAR(m->empty); /* this loop does only one repetition except for backrefs */ for (;;) { endp = fast(m, start, stop, gf, gl); if (endp == NULL) { /* a miss */ STATETEARDOWN(m); return(REG_NOMATCH); } if (nmatch == 0 && !g->backrefs) break; /* no further info needed */ /* where? */ assert(m->coldp != NULL); for (;;) { NOTE("finding start"); endp = slow(m, m->coldp, stop, gf, gl); if (endp != NULL) break; assert(m->coldp < m->endp); m->coldp++; } if (nmatch == 1 && !g->backrefs) break; /* no further info needed */ /* oh my, he wants the subexpressions... */ if (m->pmatch == NULL) m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) * sizeof(regmatch_t)); if (m->pmatch == NULL) { STATETEARDOWN(m); return(REG_ESPACE); } for (i = 1; i <= m->g->nsub; i++) m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1; if (!g->backrefs && !(m->eflags®_BACKR)) { NOTE("dissecting"); dp = dissect(m, m->coldp, endp, gf, gl); } else { if (g->nplus > 0 && m->lastpos == NULL) m->lastpos = (char **)malloc((g->nplus+1) * sizeof(char *)); if (g->nplus > 0 && m->lastpos == NULL) { free(m->pmatch); STATETEARDOWN(m); return(REG_ESPACE); } NOTE("backref dissect"); dp = backref(m, m->coldp, endp, gf, gl, (sopno)0); } if (dp != NULL) break; /* uh-oh... we couldn't find a subexpression-level match */ assert(g->backrefs); /* must be back references doing it */ assert(g->nplus == 0 || m->lastpos != NULL); for (;;) { if (dp != NULL || endp <= m->coldp) break; /* defeat */ NOTE("backoff"); endp = slow(m, m->coldp, endp-1, gf, gl); if (endp == NULL) break; /* defeat */ /* try it on a shorter possibility */ #ifndef NDEBUG for (i = 1; i <= m->g->nsub; i++) { assert(m->pmatch[i].rm_so == -1); assert(m->pmatch[i].rm_eo == -1); } #endif NOTE("backoff dissect"); dp = backref(m, m->coldp, endp, gf, gl, (sopno)0); } assert(dp == NULL || dp == endp); if (dp != NULL) /* found a shorter one */ break; /* despite initial appearances, there is no match here */ NOTE("false alarm"); start = m->coldp + 1; /* recycle starting later */ assert(start <= stop); } /* fill in the details if requested */ if (nmatch > 0) { pmatch[0].rm_so = m->coldp - m->offp; pmatch[0].rm_eo = endp - m->offp; } if (nmatch > 1) { assert(m->pmatch != NULL); for (i = 1; i < nmatch; i++) if (i <= m->g->nsub) pmatch[i] = m->pmatch[i]; else { pmatch[i].rm_so = -1; pmatch[i].rm_eo = -1; } } if (m->pmatch != NULL) free((char *)m->pmatch); if (m->lastpos != NULL) free((char *)m->lastpos); STATETEARDOWN(m); return(0); } /* - dissect - figure out what matched what, no back references == static char *dissect(register struct match *m, char *start, \ == char *stop, sopno startst, sopno stopst); */ static char * /* == stop (success) always */ dissect(m, start, stop, startst, stopst) register struct match *m; char *start; char *stop; sopno startst; sopno stopst; { register int i; register sopno ss; /* start sop of current subRE */ register sopno es; /* end sop of current subRE */ register char *sp; /* start of string matched by it */ register char *stp; /* string matched by it cannot pass here */ register char *rest; /* start of rest of string */ register char *tail; /* string unmatched by rest of RE */ register sopno ssub; /* start sop of subsubRE */ register sopno esub; /* end sop of subsubRE */ register char *ssp; /* start of string matched by subsubRE */ register char *sep; /* end of string matched by subsubRE */ register char *oldssp; /* previous ssp */ register char *dp; AT("diss", start, stop, startst, stopst); sp = start; for (ss = startst; ss < stopst; ss = es) { /* identify end of subRE */ es = ss; switch (OP(m->g->strip[es])) { case OPLUS_: case OQUEST_: es += OPND(m->g->strip[es]); break; case OCH_: while (OP(m->g->strip[es]) != O_CH) es += OPND(m->g->strip[es]); break; } es++; /* figure out what it matched */ switch (OP(m->g->strip[ss])) { case OEND: assert(nope); break; case OCHAR: sp++; break; case OBOL: case OEOL: case OBOW: case OEOW: break; case OANY: case OANYOF: sp++; break; case OBACK_: case O_BACK: assert(nope); break; /* cases where length of match is hard to find */ case OQUEST_: stp = stop; for (;;) { /* how long could this one be? */ rest = slow(m, sp, stp, ss, es); assert(rest != NULL); /* it did match */ /* could the rest match the rest? */ tail = slow(m, rest, stop, es, stopst); if (tail == stop) break; /* yes! */ /* no -- try a shorter match for this one */ stp = rest - 1; assert(stp >= sp); /* it did work */ } ssub = ss + 1; esub = es - 1; /* did innards match? */ if (slow(m, sp, rest, ssub, esub) != NULL) { dp = dissect(m, sp, rest, ssub, esub); assert(dp == rest); } else /* no */ assert(sp == rest); sp = rest; break; case OPLUS_: stp = stop; for (;;) { /* how long could this one be? */ rest = slow(m, sp, stp, ss, es); assert(rest != NULL); /* it did match */ /* could the rest match the rest? */ tail = slow(m, rest, stop, es, stopst); if (tail == stop) break; /* yes! */ /* no -- try a shorter match for this one */ stp = rest - 1; assert(stp >= sp); /* it did work */ } ssub = ss + 1; esub = es - 1; ssp = sp; oldssp = ssp; for (;;) { /* find last match of innards */ sep = slow(m, ssp, rest, ssub, esub); if (sep == NULL || sep == ssp) break; /* failed or matched null */ oldssp = ssp; /* on to next try */ ssp = sep; } if (sep == NULL) { /* last successful match */ sep = ssp; ssp = oldssp; } assert(sep == rest); /* must exhaust substring */ assert(slow(m, ssp, sep, ssub, esub) == rest); dp = dissect(m, ssp, sep, ssub, esub); assert(dp == sep); sp = rest; break; case OCH_: stp = stop; for (;;) { /* how long could this one be? */ rest = slow(m, sp, stp, ss, es); assert(rest != NULL); /* it did match */ /* could the rest match the rest? */ tail = slow(m, rest, stop, es, stopst); if (tail == stop) break; /* yes! */ /* no -- try a shorter match for this one */ stp = rest - 1; assert(stp >= sp); /* it did work */ } ssub = ss + 1; esub = ss + OPND(m->g->strip[ss]) - 1; assert(OP(m->g->strip[esub]) == OOR1); for (;;) { /* find first matching branch */ if (slow(m, sp, rest, ssub, esub) == rest) break; /* it matched all of it */ /* that one missed, try next one */ assert(OP(m->g->strip[esub]) == OOR1); esub++; assert(OP(m->g->strip[esub]) == OOR2); ssub = esub + 1; esub += OPND(m->g->strip[esub]); if (OP(m->g->strip[esub]) == OOR2) esub--; else assert(OP(m->g->strip[esub]) == O_CH); } dp = dissect(m, sp, rest, ssub, esub); assert(dp == rest); sp = rest; break; case O_PLUS: case O_QUEST: case OOR1: case OOR2: case O_CH: assert(nope); break; case OLPAREN: i = OPND(m->g->strip[ss]); assert(0 < i && i <= m->g->nsub); m->pmatch[i].rm_so = sp - m->offp; break; case ORPAREN: i = OPND(m->g->strip[ss]); assert(0 < i && i <= m->g->nsub); m->pmatch[i].rm_eo = sp - m->offp; break; default: /* uh oh */ assert(nope); break; } } assert(sp == stop); return(sp); } /* - backref - figure out what matched what, figuring in back references == static char *backref(register struct match *m, char *start, \ == char *stop, sopno startst, sopno stopst, sopno lev); */ static char * /* == stop (success) or NULL (failure) */ backref(m, start, stop, startst, stopst, lev) register struct match *m; char *start; char *stop; sopno startst; sopno stopst; sopno lev; /* PLUS nesting level */ { register int i; register sopno ss; /* start sop of current subRE */ register char *sp; /* start of string matched by it */ register sopno ssub; /* start sop of subsubRE */ register sopno esub; /* end sop of subsubRE */ register char *ssp; /* start of string matched by subsubRE */ register char *dp; register size_t len; register int hard; register sop s; register regoff_t offsave; register cset *cs; AT("back", start, stop, startst, stopst); sp = start; /* get as far as we can with easy stuff */ hard = 0; for (ss = startst; !hard && ss < stopst; ss++) switch (OP(s = m->g->strip[ss])) { case OCHAR: if (sp == stop || *sp++ != (char)OPND(s)) return(NULL); break; case OANY: if (sp == stop) return(NULL); sp++; break; case OANYOF: cs = &m->g->sets[OPND(s)]; if (sp == stop || !CHIN(cs, *sp++)) return(NULL); break; case OBOL: if ( (sp == m->beginp && !(m->eflags®_NOTBOL)) || (sp < m->endp && *(sp-1) == '\n' && (m->g->cflags®_NEWLINE)) ) { /* yes */ } else return(NULL); break; case OEOL: if ( (sp == m->endp && !(m->eflags®_NOTEOL)) || (sp < m->endp && *sp == '\n' && (m->g->cflags®_NEWLINE)) ) { /* yes */ } else return(NULL); break; case OBOW: if (( (sp == m->beginp && !(m->eflags®_NOTBOL)) || (sp < m->endp && *(sp-1) == '\n' && (m->g->cflags®_NEWLINE)) || (sp > m->beginp && !ISWORD(*(sp-1))) ) && (sp < m->endp && ISWORD(*sp)) ) { /* yes */ } else return(NULL); break; case OEOW: if (( (sp == m->endp && !(m->eflags®_NOTEOL)) || (sp < m->endp && *sp == '\n' && (m->g->cflags®_NEWLINE)) || (sp < m->endp && !ISWORD(*sp)) ) && (sp > m->beginp && ISWORD(*(sp-1))) ) { /* yes */ } else return(NULL); break; case O_QUEST: break; case OOR1: /* matches null but needs to skip */ ss++; s = m->g->strip[ss]; do { assert(OP(s) == OOR2); ss += OPND(s); } while (OP(s = m->g->strip[ss]) != O_CH); /* note that the ss++ gets us past the O_CH */ break; default: /* have to make a choice */ hard = 1; break; } if (!hard) { /* that was it! */ if (sp != stop) return(NULL); return(sp); } ss--; /* adjust for the for's final increment */ /* the hard stuff */ AT("hard", sp, stop, ss, stopst); s = m->g->strip[ss]; switch (OP(s)) { case OBACK_: /* the vilest depths */ i = OPND(s); assert(0 < i && i <= m->g->nsub); if (m->pmatch[i].rm_eo == -1) return(NULL); assert(m->pmatch[i].rm_so != -1); len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so; assert(stop - m->beginp >= len); if (sp > stop - len) return(NULL); /* not enough left to match */ ssp = m->offp + m->pmatch[i].rm_so; if (memcmp(sp, ssp, len) != 0) return(NULL); while (m->g->strip[ss] != SOP(O_BACK, i)) ss++; return(backref(m, sp+len, stop, ss+1, stopst, lev)); break; case OQUEST_: /* to null or not */ dp = backref(m, sp, stop, ss+1, stopst, lev); if (dp != NULL) return(dp); /* not */ return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev)); break; case OPLUS_: assert(m->lastpos != NULL); assert(lev+1 <= m->g->nplus); m->lastpos[lev+1] = sp; return(backref(m, sp, stop, ss+1, stopst, lev+1)); break; case O_PLUS: if (sp == m->lastpos[lev]) /* last pass matched null */ return(backref(m, sp, stop, ss+1, stopst, lev-1)); /* try another pass */ m->lastpos[lev] = sp; dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev); if (dp == NULL) return(backref(m, sp, stop, ss+1, stopst, lev-1)); else return(dp); break; case OCH_: /* find the right one, if any */ ssub = ss + 1; esub = ss + OPND(s) - 1; assert(OP(m->g->strip[esub]) == OOR1); for (;;) { /* find first matching branch */ dp = backref(m, sp, stop, ssub, esub, lev); if (dp != NULL) return(dp); /* that one missed, try next one */ if (OP(m->g->strip[esub]) == O_CH) return(NULL); /* there is none */ esub++; assert(OP(m->g->strip[esub]) == OOR2); ssub = esub + 1; esub += OPND(m->g->strip[esub]); if (OP(m->g->strip[esub]) == OOR2) esub--; else assert(OP(m->g->strip[esub]) == O_CH); } break; case OLPAREN: /* must undo assignment if rest fails */ i = OPND(s); assert(0 < i && i <= m->g->nsub); offsave = m->pmatch[i].rm_so; m->pmatch[i].rm_so = sp - m->offp; dp = backref(m, sp, stop, ss+1, stopst, lev); if (dp != NULL) return(dp); m->pmatch[i].rm_so = offsave; return(NULL); break; case ORPAREN: /* must undo assignment if rest fails */ i = OPND(s); assert(0 < i && i <= m->g->nsub); offsave = m->pmatch[i].rm_eo; m->pmatch[i].rm_eo = sp - m->offp; dp = backref(m, sp, stop, ss+1, stopst, lev); if (dp != NULL) return(dp); m->pmatch[i].rm_eo = offsave; return(NULL); break; default: /* uh oh */ assert(nope); break; } /* "can't happen" */ assert(nope); /* NOTREACHED */ return((char *)NULL); /* dummy */ } /* - fast - step through the string at top speed == static char *fast(register struct match *m, char *start, \ == char *stop, sopno startst, sopno stopst); */ static char * /* where tentative match ended, or NULL */ fast(m, start, stop, startst, stopst) register struct match *m; char *start; char *stop; sopno startst; sopno stopst; { register states st = m->st; register states fresh = m->fresh; register states tmp = m->tmp; register char *p = start; register int c = (start == m->beginp) ? OUT : *(start-1); register int lastc; /* previous c */ register int flagch; register int i; register char *coldp; /* last p after which no match was underway */ CLEAR(st); SET1(st, startst); st = step(m->g, startst, stopst, st, NOTHING, st); ASSIGN(fresh, st); SP("start", st, *p); coldp = NULL; for (;;) { /* next character */ lastc = c; c = (p == m->endp) ? OUT : *p; if (EQ(st, fresh)) coldp = p; /* is there an EOL and/or BOL between lastc and c? */ flagch = '\0'; i = 0; if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || (lastc == OUT && !(m->eflags®_NOTBOL)) ) { flagch = BOL; i = m->g->nbol; } if ( (c == '\n' && m->g->cflags®_NEWLINE) || (c == OUT && !(m->eflags®_NOTEOL)) ) { flagch = (flagch == BOL) ? BOLEOL : EOL; i += m->g->neol; } if (i != 0) { for (; i > 0; i--) st = step(m->g, startst, stopst, st, flagch, st); SP("boleol", st, c); } /* how about a word boundary? */ if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && (c != OUT && ISWORD(c)) ) { flagch = BOW; } if ( (lastc != OUT && ISWORD(lastc)) && (flagch == EOL || (c != OUT && !ISWORD(c))) ) { flagch = EOW; } if (flagch == BOW || flagch == EOW) { st = step(m->g, startst, stopst, st, flagch, st); SP("boweow", st, c); } /* are we done? */ if (ISSET(st, stopst) || p == stop) break; /* NOTE BREAK OUT */ /* no, we must deal with this character */ ASSIGN(tmp, st); ASSIGN(st, fresh); assert(c != OUT); st = step(m->g, startst, stopst, tmp, c, st); SP("aft", st, c); assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); p++; } assert(coldp != NULL); m->coldp = coldp; if (ISSET(st, stopst)) return(p+1); else return(NULL); } /* - slow - step through the string more deliberately == static char *slow(register struct match *m, char *start, \ == char *stop, sopno startst, sopno stopst); */ static char * /* where it ended */ slow(m, start, stop, startst, stopst) register struct match *m; char *start; char *stop; sopno startst; sopno stopst; { register states st = m->st; register states empty = m->empty; register states tmp = m->tmp; register char *p = start; register int c = (start == m->beginp) ? OUT : *(start-1); register int lastc; /* previous c */ register int flagch; register int i; register char *matchp; /* last p at which a match ended */ AT("slow", start, stop, startst, stopst); CLEAR(st); SET1(st, startst); SP("sstart", st, *p); st = step(m->g, startst, stopst, st, NOTHING, st); matchp = NULL; for (;;) { /* next character */ lastc = c; c = (p == m->endp) ? OUT : *p; /* is there an EOL and/or BOL between lastc and c? */ flagch = '\0'; i = 0; if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || (lastc == OUT && !(m->eflags®_NOTBOL)) ) { flagch = BOL; i = m->g->nbol; } if ( (c == '\n' && m->g->cflags®_NEWLINE) || (c == OUT && !(m->eflags®_NOTEOL)) ) { flagch = (flagch == BOL) ? BOLEOL : EOL; i += m->g->neol; } if (i != 0) { for (; i > 0; i--) st = step(m->g, startst, stopst, st, flagch, st); SP("sboleol", st, c); } /* how about a word boundary? */ if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && (c != OUT && ISWORD(c)) ) { flagch = BOW; } if ( (lastc != OUT && ISWORD(lastc)) && (flagch == EOL || (c != OUT && !ISWORD(c))) ) { flagch = EOW; } if (flagch == BOW || flagch == EOW) { st = step(m->g, startst, stopst, st, flagch, st); SP("sboweow", st, c); } /* are we done? */ if (ISSET(st, stopst)) matchp = p; if (EQ(st, empty) || p == stop) break; /* NOTE BREAK OUT */ /* no, we must deal with this character */ ASSIGN(tmp, st); ASSIGN(st, empty); assert(c != OUT); st = step(m->g, startst, stopst, tmp, c, st); SP("saft", st, c); assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); p++; } return(matchp); } /* - step - map set of states reachable before char to set reachable after == static states step(register struct re_guts *g, sopno start, sopno stop, \ == register states bef, int ch, register states aft); == #define BOL (OUT+1) == #define EOL (BOL+1) == #define BOLEOL (BOL+2) == #define NOTHING (BOL+3) == #define BOW (BOL+4) == #define EOW (BOL+5) == #define CODEMAX (BOL+5) // highest code used == #define NONCHAR(c) ((c) > CHAR_MAX) == #define NNONCHAR (CODEMAX-CHAR_MAX) */ static states step(g, start, stop, bef, ch, aft) register struct re_guts *g; sopno start; /* start state within strip */ sopno stop; /* state after stop state within strip */ register states bef; /* states reachable before */ int ch; /* character or NONCHAR code */ register states aft; /* states already known reachable after */ { register cset *cs; register sop s; register sopno pc; register onestate here; /* note, macros know this name */ register sopno look; register long i; for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) { s = g->strip[pc]; switch (OP(s)) { case OEND: assert(pc == stop-1); break; case OCHAR: /* only characters can match */ assert(!NONCHAR(ch) || ch != (char)OPND(s)); if (ch == (char)OPND(s)) FWD(aft, bef, 1); break; case OBOL: if (ch == BOL || ch == BOLEOL) FWD(aft, bef, 1); break; case OEOL: if (ch == EOL || ch == BOLEOL) FWD(aft, bef, 1); break; case OBOW: if (ch == BOW) FWD(aft, bef, 1); break; case OEOW: if (ch == EOW) FWD(aft, bef, 1); break; case OANY: if (!NONCHAR(ch)) FWD(aft, bef, 1); break; case OANYOF: cs = &g->sets[OPND(s)]; if (!NONCHAR(ch) && CHIN(cs, ch)) FWD(aft, bef, 1); break; case OBACK_: /* ignored here */ case O_BACK: FWD(aft, aft, 1); break; case OPLUS_: /* forward, this is just an empty */ FWD(aft, aft, 1); break; case O_PLUS: /* both forward and back */ FWD(aft, aft, 1); i = ISSETBACK(aft, OPND(s)); BACK(aft, aft, OPND(s)); if (!i && ISSETBACK(aft, OPND(s))) { /* oho, must reconsider loop body */ pc -= OPND(s) + 1; INIT(here, pc); } break; case OQUEST_: /* two branches, both forward */ FWD(aft, aft, 1); FWD(aft, aft, OPND(s)); break; case O_QUEST: /* just an empty */ FWD(aft, aft, 1); break; case OLPAREN: /* not significant here */ case ORPAREN: FWD(aft, aft, 1); break; case OCH_: /* mark the first two branches */ FWD(aft, aft, 1); assert(OP(g->strip[pc+OPND(s)]) == OOR2); FWD(aft, aft, OPND(s)); break; case OOR1: /* done a branch, find the O_CH */ if (ISSTATEIN(aft, here)) { for (look = 1; OP(s = g->strip[pc+look]) != O_CH; look += OPND(s)) assert(OP(s) == OOR2); FWD(aft, aft, look); } break; case OOR2: /* propagate OCH_'s marking */ FWD(aft, aft, 1); if (OP(g->strip[pc+OPND(s)]) != O_CH) { assert(OP(g->strip[pc+OPND(s)]) == OOR2); FWD(aft, aft, OPND(s)); } break; case O_CH: /* just empty */ FWD(aft, aft, 1); break; default: /* ooooops... */ assert(nope); break; } } return(aft); } #ifdef REDEBUG /* - print - print a set of states == #ifdef REDEBUG == static void print(struct match *m, char *caption, states st, \ == int ch, FILE *d); == #endif */ static void print(m, caption, st, ch, d) struct match *m; char *caption; states st; int ch; FILE *d; { register struct re_guts *g = m->g; register int i; register int first = 1; if (!(m->eflags®_TRACE)) return; fprintf(d, "%s", caption); if (ch != '\0') fprintf(d, " %s", pchar(ch)); for (i = 0; i < g->nstates; i++) if (ISSET(st, i)) { fprintf(d, "%s%d", (first) ? "\t" : ", ", i); first = 0; } fprintf(d, "\n"); } /* - at - print current situation == #ifdef REDEBUG == static void at(struct match *m, char *title, char *start, char *stop, \ == sopno startst, sopno stopst); == #endif */ static void at(m, title, start, stop, startst, stopst) struct match *m; char *title; char *start; char *stop; sopno startst; sopno stopst; { if (!(m->eflags®_TRACE)) return; printf("%s %s-", title, pchar(*start)); printf("%s ", pchar(*stop)); printf("%ld-%ld\n", (long)startst, (long)stopst); } #ifndef PCHARDONE #define PCHARDONE /* never again */ /* - pchar - make a character printable == #ifdef REDEBUG == static char *pchar(int ch); == #endif * * Is this identical to regchar() over in debug.c? Well, yes. But a * duplicate here avoids having a debugging-capable regexec.o tied to * a matching debug.o, and this is convenient. It all disappears in * the non-debug compilation anyway, so it doesn't matter much. */ static char * /* -> representation */ pchar(ch) int ch; { static char pbuf[10]; if (isprint(ch) || ch == ' ') sprintf(pbuf, "%c", ch); else sprintf(pbuf, "\\%o", ch); return(pbuf); } #endif #endif #undef matcher #undef fast #undef slow #undef dissect #undef backref #undef step #undef print #undef at #undef match z88dk-1.8.ds1/src/copt/regex/engine.h0000644000175000017500000000253507541137357017011 0ustar tygrystygrys/* ========= begin header generated by ./mkh ========= */ #ifdef __cplusplus extern "C" { #endif /* === engine.c === */ static int matcher(register struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags); static char *dissect(register struct match *m, char *start, char *stop, sopno startst, sopno stopst); static char *backref(register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev); static char *fast(register struct match *m, char *start, char *stop, sopno startst, sopno stopst); static char *slow(register struct match *m, char *start, char *stop, sopno startst, sopno stopst); static states step(register struct re_guts *g, sopno start, sopno stop, register states bef, int ch, register states aft); #define BOL (OUT+1) #define EOL (BOL+1) #define BOLEOL (BOL+2) #define NOTHING (BOL+3) #define BOW (BOL+4) #define EOW (BOL+5) #define CODEMAX (BOL+5) /* highest code used */ #define NONCHAR(c) ((c) > CHAR_MAX) #define NNONCHAR (CODEMAX-CHAR_MAX) #ifdef REDEBUG static void print(struct match *m, char *caption, states st, int ch, FILE *d); #endif #ifdef REDEBUG static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst); #endif #ifdef REDEBUG static char *pchar(int ch); #endif #ifdef __cplusplus } #endif /* ========= end header generated by ./mkh ========= */ z88dk-1.8.ds1/src/copt/regex/README0000644000175000017500000000264107541137357016251 0ustar tygrystygrysThis a modified copy of Henry Spencer's regex library, it was originally snarfed from http://arglist.com/regex/. The following changes were made: REGCOMP.C line 1438 changed to assert(value < 1L< #include #include #include #include #include #include #include "utils.h" #include "regex2.h" #include "cclass.h" #include "cname.h" /* * parse structure, passed up and down to avoid global variables and * other clumsinesses */ struct parse { char *next; /* next character in RE */ char *end; /* end of string (-> NUL normally) */ int error; /* has an error been seen? */ sop *strip; /* malloced strip */ sopno ssize; /* malloced strip size (allocated) */ sopno slen; /* malloced strip length (used) */ int ncsalloc; /* number of csets allocated */ struct re_guts *g; # define NPAREN 10 /* we need to remember () 1-9 for back refs */ sopno pbegin[NPAREN]; /* -> ( ([0] unused) */ sopno pend[NPAREN]; /* -> ) ([0] unused) */ }; #include "regcomp.h" static char nuls[10]; /* place to point scanner in event of error */ /* * macros for use with parse structure * BEWARE: these know that the parse structure is named `p' !!! */ #define PEEK() (*p->next) #define PEEK2() (*(p->next+1)) #define MORE() (p->next < p->end) #define MORE2() (p->next+1 < p->end) #define SEE(c) (MORE() && PEEK() == (c)) #define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b)) #define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0) #define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0) #define NEXT() (p->next++) #define NEXT2() (p->next += 2) #define NEXTn(n) (p->next += (n)) #define GETNEXT() (*p->next++) #define SETERROR(e) seterr(p, (e)) #define REQUIRE(co, e) ((co) || SETERROR(e)) #define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e)) #define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e)) #define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e)) #define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd)) #define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos) #define AHEAD(pos) dofwd(p, pos, HERE()-(pos)) #define ASTERN(sop, pos) EMIT(sop, HERE()-pos) #define HERE() (p->slen) #define THERE() (p->slen - 1) #define THERETHERE() (p->slen - 2) #define DROP(n) (p->slen -= (n)) #ifndef NDEBUG static int never = 0; /* for use in asserts; shuts lint up */ #else #define never 0 /* some s have bugs too */ #endif /* - regcomp - interface for parser and compilation = extern int regcomp(regex_t *, const char *, int); = #define REG_BASIC 0000 = #define REG_EXTENDED 0001 = #define REG_ICASE 0002 = #define REG_NOSUB 0004 = #define REG_NEWLINE 0010 = #define REG_NOSPEC 0020 = #define REG_PEND 0040 = #define REG_DUMP 0200 */ int /* 0 success, otherwise REG_something */ regcomp(preg, pattern, cflags) regex_t *preg; const char *pattern; int cflags; { struct parse pa; register struct re_guts *g; register struct parse *p = &pa; register int i; register size_t len; #ifdef REDEBUG # define GOODFLAGS(f) (f) #else # define GOODFLAGS(f) ((f)&~REG_DUMP) #endif cflags = GOODFLAGS(cflags); if ((cflags®_EXTENDED) && (cflags®_NOSPEC)) return(REG_INVARG); if (cflags®_PEND) { if (preg->re_endp < pattern) return(REG_INVARG); len = preg->re_endp - pattern; } else len = strlen((char *)pattern); /* do the mallocs early so failure handling is easy */ g = (struct re_guts *)malloc(sizeof(struct re_guts) + (NC-1)*sizeof(cat_t)); if (g == NULL) return(REG_ESPACE); p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */ p->strip = (sop *)malloc(p->ssize * sizeof(sop)); p->slen = 0; if (p->strip == NULL) { free((char *)g); return(REG_ESPACE); } /* set things up */ p->g = g; p->next = (char *)pattern; /* convenience; we do not modify it */ p->end = p->next + len; p->error = 0; p->ncsalloc = 0; for (i = 0; i < NPAREN; i++) { p->pbegin[i] = 0; p->pend[i] = 0; } g->csetsize = NC; g->sets = NULL; g->setbits = NULL; g->ncsets = 0; g->cflags = cflags; g->iflags = 0; g->nbol = 0; g->neol = 0; g->must = NULL; g->mlen = 0; g->nsub = 0; g->ncategories = 1; /* category 0 is "everything else" */ g->categories = &g->catspace[-(CHAR_MIN)]; (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t)); g->backrefs = 0; /* do it */ EMIT(OEND, 0); g->firststate = THERE(); if (cflags®_EXTENDED) p_ere(p, OUT); else if (cflags®_NOSPEC) p_str(p); else p_bre(p, OUT, OUT); EMIT(OEND, 0); g->laststate = THERE(); /* tidy up loose ends and fill things in */ categorize(p, g); stripsnug(p, g); findmust(p, g); g->nplus = pluscount(p, g); g->magic = MAGIC2; preg->re_nsub = g->nsub; preg->re_g = g; preg->re_magic = MAGIC1; #ifndef REDEBUG /* not debugging, so can't rely on the assert() in regexec() */ if (g->iflags&BAD) SETERROR(REG_ASSERT); #endif /* win or lose, we're done */ if (p->error != 0) /* lose */ regfree(preg); return(p->error); } /* - p_ere - ERE parser top level, concatenation and alternation == static void p_ere(register struct parse *p, int stop); */ static void p_ere(p, stop) register struct parse *p; int stop; /* character this ERE should end at */ { register char c; register sopno prevback; register sopno prevfwd; register sopno conc; register int first = 1; /* is this the first alternative? */ for (;;) { /* do a bunch of concatenated expressions */ conc = HERE(); while (MORE() && (c = PEEK()) != '|' && c != stop) p_ere_exp(p); REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */ if (!EAT('|')) break; /* NOTE BREAK OUT */ if (first) { INSERT(OCH_, conc); /* offset is wrong */ prevfwd = conc; prevback = conc; first = 0; } ASTERN(OOR1, prevback); prevback = THERE(); AHEAD(prevfwd); /* fix previous offset */ prevfwd = HERE(); EMIT(OOR2, 0); /* offset is very wrong */ } if (!first) { /* tail-end fixups */ AHEAD(prevfwd); ASTERN(O_CH, prevback); } assert(!MORE() || SEE(stop)); } /* - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op == static void p_ere_exp(register struct parse *p); */ static void p_ere_exp(p) register struct parse *p; { register char c; register sopno pos; register int count; register int count2; register sopno subno; int wascaret = 0; assert(MORE()); /* caller should have ensured this */ c = GETNEXT(); pos = HERE(); switch (c) { case '(': REQUIRE(MORE(), REG_EPAREN); p->g->nsub++; subno = p->g->nsub; if (subno < NPAREN) p->pbegin[subno] = HERE(); EMIT(OLPAREN, subno); if (!SEE(')')) p_ere(p, ')'); if (subno < NPAREN) { p->pend[subno] = HERE(); assert(p->pend[subno] != 0); } EMIT(ORPAREN, subno); MUSTEAT(')', REG_EPAREN); break; #ifndef POSIX_MISTAKE case ')': /* happens only if no current unmatched ( */ /* * You may ask, why the ifndef? Because I didn't notice * this until slightly too late for 1003.2, and none of the * other 1003.2 regular-expression reviewers noticed it at * all. So an unmatched ) is legal POSIX, at least until * we can get it fixed. */ SETERROR(REG_EPAREN); break; #endif case '^': EMIT(OBOL, 0); p->g->iflags |= USEBOL; p->g->nbol++; wascaret = 1; break; case '$': EMIT(OEOL, 0); p->g->iflags |= USEEOL; p->g->neol++; break; case '|': SETERROR(REG_EMPTY); break; case '*': case '+': case '?': SETERROR(REG_BADRPT); break; case '.': if (p->g->cflags®_NEWLINE) nonnewline(p); else EMIT(OANY, 0); break; case '[': p_bracket(p); break; case '\\': REQUIRE(MORE(), REG_EESCAPE); c = GETNEXT(); ordinary(p, c); break; case '{': /* okay as ordinary except if digit follows */ REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT); /* FALLTHROUGH */ default: ordinary(p, c); break; } if (!MORE()) return; c = PEEK(); /* we call { a repetition if followed by a digit */ if (!( c == '*' || c == '+' || c == '?' || (c == '{' && MORE2() && isdigit(PEEK2())) )) return; /* no repetition, we're done */ NEXT(); REQUIRE(!wascaret, REG_BADRPT); switch (c) { case '*': /* implemented as +? */ /* this case does not require the (y|) trick, noKLUDGE */ INSERT(OPLUS_, pos); ASTERN(O_PLUS, pos); INSERT(OQUEST_, pos); ASTERN(O_QUEST, pos); break; case '+': INSERT(OPLUS_, pos); ASTERN(O_PLUS, pos); break; case '?': /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ INSERT(OCH_, pos); /* offset slightly wrong */ ASTERN(OOR1, pos); /* this one's right */ AHEAD(pos); /* fix the OCH_ */ EMIT(OOR2, 0); /* offset very wrong... */ AHEAD(THERE()); /* ...so fix it */ ASTERN(O_CH, THERETHERE()); break; case '{': count = p_count(p); if (EAT(',')) { if (isdigit(PEEK())) { count2 = p_count(p); REQUIRE(count <= count2, REG_BADBR); } else /* single number with comma */ count2 = INFINITY; } else /* just a single number */ count2 = count; repeat(p, pos, count, count2); if (!EAT('}')) { /* error heuristics */ while (MORE() && PEEK() != '}') NEXT(); REQUIRE(MORE(), REG_EBRACE); SETERROR(REG_BADBR); } break; } if (!MORE()) return; c = PEEK(); if (!( c == '*' || c == '+' || c == '?' || (c == '{' && MORE2() && isdigit(PEEK2())) ) ) return; SETERROR(REG_BADRPT); } /* - p_str - string (no metacharacters) "parser" == static void p_str(register struct parse *p); */ static void p_str(p) register struct parse *p; { REQUIRE(MORE(), REG_EMPTY); while (MORE()) ordinary(p, GETNEXT()); } /* - p_bre - BRE parser top level, anchoring and concatenation == static void p_bre(register struct parse *p, register int end1, \ == register int end2); * Giving end1 as OUT essentially eliminates the end1/end2 check. * * This implementation is a bit of a kludge, in that a trailing $ is first * taken as an ordinary character and then revised to be an anchor. The * only undesirable side effect is that '$' gets included as a character * category in such cases. This is fairly harmless; not worth fixing. * The amount of lookahead needed to avoid this kludge is excessive. */ static void p_bre(p, end1, end2) register struct parse *p; register int end1; /* first terminating character */ register int end2; /* second terminating character */ { register sopno start = HERE(); register int first = 1; /* first subexpression? */ register int wasdollar = 0; if (EAT('^')) { EMIT(OBOL, 0); p->g->iflags |= USEBOL; p->g->nbol++; } while (MORE() && !SEETWO(end1, end2)) { wasdollar = p_simp_re(p, first); first = 0; } if (wasdollar) { /* oops, that was a trailing anchor */ DROP(1); EMIT(OEOL, 0); p->g->iflags |= USEEOL; p->g->neol++; } REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */ } /* - p_simp_re - parse a simple RE, an atom possibly followed by a repetition == static int p_simp_re(register struct parse *p, int starordinary); */ static int /* was the simple RE an unbackslashed $? */ p_simp_re(p, starordinary) register struct parse *p; int starordinary; /* is a leading * an ordinary character? */ { register int c; register int count; register int count2; register sopno pos; register int i; register sopno subno; # define BACKSL (1<g->cflags®_NEWLINE) nonnewline(p); else EMIT(OANY, 0); break; case '[': p_bracket(p); break; case BACKSL|'{': SETERROR(REG_BADRPT); break; case BACKSL|'(': p->g->nsub++; subno = p->g->nsub; if (subno < NPAREN) p->pbegin[subno] = HERE(); EMIT(OLPAREN, subno); /* the MORE here is an error heuristic */ if (MORE() && !SEETWO('\\', ')')) p_bre(p, '\\', ')'); if (subno < NPAREN) { p->pend[subno] = HERE(); assert(p->pend[subno] != 0); } EMIT(ORPAREN, subno); REQUIRE(EATTWO('\\', ')'), REG_EPAREN); break; case BACKSL|')': /* should not get here -- must be user */ case BACKSL|'}': SETERROR(REG_EPAREN); break; case BACKSL|'1': case BACKSL|'2': case BACKSL|'3': case BACKSL|'4': case BACKSL|'5': case BACKSL|'6': case BACKSL|'7': case BACKSL|'8': case BACKSL|'9': i = (c&~BACKSL) - '0'; assert(i < NPAREN); if (p->pend[i] != 0) { assert(i <= p->g->nsub); EMIT(OBACK_, i); assert(p->pbegin[i] != 0); assert(OP(p->strip[p->pbegin[i]]) == OLPAREN); assert(OP(p->strip[p->pend[i]]) == ORPAREN); (void) dupl(p, p->pbegin[i]+1, p->pend[i]); EMIT(O_BACK, i); } else SETERROR(REG_ESUBREG); p->g->backrefs = 1; break; case '*': REQUIRE(starordinary, REG_BADRPT); /* FALLTHROUGH */ default: ordinary(p, (char)c); /* takes off BACKSL, if any */ break; } if (EAT('*')) { /* implemented as +? */ /* this case does not require the (y|) trick, noKLUDGE */ INSERT(OPLUS_, pos); ASTERN(O_PLUS, pos); INSERT(OQUEST_, pos); ASTERN(O_QUEST, pos); } else if (EATTWO('\\', '{')) { count = p_count(p); if (EAT(',')) { if (MORE() && isdigit(PEEK())) { count2 = p_count(p); REQUIRE(count <= count2, REG_BADBR); } else /* single number with comma */ count2 = INFINITY; } else /* just a single number */ count2 = count; repeat(p, pos, count, count2); if (!EATTWO('\\', '}')) { /* error heuristics */ while (MORE() && !SEETWO('\\', '}')) NEXT(); REQUIRE(MORE(), REG_EBRACE); SETERROR(REG_BADBR); } } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */ return(1); return(0); } /* - p_count - parse a repetition count == static int p_count(register struct parse *p); */ static int /* the value */ p_count(p) register struct parse *p; { register int count = 0; register int ndigits = 0; while (MORE() && isdigit(PEEK()) && count <= DUPMAX) { count = count*10 + (GETNEXT() - '0'); ndigits++; } REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR); return(count); } /* - p_bracket - parse a bracketed character list == static void p_bracket(register struct parse *p); * * Note a significant property of this code: if the allocset() did SETERROR, * no set operations are done. */ static void p_bracket(p) register struct parse *p; { register cset *cs = allocset(p); register int invert = 0; /* Dept of Truly Sickening Special-Case Kludges */ if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) { EMIT(OBOW, 0); NEXTn(6); return; } if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) { EMIT(OEOW, 0); NEXTn(6); return; } if (EAT('^')) invert++; /* make note to invert set at end */ if (EAT(']')) CHadd(cs, ']'); else if (EAT('-')) CHadd(cs, '-'); while (MORE() && PEEK() != ']' && !SEETWO('-', ']')) p_b_term(p, cs); if (EAT('-')) CHadd(cs, '-'); MUSTEAT(']', REG_EBRACK); if (p->error != 0) /* don't mess things up further */ return; if (p->g->cflags®_ICASE) { register int i; register int ci; for (i = p->g->csetsize - 1; i >= 0; i--) if (CHIN(cs, i) && isalpha(i)) { ci = othercase(i); if (ci != i) CHadd(cs, ci); } if (cs->multis != NULL) mccase(p, cs); } if (invert) { register int i; for (i = p->g->csetsize - 1; i >= 0; i--) if (CHIN(cs, i)) CHsub(cs, i); else CHadd(cs, i); if (p->g->cflags®_NEWLINE) CHsub(cs, '\n'); if (cs->multis != NULL) mcinvert(p, cs); } assert(cs->multis == NULL); /* xxx */ if (nch(p, cs) == 1) { /* optimize singleton sets */ ordinary(p, firstch(p, cs)); freeset(p, cs); } else EMIT(OANYOF, freezeset(p, cs)); } /* - p_b_term - parse one term of a bracketed character list == static void p_b_term(register struct parse *p, register cset *cs); */ static void p_b_term(p, cs) register struct parse *p; register cset *cs; { register char c; register char start, finish; register int i; /* classify what we've got */ switch ((MORE()) ? PEEK() : '\0') { case '[': c = (MORE2()) ? PEEK2() : '\0'; break; case '-': SETERROR(REG_ERANGE); return; /* NOTE RETURN */ break; default: c = '\0'; break; } switch (c) { case ':': /* character class */ NEXT2(); REQUIRE(MORE(), REG_EBRACK); c = PEEK(); REQUIRE(c != '-' && c != ']', REG_ECTYPE); p_b_cclass(p, cs); REQUIRE(MORE(), REG_EBRACK); REQUIRE(EATTWO(':', ']'), REG_ECTYPE); break; case '=': /* equivalence class */ NEXT2(); REQUIRE(MORE(), REG_EBRACK); c = PEEK(); REQUIRE(c != '-' && c != ']', REG_ECOLLATE); p_b_eclass(p, cs); REQUIRE(MORE(), REG_EBRACK); REQUIRE(EATTWO('=', ']'), REG_ECOLLATE); break; default: /* symbol, ordinary character, or range */ /* xxx revision needed for multichar stuff */ start = p_b_symbol(p); if (SEE('-') && MORE2() && PEEK2() != ']') { /* range */ NEXT(); if (EAT('-')) finish = '-'; else finish = p_b_symbol(p); } else finish = start; /* xxx what about signed chars here... */ REQUIRE(start <= finish, REG_ERANGE); for (i = start; i <= finish; i++) CHadd(cs, i); break; } } /* - p_b_cclass - parse a character-class name and deal with it == static void p_b_cclass(register struct parse *p, register cset *cs); */ static void p_b_cclass(p, cs) register struct parse *p; register cset *cs; { register char *sp = p->next; register struct cclass *cp; register size_t len; register char *u; register char c; while (MORE() && isalpha(PEEK())) NEXT(); len = p->next - sp; for (cp = cclasses; cp->name != NULL; cp++) if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') break; if (cp->name == NULL) { /* oops, didn't find it */ SETERROR(REG_ECTYPE); return; } u = cp->chars; while ((c = *u++) != '\0') CHadd(cs, c); for (u = cp->multis; *u != '\0'; u += strlen(u) + 1) MCadd(p, cs, u); } /* - p_b_eclass - parse an equivalence-class name and deal with it == static void p_b_eclass(register struct parse *p, register cset *cs); * * This implementation is incomplete. xxx */ static void p_b_eclass(p, cs) register struct parse *p; register cset *cs; { register char c; c = p_b_coll_elem(p, '='); CHadd(cs, c); } /* - p_b_symbol - parse a character or [..]ed multicharacter collating symbol == static char p_b_symbol(register struct parse *p); */ static char /* value of symbol */ p_b_symbol(p) register struct parse *p; { register char value; REQUIRE(MORE(), REG_EBRACK); if (!EATTWO('[', '.')) return(GETNEXT()); /* collating symbol */ value = p_b_coll_elem(p, '.'); REQUIRE(EATTWO('.', ']'), REG_ECOLLATE); return(value); } /* - p_b_coll_elem - parse a collating-element name and look it up == static char p_b_coll_elem(register struct parse *p, int endc); */ static char /* value of collating element */ p_b_coll_elem(p, endc) register struct parse *p; int endc; /* name ended by endc,']' */ { register char *sp = p->next; register struct cname *cp; register int len; while (MORE() && !SEETWO(endc, ']')) NEXT(); if (!MORE()) { SETERROR(REG_EBRACK); return(0); } len = p->next - sp; for (cp = cnames; cp->name != NULL; cp++) if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') return(cp->code); /* known name */ if (len == 1) return(*sp); /* single character */ SETERROR(REG_ECOLLATE); /* neither */ return(0); } /* - othercase - return the case counterpart of an alphabetic == static char othercase(int ch); */ static char /* if no counterpart, return ch */ othercase(ch) int ch; { assert(isalpha(ch)); if (isupper(ch)) return(tolower(ch)); else if (islower(ch)) return(toupper(ch)); else /* peculiar, but could happen */ return(ch); } /* - bothcases - emit a dualcase version of a two-case character == static void bothcases(register struct parse *p, int ch); * * Boy, is this implementation ever a kludge... */ static void bothcases(p, ch) register struct parse *p; int ch; { register char *oldnext = p->next; register char *oldend = p->end; char bracket[3]; assert(othercase(ch) != ch); /* p_bracket() would recurse */ p->next = bracket; p->end = bracket+2; bracket[0] = ch; bracket[1] = ']'; bracket[2] = '\0'; p_bracket(p); assert(p->next == bracket+2); p->next = oldnext; p->end = oldend; } /* - ordinary - emit an ordinary character == static void ordinary(register struct parse *p, register int ch); */ static void ordinary(p, ch) register struct parse *p; register int ch; { register cat_t *cap = p->g->categories; if ((p->g->cflags®_ICASE) && isalpha(ch) && othercase(ch) != ch) bothcases(p, ch); else { EMIT(OCHAR, (unsigned char)ch); if (cap[ch] == 0) cap[ch] = p->g->ncategories++; } } /* - nonnewline - emit REG_NEWLINE version of OANY == static void nonnewline(register struct parse *p); * * Boy, is this implementation ever a kludge... */ static void nonnewline(p) register struct parse *p; { register char *oldnext = p->next; register char *oldend = p->end; char bracket[4]; p->next = bracket; p->end = bracket+3; bracket[0] = '^'; bracket[1] = '\n'; bracket[2] = ']'; bracket[3] = '\0'; p_bracket(p); assert(p->next == bracket+3); p->next = oldnext; p->end = oldend; } /* - repeat - generate code for a bounded repetition, recursively if needed == static void repeat(register struct parse *p, sopno start, int from, int to); */ static void repeat(p, start, from, to) register struct parse *p; sopno start; /* operand from here to end of strip */ int from; /* repeated from this number */ int to; /* to this number of times (maybe INFINITY) */ { register sopno finish = HERE(); # define N 2 # define INF 3 # define REP(f, t) ((f)*8 + (t)) # define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N) register sopno copy; if (p->error != 0) /* head off possible runaway recursion */ return; assert(from <= to); switch (REP(MAP(from), MAP(to))) { case REP(0, 0): /* must be user doing this */ DROP(finish-start); /* drop the operand */ break; case REP(0, 1): /* as x{1,1}? */ case REP(0, N): /* as x{1,n}? */ case REP(0, INF): /* as x{1,}? */ /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ INSERT(OCH_, start); /* offset is wrong... */ repeat(p, start+1, 1, to); ASTERN(OOR1, start); AHEAD(start); /* ... fix it */ EMIT(OOR2, 0); AHEAD(THERE()); ASTERN(O_CH, THERETHERE()); break; case REP(1, 1): /* trivial case */ /* done */ break; case REP(1, N): /* as x?x{1,n-1} */ /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ INSERT(OCH_, start); ASTERN(OOR1, start); AHEAD(start); EMIT(OOR2, 0); /* offset very wrong... */ AHEAD(THERE()); /* ...so fix it */ ASTERN(O_CH, THERETHERE()); copy = dupl(p, start+1, finish+1); assert(copy == finish+4); repeat(p, copy, 1, to-1); break; case REP(1, INF): /* as x+ */ INSERT(OPLUS_, start); ASTERN(O_PLUS, start); break; case REP(N, N): /* as xx{m-1,n-1} */ copy = dupl(p, start, finish); repeat(p, copy, from-1, to-1); break; case REP(N, INF): /* as xx{n-1,INF} */ copy = dupl(p, start, finish); repeat(p, copy, from-1, to); break; default: /* "can't happen" */ SETERROR(REG_ASSERT); /* just in case */ break; } } /* - seterr - set an error condition == static int seterr(register struct parse *p, int e); */ static int /* useless but makes type checking happy */ seterr(p, e) register struct parse *p; int e; { if (p->error == 0) /* keep earliest error condition */ p->error = e; p->next = nuls; /* try to bring things to a halt */ p->end = nuls; return(0); /* make the return value well-defined */ } /* - allocset - allocate a set of characters for [] == static cset *allocset(register struct parse *p); */ static cset * allocset(p) register struct parse *p; { register int no = p->g->ncsets++; register size_t nc; register size_t nbytes; register cset *cs; register size_t css = (size_t)p->g->csetsize; register int i; if (no >= p->ncsalloc) { /* need another column of space */ p->ncsalloc += CHAR_BIT; nc = p->ncsalloc; assert(nc % CHAR_BIT == 0); nbytes = nc / CHAR_BIT * css; if (p->g->sets == NULL) p->g->sets = (cset *)malloc(nc * sizeof(cset)); else p->g->sets = (cset *)realloc((char *)p->g->sets, nc * sizeof(cset)); if (p->g->setbits == NULL) p->g->setbits = (uch *)malloc(nbytes); else { p->g->setbits = (uch *)realloc((char *)p->g->setbits, nbytes); /* xxx this isn't right if setbits is now NULL */ for (i = 0; i < no; i++) p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT); } if (p->g->sets != NULL && p->g->setbits != NULL) (void) memset((char *)p->g->setbits + (nbytes - css), 0, css); else { no = 0; SETERROR(REG_ESPACE); /* caller's responsibility not to do set ops */ } } assert(p->g->sets != NULL); /* xxx */ cs = &p->g->sets[no]; cs->ptr = p->g->setbits + css*((no)/CHAR_BIT); cs->mask = 1 << ((no) % CHAR_BIT); cs->hash = 0; cs->smultis = 0; cs->multis = NULL; return(cs); } /* - freeset - free a now-unused set == static void freeset(register struct parse *p, register cset *cs); */ static void freeset(p, cs) register struct parse *p; register cset *cs; { register int i; register cset *top = &p->g->sets[p->g->ncsets]; register size_t css = (size_t)p->g->csetsize; for (i = 0; i < css; i++) CHsub(cs, i); if (cs == top-1) /* recover only the easy case */ p->g->ncsets--; } /* - freezeset - final processing on a set of characters == static int freezeset(register struct parse *p, register cset *cs); * * The main task here is merging identical sets. This is usually a waste * of time (although the hash code minimizes the overhead), but can win * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash * is done using addition rather than xor -- all ASCII [aA] sets xor to * the same value! */ static int /* set number */ freezeset(p, cs) register struct parse *p; register cset *cs; { register uch h = cs->hash; register int i; register cset *top = &p->g->sets[p->g->ncsets]; register cset *cs2; register size_t css = (size_t)p->g->csetsize; /* look for an earlier one which is the same */ for (cs2 = &p->g->sets[0]; cs2 < top; cs2++) if (cs2->hash == h && cs2 != cs) { /* maybe */ for (i = 0; i < css; i++) if (!!CHIN(cs2, i) != !!CHIN(cs, i)) break; /* no */ if (i == css) break; /* yes */ } if (cs2 < top) { /* found one */ freeset(p, cs); cs = cs2; } return((int)(cs - p->g->sets)); } /* - firstch - return first character in a set (which must have at least one) == static int firstch(register struct parse *p, register cset *cs); */ static int /* character; there is no "none" value */ firstch(p, cs) register struct parse *p; register cset *cs; { register int i; register size_t css = (size_t)p->g->csetsize; for (i = 0; i < css; i++) if (CHIN(cs, i)) return((char)i); assert(never); return(0); /* arbitrary */ } /* - nch - number of characters in a set == static int nch(register struct parse *p, register cset *cs); */ static int nch(p, cs) register struct parse *p; register cset *cs; { register int i; register size_t css = (size_t)p->g->csetsize; register int n = 0; for (i = 0; i < css; i++) if (CHIN(cs, i)) n++; return(n); } /* - mcadd - add a collating element to a cset == static void mcadd(register struct parse *p, register cset *cs, \ == register char *cp); */ static void mcadd(p, cs, cp) register struct parse *p; register cset *cs; register char *cp; { register size_t oldend = cs->smultis; cs->smultis += strlen(cp) + 1; if (cs->multis == NULL) cs->multis = malloc(cs->smultis); else cs->multis = realloc(cs->multis, cs->smultis); if (cs->multis == NULL) { SETERROR(REG_ESPACE); return; } (void) strcpy(cs->multis + oldend - 1, cp); cs->multis[cs->smultis - 1] = '\0'; } /* - mcsub - subtract a collating element from a cset == static void mcsub(register cset *cs, register char *cp); */ static void mcsub(cs, cp) register cset *cs; register char *cp; { register char *fp = mcfind(cs, cp); register size_t len = strlen(fp); assert(fp != NULL); (void) memmove(fp, fp + len + 1, cs->smultis - (fp + len + 1 - cs->multis)); cs->smultis -= len; if (cs->smultis == 0) { free(cs->multis); cs->multis = NULL; return; } cs->multis = realloc(cs->multis, cs->smultis); assert(cs->multis != NULL); } /* - mcin - is a collating element in a cset? == static int mcin(register cset *cs, register char *cp); */ static int mcin(cs, cp) register cset *cs; register char *cp; { return(mcfind(cs, cp) != NULL); } /* - mcfind - find a collating element in a cset == static char *mcfind(register cset *cs, register char *cp); */ static char * mcfind(cs, cp) register cset *cs; register char *cp; { register char *p; if (cs->multis == NULL) return(NULL); for (p = cs->multis; *p != '\0'; p += strlen(p) + 1) if (strcmp(cp, p) == 0) return(p); return(NULL); } /* - mcinvert - invert the list of collating elements in a cset == static void mcinvert(register struct parse *p, register cset *cs); * * This would have to know the set of possibilities. Implementation * is deferred. */ static void mcinvert(p, cs) register struct parse *p; register cset *cs; { assert(cs->multis == NULL); /* xxx */ } /* - mccase - add case counterparts of the list of collating elements in a cset == static void mccase(register struct parse *p, register cset *cs); * * This would have to know the set of possibilities. Implementation * is deferred. */ static void mccase(p, cs) register struct parse *p; register cset *cs; { assert(cs->multis == NULL); /* xxx */ } /* - isinsets - is this character in any sets? == static int isinsets(register struct re_guts *g, int c); */ static int /* predicate */ isinsets(g, c) register struct re_guts *g; int c; { register uch *col; register int i; register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT; register unsigned uc = (unsigned char)c; for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize) if (col[uc] != 0) return(1); return(0); } /* - samesets - are these two characters in exactly the same sets? == static int samesets(register struct re_guts *g, int c1, int c2); */ static int /* predicate */ samesets(g, c1, c2) register struct re_guts *g; int c1; int c2; { register uch *col; register int i; register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT; register unsigned uc1 = (unsigned char)c1; register unsigned uc2 = (unsigned char)c2; for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize) if (col[uc1] != col[uc2]) return(0); return(1); } /* - categorize - sort out character categories == static void categorize(struct parse *p, register struct re_guts *g); */ static void categorize(p, g) struct parse *p; register struct re_guts *g; { register cat_t *cats = g->categories; register int c; register int c2; register cat_t cat; /* avoid making error situations worse */ if (p->error != 0) return; for (c = CHAR_MIN; c <= CHAR_MAX; c++) if (cats[c] == 0 && isinsets(g, c)) { cat = g->ncategories++; cats[c] = cat; for (c2 = c+1; c2 <= CHAR_MAX; c2++) if (cats[c2] == 0 && samesets(g, c, c2)) cats[c2] = cat; } } /* - dupl - emit a duplicate of a bunch of sops == static sopno dupl(register struct parse *p, sopno start, sopno finish); */ static sopno /* start of duplicate */ dupl(p, start, finish) register struct parse *p; sopno start; /* from here */ sopno finish; /* to this less one */ { register sopno ret = HERE(); register sopno len = finish - start; assert(finish >= start); if (len == 0) return(ret); enlarge(p, p->ssize + len); /* this many unexpected additions */ assert(p->ssize >= p->slen + len); (void) memcpy((char *)(p->strip + p->slen), (char *)(p->strip + start), (size_t)len*sizeof(sop)); p->slen += len; return(ret); } /* - doemit - emit a strip operator == static void doemit(register struct parse *p, sop op, size_t opnd); * * It might seem better to implement this as a macro with a function as * hard-case backup, but it's just too big and messy unless there are * some changes to the data structures. Maybe later. */ static void doemit(p, op, opnd) register struct parse *p; sop op; size_t opnd; { /* avoid making error situations worse */ if (p->error != 0) return; /* deal with oversize operands ("can't happen", more or less) */ assert(opnd < 1<slen >= p->ssize) enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */ assert(p->slen < p->ssize); /* finally, it's all reduced to the easy case */ p->strip[p->slen++] = SOP(op, opnd); } /* - doinsert - insert a sop into the strip == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos); */ static void doinsert(p, op, opnd, pos) register struct parse *p; sop op; size_t opnd; sopno pos; { register sopno sn; register sop s; register int i; /* avoid making error situations worse */ if (p->error != 0) return; sn = HERE(); EMIT(op, opnd); /* do checks, ensure space */ assert(HERE() == sn+1); s = p->strip[sn]; /* adjust paren pointers */ assert(pos > 0); for (i = 1; i < NPAREN; i++) { if (p->pbegin[i] >= pos) { p->pbegin[i]++; } if (p->pend[i] >= pos) { p->pend[i]++; } } memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos], (HERE()-pos-1)*sizeof(sop)); p->strip[pos] = s; } /* - dofwd - complete a forward reference == static void dofwd(register struct parse *p, sopno pos, sop value); */ static void dofwd(p, pos, value) register struct parse *p; register sopno pos; sop value; { /* avoid making error situations worse */ if (p->error != 0) return; assert(value < 1L<strip[pos] = OP(p->strip[pos]) | value; } /* - enlarge - enlarge the strip == static void enlarge(register struct parse *p, sopno size); */ static void enlarge(p, size) register struct parse *p; register sopno size; { register sop *sp; if (p->ssize >= size) return; sp = (sop *)realloc(p->strip, size*sizeof(sop)); if (sp == NULL) { SETERROR(REG_ESPACE); return; } p->strip = sp; p->ssize = size; } /* - stripsnug - compact the strip == static void stripsnug(register struct parse *p, register struct re_guts *g); */ static void stripsnug(p, g) register struct parse *p; register struct re_guts *g; { g->nstates = p->slen; g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop)); if (g->strip == NULL) { SETERROR(REG_ESPACE); g->strip = p->strip; } } /* - findmust - fill in must and mlen with longest mandatory literal string == static void findmust(register struct parse *p, register struct re_guts *g); * * This algorithm could do fancy things like analyzing the operands of | * for common subsequences. Someday. This code is simple and finds most * of the interesting cases. * * Note that must and mlen got initialized during setup. */ static void findmust(p, g) struct parse *p; register struct re_guts *g; { register sop *scan; sop *start; register sop *newstart; register sopno newlen; register sop s; register char *cp; register sopno i; /* avoid making error situations worse */ if (p->error != 0) return; /* find the longest OCHAR sequence in strip */ newlen = 0; scan = g->strip + 1; do { s = *scan++; switch (OP(s)) { case OCHAR: /* sequence member */ if (newlen == 0) /* new sequence */ newstart = scan - 1; newlen++; break; case OPLUS_: /* things that don't break one */ case OLPAREN: case ORPAREN: break; case OQUEST_: /* things that must be skipped */ case OCH_: scan--; do { scan += OPND(s); s = *scan; /* assert() interferes w debug printouts */ if (OP(s) != O_QUEST && OP(s) != O_CH && OP(s) != OOR2) { g->iflags |= BAD; return; } } while (OP(s) != O_QUEST && OP(s) != O_CH); /* fallthrough */ default: /* things that break a sequence */ if (newlen > g->mlen) { /* ends one */ start = newstart; g->mlen = newlen; } newlen = 0; break; } } while (OP(s) != OEND); if (g->mlen == 0) /* there isn't one */ return; /* turn it into a character string */ g->must = malloc((size_t)g->mlen + 1); if (g->must == NULL) { /* argh; just forget it */ g->mlen = 0; return; } cp = g->must; scan = start; for (i = g->mlen; i > 0; i--) { while (OP(s = *scan++) != OCHAR) continue; assert(cp < g->must + g->mlen); *cp++ = (char)OPND(s); } assert(cp == g->must + g->mlen); *cp++ = '\0'; /* just on general principles */ } /* - pluscount - count + nesting == static sopno pluscount(register struct parse *p, register struct re_guts *g); */ static sopno /* nesting depth */ pluscount(p, g) struct parse *p; register struct re_guts *g; { register sop *scan; register sop s; register sopno plusnest = 0; register sopno maxnest = 0; if (p->error != 0) return(0); /* there may not be an OEND */ scan = g->strip + 1; do { s = *scan++; switch (OP(s)) { case OPLUS_: plusnest++; break; case O_PLUS: if (plusnest > maxnest) maxnest = plusnest; plusnest--; break; } } while (OP(s) != OEND); if (plusnest != 0) g->iflags |= BAD; return(maxnest); } z88dk-1.8.ds1/src/copt/regex/regcomp.h0000644000175000017500000000522607541137357017200 0ustar tygrystygrys/* ========= begin header generated by ./mkh ========= */ #ifdef __cplusplus extern "C" { #endif /* === regcomp.c === */ static void p_ere(register struct parse *p, int stop); static void p_ere_exp(register struct parse *p); static void p_str(register struct parse *p); static void p_bre(register struct parse *p, register int end1, register int end2); static int p_simp_re(register struct parse *p, int starordinary); static int p_count(register struct parse *p); static void p_bracket(register struct parse *p); static void p_b_term(register struct parse *p, register cset *cs); static void p_b_cclass(register struct parse *p, register cset *cs); static void p_b_eclass(register struct parse *p, register cset *cs); static char p_b_symbol(register struct parse *p); static char p_b_coll_elem(register struct parse *p, int endc); static char othercase(int ch); static void bothcases(register struct parse *p, int ch); static void ordinary(register struct parse *p, register int ch); static void nonnewline(register struct parse *p); static void repeat(register struct parse *p, sopno start, int from, int to); static int seterr(register struct parse *p, int e); static cset *allocset(register struct parse *p); static void freeset(register struct parse *p, register cset *cs); static int freezeset(register struct parse *p, register cset *cs); static int firstch(register struct parse *p, register cset *cs); static int nch(register struct parse *p, register cset *cs); static void mcadd(register struct parse *p, register cset *cs, register char *cp); static void mcsub(register cset *cs, register char *cp); static int mcin(register cset *cs, register char *cp); static char *mcfind(register cset *cs, register char *cp); static void mcinvert(register struct parse *p, register cset *cs); static void mccase(register struct parse *p, register cset *cs); static int isinsets(register struct re_guts *g, int c); static int samesets(register struct re_guts *g, int c1, int c2); static void categorize(struct parse *p, register struct re_guts *g); static sopno dupl(register struct parse *p, sopno start, sopno finish); static void doemit(register struct parse *p, sop op, size_t opnd); static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos); static void dofwd(register struct parse *p, sopno pos, sop value); static void enlarge(register struct parse *p, sopno size); static void stripsnug(register struct parse *p, register struct re_guts *g); static void findmust(register struct parse *p, register struct re_guts *g); static sopno pluscount(register struct parse *p, register struct re_guts *g); #ifdef __cplusplus } #endif /* ========= end header generated by ./mkh ========= */ z88dk-1.8.ds1/src/copt/regex/regerror.c0000644000175000017500000000631210537314617017356 0ustar tygrystygrys#include #include #include #include #include #include #include #include "utils.h" #include "regerror.h" #if _MSC_VER >= 1400 /* is this Visual C++ 2005 ? */ #define errcode __vc_errcode #endif /* = #define REG_OKAY 0 = #define REG_NOMATCH 1 = #define REG_BADPAT 2 = #define REG_ECOLLATE 3 = #define REG_ECTYPE 4 = #define REG_EESCAPE 5 = #define REG_ESUBREG 6 = #define REG_EBRACK 7 = #define REG_EPAREN 8 = #define REG_EBRACE 9 = #define REG_BADBR 10 = #define REG_ERANGE 11 = #define REG_ESPACE 12 = #define REG_BADRPT 13 = #define REG_EMPTY 14 = #define REG_ASSERT 15 = #define REG_INVARG 16 = #define REG_ATOI 255 // convert name to number (!) = #define REG_ITOA 0400 // convert number to name (!) */ static struct rerr { int code; char *name; char *explain; } rerrs[] = { REG_OKAY, "REG_OKAY", "no errors detected", REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match", REG_BADPAT, "REG_BADPAT", "invalid regular expression", REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element", REG_ECTYPE, "REG_ECTYPE", "invalid character class", REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)", REG_ESUBREG, "REG_ESUBREG", "invalid backreference number", REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced", REG_EPAREN, "REG_EPAREN", "parentheses not balanced", REG_EBRACE, "REG_EBRACE", "braces not balanced", REG_BADBR, "REG_BADBR", "invalid repetition count(s)", REG_ERANGE, "REG_ERANGE", "invalid character range", REG_ESPACE, "REG_ESPACE", "out of memory", REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid", REG_EMPTY, "REG_EMPTY", "empty (sub)expression", REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug", REG_INVARG, "REG_INVARG", "invalid argument to regex routine", -1, "", "*** unknown regexp error code ***", }; /* - regerror - the interface to error numbers = extern size_t regerror(int, const regex_t *, char *, size_t); */ /* ARGSUSED */ size_t regerror(errcode, preg, errbuf, errbuf_size) int errcode; const regex_t *preg; char *errbuf; size_t errbuf_size; { register struct rerr *r; register size_t len; register int target = errcode &~ REG_ITOA; register char *s; char convbuf[50]; if (errcode == REG_ATOI) s = regatoi(preg, convbuf); else { for (r = rerrs; r->code >= 0; r++) if (r->code == target) break; if (errcode®_ITOA) { if (r->code >= 0) (void) strcpy(convbuf, r->name); else sprintf(convbuf, "REG_0x%x", target); assert(strlen(convbuf) < sizeof(convbuf)); s = convbuf; } else s = r->explain; } len = strlen(s) + 1; if (errbuf_size > 0) { if (errbuf_size > len) (void) strcpy(errbuf, s); else { (void) strncpy(errbuf, s, errbuf_size-1); errbuf[errbuf_size-1] = '\0'; } } return(len); } /* - regatoi - internal routine to implement REG_ATOI == static char *regatoi(const regex_t *preg, char *localbuf); */ static char * regatoi(preg, localbuf) const regex_t *preg; char *localbuf; { register struct rerr *r; for (r = rerrs; r->code >= 0; r++) if (strcmp(r->name, preg->re_endp) == 0) break; if (r->code < 0) return("0"); sprintf(localbuf, "%d", r->code); return(localbuf); } z88dk-1.8.ds1/src/copt/regex/regerror.h0000644000175000017500000000041307541137357017364 0ustar tygrystygrys/* ========= begin header generated by ./mkh ========= */ #ifdef __cplusplus extern "C" { #endif /* === regerror.c === */ static char *regatoi(const regex_t *preg, char *localbuf); #ifdef __cplusplus } #endif /* ========= end header generated by ./mkh ========= */ z88dk-1.8.ds1/src/copt/regex/regex.h0000644000175000017500000000355307541137357016657 0ustar tygrystygrys#ifndef _REGEX_H_ #define _REGEX_H_ /* never again */ /* ========= begin header generated by ./mkh ========= */ #ifdef __cplusplus extern "C" { #endif /* === regex2.h === */ #ifdef __TURBOC__ typedef long off_t; #endif typedef off_t regoff_t; typedef struct { int re_magic; size_t re_nsub; /* number of parenthesized subexpressions */ const char *re_endp; /* end pointer for REG_PEND */ struct re_guts *re_g; /* none of your business :-) */ } regex_t; typedef struct { regoff_t rm_so; /* start of match */ regoff_t rm_eo; /* end of match */ } regmatch_t; /* === regcomp.c === */ extern int regcomp(regex_t *, const char *, int); #define REG_BASIC 0000 #define REG_EXTENDED 0001 #define REG_ICASE 0002 #define REG_NOSUB 0004 #define REG_NEWLINE 0010 #define REG_NOSPEC 0020 #define REG_PEND 0040 #define REG_DUMP 0200 /* === regerror.c === */ #define REG_OKAY 0 #define REG_NOMATCH 1 #define REG_BADPAT 2 #define REG_ECOLLATE 3 #define REG_ECTYPE 4 #define REG_EESCAPE 5 #define REG_ESUBREG 6 #define REG_EBRACK 7 #define REG_EPAREN 8 #define REG_EBRACE 9 #define REG_BADBR 10 #define REG_ERANGE 11 #define REG_ESPACE 12 #define REG_BADRPT 13 #define REG_EMPTY 14 #define REG_ASSERT 15 #define REG_INVARG 16 #define REG_ATOI 255 /* convert name to number (!) */ #define REG_ITOA 0400 /* convert number to name (!) */ extern size_t regerror(int, const regex_t *, char *, size_t); /* === regexec.c === */ extern int regexec(const regex_t *, const char *, size_t, regmatch_t [], int); #define REG_NOTBOL 00001 #define REG_NOTEOL 00002 #define REG_STARTEND 00004 #define REG_TRACE 00400 /* tracing of execution */ #define REG_LARGE 01000 /* force large representation */ #define REG_BACKR 02000 /* force use of backref code */ /* === regfree.c === */ extern void regfree(regex_t *); #ifdef __cplusplus } #endif /* ========= end header generated by ./mkh ========= */ #endif z88dk-1.8.ds1/src/copt/regex/regex2.h0000644000175000017500000001241107541137357016732 0ustar tygrystygrys/* * First, the stuff that ends up in the outside-world include file = typedef off_t regoff_t; = typedef struct { = int re_magic; = size_t re_nsub; // number of parenthesized subexpressions = const char *re_endp; // end pointer for REG_PEND = struct re_guts *re_g; // none of your business :-) = } regex_t; = typedef struct { = regoff_t rm_so; // start of match = regoff_t rm_eo; // end of match = } regmatch_t; */ /* * internals of regex_t */ #define MAGIC1 ((('r'^0200)<<8) | 'e') /* * The internal representation is a *strip*, a sequence of * operators ending with an endmarker. (Some terminology etc. is a * historical relic of earlier versions which used multiple strips.) * Certain oddities in the representation are there to permit running * the machinery backwards; in particular, any deviation from sequential * flow must be marked at both its source and its destination. Some * fine points: * * - OPLUS_ and O_PLUS are *inside* the loop they create. * - OQUEST_ and O_QUEST are *outside* the bypass they create. * - OCH_ and O_CH are *outside* the multi-way branch they create, while * OOR1 and OOR2 are respectively the end and the beginning of one of * the branches. Note that there is an implicit OOR2 following OCH_ * and an implicit OOR1 preceding O_CH. * * In state representations, an operator's bit is on to signify a state * immediately *preceding* "execution" of that operator. */ typedef long sop; /* strip operator */ typedef long sopno; #define OPRMASK 0x7c000000 #define OPDMASK 0x03ffffff #define OPSHIFT (26) #define OP(n) ((n)&OPRMASK) #define OPND(n) ((n)&OPDMASK) #define SOP(op, opnd) ((op)|(opnd)) /* operators meaning operand */ /* (back, fwd are offsets) */ #define OEND (1L< uch [csetsize] */ uch mask; /* bit within array */ uch hash; /* hash code */ size_t smultis; char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */ } cset; /* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */ #define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c)) #define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c)) #define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask) #define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */ #define MCsub(p, cs, cp) mcsub(p, cs, cp) #define MCin(p, cs, cp) mcin(p, cs, cp) /* stuff for character categories */ typedef unsigned char cat_t; /* * main compiled-expression structure */ struct re_guts { int magic; # define MAGIC2 ((('R'^0200)<<8)|'E') sop *strip; /* malloced area for strip */ int csetsize; /* number of bits in a cset vector */ int ncsets; /* number of csets in use */ cset *sets; /* -> cset [ncsets] */ uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */ int cflags; /* copy of regcomp() cflags argument */ sopno nstates; /* = number of sops */ sopno firststate; /* the initial OEND (normally 0) */ sopno laststate; /* the final OEND */ int iflags; /* internal flags */ # define USEBOL 01 /* used ^ */ # define USEEOL 02 /* used $ */ # define BAD 04 /* something wrong */ int nbol; /* number of ^ used */ int neol; /* number of $ used */ int ncategories; /* how many character categories */ cat_t *categories; /* ->catspace[-CHAR_MIN] */ char *must; /* match must contain this string */ int mlen; /* length of must */ size_t nsub; /* copy of re_nsub */ int backrefs; /* does it use back references? */ sopno nplus; /* how deep does it nest +s? */ /* catspace must be last */ cat_t catspace[1]; /* actually [NC] */ }; /* misc utilities */ #define OUT (CHAR_MAX+1) /* a non-character value */ #define ISWORD(c) (isalnum(c) || (c) == '_') z88dk-1.8.ds1/src/copt/regex/regexec.c0000644000175000017500000001021607541137357017154 0ustar tygrystygrys/* * the outer shell of regexec() * * This file includes engine.c *twice*, after muchos fiddling with the * macros that code uses. This lets the same code operate on two different * representations for state sets. */ #include #include #include #include #include #include #include #include "utils.h" #include "regex2.h" static int nope = 0; /* for use in asserts; shuts lint up */ /* macros for manipulating states, small version */ #define states unsigned #define states1 unsigned /* for later use in regexec() decision */ #define CLEAR(v) ((v) = 0) #define SET0(v, n) ((v) &= ~((unsigned)1 << (n))) #define SET1(v, n) ((v) |= (unsigned)1 << (n)) #define ISSET(v, n) ((v) & ((unsigned)1 << (n))) #define ASSIGN(d, s) ((d) = (s)) #define EQ(a, b) ((a) == (b)) #define STATEVARS int dummy /* dummy version */ #define STATESETUP(m, n) /* nothing */ #define STATETEARDOWN(m) /* nothing */ #define SETUP(v) ((v) = 0) #define onestate unsigned #define INIT(o, n) ((o) = (unsigned)1 << (n)) #define INC(o) ((o) <<= 1) #define ISSTATEIN(v, o) ((v) & (o)) /* some abbreviations; note that some of these know variable names! */ /* do "if I'm here, I can also be there" etc without branches */ #define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n)) #define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n)) #define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n))) /* function names */ #define SNAMES /* engine.c looks after details */ #include "engine.c" /* now undo things */ #undef states #undef CLEAR #undef SET0 #undef SET1 #undef ISSET #undef ASSIGN #undef EQ #undef STATEVARS #undef STATESETUP #undef STATETEARDOWN #undef SETUP #undef onestate #undef INIT #undef INC #undef ISSTATEIN #undef FWD #undef BACK #undef ISSETBACK #undef SNAMES /* macros for manipulating states, large version */ #define states char * #define CLEAR(v) memset(v, 0, m->g->nstates) #define SET0(v, n) ((v)[n] = 0) #define SET1(v, n) ((v)[n] = 1) #define ISSET(v, n) ((v)[n]) #define ASSIGN(d, s) memcpy(d, s, m->g->nstates) #define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0) #define STATEVARS int vn; char *space #define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \ if ((m)->space == NULL) return(REG_ESPACE); \ (m)->vn = 0; } #define STATETEARDOWN(m) { free((m)->space); } #define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates]) #define onestate int #define INIT(o, n) ((o) = (n)) #define INC(o) ((o)++) #define ISSTATEIN(v, o) ((v)[o]) /* some abbreviations; note that some of these know variable names! */ /* do "if I'm here, I can also be there" etc without branches */ #define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here]) #define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here]) #define ISSETBACK(v, n) ((v)[here - (n)]) /* function names */ #define LNAMES /* flag */ #include "engine.c" /* - regexec - interface for matching = extern int regexec(const regex_t *, const char *, size_t, \ = regmatch_t [], int); = #define REG_NOTBOL 00001 = #define REG_NOTEOL 00002 = #define REG_STARTEND 00004 = #define REG_TRACE 00400 // tracing of execution = #define REG_LARGE 01000 // force large representation = #define REG_BACKR 02000 // force use of backref code * * We put this here so we can exploit knowledge of the state representation * when choosing which matcher to call. Also, by this point the matchers * have been prototyped. */ int /* 0 success, REG_NOMATCH failure */ regexec(preg, string, nmatch, pmatch, eflags) const regex_t *preg; const char *string; size_t nmatch; regmatch_t pmatch[]; int eflags; { register struct re_guts *g = preg->re_g; #ifdef REDEBUG # define GOODFLAGS(f) (f) #else # define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND)) #endif if (preg->re_magic != MAGIC1 || g->magic != MAGIC2) return(REG_BADPAT); assert(!(g->iflags&BAD)); if (g->iflags&BAD) /* backstop for no-debug case */ return(REG_BADPAT); eflags = GOODFLAGS(eflags); if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE)) return(smatcher(g, (char *)string, nmatch, pmatch, eflags)); else return(lmatcher(g, (char *)string, nmatch, pmatch, eflags)); } z88dk-1.8.ds1/src/copt/regex/regfree.c0000644000175000017500000000132107541137357017146 0ustar tygrystygrys#include #include #include #include #include "utils.h" #include "regex2.h" /* - regfree - free everything = extern void regfree(regex_t *); */ void regfree(preg) regex_t *preg; { register struct re_guts *g; if (preg->re_magic != MAGIC1) /* oops */ return; /* nice to complain, but hard */ g = preg->re_g; if (g == NULL || g->magic != MAGIC2) /* oops again */ return; preg->re_magic = 0; /* mark it invalid */ g->magic = 0; /* mark it invalid */ if (g->strip != NULL) free((char *)g->strip); if (g->sets != NULL) free((char *)g->sets); if (g->setbits != NULL) free((char *)g->setbits); if (g->must != NULL) free(g->must); free((char *)g); } z88dk-1.8.ds1/src/copt/regex/utils.h0000644000175000017500000000076407541137357016706 0ustar tygrystygrys/* utility definitions */ #ifdef _POSIX2_RE_DUP_MAX #define DUPMAX _POSIX2_RE_DUP_MAX #else #define DUPMAX 255 #endif #define INFINITY (DUPMAX + 1) #define NC (CHAR_MAX - CHAR_MIN + 1) typedef unsigned char uch; /* switch off assertions (if not already off) if no REDEBUG */ #ifndef REDEBUG #ifndef NDEBUG #define NDEBUG /* no assertions please */ #endif #endif #include /* for old systems with bcopy() but no memmove() */ #ifdef USEBCOPY #define memmove(d, s, c) bcopy(s, d, c) #endif z88dk-1.8.ds1/src/copt/vscmake.bat0000644000175000017500000000045010537314616016366 0ustar tygrystygrys@echo off rem $Id: vscmake.bat,v 1.4 2006/12/11 17:46:54 stefano Exp $ echo ***************** echo * Building copt * echo ***************** cl /Fecopt /Iregex -DUSE_REGEXP -DLOCAL_REGEXP -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE *.c regex\reg*.c move copt.exe ..\..\bin del *.obj z88dk-1.8.ds1/src/cpp/0000755000175000017500000000000010765202715014062 5ustar tygrystygrysz88dk-1.8.ds1/src/cpp/cpp.h0000644000175000017500000001472207130401711015010 0ustar tygrystygrys /* * I n t e r n a l D e f i n i t i o n s f o r C P P * * In general, definitions in this file should not be changed. */ #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #ifndef EOS /* * This is predefined in Decus C */ #define EOS '\0' /* End of string */ #endif #define EOF_CHAR 0 /* Returned by get() on eof */ #define NULLST ((char *) NULL) /* Pointer to nowhere (linted) */ #define DEF_NOARGS (-1) /* #define foo vs #define foo() */ /* * The following may need to change if the host system doesn't use ASCII. */ #define DBL_QUOTE 0x1B /* This is a virtual " */ #define TOK_QUOTE 0x1C /* Token quotation */ #define DEF_MAGIC 0x1D /* Magic for #defines */ #define TOK_SEP 0x1E /* Token concatenation delim. */ #define COM_SEP 0x1F /* Magic comment separator */ /* * Note -- in Ascii, the following will map macro formals onto DEL + the * C1 control character region (decimal 128 .. (128 + PAR_MAC)) which will * be ok as long as PAR_MAC is less than 33). Note that the last PAR_MAC * value is reserved for string substitution. */ #define MAC_PARM 0x7F /* Macro formals start here */ #if PAR_MAC >= 33 #error "assertion fails -- PAR_MAC isn't less than 33" #endif #define LASTPARM (PAR_MAC - 1) /* * Character type codes. */ #define INV 0 /* Invalid, must be zero */ #define OP_EOE INV /* End of expression */ #define DIG 1 /* Digit */ #define LET 2 /* Identifier start */ #define FIRST_BINOP OP_ADD #define OP_ADD 3 #define OP_SUB 4 #define OP_MUL 5 #define OP_DIV 6 #define OP_MOD 7 #define OP_ASL 8 #define OP_ASR 9 #define OP_AND 10 /* &, not && */ #define OP_OR 11 /* |, not || */ #define OP_XOR 12 #define OP_EQ 13 #define OP_NE 14 #define OP_LT 15 #define OP_LE 16 #define OP_GE 17 #define OP_GT 18 #define OP_ANA 19 /* && */ #define OP_ORO 20 /* || */ #define OP_QUE 21 /* ? */ #define OP_COL 22 /* : */ #define OP_CMA 23 /* , (relevant?) */ #define LAST_BINOP OP_CMA /* Last binary operand */ /* * The following are unary. */ #define FIRST_UNOP OP_PLU /* First Unary operand */ #define OP_PLU 24 /* + (draft ANSI standard) */ #define OP_NEG 25 /* - */ #define OP_COM 26 /* ~ */ #define OP_NOT 27 /* ! */ #define LAST_UNOP OP_NOT #define OP_LPA 28 /* ( */ #define OP_RPA 29 /* ) */ #define OP_END 30 /* End of expression marker */ #define OP_MAX (OP_END + 1) /* Number of operators */ #define OP_FAIL (OP_END + 1) /* For error returns */ /* * The following are for lexical scanning only. */ #define QUO 65 /* Both flavors of quotation */ #define DOT 66 /* . might start a number */ #define SPA 67 /* Space and tab */ #define BSH 68 /* Just a backslash */ #define END 69 /* EOF */ /* * These bits are set in ifstack[] */ #define WAS_COMPILING 1 /* TRUE if compile set at entry */ #define ELSE_SEEN 2 /* TRUE when #else processed */ #define TRUE_SEEN 4 /* TRUE when #if TRUE processed */ /* * Define bits for the basic types and their adjectives */ #define T_CHAR 1 #define T_INT 2 #define T_FLOAT 4 #define T_DOUBLE 8 #define T_SHORT 16 #define T_LONG 32 #define T_SIGNED 64 #define T_UNSIGNED 128 #define T_PTR 256 /* Pointer */ #define T_FPTR 512 /* Pointer to functions */ /* * The DEFBUF structure stores information about #defined * macros. Note that the defbuf->repl information is always * in malloc storage. */ typedef struct defbuf { struct defbuf *link; /* Next define in chain */ char *repl; /* -> replacement */ int hash; /* Symbol table hash */ int nargs; /* For define(args) */ char name[1]; /* #define name */ } DEFBUF; /* * The FILEINFO structure stores information about open files * and macros being expanded. */ typedef struct fileinfo { char *bptr; /* Buffer pointer */ int line; /* for include or macro */ FILE *fp; /* File if non-null */ struct fileinfo *parent; /* Link to includer */ char *filename; /* File/macro name */ char *progname; /* From #line statement */ unsigned int unrecur; /* For macro recursion */ char buffer[1]; /* current input line */ } FILEINFO; /* * The SIZES structure is used to store the values for #if sizeof */ typedef struct sizes { short bits; /* If this bit is set, */ short size; /* this is the datum size value */ short psize; /* this is the pointer size */ } SIZES; /* * nomacarg is a built-in #define on Decus C. */ #define cput output /* cput concatenates tokens */ #ifndef nomacarg #define streq(s1, s2) (strcmp(s1, s2) == 0) #endif /* * Error codes. VMS uses system definitions. * Decus C codes are defined in stdio.h. * Others are cooked to order. */ #if HOST == SYS_VMS #include #include #define IO_NORMAL (SS$_NORMAL | STS$M_INHIB_MSG) #define IO_ERROR SS$_ABORT #endif /* * Note: IO_NORMAL and IO_ERROR are defined in the Decus C stdio.h file */ #ifndef IO_NORMAL #define IO_NORMAL 0 #endif #ifndef IO_ERROR #define IO_ERROR 1 #endif /* * Externs */ extern int line; /* Current line number */ extern int wrongline; /* Force #line to cc pass 1 */ extern char type[]; /* Character classifier */ extern char token[IDMAX + 1]; /* Current input token */ extern int instring; /* TRUE if scanning string */ extern int inmacro; /* TRUE if scanning #define */ extern int errors; /* Error counter */ extern int recursion; /* Macro depth counter */ extern char ifstack[BLK_NEST]; /* #if information */ #define compiling ifstack[0] extern char *ifptr; /* -> current ifstack item */ extern char *incdir[NINCLUDE]; /* -i directories */ extern char **incend; /* -> active end of incdir */ extern int cflag; /* -C option (keep comments) */ extern int eflag; /* -E option (ignore errors) */ extern int nflag; /* -N option (no pre-defines) */ extern int pflag; /* -P option (no #line lines) */ extern int rec_recover; /* unwind recursive macros */ extern char *preset[]; /* Standard predefined symbols */ extern char *magic[]; /* Magic predefined symbols */ extern FILEINFO *infile; /* Current input file */ extern char work[NWORK + 1]; /* #define scratch */ extern char *workp; /* Free space in work */ #if DEBUG extern int debug; /* Debug level */ #endif extern int keepcomments; /* Don't remove comments if set */ extern SIZES size_table[]; /* For #if sizeof sizes */ extern char *getmem(); /* Get memory or die. */ extern DEFBUF *lookid(); /* Look for a #define'd thing */ extern DEFBUF *defendel(); /* Symbol table enter/delete */ extern char *savestring(); /* Stuff string in malloc mem. */ z88dk-1.8.ds1/src/cpp/cpp1.c0000644000175000017500000004176507271237071015107 0ustar tygrystygrys/* * CPP main program. * * Edit history * 21-May-84 MM "Field test" release * 23-May-84 MM Some minor hacks. * 30-May-84 ARF Didn't get enough memory for __DATE__ * Added code to read stdin if no input * files are provided. * 29-Jun-84 MM Added ARF's suggestions, Unixifying cpp. * 11-Jul-84 MM "Official" first release (that's what I thought!) * 22-Jul-84 MM/ARF/SCK Fixed line number bugs, added cpp recognition * of #line, fixed problems with #include. * 23-Jul-84 MM More (minor) include hacking, some documentation. * Also, redid cpp's #include files * 25-Jul-84 MM #line filename isn't used for #include searchlist * #line format is * 25-Jul-84 ARF/MM Various bugs, mostly serious. Removed homemade doprint * 01-Aug-84 MM Fixed recursion bug, remove extra newlines and * leading whitespace from cpp output. * 02-Aug-84 MM Hacked (i.e. optimized) out blank lines and unneeded * whitespace in general. Cleaned up unget()'s. * 03-Aug-84 Keie Several bug fixes from Ed Keizer, Vrije Universitet. * -- corrected arg. count in -D and pre-defined * macros. Also, allow \n inside macro actual parameter * lists. * 06-Aug-84 MM If debugging, dump the preset vector at startup. * 12-Aug-84 MM/SCK Some small changes from Sam Kendall * 15-Aug-84 Keie/MM cerror, cwarn, etc. take a single string arg. * cierror, etc. take a single int. arg. * changed LINE_PREFIX slightly so it can be * changed in the makefile. * 31-Aug-84 MM USENET net.sources release. * 7-Sep-84 SCH/ado Lint complaints * 10-Sep-84 Keie Char's can't be signed in some implementations * 11-Sep-84 ado Added -C flag, pathological line number fix * 13-Sep-84 ado Added -E flag (does nothing) and "-" file for stdin. * 14-Sep-84 MM Allow # 123 as a synonym for #line 123 * 19-Sep-84 MM scanid always reads to token, make sure #line is * written to a new line, even if -C switch given. * Also, cpp - - reads stdin, writes stdout. * 03-Oct-84 ado/MM Several changes to line counting and keepcomments * stuff. Also a rewritten control() hasher -- much * simpler and no less "perfect". Note also changes * in cpp3.c to fix numeric scanning. * 04-Oct-84 MM Added recognition of macro formal parameters if * they are the only thing in a string, per the * draft standard. * 08-Oct-84 MM One more attack on scannumber * 15-Oct-84 MM/ado Added -N to disable predefined symbols. Fixed * linecount if COMMENT_INVISIBLE enabled. * 22-Oct-84 MM Don't evaluate the #if/#ifdef argument if * compilation is supressed. This prevents * unnecessary error messages in sequences such as * #ifdef FOO -- undefined * #if FOO == 10 -- shouldn't print warning * 25-Oct-84 MM Fixed bug in false ifdef supression. On vms, * #include should open foo.h -- this duplicates * the behavior of Vax-C * 31-Oct-84 ado/MM Parametized $ in indentifiers. Added a better * token concatenator and took out the trial * concatenation code. Also improved #ifdef code * and cleaned up the macro recursion tester. * 2-Nov-84 MM/ado Some bug fixes in token concatenation, also * a variety of minor (uninteresting) hacks. * 6-Nov-84 MM Happy Birthday. Broke into 4 files and added * #if sizeof (basic_types) * 9-Nov-84 MM Added -S* for pointer type sizes * 13-Nov-84 MM Split cpp1.c, added vms defaulting * 23-Nov-84 MM/ado -E supresses error exit, added CPP_INCLUDE, * fixed strncpy bug. * 3-Dec-84 ado/MM Added OLD_PREPROCESSOR * 7-Dec-84 MM Stuff in Nov 12 Draft Standard * 17-Dec-84 george Fixed problems with recursive macros * 17-Dec-84 MM Yet another attack on #if's (f/t)level removed. * 07-Jan-85 ado Init defines before doing command line options * so -Uunix works. * 11-Feb-94 MH Changed token concatenation (hopefully) to ANSI * standard and added token quoting. * 26-Nov-94 MH -P problem of outputting a newline after leading * white space in order to correct counter if fixed * now. Several other fixes for -P, too. */ #include #include #include #include #include "cppdef.h" #include "cpp.h" #ifdef __MSDOS__ #ifdef __BORLANDC__ extern unsigned _stklen=8192U; /* Default stack of 4096 is too small */ #endif #endif /* * Commonly used global variables: * line is the current input line number. * wrongline is set in many places when the actual output * line is out of sync with the numbering, e.g, * when expanding a macro with an embedded newline. * * token holds the last identifier scanned (which might * be a candidate for macro expansion). * errors is the running cpp error counter. * infile is the head of a linked list of input files (extended by * #include and macros being expanded). infile always points * to the current file/macro. infile->parent to the includer, * etc. infile->fd is NULL if this input stream is a macro. */ int line; /* Current line number */ int wrongline; /* Force #line to compiler */ char token[IDMAX + 1]; /* Current input token */ int errors; /* cpp error counter */ FILEINFO *infile = NULL; /* Current input file */ #if DEBUG int debug; /* TRUE if debugging now */ #endif /* * This counter is incremented when a macro expansion is initiated. * If it exceeds a built-in value, the expansion stops -- this tests * for a runaway condition: * #define X Y * #define Y X * X * This can be disabled by falsifying rec_recover. (Nothing does this * currently: it is a hook for an eventual invocation flag.) */ int recursion; /* Infinite recursion counter */ int rec_recover = TRUE; /* Unwind recursive macros */ /* * instring is set TRUE when a string is scanned. It modifies the * behavior of the "get next character" routine, causing all characters * to be passed to the caller (except ). Note especially that * comments and \ are not removed from the source. (This * prevents cpp output lines from being arbitrarily long). * * inmacro is set by #define -- it absorbs comments and converts * form-feed and vertical-tab to space, but returns \ * to the caller. Strictly speaking, this is a bug as \ * shouldn't delimit tokens, but we'll worry about that some other * time -- it is more important to prevent infinitly long output lines. * * instring and inmarcor are parameters to the get() routine which * were made global for speed. */ int instring = FALSE; /* TRUE if scanning string */ int inmacro = FALSE; /* TRUE if #defining a macro */ /* * work[] and workp are used to store one piece of text in a temporay * buffer. To initialize storage, set workp = work. To store one * character, call save(c); (This will fatally exit if there isn't * room.) To terminate the string, call save(EOS). Note that * the work buffer is used by several subroutines -- be sure your * data won't be overwritten. The extra byte in the allocation is * needed for string formal replacement. */ char work[NWORK + 1]; /* Work buffer */ char *workp; /* Work buffer pointer */ /* * keepcomments is set TRUE by the -C option. If TRUE, comments * are written directly to the output stream. This is needed if * the output from cpp is to be passed to lint (which uses commands * embedded in comments). cflag contains the permanent state of the * -C flag. keepcomments is always falsified when processing #control * commands and when compilation is supressed by a false #if * * If eflag is set, CPP returns "success" even if non-fatal errors * were detected. * * If nflag is non-zero, no symbols are predefined except __LINE__. * __FILE__, and __DATE__. If nflag > 1, absolutely no symbols * are predefined. */ int keepcomments = FALSE; /* Write out comments flag */ int cflag = FALSE; /* -C option (keep comments) */ int eflag = FALSE; /* -E option (never fail) */ int nflag = 0; /* -N option (no predefines) */ int pflag = 0; /* -P option (no #line) */ /* * ifstack[] holds information about nested #if's. It is always * accessed via *ifptr. The information is as follows: * WAS_COMPILING state of compiling flag at outer level. * ELSE_SEEN set TRUE when #else seen to prevent 2nd #else. * TRUE_SEEN set TRUE when #if or #elif succeeds * ifstack[0] holds the compiling flag. It is TRUE if compilation * is currently enabled. Note that this must be initialized TRUE. */ char ifstack[BLK_NEST] = { TRUE }; /* #if information */ char *ifptr = ifstack; /* -> current ifstack[] */ /* * incdir[] stores the -i directories (and the system-specific * #include <...> directories. */ char *incdir[NINCLUDE]; /* -i directories */ char **incend = incdir; /* -> free space in incdir[] */ /* * This is the table used to predefine target machine and operating * system designators. It may need hacking for specific circumstances. * Note: it is not clear that this is part of the Ansi Standard. * The -N option supresses preset definitions. */ char *preset[] = { /* names defined at cpp start */ #ifdef MACHINE MACHINE, #endif #ifdef SYSTEM SYSTEM, #endif #ifdef COMPILER COMPILER, #endif #if DEBUG "decus_cpp", /* Ourselves! */ #endif NULL /* Must be last */ }; /* * The value of these predefined symbols must be recomputed whenever * they are evaluated. The order must not be changed. */ char *magic[] = { /* Note: order is important */ "__LINE__", "__FILE__", NULL /* Must be last */ }; main(argc, argv) int argc; char *argv[]; { register int i; #if HOST == SYS_VMS argc = getredirection(argc, argv); /* vms >file and stdin */ /* * Open input file, "-" means use stdin. */ if (!streq(argv[1], "-")) { if (freopen(argv[1], "r", stdin) == NULL) { perror(argv[1]); cerror("Can't open input file `%s'", argv[1]); exit(IO_ERROR); } strcpy(work, argv[1]); /* Remember input filename */ break; } /* Else, just get stdin */ case 0: /* No args? */ case 1: /* No files, stdin -> stdout */ #if HOST == SYS_UNIX work[0] = EOS; /* Unix can't find stdin name */ #else fgetname(stdin, work); /* Vax-11C, Decus C know name */ #endif break; default: exit(IO_ERROR); /* Can't happen */ } setincdirs(); /* Setup -I include directories */ addfile(stdin, work); /* "open" main input file */ #if DEBUG if (debug > 0) dumpdef("preset #define symbols"); #endif cppmain(); /* Process main file */ if ((i = (ifptr - &ifstack[0])) != 0) { #if OLD_PREPROCESSOR ciwarn("Inside #ifdef block at end of input, depth = %d", i); #else cierror("Inside #ifdef block at end of input, depth = %d", i); #endif } fclose(stdout); if (errors > 0) { fprintf(stderr, (errors == 1) ? "%d error in preprocessor\n" : "%d errors in preprocessor\n", errors); if (!eflag) exit(IO_ERROR); } exit(IO_NORMAL); /* No errors or -E option set */ } FILE_LOCAL cppmain() /* * Main process for cpp -- copies tokens from the current input * stream (main file, include file, or a macro) to the output * file. */ { register int c; /* Current character */ register int counter; /* newlines and spaces */ extern int output(); /* Output one character */ /* * Explicitly output a #line at the start of cpp output so * that lint (etc.) knows the name of the original source * file. If we don't do this explicitly, we may get * the name of the first #include file instead. * We also seem to need a blank line following that first #line. */ sharp(); output('\n'); /* * This loop is started "from the top" at the beginning of each line * wrongline is set TRUE in many places if it is necessary to write * a #line record. (But we don't write them when expanding macros.) * * The counter variable has two different uses: at * the start of a line, it counts the number of blank lines that * have been skipped over. These are then either output via * #line records or by outputting explicit blank lines. * When expanding tokens within a line, the counter remembers * whether a blank/tab has been output. These are dropped * at the end of the line, and replaced by a single blank * within lines. */ for (;;) { counter = 0; /* Count empty lines */ for (;;) { /* For each line, ... */ while (type[(c = get())] == SPA)/* Skip leading blanks */ if (pflag && compiling) /* in this line. */ output(c); if (c == '\n') /* If line's all blank, */ if (pflag) /* Do nothing now */ output('\n'); else ++counter; else if (c == '#') { /* Is 1st non-space '#' */ keepcomments = FALSE; /* Don't pass comments */ counter = control(counter); /* Yes, do a #command */ if (pflag) /* Output missing \n */ while (counter>0) { output('\n'); --counter; } keepcomments = (cflag && compiling); } else if (c == EOF_CHAR) /* At end of file? */ break; else if (!compiling) { /* #ifdef false? */ skipnl(); /* Skip to newline */ if (pflag) output('\n'); /* Output blank line */ else counter++; /* Count it, too. */ } else { break; /* Actual token */ } } if (c == EOF_CHAR) /* Exit process at */ break; /* End of file */ /* * If the loop didn't terminate because of end of file, we * know there is a token to compile. First, clean up after * absorbing newlines. counter has the number we skipped. */ if ((wrongline && infile->fp != NULL) || counter > 4) sharp(); /* Output # line number */ else { /* If just a few, stuff */ while (--counter >= 0) /* them out ourselves */ output('\n'); } /* * Process each token on this line. */ unget(); /* Reread the char. */ for (;;) { /* For the whole line, */ do { /* Token concat. loop */ for (counter = 0; (type[(c = get())] == SPA);) { if (pflag) output(c); else { #if COMMENT_INVISIBLE if (c != COM_SEP) counter++; #else counter++; /* Skip over blanks */ #endif } } if (c == EOF_CHAR || c == '\n') goto end_line; /* Exit line loop */ else if (counter > 0) /* If we got any spaces */ output(' '); /* Output one space */ c = macroid(c); /* Grab the token */ } while (type[c] == LET && catenate()); if (c == EOF_CHAR || c == '\n') /* From macro exp error */ goto end_line; /* Exit line loop */ switch (type[c]) { case LET: output(*token); fputs(token+1, stdout); /* Quite ordinary token */ break; case DIG: /* Output a number */ case DOT: /* Dot may begin floats */ scannumber(c, output); break; case QUO: /* char or string const */ scanstring(c, output); /* Copy it to output */ break; default: /* Some other character */ output(c); /* Just output it */ break; } /* Switch ends */ } /* Line for loop */ end_line: if (c == '\n') { /* Compiling at EOL? */ output('\n'); /* Output newline, if */ if (infile->fp == NULL) /* Expanding a macro, */ wrongline = TRUE; /* Output # line later */ } } /* Continue until EOF */ } int join=0; output(c) int c; /* * Output one character to stdout -- output() is passed as an * argument to scanstring() */ { static quote_quote=0; if (c == DBL_QUOTE) { if (join) { putchar('\\'); join=0; } putchar('"'); quote_quote=!quote_quote; } else if (c == '"') { if (join) { putchar('\\'); join=0; } if (quote_quote) putchar('\\'); putchar('"'); } else if (c == '\\') { if (join) { putchar('\\'); putchar('\\'); join=0; } else join=1; } else if (c=='\n') { if (join==0) putchar('\n'); else wrongline=1; join=0; } else #if COMMENT_INVISIBLE if (c != TOK_SEP && c != COM_SEP) #else if (c != TOK_SEP) #endif { if (join) putchar('\\'); join=0; putchar(c); } } static char *sharpfilename = NULL; FILE_LOCAL sharp() /* * Output a line number line. */ { register char *name; if (keepcomments) /* Make sure # comes on */ putchar('\n'); /* a fresh, new line. */ if (pflag == 0) { printf("#%s %d", LINE_PREFIX, line); if (infile->fp != NULL) { name = (infile->progname != NULL) ? infile->progname : infile->filename; if (sharpfilename == NULL || sharpfilename != NULL && !streq(name, sharpfilename)) { if (sharpfilename != NULL) free(sharpfilename); sharpfilename = savestring(name); output(' '); output('"'); fputs(name,stdout); output('"'); } } output('\n'); } wrongline = FALSE; } z88dk-1.8.ds1/src/cpp/cpp2.c0000644000175000017500000005163207267604434015110 0ustar tygrystygrys/* * C P P 2 . C * * Process #control lines * * Edit history * 13-Nov-84 MM Split from cpp1.c */ #include #include #include #include #include "cppdef.h" #include "cpp.h" #if HOST == SYS_VMS /* * Include the rms stuff. (We can't just include rms.h as it uses the * VaxC-specific library include syntax that Decus CPP doesn't support. * By including things by hand, we can CPP ourself.) */ #include #include #include #include #endif /* * Generate (by hand-inspection) a set of unique values for each control * operator. Note that this is not guaranteed to work for non-Ascii * machines. CPP won't compile if there are hash conflicts. */ #define L_assert ('a' + ('s' << 1)) #define L_define ('d' + ('f' << 1)) #define L_elif ('e' + ('i' << 1)) #define L_else ('e' + ('s' << 1)) #define L_endif ('e' + ('d' << 1)) #define L_if ('i' + (EOS << 1)) #define L_ifdef ('i' + ('d' << 1)) #define L_ifndef ('i' + ('n' << 1)) #define L_include ('i' + ('c' << 1)) #define L_line ('l' + ('n' << 1)) #define L_nogood (EOS + (EOS << 1)) /* To catch #i */ #define L_pragma ('p' + ('a' << 1)) #define L_undef ('u' + ('d' << 1)) #define L_error ('e' + ('r' << 1)) #if DEBUG #define L_debug ('d' + ('b' << 1)) /* #debug */ #define L_nodebug ('n' + ('d' << 1)) /* #nodebug */ #endif int control(counter) int counter; /* Pending newline counter */ /* * Process #control lines. Simple commands are processed inline, * while complex commands have their own subroutines. * * The counter is used to force out a newline before #line, and * #pragma commands. This prevents these commands from ending up at * the end of the previous line if cpp is invoked with the -C option. */ { register int c; register char *tp; register int hash; char *ep; c = skipws(); if (c == '\n' || c == EOF_CHAR) return (counter + 1); if (!isdigit(c)) scanid(c); /* Get #word to token[] */ else { unget(); /* Hack -- allow #123 as a */ strcpy(token, "line"); /* synonym for #line 123 */ } hash = (token[1] == EOS) ? L_nogood : (token[0] + (token[2] << 1)); switch (hash) { case L_assert: tp = "assert"; break; case L_define: tp = "define"; break; case L_elif: tp = "elif"; break; case L_else: tp = "else"; break; case L_endif: tp = "endif"; break; case L_if: tp = "if"; break; case L_ifdef: tp = "ifdef"; break; case L_ifndef: tp = "ifndef"; break; case L_include: tp = "include"; break; case L_line: tp = "line"; break; case L_pragma: tp = "pragma"; break; case L_undef: tp = "undef"; break; case L_error: tp = "error"; break; #if DEBUG case L_debug: tp = "debug"; break; case L_nodebug: tp = "nodebug"; break; #endif default: hash = L_nogood; case L_nogood: tp = ""; break; } if (!streq(tp, token)) hash = L_nogood; /* * hash is set to a unique value corresponding to the * control keyword (or L_nogood if we think it's nonsense). */ if (infile->fp == NULL) cwarn("Control line \"%s\" within macro expansion", token); if (!compiling) { /* Not compiling now */ switch (hash) { case L_if: /* These can't turn */ case L_ifdef: /* compilation on, but */ case L_ifndef: /* we must nest #if's */ if (++ifptr >= &ifstack[BLK_NEST]) goto if_nest_err; *ifptr = 0; /* !WAS_COMPILING */ case L_line: /* Many */ /* * Are pragma's always processed? */ case L_pragma: /* options */ case L_include: /* are uninteresting */ case L_define: /* if we */ case L_undef: /* aren't */ case L_assert: /* compiling. */ case L_error: /* */ dump_line: skipnl(); /* Ignore rest of line */ return (counter + 1); } } /* * Make sure that #line and #pragma are output on a fresh line. */ if (counter > 0 && (hash == L_line || hash == L_pragma)) { putchar('\n'); counter--; } switch (hash) { case L_line: /* * Parse the line to update the line number and "progname" * field and line number for the next input line. * Set wrongline to force it out later. */ c = skipws(); workp = work; /* Save name in work */ while (c != '\n' && c != EOF_CHAR) { save(c); c = get(); } unget(); save(EOS); /* * Split #line argument into and * We subtract 1 as we want the number of the next line. */ line = atoi(work) - 1; /* Reset line number */ for (tp = work; isdigit(*tp) || type[*tp] == SPA; tp++) ; /* Skip over digits */ if (*tp != EOS) { /* Got a filename, so: */ if (*tp == '"' && (ep = strrchr(tp + 1, '"')) != NULL) { tp++; /* Skip over left quote */ *ep = EOS; /* And ignore right one */ } if (infile->progname != NULL) /* Give up the old name */ free(infile->progname); /* if it's allocated. */ infile->progname = savestring(tp); } wrongline = TRUE; /* Force output later */ break; case L_include: doinclude(); break; case L_define: dodefine(); break; case L_undef: doundef(); break; case L_else: if (ifptr == &ifstack[0]) goto nest_err; else if ((*ifptr & ELSE_SEEN) != 0) goto else_seen_err; *ifptr |= ELSE_SEEN; if ((*ifptr & WAS_COMPILING) != 0) { if (compiling || (*ifptr & TRUE_SEEN) != 0) compiling = FALSE; else { compiling = TRUE; } } break; case L_elif: if (ifptr == &ifstack[0]) goto nest_err; else if ((*ifptr & ELSE_SEEN) != 0) { else_seen_err: cerror("#%s may not follow #else", token); goto dump_line; } if ((*ifptr & (WAS_COMPILING | TRUE_SEEN)) != WAS_COMPILING) { compiling = FALSE; /* Done compiling stuff */ goto dump_line; /* Skip this clause */ } doif(L_if); break; case L_if: case L_ifdef: case L_ifndef: if (++ifptr >= &ifstack[BLK_NEST]) if_nest_err: cfatal("Too many nested #%s statements", token); *ifptr = WAS_COMPILING; doif(hash); break; case L_endif: if (ifptr == &ifstack[0]) { nest_err: cerror("#%s must be in an #if", token); goto dump_line; } if (!compiling && (*ifptr & WAS_COMPILING) != 0) wrongline = TRUE; compiling = ((*ifptr & WAS_COMPILING) != 0); --ifptr; break; case L_assert: if (eval() == 0) cerror("Preprocessor assertion failure", NULLST); break; case L_pragma: /* * #pragma is provided to pass "options" to later * passes of the compiler. cpp doesn't have any yet. */ printf("#pragma "); while ((c = get()) != '\n' && c != EOF_CHAR) cput(c); unget(); cput('\n'); break; case L_error: { char ln[256],*s=ln; int c=0; while (s<(ln+sizeof(ln)-1) && (c=get())!='\n' && c!= EOF_CHAR) { *s=c; ++s; } if (c=='\n') unget(); *s='\0'; cerror("%s",ln); break; } #if DEBUG case L_debug: if (debug == 0) dumpdef("debug set on"); debug++; break; case L_nodebug: debug--; break; #endif default: /* * Undefined #control keyword. * Note: the correct behavior may be to warn and * pass the line to a subsequent compiler pass. * This would allow #asm or similar extensions. */ /* cerror("Illegal # command \"%s\"", token); */ printf("#%s\n",token); break; } if (hash != L_include) { #if OLD_PREPROCESSOR /* * Ignore the rest of the #control line so you can write * #if foo * #endif foo */ goto dump_line; /* Take common exit */ #else if (skipws() != '\n' ) { cwarn("Unexpected text in #control line ignored", NULLST); skipnl(); } #endif } return (counter + 1); } FILE_LOCAL doif(hash) int hash; /* * Process an #if, #ifdef, or #ifndef. The latter two are straightforward, * while #if needs a subroutine of its own to evaluate the expression. * * doif() is called only if compiling is TRUE. If false, compilation * is always supressed, so we don't need to evaluate anything. This * supresses unnecessary warnings. */ { register int c; register int found; if ((c = skipws()) == '\n' || c == EOF_CHAR) { unget(); goto badif; } if (hash == L_if) { unget(); found = (eval() != 0); /* Evaluate expr, != 0 is TRUE */ hash = L_ifdef; /* #if is now like #ifdef */ } else { if (type[c] != LET) /* Next non-blank isn't letter */ goto badif; /* ... is an error */ found = (lookid(c) != NULL); /* Look for it in symbol table */ } if (found == (hash == L_ifdef)) { compiling = TRUE; *ifptr |= TRUE_SEEN; } else { compiling = FALSE; } return; badif: cerror("#if, #ifdef, or #ifndef without an argument", NULLST); #if !OLD_PREPROCESSOR skipnl(); /* Prevent an extra */ unget(); /* Error message */ #endif return; } FILE_LOCAL doinclude() /* * Process the #include control line. * There are three variations: * #include "file" search somewhere relative to the * current source file, if not found, * treat as #include . * #include Search in an implementation-dependent * list of places. * #include token Expand the token, it must be one of * "file" or , process as such. * * Note: the November 12 draft forbids '>' in the #include format. * This restriction is unnecessary and not implemented. */ { register int c; register int delim; #if HOST == SYS_VMS char def_filename[NAM$C_MAXRSS + 1]; #endif delim = macroid(skipws()); if (delim != '<' && delim != '"') goto incerr; if (delim == '<') delim = '>'; workp = work; instring = TRUE; /* Accept all characters */ #ifdef CONTROL_COMMENTS_NOT_ALLOWED while ((c = get()) != '\n' && c != EOF_CHAR) save(c); /* Put it away. */ unget(); /* Force nl after includee */ /* * The draft is unclear if the following should be done. */ while (--workp >= work && *workp == ' ') ; /* Trim blanks from filename */ if (*workp != delim) goto incerr; #else while ((c = get()) != delim && c != EOF_CHAR) save(c); #endif *workp = EOS; /* Terminate filename */ instring = FALSE; #if HOST == SYS_VMS /* * Assume the default .h filetype. */ if (!vmsparse(work, ".H", def_filename)) { perror(work); /* Oops. */ goto incerr; } else if (openinclude(def_filename, (delim == '"'))) return; #else if (openinclude(work, (delim == '"'))) return; #endif /* * No sense continuing if #include file isn't there. */ cfatal("Cannot open include file \"%s\"", work); incerr: cerror("#include syntax error", NULLST); return; } FILE_LOCAL int openinclude(filename, searchlocal) char *filename; /* Input file name */ int searchlocal; /* TRUE if #include "file" */ /* * Actually open an include file. This routine is only called from * doinclude() above, but was written as a separate subroutine for * programmer convenience. It searches the list of directories * and actually opens the file, linking it into the list of * active files. Returns TRUE if the file was opened, FALSE * if openinclude() fails. No error message is printed. */ { register char **incptr; #if HOST == SYS_VMS #if NWORK < (NAM$C_MAXRSS + 1) #error "<< error, NWORK isn't greater than NAM$C_MAXRSS >>" #endif #endif char tmpname[NWORK]; /* Filename work area */ if (searchlocal) { /* * Look in local directory first */ #if HOST == SYS_UNIX /* * Try to open filename relative to the directory of the current * source file (as opposed to the current directory). (ARF, SCK). */ if (filename[0] != '/' && hasdirectory(infile->filename, tmpname)) strcat(tmpname, filename); else { strcpy(tmpname, filename); } #else if (!hasdirectory(filename, tmpname) && hasdirectory(infile->filename, tmpname)) strcat(tmpname, filename); else { strcpy(tmpname, filename); } #endif if (openfile(tmpname)) return (TRUE); } /* * Look in any directories specified by -I command line * arguments, then in the builtin search list. */ for (incptr = incdir; incptr < incend; incptr++) { if (strlen(*incptr) + strlen(filename) >= (NWORK - 1)) cfatal("Filename work buffer overflow", NULLST); else { #if HOST == SYS_UNIX if (filename[0] == '/') strcpy(tmpname, filename); else { sprintf(tmpname, "%s/%s", *incptr, filename); } #else if (!hasdirectory(filename, tmpname)) sprintf(tmpname, "%s%s", *incptr, filename); #endif if (openfile(tmpname)) return (TRUE); } } return (FALSE); } FILE_LOCAL int hasdirectory(source, result) char *source; /* Directory to examine */ char *result; /* Put directory stuff here */ /* * If a device or directory is found in the source filename string, the * node/device/directory part of the string is copied to result and * hasdirectory returns TRUE. Else, nothing is copied and it returns FALSE. */ { #if HOST == SYS_UNIX register char *tp; if ((tp = strrchr(source, '/')) == NULL) return (FALSE); else { strncpy(result, source, tp - source + 1); result[tp - source + 1] = EOS; return (TRUE); } #else #if HOST == SYS_VMS if (vmsparse(source, NULLST, result) && result[0] != EOS) return (TRUE); else { return (FALSE); } #else /* * Random DEC operating system (RSX, RT11, RSTS/E) */ register char *tp; if ((tp = strrchr(source, ']')) == NULL && (tp = strrchr(source, ':')) == NULL) return (FALSE); else { strncpy(result, source, tp - source + 1); result[tp - source + 1] = EOS; return (TRUE); } #endif #endif } #if HOST == SYS_VMS /* * EXP_DEV is set if a device was specified, EXP_DIR if a directory * is specified. (Both set indicate a file-logical, but EXP_DEV * would be set by itself if you are reading, say, SYS$INPUT:) */ #define DEVDIR (NAM$M_EXP_DEV | NAM$M_EXP_DIR) FILE_LOCAL int vmsparse(source, defstring, result) char *source; char *defstring; /* non-NULL -> default string. */ char *result; /* Size is at least NAM$C_MAXRSS + 1 */ /* * Parse the source string, applying the default (properly, using * the system parse routine), storing it in result. * TRUE if it parsed, FALSE on error. * * If defstring is NULL, there are no defaults and result gets * (just) the node::[directory] part of the string (possibly "") */ { struct FAB fab = cc$rms_fab; /* File access block */ struct NAM nam = cc$rms_nam; /* File name block */ char fullname[NAM$C_MAXRSS + 1]; register char *rp; /* Result pointer */ fab.fab$l_nam = &nam; /* fab -> nam */ fab.fab$l_fna = source; /* Source filename */ fab.fab$b_fns = strlen(source); /* Size of source */ fab.fab$l_dna = defstring; /* Default string */ if (defstring != NULLST) fab.fab$b_dns = strlen(defstring); /* Size of default */ nam.nam$l_esa = fullname; /* Expanded filename */ nam.nam$b_ess = NAM$C_MAXRSS; /* Expanded name size */ if (sys$parse(&fab) == RMS$_NORMAL) { /* Parse away */ fullname[nam.nam$b_esl] = EOS; /* Terminate string */ result[0] = EOS; /* Just in case */ rp = &result[0]; /* * Remove stuff added implicitly, accepting node names and * dev:[directory] strings (but not process-permanent files). */ if ((nam.nam$l_fnb & NAM$M_PPF) == 0) { if ((nam.nam$l_fnb & NAM$M_NODE) != 0) { strncpy(result, nam.nam$l_node, nam.nam$b_node); rp += nam.nam$b_node; *rp = EOS; } if ((nam.nam$l_fnb & DEVDIR) == DEVDIR) { strncpy(rp, nam.nam$l_dev, nam.nam$b_dev + nam.nam$b_dir); rp += nam.nam$b_dev + nam.nam$b_dir; *rp = EOS; } } if (defstring != NULLST) { strncpy(rp, nam.nam$l_name, nam.nam$b_name + nam.nam$b_type); rp += nam.nam$b_name + nam.nam$b_type; *rp = EOS; if ((nam.nam$l_fnb & NAM$M_EXP_VER) != 0) { strncpy(rp, nam.nam$l_ver, nam.nam$b_ver); rp[nam.nam$b_ver] = EOS; } } return (TRUE); } return (FALSE); } #endif z88dk-1.8.ds1/src/cpp/cpp3.c0000644000175000017500000002765610663001603015101 0ustar tygrystygrys/* * C P P 3 . C * * File open and command line options * * Edit history * 13-Nov-84 MM Split from cpp1.c */ #include #include #include #include #include #include "cppdef.h" #include "cpp.h" #if DEBUG && (HOST == SYS_VMS || HOST == SYS_UNIX) #include extern void abort(); /* For debugging */ #endif int openfile(filename) char *filename; /* * Open a file, add it to the linked list of open files. * This is called only from openfile() above. */ { register FILE *fp; if ((fp = fopen(filename, "r")) == NULL) { #if DEBUG perror(filename); #endif return (FALSE); } #if DEBUG if (debug) fprintf(stderr, "Reading from \"%s\"\n", filename); #endif addfile(fp, filename); return (TRUE); } addfile(fp, filename) FILE *fp; /* Open file pointer */ char *filename; /* Name of the file */ /* * Initialize tables for this open file. This is called from openfile() * above (for #include files), and from the entry to cpp to open the main * input file. It calls a common routine, getfile() to build the FILEINFO * structure which is used to read characters. (getfile() is also called * to setup a macro replacement.) */ { register FILEINFO *file; extern FILEINFO *getfile(); file = getfile(NBUFF, filename); file->fp = fp; /* Better remember FILE * */ file->buffer[0] = EOS; /* Initialize for first read */ line = 1; /* Working on line 1 now */ wrongline = TRUE; /* Force out initial #line */ } setincdirs() /* * Append system-specific directories to the include directory list. * Called only when cpp is started. */ { #ifdef CPP_INCLUDE *incend++ = CPP_INCLUDE; #define IS_INCLUDE 1 #else #define IS_INCLUDE 0 #endif /* My own Amiga hack... Look for includes in progdir:include */ #ifdef AMIGA *incend++ = "zcc:include"; #define MAXINCLUDE (NINCLUDE - 1 - IS_INCLUDE) #endif #if 0 #if HOST == SYS_UNIX *incend++ = "/usr/include"; #define MAXINCLUDE (NINCLUDE - 1 - IS_INCLUDE) #endif #endif #if HOST == SYS_VMS extern char *getenv(); if (getenv("C$LIBRARY") != NULL) *incend++ = "C$LIBRARY:"; *incend++ = "SYS$LIBRARY:"; #define MAXINCLUDE (NINCLUDE - 2 - IS_INCLUDE) #endif #if HOST == SYS_RSX extern int $$rsts; /* TRUE on RSTS/E */ extern int $$pos; /* TRUE on PRO-350 P/OS */ extern int $$vms; /* TRUE on VMS compat. */ if ($$pos) { /* P/OS? */ *incend++ = "SY:[ZZDECUSC]"; /* C #includes */ *incend++ = "LB:[1,5]"; /* RSX library */ } else if ($$rsts) { /* RSTS/E? */ *incend++ = "SY:@"; /* User-defined account */ *incend++ = "C:"; /* Decus-C library */ *incend++ = "LB:[1,1]"; /* RSX library */ } else if ($$vms) { /* VMS compatibility? */ *incend++ = "C:"; } else { /* Plain old RSX/IAS */ *incend++ = "LB:[1,1]"; } #define MAXINCLUDE (NINCLUDE - 3 - IS_INCLUDE) #endif #if HOST == SYS_RT11 extern int $$rsts; /* RSTS/E emulation? */ if ($$rsts) *incend++ = "SY:@"; /* User-defined account */ *incend++ = "C:"; /* Decus-C library disk */ *incend++ = "SY:"; /* System (boot) disk */ #define MAXINCLUDE (NINCLUDE - 3 - IS_INCLUDE) #endif #ifndef MAXINCLUDE #define MAXINCLUDE (NINCLUDE - 0 - IS_INCLUDE) #endif } int dooptions(argc, argv) int argc; char *argv[]; /* * dooptions is called to process command line arguments (-Detc). * It is called only at cpp startup. */ { register char *ap; register DEFBUF *dp; register int c; int i, j; char *arg; SIZES *sizp; /* For -S */ int size; /* For -S */ int isdatum; /* FALSE for -S* */ int endtest; /* For -S */ for (i = j = 1; i < argc; i++) { arg = ap = argv[i]; if (*ap++ != '-' || *ap == EOS) argv[j++] = argv[i]; else { c = *ap++; /* Option byte */ if (islower(c)) /* Normalize case */ c = toupper(c); switch (c) { /* Command character */ case 'C': /* Keep comments */ cflag = TRUE; keepcomments = TRUE; break; case 'D': /* Define symbol */ #if HOST != SYS_UNIX zap_uc(ap); /* Force define to U.C. */ #endif /* * If the option is just "-Dfoo", make it -Dfoo=1 */ while (*ap != EOS && *ap != '=') ap++; if (*ap == EOS) ap = "1"; else *ap++ = EOS; /* * Now, save the word and its definition. */ dp = defendel(argv[i] + 2, FALSE); dp->repl = savestring(ap); dp->nargs = DEF_NOARGS; break; case 'E': /* Ignore non-fatal */ eflag = TRUE; /* errors. */ break; case 'P': /* No #line */ pflag = TRUE; break; case 'I': /* Include directory */ if (incend >= &incdir[MAXINCLUDE]) cfatal("Too many include directories", NULLST); *incend++ = ap; break; case 'N': /* No predefineds */ nflag++; /* Repeat to undefine */ break; /* __LINE__, etc. */ case 'S': sizp = size_table; if (isdatum = (*ap != '*')) /* If it's just -S, */ endtest = T_FPTR; /* Stop here */ else { /* But if it's -S* */ ap++; /* Step over '*' */ endtest = 0; /* Stop at end marker */ } while (sizp->bits != endtest && *ap != EOS) { if (!isdigit(*ap)) { /* Skip to next digit */ ap++; continue; } size = 0; /* Compile the value */ while (isdigit(*ap)) { size *= 10; size += (*ap++ - '0'); } if (isdatum) sizp->size = size; /* Datum size */ else sizp->psize = size; /* Pointer size */ sizp++; } if (sizp->bits != endtest) cwarn("-S, too few values specified in %s", argv[i]); else if (*ap != EOS) cwarn("-S, too many values, \"%s\" unused", ap); break; case 'U': /* Undefine symbol */ #if HOST != SYS_UNIX zap_uc(ap); #endif if (defendel(ap, TRUE) == NULL) cwarn("\"%s\" wasn't defined", ap); break; #if DEBUG case 'X': /* Debug */ debug = (isdigit(*ap)) ? atoi(ap) : 1; #if (HOST == SYS_VMS || HOST == SYS_UNIX) signal(SIGINT, abort); /* Trap "interrupt" */ #endif fprintf(stderr, "Debug set to %d\n", debug); break; #endif default: /* What is this one? */ cwarn("Unknown option \"%s\"", arg); fprintf(stderr, "The following options are valid:\n" " -C\t\t\tWrite source file comments to output\n" " -Dsymbol=value\tDefine a symbol with the given (optional) value\n" " -Idirectory\t\tAdd a directory to the #include search list\n" " -N\t\t\tDon't predefine target-specific names\n" " -Stext\t\tSpecify sizes for #if sizeof\n" " -Usymbol\t\tUndefine symbol\n" " -P\t\t\tDon't produce # lines\n"); #if DEBUG fprintf(stderr, " -Xvalue\t\tSet internal debug flag\n"); #endif break; } /* Switch on all options */ } /* If it's a -option */ } /* For all arguments */ if (j > 3) { cerror( "Too many file arguments. Usage: cpp [input [output]]", NULLST); } return (j); /* Return new argc */ } #if HOST != SYS_UNIX FILE_LOCAL zap_uc(ap) register char *ap; /* * Dec operating systems mangle upper-lower case in command lines. * This routine forces the -D and -U arguments to uppercase. * It is called only on cpp startup by dooptions(). */ { while (*ap != EOS) { /* * Don't use islower() here so it works with Multinational */ if (*ap >= 'a' && *ap <= 'z') *ap = toupper(*ap); ap++; } } #endif initdefines() /* * Initialize the built-in #define's. There are two flavors: * #define decus 1 (static definitions) * #define __FILE__ ?? (dynamic, evaluated by magic) * Called only on cpp startup. * * Note: the built-in static definitions are supressed by the -N option. * __LINE__, __FILE__, __DATE__ and __TIME__ are always present. */ { register char **pp; register char *tp; register DEFBUF *dp; int i; time_t tvec; struct tm *tmp; /* * Predefine the built-in symbols. Allow the * implementor to pre-define a symbol as "" to * eliminate it. */ if (nflag == 0) { for (pp = preset; *pp != NULL; pp++) { if (*pp[0] != EOS) { dp = defendel(*pp, FALSE); dp->repl = savestring("1"); dp->nargs = DEF_NOARGS; } } } /* * The magic pre-defines (__FILE__ and __LINE__ are * initialized with negative argument counts. expand() * notices this and calls the appropriate routine. * DEF_NOARGS is one greater than the first "magic" definition. */ if (nflag < 2) { for (pp = magic, i = DEF_NOARGS; *pp != NULL; pp++) { dp = defendel(*pp, FALSE); dp->nargs = --i; } #if OK_DATE /* * Define __DATE__ as today's date. */ dp = defendel("__DATE__", FALSE); dp->repl = tp = getmem(14); dp->nargs = DEF_NOARGS; time(&tvec); tmp=localtime(&tvec); strftime(tp, 14,"\"%b %d %Y\"",tmp); /* * Define __TIME__ as current time. */ dp = defendel("__TIME__", FALSE); dp->repl = tp = getmem(10); dp->nargs = DEF_NOARGS; tp[0] = '"'; tp[1] = '0'+tmp->tm_hour/10; tp[2] = '0'+tmp->tm_hour%10; tp[3] = ':'; tp[4] = '0'+tmp->tm_min/10; tp[5] = '0'+tmp->tm_min%10; tp[6] = ':'; tp[7] = '0'+tmp->tm_sec/10; tp[8] = '0'+tmp->tm_sec%10; tp[9] = '"'; #endif } } #if HOST == SYS_VMS /* * getredirection() is intended to aid in porting C programs * to VMS (Vax-11 C) which does not support '>' and '<' * I/O redirection. With suitable modification, it may * useful for other portability problems as well. */ int getredirection(argc, argv) int argc; char **argv; /* * Process vms redirection arg's. Exit if any error is seen. * If getredirection() processes an argument, it is erased * from the vector. getredirection() returns a new argc value. * * Warning: do not try to simplify the code for vms. The code * presupposes that getredirection() is called before any data is * read from stdin or written to stdout. * * Normal usage is as follows: * * main(argc, argv) * int argc; * char *argv[]; * { * argc = getredirection(argc, argv); * } */ { register char *ap; /* Argument pointer */ int i; /* argv[] index */ int j; /* Output index */ int file; /* File_descriptor */ extern int errno; /* Last vms i/o error */ for (j = i = 1; i < argc; i++) { /* Do all arguments */ switch (*(ap = argv[i])) { case '<': /* ': /* >file or >>file */ if (*++ap == '>') { /* >>file */ /* * If the file exists, and is writable by us, * call freopen to append to the file (using the * file's current attributes). Otherwise, create * a new file with "vanilla" attributes as if the * argument was given as ">filename". * access(name, 2) returns zero if we can write on * the specified file. */ if (access(++ap, 2) == 0) { if (freopen(ap, "a", stdout) != NULL) break; /* Exit case statement */ perror(ap); /* Error, can't append */ exit(errno); /* After access test */ } /* If file accessable */ } /* * On vms, we want to create the file using "standard" * record attributes. creat(...) creates the file * using the caller's default protection mask and * "variable length, implied carriage return" * attributes. dup2() associates the file with stdout. */ if ((file = creat(ap, 0, "rat=cr", "rfm=var")) == -1 || dup2(file, fileno(stdout)) == -1) { perror(ap); /* Can't create file */ exit(errno); /* is a fatal error */ } /* If '>' creation */ break; /* Exit case test */ default: argv[j++] = ap; /* Not a redirector */ break; /* Exit case test */ } } /* For all arguments */ argv[j] = NULL; /* Terminate argv[] */ return (j); /* Return new argc */ } #endif z88dk-1.8.ds1/src/cpp/cpp4.c0000644000175000017500000004154707130401710015073 0ustar tygrystygrys/* * C P P 4 . C * M a c r o D e f i n i t i o n s * * Edit History * 31-Aug-84 MM USENET net.sources release * 04-Oct-84 MM __LINE__ and __FILE__ must call ungetstring() * so they work correctly with token concatenation. * Added string formal recognition. * 25-Oct-84 MM "Short-circuit" evaluate #if's so that we * don't print unnecessary error messages for * #if !defined(FOO) && FOO != 0 && 10 / FOO ... * 31-Oct-84 ado/MM Added token concatenation * 6-Nov-84 MM Split off eval stuff */ #include #include #include #include #include "cppdef.h" #include "cpp.h" /* * parm[], parmp, and parlist[] are used to store #define() argument * lists. nargs contains the actual number of parameters stored. */ static char parm[NPARMWORK + 1]; /* define param work buffer */ static char *parmp; /* Free space in parm */ static char *parlist[LASTPARM]; /* -> start of each parameter */ static int nargs; /* Parameters for this macro */ dodefine() /* * Called from control when a #define is scanned. This module * parses formal parameters and the replacement string. When * the formal parameter name is encountered in the replacement * string, it is replaced by a character in the range 128 to * 128+NPARAM (this allows up to 32 parameters within the * Dec Multinational range). If cpp is ported to an EBCDIC * machine, you will have to make other arrangements. * * There is some special case code to distinguish * #define foo bar * from #define foo() bar * * Also, we make sure that * #define foo foo * expands to "foo" but doesn't put cpp into an infinite loop. * * A warning message is printed if you redefine a symbol to a * different text. I.e, * #define foo 123 * #define foo 123 * is ok, but * #define foo 123 * #define foo +123 * is not. * * The following subroutines are called from define(): * checkparm called when a token is scanned. It checks through the * array of formal parameters. If a match is found, the * token is replaced by a control byte which will be used * to locate the parameter when the macro is expanded. * textput puts a string in the macro work area (parm[]), updating * parmp to point to the first free byte in parm[]. * textput() tests for work buffer overflow. * charput puts a single character in the macro work area (parm[]) * in a manner analogous to textput(). */ { register int c; register DEFBUF *dp; /* -> new definition */ int isredefine; /* TRUE if redefined */ char *old; /* Remember redefined */ extern int save(); /* Save char in work[] */ if (type[(c = skipws())] != LET) goto bad_define; isredefine = FALSE; /* Set if redefining */ if ((dp = lookid(c)) == NULL) /* If not known now */ dp = defendel(token, FALSE); /* Save the name */ else { /* It's known: */ isredefine = TRUE; /* Remember this fact */ old = dp->repl; /* Remember replacement */ dp->repl = NULL; /* No replacement now */ } parlist[0] = parmp = parm; /* Setup parm buffer */ if ((c = get()) == '(') { /* With arguments? */ nargs = 0; /* Init formals counter */ do { /* Collect formal parms */ if (nargs >= LASTPARM) cfatal("Too many arguments for macro", NULLST); else if ((c = skipws()) == ')') break; /* Got them all */ else if (type[c] != LET) /* Bad formal syntax */ goto bad_define; scanid(c); /* Get the formal param */ parlist[nargs++] = parmp; /* Save its start */ textput(token); /* Save text in parm[] */ } while ((c = skipws()) == ','); /* Get another argument */ if (c != ')') /* Must end at ) */ goto bad_define; c = ' '; /* Will skip to body */ } else { /* * DEF_NOARGS is needed to distinguish between * "#define foo" and "#define foo()". */ nargs = DEF_NOARGS; /* No () parameters */ } if (type[c] == SPA) /* At whitespace? */ c = skipws(); /* Not any more. */ workp = work; /* Replacement put here */ inmacro = TRUE; /* Keep \ now */ while (c != EOF_CHAR && c != '\n') { /* Compile macro body */ #if OK_CONCAT #if COMMENT_INVISIBLE if (c == COM_SEP) { /* Token concatenation? */ save(TOK_SEP); /* Stuff a delimiter */ c = get(); #else if (c == '#') { /* Token concatenation? */ int q; if (get()=='#') q=0; else { q=1; unget(); } while (workp > work && type[workp[-1]] == SPA) --workp; /* Erase leading spaces */ if (q) save(TOK_QUOTE); else save(TOK_SEP); /* Stuff a delimiter */ c = skipws(); /* Eat whitespace */ #endif if (type[c] == LET) /* Another token here? */ ; /* Stuff it normally */ else if (type[c] == DIG) { /* Digit string after? */ while (type[c] == DIG) { /* Stuff the digits */ save(c); c = get(); } if (!q) save(TOK_SEP); /* Delimit 2nd token */ } else { #if ! COMMENT_INVISIBLE ciwarn("Strange character after # or ## (%d.)", c); #endif continue; } } #endif switch (type[c]) { case LET: checkparm(c, dp); /* Might be a formal */ break; case DIG: /* Number in mac. body */ case DOT: /* Maybe a float number */ scannumber(c, save); /* Scan it off */ break; case QUO: /* String in mac. body */ #if STRING_FORMAL stparmscan(c, dp); /* Do string magic */ #else stparmscan(c); #endif break; case BSH: /* Backslash */ save('\\'); if ((c = get()) == '\n') wrongline = TRUE; save(c); break; case SPA: /* Absorb whitespace */ /* * Note: the "end of comment" marker is passed on * to allow comments to separate tokens. */ if (workp[-1] == ' ') /* Absorb multiple */ break; /* spaces */ else if (c == '\t') c = ' '; /* Normalize tabs */ /* Fall through to store character */ default: /* Other character */ save(c); break; } c = get(); } inmacro = FALSE; /* Stop newline hack */ unget(); /* For control check */ if (workp > work && workp[-1] == ' ') /* Drop trailing blank */ workp--; *workp = EOS; /* Terminate work */ dp->repl = savestring(work); /* Save the string */ dp->nargs = nargs; /* Save arg count */ #if DEBUG if (debug) dumpadef("macro definition", dp); #endif if (isredefine) { /* Error if redefined */ if ((old != NULL && dp->repl != NULL && !streq(old, dp->repl)) || (old == NULL && dp->repl != NULL) || (old != NULL && dp->repl == NULL)) { #ifdef STRICT_UNDEF cerror("Redefining defined variable \"%s\"", dp->name); #else cwarn("Redefining defined variable \"%s\"", dp->name); #endif } if (old != NULL) /* We don't need the */ free(old); /* old definition now. */ } return; bad_define: cerror("#define syntax error", NULLST); inmacro = FALSE; /* Stop hack */ } checkparm(c, dp) register int c; DEFBUF *dp; /* * Replace this param if it's defined. Note that the macro name is a * possible replacement token. We stuff DEF_MAGIC in front of the token * which is treated as a LETTER by the token scanner and eaten by * the output routine. This prevents the macro expander from * looping if someone writes "#define foo foo". */ { register int i; register char *cp; scanid(c); /* Get parm to token[] */ for (i = 0; i < nargs; i++) { /* For each argument */ if (streq(parlist[i], token)) { /* If it's known */ save(i + MAC_PARM); /* Save a magic cookie */ return; /* And exit the search */ } } if (streq(dp->name, token)) /* Macro name in body? */ save(DEF_MAGIC); /* Save magic marker */ for (cp = token; *cp != EOS;) /* And save */ save(*cp++); /* The token itself */ } #if STRING_FORMAL stparmscan(delim, dp) int delim; register DEFBUF *dp; /* * Scan the string (starting with the given delimiter). * The token is replaced if it is the only text in this string or * character constant. The algorithm follows checkparm() above. * Note that scanstring() has approved of the string. */ { register int c; /* * Warning -- this code hasn't been tested for a while. * It exists only to preserve compatibility with earlier * implementations of cpp. It is not part of the Draft * ANSI Standard C language. */ save(delim); instring = TRUE; while ((c = get()) != delim && c != '\n' && c != EOF_CHAR) { if (type[c] == LET) /* Maybe formal parm */ checkparm(c, dp); else { save(c); if (c == '\\') save(get()); } } instring = FALSE; if (c != delim) cerror("Unterminated string in macro body", NULLST); save(c); } #else stparmscan(delim) int delim; /* * Normal string parameter scan. */ { register char *wp; register int i; extern int save(); wp = workp; /* Here's where it starts */ if (!scanstring(delim, save)) return; /* Exit on scanstring error */ workp[-1] = EOS; /* Erase trailing quote */ wp++; /* -> first string content byte */ for (i = 0; i < nargs; i++) { if (streq(parlist[i], wp)) { *wp++ = MAC_PARM + PAR_MAC; /* Stuff a magic marker */ *wp++ = (i + MAC_PARM); /* Make a formal marker */ *wp = wp[-3]; /* Add on closing quote */ workp = wp + 1; /* Reset string end */ return; } } workp[-1] = wp[-1]; /* Nope, reset end quote. */ } #endif doundef() /* * Remove the symbol from the defined list. * Called from the #control processor. */ { register int c; if (type[(c = skipws())] != LET) cerror("Illegal #undef argument", NULLST); else { scanid(c); /* Get name to token[] */ if (defendel(token, TRUE) == NULL) { #ifdef STRICT_UNDEF cwarn("Symbol \"%s\" not defined in #undef", token); #endif } } } textput(text) char *text; /* * Put the string in the parm[] buffer. */ { register int size; size = strlen(text) + 1; if ((parmp + size) >= &parm[NPARMWORK]) cfatal("Macro work area overflow", NULLST); else { strcpy(parmp, text); parmp += size; } } charput(c) register int c; /* * Put the byte in the parm[] buffer. */ { if (parmp >= &parm[NPARMWORK]) cfatal("Macro work area overflow", NULLST); else { *parmp++ = c; } } /* * M a c r o E x p a n s i o n */ static DEFBUF *macro; /* Catches start of infinite macro */ expand(tokenp) register DEFBUF *tokenp; /* * Expand a macro. Called from the cpp mainline routine (via subroutine * macroid()) when a token is found in the symbol table. It calls * expcollect() to parse actual parameters, checking for the correct number. * It then creates a "file" containing a single line containing the * macro with actual parameters inserted appropriately. This is * "pushed back" onto the input stream. (When the get() routine runs * off the end of the macro line, it will dismiss the macro itself.) */ { register int c; register FILEINFO *file; extern FILEINFO *getfile(); #if DEBUG if (debug) dumpadef("expand entry", tokenp); #endif /* * If no macro is pending, save the name of this macro * for an eventual error message. */ if (recursion++ == 0) macro = tokenp; else if (recursion == RECURSION_LIMIT) { cerror("Recursive macro definition of \"%s\"", tokenp->name); fprintf(stderr, "(Defined by \"%s\")\n", macro->name); if (rec_recover) { do { c = get(); } while (infile != NULL && infile->fp == NULL); unget(); recursion = 0; return; } } /* * Here's a macro to expand. */ nargs = 0; /* Formals counter */ parmp = parm; /* Setup parm buffer */ switch (tokenp->nargs) { case (-2): /* __LINE__ */ for (file = infile; file != NULL; file = file->parent) { if (file->fp != NULL) { sprintf(work, "%d", file->line); ungetstring(work); break; } } break; case (-3): /* __FILE__ */ for (file = infile; file != NULL; file = file->parent) { if (file->fp != NULL) { sprintf(work, "\"%s\"", (file->progname != NULL) ? file->progname : file->filename); ungetstring(work); break; } } break; default: /* * Nothing funny about this macro. */ if (tokenp->nargs < 0) cfatal("Bug: Illegal __ macro \"%s\"", tokenp->name); while ((c = skipws()) == '\n') /* Look for (, skipping */ wrongline = TRUE; /* spaces and newlines */ if (c != '(') { /* * If the programmer writes * #define foo() ... * ... * foo [no ()] * just write foo to the output stream. */ unget(); cwarn("Macro \"%s\" needs arguments", tokenp->name); fputs(tokenp->name, stdout); return; } else if (expcollect()) { /* Collect arguments */ if (tokenp->nargs != nargs) { /* Should be an error? */ cwarn("Wrong number of macro arguments for \"%s\"", tokenp->name); } #if DEBUG if (debug) dumpparm("expand"); #endif } /* Collect arguments */ case DEF_NOARGS: /* No parameters just stuffs */ expstuff(tokenp); /* Do actual parameters */ } /* nargs switch */ } FILE_LOCAL int expcollect() /* * Collect the actual parameters for this macro. TRUE if ok. */ { register int c; register int paren; /* For embedded ()'s */ extern int charput(); for (;;) { paren = 0; /* Collect next arg. */ while ((c = skipws()) == '\n') /* Skip over whitespace */ wrongline = TRUE; /* and newlines. */ if (c == ')') { /* At end of all args? */ /* * Note that there is a guard byte in parm[] * so we don't have to check for overflow here. */ *parmp = EOS; /* Make sure terminated */ break; /* Exit collection loop */ } else if (nargs >= LASTPARM) cfatal("Too many arguments in macro expansion", NULLST); parlist[nargs++] = parmp; /* At start of new arg */ for (;; c = cget()) { /* Collect arg's bytes */ if (c == EOF_CHAR) { cerror("end of file within macro argument", NULLST); return (FALSE); /* Sorry. */ } else if (c == '\\') { /* Quote next character */ charput(c); /* Save the \ for later */ charput(cget()); /* Save the next char. */ continue; /* And go get another */ } else if (type[c] == QUO) { /* Start of string? */ scanstring(c, charput); /* Scan it off */ continue; /* Go get next char */ } else if (c == '(') /* Worry about balance */ paren++; /* To know about commas */ else if (c == ')') { /* Other side too */ if (paren == 0) { /* At the end? */ unget(); /* Look at it later */ break; /* Exit arg getter. */ } paren--; /* More to come. */ } else if (c == ',' && paren == 0) /* Comma delimits args */ break; else if (c == '\n') /* Newline inside arg? */ wrongline = TRUE; /* We'll need a #line */ charput(c); /* Store this one */ } /* Collect an argument */ charput(EOS); /* Terminate argument */ #if DEBUG if (debug) printf("parm[%d] = \"%s\"\n", nargs, parlist[nargs - 1]); #endif } /* Collect all args. */ return (TRUE); /* Normal return */ } FILE_LOCAL expstuff(tokenp) DEFBUF *tokenp; /* Current macro being expanded */ /* * Stuff the macro body, replacing formal parameters by actual parameters. */ { register int c; /* Current character */ register char *inp; /* -> repl string */ register char *defp; /* -> macro output buff */ int size; /* Actual parm. size */ char *defend; /* -> output buff end */ int string_magic; /* String formal hack */ FILEINFO *file; /* Funny #include */ int endquote; extern FILEINFO *getfile(); file = getfile(NBUFF, tokenp->name); inp = tokenp->repl; /* -> macro replacement */ defp = file->buffer; /* -> output buffer */ defend = defp + (NBUFF - 1); /* Note its end */ endquote = 0; if (inp != NULL) { while ((c = (*inp++ & 0xFF)) != EOS) { if (c >= MAC_PARM && c <= (MAC_PARM + PAR_MAC)) { string_magic = (c == (MAC_PARM + PAR_MAC)); if (string_magic) c = (*inp++ & 0xFF); /* * Replace formal parameter by actual parameter string. */ if ((c -= MAC_PARM) < nargs) { size = strlen(parlist[c]); if ((defp + size) >= defend) goto nospace; /* * Erase the extra set of quotes. */ if (string_magic && defp[-1] == parlist[c][0]) { strcpy(defp-1, parlist[c]); defp += (size - 2); } else { strcpy(defp, parlist[c]); defp += size; } } if (endquote) { if (defp+1 >= defend) goto nospace; *defp++=DBL_QUOTE; endquote=0; } } else if (defp >= defend) { nospace: cfatal("Out of space in macro \"%s\" arg expansion", tokenp->name); } else if (c == TOK_QUOTE) { *defp++ = DBL_QUOTE; endquote = 1; } else { *defp++ = c; } } } *defp = EOS; #if DEBUG if (debug > 1) printf("macroline: \"%s\"\n", file->buffer); #endif } #if DEBUG dumpparm(why) char *why; /* * Dump parameter list. */ { register int i; printf("dump of %d parameters (%d bytes total) %s\n", nargs, parmp - parm, why); for (i = 0; i < nargs; i++) { printf("parm[%d] (%d) = \"%s\"\n", i + 1, strlen(parlist[i]), parlist[i]); } } #endif z88dk-1.8.ds1/src/cpp/cpp5.c0000644000175000017500000005254007130401710015067 0ustar tygrystygrys/* * C P P 5 . C * E x p r e s s i o n E v a l u a t i o n * * Edit History * 31-Aug-84 MM USENET net.sources release * 04-Oct-84 MM __LINE__ and __FILE__ must call ungetstring() * so they work correctly with token concatenation. * Added string formal recognition. * 25-Oct-84 MM "Short-circuit" evaluate #if's so that we * don't print unnecessary error messages for * #if !defined(FOO) && FOO != 0 && 10 / FOO ... * 31-Oct-84 ado/MM Added token concatenation * 6-Nov-84 MM Split from #define stuff, added sizeof stuff * 19-Nov-84 ado #if error returns TRUE for (sigh) compatibility */ #include #include #include #include #include "cppdef.h" #include "cpp.h" /* * Evaluate an #if expression. */ static char *opname[] = { /* For debug and error messages */ "end of expression", "val", "id", "+", "-", "*", "/", "%", "<<", ">>", "&", "|", "^", "==", "!=", "<", "<=", ">=", ">", "&&", "||", "?", ":", ",", "unary +", "unary -", "~", "!", "(", ")", "(none)", }; /* * opdope[] has the operator precedence: * Bits * 7 Unused (so the value is always positive) * 6-2 Precedence (000x .. 017x) * 1-0 Binary op. flags: * 01 The binop flag should be set/cleared when this op is seen. * 10 The new value of the binop flag. * Note: Expected, New binop * constant 0 1 Binop, end, or ) should follow constants * End of line 1 0 End may not be preceeded by an operator * binary 1 0 Binary op follows a value, value follows. * unary 0 0 Unary op doesn't follow a value, value follows * ( 0 0 Doesn't follow value, value or unop follows * ) 1 1 Follows value. Op follows. */ static char opdope[OP_MAX] = { 0001, /* End of expression */ 0002, /* Digit */ 0000, /* Letter (identifier) */ 0141, 0141, 0151, 0151, 0151, /* ADD, SUB, MUL, DIV, MOD */ 0131, 0131, 0101, 0071, 0071, /* ASL, ASR, AND, OR, XOR */ 0111, 0111, 0121, 0121, 0121, 0121, /* EQ, NE, LT, LE, GE, GT */ 0061, 0051, 0041, 0041, 0031, /* ANA, ORO, QUE, COL, CMA */ /* * Unary op's follow */ 0160, 0160, 0160, 0160, /* NEG, PLU, COM, NOT */ 0170, 0013, 0023, /* LPA, RPA, END */ }; /* * OP_QUE and OP_RPA have alternate precedences: */ #define OP_RPA_PREC 0013 #define OP_QUE_PREC 0034 /* * S_ANDOR and S_QUEST signal "short-circuit" boolean evaluation, so that * #if FOO != 0 && 10 / FOO ... * doesn't generate an error message. They are stored in optab.skip. */ #define S_ANDOR 2 #define S_QUEST 1 typedef struct optab { char op; /* Operator */ char prec; /* Its precedence */ char skip; /* Short-circuit: TRUE to skip */ } OPTAB; static int evalue; /* Current value from evallex() */ #ifdef nomacargs FILE_LOCAL int isbinary(op) register int op; { return (op >= FIRST_BINOP && op <= LAST_BINOP); } FILE_LOCAL int isunary(op) register int op; { return (op >= FIRST_UNOP && op <= LAST_UNOP); } #else #define isbinary(op) (op >= FIRST_BINOP && op <= LAST_BINOP) #define isunary(op) (op >= FIRST_UNOP && op <= LAST_UNOP) #endif /* * The following definitions are used to specify basic variable sizes. */ #ifndef S_CHAR #define S_CHAR (sizeof (char)) #endif #ifndef S_SINT #define S_SINT (sizeof (short int)) #endif #ifndef S_INT #define S_INT (sizeof (int)) #endif #ifndef S_LINT #define S_LINT (sizeof (long int)) #endif #ifndef S_FLOAT #define S_FLOAT (sizeof (float)) #endif #ifndef S_DOUBLE #define S_DOUBLE (sizeof (double)) #endif #ifndef S_PCHAR #define S_PCHAR (sizeof (char *)) #endif #ifndef S_PSINT #define S_PSINT (sizeof (short int *)) #endif #ifndef S_PINT #define S_PINT (sizeof (int *)) #endif #ifndef S_PLINT #define S_PLINT (sizeof (long int *)) #endif #ifndef S_PFLOAT #define S_PFLOAT (sizeof (float *)) #endif #ifndef S_PDOUBLE #define S_PDOUBLE (sizeof (double *)) #endif #ifndef S_PFPTR #define S_PFPTR (sizeof (int (*)())) #endif typedef struct types { short type; /* This is the bit if */ char *name; /* this is the token word */ } TYPES; static TYPES basic_types[] = { T_CHAR, "char", T_INT, "int", T_FLOAT, "float", T_DOUBLE, "double", T_SHORT, "short", T_LONG, "long", T_SIGNED, "signed", T_UNSIGNED, "unsigned", 0, NULL, /* Signal end */ }; /* * Test_table[] is used to test for illegal combinations. */ static short test_table[] = { T_FLOAT | T_DOUBLE | T_LONG | T_SHORT, T_FLOAT | T_DOUBLE | T_CHAR | T_INT, T_FLOAT | T_DOUBLE | T_SIGNED | T_UNSIGNED, T_LONG | T_SHORT | T_CHAR, 0 /* end marker */ }; /* * The order of this table is important -- it is also referenced by * the command line processor to allow run-time overriding of the * built-in size values. The order must not be changed: * char, short, int, long, float, double (func pointer) */ SIZES size_table[] = { { T_CHAR, S_CHAR, S_PCHAR }, /* char */ { T_SHORT, S_SINT, S_PSINT }, /* short int */ { T_INT, S_INT, S_PINT }, /* int */ { T_LONG, S_LINT, S_PLINT }, /* long */ { T_FLOAT, S_FLOAT, S_PFLOAT }, /* float */ { T_DOUBLE, S_DOUBLE, S_PDOUBLE }, /* double */ { T_FPTR, 0, S_PFPTR }, /* int (*()) */ { 0, 0, 0 }, /* End of table */ }; int eval() /* * Evaluate an expression. Straight-forward operator precedence. * This is called from control() on encountering an #if statement. * It calls the following routines: * evallex Lexical analyser -- returns the type and value of * the next input token. * evaleval Evaluate the current operator, given the values on * the value stack. Returns a pointer to the (new) * value stack. * For compatiblity with older cpp's, this return returns 1 (TRUE) * if a syntax error is detected. */ { register int op; /* Current operator */ register int *valp; /* -> value vector */ register OPTAB *opp; /* Operator stack */ int prec; /* Op precedence */ int binop; /* Set if binary op. needed */ int op1; /* Operand from stack */ int skip; /* For short-circuit testing */ int value[NEXP]; /* Value stack */ OPTAB opstack[NEXP]; /* Operand stack */ extern int *evaleval(); /* Does actual evaluation */ valp = value; opp = opstack; opp->op = OP_END; /* Mark bottom of stack */ opp->prec = opdope[OP_END]; /* And its precedence */ opp->skip = 0; /* Not skipping now */ binop = 0; again: ; #ifdef DEBUG_EVAL printf("In #if at again: skip = %d, binop = %d, line is: %s", opp->skip, binop, infile->bptr); #endif if ((op = evallex(opp->skip)) == OP_SUB && binop == 0) op = OP_NEG; /* Unary minus */ else if (op == OP_ADD && binop == 0) op = OP_PLU; /* Unary plus */ else if (op == OP_FAIL) return (1); /* Error in evallex */ #ifdef DEBUG_EVAL printf("op = %s, opdope = %03o, binop = %d, skip = %d\n", opname[op], opdope[op], binop, opp->skip); #endif if (op == DIG) { /* Value? */ if (binop != 0) { cerror("misplaced constant in #if", NULLST); return (1); } else if (valp >= &value[NEXP-1]) { cerror("#if value stack overflow", NULLST); return (1); } else { #ifdef DEBUG_EVAL printf("pushing %d onto value stack[%d]\n", evalue, valp - value); #endif *valp++ = evalue; binop = 1; } goto again; } else if (op > OP_END) { cerror("Illegal #if line", NULLST); return (1); } prec = opdope[op]; if (binop != (prec & 1)) { cerror("Operator %s in incorrect context", opname[op]); return (1); } binop = (prec & 2) >> 1; for (;;) { #ifdef DEBUG_EVAL printf("op %s, prec %d., stacked op %s, prec %d, skip %d\n", opname[op], prec, opname[opp->op], opp->prec, opp->skip); #endif if (prec > opp->prec) { if (op == OP_LPA) prec = OP_RPA_PREC; else if (op == OP_QUE) prec = OP_QUE_PREC; op1 = opp->skip; /* Save skip for test */ /* * Push operator onto op. stack. */ opp++; if (opp >= &opstack[NEXP]) { cerror("expression stack overflow at op \"%s\"", opname[op]); return (1); } opp->op = op; opp->prec = prec; skip = (valp[-1] != 0); /* Short-circuit tester */ /* * Do the short-circuit stuff here. Short-circuiting * stops automagically when operators are evaluated. */ if ((op == OP_ANA && !skip) || (op == OP_ORO && skip)) opp->skip = S_ANDOR; /* And/or skip starts */ else if (op == OP_QUE) /* Start of ?: operator */ opp->skip = (op1 & S_ANDOR) | ((!skip) ? S_QUEST : 0); else if (op == OP_COL) { /* : inverts S_QUEST */ opp->skip = (op1 & S_ANDOR) | (((op1 & S_QUEST) != 0) ? 0 : S_QUEST); } else { /* Other ops leave */ opp->skip = op1; /* skipping unchanged. */ } #ifdef DEBUG_EVAL printf("stacking %s, valp[-1] == %d at %s", opname[op], valp[-1], infile->bptr); dumpstack(opstack, opp, value, valp); #endif goto again; } /* * Pop operator from op. stack and evaluate it. * End of stack and '(' are specials. */ skip = opp->skip; /* Remember skip value */ switch ((op1 = opp->op)) { /* Look at stacked op */ case OP_END: /* Stack end marker */ if (op == OP_EOE) return (valp[-1]); /* Finished ok. */ goto again; /* Read another op. */ case OP_LPA: /* ( on stack */ if (op != OP_RPA) { /* Matches ) on input */ cerror("unbalanced paren's, op is \"%s\"", opname[op]); return (1); } opp--; /* Unstack it */ /* goto again; -- Fall through */ case OP_QUE: goto again; /* Evaluate true expr. */ case OP_COL: /* : on stack. */ opp--; /* Unstack : */ if (opp->op != OP_QUE) { /* Matches ? on stack? */ cerror("Misplaced '?' or ':', previous operator is %s", opname[opp->op]); return (1); } /* * Evaluate op1. */ default: /* Others: */ opp--; /* Unstack the operator */ #ifdef DEBUG_EVAL printf("Stack before evaluation of %s\n", opname[op1]); dumpstack(opstack, opp, value, valp); #endif valp = evaleval(valp, op1, skip); #ifdef DEBUG_EVAL printf("Stack after evaluation\n"); dumpstack(opstack, opp, value, valp); #endif } /* op1 switch end */ } /* Stack unwind loop */ } FILE_LOCAL int evallex(skip) int skip; /* TRUE if short-circuit evaluation */ /* * Return next eval operator or value. Called from eval(). It * calls a special-purpose routines for 'char' strings and * numeric values: * evalchar called to evaluate 'x' * evalnum called to evaluate numbers. */ { register int c, c1, t; again: do { /* Collect the token */ c = skipws(); if ((c = macroid(c)) == EOF_CHAR || c == '\n') { unget(); return (OP_EOE); /* End of expression */ } } while ((t = type[c]) == LET && catenate()); if (t == INV) { /* Total nonsense */ if (!skip) { /* Removed isascii(C) && isprint(c)*/ if (isprint(c)) cierror("illegal character '%c' in #if", c); else cierror("illegal character (%d decimal) in #if", c); } return (OP_FAIL); } else if (t == QUO) { /* ' or " */ if (c == '\'') { /* Character constant */ evalue = evalchar(skip); /* Somewhat messy */ #ifdef DEBUG_EVAL printf("evalchar returns %d.\n", evalue); #endif return (DIG); /* Return a value */ } cerror("Can't use a string in an #if", NULLST); return (OP_FAIL); } else if (t == LET) { /* ID must be a macro */ if (streq(token, "defined")) { /* Or defined name */ c1 = c = skipws(); if (c == '(') /* Allow defined(name) */ c = skipws(); if (type[c] == LET) { evalue = (lookid(c) != NULL); if (c1 != '(' /* Need to balance */ || skipws() == ')') /* Did we balance? */ return (DIG); /* Parsed ok */ } cerror("Bad #if ... defined() syntax", NULLST); return (OP_FAIL); } else if (streq(token, "sizeof")) /* New sizeof hackery */ return (dosizeof()); /* Gets own routine */ /* * The Draft ANSI C Standard says that an undefined symbol * in an #if has the value zero. We are a bit pickier, * warning except where the programmer was careful to write * #if defined(foo) ? foo : 0 */ #ifdef STRICT_UNDEF if (!skip) cwarn("undefined symbol \"%s\" in #if, 0 used", token); #endif evalue = 0; return (DIG); } else if (t == DIG) { /* Numbers are harder */ evalue = evalnum(c); #ifdef DEBUG_EVAL printf("evalnum returns %d.\n", evalue); #endif } else if (strchr("!=<>&|\\", c) != NULL) { /* * Process a possible multi-byte lexeme. */ c1 = cget(); /* Peek at next char */ switch (c) { case '!': if (c1 == '=') return (OP_NE); break; case '=': if (c1 != '=') { /* Can't say a=b in #if */ unget(); cerror("= not allowed in #if", NULLST); return (OP_FAIL); } return (OP_EQ); case '>': case '<': if (c1 == c) return ((c == '<') ? OP_ASL : OP_ASR); else if (c1 == '=') return ((c == '<') ? OP_LE : OP_GE); break; case '|': case '&': if (c1 == c) return ((c == '|') ? OP_ORO : OP_ANA); break; case '\\': if (c1 == '\n') /* Multi-line if */ goto again; cerror("Unexpected \\ in #if", NULLST); return (OP_FAIL); } unget(); } return (t); } FILE_LOCAL int dosizeof() /* * Process the sizeof (basic type) operation in an #if string. * Sets evalue to the size and returns * DIG success * OP_FAIL bad parse or something. */ { register int c; register TYPES *tp; register SIZES *sizp; register short *testp; short typecode; if ((c = skipws()) != '(') goto nogood; /* * Scan off the tokens. */ typecode = 0; while ((c = skipws())) { if ((c = macroid(c)) == EOF_CHAR || c == '\n') goto nogood; /* End of line is a bug */ else if (c == '(') { /* thing (*)() func ptr */ if (skipws() == '*' && skipws() == ')') { /* We found (*) */ if (skipws() != '(') /* Let () be optional */ unget(); else if (skipws() != ')') goto nogood; typecode |= T_FPTR; /* Function pointer */ } else { /* Junk is a bug */ goto nogood; } } else if (type[c] != LET) /* Exit if not a type */ break; else if (!catenate()) { /* Maybe combine tokens */ /* * Look for this unexpandable token in basic_types. * The code accepts "int long" as well as "long int" * which is a minor bug as bugs go (and one shared with * a lot of C compilers). */ for (tp = basic_types; tp->name != NULLST; tp++) { if (streq(token, tp->name)) break; } if (tp->name == NULLST) { cerror("#if sizeof, unknown type \"%s\"", token); return (OP_FAIL); } typecode |= tp->type; /* Or in the type bit */ } } /* * We are at the end of the type scan. Chew off '*' if necessary. */ if (c == '*') { typecode |= T_PTR; c = skipws(); } if (c == ')') { /* Last syntax check */ for (testp = test_table; *testp != 0; testp++) { if (!bittest(typecode & *testp)) { cerror("#if ... sizeof: illegal type combination", NULLST); return (OP_FAIL); } } /* * We assume that all function pointers are the same size: * sizeof (int (*)()) == sizeof (float (*)()) * We assume that signed and unsigned don't change the size: * sizeof (signed int) == (sizeof unsigned int) */ if ((typecode & T_FPTR) != 0) /* Function pointer */ typecode = T_FPTR | T_PTR; else { /* Var or var * datum */ typecode &= ~(T_SIGNED | T_UNSIGNED); if ((typecode & (T_SHORT | T_LONG)) != 0) typecode &= ~T_INT; } if ((typecode & ~T_PTR) == 0) { cerror("#if sizeof() error, no type specified", NULLST); return (OP_FAIL); } /* * Exactly one bit (and possibly T_PTR) may be set. */ for (sizp = size_table; sizp->bits != 0; sizp++) { if ((typecode & ~T_PTR) == sizp->bits) { evalue = ((typecode & T_PTR) != 0) ? sizp->psize : sizp->size; return (DIG); } } /* We shouldn't fail */ cierror("#if ... sizeof: bug, unknown type code 0x%x", typecode); return (OP_FAIL); } nogood: unget(); cerror("#if ... sizeof() syntax error", NULLST); return (OP_FAIL); } FILE_LOCAL int bittest(value) /* * TRUE if value is zero or exactly one bit is set in value. */ { #if (4096 & ~(-4096)) == 0 return ((value & ~(-value)) == 0); #else /* * Do it the hard way (for non 2's complement machines) */ return (value == 0 || value ^ (value - 1) == (value * 2 - 1)); #endif } FILE_LOCAL int evalnum(c) register int c; /* * Expand number for #if lexical analysis. Note: evalnum recognizes * the unsigned suffix, but only returns a signed int value. */ { register int value; register int base; register int c1; if (c != '0') base = 10; else if ((c = cget()) == 'x' || c == 'X') { base = 16; c = cget(); } else base = 8; value = 0; for (;;) { c1 = c; /* removed isascii(c) && */ if (isupper(c1)) c1 = tolower(c1); if (c1 >= 'a') c1 -= ('a' - 10); else c1 -= '0'; if (c1 < 0 || c1 >= base) break; value *= base; value += c1; c = cget(); } /* Formerly unsigned nonsense, now good luck */ if (c == 'u' || c == 'U' || c == 'l' || c == 'L') c = cget(); unget(); return (value); } FILE_LOCAL int evalchar(skip) int skip; /* TRUE if short-circuit evaluation */ /* * Get a character constant */ { register int c; register int value; register int count; instring = TRUE; if ((c = cget()) == '\\') { switch ((c = cget())) { case 'a': /* New in Standard */ #if ('a' == '\a' || '\a' == ALERT) value = ALERT; /* Use predefined value */ #else value = '\a'; /* Use compiler's value */ #endif break; case 'b': value = '\b'; break; case 'f': value = '\f'; break; case 'n': value = '\n'; break; case 'r': value = '\r'; break; case 't': value = '\t'; break; case 'v': /* New in Standard */ #if ('v' == '\v' || '\v' == VT) value = VT; /* Use predefined value */ #else value = '\v'; /* Use compiler's value */ #endif break; case 'x': /* '\xFF' */ count = 3; value = 0; while ((((c = get()) >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) && (--count >= 0)) { value *= 16; value += (c <= '9') ? (c - '0') : ((c & 0xF) + 9); } unget(); break; default: if (c >= '0' && c <= '7') { count = 3; value = 0; while (c >= '0' && c <= '7' && --count >= 0) { value *= 8; value += (c - '0'); c = get(); } unget(); } else value = c; break; } } else if (c == '\'') value = 0; else value = c; /* * We warn on multi-byte constants and try to hack * (big|little)endian machines. */ #if BIG_ENDIAN count = 0; #endif while ((c = get()) != '\'' && c != EOF_CHAR && c != '\n') { if (!skip) ciwarn("multi-byte constant '%c' isn't portable", c); #if BIG_ENDIAN count += BITS_CHAR; value += (c << count); #else value <<= BITS_CHAR; value += c; #endif } instring = FALSE; return (value); } FILE_LOCAL int * evaleval(valp, op, skip) register int *valp; int op; int skip; /* TRUE if short-circuit evaluation */ /* * Apply the argument operator to the data on the value stack. * One or two values are popped from the value stack and the result * is pushed onto the value stack. * * OP_COL is a special case. * * evaleval() returns the new pointer to the top of the value stack. */ { register int v1, v2; if (isbinary(op)) v2 = *--valp; v1 = *--valp; #ifdef DEBUG_EVAL printf("%s op %s", (isbinary(op)) ? "binary" : "unary", opname[op]); if (isbinary(op)) printf(", v2 = %d.", v2); printf(", v1 = %d.\n", v1); #endif switch (op) { case OP_EOE: break; case OP_ADD: v1 += v2; break; case OP_SUB: v1 -= v2; break; case OP_MUL: v1 *= v2; break; case OP_DIV: case OP_MOD: if (v2 == 0) { if (!skip) { cwarn("%s by zero in #if, zero result assumed", (op == OP_DIV) ? "divide" : "mod"); } v1 = 0; } else if (op == OP_DIV) v1 /= v2; else v1 %= v2; break; case OP_ASL: v1 <<= v2; break; case OP_ASR: v1 >>= v2; break; case OP_AND: v1 &= v2; break; case OP_OR: v1 |= v2; break; case OP_XOR: v1 ^= v2; break; case OP_EQ: v1 = (v1 == v2); break; case OP_NE: v1 = (v1 != v2); break; case OP_LT: v1 = (v1 < v2); break; case OP_LE: v1 = (v1 <= v2); break; case OP_GE: v1 = (v1 >= v2); break; case OP_GT: v1 = (v1 > v2); break; case OP_ANA: v1 = (v1 && v2); break; case OP_ORO: v1 = (v1 || v2); break; case OP_COL: /* * v1 has the "true" value, v2 the "false" value. * The top of the value stack has the test. */ v1 = (*--valp) ? v1 : v2; break; case OP_NEG: v1 = (-v1); break; case OP_PLU: break; case OP_COM: v1 = ~v1; break; case OP_NOT: v1 = !v1; break; default: cierror("#if bug, operand = %d.", op); v1 = 0; } *valp++ = v1; return (valp); } #ifdef DEBUG_EVAL dumpstack(opstack, opp, value, valp) OPTAB opstack[NEXP]; /* Operand stack */ register OPTAB *opp; /* Operator stack */ int value[NEXP]; /* Value stack */ register int *valp; /* -> value vector */ { printf("index op prec skip name -- op stack at %s", infile->bptr); while (opp > opstack) { printf(" [%2d] %2d %03o %d %s\n", opp - opstack, opp->op, opp->prec, opp->skip, opname[opp->op]); opp--; } while (--valp >= value) { printf("value[%d] = %d\n", (valp - value), *valp); } } #endif z88dk-1.8.ds1/src/cpp/cpp6.c0000644000175000017500000006714710637514467015125 0ustar tygrystygrys/* * C P P 6 . C * S u p p o r t R o u t i n e s * * Edit History * 25-May-84 MM Added 8-bit support to type table. * 30-May-84 ARF sharp() should output filename in quotes * 02-Aug-84 MM Newline and #line hacking. sharp() now in cpp1.c * 31-Aug-84 MM USENET net.sources release * 11-Sep-84 ado/MM Keepcomments, also line number pathological * 12-Sep-84 ado/MM bug if comment changes to space and we unget later. * 03-Oct-84 gkr/MM Fixed scannumber bug for '.e' (as in struct.element). * 04-Oct-84 MM Added ungetstring() for token concatenation * 08-Oct-84 MM Yet another attack on number scanning * 31-Oct-84 ado Parameterized $ in identifiers * 2-Nov-84 MM Token concatenation is messier than I thought * 6-Dec-84 MM \ is everywhere invisible. * 22-Apr-00 djm Support for C++ // style comments */ #include #include #include #include #include "cppdef.h" #include "cpp.h" /* * skipnl() skips over input text to the end of the line. * skipws() skips over "whitespace" (spaces or tabs), but * not skip over the end of the line. It skips over * TOK_SEP, however (though that shouldn't happen). * scanid() reads the next token (C identifier) into token[]. * The caller has already read the first character of * the identifier. Unlike macroid(), the token is * never expanded. * macroid() reads the next token (C identifier) into token[]. * If it is a #defined macro, it is expanded, and * macroid() returns TRUE, otherwise, FALSE. * catenate() Does the dirty work of token concatenation, TRUE if it did. * scanstring() Reads a string from the input stream, calling * a user-supplied function for each character. * This function may be output() to write the * string to the output file, or save() to save * the string in the work buffer. * scannumber() Reads a C numeric constant from the input stream, * calling the user-supplied function for each * character. (output() or save() as noted above.) * save() Save one character in the work[] buffer. * savestring() Saves a string in malloc() memory. * getfile() Initialize a new FILEINFO structure, called when * #include opens a new file, or a macro is to be * expanded. * getmem() Get a specified number of bytes from malloc memory. * output() Write one character to stdout (calling putchar) -- * implemented as a function so its address may be * passed to scanstring() and scannumber(). * lookid() Scans the next token (identifier) from the input * stream. Looks for it in the #defined symbol table. * Returns a pointer to the definition, if found, or NULL * if not present. The identifier is stored in token[]. * defnedel() Define enter/delete subroutine. Updates the * symbol table. * get() Read the next byte from the current input stream, * handling end of (macro/file) input and embedded * comments appropriately. Note that the global * instring is -- essentially -- a parameter to get(). * cget() Like get(), but skip over TOK_SEP. * unget() Push last gotten character back on the input stream. * cerror(), cwarn(), cfatal(), cierror(), ciwarn() * These routines format an print messages to the user. * cerror & cwarn take a format and a single string argument. * cierror & ciwarn take a format and a single int (char) argument. * cfatal takes a format and a single string argument. */ /* * This table must be rewritten for a non-Ascii machine. * * Note that several "non-visible" characters have special meaning: * Hex 1D DEF_MAGIC -- a flag to prevent #define recursion. * Hex 1E TOK_SEP -- a delimiter for token concatenation * Hex 1F COM_SEP -- a zero-width whitespace for comment concatenation */ #if TOK_SEP != 0x1E || COM_SEP != 0x1F || DEF_MAGIC != 0x1D #error "<< error type table isn't correct >>" #endif #if OK_DOLLAR #define DOL LET #else #define DOL 000 #endif char type[256] = { /* Character type codes Hex */ END, 000, 000, 000, 000, 000, 000, 000, /* 00 */ 000, SPA, 000, 000, SPA, 000, 000, 000, /* 08 */ 000, 000, 000, 000, 000, 000, 000, 000, /* 10 */ 000, 000, 000, 000, 000, LET, 000, SPA, /* 18 */ SPA,OP_NOT, QUO, 000, DOL,OP_MOD,OP_AND, QUO, /* 20 !"#$%&' */ OP_LPA,OP_RPA,OP_MUL,OP_ADD, 000,OP_SUB, DOT,OP_DIV, /* 28 ()*+,-./ */ DIG, DIG, DIG, DIG, DIG, DIG, DIG, DIG, /* 30 01234567 */ DIG, DIG,OP_COL, 000, OP_LT, OP_EQ, OP_GT,OP_QUE, /* 38 89:;<=>? */ 000, LET, LET, LET, LET, LET, LET, LET, /* 40 @ABCDEFG */ LET, LET, LET, LET, LET, LET, LET, LET, /* 48 HIJKLMNO */ LET, LET, LET, LET, LET, LET, LET, LET, /* 50 PQRSTUVW */ LET, LET, LET, 000, BSH, 000,OP_XOR, LET, /* 58 XYZ[\]^_ */ 000, LET, LET, LET, LET, LET, LET, LET, /* 60 `abcdefg */ LET, LET, LET, LET, LET, LET, LET, LET, /* 68 hijklmno */ LET, LET, LET, LET, LET, LET, LET, LET, /* 70 pqrstuvw */ LET, LET, LET, 000, OP_OR, 000,OP_NOT, 000, /* 78 xyz{|}~ */ 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ }; skipnl() /* * Skip to the end of the current input line. */ { register int c; do { /* Skip to newline */ c = get(); } while (c != '\n' && c != '\r' && c != EOF_CHAR); } int skipws() /* * Skip over whitespace */ { register int c; do { /* Skip whitespace */ c = get(); #if COMMENT_INVISIBLE } while (type[c] == SPA || c == COM_SEP); #else } while (type[c] == SPA); #endif return (c); } scanid(c) register int c; /* First char of id */ /* * Get the next token (an id) into the token buffer. * Note: this code is duplicated in lookid(). * Change one, change both. */ { register char *bp; if (c == DEF_MAGIC) /* Eat the magic token */ c = get(); /* undefiner. */ bp = token; do { if (bp < &token[IDMAX]) /* token dim is IDMAX+1 */ *bp++ = c; c = get(); } while (type[c] == LET || type[c] == DIG); unget(); *bp = EOS; } int macroid(c) register int c; /* * If c is a letter, scan the id. if it's #defined, expand it and scan * the next character and try again. * * Else, return the character. If type[c] is a LET, the token is in token. */ { register DEFBUF *dp; if (infile != NULL && infile->fp != NULL) recursion = 0; while (type[c] == LET && (dp = lookid(c)) != NULL) { expand(dp); c = get(); } return (c); } int catenate() /* * A token was just read (via macroid). * If the next character is TOK_SEP, concatenate the next token * return TRUE -- which should recall macroid after refreshing * macroid's argument. If it is not TOK_SEP, unget() the character * and return FALSE. */ { register int c; register char *token1; #if OK_CONCAT if (get() != TOK_SEP) { /* Token concatenation */ unget(); return (FALSE); } else { token1 = savestring(token); /* Save first token */ c = macroid(get()); /* Scan next token */ switch(type[c]) { /* What was it? */ case LET: /* An identifier, ... */ if (strlen(token1) + strlen(token) >= NWORK) cfatal("work buffer overflow doing %s #", token1); sprintf(work, "%s%s", token1, token); break; case DIG: /* A digit string */ strcpy(work, token1); workp = work + strlen(work); do { save(c); } while ((c = get()) != TOK_SEP); /* * The trailing TOK_SEP is no longer needed. */ save(EOS); break; default: /* An error, ... */ #if ! COMMENT_INVISIBLE if (isprint(c)) cierror("Strange character '%c' after #", c); else cierror("Strange character (%d.) after #", c); #endif strcpy(work, token1); unget(); break; } /* * work has the concatenated token and token1 has * the first token (no longer needed). Unget the * new (concatenated) token after freeing token1. * Finally, setup to read the new token. */ free(token1); /* Free up memory */ ungetstring(work); /* Unget the new thing, */ return (TRUE); } #else return (FALSE); /* Not supported */ #endif } int scanstring(delim, outfun) register int delim; /* ' or " */ int (*outfun)(); /* Output function */ /* * Scan off a string. Warning if terminated by newline or EOF. * outfun() outputs the character -- to a buffer if in a macro. * TRUE if ok, FALSE if error. */ { register int c; instring = TRUE; /* Don't strip comments */ (*outfun)(delim); while ((c = get()) != delim && c != '\n' && c != EOF_CHAR) { if (c != DEF_MAGIC) (*outfun)(c); if (c == '\\') (*outfun)(get()); } instring = FALSE; if (c == delim) { (*outfun)(c); return (TRUE); } else { cerror("Unterminated string", NULLST); unget(); return (FALSE); } } scannumber(c, outfun) register int c; /* First char of number */ register int (*outfun)(); /* Output/store func */ /* * Process a number. We know that c is from 0 to 9 or dot. * Algorithm from Dave Conroy's Decus C. */ { register int radix; /* 8, 10, or 16 */ int expseen; /* 'e' seen in floater */ int signseen; /* '+' or '-' seen */ int octal89; /* For bad octal test */ int dotflag; /* TRUE if '.' was seen */ expseen = FALSE; /* No exponent seen yet */ signseen = TRUE; /* No +/- allowed yet */ octal89 = FALSE; /* No bad octal yet */ radix = 10; /* Assume decimal */ if ((dotflag = (c == '.')) != FALSE) { /* . something? */ (*outfun)('.'); /* Always out the dot */ if (type[(c = get())] != DIG) { /* If not a float numb, */ unget(); /* Rescan strange char */ return; /* All done for now */ } } /* End of float test */ else if (c == '0') { /* Octal or hex? */ (*outfun)(c); /* Stuff initial zero */ radix = 8; /* Assume it's octal */ c = get(); /* Look for an 'x' */ if (c == 'x' || c == 'X') { /* Did we get one? */ radix = 16; /* Remember new radix */ (*outfun)(c); /* Stuff the 'x' */ c = get(); /* Get next character */ } } for (;;) { /* Process curr. char. */ /* * Note that this algorithm accepts "012e4" and "03.4" * as legitimate floating-point numbers. */ if (radix != 16 && (c == 'e' || c == 'E')) { if (expseen) /* Already saw 'E'? */ break; /* Exit loop, bad nbr. */ expseen = TRUE; /* Set exponent seen */ signseen = FALSE; /* We can read '+' now */ radix = 10; /* Decimal exponent */ } else if (radix != 16 && c == '.') { if (dotflag) /* Saw dot already? */ break; /* Exit loop, two dots */ dotflag = TRUE; /* Remember the dot */ radix = 10; /* Decimal fraction */ } else if (c == '+' || c == '-') { /* 1.0e+10 */ if (signseen) /* Sign in wrong place? */ break; /* Exit loop, not nbr. */ /* signseen = TRUE; */ /* Remember we saw it */ } else { /* Check the digit */ switch (c) { case '8': case '9': /* Sometimes wrong */ octal89 = TRUE; /* Do check later */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': break; /* Always ok */ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': if (radix == 16) /* Alpha's are ok only */ break; /* if reading hex. */ default: /* At number end */ goto done; /* Break from for loop */ } /* End of switch */ } /* End general case */ (*outfun)(c); /* Accept the character */ signseen = TRUE; /* Don't read sign now */ c = get(); /* Read another char */ } /* End of scan loop */ /* * When we break out of the scan loop, c contains the first * character (maybe) not in the number. If the number is an * integer, allow a trailing 'L' for long and/or a trailing 'U' * for unsigned. If not those, push the trailing character back * on the input stream. Floating point numbers accept a trailing * 'L' for "long double". */ done: if (dotflag || expseen) { /* Floating point? */ if (c == 'l' || c == 'L') { (*outfun)(c); c = get(); /* Ungotten later */ } } else { /* Else it's an integer */ /* * We know that dotflag and expseen are both zero, now: * dotflag signals "saw 'L'", and * expseen signals "saw 'U'". */ for (;;) { switch (c) { case 'l': case 'L': if (dotflag) goto nomore; dotflag = TRUE; break; case 'u': case 'U': if (expseen) goto nomore; expseen = TRUE; break; default: goto nomore; } (*outfun)(c); /* Got 'L' or 'U'. */ c = get(); /* Look at next, too. */ } } nomore: unget(); /* Not part of a number */ if (octal89 && radix == 8) cwarn("Illegal digit in octal number", NULLST); } save(c) register int c; { if (workp >= &work[NWORK]) { work[NWORK-1] = '\0'; cfatal("Work buffer overflow: %s", work); } else *workp++ = c; } char * savestring(text) char *text; /* * Store a string into free memory. */ { register char *result; result = getmem(strlen(text) + 1); strcpy(result, text); return (result); } FILEINFO * getfile(bufsize, name) int bufsize; /* Line or define buffer size */ char *name; /* File or macro name string */ /* * Common FILEINFO buffer initialization for a new file or macro. */ { register FILEINFO *file; register int size; size = strlen(name); /* File/macro name */ file = (FILEINFO *) getmem(sizeof (FILEINFO) + bufsize + size); file->parent = infile; /* Chain files together */ file->fp = NULL; /* No file yet */ file->filename = savestring(name); /* Save file/macro name */ file->progname = NULL; /* No #line seen yet */ file->unrecur = 0; /* No macro fixup */ file->bptr = file->buffer; /* Initialize line ptr */ file->buffer[0] = EOS; /* Force first read */ file->line = 0; /* (Not used just yet) */ if (infile != NULL) /* If #include file */ infile->line = line; /* Save current line */ infile = file; /* New current file */ line = 1; /* Note first line */ return (file); /* All done. */ } char * getmem(size) int size; /* * Get a block of free memory. */ { register char *result; if ((result = malloc((unsigned) size)) == NULL) cfatal("Out of memory", NULLST); return (result); } /* * C P P S y m b o l T a b l e s */ /* * SBSIZE defines the number of hash-table slots for the symbol table. * It must be a power of 2. */ #ifndef SBSIZE #define SBSIZE 64 #endif #define SBMASK (SBSIZE - 1) #if (SBSIZE ^ SBMASK) != ((SBSIZE * 2) - 1) << error, SBSIZE must be a power of 2 >> #endif static DEFBUF *symtab[SBSIZE]; /* Symbol table queue headers */ DEFBUF * lookid(c) int c; /* First character of token */ /* * Look for the next token in the symbol table. Returns token in "token". * If found, returns the table pointer; Else returns NULL. */ { register int nhash; register DEFBUF *dp; register char *np; int temp = 0; int isrecurse; /* For #define foo foo */ np = token; nhash = 0; if ((isrecurse = (c == DEF_MAGIC))) /* If recursive macro */ c = get(); /* hack, skip DEF_MAGIC */ do { if (np < &token[IDMAX]) { /* token dim is IDMAX+1 */ *np++ = c; /* Store token byte */ nhash += c; /* Update hash value */ } c = get(); /* And get another byte */ } while (type[c] == LET || type[c] == DIG); unget(); /* Rescan terminator */ *np = EOS; /* Terminate token */ if (isrecurse) /* Recursive definition */ return (NULL); /* undefined just now */ nhash += (np - token); /* Fix hash value */ dp = symtab[nhash & SBMASK]; /* Starting bucket */ while (dp != (DEFBUF *) NULL) { /* Search symbol table */ if (dp->hash == nhash /* Fast precheck */ && (temp = strcmp(dp->name, token)) >= 0) break; dp = dp->link; /* Nope, try next one */ } return ((temp == 0) ? dp : NULL); } DEFBUF * defendel(name, delete) char *name; int delete; /* TRUE to delete a symbol */ /* * Enter this name in the lookup table (delete = FALSE) * or delete this name (delete = TRUE). * Returns a pointer to the define block (delete = FALSE) * Returns NULL if the symbol wasn't defined (delete = TRUE). */ { register DEFBUF *dp; register DEFBUF **prevp; register char *np; int nhash; int temp; int size; for (nhash = 0, np = name; *np != EOS;) nhash += *np++; size = (np - name); nhash += size; prevp = &symtab[nhash & SBMASK]; while ((dp = *prevp) != (DEFBUF *) NULL) { if (dp->hash == nhash && (temp = strcmp(dp->name, name)) >= 0) { if (temp > 0) dp = NULL; /* Not found */ else { *prevp = dp->link; /* Found, unlink and */ if (dp->repl != NULL) /* Free the replacement */ free(dp->repl); /* if any, and then */ free((char *) dp); /* Free the symbol */ } break; } prevp = &dp->link; } if (!delete) { dp = (DEFBUF *) getmem(sizeof (DEFBUF) + size); dp->link = *prevp; *prevp = dp; dp->hash = nhash; dp->repl = NULL; dp->nargs = 0; strcpy(dp->name, name); } return (dp); } #if DEBUG dumpdef(why) char *why; { register DEFBUF *dp; register DEFBUF **syp; printf("CPP symbol table dump %s\n", why); for (syp = symtab; syp < &symtab[SBSIZE]; syp++) { if ((dp = *syp) != (DEFBUF *) NULL) { printf("symtab[%d]\n", (syp - symtab)); do { dumpadef((char *) NULL, dp); } while ((dp = dp->link) != (DEFBUF *) NULL); } } } dumpadef(why, dp) char *why; /* Notation */ register DEFBUF *dp; { register char *cp; register int c; printf(" \"%s\" [%d]", dp->name, dp->nargs); if (why != NULL) printf(" (%s)", why); if (dp->repl != NULL) { printf(" => "); for (cp = dp->repl; (c = *cp++ & 0xFF) != EOS;) { if (c >= MAC_PARM && c <= (MAC_PARM + PAR_MAC)) printf("<%d>", c - MAC_PARM); else if (c == DBL_QUOTE) putchar('<">'); else if (isprint(c) || c == '\n' || c == '\t') putchar(c); else if (c < ' ') printf("<^%c>", c + '@'); else printf("<\\0%o>", c); } } else { printf(", no replacement."); } putchar('\n'); } #endif /* * G E T */ int get() /* * Return the next character from a macro or the current file. * Handle end of file from #include files. */ { register int c; register FILEINFO *file; register int popped; /* Recursion fixup */ popped = 0; get_from_file: if ((file = infile) == NULL) return (EOF_CHAR); newline: #if 0 printf("get(%s), recursion %d, line %d, bptr = %d, buffer \"%s\"\n", file->filename, recursion, line, file->bptr - file->buffer, file->buffer); #endif /* * Read a character from the current input line or macro. * At EOS, either finish the current macro (freeing temp. * storage) or read another line from the current input file. * At EOF, exit the current file (#include) or, at EOF from * the cpp input file, return EOF_CHAR to finish processing. */ if ((c = *file->bptr++ & 0xFF) == EOS) { /* * Nothing in current line or macro. Get next line (if * input from a file), or do end of file/macro processing. * In the latter case, jump back to restart from the top. */ if (file->fp == NULL) { /* NULL if macro */ popped++; recursion -= file->unrecur; if (recursion < 0) recursion = 0; infile = file->parent; /* Unwind file chain */ } else { /* Else get from a file */ if ((file->bptr = fgets(file->buffer, NBUFF, file->fp)) != NULL) { #if DEBUG if (debug > 1) { /* Dump it to stdout */ printf("\n#line %d (%s), %s", line, file->filename, file->buffer); } #endif goto newline; /* process the line */ } else { #if DEBUG if (debug) printf("\nclosing file %s",file->filename); #endif fclose(file->fp); /* Close finished file */ if ((infile = file->parent) != NULL) { /* * There is an "ungotten" newline in the current * infile buffer (set there by doinclude() in * cpp1.c). Thus, we know that the mainline code * is skipping over blank lines and will do a * #line at its convenience. */ wrongline = TRUE; /* Need a #line now */ } } } /* * Free up space used by the (finished) file or macro and * restart input from the parent file/macro, if any. */ free(file->filename); /* Free name and */ if (file->progname != NULL) /* if a #line was seen, */ free(file->progname); /* free it, too. */ free((char *) file); /* Free file space */ if (infile == NULL) /* If at end of file */ return (EOF_CHAR); /* Return end of file */ line = infile->line; /* Reset line number */ goto get_from_file; /* Get from the top. */ } /* * Common processing for the new character. */ if (c == DEF_MAGIC && file->fp != NULL) /* Don't allow delete */ goto newline; /* from a file */ if (file->parent != NULL) { /* Macro or #include */ if (popped != 0) file->parent->unrecur += popped; else { recursion -= file->parent->unrecur; if (recursion < 0) recursion = 0; file->parent->unrecur = 0; } } if (c == '\n') /* Maintain current */ ++line; /* line counter */ if (instring) /* Strings just return */ return (c); /* the character. */ else if (c == '/') { /* Comment? */ instring = TRUE; /* So get() won't loop */ if ( (c=get()) == '/') { instring = FALSE; /* So get() won't loop */ skipnl(); return('\n'); } if (c != '*') { /* Next byte '*'? */ instring = FALSE; /* Nope, no comment */ unget(); /* Push the char. back */ return ('/'); /* Return the slash */ } if (keepcomments) { /* If writing comments */ putchar('/'); /* Write out the */ putchar('*'); /* initializer */ } for (;;) { /* Eat a comment */ c = get(); test: if (keepcomments && c != EOF_CHAR) cput(c); switch (c) { case EOF_CHAR: cerror("EOF in comment", NULLST); return (EOF_CHAR); case '/': if ((c = get()) != '*') /* Don't let comments */ goto test; /* Nest. */ #ifdef STRICT_COMMENTS cwarn("Nested comments", NULLST); #endif /* Fall into * stuff */ case '*': if ((c = get()) != '/') /* If comment doesn't */ goto test; /* end, look at next */ instring = FALSE; /* End of comment, */ if (keepcomments) { /* Put out the comment */ cput(c); /* terminator, too */ } /* * A comment is syntactically "whitespace" -- * however, there are certain strange sequences * such as * #define foo(x) (something) * foo|* comment *|(123) * these are '/' ^ ^ * where just returning space (or COM_SEP) will cause * problems. This can be "fixed" by overwriting the * '/' in the input line buffer with ' ' (or COM_SEP) * but that may mess up an error message. * So, we peek ahead -- if the next character is * "whitespace" we just get another character, if not, * we modify the buffer. All in the name of purity. */ if (*file->bptr == '\n' || type[*file->bptr & 0xFF] == SPA) goto newline; #if COMMENT_INVISIBLE /* * Return magic (old-fashioned) syntactic space. */ return ((file->bptr[-1] = COM_SEP)); #else return ((file->bptr[-1] = ' ')); #endif case '\n': /* we'll need a #line */ if (!keepcomments) wrongline = TRUE; /* later... */ default: /* Anything else is */ break; /* Just a character */ } /* End switch */ } /* End comment loop */ } /* End if in comment */ else if (!inmacro && c == '\\') { /* If backslash, peek */ if ((c = get()) == '\n') { /* for a . If so, */ wrongline = TRUE; goto newline; } else { /* Backslash anything */ unget(); /* Get it later */ return ('\\'); /* Return the backslash */ } } else if ( c == '\r' || c == '\f' || c == VT) /* Form Feed, Vertical */ c = ' '; /* Tab are whitespace */ return (c); /* Just return the char */ } unget() /* * Backup the pointer to reread the last character. Fatal error * (code bug) if we backup too far. unget() may be called, * without problems, at end of file. Only one character may * be ungotten. If you need to unget more, call ungetstring(). */ { register FILEINFO *file; if ((file = infile) == NULL) return; /* Unget after EOF */ if (--file->bptr < file->buffer) cfatal("Too much pushback", NULLST); if (*file->bptr == '\n') /* Ungetting a newline? */ --line; /* Unget the line number, too */ } ungetstring(text) char *text; /* * Push a string back on the input stream. This is done by treating * the text as if it were a macro. */ { register FILEINFO *file; extern FILEINFO *getfile(); file = getfile(strlen(text) + 1, ""); strcpy(file->buffer, text); } int cget() /* * Get one character, absorb "funny space" after comments or * token concatenation */ { register int c; do { c = get(); #if COMMENT_INVISIBLE } while (c == TOK_SEP || c == COM_SEP); #else } while (c == TOK_SEP); #endif return (c); } /* * Error messages and other hacks. The first byte of severity * is 'S' for string arguments and 'I' for int arguments. This * is needed for portability with machines that have int's that * are shorter than char *'s. */ static domsg(severity, format, arg) char *severity; /* "Error", "Warning", "Fatal" */ char *format; /* Format for the error message */ char *arg; /* Something for the message */ /* * Print filenames, macro names, and line numbers for error messages. */ { register char *tp; register FILEINFO *file; fprintf(stderr, "%sline %d, %s: ", MSG_PREFIX, line, &severity[1]); if (*severity == 'S') fprintf(stderr, format, arg); else fprintf(stderr, format, (int) arg); putc('\n', stderr); if ((file = infile) == NULL) return; /* At end of file */ if (file->fp != NULL) { tp = file->buffer; /* Print current file */ fprintf(stderr, "%s", tp); /* name, making sure */ if (tp[strlen(tp) - 1] != '\n') /* there's a newline */ putc('\n', stderr); } while ((file = file->parent) != NULL) { /* Print #includes, too */ if (file->fp == NULL) fprintf(stderr, "from macro %s\n", file->filename); else { tp = file->buffer; fprintf(stderr, "from file %s, line %d:\n%s", (file->progname != NULL) ? file->progname : file->filename, file->line, tp); if (tp[strlen(tp) - 1] != '\n') putc('\n', stderr); } } } cerror(format, sarg) char *format; char *sarg; /* Single string argument */ /* * Print a normal error message, string argument. */ { domsg("SError", format, sarg); errors++; } cierror(format, narg) char *format; int narg; /* Single numeric argument */ /* * Print a normal error message, numeric argument. */ { domsg("IError", format, (char *) narg); errors++; } cfatal(format, sarg) char *format; char *sarg; /* Single string argument */ /* * A real disaster */ { domsg("SFatal error", format, sarg); exit(IO_ERROR); } cwarn(format, sarg) char *format; char *sarg; /* Single string argument */ /* * A non-fatal error, string argument. */ { domsg("SWarning", format, sarg); } ciwarn(format, narg) char *format; int narg; /* Single numeric argument */ /* * A non-fatal error, numeric argument. */ { domsg("IWarning", format, (char *) narg); } z88dk-1.8.ds1/src/cpp/cppdef.h0000644000175000017500000000774707634131646015520 0ustar tygrystygrys#define TRUE 1 #define FALSE 0 #define SYS_UNKNOWN 0 #define SYS_UNIX 1 #define SYS_VMS 2 #define SYS_RSX 3 #define SYS_RT11 4 #define SYS_LATTICE 5 #define SYS_ONYX 6 #define SYS_68000 7 #define HOST SYS_UNIX #define TARGET SYS_UNIX #define LINE_PREFIX "" #define MSG_PREFIX "cpp: " #define FILE_LOCAL #define OK_DOLLAR FALSE #define OK_CONCAT TRUE /* * RECURSION_LIMIT may be set to -1 to disable the macro recursion test. */ #ifndef RECURSION_LIMIT #define RECURSION_LIMIT 1000 #endif /* * BITS_CHAR may be defined to set the number of bits per character. * it is needed only for multi-byte character constants. */ #ifndef BITS_CHAR #define BITS_CHAR 8 #endif /* * BIG_ENDIAN is set TRUE on machines (such as the IBM 360 series) * where 'ab' stores 'a' in the high-bits and 'b' in the low-bits. * It is set FALSE on machines (such as the PDP-11 and Vax-11) * where 'ab' stores 'a' in the low-bits and 'b' in the high-bits. * (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested. */ #ifndef BIG_ENDIAN #define BIG_ENDIAN FALSE #endif /* * COMMENT_INVISIBLE may be defined to allow "old-style" comment * processing, whereby the comment becomes a zero-length token * delimiter. This permitted tokens to be concatenated in macro * expansions. This was removed from the Draft Ansi Standard. */ #ifndef COMMENT_INVISIBLE #define COMMENT_INVISIBLE FALSE #endif /* * STRING_FORMAL may be defined to allow recognition of macro parameters * anywhere in replacement strings. This was removed from the Draft Ansi * Standard and a limited recognition capability added. */ #ifndef STRING_FORMAL #define STRING_FORMAL FALSE #endif /* * OK_DOLLAR enables use of $ as a valid "letter" in identifiers. * This is a permitted extension to the Ansi Standard and is required * for e.g., VMS, RSX-11M, etc. It should be set FALSE if cpp is * used to preprocess assembler source on Unix systems. OLD_PREPROCESSOR * sets OK_DOLLAR FALSE for that reason. */ #ifndef OK_DOLLAR #define OK_DOLLAR TRUE #endif /* * OK_CONCAT enables (one possible implementation of) token concatenation. * If cpp is used to preprocess Unix assembler source, this should be * set FALSE as the concatenation character, #, is used by the assembler. */ #ifndef OK_CONCAT #define OK_CONCAT TRUE #endif /* * OK_DATE may be enabled to predefine today's date as a string * at the start of each compilation. This is apparently not permitted * by the Draft Ansi Standard. */ #ifndef OK_DATE #define OK_DATE TRUE #endif /* * Some common definitions. */ #ifndef DEBUG #define DEBUG FALSE #endif /* * The following definitions are used to allocate memory for * work buffers. In general, they should not be modified * by implementors. * * PAR_MAC The maximum number of #define parameters (31 per Standard) * Note: we need another one for strings. * IDMAX The longest identifier, 31 per Ansi Standard * NBUFF Input buffer size * NWORK Work buffer size -- the longest macro * must fit here after expansion. * NEXP The nesting depth of #if expressions * NINCLUDE The number of directories that may be specified * on a per-system basis, or by the -I option. * BLK_NEST The number of nested #if's permitted. */ #ifndef IDMAX #define IDMAX 31 #endif #define PAR_MAC (31 + 1) #define NBUFF 4096 #define NWORK 4096 #define NEXP 128 #define NINCLUDE 15 #define NPARMWORK (NWORK * 2) #define BLK_NEST 32 /* * Some special constants. These may need to be changed if cpp * is ported to a wierd machine. * * NOTE: if cpp is run on a non-ascii machine, ALERT and VT may * need to be changed. They are used to implement the proposed * ANSI standard C control characters '\a' and '\v' only. * DEL is used to tag macro tokens to prevent #define foo foo * from looping. Note that we don't try to prevent more elaborate * #define loops from occurring. */ #ifndef ALERT #define ALERT '\007' /* '\a' is "Bell" */ #endif #ifndef VT #define VT '\013' /* Vertical Tab CTRL/K */ #endif z88dk-1.8.ds1/src/cpp/Makefile0000644000175000017500000000052507575162711015532 0ustar tygrystygrys OBJS=cpp1.o cpp2.o cpp3.o cpp4.o cpp5.o cpp6.o zcpp:$(OBJS) $(CC) $(LDFLAGS) -o zcpp $(OBJS) cpp1.o:cpp1.c cpp.h cppdef.h cpp2.o:cpp2.c cpp.h cppdef.h cpp3.o:cpp3.c cpp.h cppdef.h cpp4.o:cpp4.c cpp.h cppdef.h cpp5.o:cpp5.c cpp.h cppdef.h cpp6.o:cpp6.c cpp.h cppdef.h install: install zcpp $(PREFIX)/bin clean: $(RM) *.o core *~ zcpp z88dk-1.8.ds1/src/cpp/vscmake.bat0000644000175000017500000000032710537314617016207 0ustar tygrystygrys@echo off rem $Id: vscmake.bat,v 1.3 2006/12/11 17:46:55 stefano Exp $ echo **************** echo * Building cpp * echo **************** cl /Fezcpp -D _CRT_SECURE_NO_DEPRECATE *.c move zcpp.exe ..\..\bin del *.obj z88dk-1.8.ds1/src/cpp/zcpp.vcproj0000755000175000017500000001027110762606650016272 0ustar tygrystygrys z88dk-1.8.ds1/src/sccz80/0000755000175000017500000000000010765202715014412 5ustar tygrystygrysz88dk-1.8.ds1/src/sccz80/callfunc.c0000644000175000017500000002334510637501441016350 0ustar tygrystygrys/* * Small C+ Compiler * * Perform a function call * * $Id: callfunc.c,v 1.6 2007/06/24 14:43:45 dom Exp $ */ /* * Local functions */ static int SetWatch(char *sym); static int SetMiniFunc(unsigned char *arg); /* * External variables used */ extern int smartprintf; /* * Perform a function call * * called from heirb, this routine will either call * the named function, or if the supplied ptr is * zero, will call the contents of HL */ #include "ccdefs.h" void callfunction(SYMBOL *ptr) { int nargs, vconst, val,expr,argnumber ; int watcharg; /* For watching printf etc */ unsigned char minifunc; /* Call cut down version */ unsigned char protoarg; char preserve; /* Preserve af when cleaningup */ nargs=0; preserve=argnumber=0; watcharg=minifunc=0; blanks(); /* already saw open paren */ /* * djm, another fabulous kludge!! * we don't check return types or anything..beautiful!! */ if (ptr && (strcmp(ptr->name,"asm")==0) ) { /* We're calling asm("code") */ doasmfunc(NO); return; } if (ptr && smartprintf) watcharg=SetWatch(ptr->name); while ( ch() != ')' ) { if(endst())break; argnumber++; if ( ptr ) { /* ordinary call */ expr=expression(&vconst, &val); if ( expr == CARRY ) { zcarryconv(); expr = CINT; } if (ptr->prototyped && (ptr->prototyped >= argnumber) ) { protoarg=ptr->args[ptr->prototyped-argnumber+1]; if ( (protoarg!=PELLIPSES) && ( (protoarg != fnargvalue) || ((protoarg&7)==STRUCT) ) ) expr=ForceArgs(protoarg,fnargvalue,expr,ptr->tagarg[ptr->prototyped-argnumber+1]); } if ( (ptr->flags®CALL) && ptr->prototyped==1 ) { /* fastcall of single expression */ } else { if (argnumber==watcharg) { if (ptr) debug(DBG_ARG1,"Caughtarg!! %s",litq+val+1); minifunc=SetMiniFunc(litq+val+1); } if (expr==DOUBLE) { dpush(); nargs += 6; } /* Longs and (ahem) long pointers! */ else if (expr == LONG || expr == CPTR || (expr==POINTER && lpointer)) { if (!(fnflags&FARPTR) && expr != LONG ) const2(0); lpush(); nargs += 4; } else { zpush(); nargs += 2; } } } else { /* call to address in HL */ /* * What do you do about longs also long pointers, need to push under * stack...hmmmmm: parse for LONG & CPTR push onto stk * then check if doubles...should work. */ zpush(); /* Push address */ expr=expression(&vconst, &val); if ( expr == CARRY ) { zcarryconv(); expr = CINT; } if (expr == LONG || expr == CPTR || (expr==POINTER && lpointer) ) { swap(); /* MSW -> hl */ swapstk(); /* MSW -> stack, addr -> hl */ zpushde(); /* LSW -> stack, addr = hl */ nargs += 4; } else if (expr==DOUBLE) { dpush2(); nargs += 6; swapstk(); } else { /* If we've only got one 2 byte argment, don't swap the stack */ if ( rcmatch(',') || nargs != 0 ) { swapstk(); } nargs += 2; } } if (cmatch(',')==0) break; } needchar(')'); if (ptr) debug(DBG_ARG2,"arg %d proto %d",argnumber,ptr->args[1]); if (ptr && ( ptr->prototyped != 0 )) { if ( (ptr->prototyped > argnumber) && (ptr->args[1]!=PVOID) && (ptr->args[1] !=PELLIPSES) ) { warning(W_2FAFUNC); } else if ( (ptr->prototyped < argnumber) && (ptr->args[1]!=PELLIPSES)) { warning(W_2MAFUNC); } } if ( ptr ) { /* Check to see if we have a variable number of arguments */ if ( (ptr->prototyped) && ptr->args[1]==PELLIPSES ) { loadargc(nargs) ; } /* Watch arguments */ if (watcharg || (ptr->flags&SHARED) || (ptr->flags&SHAREDC) ) { if ( (ptr->flags&SHARED) || (ptr->flags&SHAREDC)) preserve=YES; if (ptr->flags&SHAREDC) zclibcallop(); else zcallop(); switch(minifunc) { case 1: /* Mini function */ break; case 3: /* Fp function */ warning(W_FLTPRINTF); } if (minifunc > printflevel) printflevel=minifunc; outname(ptr->name,dopref(ptr)); if ( (ptr->flags&SHARED) && useshare ) outstr("_sl"); else if (ptr->flags&SHAREDC) outstr("_rst"); nl(); } else zcall(ptr) ; } else { callstk(nargs); } /* * Modify the stack after a function call * * We should modify stack if: * - __CALLEE__ isn't set * - Function is __LIB__ even if compactcode is set * - compactcode isn't set and __CALLEE__ isn't set */ if ( (ptr && ptr->flags&CALLEE) || (compactcode && ptr == NULL) || (compactcode && ( (ptr->flags&LIBRARY) == 0) ) ) { Zsp+=nargs; } else { /* If we have a frame pointer then ix holds it */ #ifdef USEFRAME if (useframe) { if (nargs) RestoreSP(preserve); Zsp+=nargs; } else #endif Zsp=modstk(Zsp+nargs,YES,preserve); /* clean up arguments - we know what type is MOOK */ } } /* * Watcharg, return number of argument to watch - for printf etc */ static int SetWatch(char *sym) { if ( strcmp(sym,"printf") == 0 ) return 1; if ( strcmp(sym,"fprintf") == 0 ) return 2; if ( strcmp(sym,"sprintf") == 0 ) return 2; if ( strcmp(sym,"vprintf") == 0 ) return 1; if ( strcmp(sym,"vfprintf") == 0 ) return 2; if ( strcmp(sym,"vsprintf") == 0 ) return 2; return 0; } /* * djm routine to force arguments to switch type */ int ForceArgs(char dest, char src,int expr, char functab) { char did, dtype, disfar, dissign; char sid, stype, sisfar, sissign; char buffer[80]; dtype=dest&7; /* Lower 3 bits */ did=(dest&56)/8; /* Middle 3 bits */ disfar=(dest&128); dissign=(dest&64); stype=src&7; /* Lower 3 bits */ sid=(src&56)/8; /* Middle 3 bits */ sisfar=(src&128); sissign=(src&64); /* * These checks need to be slightly more comprehensive me thinks */ if (did == VARIABLE) { if ( sid == VARIABLE ) { force(dtype,stype,dissign,sissign,0); } else { /* * Converting pointer to integer/long */ warning(W_PTRINT); /* Pointer is always unsigned */ force(dtype,( ( sisfar ) ? CPTR : CINT ),dissign,0,0); } if (dtype == CCHAR ) expr=CINT; else expr=dtype; } else { /* Dealing with pointers.. a type mismatch!*/ if ( ( (dtype != stype) && ( dtype != VOID) && (stype != VOID) && (stype != CPTR) ) || ( (dtype==stype) && (margtag != functab) ) ) { debug(DBG_ARG3,"dtype=%d stype=%d margtab=%d functag=%d",dtype,stype,margtag,functab); warning(W_PRELIM,currfn->name,lineno-fnstart); warning(W_PTRTYP); ExpandArgValue(dest,buffer,functab); warning(W_PTRTYP1,buffer); ExpandArgValue(src,buffer,margtag); warning(W_PTRTYP2,buffer); } else if ( dtype==stype && did != sid ) { warning(W_INTPTR); expr=CINT; } if ( disfar ) { if ( disfar != sisfar ) { /* Widening a pointer - next line unneeded - done elsewhere*/ /* const2(0); */ expr=CPTR; } } else { /* destintation is near pointer */ if ( disfar != sisfar ) { warning(W_PRELIM,currfn->name,lineno-fnstart); warning(W_FARNR); expr=CINT; } } } return(expr); } /* Short routine to determine what printf version we need - mini * standard or floating (not written yet!) */ static int SetMiniFunc(unsigned char *arg) { char c; char complex; complex=1; /* mini printf */ while ( (c=*arg++) ) { if (c != '%' ) continue; if (*arg == '%' ) {arg++; continue; } if ( *arg == '-' || *arg == '0' || *arg=='+' || *arg==' ' ) { if (complex <= 2 ) complex=2; /* Switch to standard */ while ( (c=*arg++) ) if (c=='d' || c=='i' || c=='o' || c=='u' || c=='c' || c=='s' || c=='e' || c=='E' || c=='f' || c=='g' || c=='G' || c=='p' || c=='n' ) break; } switch(*arg) { case 'e': case 'E': case 'f': case 'g': case 'G': complex=3; break; case 'o': case 'i': case 'p': case 'n': case 'x': if (complex<=2) complex=2; break; } } return(complex); } z88dk-1.8.ds1/src/sccz80/callfunc.h0000644000175000017500000000023607130401712016341 0ustar tygrystygrys/* callfunction.c */ extern void callfunction(SYMBOL *ptr); extern int nospread(char *sym); extern int ForceArgs(char dest, char src, int expr, char tagtab); z88dk-1.8.ds1/src/sccz80/ccdefs.h0000644000175000017500000000167107130401712016005 0ustar tygrystygrys/* * Small C+ Compiler * * The master header file * Includes everything else!!! * * $Id: ccdefs.h,v 1.1.1.1 2000/07/04 15:33:30 dom Exp $ */ /* * System wide definitions */ #include "define.h" #include "lvalue.h" /* * Now the fix for HP-UX * Darn short filename filesystems! */ #ifdef hpux #define FILENAME_LEN 1024 #else #define FILENAME_LEN FILENAME_MAX #endif /* * Now some system files for good luck */ #include #include #include #include /* * Prototypes */ #include "callfunc.h" #include "codegen.h" #include "const.h" #include "data.h" #include "declvar.h" #include "declfunc.h" #include "declinit.h" #include "error.h" #include "expr.h" #include "float.h" #include "io.h" #include "lex.h" #include "main.h" #include "misc.h" #include "plunge.h" #include "preproc.h" #include "primary.h" #include "stmt.h" #include "sym.h" #include "while.h" z88dk-1.8.ds1/src/sccz80/codegen.c0000644000175000017500000012471610637501441016171 0ustar tygrystygrys/* * Small C+ Compiler * * Z80 Code Generator * * $Id: codegen.c,v 1.23 2007/06/24 14:43:45 dom Exp $ * * 21/4/99 djm * Added some conditional code for tests of zero with a char, the * expand char to int code will be removed at optimizatin stage * * 22/4/99 djm * Major rewrite!! All operations have one single routine now * so the compile might actually run quicker, and uses less * of those dodgy pointers to functions * * 23/4/99 djm * With a bit of luck this file will no contain all assembler * related output, this means that if Gunther gets macros worked * into z80asm, we can change the output of the compiler to be * macros which we can then optimize a lot easier..hazzah! */ #include "ccdefs.h" #include extern int WasComp(LVALUE *lval); extern char Filenorig[]; /* * Data for this module */ int donelibheader; void constbc(long val); /* Begin a comment line for the assembler */ void comment(void) { outbyte(';'); } /* Put out assembler info before any code is generated */ void header(void) { time_t tim; char *timestr; comment(); outstr(Banner); nl(); comment(); outstr(Version); nl(); comment(); nl(); if (asxx) outstr(";\tReconstucted for asz80\n"); else outstr (";\tReconstructed for the z80 Module Assembler\n"); donelibheader=0; if ( (tim=time(NULL) ) != -1 ) { timestr=ctime(&tim); comment(); nl(); comment(); outstr("\tModule compile time: "); outstr(timestr); nl(); } nl(); } /* * Print the header for a library function, called from the preprocessor! */ void DoLibHeader(void) { char filen[FILENAME_LEN+1]; char *incdir; char *segment; if (donelibheader) return; /* * Copy filename over (obtained by preprocessor), carefully skipping * over the quotes! */ strncpy(filen,Filename+1,strlen(Filename)-2); filen[strlen(Filename)-1]='\0'; if (makelib==0) { /* Compiling a program */ if (asxx) outstr("\n\t.module\t"); else outstr ("\n\tMODULE\t"); if (strlen (filen) && strncmp(filen,"",7) ) { changesuffix(filen,".c"); if ( (segment=strrchr(filen,'/')) ) /* Unix */ ++segment; else if ( (segment=strrchr(filen,'\\')) ) /*DOG*/ segment++; else if ( (segment=strrchr(filen,':')) )/*Amiga*/ segment++; else segment=filen; outstr(segment); } else { /* This handles files produced by a filter cpp */ strcpy(filen,Filenorig); if ( (segment=strrchr(filen,'/')) ) /* Unix */ ++segment; else if ( (segment=strrchr(filen,'\\')) ) /*DOG*/ segment++; else if ( (segment=strrchr(filen,':')) )/*Amiga*/ segment++; else segment=filen; changesuffix(filen,".c"); outstr("scp_"); /* alpha id incase tmpfile is numeric */ outstr(segment); } } else { /* Library function */ outstr("\n;\tSmall C+ Library Function\n"); changesuffix(filen,""); if (asxx) outstr("\n\t.globl\t"); else outstr("\n\tXLIB\t"); outstr(filen); } if (asxx) { incdir=getenv("Z80_OZFILES"); outstr("\n\n\t.include \""); if (incdir) outstr(incdir); outstr("z80_crt0.hdx\"\n\n"); ol(".area _CODE\n"); ol(".radix d\n"); if ( noaltreg ) { ol(".globl\tsaved_hl"); ol(".globl\tsaved_de"); } } else { outstr("\n\n\tINCLUDE \"#z80_crt0.hdr\"\n\n\n"); if ( noaltreg ) { ol("XREF\tsaved_hl"); ol("XREF\tsaved_de"); } } donelibheader=1; } /* Print any assembler stuff needed after all code */ void trailer(void) { nl(); outstr("; --- End of Compilation ---\n"); } /* Print out a name such that it won't annoy the assembler * (by matching anything reserved, like opcodes.) */ void outname(char *sname,char pref) { int i ; if (pref) { if (asxx) outstr("_"); else outstr(Z80ASM_PREFIX); } if ( strlen(sname) > ASMLEN ) { i = ASMLEN; while ( i-- ) outbyte(toupper(*sname++)); } else outstr(sname); } /* Fetch a static memory cell into the primary register */ /* Can only have directly accessible things here...so should be * able to just check for far to see if we need to pick up second * bit of long pointer (check for type POINTER as well... */ void getmem(SYMBOL *sym) { if( sym->ident != POINTER && sym->type == CCHAR ) { if (!(sym->flags&UNSIGNED)) { #ifdef PREAPR00 ot("ld\ta,("); outname(sym->name,dopref(sym)); outstr(")\n"); callrts("l_sxt"); #else ot("ld\thl,"); outname(sym->name,dopref(sym)); nl(); callrts("l_gchar"); #endif } else { /* Unsigned char - new method - allows more optimizations! */ ot("ld\thl,"); outname(sym->name,dopref(sym)); nl(); ol("ld\tl,(hl)"); ol("ld\th,0"); } #ifdef OLDLOADCHAR ot("ld\ta,("); outname(sym->name,dopref(sym)); outstr(")\n"); if (!(sym->flags&UNSIGNED)) callrts("l_sxt"); else { ol("ld\tl,a"); ol("ld\th,0"); } #endif } else if( sym->ident != POINTER && sym->type == DOUBLE ) { address(sym); callrts("dload"); } else if (sym->ident !=POINTER && sym->type == LONG ) { ot("ld\thl,(");outname(sym->name,dopref(sym)); outstr(")\n"); ot("ld\tde,(");outname(sym->name,dopref(sym)); outstr("+2)\n"); } else { /* this is for CINT and get pointer..will need to change! */ ot("ld\thl,("); outname(sym->name,dopref(sym)); outstr(")\n"); /* For long pointers...load de with name+2, then d,0 */ if (sym->type==CPTR || (sym->ident==POINTER && sym->flags&FARPTR)) { ot("ld\tde,("); outname(sym->name,dopref(sym)); outstr("+2)\n\tld\td,0\n"); } } } /* Fetch the address of the specified symbol (from stack) */ int getloc(SYMBOL *sym, int off) { int offs; offs=sym->offset.i-Zsp+off; vconst(offs); ol("add\thl,sp"); return (offs); } /* Store the primary register into the specified */ /* static memory cell */ void putmem(SYMBOL *sym) { if( sym->ident != POINTER && sym->type == DOUBLE ) { address(sym); callrts("dstore"); } else { if( sym->ident != POINTER && sym->type == CCHAR ) { LoadAccum(); ot("ld\t("); outname(sym->name,dopref(sym)); outstr("),a\n"); } else if (sym ->ident != POINTER && sym->type == LONG ) { ot("ld\t("); outname(sym->name,dopref(sym)); outstr("),hl\n"); ot("ld\t("); outname(sym->name,dopref(sym)); outstr("+2),de\n"); } else if (sym->ident == POINTER && sym->flags&FARPTR) { ot("ld\t("); outname(sym->name,dopref(sym)); outstr("),hl\n"); ol("ld\ta,e"); ot("ld\t("); outname(sym->name,dopref(sym)); outstr("+2),a\n"); } else { ot("ld\t("); outname(sym->name,dopref(sym)); outstr("),hl\n"); } } } /* * Store type at TOS - used for initialising auto vars */ void StoreTOS(char typeobj) { switch (typeobj) { case LONG: lpush(); return; case CCHAR: ol("dec\tsp"); LoadAccum(); mainpop(); ol("ld\tl,a"); zpush(); Zsp--; return; case DOUBLE: dpush(); return; /* CPTR..untested */ case CPTR: ol("dec\tsp"); ol("ld\ta,e"); zpop(); /* pop de */ ol("ld\te,a"); zpushde(); zpush(); Zsp--; return; default: zpush(); return; } } /* * Store the object at the frame position marked by offset * We already know that it's in range */ #ifdef USEFRAME void PutFrame(char typeobj, int offset) { SYMBOL *ptr; char flags; ptr=retrstk(&flags); /* Not needed but.. */ switch(typeobj) { case CCHAR: ot("ld\t"); OutIndex(offset); outstr(",l\n"); break; case CINT: ot("ld\t"); OutIndex(offset); outstr(",l\n"); ot("ld\t"); OutIndex(offset+1); outstr(",h\n"); break; case CPTR: case LONG: ot("ld\t"); OutIndex(offset); outstr(",l\n"); ot("ld\t"); OutIndex(offset+1); outstr(",h\n"); ot("ld\t"); OutIndex(offset+2); outstr(",e\n"); ot("ld\t"); if (typeobj == LONG) { OutIndex(offset+3); outstr(",d\n"); } } } #endif /* Store the specified object type in the primary register */ /* at the address on the top of the stack */ void putstk(char typeobj) { SYMBOL *ptr; char flags; /* Store via long pointer... */ ptr=retrstk(&flags); if ( flags&FARACC ) { /* exx pop hl, pop de, exx */ doexx(); mainpop(); zpop(); doexx(); switch( typeobj ) { case DOUBLE: callrts("lp_pdoub"); break; case CPTR : callrts("lp_pptr"); break; case LONG : callrts("lp_plong"); break; case CCHAR : callrts("lp_pchar"); break; default: callrts("lp_pint"); } return; } switch ( typeobj ) { case DOUBLE : mainpop(); callrts("dstore"); break ; case CPTR : zpopbc(); callrts("l_putptr"); break; case LONG : zpopbc(); callrts("l_plong"); break ; case CCHAR : zpop(); LoadAccum(); ol("ld\t(de),a"); break ; default : zpop(); if (doinline) { LoadAccum(); ol("ld\t(de),a"); ol("inc\tde"); ol("ld\ta,h"); ol("ld\t(de),a"); } else callrts("l_pint"); } } /* store a two byte object in the primary register at TOS */ void puttos(void) { #ifdef USEFRAME if (useframe) { ot("ld\t"); OutIndex(0); outstr(",l\n"); ot("ld\t"); OutIndex(1); outstr(",h\n"); return; } #endif ol("pop\tbc"); ol("push\thl"); } /* store a two byte object in the primary register at 2nd TOS */ void put2tos(void) { #ifdef USEFRAME if (useframe) { ot("ld\t"); OutIndex(2); outstr(",l\n"); ot("ld\t"); OutIndex(3); outstr(",h\n"); return; } #endif ol("pop\tde"); puttos(); ol("push\tde"); } /* * loadargc - load accumulator with number of words of stack * if n=0 then emit xor a instead of ld a,0 * (this is picked up by the optimizer, but even so) */ void loadargc(int n) { n >>= 1; if ( n ) { ot("ld\ta," ) ; outdec(n) ; nl(); } else ol("xor\ta"); } /* Fetch the specified object type indirect through the */ /* primary register into the primary register */ void indirect(LVALUE *lval) { char sign; char typeobj, flags; typeobj=lval->indirect; flags=lval->flags; sign=flags&UNSIGNED; /* Fetch from far pointer */ if (flags&FARACC) { /* Access via far method */ switch(typeobj) { case CCHAR : callrts("lp_gchar"); if (!sign) callrts("l_sxt"); /* else ol("ld\th,0"); */ break; case CPTR: callrts("lp_gptr"); break; case LONG: callrts("lp_glong"); break; case DOUBLE: callrts("lp_gdoub"); break; default: callrts("lp_gint"); } return; } switch ( typeobj ) { case CCHAR : if (!sign) { #ifdef PREAPR00 ol("ld\ta,(hl)"); callrts("l_sxt"); #else callrts("l_gchar"); #endif } else { ol("ld\tl,(hl)"); ol("ld\th,0"); } break ; case CPTR : callrts("l_getptr"); break; case LONG : callrts("l_glong"); break; case DOUBLE : callrts("dload"); break ; default : if (doinline) { ol("ld\ta,(hl)"); ol("inc\thl"); ol("ld\th,(hl)"); ol("ld\tl,a"); } else { ot("call\tl_gint\t;"); #ifdef USEFRAME if (useframe && CheckOffset(lval->offset)) { OutIndex(lval->offset); } #endif nl(); } } } /* Swap the primary and secondary registers */ void swap(void) { ol("ex\tde,hl"); } /* Print partial instruction to get an immediate value */ /* into the primary register */ void immed(void) { if (asxx) ot("ld\thl,#"); else ot("ld\thl,"); } /* Print partial instruction to get an immediate value */ /* into the secondary register */ void immed2(void) { if (asxx) ot("ld\tde,#"); else ot("ld\tde,"); } /* Partial instruction to access literal */ void immedlit(int lab) { immed(); queuelabel(lab); outbyte('+'); } /* Push long onto stack */ void lpush(void) { zpushde(); zpush(); } void lpush2(void) { callrts("lpush2"); Zsp-=4; } /* Push and pop flags (used for ? operator) */ void zpushflags(void) { ol("push\taf"); Zsp -=2; } void zpopflags(void) { ol("pop\taf"); Zsp +=2; } /* Push secondary register/high work of long onto the stack */ void zpushde(void) { ol("push\tde"); Zsp -= 2; } /* Push the primary register onto the stack */ void zpush(void) { ol("push\thl"); Zsp -= 2; } /* Push the primary floating point register onto the stack */ void dpush(void) { callrts("dpush"); Zsp -= 6; } /* Push the primary floating point register, preserving the top value */ void dpush2(void) { callrts("dpush2"); Zsp -= 6; } /* Pop the top of the stack into the primary register */ void mainpop(void) { ol("pop\thl"); Zsp += 2; } /* Pop the top of the stack into the secondary register */ void zpop(void) { ol("pop\tde"); Zsp += 2; } /* Pop top of stack into bc */ void zpopbc(void) { ol("pop\tbc"); Zsp += 2; } /* Swap af & af' (preserve carry) */ void doexaf(void) { ol("ex\taf,af"); } /* Swap between the sets of registers */ void doexx(void) { ol("exx"); } /* Swap the primary register and the top of the stack */ void swapstk(void) { ol("ex\t(sp),hl"); } /* process switch statement */ void sw(char type) { if (type==LONG || type==CPTR) callrts("l_long_case"); else callrts("l_case"); } /* Call a shared library routine FIXME!!!! * Dunno which one myself and Garry are gonna hijack yet! */ void zclibcallop() { ol("rst\t8"); defword(); } /* Call the specified subroutine name */ void zcall(SYMBOL *sname) { zcallop(); outname(sname->name,dopref(sname)); nl(); } /* Output the call op code */ void zcallop(void) { ot("call\t"); } /* djm (move this!) Decide whether to print a prefix or not * This uses new flags bit LIBRARY */ char dopref(SYMBOL *sym) { if (sym->flags&LIBRARY && (sym->ident == FUNCTION || sym->ident == FUNCTIONP)) return(0); if ( sym->storage == LIBOVER ) return(0); return(1); } /* Call a run-time library routine */ void callrts(char *sname) { ot("call\t"); outstr(sname); nl(); } /* Return from subroutine */ void zret(void) { ol("ret"); nl(); nl(); } /* * Perform subroutine call to value on top of stack * Put arg count in A in case subroutine needs it */ void callstk(int n) { if ( n == 2 ) { /* At this point, TOS = function, hl = argument */ int label = getlabel(); ol("pop\tde"); /* function */ outstr("\tld\tbc,"); /* ret address */ printlabel(label); nl(); /* Argument in hl, on stack */ ol("push\thl"); ol("push\tbc"); /* Return address */ ol("push\tde"); loadargc(n); ol("ret"); postlabel(label); } else { loadargc(n) ; callrts( "l_dcal" ) ; } } void jump0(LVALUE *lval,int label) { opjump("",label); } /* Jump to specified internal label number */ void jump(int label) { opjump("",label); } /* Jump relative to specified internal label */ void jumpr(int label) { opjumpr("",label); } /* * Output the jump code, with conditions as needed */ void opjump(char *cc, int label) { ot("jp\t"); outstr(cc); printlabel(label); nl(); } void opjumpr(char *cc, int label) { ot("jr\t"); outstr(cc); printlabel(label); nl(); } void jumpc(int label) { opjump("c,",label); } void jumpnc(int label) { opjump("nc,",label); } void setcond(int val) { if (val == 1 ) ol("scf"); else ol("and\ta"); } /* Test the primary register and jump if false to label */ void testjump(LVALUE *lval,int label) { int type; ol("ld\ta,h"); ol("or\tl"); type = lval->oldval_type; if ( lval->binop == NULL ) type = lval->val_type; if ( type == LONG && WasComp(lval) ) { ol("or\td"); ol("or\te"); } if ( type == CPTR && WasComp(lval) ) { ol("or\te"); } opjump("z,",label); } /* test primary register against zero and jump if false */ /* Special conditions for testing char here */ void zerojump( void (*oper)(LVALUE *,int), int label, LVALUE *lval) { clearstage(lval->stage_add, 0) ; /* purge conventional code */ #ifdef CHARCOMP0 if (lval->oldval_type == CCHAR ) { if (oper==testjump ) { /* !=0 or >=0U */ LoadAccum(); ol("and\ta"); opjump("z,",label); return; } else if (oper==le0) { /* <=0 */ LoadAccum(); ol("and\ta"); ol("jr\tz,ASMPC+5"); opjump("p,",label); return; } else if (oper==ge0 ) { /* > 0 */ LoadAccum(); ol("and\ta"); opjump("m,",label); return; } else if (oper==gt0 ) { LoadAccum(); ol("and\ta"); opjump("m,",label); opjump("z,",label); return; } } #endif (*oper)(lval,label) ; } /* Print pseudo-op to define a byte */ void defbyte(void) { if (asxx) ot(".db\t"); else ot("defb\t"); } /*Print pseudo-op to define storage */ void defstorage(void) { if (asxx) ot(".ds\t"); else ot("defs\t"); } /* Print pseudo-op to define a word */ void defword(void) { if (asxx) ot(".dw\t"); else ot("defw\t"); } /* Print pseudo-op to dump a long */ void deflong(void) { ot("defl\t"); } /* Print pseudo-op to define a string */ void defmesg(void) { if (asxx) ot(".ascii\t\""); else ot("defm\t\""); } /* Point to following object */ void point(void) { if (asxx) ol(".dw\t.+2"); else ol("defw\tASMPC+2"); } /* Modify the stack pointer to the new value indicated */ int modstk(int newsp,int save,int saveaf) /* newsp - if true save hl; save - preserve contents of af */ { int k,flag=NO; k = newsp - Zsp ; if ( k == 0 ) return newsp ; /* Yes this goto could be an if but this is a dev compiler! */ #ifdef USEFRAME if (useframe) goto modstkcht; #endif if ( k > 0 ) { if ( k < 11 ) { if ( k & 1 ) { ol("inc\tsp") ; --k ; } while ( k ) { ol("pop\tbc"); k -= 2 ; } return newsp; } } if ( k < 0 ) { if ( k > -11 ) { if ( k & 1 ) { flag=YES; ++k ; } while ( k ) { ol("push\tbc"); k += 2 ; } if (flag) ol("dec\tsp") ; return newsp; } } /* * These doexx() where swap() but if we return a long then we've fubarred * up! */ modstkcht: if (saveaf) { if ( noaltreg ) { zpushflags(); zpopbc(); } else { doexaf(); } } #ifdef USEFRAME if (useframe) { ot("ld\t"); FrameP(); outstr(","); outdec(k); nl(); ot("add\t"); FrameP(); outstr(",sp\n"); RestoreSP(NO); } else { if ( save ) doexx() ; vconst(k) ; ol("add\thl,sp"); ol("ld\tsp,hl"); if ( save ) doexx() ; } #else if ( save ) doexx() ; vconst(k) ; ol("add\thl,sp"); ol("ld\tsp,hl"); if ( save ) doexx() ; #endif if (saveaf) { if ( noaltreg ) { ol("push\tbc"); Zsp -= 2; zpopflags(); } else { doexaf(); } } return newsp ; } /* Multiply the primary register by the length of some variable */ void scale(int type,TAG_SYMBOL *tag) { switch ( type ) { case CINT : doublereg() ; break ; case CPTR : threereg() ; break ; case LONG : doublereg(); doublereg(); break; case DOUBLE : sixreg() ; break ; case STRUCT : /* try to avoid multiplying if possible */ quikmult(tag->size,YES); } } void quikmult(int size,char preserve) { switch (size) { case 16 : doublereg() ; case 8 : doublereg() ; case 4 : doublereg() ; case 2 : doublereg() ; break ; case 12 : doublereg() ; case 6 : sixreg() ; break ; case 9 : threereg() ; case 3 : threereg() ; break ; case 15 : threereg() ; case 5 : fivereg() ; break ; case 10 : fivereg() ; doublereg() ; break ; case 14 : doublereg() ; case 7 : sixreg() ; addbc() ; /* BC contains original value */ break ; default : if (preserve) ol("push\tde") ; const2(size) ; callrts("l_mult"); /* WATCH OUT!! */ if (preserve) ol("pop\tde") ; break ; } } /* add BC to the primary register */ void addbc(void) { ol("add\thl,bc") ; } /* load BC from the primary register */ void ldbc(void) { ol("ld\tb,h") ; ol("ld\tc,l") ; } /* Double the primary register */ void doublereg(void) { ol("add\thl,hl"); } /* Multiply the primary register by three */ void threereg(void) { ldbc() ; addbc() ; addbc() ; } /* Multiply the primary register by five */ void fivereg(void) { ldbc() ; doublereg() ; doublereg() ; addbc() ; } /* Multiply the primary register by six */ void sixreg(void) { threereg() ; doublereg() ; } /* * New routines start here! What we do is have a single routine for * each operation type, the routine takes an lval, and it all works * out well..honest! */ /* Add the primary and secondary registers (result in primary) */ void zadd(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_long_add"); Zsp +=4; break; case DOUBLE: callrts("dadd"); Zsp += 6; break; default: ol("add\thl,de"); } } /* Subtract the primary register from the secondary */ /* (results in primary) */ void zsub(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_long_sub"); Zsp +=4; break; case DOUBLE: callrts("dsub"); Zsp += 6; break; default: callrts("l_sub"); } } /* Multiply the primary and secondary registers */ /* (results in primary */ void mult(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_long_mult"); Zsp +=4; break; case DOUBLE: callrts("dmul"); Zsp += 6; break; default: callrts("l_mult"); } } /* Divide the secondary register by the primary */ /* (quotient in primary, remainder in secondary) */ void zdiv(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: if (utype(lval)) callrts("l_long_div_u"); else callrts("l_long_div"); Zsp +=4; break; case DOUBLE: callrts("ddiv"); Zsp += 6; break; default: if (utype(lval)) callrts("l_div_u"); else callrts("l_div"); } } /* Compute remainder (mod) of secondary register divided * by the primary * (remainder in primary, quotient in secondary) */ void zmod(LVALUE *lval) { if ( noaltreg && ( lval->val_type == LONG || lval->val_type == CPTR ) ) { callrts("l_long_mod2"); } else { zdiv(lval); if (lval->val_type == LONG || lval->val_type==CPTR) doexx(); else swap(); } } /* Inclusive 'or' the primary and secondary */ /* (results in primary) */ void zor(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_long_or"); Zsp +=4; break; default: callrts("l_or"); } } /* Exclusive 'or' the primary and secondary */ /* (results in primary) */ void zxor(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_long_xor"); Zsp +=4; break; default: callrts("l_xor"); } } /* 'And' the primary and secondary */ /* (results in primary) */ void zand(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_long_and"); Zsp +=4; break; default: callrts("l_and"); } } /* Arithmetic shift right the secondary register number of */ /* times in primary (results in primary) */ void asr(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: if (utype(lval)) callrts("l_long_asr_u"); else callrts("l_long_asr"); Zsp +=4; break; default: if (utype(lval)) callrts("l_asr_u"); else callrts("l_asr"); } } /* Arithmetic left shift the secondary register number of */ /* times in primary (results in primary) */ void asl(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_long_asl"); Zsp +=4; break; default: callrts("l_asl"); } } /* Form logical negation of primary register */ void lneg(LVALUE *lval) { lval->oldval_type = lval->val_type; switch(lval->val_type) { case LONG: case CPTR: lval->val_type = CINT; callrts("l_long_lneg"); break; case CARRY: lval->val_type = CARRY; ccf(); break; case DOUBLE: convdoub2int(); default: lval->val_type = CARRY; callrts("l_lneg"); } } /* Form two's complement of primary register */ void neg(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_long_neg"); break; case DOUBLE: callrts("minusfa"); break; default: callrts("l_neg"); } } /* Form one's complement of primary register */ void com(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_long_com"); break; default: callrts("l_com"); } } /* Complement the carry flag (used after arithmetic before !) */ void ccf(void) { ol("ccf"); } /* * Increment value held in main register */ void inc(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_inclong"); break; default: ol("inc\thl"); } } /* * Decrement value held in main register */ void dec(LVALUE *lval) { switch(lval->val_type) { case LONG: case CPTR: callrts("l_declong"); break; default: ol("dec\thl"); } } /* Following are the conditional operators */ /* They compare the secondary register against the primary */ /* and put a literal 1 in the primary if the condition is */ /* true, otherwise they clear the primary register */ void dummy(LVALUE *lval, int label) { /* Dummy function to allows us to check for c/nc at end of if clause */ } /* test for equal to zero */ void eq0(LVALUE *lval,int label) { WasComp(lval); switch(lval->oldval_type) { #ifdef CHARCOMP0 case CCHAR: ol("ld\ta,l"); ol("and\ta"); break; #endif case LONG: ol("ld\ta,h"); ol("or\tl"); ol("or\td"); ol("or\te"); break; case CPTR: ol("ld\ta,e"); ol("or\th"); ol("or\tl"); break; default: ol("ld\ta,h"); ol("or\tl"); } opjump("nz,",label); } void lt0(LVALUE *lval, int label) { switch(lval->oldval_type) { #ifdef CHARCOMP0 case CCHAR: ol("xor\ta"); ol("or\tl"); break; #endif case LONG: ol("xor\ta"); ol("or\td"); break; case CPTR: ol("xor\ta"); ol("or\te"); break; default: ol("xor\ta"); ol("or\th"); } opjump("p,",label); } /* Test for less than or equal to zero */ void le0(LVALUE *lval, int label) { ol("ld\ta,h") ; ol("or\tl"); if (lval->oldval_type==LONG) { ol("or\td"); ol("or\te"); } if (lval->oldval_type==CPTR) { ol("or\te"); } ol("jr\tz,ASMPC+7"); lt0(lval,label); } /* test for greater than zero */ void gt0(LVALUE *lval,int label) { ge0(lval,label) ; ol("or\tl"); opjump("z,",label); } /* test for greater than or equal to zero */ void ge0(LVALUE *lval, int label) { ol("xor\ta") ; switch(lval->oldval_type) { case LONG: ol("or\td"); break; case CPTR: ol("or\te"); break; default: ol("or\th"); } opjump("m,",label); } /* Test for equal */ void zeq(LVALUE *lval) { lval->oldval_type = lval->val_type; switch(lval->val_type) { case LONG: case CPTR: lval->val_type = CARRY; callrts("l_long_eq"); Zsp+=4; break; case DOUBLE: callrts("deq"); Zsp+=6; break; case CCHAR: if ( doinline ) { lval->val_type = CARRY; ol("ld\ta,l"); ol("sub\te"); ol("and\ta"); ol("jr\tnz,ASMPC+3"); ol("scf"); break; } default: lval->val_type = CARRY; callrts("l_eq"); } } /* Test for not equal */ void zne(LVALUE *lval) { lval->oldval_type = lval->val_type; switch(lval->val_type) { case LONG: case CPTR: lval->val_type = CARRY; callrts("l_long_ne"); Zsp+=4; break; case DOUBLE: callrts("dne"); Zsp+=6; break; case CCHAR: if ( doinline ) { lval->val_type = CARRY; ol("ld\ta,l"); ol("sub\te"); ol("and\ta"); ol("jr\tz,ASMPC+3"); ol("scf"); break; } default: lval->val_type = CARRY; callrts("l_ne"); } } /* Test for less than*/ void zlt(LVALUE *lval) { lval->oldval_type = lval->val_type; switch(lval->val_type) { case LONG: case CPTR: lval->val_type = CARRY; if (utype(lval)) callrts("l_long_ult"); else callrts("l_long_lt"); Zsp+=4; break; case DOUBLE: callrts("dlt"); Zsp+=6; break; case CCHAR: if ( doinline ) { if ( utype(lval) ) { ol("ld\ta,e"); ol("sub\tl"); } else { ol("ld\ta,e"); ol("sub\tl"); ol("rra"); ol("xor\te"); ol("xor\tl"); ol("rlca"); } lval->val_type = CARRY; break; } default: lval->val_type = CARRY; if (utype(lval)) callrts("l_ult"); else callrts("l_lt"); } } /* Test for less than or equal to (signed/unsigned) */ void zle(LVALUE *lval) { lval->oldval_type = lval->val_type; switch(lval->val_type) { case LONG: case CPTR: lval->val_type = CARRY; if (utype(lval)) callrts("l_long_ule"); else callrts("l_long_le"); Zsp+=4; break; case DOUBLE: callrts("dleq"); Zsp+=6; break; case CCHAR: if ( doinline ) { if ( utype(lval) ) { /* unsigned */ ol("ld\ta,e"); ol("sub\tl"); /* If l < e then carry set */ ol("jr\tnz,ASMPC+3"); /* If zero, then set carry */ ol("scf"); } else { int label = getlabel(); ol("ld\ta,e"); ol("sub\tl"); ol("rra"); ol("scf"); opjumpr("z,",label); ol("xor\te"); ol("xor\tl"); ol("rlca"); postlabel(label); } lval->val_type = CARRY; break; } default: lval->val_type = CARRY; if (utype(lval)) callrts("l_ule"); else callrts("l_le"); } } /* Test for greater than (signed/unsigned) */ void zgt(LVALUE *lval) { lval->oldval_type = lval->val_type; switch(lval->val_type) { case LONG: case CPTR: lval->val_type = CARRY; if (utype(lval)) callrts("l_long_ugt"); else callrts("l_long_gt"); Zsp+=4; break; case DOUBLE: callrts("dgt"); Zsp+=6; break; case CCHAR: if ( doinline ) { if ( utype(lval) ) { ol("ld\ta,e"); ol("sub\tl"); ol("jr\tz,ASMPC+3"); /* If zero, nc */ ol("ccf"); } else { ol("ld\ta,e"); ol("sub\tl"); ol("rra"); ol("xor\te"); ol("xor\tl"); ol("rlca"); ccf(); } lval->val_type = CARRY; break; } default: lval->val_type = CARRY; if (utype(lval)) callrts("l_ugt"); else callrts("l_gt"); } } /* Test for greater than or equal to */ void zge(LVALUE *lval) { lval->oldval_type = lval->val_type; switch(lval->val_type) { case LONG: case CPTR: lval->val_type = CARRY; if (utype(lval)) callrts("l_long_uge"); else callrts("l_long_ge"); Zsp+=4; break; case DOUBLE: callrts("dge"); Zsp+=6; break; case CCHAR: if ( doinline ) { if ( utype(lval) ) { ol("ld\ta,l"); ol("sub\te"); /* If l > e, carry set */ ol("jr\tnz,ASMPC+3"); /* If l == e then we need to set carry */ ol("scf"); } else { int label = getlabel(); ol("ld\ta,e"); ol("sub\tl"); ol("rra"); ol("scf"); opjumpr("z,",label); ol("xor\te"); ol("xor\tl"); ol("rlca"); ccf(); postlabel(label); } lval->val_type = CARRY; break; } default: lval->val_type = CARRY; if (utype(lval)) callrts("l_uge"); else callrts("l_ge"); } } void zcarryconv(void) { vconst(0); ol("rl\tl"); } /* * Routines for conversion between different types, kept in this * file to aid conversion etc */ void convUint2char(void) { ol("ld\th,0"); } void convSint2char(void) { ol("ld\ta,l"); callrts("l_sxt"); } /* Unsigned int to long */ void convUint2long(void) { const2(0); } /* Signed int to long */ void convSint2long(void) { callrts("l_int2long_s"); } /* signed Int to doub */ void convSint2doub(void) { callrts("float"); } /* unsigned int to double */ void convUint2doub(void) { callrts("ufloat"); } /* signed long to double */ void convSlong2doub(void) { convSint2doub(); } /* unsigned long to double */ void convUlong2doub(void) { convUint2doub(); } /* double to integerl/long */ void convdoub2int(void) { callrts("ifix"); } /* Swap double positions on stack */ void DoubSwap(void) { callrts("dswap"); } /* * Load long into hl and de * Takes respect of sign, so if signed and high word=0 then * print 65535 else print whats there..could possibly come unstuck! * this is so that -1 -> -32768 are correcly represented * * djm 21/2/99 fixed, so that sign is disregarded! this allows us * to have -1 entered correctly */ void vlongconst(unsigned long val) { vconst(val%65536); const2(val/65536); } void vlongconst_noalt(unsigned long val) { constbc(val%65536); ol("push\tbc"); constbc(val/65536); ol("push\tbc"); } /* * load constant into primary register */ void vconst(long val) { if ( val < 0 ) val += 65536; immed(); outdec(val%65536); ot(";const\n"); } /* * load constant into secondary register */ void const2(long val) { if ( val < 0 ) val += 65536; immed2(); outdec(val); nl(); } void constbc(long val) { if ( val < 0 ) val += 65536; ot("ld\tbc,"); outdec(val); nl(); } void addbchl(int val) { ot("ld\tbc,"); outdec(val); outstr("\n\tadd\thl,bc\n"); } /* Load accumulator with lower half of int */ void LoadAccum(void) { ol("ld\ta,l"); } /* Compare the accumulator with a value (mod 256) */ void CpCharVal(int val) { ot("cp\t#("); outdec(val); outstr("% 256)\n"); } /* * Print prefix for global defintion */ void GlobalPrefix(char type) { if (asxx) { ot(".globl\t"); return; } switch(type) { case XDEF: ot("XDEF\t"); break; case XREF: ot("XREF\t"); break; case LIB: ot("LIB\t"); break; } } /* * Emit a LINE opcode for assembler * error reporting */ void EmitLine(int line) { if (!asxx && ctext ) { ot("LINE\t"); outdec(line); nl(); } } /* These routines save and restore hl/de from special places */ void savehl(void) { ol("ld\t(saved_hl),hl"); } void savede(void) { ol("ld\t(saved_de),de"); } void restorehl(void) { ol("ld\thl,(saved_hl)"); } void restorede(void) { ol("ld\thl,(saved_de)"); } #ifdef USEFRAME /* * Check offset is within range for frame pointer */ int CheckOffset(int val) { if (val>=-126 && val<=127 ) return 1; return 0; } /* * Output offset to index register * * FRAME POINTER STUFF IS BROKEN - DO NOT USE!!! */ void OutIndex(int val) { if (asxx) { outdec(val); if (indexix) outstr("(ix)"); else outstr("(iy)"); } else { outstr("("); if (indexix) outstr("ix "); else outstr("iy "); if (val >= 0 ) outstr("+"); outdec(val); outstr(")"); } } void RestoreSP(char saveaf) { if (saveaf) doexaf(); ot("ld\tsp,"); FrameP(); nl(); if (saveaf) doexaf(); } void pushframe(void) { #ifdef USEFRAME if (!useframe) return; ot("push\t"); FrameP(); nl(); #endif } void popframe(void) { #ifdef USEFRAME if (!useframe) return; ot("pop\t"); FrameP(); nl(); #endif } void setframe(void) { #ifdef USEFRAME if (!useframe) return; ot("ld\t"); FrameP(); outstr(",0\n"); ot("add\t"); FrameP(); outstr(",sp\n"); #endif } void FrameP(void) { if (indexix) outstr("ix"); else outstr("iy"); } #endif z88dk-1.8.ds1/src/sccz80/codegen.h0000644000175000017500000000741610031124521016157 0ustar tygrystygrys/* codegen.c */ extern void comment(void); extern void header(void); extern void DoLibHeader(void); extern void trailer(void); extern void outname(char *sname, char pref); extern void getmem(SYMBOL *sym); extern void StoreTOS(char); extern int getloc(SYMBOL *sym, int off); extern void putmem(SYMBOL *sym); extern void putstk(char typeobj); extern void puttos(void); extern void put2tos(void); extern void loadargc(int n); extern void indirect(LVALUE *lval); extern void swap(void); extern void immed(void); extern void immed2(void); extern void immedlit(int lab); extern void lpush(void); extern void lpush2(void); extern void zpushde(void); extern void zpush(void); extern void dpush(void); extern void dpush2(void); extern void mainpop(void); extern void zpop(void); extern void zpopbc(void); extern void doexx(void); extern void doexaf(void); extern void swapstk(void); extern void sw(char type); extern void zcall(SYMBOL *sname); extern void zcallop(void); extern void zclibcallop(void); extern char dopref(SYMBOL *sym); extern void callrts(char *sname); extern void zret(void); extern void callstk(int n); extern void jump0(LVALUE *lval,int label); extern void jump(int label); extern void opjump(char *, int); extern void testjump(LVALUE *,int label); extern void zerojump(void (*oper)(LVALUE *,int), int label, LVALUE *lval); extern void defbyte(void); extern void defstorage(void); extern void defword(void); extern void deflong(void); extern void defmesg(void); extern void point(void); extern int modstk(int newsp, int save,int saveaf); extern void scale(int type, TAG_SYMBOL *tag); extern void quikmult(int size, char preserve); extern void addbc(void); extern void ldbc(void); extern void doublereg(void); extern void threereg(void); extern void fivereg(void); extern void sixreg(void); extern void zadd(LVALUE *); extern void zsub(LVALUE *); extern void mult(LVALUE *); extern void zdiv(LVALUE *); extern void zmod(LVALUE *); extern void zor(LVALUE *); extern void zxor(LVALUE *); extern void zand(LVALUE *); extern void asr(LVALUE *); extern void asl(LVALUE *); extern void lneg(LVALUE *); extern void neg(LVALUE *); extern void com(LVALUE *); extern void ccf(void); extern void inc(LVALUE *); extern void dec(LVALUE *); extern void zeq(LVALUE *); extern void eq0(LVALUE *,int label); extern void zne(LVALUE *); extern void zlt(LVALUE *); extern void lt0(LVALUE *,int label); extern void zle(LVALUE *); extern void le0(LVALUE *,int label); extern void zgt(LVALUE *); extern void gt0(LVALUE *,int label); extern void zge(LVALUE *); extern void ge0(LVALUE *,int label); extern void convUint2long(void); extern void convSint2long(void); extern void convSint2doub(void); extern void convUint2doub(void); extern void convSlong2doub(void); extern void convUlong2doub(void); extern void convdoub2int(void); extern void DoubSwap(void); extern void vlongconst(unsigned long val); extern void vlongconst_noalt(unsigned long val); extern void vconst(long val); extern void const2(long val); extern void constbc(long val); extern void addbchl(int val); extern void GlobalPrefix(char); extern void jumpc(int); extern void jumpnc(int); extern void zpushflags(void); extern void zpopflags(void); extern void jumpnc(int); extern void jumpc(int); extern void jumpr(int); extern void opjumpr(char *, int); extern void setcond(int); extern void dummy(LVALUE *, int); extern void LoadAccum(void); extern void CpCharVal(int); extern void EmitLine(int); extern void OutIndex(int); extern void popframe(void); extern void pushframe(void); extern void FrameP(void); extern void PutFrame(char,int); extern void RestoreSP(char); extern int CheckOffset(int); extern void zcarryconv(void); extern void convUint2char(void); extern void convSint2char(void); extern void savehl(void); extern void savede(void); extern void restorehl(void); extern void restorede(void); z88dk-1.8.ds1/src/sccz80/const.c0000644000175000017500000003564110445247421015713 0ustar tygrystygrys/* * Small C+ Compiler * Split into parts 3/3/99 djm * * This part deals with the evaluation of a constant * * $Id: const.c,v 1.16 2006/06/18 13:03:13 dom Exp $ * * 7/3/99 djm - fixed minor problem in fnumber, which prevented * fp numbers from working properly! Also added a ifdef UNSURE * around exponent-- for -math-z88 * * 29/1/2001 djm - added ability to dump string literals and have * them sorted out at compile time * * 26/1/2002 djm - Exponent code uncommented now. This works, but * there may be accuracy issues due to method used for -ve exponents * */ #include "ccdefs.h" /* * These two variables used whilst loading constants, makes things * a little easier to handle - type specifiers.. */ char constype; char conssign; /* Modified slightly to sort have two pools - one for strings and one * for doubles.. */ int constant(LVALUE *lval) { constype=CINT; conssign=dosigned; lval->is_const = 1 ; /* assume constant will be found */ if ( fnumber(&lval->const_val) ) { lval->val_type=DOUBLE; if ( doublestrings ) { immedlit(litlab); outdec(lval->const_val); nl(); callrts("__atof2"); WriteDefined("math_atof",1); } else { immedlit(dublab); outdec(lval->const_val); nl(); callrts("dload"); } lval->is_const = 0 ; /* floating point not constant */ lval->flags=0; return(1); } else if ( number(&lval->const_val) || pstr(&lval->const_val) ) { /* Insert long stuff/long pointer here? */ if ( (unsigned long )lval->const_val >= 65536LU ) constype = LONG; lval->val_type = constype ; lval->flags = (lval->flags&MKSIGN)|conssign; if (constype == LONG) vlongconst(lval->const_val); else vconst(lval->const_val); return(1); } else if ( tstr(&lval->const_val) ) { lval->is_const = 0 ; /* string address not constant */ lval->ptr_type=CCHAR; /* djm 9/3/99 */ lval->val_type=CINT; lval->flags=0; immedlit(litlab); } else { lval->is_const = 0 ; return(0); } outdec(lval->const_val); nl(); return(1); } int fnumber(long *val) { unsigned char sum[6]; unsigned char sum2[6]; unsigned char scale[6]; unsigned char frcn[6]; unsigned char dig1[6]; unsigned char dig2[6]; unsigned char dig3[6]; int k; /* flag and mask */ char minus; /* is if negative! */ char *start; /* copy of pointer to starting point */ char *s; /* points into source code */ char *dp1; /* First number after dp */ char *end; if (mathz88) { /* Z88 Representation of 0.1 */ frcn[0] = 0; frcn[1] = 205; frcn[2] = frcn[3]=204; frcn[4] = 76; frcn[5] = 125; } else { /* Generic representation of 0.1 */ frcn[0] = 205; frcn[1] = frcn[2] = frcn[3] = 204; frcn[4] = 76; frcn[5] = 125; } start = s = line+lptr; /* save starting point */ k = 1; minus = 1; while(k) { k=0; if(*s == '+') { ++s; k=1; } if(*s == '-') { ++s; k=1; minus=(-minus); } } while (*s==' ') /* Ignore white space after sign */ s++; while ( numeric(*s) ) ++s ; if ( *s != '.' && *s != 'e' ) { /* Check that it is floating point */ s++; return 0; } dp1 = ++s; while ( numeric(*s) ) ++s ; lptr = (s--) - line ; /* save ending point */ end = s; sum[0]=sum[1]=sum[2]=sum[3]=sum[4]=sum[5]='\0'; sum2[0]=sum2[1]=sum2[2]=sum2[3]=sum2[4]=sum2[5]='\0'; memcpy(dig3,frcn,6); /* Copy 0.1 dig3 */ s = dp1; /* Deals with the decimal place */ while ( numeric(*s) && s <= end) { qfloat((*s-'0'),dig1); /* 0-9 */ fltmult(dig3,dig1); /* * 0.1 */ fltadd(dig1,sum2); fltmult(frcn,dig3); s++; } s = --dp1; /* Now points to dp */ qfloat(1,scale); /* Now do numbers after decimal place */ while ( --s >= start ) { qfloat((*s-'0'),dig1); fltmult(scale,dig1); fltadd(dig1,sum); qfloat(10,dig2); fltmult(dig2,scale); } fltadd(sum2,sum); if( cmatch('e') ) { /* interpret exponent */ int neg; /* nonzero if exp is negative */ long expon; /* the exponent */ if( number(&expon) == 0 ) { error(E_EXPON); expon=0; } if( expon < 0 ) { neg=1; expon=(-expon); } else { neg = 0; } if( expon > 38 ) { error(E_FLOATING); expon=0; } /* Now find the scaling factor. We find 10**expon */ if ( neg == 0 ) { qfloat(1,scale); k = 32; while( k ) { memcpy(sum2,scale,6); /* Copy scale */ fltmult(sum2,scale); /* scale * scale */ if( k & expon) { qfloat(10,sum2); /* scale *= 10 */ fltmult(sum2,scale); } k >>= 1; } } else { /* Negative exponenent find 0.1 ** expon */ memcpy(scale,frcn,6); /* 0.1 */ for ( k = 1; k < expon; k++ ) { fltmult(frcn,scale); /* *0.1 */ } neg = 0; } /* Now we can just multiply to find the number */ fltmult(scale,sum); } /* Not sure if this bit is necessary - dom 26/1/2002 */ if ( minus != 1) sum[4]=sum[4]|128; /* Z88 FP numbers have exp+127, gen has +128 (bad?) */ if (mathz88) --sum[5]; /* get location for result & bump litptr */ if ( doublestrings ) { *val = stash_double_str( start, lptr+line); return (1); } else { *val = searchdub(sum); } return(1) ; /* report success */ } /* stash a double string in the literal pool */ int stash_double_str(char *start, char *end) { int len; long val; unsigned char *buf; len = end-start; if (*(start+len-1) == ' ') len--; buf = malloc(len+1); if (buf == NULL ) { error(E_LITQOV); /* As good as any really.. */ } strncpy(buf,start,len); *(buf+len)=0; storeq(len+1,buf,&val); free(buf); return(val); } /* Search through the literal queue searching for a match with our * number - saves space etc etc */ long searchdub(unsigned char *num) { unsigned char *tempdub; int dubleft, k,match; dubleft=dubptr; tempdub=dubq; while( dubleft ){ /* Search through.... */ match=0; for ( k = 0 ; k < 6 ; k++) { if (*tempdub++ == num[k]) match++; } if (match == 6 ) return (dubptr-dubleft); dubleft -= 6; } /* Put it in the double queue now.. */ if ( dubptr+6 >= FNMAX ) { error(E_DBOV); return(0); } for (k=0 ; k< 6 ; k++){ *tempdub++=num[k]; } dubptr += 6; return (dubptr-6); } int number(long *val) { char c ; int minus; long k ; /* * djm, set the type specifiers to normal */ k = minus = 1 ; while ( k ) { k = 0 ; if ( cmatch('+') ) k = 1 ; if ( cmatch('-') ) { minus = (-minus) ; k = 1 ; } } if( ch() == '0' && toupper(nch()) == 'X' ) { gch() ; gch() ; if ( hex(ch()) == 0 ) return(0) ; while ( hex(ch()) ) { c = inbyte() ; if ( c <= '9' ) k = (k << 4) + (c-'0') ; else k = (k << 4) + ((c&95) - '7') ; } *val = k ; goto typecheck; } if( ch() == '0' ) { gch(); while ( numeric(ch()) ) { c=inbyte(); if (c<'8') k=k*8+(c-'0'); } *val=k; goto typecheck; } if ( numeric(ch()) == 0 ) return(0); while ( numeric(ch()) ) { c = inbyte() ; k = k*10+(c-'0') ; } if ( minus < 0 ) k = (-k) ; *val = k ; typecheck: while ( rcmatch('L') || rcmatch('U') || rcmatch ('S') ) { if ( cmatch('L') ) constype=LONG; if ( cmatch('U') ) conssign=YES; /* unsigned */ if ( cmatch('S') ) conssign=NO; } return(1) ; } int hex(char c) { char c1 ; c1 = toupper(c) ; return( (c1>='0' && c1<='9') || (c1>='A' && c1<='F') ) ; } /* djm, seems to load up literal address? */ void address(SYMBOL *ptr) { immed() ; outname(ptr->name,dopref(ptr)) ; nl(); /* djm if we're using long pointers, use of e=0 means absolute address, * this covers up a bit of a problem in deref() which can't distinguish * between ptrtoptr and ptr */ if (ptr->flags&FARPTR) { const2(0); } } int pstr(long *val) { int k ; constype=CINT; constype=dosigned; if (cmatch('\'')) { k = 0 ; while ( ch() != 39 ) k = (k&255)*256 + litchar() ; ++lptr ; *val = k ; return(1) ; } return(0) ; } /* Scan in literals within function into temporary buffer and then * check to see if present elsewhere, if so do the merge as for doubles */ int tstr(long *val) { int k,j; j=k=0; if ( cmatch('"') == 0 ) return(0) ; do { while ( ch() !='"' ) { if ( ch() == 0 ) break ; tempq[k]=litchar(); k++; /* counter */ } gch(); } while (cmatch('"')); tempq[k]= 0; k++; return(storeq(k,tempq,val)); } /* * Messed around with 5/5/99 djm to allow queues to start from 1 * internally, but to the asm file show it to start from 0 */ int storeq(int length, unsigned char *queue,long *val) { int j,k,len; /* Have stashed it in our temporary queue, we know the length, so lets * get checking to see if one exactly the same has already been placed * in there... */ k=length; len=litptr-k; /* Amount of leeway to search through.. */ j=1; /* Literal queue starts from 1 not 0 now * this allows scan for miniprintf to work * correctly */ while (len >= j) { if (strncmp(queue,litq+j,k) == 0) {*val=j-1; return(1);} /*success!*/ j++; } /* If we get here, then dump it in the queue as per normal... */ *val=(long) litptr-1; for (j=0; j= FNMAX ) { error(E_LITQOV); } *(litq+litptr)=*(queue+j); litptr++ ; } return(k); } int qstr(long *val) { int c; int cnt=0; if ( cmatch('"') == 0 ) return(-1) ; *val=(long)gltptr; do { while ( ch() !='"' ) { if ( ch() == 0 ) break ; cnt++; stowlit(litchar(),1); } gch(); } while ( cmatch('"') || (cmatch('\\') && cmatch('"') ) ); glbq[gltptr++]= 0; return(cnt); } /* store integer i of size size bytes in global var literal queue */ void stowlit(int value, int size) { if ( (gltptr+size) >= LITMAX ) { error(E_LITQOV); } putint(value, glbq+gltptr, size); gltptr += size ; } /* Return current literal char & bump lptr */ unsigned char litchar() { int i, oct ; if ( ch() != 92 ) return(gch()) ; if ( nch() == 0 ) return(gch()) ; gch() ; switch( ch() ) { case 'a': /* Bell */ ++lptr; return 7; case 'b': /* BS */ ++lptr; return 8; case 't': /* HT */ ++lptr; return 9; case 'r': /* LF */ ++lptr; return 10; case 'v': /* VT */ ++lptr; return 11; case 'f': /* FF */ ++lptr; return 12; case 'n': /* CR */ ++lptr; return 13; case '\"' : /* " */ ++lptr; return 34; case '\'' : /* ' */ ++lptr; return 39; case '\\': /* / */ ++lptr; return '\\'; case '\?': /* ? */ ++lptr; return '\?'; case 'l': /* LF (non standard)*/ ++lptr; return 10; } if (ch() != 'x' && (ch()<'0' || ch()>'7')) { warning(W_ESCAPE,ch()); return(gch()); } if (ch() == 'x') { gch(); oct=0; i=2; while ( i-- > 0 && hex(ch()) ) { if ( ch() <= '9' ) oct = (oct << 4) + (gch()-'0') ; else oct = (oct << 4) + ((gch()&95) - '7') ; } return((char)oct); } i=3; oct=0; while ( i-- > 0 && ch() >= '0' && ch() <= '7' ) oct=(oct<<3)+gch()-'0'; if( i == 2 ) return(gch()); else { return((char)oct); } } /* Perform a sizeof (works on variables as well */ /* FIXME: Should also dereference pointers... */ void size_of(LVALUE *lval) { char sname[NAMESIZE] ; int length; TAG_SYMBOL *otag ; SYMBOL *ptr; struct varid var; char ident; needchar('(') ; otag=GetVarID(&var,NO); if (var.type != NO ) { if ( match("**") || cmatch('*') ) ident=POINTER; else ident=VARIABLE; if ( otag && ident==VARIABLE ) lval->const_val =otag->size; if ( ident == POINTER ) { lval->const_val = (var.zfar ? 3 : 2); } else { switch(var.type) { case CCHAR: lval->const_val=1; break; case CINT: lval->const_val=2; break; case LONG: lval->const_val=4; break; case DOUBLE: lval->const_val=6; break; case STRUCT: lval->const_val=GetMembSize(otag); if (lval->const_val == 0 ) lval->const_val=otag->size; } } } else if ( cmatch('"') ) { /* Check size of string */ length=1; /* Always at least one */ while (!cmatch('"')) { length++; litchar(); } ; lval->const_val=length; } else if ( symname(sname) ) { /* Size of an object */ if ( ( ( ptr = findglb(sname) ) != NULL ) || ( ( ptr = findloc(sname) ) != NULL ) || ( ( ptr = findstc(sname) ) != NULL ) ) { /* Actually found sommat..very good! */ if ( ptr->ident!=FUNCTION && ptr->ident!=MACRO) { if (ptr->type!=STRUCT){ lval->const_val=ptr->size; } else { lval->const_val=GetMembSize(tagtab+ptr->tag_idx); if (lval->const_val == 0 ) lval->const_val=ptr->size; } } else { warning(W_SIZEOF); /* good enough default? */ lval->const_val=2; } } } needchar(')') ; lval->is_const = 1 ; lval->val_type = CINT ; lval->ident=VARIABLE; vconst(lval->const_val) ; } int GetMembSize(TAG_SYMBOL *ptr) { char sname[NAMEMAX]; SYMBOL *ptr2; if (cmatch('.') == NO && match("->") == NO ) return(0); if (symname(sname) && (ptr2=findmemb(ptr,sname)) ) return ptr2->size; error(E_UNMEMB,sname); return(0); } z88dk-1.8.ds1/src/sccz80/const.h0000644000175000017500000000106707475256021015720 0ustar tygrystygrys/* constant.c */ extern int constant(LVALUE *lval); extern int fnumber(long *val); extern int stash_double_str(char *start,char *end); extern long searchdub(unsigned char *num); extern int number(long *val); extern int hex(char c); extern void address(SYMBOL *ptr); extern int pstr(long *val); extern int tstr(long *val); extern int storeq(int length, unsigned char *queue,long *val); extern int qstr(long *val); extern void stowlit(int value, int size); extern unsigned char litchar(void); extern void size_of(LVALUE *lval); extern int GetMembSize(TAG_SYMBOL *ptr); z88dk-1.8.ds1/src/sccz80/data.c0000644000175000017500000001346110671010535015465 0ustar tygrystygrys/* * Small C+ Compiler * * All those nasty static variables! * * I'm starting to split these up once more and stick them in * the relevant files.. * * $Id: data.c,v 1.33 2007/09/09 15:29:33 dom Exp $ */ #include "ccdefs.h" /* Now reserve some storage words */ char amivers[] = "$VER: sccz80 " __DATE__; char titlec[] = "Small-C/Plus - z80 Crosscompiler "; char Banner[] = "* * * * * Small-C/Plus z88dk * * * * *" ; char Version[] = " Version: 20070909.1"; SYMBOL *symtab, *loctab ; /* global and local symbol tables */ SYMBOL *glbptr, *locptr ; /* ptrs to next entries */ int glbcnt ; /* number of globals used */ SYMBOL *dummy_sym[NTYPE+NUMTAG+1] ; WHILE_TAB *wqueue ; /* start of while queue */ WHILE_TAB *wqptr ; /* ptr to next entry */ /* djm 15/11/98 literal queue and double queue, unsigned for my sanity! */ unsigned char *litq, *dubq; /* literal pool */ unsigned char *glbq; /* global literal queue */ unsigned char *tempq; /* Temp store string lits */ int gltptr,litptr,dubptr; /* index of next entry */ char macq[MACQSIZE]; /* macro string buffer */ int macptr; /* and its index */ TAG_SYMBOL *tagtab ; /* start of structure tag table */ TAG_SYMBOL *tagptr ; /* ptr to next entry */ SYMBOL *membtab ; /* structure member table */ SYMBOL *membptr ; /* ptr to next member */ char *stage ; /* staging buffer */ char *stagenext ; /* next address in stage */ char *stagelast ; /* last address in stage */ SW_TAB *swnext ; /* address of next entry in switch table */ SW_TAB *swend ; /* address of last entry in switch table */ char line[LINESIZE] ; /* parsing buffer */ char mline[LINESIZE] ; /* temp macro buffer */ int lptr, mptr ; /* indexes into buffers */ char Filename[FILENAME_LEN+1] ; /* output file name */ /* Misc storage */ /* My stuff for LIB of long common functions */ int incfloat, cppcom, doinline,ncomp; int stackargs; int lpointer, defstatic, appz88,filenum; /* next argument to be used */ char dosigned, makelib,fnflags,mathz88,compactcode; int nxtlab, /* next avail label # */ dublab, /* label # relative to double pool */ glblab, /* For initializing global literals */ litlab, /* label # assigned to literal pool */ Zsp, /* compiler relative stk ptr */ undeclared, /* # function arguments not yet declared */ ncmp, /* # open compound statements */ errcnt, /* # errors in compilation */ errstop, /* stop on error */ eof, /* set non-zero on final input eof */ ctext, /* non-zero to intermix c-source */ cmode, /* non-zero while parsing c-code */ /* zero when passing assembly code */ declared, /* number of local bytes declared, else -1 when done */ lastst, /* last executed statement type */ iflevel, /* current #if nest level */ skiplevel, /* level at which #if skipping started */ fnstart, /* line# of start of current fn. */ lineno, /* line# in current file */ infunc, /* "inside function" flag */ savestart, /* copy of fnstart " " */ saveline, /* copy of lineno " " */ saveinfn, /* copy of infunc " " */ swactive, /* true inside a switch */ swdefault, /* default label number, else 0 */ verbose, /* Verbose to screen */ caller, /* stack offset for caller links... local[caller] points to name of current fct local[caller-1] points to link for calling fct, where local[0] is 1st word on stack after ret addr */ fname; /* label for name of current fct */ FILE *input, /* iob # for input file */ *output, /* iob # for output file (if any) */ *inpt2, /* iob # for "include" file */ *saveout; /* holds output ptr when diverted to console */ #ifdef SMALL_C int minavail = 32000 ; /* minimum memory available */ #endif SYMBOL *currfn, /* ptr to symtab entry for current fn. */ *savecurr ; /* copy of currfn for #include */ int gargc ; /* global copies of command line args */ char **gargv ; char endasm; char margtag; /* Struct tag number for arg value */ char fnargvalue; /* Type of argument value (as per proto) */ int ltype; /* Long? */ int opertype; /* Saves a lot of code! Reference in cc6 to grab long type operations! */ /* * A couple of variables for dealing with local statics */ int lstdecl,lstlab; /* * Variable for the offset to a shared library routine */ int shareoffset; /* * Doms debug variable */ int debuglevel; /* * Using asxxx? */ int asxx; /* * Enums defined */ int defdenums; /* * Size of far heap in bytes/units/twiddle */ int farheapsz; /* * Max level for printf (i.e. what routine do we want?) */ int printflevel; /* Doubles stored as strings? */ int doublestrings; /* * Framepointer stuff - tis broken! */ #ifdef USEFRAME int useframe; int indexix; #endif z88dk-1.8.ds1/src/sccz80/data.h0000644000175000017500000000423710445247421015500 0ustar tygrystygrys/* data.c */ extern char amivers[]; extern char titlec[]; extern char Banner[]; extern char Version[]; extern char Overflow[]; extern SYMBOL *symtab; extern SYMBOL *loctab; extern SYMBOL *glbptr; extern SYMBOL *locptr; extern int glbcnt; extern SYMBOL *dummy_sym[]; extern WHILE_TAB *wqueue; extern WHILE_TAB *wqptr; extern unsigned char *litq; extern unsigned char *dubq; extern unsigned char *glbq; extern unsigned char *tempq; extern int gltptr; extern int litptr; extern int dubptr; extern char macq[]; extern int macptr; extern TAG_SYMBOL *tagtab; extern TAG_SYMBOL *tagptr; extern SYMBOL *membtab; extern SYMBOL *membptr; extern char *stage; extern char *stagenext; extern char *stagelast; extern struct sw_tab *swnext; extern struct sw_tab *swend; extern char line[]; extern char mline[]; extern int lptr; extern int mptr; extern char Filename[]; extern int incfloat; extern int cppcom; extern int doinline; extern int ncomp; extern int stackargs; extern int lpointer; extern int defstatic; extern int appz88; extern int filenum; extern char dosigned; extern char makelib; extern char fnflags; extern char mathz88; extern char compactcode; extern int nxtlab; extern int dublab; extern int glblab; extern int litlab; extern int Zsp; extern int undeclared; extern int ncmp; extern int errcnt; extern int errstop; extern int eof; extern int ctext; extern int cmode; extern int declared; extern int lastst; extern int iflevel; extern int skiplevel; extern int fnstart; extern int lineno; extern int infunc; extern int savestart; extern int saveline; extern int saveinfn; extern int swactive; extern int swdefault; extern int verbose; extern int caller; extern int fname; extern FILE *input; extern FILE *output; extern FILE *inpt2; extern FILE *saveout; extern SYMBOL *currfn; extern SYMBOL *savecurr; extern int gargc; extern char **gargv; extern char endasm; extern char fnargvalue; extern int ltype; extern int opertype; extern char margtag; extern int lstdecl; extern int lstlab; extern int shareoffset; extern int debuglevel; extern int asxx; extern int indexix; extern int useframe; extern int defdenums; extern int farheapsz; extern int printflevel; extern int doublestrings; extern int usempm; z88dk-1.8.ds1/src/sccz80/declfunc.c0000644000175000017500000005117210611156116016340 0ustar tygrystygrys/* * Routines to declare a function * Split from decl.c 11/3/98 djm * * $Id: declfunc.c,v 1.9 2007/04/17 14:40:14 dom Exp $ */ #include "ccdefs.h" extern void CleanGoto(void); /** \brief Given an argument train, add in signature information to currfn * * \param ptr - Last argument */ void StoreFunctionSignature(SYMBOL *ptr) { SYMBOL *ptr2; int j,k; /* Count the number of arguments that this function had */ j = 1; ptr2 = ptr; while ( (ptr2=ptr2->offset.p) ) { j++; } if ( j > MAXARGS ) { j = MAXARGS-1; } currfn->prototyped = j; /* Set number of arguments */ /* Now define them in currfn - list is in reverse order remember */ while (j) { k = j; ptr2 = ptr; while (--k) { ptr2 = ptr2->offset.p; } /* Okay, so now in ptr2 we have the SYMBOL for the argument */ currfn->args[j] = CalcArgValue(ptr2->type, ptr2->ident, ptr2->flags); currfn->tagarg[j] = 0; /* Set the tag if necessary */ if (ptr2->type == STRUCT) { currfn->tagarg[j]=ptr2->tag_idx; } j--; } /* Clear down remaining arguments */ for ( j = (currfn->prototyped+1) ; j <= MAXARGS-1 ; j++) { currfn->args[j]=0; currfn->tagarg[j]=0; } } /* * Function parsing here, we parse for prototyping and for * declarations */ int AddNewFunc( char *sname, int type, int storage, char zfar, char sign, TAG_SYMBOL *otag, int ident, long *addr) { SYMBOL *ptr; int more; char simple; /* Simple def () */ more=0; /* * First of all check to see if we have a number - this is * external pointer type */ if (number(addr)) return (EXTERNP); /* * Now, check for simple prototyping, we can drop that * back as well, we have to check for punctuation - ; or , * afterwards, so that we can know its not a function * definitions */ simple=NO; if ( cmatch(')') ) { if ( rcmatch(';') || rcmatch(',') ) return(storage); simple=YES; } ptrerror(ident) ; if ( ident == POINTER ) { /* function returning pointer needs dummy symbol */ more = dummy_idx(type, otag) ; /* type = (zfar ? CPTR : CINT ); */ ident=FUNCTIONP; /* func returning ptr */ } else ident=FUNCTION; /* * Okay, we've got rid of everything that could pop up apart * from: * - ANSI prototypes * - Functions themselves (ANSI & K&R) * * First call AddNewFunc(), if this returns 0 then we have defined * a function (including code) */ ptr=AddFuncCode(sname, type, ident,sign, zfar, storage, more,NO,simple,otag,addr); if (ptr==0) { /* Defined a function */ /* trap external int blah() { } things */ if (currfn->storage==EXTERNAL) currfn->storage=STATIK; return(0); } else { StoreFunctionSignature(ptr); } return(0); } /* * Begin a function * * Called from "parse" this routine tries to make a function * out of what follows. */ void newfunc() { char n[NAMESIZE]; /* ptr => currfn */ long addr; if ( symname(n) == 0 ) { error(E_ILLEGAL); clear(); /* invalidate line */ return; } warning(W_RETINT); AddFuncCode(n,CINT,FUNCTION,dosigned,0,STATIK,0,1,NO,0, &addr); } /* * Add the function proper, this is called from newfunc() * and also from AddNewFunc(), returns 0 if added a real * function (code etc) */ #ifndef SMALL_C SYMBOL * #endif AddFuncCode(char *n, char type, char ident, char sign,char zfar, int storage, int more, char check,char simple,TAG_SYMBOL *otag, long *addr) { unsigned char tvalue; /* Used to hold protot value */ char typ; /* Temporary type */ int itag; itag=0; if (otag) itag=otag-tagtab; /* tag number */ lastst = 0; /* no last statement */ locptr = STARTLOC ; /* deallocate all locals */ fnstart = lineno ; /* remember where fn began */ /* * Do some elementary checking before hand.. */ if (zfar && ident!=FUNCTIONP) { zfar=NO; warning(W_FAR); } if ( ( currfn=findglb(n) ) ) { /* already in symbol table ? */ if ( currfn->ident != FUNCTION && currfn->ident != FUNCTIONP ) { /* already variable by that name */ multidef(); } else if ( currfn->offset.i == FUNCTION && !currfn->prototyped) { /* already function by that name */ multidef(); } else { /* we have what was earlier assumed to be a function */ if (currfn->storage == EXTERNAL && currfn->flags&LIBRARY ) { /* Overwriting a lib function, is that what you wanted?!? Handy for * compiling the library though!! Change type to local static to prevent * being dumped in the scope list.. */ if (makelib || storage == LSTATIC ) { currfn->storage=LSTATIC; } else { currfn->storage=LIBOVER; } currfn->offset.i=FUNCTION; } else { /* * I'm not sure what *exactly* I was trying to achieve here djm 25/2/00 */ if (currfn->storage != EXTERNAL && ( (currfn->flags&LIBRARY) != LIBRARY) ) { currfn->flags&=(~LIBRARY); currfn->size = 0; } currfn->offset.i = FUNCTION ; currfn->storage = storage; } } } /* if not in table, define as a function now */ else { typ=type; if (ident == FUNCTIONP) typ=(zfar ? CPTR : CINT ); currfn = addglb(n, FUNCTION, typ, FUNCTION, storage, more, 0); currfn->size=0; currfn->prototyped=0; currfn->flags= (sign&UNSIGNED) | (zfar&FARPTR); if (type == STRUCT) currfn->tagarg[0]=itag; /* * Set our function prototype - what we are! * args[0] is free for use */ currfn->args[0]=CalcArgValue(type, ident, currfn->flags); } tvalue=CalcArgValue(type,ident,((sign&UNSIGNED) | (zfar&FARPTR)) ); if ( currfn->args[0] != tvalue || (type==STRUCT && currfn->tagarg[0] != itag ) ){ char buffer[120]; warning(W_DIFFTYPE); warning(W_DIFFTYPE2,ExpandArgValue(currfn->args[0],buffer,currfn->tagarg[0])); warning(W_DIFFTYPE3,ExpandArgValue(tvalue,buffer,itag) ); } /* we had better see open paren for args... */ if ( check && (cmatch('(') == 0) ) error(E_PAREN); locptr = STARTLOC ; /* "clear" local symbol table */ undeclared = 0 ; /* init arg count */ /* Check to see if we are doing ANSI fn defs - must be a better way of * doing this! (Have an array and check by that?) */ if (CheckANSI()) { return( dofnansi(currfn, addr) ); /* So we can pass back result */ } DoFnKR(currfn,simple); return(0); } /* * This is where we do K&R function definitions, make this into * a separate function and then it makes life a lot easier!! */ void DoFnKR( SYMBOL *currfn, char simple) { char n[NAMESIZE]; SYMBOL *prevarg; /* ptr to symbol table entry of most recent argument */ SYMBOL *cptr; TAG_SYMBOL *otag ; /* structure tag for structure argument */ struct varid var; prevarg=0; Zsp=0; /* Reset stack pointer */ undeclared=0; infunc=1; while ( !simple && cmatch(')') == 0 ) { /* then count args */ /* any legal name bumps arg count */ if ( symname(n) ) { /* add link to argument chain */ if ( (cptr=addloc(n,0,CINT,0,0)) ) cptr->offset.p = prevarg ; prevarg = cptr ; ++undeclared ; } else { error(E_ARGNAME); junk(); } blanks(); /* if not closing paren, should be comma */ if ( ch() != ')' && cmatch(',') == 0 ) { warning(W_EXPCOM); } if ( endst() ) break ; } Zsp = 0 ; /* preset stack ptr */ while ( undeclared ) { char regit=NO; if (amatch("register") ) regit=YES; /* Auto is be default in function defns, but someone might * try it on... */ if (amatch("auto") ) warning(W_AUTO); otag=GetVarID(&var,STATIK); if (var.type==STRUCT) { getarg(STRUCT, otag,NO,0,0, var.zfar,NO) ; } else if (var.type || regit) { if (regit && var.type == NO ) var.type=CINT; getarg(var.type,NULL_TAG,NO,0,var.sign,var.zfar,NO); } else { error(E_BADARG) ; break ; } } /* Have finished K&R parsing */ setlocvar(prevarg,currfn); } /** \brief Set the argument offsets for a function, then kick off compiling * of the function * * \param prevarg - Last argument * \param currfn - Current function */ void setlocvar(SYMBOL *prevarg,SYMBOL *currfn) { int lgh,where; int *iptr; SYMBOL *copyarg; int argnumber; char buffer2[120]; unsigned char tester; lgh = 0; /* Initialise it */ if ( prevarg != NULL && currfn->prototyped == 0 ) { StoreFunctionSignature(prevarg); } argnumber=currfn->prototyped; /* * If we have filled up our number of arguments, then pretend * we don't have any..nasty, nasty */ if (argnumber==(MAXARGS-1)) argnumber=0; else if (argnumber) argnumber=1; /* * Dump some info about defining the function etc */ if (verbose){ toconsole(); outstr("Defining function: "); outstr(currfn->name); nl(); tofile(); } nl();prefix();outname(currfn->name,dopref(currfn));col();nl(); /* print function name */ infunc=1; /* In a function for sure! */ copyarg=prevarg; if ( ( (currfn->flags&SHARED) && makeshare ) || sharedfile ) { /* Shared library definition, offset the stack */ where= 2 +shareoffset; } else where = 2 ; /* If we use frame pointer we preserve previous framepointer on entry * to each function */ #ifdef USEFRAME if (useframe) where+=2; #endif while ( prevarg ) { lgh = 2 ; /* Default length */ /* This is strange, previously double check for ->type */ if ( prevarg->type == LONG && prevarg->ident != POINTER ) lgh=4; if ( prevarg->type == DOUBLE && prevarg->ident != POINTER ) lgh=6; /* Far pointers */ if ( (prevarg->flags&FARPTR)==FARPTR && prevarg->ident == POINTER) lgh=4; prevarg->size=lgh; #ifdef CODSWALLOP /* All pointers are pushed onto the stack for functions as 4 bytes, if * needed, near pointers are padded out to compensate for this by dummy * loading with zero, this allows us to have one set of routines to * cope with this and hence solve a lot of duplication */ if (prevarg->ident == POINTER && lpointer) lgh=4; prevarg->size=lgh; #endif /* * Check the definition against prototypes here... */ if (argnumber) { tester=CalcArgValue(prevarg->type,prevarg->ident,prevarg->flags); if (currfn->args[argnumber] != tester ) { if (currfn->args[argnumber] != PELLIPSES ) { if (currfn->args[argnumber] == 0 ) { warning(W_2MADECL); } else { if ( (currfn->args[argnumber]&PMASKSIGN) == (tester&PMASKSIGN) ) { warning(W_SIGNARG); } else { error(E_ARGMIS1,currfn->name,currfn->prototyped-argnumber+1, ExpandArgValue(tester,buffer2,prevarg->tag_idx) ); error(E_ARGMIS2,ExpandArgValue(currfn->args[argnumber],buffer2, currfn->tagarg[argnumber])); } } } } argnumber++; } iptr = &prevarg->offset.i ; prevarg = prevarg->offset.p ; /* follow ptr to prev. arg */ *iptr = where ; /* insert offset */ where += lgh ; /* calculate next offset */ } #ifdef USEFRAME pushframe(); #endif currfn->handled=YES; if (currfn->prototyped==1 && (currfn->flags®CALL) ) { /* * Fast call routine.. */ if (lgh==2) zpush(); else if (lgh==4) lpush(); else if (lgh==6) dpush(); /* erk, if not matched, dodgy type! */ copyarg->offset.i=-lgh; where=2; } stackargs=where; lstdecl=0; /* Set number of local statics to zero */ if ( statement() != STRETURN ) { if (lstdecl) postlabel(lstlab); lstdecl=0; /* do a statement, but if it's a return, skip */ /* cleaning up the stack */ leave(NO,NO) ; } CleanGoto(); /* Asz80 needs a label at the end to sort out local symbols */ if (asxx) { nl();prefix(); outstr("smce_"); outname(currfn->name,NO); col();nl(); } #ifdef INBUILT_OPTIMIZER generate(); #endif infunc = 0 ; /* not in fn. any more */ } /* djm Declare a function in the ansi style! */ #ifndef SMALL_C SYMBOL * #endif dofnansi(SYMBOL *currfn, long *addr) { SYMBOL *prevarg; /* ptr to symbol table entry of most recent argument */ SYMBOL *argptr; /* Temporary holder.. */ TAG_SYMBOL *otag ; /* structure tag for structure argument */ struct varid var; char proto; locptr=STARTLOC; prevarg=0; Zsp=0; /* Reset stack pointer */ undeclared=1; proto=YES; swallow("__TD__"); /* kludge to get round typedef problem */ /* Master loop, checking for end of function */ while ( cmatch(')') == 0 ) { if (amatch("...") ) { /* * Found some ellipses, so, add it to the local symbol table and * then return..(after breaking, and checking for ; & , ) */ if (proto == 1 ) warning(W_ELLIP); needchar(')'); argptr=addloc("ellp",0,ELLIPSES,0,0); argptr->offset.p = prevarg; prevarg=argptr; break; } otag=GetVarID(&var,STATIK); if (var.type==STRUCT) { prevarg=getarg(STRUCT, otag,YES,prevarg,0, var.zfar,proto) ; } else if (var.type) { prevarg=getarg(var.type,NULL_TAG,YES,prevarg,var.sign,var.zfar,proto); } else { warning(W_EXPARG); break; } proto++; /* Now check for comma */ if (ch() !=')' && cmatch(',') == 0) { warning(W_EXPCOM); break; } } /* * Check for semicolon - I think this should be enough, just * have to have prototypes on separate lines - good practice * in anycase!! */ if (cmatch('@') ) { constexpr(addr,1); } if (cmatch(';') ) return (prevarg); setlocvar(prevarg,currfn); return (0); } /* * Check to see if could be doing any ANSI style function definitions * * Returns: YES - we are, NO - we're not */ int CheckANSI() { if (rmatch("unsigned") || rmatch("signed") || rmatch("int") || rmatch("char") || rmatch("double") || rmatch("long") || rmatch("struct") || rmatch("union") || rmatch("void") || rmatch("far") || rmatch("near") || rmatch("const") || rmatch("volatile") || rmatch("__TD__") || rmatch("float") || rmatch("register") || rmatch("short") || CheckTypDef() ) return (YES); return (NO); } /* * Declare argument types * * called from "newfunc" this routine adds an entry in the * local symbol table for each named argument */ #ifndef SMALL_C SYMBOL * #endif getarg( int typ , /* typ = CCHAR, CINT, DOUBLE or STRUCT */ TAG_SYMBOL *otag , /* structure tag for STRUCT type objects */ int deftype, /* YES=ANSI -> addloc NO=K&R -> findloc */ SYMBOL *prevarg, /* ptr to previous argument, only of use to ANSI */ char issigned, /* YES=unsigned NO=signed */ char zfar, /* FARPTR=far NO=near */ char proto) /* YES=prototyping -> names not needed */ { char n[NAMESIZE] ; SYMBOL *argptr ; int legalname, ident, more ; int brkflag; /* Needed to correctly break out for K&R*/ /* * This is of dubious need since prototyping came about, we could * inadvertently include fp packages if the user includes but * didn't actually use them, we'll save the incfloat business for * static doubles and definitions of local doubles * * if (typ == DOUBLE) * incfloat=1; */ argptr = NULL; /* Only need while loop if K&R defs */ while ( undeclared) { ident = get_ident() ; more =0; if ( (legalname=symname(n)) == 0 ) { if (!proto) { illname(n); } else { /* * Obligatory silly fake name */ sprintf(n,"sg6p_%d",proto); legalname=1; } } if ( ident == FUNCTIONP ) { needtoken(")()"); /* function returning pointer needs dummy symbol */ more = dummy_idx(typ, otag) ; typ = (zfar ? CPTR : CINT ); } else if ( ident == PTR_TO_FN ) { needtoken(")()") ; ident = POINTER ; } if ( cmatch('[') ) { /* pointer ? */ ptrerror(ident) ; /* it is a pointer, so skip all */ /* stuff between "[]" */ while ( inbyte() != ']' ) if ( endst() ) break; /* add entry as pointer */ ident = (ident == POINTER) ? PTR_TO_PTR : POINTER ; } if ( legalname ) { /* * For ANSI we need to add symbol name to local table - this CINT is * temporary */ if (deftype) { argptr=addloc(n,0,CINT,0,0); argptr->offset.p = prevarg; } /* * If prototyping, then we can't find the name, but if we're prototyping * we have been defined as ANSI, therefore argptr already holds * the correct pointer - kinda neat! */ if ( proto || (argptr=findloc(n)) ) { argptr->flags=(zfar&FARPTR)|(issigned&UNSIGNED); /* add in details of the type of the name */ if ( ident == PTR_TO_PTR ) { /* djm mods will be here for long pointer */ // argptr->flags = UNSIGNED |FARPTR ; /*unsigned*/ argptr->ident = POINTER ; argptr->type = typ; // argptr->type = ( (zfar&FARPTR) ? CPTR : CINT ); argptr->more = dummy_idx(typ, otag) ; } else { argptr->more = more; argptr->ident = ident ; argptr->type = typ ; } } else warning(W_EXPARG); if ( otag ) { argptr->tag_idx = otag - tagtab ; argptr->ident = POINTER ; argptr->type = STRUCT ; } } brkflag=0; if (!deftype) { --undeclared; /* cnt down */ if ( endst() ) { brkflag=1; break; } if ( cmatch(',') == 0 ) warning(W_EXPCOM) ; } if (brkflag || deftype) break; } if (deftype) return(argptr); ns(); return(0); } z88dk-1.8.ds1/src/sccz80/declfunc.h0000644000175000017500000000116710611156117016345 0ustar tygrystygrys/* declfunc.c */ extern int AddNewFunc(char *sname, int type, int storage, char zfar, char sign, TAG_SYMBOL *otag, int ident, long *addr); extern void newfunc(void); extern SYMBOL *AddFuncCode(char *n, char type, char ident, char sign, char zfar, int storage, int more, char check, char simple, TAG_SYMBOL *otag, long *addr); extern void DoFnKR(SYMBOL *currfn, char simple); extern void setlocvar(SYMBOL *prevarg, SYMBOL *currfn); extern SYMBOL *dofnansi(SYMBOL *currfn, long *addr); extern int CheckANSI(void); extern SYMBOL *getarg(int typ, TAG_SYMBOL *otag, int deftype, SYMBOL *prevarg, char issigned, char zfar, char proto); z88dk-1.8.ds1/src/sccz80/declinit.c0000644000175000017500000002354510031124521016342 0ustar tygrystygrys/* * Routines to initialise variables * Split from decl.c 11/3/98 djm * * 14/3/99 djm Solved many problems with string initialisation * char arrays in structs now initialised correctly, strings * truncated if too long, all seems to be fine - hurrah! * * 2/2/02 djm - This file needs to rewritten to be more flexible * * 3/2/02 djm - Unspecified structure members are now padded out * * $Id: declinit.c,v 1.12 2004/03/26 22:06:09 denniz Exp $ */ #include "ccdefs.h" /* * initialise global object */ int initials(char *sname, int type, int ident, int dim, int more, TAG_SYMBOL * tag, char zfar) { int size, desize = 0; int olddim = dim; if (cmatch('=')) { /* initialiser present */ defstatic = 1; /* So no 2nd redefine djm */ gltptr = 0; glblab = getlabel(); if (dim == 0) dim = -1; switch (type) { case CCHAR: size = 1; break; case LONG: size = 4; break; case CINT: default: size = 2; } if (asxx) ol(".area _TEXT"); prefix(); outname(sname, YES); nl(); if (cmatch('{')) { /* aggregate initialiser */ if ((ident == POINTER || ident == VARIABLE) && type == STRUCT) { /* aggregate is structure or pointer to structure */ dim = 0; olddim = 1; if (ident == POINTER) point(); str_init(tag); } else { /* aggregate is not struct or struct pointer */ agg_init(size, type, ident, &dim, more, tag); } needchar('}'); } else { /* single initialiser */ init(size, ident, &dim, more, 0, 0); } /* dump literal queue and fill tail of array with zeros */ if ((ident == ARRAY && more == CCHAR) || type == STRUCT) { if (type == STRUCT) { dumpzero(tag->size, dim); desize = dim < 0 ? abs(dim+1)*tag->size : olddim * tag->size; } else { /* Handles unsized arrays of chars */ dumpzero(size, dim); dim = dim < 0 ? abs(dim+1) : olddim; cscale(type,tag,&dim); desize = dim; } dumplits(0, YES, gltptr, glblab, glbq); } else { if (!(ident == POINTER && type == CCHAR)) { dumplits(((size == 1) ? 0 : size), NO, gltptr, glblab,glbq); if ( type != CCHAR ) /* Already dumped by init? */ desize = dumpzero(size, dim); dim = dim < 0 ? abs(dim+1) : olddim; cscale(type,tag,&dim); desize = dim; } } } else { char *dosign, *typ; dosign = ""; if (ident == ARRAY && (dim == 0)) { typ = ExpandType(more, &dosign, (tag - tagtab)); warning(W_NULLARRAY, dosign, typ); } /* no initialiser present, let loader insert zero */ if (ident == POINTER) type = (zfar ? CPTR : CINT); cscale(type, tag, &dim); desize = dim; } return (desize); } /* * initialise structure */ int str_init(TAG_SYMBOL *tag) { int dim, flag; int sz, usz, numelements = 0; SYMBOL *ptr; int nodata = NO; ptr = tag->ptr; while (ptr < tag->end) { numelements++; dim = ptr->size; sz = getstsize(ptr,NO); if ( nodata == NO ) { if ( rcmatch('{') ) { needchar('{'); while (dim) { if ( ptr->type == STRUCT ) { if ( ptr->ident == ARRAY ) /* array of struct */ needchar('{'); str_init(tag); if ( ptr->ident == ARRAY ) { --dim; needchar('}'); } } else { init(sz, ptr->ident, &dim, 1, 1,1); } if (cmatch(',') == 0) break; blanks(); } needchar('}'); dumpzero(sz,dim); } else { init(sz, ptr->ident, &dim, ptr->more, 1, 1); } /* Pad out afterwards */ } else { /* Run out of data for this initialisation, set blank */ defstorage(); outdec(dim * getstsize(ptr,YES)); nl(); } usz = (ptr->size ? ptr->size : 1 ) * getstsize(ptr,YES); ++ptr; flag = NO; while (ptr->offset.i == 0 && ptr < tag->end) { if (getstsize(ptr,YES) * (ptr->size ? ptr->size : 1 ) > usz) { usz = getstsize(ptr,YES) * (ptr->size ? ptr->size : 1 ) ; flag = YES; } ++ptr; } /* Pad out the union */ if (usz != sz && flag) { defstorage(); outdec(usz - sz); nl(); } if (cmatch(',') == 0 && ptr != tag->end) { nodata = YES; } } return numelements; } /* * initialise aggregate */ void agg_init(int size, int type, int ident, int *dim, int more, TAG_SYMBOL *tag) { while (*dim) { if (ident == ARRAY && type == STRUCT) { /* array of struct */ needchar('{'); str_init(tag); --*dim; needchar('}'); } else { init(size, ident, dim, more, (ident == ARRAY && more == CCHAR),0); } if (cmatch(',') == 0) break; blanks(); } } /* * evaluate one initialiser * * if dump is TRUE, dump literal immediately * save character string in litq to dump later * this is used for structures and arrays of pointers to char, so that the * struct or array is built immediately and the char strings are dumped later */ void init(int size, int ident, int *dim, int more, int dump, int is_struct) { long value; int sz; /* number of chars in queue */ /* * djm 14/3/99 We have to rewrite this bit (ugh!) so that we store * our literal in a temporary queue, then if needed, we then dump * it out.. */ if ((sz = qstr(&value)) != -1 ) { sz++; #if 0 if (ident == VARIABLE || (size != 1 && more != CCHAR)) error(E_ASSIGN); #endif #ifdef INIT_TEST outstr("ident="); outdec(ident); outstr("size="); outdec(size); outstr("more="); outdec(more); outstr("dim="); outdec(*dim); outstr("sz="); outdec(sz); nl(); #endif if (ident == ARRAY && more == 0) { /* * Dump the literals where they are, padding out as appropriate */ if (*dim != -1 && sz > *dim) { /* * Ooops, initialised to long a string! */ warning(W_INIT2LONG); sz = *dim; gltptr = sz; *(glbq + sz - 1) = '\0'; /* Terminate string */ } dumplits(((size == 1) ? 0 : size), NO, gltptr, glblab, glbq); *dim -= sz; gltptr = 0; dumpzero(size, *dim); return; } else { /* * Store the literals in the queue! */ storeq(sz, glbq, &value); gltptr = 0; defword(); printlabel(litlab); outbyte('+'); outdec(value); nl(); --*dim; return; } } /* * djm, catch label names in structures (for (*name)() initialisation */ else { char sname[NAMEMAX + 1]; SYMBOL *ptr; if (symname(sname) && strcmp(sname,"sizeof") ) { /* We have got something.. */ if ((ptr = findglb(sname))) { /* Actually found sommat..very good! */ if (ident == POINTER || (ident == ARRAY && more)) { defword(); outname(ptr->name, dopref(ptr)); nl(); --*dim; } else if (ptr->type == ENUM) { value = ptr->size; goto constdecl; } else { error(E_DDECL); } } else error(E_UNSYMB, sname); } else if (rcmatch('}')) { #if 0 dumpzero(size,*dim); #endif } else if (constexpr(&value, 1)) { constdecl: if (ident == POINTER) { /* 24/1/03 dom - We want to be able to assign values to pointers or they're a bit useless.. */ #if 0 /* the only constant which can be assigned to a pointer is 0 */ if (value != 0) warning(W_ASSPTR); #endif size = 2; dump = YES; } if (dump) { /* struct member or array of pointer to char */ if (size == 4) { /* there appears to be a bug in z80asm regarding defl */ defbyte(); outdec((value % 65536UL) % 256); outbyte(','); outdec((value % 65536UL) / 256); outbyte(','); outdec((value / 65536UL) % 256); outbyte(','); outdec((value / 65536UL) / 256); } else { if (size == 1) defbyte(); else defword(); outdec(value); } nl(); /* Dump out a train of zeros as appropriate */ if (ident == ARRAY && more == 0) { dumpzero(size,(*dim)-1); } } else stowlit(value, size); --*dim; } } } /* Find the size of a member of a union/structure */ int getstsize(SYMBOL * ptr,char real) { TAG_SYMBOL *tag; int ptrsize; tag = tagtab + ptr->tag_idx; ptrsize = ptr->flags&FARPTR ? 3 : 2; #if 1 if ( ptr->ident == POINTER && real) return ptrsize; #endif switch (ptr->type) { case STRUCT: return (tag->size); case DOUBLE: return (6); case LONG: return (4); case CPTR: return (3); case CINT: return (2); default: return (1); } } z88dk-1.8.ds1/src/sccz80/declinit.h0000644000175000017500000000054707614327772016376 0ustar tygrystygrysextern int initials(char *sname, int type, int ident, int dim, int more, TAG_SYMBOL *tag, char zfar); extern int str_init(TAG_SYMBOL *tag); extern void agg_init(int size, int type, int ident, int *dim, int more, TAG_SYMBOL *tag); extern void init(int size, int ident, int *dim, int more, int dump, int is_struct); extern int getstsize(SYMBOL *ptr,char real); z88dk-1.8.ds1/src/sccz80/declvar.c0000644000175000017500000006436310643235304016205 0ustar tygrystygrys/******************************************************************** * * Small C+ Routines to Handle the Declaration of global * variables (parsing of prototypes, function definitions etc) * * Also routines to parse variables and add them into the * symbol table * * Split into parts djm 3/3/99 * * $Id: declvar.c,v 1.16 2007/07/05 18:39:00 dom Exp $ * * The Declaration Routines * (Oh they're so much fun!!) * * 16/3/99 djm A little bit of tidying up * * 18/3/99 djm Invented the GetVarID function to really clean up * the code (much easier to read now!) sorted a little bug out * with local statics which was causing their type size to be * dumped after initialisation * * 29/3/99 djm Allowed pointers to functions return pointers... * ******************************************************************** */ #include "ccdefs.h" /* * test for global declarations/structure member declarations */ int dodeclare ( int storage, TAG_SYMBOL *mtag, /* tag of struct whose members are being declared, or zero */ int is_struct /* TRUE if struct member is being declared, zero for union */ ) /* only matters if mtag is non-zero */ { struct varid var; /* Our little structure for iding vars */ TAG_SYMBOL *otag ; /* tag of struct object being */ /* declared */ otag=GetVarID(&var,storage); if (var.type == NO) { if (storage==EXTERNAL) var.type=CINT; else return(0); /* fail */ } if (var.type == STRUCT ) { declglb(STRUCT, storage, mtag, otag, is_struct,var.sign,var.zfar) ; return (1); } else { declglb(var.type,storage, mtag, NULL_TAG, is_struct,var.sign,var.zfar); return(1); } } /* * define structure/union members * return pointer to new structure tag */ TAG_SYMBOL * defstruct (char *sname, int storage, int is_struct) { int itag ; /* index of tag in tag symbol table */ char nam[20]; /* Dummy name */ TAG_SYMBOL *tag = NULL; if ( tagptr >= ENDTAG ) { error(E_STROV) ; } if ( sname && sname[0] == 0 ) sname = NULL; if ( sname && (tag = findtag(sname) ) ) { if ( tag->weak == 0 ) { if ( rcmatch('{') ) multidef(); else return tag; } itag = tag - tagtab; } /* No tag defined for this, so leave it alone */ if ( tag == NULL ) { tag = tagptr++; itag = tag - tagtab ; sprintf(nam,"0st%d",itag); if ( sname == NULL ) sname = nam; strcpy(tag->name,sname); tag->size = 0; tag->ptr = tag->end = membptr ; /* Set so no member searches done.. */ dummy_sym[NTYPE+1+itag] = addglb(nam,POINTER,STRUCT,0,STATIK,0,itag) ; tag->weak = 1; } if ( rcmatch('{' ) ) { /* increment tagptr to add tag to table */ tag->ptr = membptr; tag->weak = 0; needchar('{') ; while ( dodeclare(storage, tag, is_struct) ) ; needchar('}') ; tag->end = membptr ; } return tag ; } /* * declare an enum, ATP we have to parse between the curly brackets */ void defenum(char *sname, char storage) { SYMBOL *ptr; char name[NAMEMAX]; long value; /* Add it into the symbol table, we do not need to keep track of the * tag because we treat enums as constants */ addglb(sname, ENUM, CINT, 0, storage, 0, 0); value=0; /* initial constant */ needchar('{'); do { if (symname(name)==0) illname(name); if ( cmatch('=') ) constexpr(&value,1); ptr=addglb(name,VARIABLE,ENUM,0,STATIK,0,0); ptr->size=value; value++; } while (cmatch(',')); needchar('}'); } /* * make a first stab at determining the ident of a variable */ int get_ident (void) { if ( match("**") ) return PTR_TO_PTR ; if ( match("*(*") ) return PTR_TO_FNP; if ( cmatch('*') ) return POINTER ; if ( match("(*") ) return PTR_TO_FN ; return VARIABLE ; } /* * return correct index into dummy_sym */ int dummy_idx (int typ, TAG_SYMBOL *otag) { if ( typ == STRUCT ) return NTYPE + 1 + (otag-tagtab) ; else if (typ <= VOID ) return typ; else return CINT; } /* * Declare a static variable (i.e. define for use) * * makes an entry in the symbol table so subsequent * references can call symbol by name */ void declglb( int typ , /* typ is CCHAR, CINT, DOUBLE, STRUCT, LONG, */ int storage, TAG_SYMBOL *mtag , /* tag of struct whose members are being declared, or zero */ TAG_SYMBOL *otag , /* tag of struct for object being declared */ int is_struct , /* TRUE if struct member being declared, zero if union */ char sign , /* TRUE if need signed */ char zfar ) /* TRUE if far */ { char sname[NAMESIZE]; int size, ident, more, itag, type, size_st; long addr = -1; char flagdef,match,ptrtofn; char libdef,fastcall,callee; SYMBOL *myptr ; do { if ( endst() ) break; /* do line */ type = typ ; size = 1 ; /* assume 1 element */ more = /* assume dummy symbol not required */ itag = 0 ; /* just for tidiness */ flagdef=libdef=fastcall=callee=NO; match=ptrtofn=NO; while (blanks(),rcmatch('_') ) { match=NO; if (amatch("__APPFUNC__") ) { match=YES; flagdef=1; } if (amatch("__LIB__") /* && libdef==0 */) {match=YES; libdef|=LIBRARY; } if (amatch("__FASTCALL__") ) {match=YES; fastcall=REGCALL; } if (amatch("__SHARED__") ) {match=YES; libdef|=SHARED; } if (amatch("__SHAREDC__") ) {match=YES; libdef|=SHAREDC; } if (amatch("__CALLEE__") ) {match=YES; callee=CALLEE; } if (match ==NO )break; } ident = get_ident() ; if (storage==TYPDEF && ident !=VARIABLE && mtag ==0 ) warning(W_TYPEDEF); if ( symname(sname) == 0 ) /* name ok? */ illname(sname) ; /* no... */ if ( ident == PTR_TO_FNP ) { /* function returning pointer needs dummy symbol */ more = dummy_idx(typ, otag) ; type = (zfar ? CPTR : CINT ); size=0; ptrtofn=YES; } else if ( ident == PTR_TO_FN ) { ident = POINTER ; ptrtofn=YES; #if 0 } else if ( cmatch('@') ) { storage = EXTERNP; constexpr(&addr,1); #endif } else if ( cmatch('(') ) { /* * Here we check for functions, but we can never have a pointer to * function because thats considered above. Which means as a very * nice side effect that we don't have to consider structs/unions * since they can't contain functions, only pointers to functions * this, understandably(!) makes the work here a lot, lot easier! */ storage=AddNewFunc(sname,type,storage,zfar,sign,otag,ident,&addr); /* * On return from AddNewFunc, storage will be: * EXTERNP = external pointer, in which case addr will be set * !! FUNCTION = have prototyped a function (NOT USED!) * 0 = have declared a function/!! prototyped ANSI * * If 0, then we have to get the hell out of here, FUNCTION * then gracefully loop round again, if EXTERNP, carry on with * this function, anything else means that we've come up * against a K&R style function definition () so carry on * as normal! * * If we had our function prefixed with __APPFUNC__ then we want * to write it out to the zcc_opt.def file (this bloody thing * is becoming invaluable for messaging! * * __SHARED__ indicates in a library so preserve carry flag * (so we can test with iferror) * * __CALLEE__ indicates that the function called cleans up * the stack * * __SHAREDC__ is indicates call by rst 8 but is unused.. * (old idea unused, but may yet be useful) */ if (flagdef) WriteDefined(sname,0); if (currfn) { /* djm 1/2/03 - since we can override lib functions don't reset the library flag currfn->flags&=(~LIBRARY); */ if (libdef) { // currfn->flags|=LIBRARY; currfn->flags|=libdef; } if (callee && (libdef&SHARED) != SHARED && \ (libdef&SHAREDC) != SHAREDC ) currfn->flags|=callee; if (fastcall) currfn->flags|=fastcall; } if (storage==0) { if ( addr != -1 ) { currfn->size = addr; } return; } /* * External pointer..check for the closing ')' */ if (storage==EXTERNP) { needchar(')'); } else { /* * Must be a devilishly simple prototype! ();/, type... */ ptrerror(ident) ; if ( ident == POINTER ) { /* function returning pointer needs dummy symbol */ more = dummy_idx(typ, otag) ; type = (zfar ? CPTR : CINT ); ident=FUNCTIONP; } else { ident=FUNCTION; } size = 0 ; } } if (cmatch('[')) { /* array? */ ptrerror(ident) ; if ( ident == POINTER) { /* array of pointers needs dummy symbol */ more = dummy_idx(typ, otag) ; type = (zfar ? CPTR : CINT ); } size = needsub() ; /* get size */ if (size == 0 && ident == POINTER ) size=0; ident = ARRAY; if ( ptrtofn ) needtoken(")()"); } else if ( ptrtofn ) { needtoken(")()") ; } else if ( ident == PTR_TO_PTR ) { ident = POINTER ; more = dummy_idx(typ, otag) ; type = (zfar ? CPTR : CINT ); } if ( cmatch('@') ) { storage = EXTERNP; constexpr(&addr,1); } /* Check to see if far has been defined when we haven't got a pointer */ if (zfar && !(ident==POINTER || (ident==ARRAY && more) || (ident==FUNCTIONP && more))) { warning(W_FAR); zfar=NO; } if ( otag ) { /* calculate index of object's tag in tag table */ itag = otag - tagtab ; } /* add symbol */ if ( mtag == 0 ) { /* this is a real variable, not a structure member */ if (typ == VOID && ident != FUNCTION && ident!=FUNCTIONP && ident != POINTER && ident != ARRAY ) { warning(W_BADDECL); typ=type=CINT; } myptr=addglb(sname, ident, type, 0, storage, more, itag) ; /* What happens if we have an array which will be initialised? */ myptr->flags = ( sign | zfar | fastcall ); /* initialise variable (allocate storage space) */ /* defstatic to prevent repetition of def for declared statics */ defstatic=0; myptr->size=0; /* Set to zero.. */ if ( ident == FUNCTION || ident==FUNCTIONP ) { myptr->prototyped=0; myptr->args[0]=CalcArgValue(typ,ident,myptr->flags); myptr->ident=FUNCTION; if (typ==STRUCT) myptr->tagarg[0]=itag; } if ( storage != EXTERNAL && ident != FUNCTION ) { size_st=initials(sname, type, ident, size, more, otag, zfar) ; if (storage == EXTERNP) myptr->size=addr; else myptr->size=size_st; if (defstatic) myptr->storage=DECLEXTN; } /* * Set the return type of the function */ if ( ident == FUNCTION ) { myptr->args[0]=CalcArgValue(type, FUNCTION, myptr->flags); myptr->flags|=callee; } /* Make library routines so.. */ if ( storage == EXTERNAL && ident == FUNCTION ) { myptr->handled=0; myptr->flags&=(~LIBRARY); if (libdef) myptr->flags|=LIBRARY; if (libdef==SHARED || libdef==SHAREDC){ /* Shared can't be __CALLEE__ */ myptr->flags&=(~CALLEE); myptr->flags|=libdef|LIBRARY; } } } else if ( is_struct ) { if ( type==CINT && ident==VARIABLE ) BitFieldSwallow(); /* are adding structure member, mtag->size is offset */ myptr=addmemb(sname, ident, type, mtag->size, storage, more, itag) ; myptr--; /* addmemb returns myptr+1 */ myptr->flags = ( (sign&UNSIGNED) | (zfar&FARPTR) ); myptr->size = size; /* store (correctly scaled) size of member in tag table entry */ /* 15/2/99 djm - screws up sizing of arrays - quite obviously!! - removing */ if ( ident == POINTER) { /* || ident== ARRAY ) { */ type=(zfar ? CPTR : CINT); } cscale(type, otag, &size) ; mtag->size += size ; } else { /* are adding union member, offset is always zero */ myptr=addmemb(sname, ident, type, 0, storage, more, itag) ; myptr--; myptr->flags = ( (sign&UNSIGNED) | (zfar&FARPTR) ); myptr->size = size; /* store maximum member size in tag table entry */ /* 2/11/2002 djm - fix from above */ if ( ident == POINTER /* || ident==ARRAY */ ) { type=(zfar ? CPTR : CINT); } cscale(type, otag, &size) ; if ( mtag->size < size ) mtag->size = size ; } } while ( cmatch(',') ) ; ns() ; } /* * Declare local variables (i.e. define for use) * * works just like "declglb" but modifies machine stack * and adds symbol table entry with appropriate * stack offset to find it again */ void declloc( int typ , /* typ is CCHAR, CINT DOUBLE or STRUCT, LONG */ TAG_SYMBOL *otag , /* tag of struct for object being declared */ char sign, /* Are we signed or not? */ char locstatic, /* Is this as static local variable? */ char zfar) /* Far pointer thing.. */ { char sname[NAMESIZE]; char sname2[3*NAMESIZE]; /* More than enuff overhead! */ SYMBOL *cptr ; int dsize,size, ident, more, itag, type, decltype ; /* if ( swactive ) error(E_DECLSW) ; */ if ( declared < 0 ) error(E_DECLST) ; do { if ( endst() ) break ; type = decltype = typ ; more = /* assume dummy symbol not required */ itag = 0 ; dsize=size = 1 ; ident = get_ident() ; if ( symname(sname) == 0 ) illname(sname) ; if ( ident == FUNCTIONP ) { needtoken(")()"); /* function returning pointer needs dummy symbol */ more = dummy_idx(typ, otag) ; type = (zfar ? CPTR : CINT ); dsize=size = (zfar ? 3 : 2 ); } if ( ident == PTR_TO_FN ) { needtoken(")()") ; ident = POINTER ; } if ( cmatch('[') ) { ptrerror(ident) ; if ( ident == POINTER ) { /* array of pointers needs dummy symbol */ more = dummy_idx(typ, otag) ; type = ( zfar ? CPTR : CINT ); } dsize=size = needsub() ; ident = ARRAY ; /* null subscript array is NOT a pointer */ cscale(type, otag, &size); } else if ( ident == PTR_TO_PTR ) { ident = POINTER ; more = dummy_idx(typ, otag) ; type = (zfar ? CPTR : CINT ) ; dsize=size = (zfar ? 3 : 2 ); } else { switch ( type ) { case CCHAR : size = 1 ; break ; case LONG : size = 4; break ; case DOUBLE : size = 6 ; break ; case STRUCT : size = otag->size ; break ; default : size = 2 ; } } /* Check to see if far has been defined when we haven't got a pointer */ if (zfar && !(ident==POINTER || (ident==ARRAY && more))) { warning(W_FAR); zfar=NO; } if (typ == VOID && ident != FUNCTION && ident != POINTER ) { warning(W_BADDECL); typ=type=CINT; } if (ident == POINTER) { decltype = ( zfar ? CPTR : CINT); size = ( zfar ? 3 : 2 ); } /* declared += size ; Moved down djm */ if ( otag ) itag = otag - tagtab ; /* djm, add in local statics - use the global symbol table to ensure * that they will be placed in RAM and not in ROM */ if (locstatic) { strcpy(sname2,"st_"); strcat(sname2,currfn->name); strcat(sname2,"_"); strcat(sname2,sname); cptr=addglb(sname2,ident,type,0,LSTATIC,more,itag); if (cptr) { cptr->flags=( (sign&UNSIGNED) | (zfar&FARPTR)); cptr->size=size; } if (rcmatch('=') ) { /* * Insert the jump in... */ if (lstdecl++ == 0 ) { jump(lstlab=getlabel()); } initials(sname2, type, ident, dsize, more, otag,zfar); ns(); cptr->storage=LSTKEXT; return; } else if (ident==ARRAY && dsize == 0 ) { char *dosign="",*typ; typ=ExpandType(more,&dosign,otag-tagtab); warning(W_NULLARRAY,dosign,typ); } } else { declared += size; cptr = addloc(sname, ident, type, more, itag); if ( cptr ) { cptr->size=size; cptr->offset.i = Zsp - declared ; cptr->flags=( (sign&UNSIGNED) | (zfar&FARPTR) ); if (cmatch('=') ) { int vconst, val, expr; char *before,*start; if ( (typ == STRUCT && ident != POINTER) || ident == ARRAY ) error(E_AUTOASSIGN,sname); if (lstdecl) postlabel(lstlab); lstdecl=0; Zsp=modstk(Zsp-(declared-size),NO,NO); declared=0; setstage(&before,&start); expr=expression(&vconst,&val); clearstage(before,start); //conv type force(decltype,expr,0,0,0); StoreTOS(decltype); } } } } while ( cmatch(',') ) ; ns() ; } /* * Calculate a value for the arguments, this is kludgey but * kinda nice at the same time * bits 0-2 = type ; 3-5 = ident, 7-8=flags (signed & zfar) */ unsigned char CalcArgValue(char type, char ident, char flags) { if (type==ELLIPSES) return PELLIPSES; if (type==VOID) flags&=MKSIGN; /* remove sign from void */ return( type+(ident*8)+((flags&MKDEF)*64) ); } /* * Expand the type into something nice */ char *ExpandType(int type, char **dosign, char tagidx) { char *typ; switch(type) { case DOUBLE: typ="double "; *dosign=""; break; case CINT: typ="int "; break; case CCHAR: typ="char "; break; case LONG: typ="long "; break; case CPTR: typ="lptr "; break; case STRUCT: *dosign="struct "; typ=(&tagtab[(int) tagidx])->name; break; case VOID: typ="void "; *dosign=""; break; default: typ=" "; break; } return typ; } /* * Expand the prototype byte out into what the variable actually * is.. */ char * ExpandArgValue(unsigned char value, char *buffer, char tagidx) { char ident, type, isfar, issigned; char *id, *typ, *dofar, *dosign; type=value&7; /* Lower 3 bits */ ident=(value&56)/8; /* Middle 3 bits */ isfar=(value&128); issigned=(value&64); if (issigned) dosign="unsigned "; else dosign="signed "; if (isfar) dofar="far "; else dofar=""; typ=ExpandType(type,&dosign,tagidx); switch(ident) { case POINTER: id="*"; break; case FUNCTION: id="fn"; break; case FUNCTIONP: id="*fn"; break; case VARIABLE: case ARRAY: default: id=""; break; } sprintf(buffer,"%s%s%s%s",dofar,dosign,typ,id); return (buffer); } /* * test for function returning/array of ptr to ptr (unsupported) */ void ptrerror (int ident) { if ( ident == PTR_TO_PTR ) error(E_INDIRECTION) ; } /* * Get required array size * * invoked when declared variable is followed by "[" * this routine makes subscript the absolute * size of the array. */ int needsub (void) { long num; if ( cmatch(']') ) return (0); /* null size */ if ( constexpr(&num,1) == 0 ) { num = 1 ; } else if ( num < 0 ) { error(E_NEGATIVE); num = (-num) ; } needchar(']') ; /* force single dimension */ return ((int) num) ; /* and return size */ } /* * Get the type of variable, handles far, unsigned etc, this * way is much neater and centralises things somewhat! * * Returns otag for structure or 0 (can tell success via var.type) * * djm 18/3/99 */ TAG_SYMBOL *GetVarID(struct varid *var,char storage) { TAG_SYMBOL *otag = NULL; char sname[NAMEMAX]; SYMBOL *ptr; var->sign=dosigned; var->zfar=NO; var->type=NO; var->sflag=NO; if (swallow("const") ) warning(W_CONST); else if (swallow("volatile") ) warning(W_VOLATILE); if (amatch("far") ) var->zfar=FARPTR; else if ( amatch("near") ) var->zfar=NO; if (amatch("signed") ) { var->type=CINT; var->sign=NO; } else if (amatch("unsigned") ) { var->type=CINT; var->sign=YES; } if (amatch("char") ) var->type=CCHAR; else if (amatch("int") ) var->type=CINT; else if (amatch("long") ) { swallow("int"); var->type=LONG; } else if (amatch("short") ) { swallow("int"); var->type=CINT; } else if (amatch("float") || amatch("double") ) { incfloat=1; var->type=DOUBLE; } else if (amatch("void") ) var->type=VOID; else if (amatch("enum") ) { if ( symname(sname) == 0 ) sprintf(sname,"sc_i_enumb%d",defdenums++); ptr=findenum(sname); if ( ptr == 0 ) /* not defined */ defenum(sname,storage); var->type=CINT; var->sign=dosigned; } else if ( (var->sflag=amatch("struct")) || amatch("union") ) { var->type=STRUCT; /* find structure tag */ if ( storage==TYPDEF && rcmatch('{') ) return (defstruct(NULL, storage, var->sflag) ); /* Get the symbol name if present */ symname(sname); if ( storage == 0 ) { if ( (otag = findtag(sname) ) == NULL ) { error(E_UNSTR); } else { return otag; } } else otag = defstruct(sname, storage, var->sflag) ; return(otag); } else { SYMBOL *ptr; ptr=STARTGLB; while ( ptr < ENDGLB ) { if (ptr->name[0] && ptr->storage == TYPDEF && amatch(ptr->name) ) { /* Found a typedef match */ var->sign=ptr->flags&UNSIGNED; var->zfar=ptr->flags&FARPTR; var->type=ptr->type; if (var->type==STRUCT) return (tagtab+ptr->tag_idx); else return(0); } ++ptr; } } return(0); } /* * Swallow bitfield definition */ void BitFieldSwallow (void) { long val; if (cmatch(':')) { constexpr(&val,1); warning(W_BITFIELD); } } z88dk-1.8.ds1/src/sccz80/declvar.h0000644000175000017500000000143207130401713016172 0ustar tygrystygrys/* decl.c */ extern int dodeclare(int storage, TAG_SYMBOL *mtag, int is_struct); extern TAG_SYMBOL *defstruct(char *sname, int storage, int is_struct); extern int get_ident(void); extern int dummy_idx(int typ, TAG_SYMBOL *otag); extern void declglb(int typ, int storage, TAG_SYMBOL *mtag, TAG_SYMBOL *otag, int is_struct, char sign, char zfar); extern void declloc(int typ, TAG_SYMBOL *otag, char sign, char locstatic, char zfar); extern unsigned char CalcArgValue(char type, char ident, char flags); extern char *ExpandArgValue(unsigned char value, char *buffer, char tagidx); extern void ptrerror(int ident); extern int needsub(void); extern TAG_SYMBOL *GetVarID(struct varid *var,char storage); extern void BitFieldSwallow(void); extern char *ExpandType(int type, char **sign, char tagidx); z88dk-1.8.ds1/src/sccz80/define.h0000644000175000017500000002050410551132474016013 0ustar tygrystygrys/* Define system dependent parameters * * $Id: define.h,v 1.9 2007/01/10 09:43:24 stefano Exp $ */ /* Stand-alone definitions */ #define NO 0 #define YES 1 #define NULL 0 #define NULL_FD 0 #define NULL_FN 0 #define NULL_CHAR 0 #define alloc malloc /* Offset to stack params for shared lib funcs */ #define SHAREOFFSET 4 /* System wide name size (for symbols) */ #if defined(__MSDOS__) && defined(__TURBOC__) #define NAMESIZE 33 #define NAMEMAX 32 #else #define NAMESIZE 127 #define NAMEMAX 126 #endif #define MAXARGS 10 /* Define the symbol table parameters */ /* Stefano - doubled the global symble table size */ #define NUMGLBS 1024 #define MASKGLBS 1023 #define STARTGLB symtab #define ENDGLB (STARTGLB+NUMGLBS) #if defined(__MSDOS__) && defined(__TURBOC__) #define NUMLOC 33 #else #define NUMLOC 512 #endif #define STARTLOC loctab #define ENDLOC (STARTLOC+NUMLOC) /* Define symbol table entry format */ #define SYMBOL struct symb #define TAG_SYMBOL struct tag_symbol SYMBOL { char name[NAMESIZE] ; char ident ; /*VARIABLE, ARRAY, POINTER, FUNCTION, MACRO */ char type ; /* DOUBLE, CINT, CCHAR, STRUCT */ char storage ; /* STATIK, STKLOC, EXTERNAL */ union xx { /* offset has a number of interpretations: */ int i ; /* local symbol: offset into stack */ /* struct member: offset into struct */ /* global symbol: FUNCTION if symbol is declared fn */ /* or offset into macro table, else 0 */ SYMBOL *p ; /* also used to form linked list of fn args */ } offset ; int more ; /* index of linked entry in dummy_sym */ char tag_idx ; /* index of struct tag in tag table */ int size ; /* djm, storage reqd! */ char handled; /* djm, whether we've written the type or not */ char prototyped; unsigned char args[MAXARGS]; /* arguments */ unsigned char tagarg[MAXARGS]; /* ptrs to tagsymbol entries*/ unsigned int flags ; /* djm, various flags: bit 0 = unsigned bit 1 = far data/pointer bit 2 = access via far methods */ } ; #ifdef SMALL_C #define NULL_SYM 0 #else #define NULL_SYM (SYMBOL *)0 #endif /* Define possible entries for "ident" */ #define VARIABLE 1 #define ARRAY 2 #define POINTER 3 #define FUNCTION 4 #define MACRO 5 /* function returning pointer */ #define FUNCTIONP 6 #define GOTOLABEL 9 /* the following only used in processing, not in symbol table */ #define PTR_TO_FN 7 #define PTR_TO_PTR 8 #define PTR_TO_FNP 10 /* Define possible entries for "type" */ #define DOUBLE 1 #define CINT 2 #define CCHAR 3 #define LONG 4 /* was 5 */ #define CPTR 5 /* was 6 - 3 byte pointer */ #define STRUCT 6 /* was 4 */ #define VOID 7 /* This does actually do sommat now */ #define ELLIPSES 8 /* Used for ANSI defs */ #define ENUM 9 /* ONly used in symbol table */ #define CARRY 10 /* Carry stuff */ /* * Value of ellipses in prototypes */ #define PELLIPSES 255 /* * Mask of sign in prototype */ #define PMASKSIGN 191 /* * What void comes out to in a prototype */ #define PVOID 15 /* number of types to which pointers to pointers can be defined */ /* 15 is more than enough! we need some dummy symbols so casting of ** * types will work.. */ #define NTYPE 15 /* Define possible entries for "storage" */ #define STATIK 1 #define STKLOC 2 #define EXTERNAL 3 #define EXTERNP 4 #define DECLEXTN 5 #define LSTATIC 6 #define FAR 7 #define LSTKEXT 8 #define TYPDEF 9 #define LIBOVER 10 /* Library override */ /* Flags */ #define UNSIGNED 1 #define FARPTR 2 #define FARACC 4 #define REGCALL 8 /* for certain lib calls only */ #define SHARED 16 /* Call via shared library method (append _s) */ #define SHAREDC 32 /* Call via rst (library is C code) */ #define CALLEE 64 /* Called function pops regs */ #define LIBRARY 128 /* Lib routine */ /* * MKDEF is for masking unsigned and far */ #define MKDEF 3 #define MKSIGN 254 #define MKFARP 253 #define MKFARA 251 /* Define the structure tag table parameters */ #define NUMTAG 300 #define STARTTAG tagtab #define ENDTAG tagtab+NUMTAG struct tag_symbol { char name[NAMESIZE] ; /* structure tag name */ int size ; /* size of struct in bytes */ char weak; /* Not fully defined */ SYMBOL *ptr ; /* pointer to first member */ SYMBOL *end ; /* pointer to beyond end of members */ } ; #ifdef SMALL_C #define NULL_TAG 0 #else #define NULL_TAG (TAG_SYMBOL *)0 #endif /* Define the structure member table parameters */ #define NUMMEMB 2000 #define STARTMEMB membtab #define ENDMEMB (membtab+NUMMEMB) /* switch table */ #define NUMCASE 256 struct sw_tab { int label ; /* label for start of case */ long value ; /* value associated with case */ } ; #define SW_TAB struct sw_tab /* Define the "while" statement queue */ #define NUMWHILE 20 #define WQMAX wqueue+(NUMWHILE-1) #define WHILE_TAB struct while_tab struct while_tab { int sp ; /* stack pointer */ int loop ; /* label for top of loop */ int exit ; /* label at end of loop */ } ; #define NUMGOTO 100 #define GOTO_TAB struct goto_tab GOTO_TAB { int sp; /* Stack pointer to correct to */ SYMBOL *sym; /* Pointer to goto label */ int lineno; /* line where goto was */ int next; /* Link to next in goto chain */ int label; /* Literal label */ }; /* Define the literal pool */ #if defined(__MSDOS__) && defined(__TURBOC__) #define LITABSZ 950 #else #define LITABSZ 49152 #endif #define LITMAX LITABSZ-1 /* For the function literal queues... */ #if defined(__MSDOS__) && defined(__TURBOC__) #define FNLITQ 5000 #else #define FNLITQ 49152 #endif #define FNMAX FNLITQ-1 /* Define the input line */ #define LINESIZE 1024 #define LINEMAX (LINESIZE-1) #define MPMAX LINEMAX /* Output staging buffer size */ #define STAGESIZE 3450 #define STAGELIMIT (STAGESIZE-1) /* Define the macro (define) pool */ #define MACQSIZE 500 #define MACMAX MACQSIZE-1 /* Define statement types (tokens) */ #define STIF 1 #define STWHILE 2 #define STRETURN 3 #define STBREAK 4 #define STCONT 5 #define STASM 6 #define STEXP 7 #define STDO 8 #define STFOR 9 #define STSWITCH 10 #define STCASE 11 #define STDEF 12 #define STGOTO 13 /* Maximum number of errors before we barf */ #define MAXERRORS 10 /* Maximum number of nested levels */ #define MAX_LEVELS 100 /* define length of names for assembler */ #define ASMLEN 32 #ifdef SMALL_C #define SYM_CAST #define TAG_CAST #define WQ_CAST #define SW_CAST #else #define SYM_CAST (SYMBOL *) #define TAG_CAST (TAG_SYMBOL *) #define WQ_CAST (WHILE_TAB *) #define SW_CAST (SW_TAB *) #endif /* * djm, function for variable definitions now */ #define APPFUNC 1 #define LIBFUNC 2 struct varid { unsigned char type; unsigned char zfar; unsigned char sign; unsigned char sflag; unsigned char defstatus; /* APPFUNC, LIBFUNC etc */ unsigned char ident; int more; }; /* defines for globalisation */ #define XDEF 0 #define XREF 1 #define LIB 2 /* Defines for debugging */ #define DBG_CAST1 1 #define DBG_CAST2 2 #define DBG_ARG1 11 #define DBG_ARG2 12 #define DBG_ARG3 13 #define DBG_GOTO 14 #define DBG_FAR1 21 #define DBG_ALL 99 #define Z80ASM_PREFIX "_" z88dk-1.8.ds1/src/sccz80/error.c0000644000175000017500000001645610031124521015703 0ustar tygrystygrys/* * Small C Compiler * * Errors and other such misfitting routines * * $Id: error.c,v 1.4 2004/03/26 22:06:09 denniz Exp $ */ #include "ccdefs.h" #include /* * All those lovely error & warnig messages */ struct warnings mywarn[]={ /* * Warnings related to function prototyping */ {"",0}, {"Too few arguments in function",0}, {"Too many arguments in function call",0}, {"Too many arguments in declaration",0}, {"Function returns different type to prototype",0}, {"Prototype is %s",0}, {"Function is %s",0}, /* Very annoying warning! */ {"Return type defaults to int",1}, /* * Warnings that can be circumvented by casting */ {"Converting integer to pointer without cast",0}, {"Converting pointer to integer without cast",0}, {"Equating of different signedness",1}, {"Operation on different signedness!",1}, {"Converting far ptr to near ptr",0}, {"Pointer/pointer type mismatch",0}, /* * Well, who can't type then? */ {"Expected ','",0}, {"Expected '\"'",0}, {"Expected '\''",0}, {"Expected ';'",0}, {"Unterminated assembler code",0}, {"Unknown #pragma directive",0}, /* * Warnings that can pop up during declarations */ {"Far only applicable to pointers",0}, {"Initialisation too long, truncating!",0}, {"Bad variable declaration (void)",0}, {"Static incompatible with register/auto",0}, {"Cannot assign value to pointer",0}, /* * Blatantly daft expression things */ {"Illegal sizeof operation (on function)",0}, {"Expected argument",0}, {"Int constant in double expression",0}, {"Getting value from void function",1}, /* * I shall write the compiler better, well one day at least! */ {"Compiler bug - code may not work properly",1}, {"Fix soon hopefully! Next warning may be dubious!",1}, {"Bitfields not supported by compiler",0}, /* * Some more just added on to the end.. */ {"Division by zero, result set to be zero",0}, {"Call to function without prototype",1}, {"Func expects: %s",0}, {"Func gets: %s",0}, {"In function: %s() line %d",0}, {"Typedef doesn't support pointer types (sorry!)",0}, {"Converting long to double in generic math mode",0}, {"Const type not supported by compiler",0}, {"Volatile type not supported by compiler",0}, {"... must be preceded by named argument",0}, {"Floating point not supported by printf yet!",1}, {"Function arguments have sign mismatch",0}, {"Auto by default in function definition",0}, {"%s%s*[] type uninitialised has no storage",0}, {"Unreachable code follows",0}, {"Unknown escape sequence \\%c",0}, {"Internal thingummyjob please report!!! Please!",0} }; struct errors { char *error; char fatal; } myerrors[]={ /* * What happens when file operations screw up? Yup an error.. */ {"",0}, {"Unexpected end of file",1}, {"Can't open zcc_opt.def file",1}, {"Can't nest include files",1}, {"Can't open include file",1}, {"Input line too long",1}, {"Output file error",1}, /* * What type of program are you writing, you use too much memory! */ {"Double literal space exhausted",1}, {"Literal Queue Overflow",1}, {"Staging buffer overflow",1}, {"Macro table full",1}, {"Global symbol table overflow",1}, {"Local symbol table overflow",1}, {"Structure member table overflow",1}, {"Structure symbol table overflow",1}, /* * Hey boy, don't make yer program too complex */ {"Indirection too deep",1}, {"Negative Size Illegal",0}, {"Not in switch",0}, {"Too many cases",0}, {"Multiple defaults",0}, {"Too many active whiles",1}, {"Out of context",0}, {"Must assign to char pointer or array",0}, {"Dodgy declaration (not pointer)",0}, {"Can't declare within switch",1}, {"Must declare at start of block",1}, /* * Learn to type proper! */ {"Illegal Function or Declaration",0}, {"Missing Open Parenthesis",1}, {"Illegal Argument Name: %s",0}, {"Incorrect number of arguments",0}, {"Expected arguments",0}, {"Out of data for struct initialisation",1}, {"Already defined",1}, {"Must be lvalue",1}, {"Illegal address",0}, {"Can't subscript",0}, {"Can't take member",1}, {"Unknown member: %s",1}, {"Unknown struct",1}, {"Illegal symbol name: %s",0}, {"Missing closing bracket",0}, {"Missing token: %s",0}, {"Unknown symbol: %s",0}, {"Argument mismatch %s() Arg #%d: %s",0}, {"Doesn't match original decl type: %s",0}, {"Missing token, expecting %c got %c",0}, /* * Misc problems with yer code.. */ {"Invalid Exponent",0}, {"Floating Overflow",0}, {"Invalid expression",0}, {"Can't dereference",0}, {"Operands must be int",0}, {"Expecting constant expression",0}, {"Enum name already used by another symbol",0}, /* * Preprocessor errors */ {"No matching #if",0}, {"Maximum nesting level reached (%d)",1}, /* * New ones tacked on the end */ {"Maximum number of gotos reached (%d)",1}, {"Unknown goto label: %s at line %d",1}, {"Cannot assign to compound auto variable \'%s\'",1}, }; /* * Now some code! */ int endst(void) { blanks(); return ( ch() == ';' || ch() == 0 ); } void illname(char *sname) { error(E_SYMNAME,sname);junk(); } void multidef(void) { error(E_DEFINED); } void needtoken(char *str) { if ( match(str) == 0 ) { error(E_TOKEN,str); } } void needchar(char c) { if ( cmatch(c) == 0 ) { error(E_NEEDCHAR,c,( line[lptr]>=32 && line[lptr]<127 ? line[lptr] : '?') ); } } void needlval(void) { error(E_LVALUE); } void debug(int num,char *str,...) { va_list ap; if (debuglevel != num && debuglevel != DBG_ALL ) return; fprintf(stderr,"sccz80:%s L:%d Debug:#%d: ",Filename,lineno,num); va_start(ap,str); vfprintf(stderr,str,ap); va_end(ap); fprintf(stderr,"\n"); } void warning(int num, ...) { va_list ap; if ( mywarn[num].suppress == 0 ) { fprintf(stderr,"sccz80:%s L:%d Warning:#%d:",Filename, lineno,num); va_start(ap,num); vfprintf(stderr,mywarn[num].warn,ap); va_end(ap); fprintf(stderr,"\n"); } } void error(int num, ...) { va_list ap; fprintf(stderr,"sccz80:%s L:%d Error:#%d:",Filename,lineno,num); va_start(ap,num); vfprintf(stderr,myerrors[num].error,ap); va_end(ap); fprintf(stderr,"\n"); if (myerrors[num].fatal != 0 ) ccabort(); ++errcnt; if ( errstop ) { fprintf(stderr,"Continue (Y\\N) ?\n"); if ( (toupper(getchar()) == 'N') ) ccabort() ; } if (errcnt >= MAXERRORS ) { fprintf(stderr,"\nMaximum (%d) number of errors reached, aborting!\n",MAXERRORS); ccabort(); } } z88dk-1.8.ds1/src/sccz80/error.h0000644000175000017500000000347207617027242015724 0ustar tygrystygrys/* error.c */ extern int endst(void); extern void illname(char *sname); extern void multidef(void); extern void needtoken(char *str); extern void needchar(char c); extern void needlval(void); extern void warning(int num,...); extern void debug(int num,char *str,...); extern void error(int num,...); struct warnings { char *warn; char suppress; }; extern struct warnings mywarn[]; /* * Warning and error values */ enum warnct { W_NOWARN=0, W_2FAFUNC,W_2MAFUNC,W_2MADECL,W_DIFFTYPE, W_DIFFTYPE2, W_DIFFTYPE3, W_RETINT, W_INTPTR, W_PTRINT, W_EQSG, W_OPSG, W_FARNR, W_PTRTYP, W_EXPCOM, W_EXPQT, W_EXPAPO, W_EXPSEMI, W_UNTERM, W_PRAGMA, W_FAR, W_INIT2LONG, W_BADDECL, W_BADSTC, W_ASSPTR, W_SIZEOF, W_EXPARG, W_INTDOUB, W_VOID, W_BUG1, W_BUG2, W_BITFIELD, W_DIVZERO, W_FUNC_NO_PROTO, W_PTRTYP1, W_PTRTYP2, W_PRELIM, W_TYPEDEF, W_LONGDOUB, W_CONST, W_VOLATILE, W_ELLIP, W_FLTPRINTF, W_SIGNARG, W_AUTO, W_NULLARRAY, W_UNREACH, W_ESCAPE, W_INTERNAL, W_MAXIMUM }; enum errorct { E_NOERR=0, E_EOF, E_ZCCOPT, E_NEST, E_INCLUDE, E_TOOLONG, E_OUTERR, E_DBOV, E_LITQOV, E_STGOV, E_MACOV, E_GLBOV, E_LOCOV, E_MEMOV, E_STROV, E_INDIRECTION, E_NEGATIVE, E_SWITCH, E_CASE, E_DEFAULT, E_WHILE, E_CONTEXT, E_ASSIGN, E_DDECL, E_DECLSW, E_DECLST, E_ILLEGAL, E_PAREN, E_ARGNAME, E_BADARG, E_EXPARGS, E_DATA, E_DEFINED, E_LVALUE, E_ADDRESS, E_SUBSCRIPT, E_MEMBER, E_UNMEMB, E_UNSTR, E_SYMNAME, E_BRACKET, E_TOKEN, E_UNSYMB, E_ARGMIS1, E_ARGMIS2, E_NEEDCHAR, E_EXPON, E_FLOATING, E_EXPRESSION, E_DEREF, E_INTOPER, E_CONSTANT, E_ENUMDEF, E_MISSIF, E_MAXLEVELS, E_MAXGOTO, E_UNGOTO, E_AUTOASSIGN, E_MAXIMUM }; z88dk-1.8.ds1/src/sccz80/expr.c0000644000175000017500000006017610031124521015526 0ustar tygrystygrys/* * cc4.c - fourth part of Small-C/Plus compiler * routines for recursive descent * * $Id: expr.c,v 1.12 2004/03/26 22:06:09 denniz Exp $ * */ /* 9/9/98 djm - Modified plnge2a to use unsigned functions for unsigned * variables, seems to be fine.. * * Have added parameter to addconst, so to not do long add for stack ops * */ /* 14/9/98 Some conditional long pointer stuff inserted * * 5/10/98 Some simple prototyping * *13/11/98 Radically changed handling of longs - now they are pushed onto * the stack instead of being held in alternate register set */ #include "ccdefs.h" /* Clear the casting markers */ void ClearCast(LVALUE *lval) { lval->c_vtype = lval->c_id = lval->c_flags=0; lval->c_tag = (TAG_SYMBOL *) 0; lval->level=0; lval->castlevel=0; } int expression(int *con, int *val) { LVALUE lval ; char type; ClearCast(&lval); if ( heir1(&lval) ) { rvalue(&lval) ; } fnflags=lval.flags; if ( lval.ptr_type ) { type=lval.ptr_type; lval.ident=POINTER; } else type=lval.val_type; fnargvalue=CalcArgValue(type, lval.ident ,lval.flags); margtag = 0; if (lval.tagsym) margtag=(lval.tagsym-tagtab); *con = lval.is_const ; *val = lval.const_val ; return lval.val_type ; } int heir1(LVALUE *lval) { char *before, *start ; LVALUE lval2, lval3 ; void (*oper)(), (*doper)(), (*uoper)() ; int k; ClearCast(&lval2); ClearCast(&lval3); lval2.level = lval3.level = lval->level; setstage(&before, &start) ; k = plnge1(heir1a, lval); if ( lval->is_const ) { if (lval->val_type == LONG) { vlongconst(lval->const_val); /* lval->flags=lval->flags|UNSIGNED; */ } else vconst(lval->const_val) ; } doper = 0 ; if ( cmatch('=') ) { if ( k == 0 ) { needlval() ; return 0 ; } if ( lval->indirect ) smartpush(lval, before); if ( heir1(&lval2) ) rvalue(&lval2); /* Now our type checking so we can give off lots of warnings about * type mismatches etc.. */ if (lval2.val_type == VOID && lval2.ptr_type ==0 ) warning(W_VOID); /* First operand is a pointer */ if (lval->ptr_type) { if (lval2.ptr_type && lval->ptr_type !=lval2.ptr_type && (lval2.ptr_type!=VOID && lval->ptr_type !=VOID) ) { /* * Here we have a pointer mismatch, however we don't take account of * ptr2ptr, so anything involvind them will barf badly, I'm leaving * this for now, since the code is fine, but commenting out the warning * which is a bit of shame, but there you go... */ #if 0 warning(W_PTRTYP); #endif } else if ( !(lval2.ptr_type) && !(lval2.is_const) && lval2.ident!=FUNCTION ) warning(W_INTPTR); } else if (lval2.ptr_type && ( !(lval->ptr_type) && !(lval->is_const) ) ) warning(W_PTRINT); #ifdef SILLYWARNING if ( ((lval->flags&UNSIGNED) != (lval2.flags&UNSIGNED)) && ( !(lval2.is_const) && !(lval->ptr_type) && !(lval2.ptr_type) ) ) warning(W_EGSG); #endif force(lval->val_type, lval2.val_type, lval->flags&UNSIGNED, lval2.flags&UNSIGNED,0); /* 27.6.01 lval2.is_const); */ smartstore(lval); return 0; } else if ( match("|=") ) oper = zor; else if ( match("^=") ) oper = zxor; else if ( match("&=") ) oper = zand; else if ( match("+=") ) oper = doper = zadd; else if ( match("-=") ) oper = doper = zsub; else if ( match("*=") ) oper = doper = mult; else if ( match("/=") ) oper = doper = zdiv; else if ( match("%=") ) oper = zmod; else if ( match(">>=") ) oper = asr; else if ( match("<<=") ) oper = asl; else return k; /* if we get here we have an oper= */ if ( k == 0 ) { needlval() ; return 0 ; } lval3.symbol = lval->symbol ; lval3.indirect = lval->indirect ; lval3.flags = lval->flags; lval3.val_type = lval->val_type; lval3.offset = lval->offset; lval3.storage = lval->storage; /* don't clear address calc we need it on rhs */ if ( lval->indirect ) smartpush(lval, 0); rvalue(lval) ; if ( oper==zadd || oper==zsub ) plnge2b(heir1, lval, &lval2, oper) ; else plnge2a(heir1, lval, &lval2, oper, doper) ; /* * djm 23/2/99 Major flaw in the plan here Ron, we don't check the * types properly before storing, this one left open for years!!! * So we we do int+=double we don't get the right value (slaps head * and runs round the room!) */ force(lval3.val_type, lval->val_type, lval3.flags&UNSIGNED, lval->flags&UNSIGNED,lval->is_const); smartstore(&lval3) ; return 0 ; } /* * heir1a - conditional operator */ int heir1a(LVALUE *lval) { int falselab, endlab, skiplab ; LVALUE lval2 ; int k ; int temptype; ClearCast(&lval2); lval2.level = lval->level; k = heir2a(lval) ; if ( cmatch('?') ) { /* evaluate condition expression */ if ( k ) rvalue(lval) ; /* test condition, jump to false expression evaluation if necessary */ if (DoTestJump(lval) ) { /* * Always evaluated as an integer, so fake it temporarily */ force(CINT, lval->val_type, dosigned, lval->flags&UNSIGNED,0) ; temptype=lval->val_type; lval->val_type=CINT; /* Force to integer */ testjump(lval,falselab=getlabel()) ; lval->val_type=temptype; /* evaluate 'true' expression */ if ( heir1(&lval2) ) rvalue(&lval2) ; jump(endlab=getlabel()); postlabel(falselab); } else { /* New handling by djm 13/5/99, push flags, load true, jump on true * The optimizer will with a bit of luck catch inefficient push/pop */ #if 1 jumpnc(falselab=getlabel()); if ( heir1(&lval2)) rvalue(&lval2); jump(endlab=getlabel()); postlabel(falselab); #else zpushflags(); /* evaluate 'true' expression */ if ( heir1(&lval2) ) rvalue(&lval2) ; zpopflags(); jumpc(endlab=getlabel()); #endif } needchar(':') ; /* evaluate 'false' expression */ if ( heir1(lval) ) rvalue(lval) ; /* check types of expressions and widen if necessary */ if ( lval2.val_type == DOUBLE && lval->val_type != DOUBLE ) { DoDoubConv(lval->val_type,lval->flags&UNSIGNED); postlabel(endlab) ; } else if ( lval2.val_type != DOUBLE && lval->val_type == DOUBLE ) { jump(skiplab=getlabel()) ; postlabel(endlab) ; DoDoubConv(lval2.val_type,lval2.flags&UNSIGNED); postlabel(skiplab) ; } /* 12/8/98 Mod by djm to convert long types - it's nice when someone * else has had to do it before! */ else if ( lval2.val_type == LONG && lval->val_type != LONG ) { /* Check for signed, if both signed convert properly, if one/neither signed * then we have dodgy equating in anycase, so treat as unsigned */ widenlong(&lval2,lval); lval->val_type = LONG ; postlabel(endlab) ; } else if ( lval2.val_type != LONG && lval->val_type == LONG ) { jump(skiplab=getlabel()) ; postlabel(endlab) ; widenlong(lval,&lval2); lval->val_type = LONG; postlabel(skiplab) ; } else postlabel(endlab) ; /* result cannot be a constant, even if second expression is */ lval->is_const = 0 ; return 0 ; } else return k ; } int heir2a(LVALUE *lval) { return skim("||", eq0, jumpc, 1, 0, heir2b, lval); } int heir2b(LVALUE *lval) { return skim("&&", testjump, jumpnc, 0 , 1, heir2, lval); } int heir234(LVALUE *lval, int (*heir)(), char opch, void (*oper)()) { LVALUE lval2 ; int k ; ClearCast(&lval2); lval2.level = lval->level; k = plnge1(heir, lval); blanks(); if ((ch() != opch) || (nch() == '=') || (nch() == opch)) return k; if ( k ) rvalue(lval); while(1) { if ( (ch() == opch) && (nch() != '=') && (nch() != opch) ) { inbyte(); plnge2a(heir, lval, &lval2, oper, 0) ; } else return 0; } } int heir2(LVALUE *lval) { return heir234(lval, heir3, '|', zor) ; } int heir3(LVALUE *lval) { return heir234(lval, heir4, '^', zxor) ; } int heir4(LVALUE *lval) { return heir234(lval, heir5, '&', zand) ; } int heir5(LVALUE *lval) { LVALUE lval2 ; int k; ClearCast(&lval2); lval2.level = lval->level; k = plnge1(heir6, lval) ; blanks() ; if((streq(line+lptr,"==")==0) && (streq(line+lptr,"!=")==0))return k; if ( k ) rvalue(lval) ; while(1) { if (match("==")) { plnge2a(heir6, lval, &lval2, zeq, zeq) ; } else if (match("!=")) { plnge2a(heir6, lval, &lval2, zne, zne) ; } else return 0; } } int heir6(LVALUE *lval) { LVALUE lval2 ; int k ; ClearCast(&lval2); lval2.level = lval->level; k = plnge1(heir7, lval) ; blanks() ; if ( ch() != '<' && ch() != '>' && (streq(line+lptr,"<=")==0) && (streq(line+lptr,">=")==0) ) return k ; if ( streq(line+lptr,">>") ) return k ; if ( streq(line+lptr,"<<") ) return k ; if ( k ) rvalue(lval) ; while(1) { if (match("<=")) { plnge2a(heir7, lval, &lval2, zle, zle) ; } else if (match(">=")) { plnge2a(heir7, lval, &lval2, zge, zge) ; } else if ( ch() == '<' && nch() != '<' ) { inbyte(); plnge2a(heir7, lval, &lval2, zlt, zlt) ; } else if ( ch() == '>' && nch() != '>' ) { inbyte(); plnge2a(heir7, lval, &lval2, zgt, zgt) ; } else return 0; } } int heir7(LVALUE *lval) { LVALUE lval2 ; int k ; ClearCast(&lval2); lval2.level = lval->level; k = plnge1(heir8, lval) ; blanks(); if((streq(line+lptr,">>")==0) && (streq(line+lptr,"<<")==0))return k; if ( streq(line+lptr, ">>=") ) return k ; if ( streq(line+lptr, "<<=") ) return k ; if ( k ) rvalue(lval) ; while(1) { if ((streq(line+lptr,">>") == 2) && (streq(line+lptr,">>=") == 0) ) { inbyte(); inbyte(); plnge2a(heir8, lval, &lval2, asr, 0) ; } else if ((streq(line+lptr,"<<") == 2) && (streq(line+lptr,"<<=") == 0) ) { inbyte(); inbyte(); plnge2a(heir8, lval, &lval2, asl, 0) ; } else return 0; } } int heir8(LVALUE *lval) { LVALUE lval2 ; int k ; ClearCast(&lval2); lval2.level = lval->level; k = plnge1(heir9, lval) ; blanks(); if ( ch()!='+' && ch()!='-' ) return k; if (nch()=='=') return k; if ( k ) rvalue(lval) ; while(1) { if (cmatch('+')) { plnge2b(heir9, lval, &lval2, zadd) ; } else if (cmatch('-')) { plnge2b(heir9, lval, &lval2, zsub) ; } else return 0 ; } } int heir9(LVALUE *lval) { LVALUE lval2 ; int k ; ClearCast(&lval2); lval2.level = lval->level; k = plnge1(heira, lval) ; blanks(); if ( ch() != '*' && ch() != '/' && ch() != '%' ) return k; if ( nch() == '=' ) return k ; if ( k ) rvalue(lval) ; while(1) { if (cmatch('*')) { plnge2a(heira, lval, &lval2, mult, mult); } else if (cmatch('/')) { plnge2a(heira, lval, &lval2, zdiv, zdiv); } else if (cmatch('%')) { plnge2a(heira, lval, &lval2, zmod, zmod); } else return 0; } } /* * perform lval manipulation for pointer dereferencing/array subscripting */ /* djm, I can't make this routine distinguish between ptr->ptr and ptr * so if address loads dummy de,0 to ensure everything works out */ #ifndef SMALL_C SYMBOL * #endif deref(LVALUE *lval, char isaddr) { char flags; flags=lval->flags; if (isaddr) { if (flags&FARACC) flags|=FARACC; } else { if (flags&FARPTR) flags|=FARACC; else flags&=MKFARA; } /* NB it has already been determind that lval->symbol is non-zero */ if ( lval->symbol->more == 0 ) { /* array of/pointer to variable */ if (flags&FARPTR && lval->val_type == CPTR) flags|=FARACC; // else flags &= ~FARACC; lval->val_type = lval->indirect = lval->symbol->type ; lval->flags=flags; lval->symbol = NULL_SYM ; /* forget symbol table entry */ lval->ptr_type = 0 ; /* flag as not symbol or array */ lval->ident=VARIABLE; /* We're now a variable! */ } else { /* array of/pointer to pointer */ lval->symbol = dummy_sym[(int) lval->symbol->more] ; /* djm long pointers */ lval->ptr_type = lval->symbol->type ; /* 5/10/98 restored lval->val_type */ lval->indirect = lval->val_type = (flags&FARPTR ? CPTR : CINT ); if ( flags&FARPTR ) flags|=FARACC; lval->flags=flags; if ( lval->symbol->type == STRUCT ) lval->tagsym = tagtab + lval->symbol->tag_idx ; } return lval->symbol ; } int heira(LVALUE *lval) { int k,j; TAG_SYMBOL *otag; struct varid var; char ident; int klptr; /* * djm, check for a cast */ if (cmatch('(')) { klptr=lptr-1; /* -1 takes care of ( */ otag=GetVarID(&var,NO); var.sflag= ( (var.sign&UNSIGNED) | (var.zfar&FARPTR) ); if (var.type != NO ) { ident=get_ident(); if ( ident==PTR_TO_FN || ident==FUNCTIONP ) needtoken(")()"); /* * Scrunch everything together, replace c_ptype with c_id */ lval->c_vtype=var.type; lval->c_id=ident; lval->c_tag=otag; lval->c_flags=var.sflag; lval->castlevel=lval->level; needchar(')'); /* * Reenter ourselves..gosh, recursion is fun! * Is this right? I think so.. */ return(heira(lval)); } else { lptr=klptr; } } if(match("++")) { prestep(lval, 1, inc) ; return 0; } else if(match("--")) { prestep(lval, -1, dec) ; return 0; } else if (cmatch('~')) { if (heira(lval)) rvalue(lval) ; intcheck(lval, lval) ; com(lval) ; lval->const_val = ~lval->const_val ; lval->stage_add = NULL_CHAR ; return 0 ; } else if (cmatch('!')) { if (heira(lval)) rvalue(lval) ; lneg(lval); lval->binop=lneg; lval->const_val = !lval->const_val ; lval->stage_add = NULL_CHAR ; return 0 ; } else if (cmatch('-')) { if (heira(lval)) rvalue(lval); neg(lval); if (lval->val_type !=DOUBLE ) lval->const_val =- lval->const_val; lval->stage_add = NULL_CHAR ; return 0 ; } else if ( cmatch('*') ) { /* unary * */ if ( heira(lval) ) rvalue(lval) ; /* Cast the symbol before derefencing.. */ if (lval->c_id /* != VARIABLE */ ) { j=docast(lval,1); if (j) lval->indirect=lval->c_vtype; } if ( lval->symbol == 0 ) { error(E_DEREF) ; junk() ; return 0 ; } else { deref(lval,NO) ; } lval->is_const = 0 ; /* flag as not constant */ lval->const_val = 1 ; /* omit rvalue() on func call */ lval->stage_add = 0 ; return 1 ; /* dereferenced pointer is lvalue */ } else if ( cmatch('&') ) { if ( heira(lval) == 0 ) { /* OK to take address of struct */ if ( lval->tagsym == 0 || lval->ptr_type != STRUCT || ( lval->symbol && lval->symbol->ident == ARRAY ) ) { error(E_ADDRESS); } return 0; } /* * Do the cast in here and convert the type, but don't generate any * code.. */ if ( lval->c_vtype) docast(lval,NO); if (lval->symbol) { lval->ptr_type = lval->symbol->type ; lval->val_type = (lval->flags&FARACC ? CPTR : CINT); } else { warning(W_BUG1); warning(W_BUG2); lval->ptr_type = VOID; lval->val_type = (lval->flags&(FARACC|FARPTR)) ? CPTR : CINT; } if ( lval->indirect ) return 0 ; /* global & non-array */ address(lval->symbol) ; lval->indirect = lval->symbol->type ; return 0; } else { k = heirb(lval) ; /* * djm 2/3/99 Removed if (k) because heirb returns 0 for a function * hopefully this will work, also inserted the check for VOID */ if (k) ltype=lval->val_type; /* djm 28/11/98 */ if ( match("++") ) { poststep(k, lval, 1, inc, dec) ; return 0; } else if ( match("--") ) { poststep(k, lval, -1, dec, inc ) ; return 0; } else return k; } } int heirb(LVALUE *lval) { char *before, *start ; char *before1, *start1 ; char sname[NAMESIZE] ; int con, val, direct, k ; char flags; SYMBOL *ptr ; setstage(&before1, &start1); k = primary(lval) ; ptr = lval->symbol ; blanks(); if ( ch()=='[' || ch()=='(' || ch()=='.' || (ch()=='-' && nch()=='>') ) while ( 1 ) { if ( cmatch('[') ) { if ( ptr == 0 ) { error(E_SUBSCRIPT); junk(); needchar(']'); return 0; } else if ( k && ptr->ident == POINTER ) rvalue(lval) ; else if ( ptr->ident != POINTER && ptr->ident != ARRAY ) { error(E_SUBSCRIPT); k=0; } setstage(&before, &start) ; if (lval->flags&FARPTR) zpushde(); lval->ident=VARIABLE; zpush(); expression(&con, &val); needchar(']'); if ( con ) { Zsp += 2 ; /* undo push */ if (lval->flags&FARPTR) Zsp += 2; if (lval->symbol->more) cscale(lval->val_type,tagtab+ptr->tag_idx,&val); else cscale(ptr->type, tagtab+ptr->tag_idx, &val) ; if ( ptr->storage == STKLOC && ptr->ident == ARRAY ) { /* constant offset to array on stack */ /* do all offsets at compile time */ clearstage(before1, 0) ; lval->offset=getloc(ptr, val) ; } else { /* add constant offset to address in primary */ clearstage(before, 0); // if (lval->symbol->more) // cscale(lval->val_type,tagtab+ptr->tag_idx,&val); addconst(val,1,0) ; } } else { /* non-constant subscript, calc at run time */ if (lval->symbol->more) { scale(lval->val_type,tagtab+ptr->tag_idx); } else { scale(ptr->type, tagtab+ptr->tag_idx); } /* If near, then pop other side back, otherwise load high reg with de and do an add */ if (lval->flags&FARPTR) { const2(0); } else { zpop(); } zadd(lval); /* If long pointer restore upper 16 bits */ // if (lval->flags&FARPTR) zpop(); } ptr = deref(lval,YES); k = 1 ; } else if ( cmatch('(') ) { if ( ptr == 0 ) { callfunction(NULL_SYM); /* Bugger knows what ya doing..stop SEGV */ ptr=dummy_sym[VOID]; warning(W_INTERNAL); } else if ( ptr->ident != FUNCTION ) { if ( k && lval->const_val == 0 ) rvalue(lval); callfunction(NULL_SYM); } else callfunction(ptr); k = lval->is_const = lval->const_val = 0 ; if ( ptr && ptr->more == 0 ) { /* function returning variable */ lval->ptr_type = 0; lval->val_type = ptr->type ; lval->ident=VARIABLE; ptr = lval->symbol = 0 ; } else { /* function returning pointer */ lval->flags=ptr->flags; /* djm */ ptr = lval->symbol = dummy_sym[(int) ptr->more] ; lval->ident=POINTER; lval->indirect = lval->ptr_type = ptr->type ; /* djm - 24/11/98 */ lval->val_type = (lval->flags&FARPTR ? CPTR : CINT); if ( ptr->type == STRUCT ) { lval->tagsym = tagtab + ptr->tag_idx ; } } /* Perform the cast here */ if (lval->c_vtype) docast(lval,YES); } /* Handle structures... come in here with lval holding tehe previous * pointer to the struct thing..*/ else if ( (direct=cmatch('.')) || match("->") ) { /* Check to see if we have a cast in operation, if so then change type * internally, but don't generate any code */ if ( lval->tagsym == 0 ) { error(E_MEMBER) ; junk() ; return 0 ; } if ( symname(sname) == 0 || (ptr=findmemb(lval->tagsym,sname)) == 0 ) { error(E_UNMEMB,sname) ; junk() ; return 0 ; } /* * Here, we're trying to chase our member up, we have to be careful * not to access via far methods near data.. */ if ( k && direct == 0 ) rvaluest(lval) ; if ( lval->c_tag ) docast(lval,NO); debug(DBG_FAR1,"prev=%s name=%s flags %d oflags %d",lval->symbol->name,ptr->name,lval->flags, lval->oflags); flags = ptr->flags; if ( direct == 0 ) { /* * So, we're accessing via a pointer if we get here */ flags=ptr->flags; if (lval->oflags&FARACC || (lval->flags&FARPTR) ) flags|=FARACC; if (flags&FARPTR || (lval->flags&FARPTR) ) lval->oflags|=FARACC; } lval->flags=flags; addconst(ptr->offset.i,1,ptr->flags&FARPTR) ; lval->symbol = ptr ; lval->indirect = lval->val_type = ptr->type ; lval->ptr_type = lval->is_const = lval->const_val = 0 ; lval->ident=VARIABLE; lval->stage_add = NULL_CHAR ; lval->tagsym = NULL_TAG ; lval->binop = NULL_FN ; if ( ptr->type == STRUCT ) lval->tagsym = tagtab + ptr->tag_idx ; if ( ptr->ident == POINTER ) { lval->ptr_type = ptr->type ; lval->ident=POINTER; /* djm */ if (ptr->flags&FARPTR) { lval->indirect = CPTR ; lval->val_type = CPTR ; } else { lval->indirect = CINT ; lval->val_type = CINT ; } } if ( ptr->ident==ARRAY || (ptr->type==STRUCT && ptr->ident==VARIABLE) ) { /* array or struct */ lval->ptr_type = ptr->type ; lval->ident=POINTER; /* djm Long pointers here? */ lval->val_type = ((ptr->flags&FARPTR) ? CPTR :CINT) ; k = 0 ; } else k = 1 ; } else return k ; } if ( ptr && ptr->ident == FUNCTION ) { address(ptr); lval->symbol = 0 ; return 0; } return k; } z88dk-1.8.ds1/src/sccz80/expr.h0000644000175000017500000000123507130401713015531 0ustar tygrystygrys/* expr.c */ extern void ClearCast(LVALUE *lval); extern int expression(int *con, int *val); extern int heir1(LVALUE *lval); extern int heir1a(LVALUE *lval); extern int heir2a(LVALUE *lval); extern int heir2b(LVALUE *lval); extern int heir234(LVALUE *lval, int (*heir)(), char opch, void (*oper)()); extern int heir2(LVALUE *lval); extern int heir3(LVALUE *lval); extern int heir4(LVALUE *lval); extern int heir5(LVALUE *lval); extern int heir6(LVALUE *lval); extern int heir7(LVALUE *lval); extern int heir8(LVALUE *lval); extern int heir9(LVALUE *lval); extern SYMBOL *deref(LVALUE *lval, char isaddr); extern int heira(LVALUE *lval); extern int heirb(LVALUE *lval); z88dk-1.8.ds1/src/sccz80/float.c0000644000175000017500000001552007434702172015667 0ustar tygrystygrys/* * Small C+ Compiler * * Routines to float an string * * $Id: float.c,v 1.5 2002/02/20 11:11:54 dom Exp $ * * This code has been largely rewritten. It now produces numbers * to about 4 decimal places - there's an inaccuracy creeping in * somewhere, but I just can't find it! * * Some figures, fp package values obtained via: * * 1./(double)x where x = 10,100,1000,10000 * * Decimal What fp package makes What compiler makes * 0.1 205 204 204 204 76 125 205 204 204 204 76 125 * 0.01 113 61 10 215 35 122 113 61 10 215 35 122 * 0.001 141 151 110 18 3 119 142 151 110 18 3 119 (*) * 0.0001 226 88 23 183 81 115 228 88 23 184 81 115 (*) * * atof() returns: * 0.001 142 151 110 18 3 119 * 0.0001 227 88 23 183 81 115 * * There appears to be some sort of accuracy issue somewhere * but I'm not sure where - takers to find out? */ #include "ccdefs.h" /* Exponent is at position 7 - this should give us the same accuracy as the native libs */ #define EXPONENT 6 /* Kludgy way to convert number to 6 byte representation * Entry: val=value fa=pointer to 6 byte area for number */ void qfloat(int va, unsigned char *fa) { unsigned long val; int i,minus,exp; val = va; if (val == 0) { for (i = 0; i < 6; i++) { fa[i] = 0; } return; } minus = 0; exp = 128 + 38 + 8; norm(val%65536, val/65536, 0, minus, fa, exp); } void norm(unsigned long a, unsigned long b, unsigned long c, int minus, unsigned char *fa, int exp) { if (a | b | c) { while (c < 32768UL) { a *= 2; if (a >= 65536UL) { a %= 65536UL; b++; } b *= 2; if (b >= 65536UL) { b %= 65536UL; c++; } c *= 2; exp--; } /* Now a,b,c,exp is the number, get the sign */ if (!minus) c &= 32767; /* It should work! */ if (mathz88) a = 0; fa[0] = a / 256; fa[1] = b % 256; fa[2] = b / 256; fa[3] = c % 256; fa[4] = c / 256; fa[5] = exp % 256; } } /* A couple of common operations */ static int fa_add(unsigned char *fa1, unsigned char *fa2, int carry) { int i; int temp; for (i = 0; i < EXPONENT; i++) { temp = fa1[i] + fa2[i] + carry; fa1[i] = (temp % 256); carry = ( temp >= 256 ? 1 : 0 ); } return carry; } #if 0 static int fa_sub(unsigned char *fa1, unsigned char *fa2, int carry) { int i; int temp; for (i = 0; i < EXPONENT; i++) { temp = fa1[i] - fa2[i] - carry; carry = ( temp < 0 ? 1 : 0 ); fa1[i] = (temp % 256); } return carry; } #endif static int shift_right(unsigned char *fa, int carry) { int temp; int i,carry2; for ( i = EXPONENT-1; i > EXPONENT-6; i-- ) { temp = (fa[i] & 1); fa[i] >>= 1; if ( carry ) fa[i] |= 128; carry = temp; } carry2 = carry; for ( ; i >= 0; i-- ) { temp = (fa[i] & 1); fa[i] >>= 1; if ( carry2 ) fa[i] |= 128; carry2 = temp; } return carry; } #if 0 static int shift_left(unsigned char *fa, int carry) { int temp; int i; for ( i = 0; i < EXPONENT-6; i ++ ) { temp = (fa[i] & 128); fa[i] <<= 1; if ( carry ) fa[i] |= 1; carry = temp; } for ( i = EXPONENT-6; i < EXPONENT; i++ ) { temp = (fa[i] & 128); fa[i] <<= 1; if ( carry ) fa[i] |= 1; carry = temp; } return carry; } #endif /* Multiply two FP numbers together */ void fltmult(unsigned char *i1, unsigned char *i2) { unsigned char fa1[EXPONENT+2], fa2[EXPONENT+2], fa3[EXPONENT+2]; int i, j, k, temp, mask, carry; unsigned long a, b, c; int exp; unpack(i1, fa1); unpack(i2, fa2); if (fa1[EXPONENT] == 0) { /* If zero return */ for (k = 0; k < 6; k++) { i2[k] = i1[k]; } return; } if (fa2[EXPONENT] == 0) return; for (i = 0; i < EXPONENT+1; i++) { fa3[i] = 0; } /* These two routines are equivalent. The first one is a new method, the second is the old algorithm cleaned up a bit! */ #if 0 temp = ((fa1[EXPONENT] + fa2[EXPONENT]) % 256); exp = (128 + temp); carry = 0; for ( k = 0; k < 40; k++ ) { /* 41 = significent bits */ /* Shift the multiplier right by one bit */ if ( shift_right(fa1,0) ) { carry = fa_add(fa3,fa2,0); } else { carry = 0; } shift_right(fa3,carry); } #else temp = ((fa1[EXPONENT] + fa2[EXPONENT]) % 256); exp = 128 + temp; for (i = EXPONENT-5; i < EXPONENT ; i++) { mask = 1; carry = 0; for (j = 0; j < 8; j++) { if (fa1[i] & mask ) { carry = fa_add(fa3,fa2,0); } else { carry = 0; } shift_right(fa3,carry); mask <<= 1; } } #endif a = fa3[EXPONENT-6] + (256UL * fa3[EXPONENT-5]); b = fa3[EXPONENT-4] + (256UL * fa3[EXPONENT-3]); c = fa3[EXPONENT-2] + (256UL * fa3[EXPONENT-1]); norm(a, b, c, 0, i2, exp); return; } /* This is a very cut down version and doesn't consider adding -ve * number to positive etc..just for the compiler! */ void fltadd(unsigned char *i1,unsigned char *i2) { unsigned char fa1[EXPONENT+2], fa2[EXPONENT+2]; unsigned long temp, carry; int i; if ( i2[5] == 0) { /* If adding zero */ for (i = 0; i < 6; i++) { i2[i] = i1[i]; } return; } if (i1[5] == 0) /* If base is zero */ return; unpack(i1, fa1); unpack(i2, fa2); if ( fa1[EXPONENT] < fa2[EXPONENT] ) { unpack(i1,fa2); unpack(i2,fa1); } /* fa1 > fa2 fa1=accumulator, fa2=bcixde */ if ((fa1[EXPONENT] - fa2[EXPONENT]) > 38) { for (i = 0; i < 6; i++) { i2[i] = i1[i]; } return; } /* Unequal exponents, do some shifting!! */ if (fa1[EXPONENT] != fa2[EXPONENT]) { for (i = 0; i < (fa1[EXPONENT] - fa2[EXPONENT]); i++) { shift_right(fa2,0); } } /* Now for some addition! */ carry = fa_add(fa1,fa2,0); if (carry) { /* If it overflowed shift right by 1 increment exponent */ fa1[EXPONENT]++; temp = 0; shift_right(fa1,0); } pack(fa1, i2); return; } /* Pack the number back into a FP form - should deal with -ve numbers but code does a minusfa on load in anycase */ void pack(unsigned char *s, unsigned char *d) { d[0] = s[EXPONENT-5]; d[1] = s[EXPONENT-4]; d[2] = s[EXPONENT-3]; d[3] = s[EXPONENT-2]; d[4] = (s[EXPONENT-1] & 127); d[5] = s[EXPONENT]; return; } /* Unpack - ie restore hidden bit and make sign... */ void unpack(unsigned char *s, unsigned char *d) { unsigned char temp; unsigned char minus; d[EXPONENT-6] = 0; d[EXPONENT-5] = s[0]; d[EXPONENT-4] = s[1]; d[EXPONENT-3] = s[2]; d[EXPONENT-2] = s[3]; temp = s[4]; if ( temp & 128 ) { minus = 1; d[EXPONENT-1] = temp; } else { minus = 0; d[EXPONENT-1] = ( temp | 128 ); } d[EXPONENT] = s[5]; d[EXPONENT+1] = minus; return; } z88dk-1.8.ds1/src/sccz80/float.h0000644000175000017500000000055107425020457015671 0ustar tygrystygrys/* float.c */ extern void qfloat(int ,unsigned char *); extern void fltadd(unsigned char *, unsigned char *); extern void fltmult(unsigned char *, unsigned char *); extern void pack(unsigned char *, unsigned char *); extern void unpack(unsigned char *, unsigned char *); extern void norm(unsigned long, unsigned long, unsigned long, int, unsigned char *, int); z88dk-1.8.ds1/src/sccz80/goto.c0000644000175000017500000001551010031124521015510 0ustar tygrystygrys/* * The Goto File * * Yes, they are truly hideous things, and no, you shouldn't * have to use them if you write your own code, but those * pesky kids who write grown up C love em..so here I will * (finally!) give them to you! * * Started djm 22/4/99 * * $Id: goto.c,v 1.2 2004/03/26 22:06:09 denniz Exp $ * * The scheme is: * * 1. If label defined and we hit goto, adjust stack and jump * directly to label * 2. If label not defined keep in goto queue * 3. If we hit a label and it has been previously goto'd to, we * will scan through the goto table looking for ptrs to our * label, if we find any which have the same sp as us, then dump * that label and invalidate entry (ptr=0) * 4. If the stack is uneven, keep in queue and deal with at function * end * 5. Literal labels are used for goto labels i.e. getlabel() * 6. All gotos are kept in global variable space * 7. We endeavour to wipe all trace of goto labels from * global symbol table on exit * * All relevent structures and #define are in define.h */ #include "ccdefs.h" int dolabel(void); void dogoto(void); int AddGoto(SYMBOL *); void ChaseGoto(SYMBOL *ptr); void CleanGoto(void); GOTO_TAB *SearchGoto(SYMBOL *ptr); SYMBOL *findgoto(char *); SYMBOL *addgotosym(char *); /* * Some nice variables for us! */ GOTO_TAB *gotoq; int gotocnt=0; /* * Endeavour to find a label for a goto statement * * We chase up the goto stack adjust queue after leaving function */ int dolabel() { int savelptr; char sname[NAMESIZE]; SYMBOL *ptr; blanks(); savelptr=lptr; if (symname(sname)) { if (gch()==':') { if ((ptr=findgoto(sname)) && ptr->ident==GOTOLABEL){ /* Label already goto'd, find some others with * same stack */ ptr->type=GOTOLABEL; debug(DBG_GOTO,"Starting chase %s\n",sname); ChaseGoto(ptr); } else { ptr=addgotosym(sname); ptr->type=GOTOLABEL; } debug(DBG_GOTO,"Adding label not called %s\n",sname); ptr->offset.i=Zsp; /* Save stack for label */ postlabel(ptr->size=getlabel()); return(1); } } lptr=savelptr; return(0); } /* * dogoto, parse goto, this is where things can go completely wrong! */ void dogoto() { SYMBOL *ptr; char sname[NAMESIZE]; int stkmod=0; int label; /* * Should find symbol, and if a goto expr obtain the level from * ptr->size, and modify the stack accordingly.. */ if ( symname(sname) == 0 ) illname(sname); debug(DBG_GOTO,"goto is -->%s<--\n",sname); if ( (ptr=findgoto(sname)) && ptr->ident==GOTOLABEL) { /* Label found, but is it actually defined? */ if (ptr->type == GOTOLABEL) { label=ptr->size; stkmod=ptr->offset.i; } else { debug(DBG_GOTO,"Sym found but still on goto\n"); /* Not defined, add into the goto queue */ label=AddGoto(ptr); } } else if ( (ptr=addgotosym(sname) ) ) { debug(DBG_GOTO,"Adding symbol to table\n"); ptr->offset.i=0; label=AddGoto(ptr); } if (stkmod) modstk(stkmod,NO,NO); jump(label); } SYMBOL *addgotosym(char *sname) { char sname2[NAMEMAX*3]; strcpy(sname2,"goto_"); strcat(sname2,currfn->name); strcat(sname2,"_"); strcat(sname2,sname); return(addglb(sname2,GOTOLABEL,0,0,0,0,0)); } SYMBOL *findgoto(char *sname) { char sname2[NAMEMAX*3]; strcpy(sname2,"goto_"); strcat(sname2,currfn->name); strcat(sname2,"_"); strcat(sname2,sname); return(findglb(sname2)); } /* * Add an entry into the goto chain */ int AddGoto(SYMBOL *ptr) { GOTO_TAB *gptr; int gqptr=0; /* Pointer int goto queue */ debug(DBG_GOTO,"Adding goto label: %s\n",ptr->name); if (ptr->more) gqptr=ptr->more; if ( (gptr=SearchGoto(ptr)) ) return(gptr->label); if ( ++gotocnt > NUMGOTO) error(E_MAXGOTO,NUMGOTO); gptr=gotoq+gotocnt; /* Ref for our label */ gptr->next=gqptr; /* store next in chain */ ptr->more=gotocnt; /* Make us first */ gptr->sp=Zsp; /* Store current stack */ gptr->sym=ptr; /* What label do we reference */ gptr->lineno=lineno; gptr->label=getlabel(); return(gptr->label); } /* * Chase up the gotoqueue looking for previous gotos that * match our symbol, check to stack to see if same, and if * so dump a label here - saves a jp followed by a jump */ void ChaseGoto(SYMBOL *ptr) { GOTO_TAB *gptr; int i; if (gotocnt == 0 ) return; /* No gotos */ gptr=gotoq; for (i=0 ; i <= gotocnt ; i++ ) { debug(DBG_GOTO,"Chasing %s # %d\n",ptr->name,i); if (gptr->sym == ptr && gptr->sp==Zsp) { debug(DBG_GOTO,"Matched #%d \n",i); postlabel(gptr->label); gptr->sym=0; /* invalidate */ } gptr++; } } /* * Clean up the goto tree, called at the end of a function * Should remedy all stack problems etc(!) */ void CleanGoto(void) { int i; GOTO_TAB *gptr; if (gotocnt == 0 ) return; gptr=gotoq; for (i=0 ; i <= gotocnt ; i++ ) { if (gptr->sym ) { debug(DBG_GOTO,"Cleaning %s #%d\n",gptr->sym->name,i); postlabel(gptr->label); if (gptr->sym->type==GOTOLABEL) { modstk((gptr->sym->offset.i)-(gptr->sp),NO,NO); jump(gptr->sym->size); /* label label(!) */ } else error(E_UNGOTO,gptr->sym->name,gptr->lineno); } gptr++; } /* Wipe out reference to our goto labels in symbol table */ gptr=gotoq; for (i=0; i<= gotocnt; i++ ) { if (gptr->sym) gptr->sym->name[0]=0; } gotocnt=0; } /* * Search Through Goto table, matching entries which look like * ours, if one does, then return a ptr to the entry - saves * having duplicate identical jumps to a label */ GOTO_TAB *SearchGoto(SYMBOL *ptr) { int i; GOTO_TAB *gptr; if (gotocnt == 0 ) return(0); gptr=gotoq; for (i=0 ; i <= gotocnt ; i++ ) { if (gptr->sym == ptr && gptr->sp==Zsp ) return(gptr); gptr++; } return(0); } z88dk-1.8.ds1/src/sccz80/io.c0000644000175000017500000001377210445247421015175 0ustar tygrystygrys/* * Small C+ Compiler * * Various compiler file i/o routines * * $Id: io.c,v 1.6 2006/06/18 13:03:13 dom Exp $ */ #include "ccdefs.h" #ifdef INBUILT_OPTIMIZER int opt_outc(char c); #endif /* * get integer of length len bytes from address addr */ int getint(unsigned char *addr, int len) { int i ; i = *(addr + --len) ; /* high order byte sign extended */ while (len--) i = (i << 8) | ( *(addr+len) & 255 ) ; return i ; } /* * put integer of length len bytes into address addr * (low byte first) */ void putint(int i, unsigned char *addr, int len) { while (len--) { *addr++ = i ; i >>= 8 ; } } /* * Test if next input string is legal symbol name * if it is, truncate it and copy it to sname */ int symname(char *sname) { int k ; #ifdef SMALL_C { char *p ; char c ; /* this is about as deep as nesting goes, check memory left */ p = alloc(1) ; /* &c is top of stack, p is end of heap */ if ( (k=&c-p) < minavail ) minavail = k ; free(p) ; } #endif blanks(); if ( alpha(ch()) == 0 ) return (*sname=0) ; k = 0 ; while ( an(ch()) ) { sname[k] = gch(); if ( k < NAMEMAX ) ++k ; } sname[k] = 0; return 1; } /* Return next avail internal label number */ int getlabel() { return(++nxtlab); } /* Print a queue label/reference */ void queuelabel(int label) { outstr("i_"); outdec(label); } /* Print specified number as label */ void printlabel(int label) { if (asxx) { outdec(label); outstr("$"); } else { outstr("i_"); outdec(label); } } /* print label with colon and newline */ void postlabel(int label) { prefix(); printlabel(label) ; col(); nl(); } /* Test if given character is alpha */ int alpha(char c) { if(c>='a') return (c<='z'); if(c<='Z') return (c>='A'); return (c=='_'); } /* Test if given character is numeric */ int numeric(char c) { if(c<='9') return(c>='0'); return 0; } /* Test if given character is alphanumeric */ int an(char c) { if ( alpha(c) ) return 1 ; return numeric(c) ; } /* Print a carriage return and a string only to console */ void pl(char *str) { putchar('\n'); while(*str)putchar(*str++); } /* buffering code */ t_buffer *currentbuffer = NULL; t_buffer * startbuffer(int blocks) { t_buffer *buf = (t_buffer *) mymalloc(sizeof(t_buffer)) ; int size = blocks * STAGESIZE; buf->size = size; buf->start = (char *) mymalloc(size); buf->end = buf->start + blocks * size - 1; buf->next = buf->start; buf->before = currentbuffer; currentbuffer = buf; return buf; } void suspendbuffer(void) { if (currentbuffer) currentbuffer = currentbuffer->before; } void clearbuffer(t_buffer *buf) { if (! buf || ! buf->start) return; if (currentbuffer == buf) currentbuffer = currentbuffer->before; * buf->next = '\0'; outstr(buf->start); free(buf->start); buf->start = buf->next = 0; free(buf); } int outbuffer(char c) { if (currentbuffer->next == currentbuffer->end) { size_t size = currentbuffer->size * 2; char *tmp = (char *) mymalloc(size); memcpy(tmp, currentbuffer->start, currentbuffer->size); free(currentbuffer->start); currentbuffer->next = tmp + (currentbuffer->start - currentbuffer->next); currentbuffer->start = tmp; currentbuffer->end = tmp + size - 1; currentbuffer->size = size; } return * (currentbuffer->next++) = c; } /* initialise staging buffer */ void setstage(char **before, char **start) { if ( (*before=stagenext) == 0 ) stagenext = stage ; *start = stagenext ; } /* flush or clear staging buffer */ void clearstage(char *before, char *start) { *stagenext = 0 ; if ( (stagenext=before) ) return ; if ( start ) { if ( output != NULL_FD ) { #ifdef INBUILT_OPTIMIZER if (infunc) AddBuffer(start); else #endif outstr(start); /* if ( fputs(start, output) == EOF ) fabort() ; */ } else { puts(start) ; } } } void fabort() { closeout(); error(E_OUTERR); } /* direct output to console */ void toconsole() { saveout = output; output = 0; } /* direct output back to file */ void tofile() { if(saveout) output = saveout; saveout = 0; } int outbyte(char c) { if(c) { if ( output != NULL_FD ) { if (stagenext) { return(outstage(c)) ; } else { #ifdef INBUILT_OPTIMIZER if (infunc) opt_outc(c); else #endif if (currentbuffer) { return outbuffer(c); } else if((putc(c,output))==EOF) fabort() ; } } else putchar(c); } return c; } /* output character to staging buffer */ int outstage(char c) { if (stagenext == stagelast) { error(E_STGOV) ; return 0 ; } *stagenext++ = c ; return c ; } void outstr(char ptr[]) { while(outbyte(*ptr++)); } void nl() { outbyte('\n'); } void tab() { outbyte('\t'); } void col() { if (asxx) outbyte(58); } void bell() { outbyte(7); } void ol(char *ptr) { ot(ptr); nl(); } void ot(char *ptr) { tab(); outstr(ptr); } void blanks() { while(1) { while(ch()==0) { preprocess(); if(eof) break; } if(ch()==' ')gch(); else if(ch()==9)gch(); else return; } } void outdec(long number) { if ( number < 0 ) { number=-number; /* number= (int)( 65536UL-(long)number); */ outbyte('-'); } outd2(number); } void outd2(long n) { if ( n > 9 ) { outd2(n/10) ; n %= 10 ; } outbyte('0'+n) ; } /* convert lower case to upper */ #ifdef INBUILT_OPTIMIZER # include "opt.c" #endif z88dk-1.8.ds1/src/sccz80/io.h0000644000175000017500000000222410445247421015170 0ustar tygrystygrys/* io.c */ extern int getint(unsigned char *addr, int len); extern void putint(int i, unsigned char *addr, int len); extern int symname(char *sname); extern int getlabel(void); extern void printlabel(int label); extern void postlabel(int label); extern int alpha(char c); extern int numeric(char c); extern int an(char c); extern void pl(char *str); extern void setstage(char **before, char **start); extern void clearstage(char *before, char *start); extern void fabort(void); extern void toconsole(void); extern void tofile(void); extern int outbyte(char c); extern int outstage(char c); extern void outstr(char ptr[]); extern void nl(void); extern void tab(void); extern void col(void); extern void bell(void); extern void ol(char *ptr); extern void ot(char *ptr); extern void blanks(void); extern void outdec(long number); extern void outd2(long n); extern void queuelabel(int); typedef struct { struct t_buffer *before; size_t size; char *start; char *end; char *next; } t_buffer; extern t_buffer * startbuffer(int blocks); extern void clearbuffer(t_buffer *buf); extern void suspendbuffer(void); extern int outbuffer(char c); extern t_buffer *currentbuffer; z88dk-1.8.ds1/src/sccz80/lex.c0000644000175000017500000000517410647730235015357 0ustar tygrystygrys/* * Small C+ Compiler * * Lexical routines - string matching etc * * $Id: lex.c,v 1.3 2007/07/19 18:42:37 dom Exp $ */ #include "ccdefs.h" extern char line[]; int streq(char str1[], char str2[]) { int k; k=0; while (*str2) { if ((*str1++)!=(*str2++)) return 0; ++k; } return k; } /* * compare strings * match only if we reach end of both strings or if, at end of one of the * strings, the other one has reached a non-alphanumeric character * (so that, for example, astreq("if", "ifline") is not a match) */ int astreq(char *str1, char *str2) { int k; k=0; while ( *str1 && *str2 ) { if ( *str1 != *str2 ) break ; ++str1 ; ++str2 ; ++k ; } if ( an(*str1) || an(*str2) ) return 0; return k; } int match(char *lit) { int k; blanks(); if ( (k=streq(line+lptr,lit)) ) { lptr += k; return 1; } return 0; } int cmatch(char lit) { blanks() ; if (eof) error(E_EOF); if ( line[lptr] == lit ) { ++lptr ; return 1 ; } return 0 ; } /* Get the next character, don't skip spaces */ int acmatch(char lit) { if (eof) error(E_EOF); if ( line[lptr] == lit ) { ++lptr ; return 1 ; } return 0 ; } /* * djm get symbol name into string...and check for typedef */ int CheckTypDef(void) { char sname[NAMEMAX]; char *ptr; SYMBOL *sym; int i=0; blanks(); /* Skip white space */ ptr=line+lptr; /* Where label starts */ while (an(*ptr) && istorage == TYPDEF ) return 1; return 0; } /* djm, reversible match thing, used to scan for ascii fn defs.. * this doesn't affect the line permanently! */ int rmatch(char *lit) { int k; blanks(); if ( (k=astreq(line+lptr,lit)) ) return 1; return 0; } /* * djm, reversible character match, used to scan for local statics */ int rcmatch(char lit) { blanks() ; if (eof) error(E_EOF); if ( line[lptr] == lit ) { return 1 ; } return 0 ; } int amatch(char *lit) { int k; blanks(); if ( (k=astreq(line+lptr,lit)) ) { lptr += k; return 1; } return 0; } /* * Consume unecessary identifiers (if present) */ int swallow(char *lit) { return (amatch(lit)); } z88dk-1.8.ds1/src/sccz80/lex.h0000644000175000017500000000052210650507247015353 0ustar tygrystygrys/* lex.c */ extern int streq(char str1[], char str2[]); extern int astreq(char *str1, char *str2); extern int match(char *lit); extern int cmatch(char lit); extern int acmatch(char lit); extern int rmatch(char *lit); extern int rcmatch(char lit); extern int amatch(char *lit); extern int swallow(char *lit); extern int CheckTypDef(void); z88dk-1.8.ds1/src/sccz80/lvalue.h0000644000175000017500000000301110637501441016042 0ustar tygrystygrys/* * structure for lvalue's - (cclvalue.h) * * $Id: lvalue.h,v 1.3 2007/06/24 14:43:45 dom Exp $ */ struct lvalue { SYMBOL *symbol ; /* symbol table address, or 0 for constant */ int indirect ; /* type of indirect object, 0 for static object */ int ptr_type ; /* type of pointer or array, 0 for other idents */ int is_const ; /* true if constant expression */ signed long const_val ; /* value of constant expression (& other uses) */ TAG_SYMBOL *tagsym ; /* tag symbol address, 0 if not struct */ void (*binop)() ; /* function address of highest/last binary operator */ char *stage_add ; /* stage addess of "oper 0" code, else 0 */ int val_type ; /* type of value calculated */ int oldval_type; /* What the valtype was */ char flags ; /* As per symbol */ char oflags; /* Needed for deref of far str*/ int type; /* type (from symbol table) */ int ident; /* ident (from symbol table) */ char storage; /* storage (from sym tab) */ char c_id; /* ident of cast */ char c_vtype; /* type of value calc if cast */ char c_flags; /* flags for casting */ int level; /* Parenth level (cast) */ int castlevel; int offset; TAG_SYMBOL *c_tag; } ; #define LVALUE struct lvalue z88dk-1.8.ds1/src/sccz80/main.c0000644000175000017500000011174310702203103015470 0ustar tygrystygrys/* * Small C+ Compiler - * * Main() part * * $Id: main.c,v 1.18 2007/10/07 16:16:03 dom Exp $ */ #include "ccdefs.h" #if defined(__MSDOS__) && defined(__TURBOC__) extern unsigned _stklen=8192U; /* Default stack size 4096 bytes is too small. */ #endif /* * Data used in this file only */ char Filenorig[FILENAME_LEN+1]; unsigned int zorg; /* Origin for applications */ int reqpag; /* required bad pages */ int defvars; int safedata; /* amount of safe workspace required */ int intuition; /* Intuitiono to debug?!?!? */ int smartprintf; /* Map printf -> miniprintf */ int expanded; /* Do we need expanded Z88? */ int startup; /* Which startup to we want? app has it's own but by using -startup= we can switch between "BASIC" startups, eg for shell etc.. */ int makeshare; /* Do we want to make a shared library? */ int useshare; /* Use shared lib routines? */ int sharedfile; /* File contains routines which are to be * called via lib package - basically jimmy * the stack but that's it.. */ int noaltreg; /* No alternate registers */ int usempm; /* We're using mpm */ /* * Some external data */ extern int gotocnt; /* No of gotos */ extern GOTO_TAB *gotoq; /* Pointer for gotoq */ void DispVersion(char *); void SetMPM(char *); void SetSmart(char *); void UnSetSmart(char *); void SetExpand(char *); void UnSetExpand(char *); void SetMakeShared(char *); void SetUseShared(char *); /* * * Code... * */ /* * Compiler begins execution here */ int main(int argc, char **argv) { int n; /* Loop counter */ gargc = argc ; gargv = argv ; /* * Empty our mem ptrs */ litq=dubq=tempq=glbq=0; symtab=loctab=0; wqueue=0;membptr=0;tagptr=0;swnext=0;stage=0; gotoq=0; /* allocate space for arrays */ litq = mymalloc(FNLITQ) ; /* literals, these 2 dumped end */ dubq = mymalloc(FNLITQ) ; /* Doubles */ tempq = mymalloc(LITABSZ) ; /* Temp strings... */ glbq = mymalloc(LITABSZ) ; /* Used for glb lits, dumped now */ symtab = SYM_CAST mymalloc(NUMGLBS*sizeof(SYMBOL)) ; loctab = SYM_CAST mymalloc(NUMLOC*sizeof(SYMBOL)) ; wqueue = WQ_CAST mymalloc(NUMWHILE*sizeof(WHILE_TAB)) ; gotoq= (GOTO_TAB *)calloc(NUMGOTO,sizeof(GOTO_TAB)); if (gotoq==NULL) OutOfMem(); tagptr = tagtab = TAG_CAST mymalloc(NUMTAG*sizeof(TAG_SYMBOL)) ; membptr = membtab = SYM_CAST mymalloc(NUMMEMB*sizeof(SYMBOL)) ; swnext = SW_CAST mymalloc(NUMCASE*sizeof(SW_TAB)) ; swend = swnext + (NUMCASE-1) ; stage = mymalloc(STAGESIZE) ; stagelast = stage+STAGELIMIT ; /* empty symbol table */ glbptr = STARTGLB; while ( glbptr < ENDGLB ) { glbptr->name[0] = 0 ; ++glbptr ; } glbcnt = 0 ; /* clear global symbols */ locptr = STARTLOC ; /* clear local symbols */ wqptr = wqueue ; /* clear while queue */ gltptr=dubptr=0 ; /* clear literal pools */ *litq=0; /* First entry in literal queue is zero */ litptr=1; /* So miniprintf search works */ Zsp = /* stack ptr (relative) */ errcnt = /* no errors */ errstop = /* keep going after an error */ eof = /* not eof yet */ swactive = /* not in switch */ skiplevel = /* #if not encountered */ iflevel = /* #if nesting level = 0 */ ncmp = /* no open compound states */ lastst = /* not first file to asm */ fnstart = /* current "function" started at line 0 */ lineno = /* no lines read from file */ infunc = /* not in function now */ 0 ; /* ...all set to zero.... */ stagenext = NULL_CHAR ; /* direct output mode */ input = /* no input file */ inpt2 = /* or include file */ saveout = /* no diverted output */ output = NULL_FD ; /* no open units */ currfn = NULL_SYM ; /* no function yet */ macptr = cmode = 1 ; /* clear macro pool and enable preprocessing */ ncomp=doinline=mathz88 = incfloat= compactcode =0; intuition=zorg=lpointer=cppcom=appz88=0; dosigned=NO; makelib=useshare=makeshare=sharedfile=NO; smartprintf=expanded=YES; startup=0; /* Which startup do we want? */ nxtlab = /* start numbers at lowest possible */ ctext = /* don't include the C text as comments */ errstop = /* don't stop after errors */ verbose = 0; gotocnt=0; defdenums=0; doublestrings = 0; noaltreg = NO; safedata=reqpag = -1; shareoffset=SHAREOFFSET; /* Offset for shared libs */ debuglevel=NO; farheapsz=-1; /* Size of far heap */ asxx=NO; usempm = NO; printflevel=0; #ifdef USEFRAME indexix=YES; useframe=NO; #endif /* * compiler body */ setup_sym() ; /* define some symbols */ /* Parse the command line options */ atexit(MemCleanup); /* To free everything */ clear(); filenum=0; for (n=1;n= gargc ) return NULL_CHAR ; i = 0 ; str = str2 =gargv[n] ; while ( ++i < size && (*s++ = *str++) ) ; if (*str2 == '\0' ) return NULL_CHAR; return s ; } /* * make a few preliminary entries in the symbol table */ #ifndef SMALL_C void #endif setup_sym() { defmac("Z80") ; defmac("SMALL_C") ; /* dummy symbols for pointers to char, int, double */ /* note that the symbol names are not valid C variables */ dummy_sym[0] = 0 ; dummy_sym[CCHAR] = addglb("0ch", POINTER, CCHAR, 0, STATIK, 0,0) ; dummy_sym[CINT] = addglb("0int", POINTER, CINT, 0, STATIK, 0,0) ; dummy_sym[DOUBLE] = addglb("0dbl", POINTER,DOUBLE,0,STATIK, 0,0) ; dummy_sym[LONG] = addglb("0lng", POINTER, LONG, 0, STATIK, 0,0) ; dummy_sym[CPTR] = addglb("0cpt", POINTER, CPTR, 0, STATIK, 0,0) ; dummy_sym[VOID] = addglb("0vd", POINTER, VOID, 0 , STATIK, 0,0) ; } #ifndef SMALL_C void #endif info() { fputs(titlec,stderr); fputs(Version,stderr); fputs("\n(C) 1980-2004 Cain, Van Zandt, Hendrix, Yorston, Morris\n",stderr); fprintf(stderr,"Usage: %s [flags] [file]\n",gargv[0]); } /* *********************************************************************** * * * Routines To Write Out Scope of labels and to Dump * the static variables, also for dumping the literal pool * * *********************************************************************** */ /* * Write out the header file! - djm */ #ifdef HEADFILE void dohdrfi() { char file2[FILENAME_LEN+1]; char *file3; if (verbose) fputs("Writing header file\n",stderr); clear(); strcpy(file2,Filenorig); changesuffix(file2,".hdr"); file3=file2; while (*file3=='"') file3++; if ((output=fopen(file3,"w")) != NULL ) { dumpfns(); fclose(output); output=0; } else { fprintf(stderr,"Cannot open output file: %s\n",file3); } } #endif /* djm write out the header file */ #ifndef SMALL_C void #endif dumpfns() { int ident,type,storage; SYMBOL *ptr; FILE *fp; #ifdef HEADERFILE outstr(";\tHeader file for file:\t"); outstr(Filename); outstr("\n;\n;\tEven if empty do not delete!!!\n"); outstr(";\n;\t***START OF HEADER DEFNS***\n\n"); #else outstr("\n\n; --- Start of Scope Defns ---\n\n"); #endif if (!glbcnt) return; /* Start at the start! */ glbptr=STARTGLB; ptr=STARTGLB; while (ptr < ENDGLB) { if (ptr->name[0] != 0 && ptr->name[0] != '0' ) { ident=ptr->ident; if (ident==FUNCTIONP) ident=FUNCTION; type =ptr->type; storage=ptr->storage; if ( ident == FUNCTION && ptr->size != 0 ) { outstr("\tdefc\t"); outname(ptr->name,1); ot("=\t"); outdec(ptr->size); nl(); } else { if (ident == FUNCTION && storage!=LSTATIC ) { if (storage==EXTERNAL) { if (ptr->flags&LIBRARY) { GlobalPrefix(LIB); if ( (ptr->flags&SHARED) && useshare ){ outstr(ptr->name); outstr("_sl\n"); GlobalPrefix(LIB); } } else { GlobalPrefix(XREF); } } else { if (ptr->offset.i == FUNCTION || ptr->storage==DECLEXTN ) GlobalPrefix(XDEF); else GlobalPrefix(XREF); } outname(ptr->name,dopref(ptr)); nl(); } else { if (storage == EXTERNP) { GlobalPrefix(XDEF); outname(ptr->name,1); nl(); outstr("\tdefc\t"); outname(ptr->name,1); ot("=\t"); outdec(ptr->size); nl(); } else if (ident != ENUM && type !=ENUM && ident != MACRO && storage != LSTATIC && storage != LSTKEXT && storage!=TYPDEF ) { if (storage == EXTERNAL) GlobalPrefix(XREF); else GlobalPrefix(XDEF); outname(ptr->name,1); nl(); } } } } ++ptr; } /* * If a module requires floating point then previously we wrote * it out to the header file. However, if the module didn't * contain main() then important routines wouldn't be included. * So, if main didn't need float, but ours did we couldn't * compile correctly. * * The solution was to separate startup code, and then define * a new file to which all the math type headers would be * appended. * * This file is zcc_opt.def in the source code directory. * */ if ( (fp=fopen("zcc_opt.def","a")) == NULL ) { error(E_ZCCOPT); } /* Now output the org */ if (zorg) { fprintf(fp,"\tDEFINE DEFINED_myzorg\n"); fprintf(fp,"\tdefc myzorg = %u\n",zorg); } if (appz88) { int k,value=0; fprintf(fp,"\nIF !NEED_appstartup\n"); fprintf(fp,"\tDEFINE\tNEED_appstartup\n"); if (safedata != -1 ) fprintf(fp,"\tdefc safedata = %d\n",safedata); if (intuition) fprintf(fp,"\tdefc intuition = 1\n"); if (farheapsz != -1) { fprintf(fp,"\tDEFINE DEFINED_farheapsz\n"); fprintf(fp,"\tdefc farheapsz = %d\n",farheapsz); } if (reqpag != -1 ) { fprintf(fp,"\tdefc reqpag = %d\n",reqpag); value=reqpag; } else { /* * Consider the malloc pool as well, if defined we need 32 (standard) + * size of malloc - this is a little kludgy, hence the tuning command * line option */ if ( (k=findmac("HEAPSIZE"))) { sscanf(&macq[k],"%d",&value); if (value != 0 ) value/=256; } value+=32; fprintf(fp,"\tdefc reqpag = %d\n",value); } if (value > 32) expanded=YES; fprintf(fp,"\tdefc NEED_expanded = %d\n",expanded); fprintf(fp,"ENDIF\n\n"); } if (incfloat) { fprintf(fp,"\nIF !NEED_floatpack\n"); fprintf(fp,"\tDEFINE\tNEED_floatpack\n"); fprintf(fp,"ENDIF\n\n"); } if (mathz88) { fprintf(fp,"\nIF !NEED_mathz88\n"); fprintf(fp,"\tDEFINE\tNEED_mathz88\n"); fprintf(fp,"ENDIF\n\n"); } if (lpointer) { fprintf(fp,"\nIF !NEED_farpointer\n"); fprintf(fp,"\tDEFINE NEED_farpointer\n"); fprintf(fp,"ENDIF\n\n"); } if (startup) { fprintf(fp,"\nIF !DEFINED_startup\n"); fprintf(fp,"\tDEFINE DEFINED_startup\n"); fprintf(fp,"\tdefc startup=%d\n",startup); fprintf(fp,"ENDIF\n\n"); } /* * Now, we're gonna use #pragma define _FAR_PTR to indicate whether we need * far stuff - this has to go with a -D_FAR_PTR from the compile line * as well for everything to work just right, so if we find this then * we can indicate to the startup code via zcc_opt.def what the scam * is - this could be used for eg. to allocate space for file structures * etc */ if ( (ptr=findglb("_FAR_PTR")) && ptr->ident==MACRO ) { fprintf(fp,"\nIF !NEED_farstartup\n"); fprintf(fp,"\tDEFINE NEED_farstartup\n"); fprintf(fp,"ENDIF\n\n"); } fclose(fp); if ( defvars != 0 ) WriteDefined("defvarsaddr",defvars); switch(printflevel) { case 1: WriteDefined("ministdio",0); break; case 2: WriteDefined("complexstdio",0); break; case 3: WriteDefined("floatstdio",0); break; } /* * DO_inline is obsolete, but it may have a use sometime.. */ if (doinline) outstr("\tDEFINE\tDO_inline\n"); outstr("\n\n; --- End of Scope Defns ---\n\n"); } /* * Dump some text into the zcc_opt.def, this allows us to define some * things that the startup code might need */ void PragmaOutput(char *ptr) { char *text; FILE *fp; text = strchr(ptr,' '); if ( text == NULL ) text = strchr(ptr,'\t'); if ( text != NULL ) { *text = 0; text++; if ( (fp=fopen("zcc_opt.def","a")) == NULL ) { error(E_ZCCOPT); } fprintf(fp,"\nIF NEED_%s\n",ptr); fprintf(fp,"\tdefm\t\"%s\"\n",text); fprintf(fp,"\tdefc DEFINED_NEED_%s = 1\n",ptr); fprintf(fp,"ENDIF\n\n"); fclose(fp); } } /* Dump some bytes into the zcc_opt.def file */ void PragmaBytes(int flag) { FILE *fp; char sname[NAMESIZE]; long value; int count; if ( symname(sname) ) { if ( (fp=fopen("zcc_opt.def","a")) == NULL ) { error(E_ZCCOPT); } fprintf(fp,"\nIF NEED_%s\n",sname); if ( flag ) fprintf(fp,"\tdefc DEFINED_NEED_%s = 1\n",sname); /* Now, do the numbers */ count=0; while ( !cmatch(';') ) { if ( count == 0 ) fprintf(fp,"\n\tdefb\t"); else fprintf(fp,","); if ( number(&value) ) { fprintf(fp,"%ld",value); } else { warning(W_EXPARG); } if ( rcmatch(';') ) { break; } needchar(','); count++; if ( count == 9 ) count=0; } fprintf(fp,"\nENDIF\n"); fclose(fp); needchar(';'); } } /* * Dump a function into the zcc_opt.def file - this allows us to pass * important functions to the appstartup code so it can call them * when appropriate, we also XREF it so we don't have to do that in * the startup code */ void WriteDefined(char *sname, int value) { FILE *fp; if ( (fp=fopen("zcc_opt.def","a")) == NULL ) { error(E_ZCCOPT); } fprintf(fp,"\nIF !DEFINED_%s\n",sname); fprintf(fp,"\tdefc\tDEFINED_%s = 1\n",sname); if (value) fprintf(fp,"\tdefc %s = %d\n",sname,value); fprintf(fp,"ENDIF\n\n"); fclose(fp); } /* * Dump the DEFVAR statement out - will also be for DEFDATA..eventually! */ #ifndef SMALL_C void #endif dumpvars() { int ident,type,storage; SYMBOL *ptr; if (!glbcnt) return; /* Start at the start! */ glbptr=STARTGLB; outstr("; --- Start of Static Variables ---\n\n"); /* Two different handlings, if an application then use defvars construct * if not, then just drop em using defs! * * Even more handlings...if asz80 used we dump into data sectio */ if (asxx) ol(".area _BSS"); if (appz88 && !asxx ) { outstr("DEFVARS\t"); #if 0 if (defvars) outdec(defvars); else outstr("-1"); outstr("\n{\n"); #else outstr("-1\n{\n"); #endif } ptr=STARTGLB; while (ptr < ENDGLB) { if (ptr->name[0] != 0 && ptr->name[0] != '0' ) { ident=ptr->ident; type =ptr->type; storage=ptr->storage; if (ident !=ENUM && type !=ENUM && ident != MACRO && ident != FUNCTION && storage != EXTERNAL && storage != DECLEXTN && storage != EXTERNP && storage != LSTKEXT && storage!=TYPDEF ) { if (!appz88) prefix(); outname(ptr->name,1); col(); if (appz88 && !asxx) outstr("\n\tds.b\t"); else defstorage(); outdec(ptr->size); nl(); } } ++ptr; } if (appz88 && !asxx) outstr("}\n"); /* close defvars statement */ } /* * Dump the literal pool if it's not empty * Modified by djm to be able to input which queue should be * dumped.. */ void dumplits( int size, int pr_label , int queueptr,int queuelab, unsigned char *queue) { int j, k,lit ; if ( queueptr ) { if ( pr_label ) { if (asxx) ol(".area _TEXT"); prefix(); queuelabel(queuelab) ; col() ; nl(); } k = 0 ; while ( k < queueptr ) { /* pseudo-op to define byte */ if (infunc) j=1; else j=10; if (size == 1) defbyte(); else if (size == 4) deflong(); else if (size == 0 ) { defmesg(); j=30; } else defword(); while ( j-- ) { if (size==0) { lit=getint(queue+k,1); if (lit >= 32 && lit <= 126 && lit != '"' ) outbyte(lit); else { if (asxx) { outstr("\"\n"); defbyte(); outdec(lit); nl(); lit=0; } else { /* Now z80asm */ if ( usempm ) { outstr("\","); } else { outstr("\"&"); } outdec(lit); if (lit) { if ( usempm ) { outstr(",\""); } else { outstr("&\""); } } } } k++; if ( j == 0 || k >=queueptr || lit == 0 ) { if (lit) outbyte('"'); nl(); break; } } else { outdec(getint(queue+k, size)); k += size ; if ( j == 0 || k >= queueptr ) { nl(); /* need */ break; } outbyte(','); /* separate bytes */ } } } } nl(); } /* * dump zeroes for default initial value * (or rather, get loader to do it for us) */ int dumpzero(int size, int count) { if (count <= 0) return (0); defstorage() ; outdec(size*count) ; /* outstr("dumpzero"); */ nl(); return(size*count); } /******************************************************************** * * Routines to open the assembly and C source files * ******************************************************************** */ /* * Get output filename */ void openout() { char filen2[FILENAME_LEN+1]; FILE *fp; clear() ; /* erase line */ output = 0 ; /* start with none */ if ( nextarg(filenum, filen2, FILENAME_LEN) == NULL_CHAR ) return ; /* For weird reasons, output is opened before input, so have to check * input exists beforehand.. */ if ( ( fp=fopen(filen2,"r")) == NULL ) { fprintf(stderr,"Cannot open source file: %s\n",filen2); exit(1); } fclose(fp); /* Close it again... */ /* copy file name to string */ strcpy(Filename,filen2) ; strcpy(Filenorig,filen2); changesuffix(filen2,".asm"); /* Change appendix to .asm */ if ( (output=fopen(filen2, "w")) == NULL && (!eof) ) { fprintf(stderr,"Cannot open output file: %s\n",line); exit(1); } clear() ; /* erase line */ } /* * Get (next) input file */ void openin() { input = 0 ; /* none to start with */ while ( input == 0 ) { /* any above 1 allowed */ clear() ; /* clear line */ if ( eof ) break ; /* if user said none */ /* Deleted hopefully irrelevant code */ if (Filename[0] == '-') { if (ncomp==0) info(); exit(1); } if ( (input=fopen(Filename,"r")) == NULL ) { fprintf(stderr,"Can't open: %s\n",Filename); exit(1); } else { if (verbose) fprintf(stderr,"Compiling: %s\n",Filename); ncomp++; newfile() ; } } clear(); /* erase line */ } /* * Reset line count, etc. */ void newfile() { lineno = /* no lines read */ fnstart = /* no fn. start yet. */ infunc = 0 ; /* therefore not in fn. */ currfn = NULL ; /* no fn. yet */ } /* * Open an include file */ void doinclude() { char name[FILENAME_LEN+1], *cp ; blanks(); /* skip over to name */ if (verbose) { toconsole(); outstr(line); nl(); tofile(); } if ( inpt2 ) error(E_NEST); else { /* ignore quotes or angle brackets round file name */ strcpy(name, line+lptr) ; cp = name ; if ( *cp == '"' || *cp == '<' ) { name[strlen(name)-1] = '\0' ; ++cp ; } if ( (inpt2=fopen(cp, "r") ) == NULL ) { error(E_INCLUDE) ; closeout(); exit(1); } else { saveline = lineno ; savecurr = currfn ; saveinfn = infunc ; savestart = fnstart ; newfile() ; } } clear(); /* clear rest of line */ /* so next read will come from */ /* new file (if open) */ } /* * Close an include file */ void endinclude() { if (verbose) { toconsole(); outstr("#end include\n"); tofile(); } inpt2 = 0 ; lineno = saveline ; currfn = savecurr ; infunc = saveinfn ; fnstart = savestart ; } /* * Close the output file */ void closeout() { tofile() ; /* if diverted, return to file */ if ( output ) { /* if open, close it */ fclose(output) ; } output = 0 ; /* mark as closed */ } /* * Deals With parsing of command line options * * djm 3/12/98 * */ struct args { char *name; char more; void (*setfunc)(char *); char *help; }; struct args myargs[]= { {"math-z88",NO,SetMathZ88, "Enable machine native maths mode" }, {"unsigned",NO,SetUnsigned, "Make all types unsigned" }, {"//",NO,SetCppComm, "Accept C++ style // comments" }, {"make-app",NO,SetMakeApp, "Turn on ROMable code mode" }, {"do-inline",NO,SetDoInline, "Inline certain common functions" }, {"stop-error",NO,SetStopError, "Stop when an error is received" }, {"far-pointers",NO,SetFarPtrs, NULL}, /* Obsolete..but maybe useful*/ {"make-lib",NO,SetNoHeader, "Turn on Library code mode" }, {"make-shared",NO,SetMakeShared, "This Library file is shared" }, {"shared-file",NO,SetSharedFile, "All functions within this file are shared" }, {"use-shared",NO,SetUseShared, "Used shared library functions" }, {"Wnone",NO,SetNoWarn, "Disable all warnings" }, {"compact",NO,SetCompactCode, "Enable caller cleanup for all functions" }, {"cc",NO,SetCCode, "Intersperse the assembler output with the source c code" }, {"verbose",NO,SetVerbose, "Be more verbose"}, {"D",YES,SetDefine, "Define a preprocessor directive"}, {"U",YES,SetUndefine, "Undefine a preprocessor directive"}, {"h",NO,DispInfo, "Displace this text"}, {"v",NO,SetVerbose, "Be more verbose"}, {"Wall",NO,SetAllWarn, "Enable all warnings" }, {"Wn",YES,UnSetWarning, "Unset a warning"}, {"W",YES,SetWarning, "Set a warning"}, {"zorg=",YES,SetOrg, "Set the origin for this program" }, {"reqpag=",YES,SetReqPag, "Define the number of safe pages required (z88)" }, {"defvars=",YES,SetDefVar, "Assign all initialised statics to this address" }, {"safedata=",YES,SetSafeData, "Amount of safedata (z88)" }, {"startup=",YES,SetStartUp, "Switch between startups" }, {"shareoffset=",YES,SetShareOffset, "Define the shared offset (use with -make-shared" }, {"version",NO,DispVersion, "Display the this"}, {"intuition",NO,SetIntuition, "Enable intuition debugging (z88)" }, {"smartpf",NO,SetSmart, "Enable smart printf format handling" }, {"no-smartpf",NO,UnSetSmart, "Disable smart printf format handling" }, {"pflevel",YES,SetPfLevel, "Set the manual printf level" }, {"expandz88",NO,SetExpand, "Enable use only on expanded z88" }, {"no-expandz88",NO,UnSetExpand, "Enable use on non-expanded z88"}, {"farheap=",YES,SetFarHeap, "Set the size of the far heap (z88)"}, {"debug=",YES,SetDebug, "Enable some extra logging" }, {"asxx",NO,SetASXX, "Use asxx as the output format"}, {"doublestr",NO,SetDoubleStrings, "Convert fp strings to values at runtime"}, {"noaltreg",NO,SetNoAltReg, "Don't use alternate registers" }, #ifdef USEFRAME {"frameix",NO,SetFrameIX}, {"frameiy",NO,SetFrameIY}, {"noframe",NO,SetNoFrame}, #endif /* Compatibility Modes.. */ {"f",NO,SetUnsigned, NULL}, {"l",NO,SetFarPtrs, NULL}, {"mpm",NO,SetMPM, "Enable MPM output mode"}, {"",0, NULL, NULL} }; #ifdef USEFRAME void SetNoFrame(char *arg) { useframe=NO; indexix=NO; } void SetFrameIX(char *arg) { useframe=YES; indexix=YES; } void SetFrameIY(char *arg) { useframe=YES; indexix=NO; } #endif void SetMPM(char *arg) { usempm = YES; } void SetDoubleStrings(char *arg) { doublestrings = YES; } void SetNoAltReg(char *arg) { noaltreg = YES; } void SetASXX(char *arg) { asxx=YES; } /* farheap= */ void SetFarHeap(char *arg) { int num; num=0; sscanf(arg+8,"%d",&num); if (num!=0) farheapsz=num; } /* debug= */ void SetDebug(char *arg) { int num; num=0; sscanf(arg+6,"%d",&num); if (num!=0) debuglevel=num; } /* shareoffset= */ void SetShareOffset(char *arg) { int num; num=0; sscanf(arg+12,"%d",&num); if (num!=0) shareoffset=num; } /* startup= */ void SetStartUp(char *arg) { int num; num=0; sscanf(arg+8,"%d",&num); startup=num; #if 0 if (startup==2) appz88=YES; /* Flag that we want app startup gunk*/ #endif } /* Do we need an expanded Z88? */ void UnSetExpand(char *arg) { expanded=NO; } void SetExpand(char *arg) { expanded=YES; } /* Flag whether we want to do "smart" mapping of printf -> miniprintf */ void UnSetSmart(char *arg) { smartprintf=NO; printflevel=2; /* Complex */ } void SetSmart(char *arg) { smartprintf=YES; } /* pflevel= */ void SetPfLevel(char *arg) { int num; num=0; sscanf(arg+8,"%d",&num); if (num>=1 && num<=3) printflevel=num; } /* Flag out that we want some debugging boy! */ void SetIntuition(char *arg) { intuition=YES; } void UnSetWarning(char *arg) { int num; num=0; sscanf(arg+2,"%d",&num); if (num=0 && num <= 65535U ) zorg=num; } /* reqpag= */ void SetReqPag(char *arg) { int num; num=-1; #if 0 appz88=1; #endif sscanf(arg+7,"%d",&num); if (num >= 0 && num <= 160) reqpag=num; } void SetMathZ88(char *arg) { mathz88=YES; } void SetUnsigned(char *arg) { dosigned=YES; } void SetNoWarn(char *arg) { int i; for (i=1;isetfunc ) { if ( cur->help ) { printf("%-15s %s\n",cur->name, cur->help); } cur++; } exit(1); } void DispVersion(char *arg) { info(); exit(1); } void SetVerbose(char *arg) { verbose=YES; } void ShowNotFunc(char *arg) { fprintf(stderr,"Flag -%s is currently non-functional\n",arg); } void ParseArgs(char *arg) { struct args *pargs; int flag; pargs=myargs; flag=0; while(pargs->setfunc) { switch(pargs->more) { /* More info follows the initial thing.. */ case YES: if (strncmp(arg,pargs->name,strlen(pargs->name))==0) { (*pargs->setfunc)(arg); flag=1; } break; case NO: if (strcmp(arg,pargs->name)==0) { (*pargs->setfunc)(arg); flag=1; } } if (flag) return; pargs++; } printf("Unrecognised argument: %s\n",arg); } /* * This routine called via atexit to clean up memory */ void MemCleanup() { if (litq) { free(litq); litq=0; } if (dubq) { free(dubq); dubq=0;} if (tempq) { free(tempq); tempq=0;} if (glbq) { free(glbq); glbq=0; } if (symtab) { free(symtab); symtab=0; } if (loctab) { free(loctab); loctab=0; } if (wqueue) { free(wqueue); wqueue=0; } if (tagtab) { free(tagtab); tagtab=0; } if (membtab) { free(membtab); membtab=0; } if (swnext) { free(swnext); swnext=0; } if (stage) { free(stage); stage=0; } if (gotoq) { free(gotoq); gotoq=0; } } /* * Routine to keep DOG happy and avoid nastiness * should really do this any case..so I'll let it * pass! */ void *mymalloc(size_t size) { void *ptr; if ( (ptr=calloc(size,1)) != NULL ) return ptr; else OutOfMem(); return 0; /* Sigh */ } void OutOfMem() { fprintf(stderr,"Out of memory...\n"); exit(1); } z88dk-1.8.ds1/src/sccz80/main.h0000644000175000017500000000421507457362663015526 0ustar tygrystygrys/* main.c */ extern int main(int argc, char **argv); extern void ccabort(void); extern void parse(void); extern void errsummary(void); extern char *nextarg(int n, char *s, int size); extern void setup_sym(void); extern void info(void); extern void dohdrfi(void); extern void dumpfns(void); extern void dumpvars(void); extern void dumplits(int size, int pr_label, int queueptr, int queuelab, unsigned char *queue); extern int dumpzero(int size, int count); extern void openout(void); extern void openin(void); extern void newfile(void); extern void doinclude(void); extern void endinclude(void); extern void closeout(void); extern void SetNoWarn(char *arg); extern void SetMathZ88(char *arg); extern void SetUnsigned(char *arg); extern void SetCppComm(char *arg); extern void SetMakeApp(char *arg); extern void SetDoInline(char *arg); extern void SetStopError(char *arg); extern void SetFarPtrs(char *arg); extern void SetNoHeader(char *arg); extern void SetCompactCode(char *arg); extern void SetCCode(char *arg); extern void SetDefine(char *arg); extern void SetUndefine(char *arg); extern void DispInfo(char *arg); extern void SetVerbose(char *arg); extern void ShowNotFunc(char *arg); extern void ParseArgs(char *arg); extern void UnSetWarning(char *arg); extern void SetWarning(char *arg); extern void SetOrg(char *arg); extern void SetReqPag(char *arg); extern void SetAllWarn(char *arg); extern void SetDefVar(char *arg); extern void SetSafeData(char *arg); extern void MemCleanup(void); extern void PragmaBytes(int flag); extern void WriteDefined(char *sname, int value); extern void SetIntuition(char *); extern void SetStartUp(char *); extern void SetShareOffset(char *); extern void SetDoubleStrings(char *); extern void SetNoAltReg(char *); extern int noaltreg; extern int makeshare; extern int useshare; extern int sharedfile; extern void SetSharedFile(char *); extern void *mymalloc(size_t); extern void SetDebug(char *); extern void SetASXX(char *); extern void SetFrameIX(char *); extern void SetFrameIY(char *); extern void SetNoFrame(char *); extern void OutOfMem(void); extern void SetFarHeap(char *); extern void SetPfLevel(char *); extern void PragmaOutput(char *); z88dk-1.8.ds1/src/sccz80/Makefile0000644000175000017500000001202307614332304016045 0ustar tygrystygrys# # Makefile for sccz80 # # $Id: Makefile,v 1.8 2003/01/24 21:48:52 dom Exp $ # OBJS = callfunc.o \ codegen.o \ const.o \ data.o \ declfunc.o \ declinit.o \ declvar.o \ error.o \ expr.o \ float.o \ goto.o \ io.o \ lex.o \ main.o \ misc.o \ plunge.o \ preproc.o \ primary.o \ stmt.o \ sym.o \ while.o all: sccz80 sccz80: $(OBJS) $(CC) $(LDFLAGS) -o sccz80 $(OBJS) install: install -m 755 sccz80 $(PREFIX)/bin/sccz80 clean : $(RM) *.o *~ core sccz80 # Dependencies (gcc -MM) callfunc.o: callfunc.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \ const.h data.h declvar.h declfunc.h declinit.h error.h expr.h float.h \ io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \ while.h codegen.o: codegen.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \ const.h data.h declvar.h declfunc.h declinit.h error.h expr.h float.h \ io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \ while.h const.o: const.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h data.o: data.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h declfunc.o: declfunc.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \ const.h data.h declvar.h declfunc.h declinit.h error.h expr.h float.h \ io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \ while.h declinit.o: declinit.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \ const.h data.h declvar.h declfunc.h declinit.h error.h expr.h float.h \ io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \ while.h declvar.o: declvar.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \ const.h data.h declvar.h declfunc.h declinit.h error.h expr.h float.h \ io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \ while.h error.o: error.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h expr.o: expr.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h float.o: float.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h goto.o: goto.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h io.o: io.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h data.h \ declvar.h declfunc.h declinit.h error.h expr.h float.h io.h lex.h \ main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h lex.o: lex.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h main.o: main.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h misc.o: misc.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h plunge.o: plunge.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \ const.h data.h declvar.h declfunc.h declinit.h error.h expr.h float.h \ io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \ while.h preproc.o: preproc.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \ const.h data.h declvar.h declfunc.h declinit.h error.h expr.h float.h \ io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \ while.h primary.o: primary.c ccdefs.h define.h lvalue.h callfunc.h codegen.h \ const.h data.h declvar.h declfunc.h declinit.h error.h expr.h float.h \ io.h lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h \ while.h stmt.o: stmt.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h sym.o: sym.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h while.o: while.c ccdefs.h define.h lvalue.h callfunc.h codegen.h const.h \ data.h declvar.h declfunc.h declinit.h error.h expr.h float.h io.h \ lex.h main.h misc.h plunge.h preproc.h primary.h stmt.h sym.h while.h z88dk-1.8.ds1/src/sccz80/misc.c0000644000175000017500000000313607130401714015504 0ustar tygrystygrys/********************************************************************* * * Some routines just dumped here by djm..can't be bothered to * find proper place for them! * ********************************************************************* */ #include "ccdefs.h" /* Prefix for assembler */ void prefix() { if (!asxx) outbyte('.'); } /* Generic change suffix routine */ void changesuffix(char *name, char *suffix) { int j; j=strlen(name)+1; while (j && name[j-1] != '.' ) { j--; } if ( j) name[j-1]='\0'; strcat(name,suffix); } /* These two used to keep track of what goes on stack, and what comes * off of stack, guess 100 is enough to be going on with? */ SYMBOL *stkptr[100], *laststk; int stkcount; char flgstk[100]; /* Set up the stack references... */ void initstack() { stkcount=0; laststk=0; } /* Retrieve last item on the stack */ SYMBOL *retrstk(char *flags) { SYMBOL *ptr; if (!stkcount) return (laststk=0); ptr=laststk=stkptr[--stkcount]; *flags=flgstk[stkcount]; return(ptr); } /* Insert an item onto the stack */ int addstk(LVALUE *lval) { if ((stkcount+1) >= 99 ) return (0); stkptr[stkcount]=lval->symbol; flgstk[stkcount]=lval->flags; return(stkcount++); } /* Check if last item referenced to is this item, used when loading * values - saves a little bit of generated code */ int chkstk(SYMBOL *ptr) { if (!stkcount) return (0); if (laststk==ptr) return(1); else return(0); } z88dk-1.8.ds1/src/sccz80/misc.h0000644000175000017500000000033607130401714015510 0ustar tygrystygrys/* misc.c */ extern void prefix(void); extern void changesuffix(char *name, char *suffix); extern void initstack(void); extern SYMBOL *retrstk(char *flags); extern int addstk(LVALUE *lval); extern int chkstk(SYMBOL *ptr); z88dk-1.8.ds1/src/sccz80/plunge.c0000644000175000017500000002762710671010535016057 0ustar tygrystygrys/* * Small C+ Compiler * * Plunging routines * * $Id: plunge.c,v 1.10 2007/09/09 15:29:33 dom Exp $ * * Altogether now...arse! My cunning scheme to use c as an * indicator flops badly due to logical conditions, I just * wanna scream! So, during the if statement we use c to * signal that we want to drop out, at the end we test for * hl to maintain the logicalness... */ #include "ccdefs.h" /* * skim over text adjoining || and && operators */ int skim(char *opstr, void (*testfuncz)(), void (*testfuncq)(), int dropval, int endval, int (*heir)(), LVALUE *lval) { int droplab, endlab, hits, k ; hits = 0 ; while (1) { k = plnge1(heir, lval) ; if ( streq(line+lptr, opstr) == 2 ) { inbyte() ; inbyte() ; if (hits == 0) { hits = 1 ; droplab = getlabel() ; } dropout(k, testfuncz,testfuncq, droplab, lval) ; } else if (hits) { dropout(k, testfuncz,testfuncq, droplab, lval) ; vconst(endval) ; jumpr(endlab=getlabel()) ; postlabel(droplab); vconst(dropval); postlabel(endlab) ; lval->val_type = lval->oldval_type = CINT; /* stops the carry stuff coming in */ lval->indirect = lval->ptr_type = lval->is_const = lval->const_val = 0 ; lval->stage_add = NULL_CHAR ; lval->binop=dummy; return (0) ; } else return k ; } } /* * test for early dropout from || or && evaluations */ void dropout(int k, void (*testfuncz)(), void (*testfuncq)(), int exit1, LVALUE *lval) { int temp; if ( k ) rvalue(lval) ; else if ( lval->is_const ) { if (lval->val_type == LONG) vlongconst(lval->const_val); else vconst(lval->const_val) ; } if (DoTestJump(lval) || lval->binop==dummy ) { if (lval->binop==dummy) { lval->val_type=CINT; } (*testfuncz)(lval,exit1); /* test zero jump */ } else { (*testfuncq)(exit1); /* carry jump */ } } /* * unary plunge to lower level */ int plnge1(int (*heir)(), LVALUE *lval) { char *before, *start ; int k ; setstage(&before, &start) ; k = (*heir)(lval) ; if ( lval->is_const ) { /* constant, load it later */ clearstage( before, 0 ) ; } return (k) ; } /* * binary plunge to lower level (not for +/-) */ void plnge2a(int (*heir)(), LVALUE *lval, LVALUE *lval2, void (*oper)(), void (*doper)()) { char *before, *start ; setstage(&before, &start) ; lval->stage_add = 0 ; /* flag as not "..oper 0" syntax */ if ( lval->is_const ) { /* constant on left not loaded yet */ if ( plnge1(heir, lval2) ) rvalue(lval2) ; if ( lval->const_val == 0 ) lval->stage_add = stagenext ; /* Fixed 4/5/2000 If LHS was long const then we would generate bad code cos constant was only in de and rhs was ot on the stack -> crash (also in plnge2b) */ if (lval->val_type == LONG) { widenlong(lval,lval2); lval2->val_type=LONG; /* Kludge */ lpush(); vlongconst(lval->const_val); } else { const2(lval->const_val) ; } dcerror(lval2) ; } else { /* non-constant on left */ if ( lval->val_type == DOUBLE ) dpush() ; else { if ( lval->val_type == LONG || lval->val_type==CPTR) { lpush(); } else zpush(); } if( plnge1(heir,lval2) ) rvalue(lval2); if ( lval2->is_const ) { /* constant on right, load primary */ if ( lval2->const_val == 0 ) lval->stage_add = start ; /* djm, load double reg for long operators */ if (lval->val_type == LONG || lval2->val_type==LONG ) { vlongconst(lval2->const_val); lval2->val_type=LONG; } else vconst(lval2->const_val) ; dcerror(lval) ; if (lval2->const_val == 0 && (oper==zdiv || oper==zmod ) ) { clearstage(start,0); if (lval->val_type==LONG) { Zsp +=4; vlongconst(0); } else { vconst(0); Zsp+=2; } warning(W_DIVZERO); return; } } if ( lval->val_type != DOUBLE && lval2->val_type != DOUBLE && lval->val_type != LONG && lval2->val_type !=LONG && lval->val_type !=CPTR && lval2->val_type !=CPTR ) /* Dodgy? */ zpop() ; } lval->is_const &= lval2->is_const ; /* ensure that operation is valid for double */ if ( doper == 0 ) intcheck(lval, lval2) ; if ( widen(lval, lval2) ) { (*doper)(lval); /* result of comparison is int */ if( doper != mult && doper != zdiv ) lval->val_type = CINT; return; } /* Attempt to compensate width, so that we are doing double oprs if * one of the expressions is a double */ if ( !lval->is_const ) widenlong(lval, lval2); if ( lval->ptr_type || lval2->ptr_type ) { (*oper)(lval); // if (lval->val_type == CPTR) zpop(); /* rest top bits */ lval->binop = oper ; return; } /* Moved unsigned thing to below, so can fold expr correctly! */ if ( (lval2->symbol && lval2->symbol->ident == POINTER) ) { (*oper)(lval); lval->binop = oper ; return; } if ( lval->is_const ) { /* both operands constant taking respect of sign now, * unsigned takes precedence.. */ if ( (lval->flags&UNSIGNED) || (lval2->flags&UNSIGNED) ) lval->const_val = calcun(lval->const_val, oper, lval2->const_val) ; else lval->const_val = calc(lval->const_val, oper, lval2->const_val) ; clearstage(before, 0) ; /* For long constants we push on stack, have to undo this... */ if ( lval->val_type == LONG ) Zsp += 4; } else { /* one or both operands not constant */ /* djm, if we have a constant and a proper lvalue, then set the flags of * const to equal the signedness of the lvalue. This *will* cause * problems if we allow specifiers after numbers */ if (lval->is_const) lval->flags=(lval->flags&MKSIGN)|(lval2->flags&UNSIGNED); if (lval2->is_const) lval2->flags=(lval2->flags&MKSIGN)|(lval->flags&UNSIGNED); if ((lval->flags&UNSIGNED) !=( lval2->flags&UNSIGNED) && (oper==zmod || oper==mult || oper==zdiv)) warning(W_OPSG); /* Special case for multiplication by constant... */ if (oper==mult && (lval2->is_const) && (lval->val_type ==CINT || lval->val_type==CCHAR) ){ clearstage(before,0); quikmult(lval2->const_val,NO); return; } (*oper)(lval); lval->binop = oper ; } } /* * binary plunge to lower level (for +/-) */ void plnge2b(int (*heir)(), LVALUE *lval, LVALUE *lval2, void (*oper)()) { char *before, *start, *before1, *start1 ; int val, oldsp = Zsp ; setstage(&before, &start) ; if ( lval->is_const ) { /* constant on left not yet loaded */ if ( plnge1(heir, lval2) ) rvalue(lval2) ; val = lval->const_val ; if ( dbltest(lval2, lval) ) { /* are adding lval to pointer, adjust size */ cscale(lval2->ptr_type, lval2->tagsym, &val) ; } if (lval->val_type == LONG) { widenlong(lval,lval2); if ( noaltreg ) { vlongconst_noalt(val); } else { doexx(); vlongconst(val); lpush(); doexx(); } } else { const2(val) ; } dcerror(lval2) ; } else { /* non-constant on left */ setstage(&before1, &start1) ; if ( lval->val_type == DOUBLE ) dpush() ; else if (lval->val_type == LONG || lval->val_type==CPTR) lpush() ; /* Long ptrs? */ else { if ( lval->val_type == CARRY ) { zcarryconv(); lval->val_type = CINT; } zpush() ; } if ( plnge1(heir, lval2) ) rvalue(lval2) ; if ( lval2->is_const ) { /* constant on right */ val = lval2->const_val ; if ( dbltest(lval, lval2) ) { /* are adding lval2 to pointer, adjust size */ cscale(lval->ptr_type, lval->tagsym, &val) ; } if ( oper == zsub ) { /* addition on Z80 is cheaper than subtraction */ val = (-val) ; /* skip later diff scaling - constant can't be pointer */ oper = zadd ; } /* remove zpush and add int constant to int */ clearstage(before1, 0) ; Zsp += 2 ; if ( lval->val_type == LONG || lval->val_type==CPTR) Zsp +=2; addconst(val,0,0) ; dcerror(lval) ; } else { /* non-constant on both sides or double +/- int const */ if (dbltest(lval,lval2)) scale(lval->ptr_type, lval->tagsym); if ( widen(lval, lval2) ) { /* floating point operation */ (*oper)(lval); lval->is_const = 0 ; return ; } else { widenlong(lval, lval2) ; /* non-constant integer operation */ if (lval->val_type != LONG && lval->val_type !=CPTR ) zpop(); if ( dbltest(lval2, lval) ) { swap(); scale(lval2->ptr_type, lval2->tagsym) ; /* subtraction not commutative */ if (oper == zsub) swap(); } } } } if ( lval->is_const &= lval2->is_const ) { /* both operands constant */ if (oper == zadd) lval->const_val += lval2->const_val ; else if (oper == zsub) lval->const_val -= lval2->const_val ; else lval->const_val = 0 ; clearstage(before, 0) ; Zsp = oldsp; } else if (lval2->is_const == 0) { /* right operand not constant */ (*oper)(lval); } if (oper == zsub && lval->ptr_type ) { /* scale difference between pointers */ /* djm...preserve our pointer high 8 bits? */ if (lval->val_type == CPTR ){ lval->val_type=CPTR; ltype=LONG; } else { lval->val_type=CINT; /* operate on pointers as ints */ ltype=CINT; /* dodgy maybe 24/4/99 */ } if( lval->ptr_type == CINT && lval2->ptr_type == CINT ) { if (lval->val_type == CPTR) { lpush(); vlongconst(1); } else { swap(); vconst(1); } asr(lval); /* div by 2 */ } else if ( lval->ptr_type == CPTR && lval2->ptr_type == CPTR) { if (lval->val_type == CPTR) { lpush(); vlongconst(3); } else { swap(); vconst(3); } zdiv(lval); } else if( lval->ptr_type == LONG && lval2->ptr_type == LONG) { if (lval->val_type == CPTR) { lpush(); vlongconst(2); } else { swap(); vconst(2); } asr(lval); /* div by 4 */ } else if( lval->ptr_type == DOUBLE && lval2->ptr_type == DOUBLE ) { if (lval->val_type == CPTR) { lpush(); vlongconst(6); } else { swap(); vconst(6); } zdiv(lval); /* div by 6 */ } else if ( lval->ptr_type == STRUCT && lval2->ptr_type == STRUCT ) { if (lval->val_type == CPTR) { lpush(); vlongconst(lval->tagsym->size); } else { swap(); vconst(lval->tagsym->size); } zdiv(lval) ; } } result(lval,lval2); } z88dk-1.8.ds1/src/sccz80/plunge.h0000644000175000017500000000071707130401714016052 0ustar tygrystygrys/* plunge.c */ extern int skim(char *opstr, void (*testfuncz)(), void (*testfuncq)(), int dropval, int endval, int (*heir)(), LVALUE *lval); extern void dropout(int k, void (*testfuncz)(), void (*testfuncq)(), int exit1, LVALUE *lval); extern int plnge1(int (*heir)(), LVALUE *lval); extern void plnge2a(int (*heir)(), LVALUE *lval, LVALUE *lval2, void (*oper)(), void (*doper)()); extern void plnge2b(int (*heir)(), LVALUE *lval, LVALUE *lval2, void (*oper)()); z88dk-1.8.ds1/src/sccz80/preproc.c0000644000175000017500000002575210031124521016223 0ustar tygrystygrys/* * Small C+ Compiler * * The rather simple preprocessor is here * * $Id: preproc.c,v 1.3 2004/03/26 22:06:09 denniz Exp $ */ #include "ccdefs.h" void junk() { if(an(inbyte())) while(an(ch()))gch(); else while(an(ch())==0) { if(ch()==0)break; gch(); } blanks(); } char ch() { return line[lptr] ; } char nch() { if ( ch() ) return line[lptr+1] ; return 0; } char gch() { if ( ch() ) return line[lptr++] ; return 0; } void clear() { lptr = 0 ; line[0] = 0 ; } char inbyte() { while(ch()==0) { if (eof) return 0; preprocess(); } return gch(); } void vinline() { FILE *unit ; int k ; while(1) { if ( input == NULL_FD ) openin() ; if ( eof ) return ; if( (unit=inpt2) == NULL_FD ) unit = input ; clear() ; while ( (k=getc(unit)) > 0 ) { if ( k == '\n' || k == '\r' || lptr >= LINEMAX ) break; line[lptr++]=k; } line[lptr] = 0 ; /* append null */ if (k != '\r') ++lineno ; /* read one more line */ if ( k <= 0 ) { fclose(unit); if ( inpt2 != NULL_FD ) endinclude() ; else { input = 0; eof=1; } } if ( lptr ) { if( ctext && cmode ) { comment(); outstr(line); nl(); } lptr=0; return; } } } /* * ifline - part of preprocessor to handle #ifdef, etc */ void ifline() { char sname[NAMESIZE] ; endasm=0; while ( 1 ) { vinline() ; if ( eof ) return ; if ( ch() == '#' ) { if ( match("#pragma") ) { dopragma(); if (endasm) break; continue ; } if ( match("#undef") ) { delmac() ; continue ; } if ( match("#ifdef") ) { ++iflevel ; if ( skiplevel ) continue ; symname(sname) ; if ( findmac(sname) == 0 ) skiplevel = iflevel ; continue ; } if ( match("#ifndef") ) { ++iflevel ; if ( skiplevel ) continue ; symname(sname) ; if ( findmac(sname) ) skiplevel = iflevel ; continue ; } if ( match("#else") ) { if ( iflevel ) { if ( skiplevel == iflevel ) skiplevel = 0 ; else if ( skiplevel == 0 ) skiplevel = iflevel ; } else noiferr() ; continue ; } if ( match("#endif") ) { if ( iflevel ) { if ( skiplevel == iflevel ) skiplevel = 0 ; --iflevel ; } else noiferr() ; continue ; } if ( match("# ") || match("#line") ) { int num=0; char string[FILENAME_LEN+1]; string[0]=0; sscanf(line+lptr,"%d %s",&num,string); if (num) lineno=--num; if (strlen(string)) strcpy(Filename,string); if (lineno==0) DoLibHeader(); continue; } } if ( skiplevel ) continue ; if ( ch() == 0 ) continue ; break ; } } void noiferr() { error(E_MISSIF) ; } void keepch(char c) { mline[mptr] = c ; if ( mptr < MPMAX ) ++mptr ; } /* The preprocessor here is pants, and messes up all sorts of things - best leave it to the external preprocessor to do all the dirty work */ void preprocess() { char c,sname[NAMESIZE]; int k; ifline() ; return; #if 0 if ( eof || cmode == 0 ) { /* while passing through assembler, only do #if, etc */ return ; } mptr = lptr = 0 ; while ( ch() ) { if ( ch()==' ' || ch()=='\t' ) { keepch(' '); while ( ch()==' ' || ch()=='\t' ) gch(); } else if(ch()=='"') { keepch(ch()); gch(); do { while ( ch()!='"' || (line[lptr-1]==92 && line[lptr-2]!=92 ) ) { if(ch()==0) { warning(W_EXPQT); break; } keepch(gch()); } } while (gch() && cmatch('"') ); keepch('"'); } else if(ch()==39) { keepch(39); gch(); while ( ch()!=39 || (line[lptr-1]==92 && line[lptr-2]!=92) ) { if(ch()==0) { warning(W_EXPAPO); break; } keepch(gch()); } gch(); keepch(39); } /* else if (amatch("typedef")) { warning(W_TYPEDEF); junk(); vinline(); if (eof) break; } */ else if (ch()=='/' && nch()=='/' && (cppcom)) { junk(); vinline(); if (eof) break; } else if ( ch()=='/' && nch()=='*' ) { lptr += 2; while ( ch()!='*' || nch()!='/' ) { if ( ch() ) { ++lptr; } else { vinline() ; if(eof)break; } } lptr += 2; } /* * Some preprocessor directives, if they get this far then we are running * the compiler directly, so we need the quotes around filename */ else if ( amatch("__LINE__")){ sprintf(sname,"%d",lineno); for (k=0 ; k= MPMAX ) error(E_TOOLONG) ; strcpy(line, mline) ; lptr = 0 ; #endif } void addmac() { char sname[NAMESIZE]; if ( symname(sname) == 0 ) { illname(sname); clear(); return; } addglb(sname, MACRO, 0, macptr, STATIK, 0, 0) ; while ( ch()==' ' || ch()=='\t' ) gch() ; while ( putmac(gch()) ) ; if ( macptr >= MACMAX ) error(E_MACOV) ; } /* * delete macro from symbol table, but leave entry so hashing still works */ void delmac() { char sname[NAMESIZE] ; SYMBOL *ptr ; if ( symname(sname) ) { if ( (ptr=findglb(sname)) ) { /* invalidate name */ ptr->name[0] = '0' ; } } } char putmac(char c) { macq[macptr] = c ; if ( macptr < MACMAX ) ++macptr ; return (c) ; } int findmac(char *sname) { if( findglb(sname) != 0 && glbptr->ident == MACRO ) { return (glbptr->offset.i) ; } return (0) ; } /* * defmac - takes macro definition of form name[=value] and enters * it in table. If value is not present, set value to 1. * Uses some shady manipulation of the line buffer to set * up conditions for addmac(). */ void defmac(char *text) { char *p ; /* copy macro name into line buffer */ p = line ; while ( *text != '=' && *text ) { *p++ = *text++ ; } *p++ = ' ' ; /* copy value or "1" into line buffer */ strcpy(p, (*text++) ? text : "1") ; /* make addition to table */ lptr = 0 ; addmac() ; } z88dk-1.8.ds1/src/sccz80/preproc.h0000644000175000017500000000067207130401714016232 0ustar tygrystygrys/* preproc.c */ extern void junk(void); extern char ch(void); extern char nch(void); extern char gch(void); extern void clear(void); extern char inbyte(void); extern void vinline(void); extern void ifline(void); extern void noiferr(void); extern void keepch(char c); extern void preprocess(void); extern void addmac(void); extern void delmac(void); extern char putmac(char c); extern int findmac(char *sname); extern void defmac(char *text); z88dk-1.8.ds1/src/sccz80/primary.c0000644000175000017500000006123210643235304016240 0ustar tygrystygrys/* * Small C+ Compiler * Split into parts djm 3/3/99 * * This part contains various routines to deal with constants * and also finds variable names in the hash tables * * $Id: primary.c,v 1.19 2007/07/05 18:39:00 dom Exp $ */ #include "ccdefs.h" int primary(LVALUE *lval) { char sname[NAMESIZE] ; SYMBOL *ptr ; int k,level ; char cid,vtype,cflags,clevel; TAG_SYMBOL *cotag; if ( cmatch('(') ) { lval->level++; do k=heir1(lval); while (cmatch(',')) ; needchar(')'); /* Not sure about doing this here..but here goes nowt!*/ if (lval->c_vtype) { docast(lval,YES); } lval->level--; if (lval->c_vtype) { docast(lval,YES); } return k; } /* clear lval array - djm second arg was lval.. now cast, clears lval */ cid=lval->c_id; vtype=lval->c_vtype; cflags=lval->c_flags; cotag=lval->c_tag; level=lval->level; clevel=lval->castlevel; memset(lval,0,sizeof(LVALUE)); lval->c_id=cid; lval->c_vtype=vtype; lval->c_flags=cflags; lval->c_tag=cotag; lval->level=level; lval->castlevel = clevel; if ( symname(sname) ) { if ( strcmp(sname, "sizeof") == 0 ) { size_of(lval) ; return(0) ; } else if ( (ptr=findloc(sname)) && ptr->ident !=GOTOLABEL ) { lval->offset=getloc(ptr, 0); lval->symbol = ptr; lval->val_type = lval->indirect = ptr->type; lval->flags = ptr->flags; lval->ident = ptr->ident; lval->storage = ptr->storage; lval->ptr_type=0; ltype=ptr->type; if ( ptr->type == STRUCT ) lval->tagsym = tagtab + ptr->tag_idx ; if ( ptr->ident == POINTER ) { lval->ptr_type = ptr->type; /* djm long pointers */ lval->indirect=lval->val_type = (ptr->flags&FARPTR ? CPTR : CINT); ltype=lval->indirect; } if ( ptr->ident == ARRAY || (ptr->ident == VARIABLE && ptr->type == STRUCT) ) { /* djm pointer? */ lval->ptr_type = ptr->type ; lval->val_type = (ptr->flags&FARPTR ? CPTR : CINT ); return(0) ; } else return(1); } /* djm search for local statics */ ptr=findstc(sname); if (!ptr) ptr=findglb(sname); if ( ptr ) { if ( ptr->ident != FUNCTION && ptr->ident !=FUNCTIONP ) { if (ptr->ident==ENUM ) error(E_UNSYMB,sname); if (ptr->type==ENUM) { lval->symbol = NULL_SYM ; lval->indirect = 0 ; lval->is_const = 1; lval->const_val=ptr->size; lval->flags=0; lval->ident = VARIABLE; return(0) ; } lval->symbol = ptr ; lval->indirect = 0 ; lval->val_type = ptr->type ; lval->flags = ptr->flags ; lval->ident = ptr->ident; lval->ptr_type = 0; lval->storage = ptr->storage; ltype=ptr->type; if ( ptr->type == STRUCT ) lval->tagsym = tagtab + ptr->tag_idx ; if ( ptr->ident != ARRAY && (ptr->ident != VARIABLE || ptr->type != STRUCT) ) { if ( ptr->ident == POINTER ) { lval->ptr_type = ptr->type; lval->val_type = (ptr->flags&FARPTR ? CPTR : CINT); ltype=lval->val_type; } return(1); } /* Handle arrays... */ address(ptr); /* djm sommat here about pointer types? */ lval->indirect = lval->ptr_type = ptr->type ; lval->val_type = (ptr->flags&FARPTR ? CPTR : CINT); return(0) ; } else { lval->ident=FUNCTION; } } else { /* Check to see if we have a right bracket, if we don't assume * it's a function then we can break an awful lot of code, do it * this way and it's safer... we're not GNU after all! */ if ( rcmatch('(') ) warning(W_FUNC_NO_PROTO); else { error(E_UNSYMB,sname); } /* assume it's a function we haven't seen yet */ /* NB value set to 0 */ ptr = addglb(sname,FUNCTION,CINT,0,STATIK,0,0); ptr->size=0; ptr->prototyped=0; /* No parameters known */ ptr->args[0]=CalcArgValue(CINT, FUNCTION, 0); } lval->symbol = ptr ; lval->indirect = 0 ; lval->val_type = CINT ; /* Null function, always int */ lval->flags = 0 ; /* Assume signed, no far */ lval->ident=FUNCTION; return(0) ; } if ( constant(lval) ) { lval->symbol = NULL_SYM ; lval->indirect = 0 ; lval->ident = VARIABLE; return(0) ; } else { error(E_EXPRESSION); vconst(0); junk(); return(0); } } /* * flag error if integer constant is found in double expression */ void dcerror(LVALUE *lval) { if ( lval->val_type == DOUBLE ) warning(W_INTDOUB) ; } /* * calculate constant expression (signed values) */ int calc( int left, void (*oper)(void), int right) { if (oper == zdiv) return (left / right ); else if (oper == zmod) return (left % right ); else if (oper == zle) return (left <= right) ; else if (oper == zge) return (left >= right) ; else if (oper == zlt) return (left < right) ; else if (oper == zgt) return (left > right) ; else if (oper == asr) return (left >> right) ; else return(CalcStand(left,oper,right)) ; } int calcun( unsigned int left, void (*oper)(void), unsigned int right) { if (oper == zdiv) return (left / right ); else if (oper == zmod) return (left % right ); else if (oper == zle) return (left <= right) ; else if (oper == zge) return (left >= right) ; else if (oper == zlt) return (left < right) ; else if (oper == zgt) return (left > right) ; else if (oper == asr) return (left >> right) ; else return(CalcStand(left,oper,right)) ; } /* * Calculations..standard ones - same for U & S */ int CalcStand( int left, void (*oper)(void), int right) { if (oper == zor) return (left | right) ; else if (oper == zxor) return (left ^ right) ; else if (oper == zand) return (left & right) ; else if (oper == mult) return (left * right) ; else if (oper == asl) return (left << right) ; else if (oper == zeq) return (left == right) ; else if (oper == zne) return (left != right) ; else return(0); } /* Complains if an operand isn't int */ void intcheck(LVALUE *lval, LVALUE *lval2) { if( lval->val_type==DOUBLE || lval2->val_type==DOUBLE ) error(E_INTOPER); } /* Forces result, having type t2, to have type t1 */ /* Must take account of sign in here somewhere, also there is a problem possibly with longs.. */ void force(int t1, int t2,char sign1,char sign2,int lconst) { if ( t2 == CARRY ) { zcarryconv(); } if(t1==DOUBLE) { if(t2!=DOUBLE) { DoDoubConv(t2,sign2); } } else { if (t2==DOUBLE ) { convdoub2int(); return; } } /* t2 =source, t1=dest */ /* int to long, if signed, do sign, if not ld de,0 */ /* Check to see if constant or not... */ if(t1==LONG) { if (t2!=LONG && (!lconst)) { if (sign2==NO && sign1==NO && t2 != CARRY) convSint2long(); else convUint2long(); } return; } /* Converting long to int, not needed, if it don't fit tough!! */ /* Converting between pointer types..far and near */ if (t1==CPTR && t2==CINT) convUint2long(); else if (t2==CPTR && t1==CINT) warning(W_FARNR); /* Char conversion */ if ( t1 == CCHAR && sign2 == NO && !lconst) { if ( sign1 == NO ) convSint2char(); else convUint2char(); } else if ( t1 == CCHAR && sign2 == YES && !lconst ) { if ( sign1 == NO ) convSint2char(); else convUint2char(); } } /* * If only one operand is DOUBLE, converts the other one to * DOUBLE. Returns 1 if result will be DOUBLE * * Maybe should an operand in here for LONG? */ int widen(LVALUE *lval, LVALUE *lval2) { if ( lval2->val_type == DOUBLE ) { if ( lval->val_type != DOUBLE ) { dpush2(); /* push 2nd operand UNDER 1st */ mainpop() ; if (lval->val_type==LONG) zpop(); DoDoubConv(lval->val_type,lval->flags&UNSIGNED); DoubSwap(); lval->val_type = DOUBLE ; /* type of result */ } return(1); } else { if ( lval->val_type == DOUBLE ) { DoDoubConv(lval2->val_type,lval2->flags&UNSIGNED); lval2->val_type=DOUBLE; return(1); } else return(0); } } void widenlong(LVALUE *lval,LVALUE *lval2) { if ( lval2->val_type == CARRY ) { zcarryconv(); lval2->val_type = CINT; } if ( lval2->val_type == LONG ) { /* Second operator is long */ if ( lval->val_type != LONG ) { doexx(); /* Preserve other operator */ mainpop() ; force(LONG,lval->val_type,lval->flags&UNSIGNED, lval->flags&UNSIGNED, 0 ); lpush(); /* Put the new expansion on stk*/ doexx(); /* Get it back again */ lval->val_type = LONG; } return; } if ( lval->val_type == LONG) { if (lval2->val_type != LONG && lval2->val_type != CPTR) { /* * FIXED!! 23/4/99 djm, if any of them is unsigned then we extend out * to an unsigned long. * * This is sort of in accordance with A6.5 except for the fact that * we don't convert the signed integer to postive if it negative * * If neither are unsigned, then we extend the sign, let me know if this * causes lots of problems! */ if ( (lval->flags&UNSIGNED) || (lval2->flags&UNSIGNED) ) convUint2long(); else convSint2long(); lval->val_type=LONG; } } } /* * true if val1 -> int pointer or int array and * val2 not ptr or array */ int dbltest(LVALUE *lval, LVALUE *lval2) { if ( lval->ptr_type ) { if ( lval->ptr_type == CCHAR ) return(0); if ( lval2->ptr_type ) return(0); return(1); } else return(0); } /* * determine type of binary operation */ void result(LVALUE *lval,LVALUE *lval2) { if ( lval->ptr_type && lval2->ptr_type ) { lval->ptr_type = 0 ; /* ptr-ptr => int */ if (lval->val_type == CPTR) lval->val_type = LONG; else lval->val_type = CINT; lval->indirect = 0; lval->ident = VARIABLE; } else if ( lval2->ptr_type ) { /* ptr +- int => ptr */ lval->symbol = lval2->symbol ; lval->indirect = lval2->indirect ; lval->ptr_type = lval2->ptr_type ; } } /* * prestep - preincrement or predecrement lvalue */ void prestep( LVALUE *lval, int n, void (*step)()) { if ( heira(lval) == 0 ) { needlval(); } else { if(lval->indirect) { addstk(lval); if (lval->flags&FARACC) lpush(); else zpush(); } rvalue(lval); intcheck(lval,lval); switch ( lval->ptr_type ) { case DOUBLE : addconst(n*6,1,lval->symbol->flags&FARPTR); break ; case STRUCT : addconst(n*lval->tagsym->size,1,lval->symbol->flags&FARPTR) ; break ; case LONG : (*step)(lval) ; case CPTR : (*step)(lval) ; case CINT : (*step)(lval) ; default : (*step)(lval) ; break ; } store(lval); } } /* * poststep - postincrement or postdecrement lvalue */ void poststep( int k, LVALUE *lval, int n, void (*step)(), void (*unstep)() ) { if ( k == 0 ) { needlval() ; } else { if(lval->indirect) { addstk(lval); if (lval->flags&FARACC) lpush(); else zpush(); } rvalue(lval); intcheck(lval,lval); switch ( lval->ptr_type ) { case DOUBLE : nstep(lval, n*6,unstep); break ; case STRUCT : nstep(lval, n*lval->tagsym->size,unstep) ; break ; case LONG: nstep(lval,n*4,unstep) ; break; case CPTR: nstep(lval,n*3,unstep) ; break; case CINT : (*step)(lval) ; default : (*step)(lval); store(lval); if (unstep) (*unstep)(lval); if ( lval->ptr_type == CINT ) if (unstep) (*unstep)(lval); break ; } } } /* * generate code to postincrement by n * no need to change for long pointers since we're going to have * memory pools.. */ void nstep( LVALUE *lval, int n, void (*unstep)() ) { addconst(n,1,lval->symbol->flags&FARPTR) ; store(lval) ; if (unstep) addconst(-n,1,lval->symbol->flags&FARPTR); } void store(LVALUE *lval) { if (lval->indirect == 0) putmem(lval->symbol) ; else putstk(lval->indirect) ; } /* * push address only if it's not that of a two byte quantity at TOS * or second TOS. In either of those cases, forget address calculation * This should be followed by a smartstore() */ void smartpush(LVALUE *lval,char *before) { if ( lval->indirect != CINT || lval->symbol == 0 || lval->symbol->storage != STKLOC ) { addstk(lval); if ( (lval->flags&FARACC) || ( lval->symbol && lval->symbol->storage==FAR) ) { lpush(); } else { zpush(); } } else { switch ( lval->symbol->offset.i - Zsp ) { case 0: case 2: if ( before ) clearstage(before, 0) ; break ; default: addstk(lval); if (lval->symbol && lval->symbol->storage==FAR) { lpush(); } else { zpush(); } } } } /* * store thing in primary register at address taking account * of previous preparation to store at TOS or second TOS */ void smartstore(LVALUE *lval) { if ( lval->indirect != CINT || lval->symbol == 0 || lval->symbol->storage != STKLOC ) store(lval) ; else { switch ( lval->symbol->offset.i - Zsp ) { case 0 : puttos(); break ; case 2 : put2tos(); break ; default: store(lval) ; } } } void rvaluest(LVALUE *lval) { if ( lval->symbol && strncmp(lval->symbol->name,"0dptr",5) == 0 ) lval->symbol=lval->symbol->offset.p; if( lval->symbol && lval->indirect == 0 ) getmem(lval->symbol); else { indirect(lval); } } void rvalue(LVALUE *lval) { if( lval->symbol && lval->indirect == 0 ) getmem(lval->symbol); else { indirect(lval); } if ( lval->c_vtype ) { docast(lval,YES); } #if DEBUG_SIGN if (lval->flags&UNSIGNED) ol("; unsigned"); else ol("; signed"); #endif } void test(int label,int parens) { char *before, *start ; LVALUE lval ; void (*oper)() ; ClearCast(&lval); if (parens) needchar('('); while(1) { setstage( &before, &start ) ; if ( heir1(&lval) ) { rvalue(&lval) ; } if ( cmatch(',') ) clearstage( before, start) ; else break ; } if (parens) needchar(')'); if ( lval.is_const ) { /* constant expression */ clearstage(before,0) ; if ( lval.const_val ) { /* true constant, perform body */ return ; } /* false constant, jump round body */ jump(label) ; return ; } if ( lval.stage_add ) { /* stage address of "..oper 0" code */ oper = lval.binop ; /* operator function pointer */ lval.binop=0; /* Reset binop to 0 so not picked up by comparison ops */ if ( oper == zeq || ( oper == zle && utype(&lval) ) ) zerojump(eq0, label, &lval) ; else if ( oper == zne || (oper == zgt && utype(&lval)) ) zerojump(testjump, label, &lval) ; else if ( oper == zge && utype(&lval) ) clearstage(lval.stage_add, 0) ; else if ( oper == zlt && utype(&lval) ) { zerojump(jump0, label, &lval) ; warning(W_UNREACH); } else if ( oper == zgt ) zerojump(gt0, label, &lval) ; else if ( oper == zge ) zerojump(ge0, label, &lval) ; else if ( oper == zlt ) zerojump(lt0, label, &lval) ; else if ( oper == zle ) zerojump(le0, label, &lval) ; else testjump(&lval,label) ; } else { if ( lval.binop==dummy || DoTestJump(&lval)) { if (lval.binop == dummy) lval.val_type=CINT; /* logical always int */ testjump(&lval,label); } else { jumpnc(label); } } clearstage(before,start); } /* * evaluate constant expression * return TRUE if it is a constant expression */ int constexpr(long *val,int flag) { char *before, *start ; int con, valtemp ; setstage(&before, &start) ; expression(&con, &valtemp) ; *val=(long) valtemp; clearstage(before, 0) ; /* scratch generated code */ if (flag && con == 0) error(E_CONSTANT) ; return con ; } /* * scale constant value according to type */ void cscale( int type, TAG_SYMBOL *tag, int *val) { switch ( type ) { case CINT: *val *= 2 ; break ; case CPTR: *val *= 3 ; break; case LONG: *val *= 4 ; break; case DOUBLE: *val *= 6 ; break ; case STRUCT : *val *= tag->size ; break ; } } /* * add constant to primary register * * changed quite a bit...using bc to get offset to add to, was * going to take account of far and then push/pop, but maybe this * will work just as well? */ void addconst(int val,int opr, char zfar) { LVALUE lval; /* if (!opr) lval->val_type=ltype; */ if ( (ltype == LONG && (!opr) ) || (ltype==CPTR && (!opr)) ) { lval.val_type=LONG; lpush(); vlongconst(val); zadd(&lval); } else { lval.val_type = CINT; switch(val) { case -3 : dec(&lval) ; case -2 : dec(&lval) ; case -1 : dec(&lval) ; case 0 : break ; case 3 : inc(&lval) ; case 2 : inc(&lval) ; case 1 : inc(&lval) ; break ; default : addbchl(val); } } } /* * Routine to do casting * djm 24/3/99 */ int docast(LVALUE *lval,char df) { SYMBOL *ptr; char temp_type; int itag; char nam[20]; debug(DBG_CAST1,"Level=%d Castlevel=%d df=%d %p",lval->level,lval->castlevel,df,lval); if (lval->level != lval->castlevel ) return 0; if ( lval->c_id == VARIABLE ) { /* * Straight forward variable conversion now.. */ if (df) force(lval->c_vtype,lval->val_type,lval->c_flags&UNSIGNED,lval->flags&UNSIGNED,0); lval->val_type=lval->c_vtype; lval->ptr_type=0; lval->ident=VARIABLE; lval->flags= ( (lval->flags&FARACC) | (lval->c_flags&UNSIGNED) ); lval->c_id=0; lval->c_vtype=0; lval->c_flags=0; lval->is_const = 0; return(0); } if ( lval->c_id == POINTER || lval->c_id==PTR_TO_FN ) { switch(lval->c_vtype) { case STRUCT: /* * Casting a structure - has to be a pointer... */ lval->tagsym=lval->c_tag; /* Copy tag symbol over */ lval->ptr_type=STRUCT; temp_type=( ( lval->c_flags&FARPTR ) ? CPTR : CINT ); if (df) force(temp_type,lval->val_type,0,0,0); lval->val_type=temp_type; lval->flags=( (lval->flags&FARACC) | lval->c_flags ); if (df) {lval->c_id=0; lval->c_vtype=0; lval->c_flags=0;} return(1); /* All other simple pointers.. */ default: debug(DBG_CAST2,"Converting %d to %d",lval->ptr_type,lval->c_vtype); lval->ptr_type=lval->c_vtype; lval->symbol=dummy_sym[(int)lval->c_vtype]; temp_type=( ( lval->c_flags&FARPTR ) ? CPTR : CINT ); if (df) force(temp_type,lval->val_type,0,0,0); lval->val_type=temp_type; lval->flags=( (lval->flags&FARACC) | lval->c_flags ); lval->ident=POINTER; if (df) {lval->c_id=0; lval->c_vtype=0; lval->c_flags=0; } return(1); } } /* Now we deal with pointers to pointers and pointers to functions * returning pointers - to do this, we will define dummy symbols in * the local symbol table so that they do what we want them to do! */ sprintf(nam,"0dptr%d",(int)locptr); temp_type = ( (lval->c_flags&FARPTR) ? CPTR : CINT ); itag=0; if ( lval->c_tag) itag=lval->c_tag-tagtab; ptr=lval->symbol; lval->symbol = addloc(nam,POINTER,temp_type,dummy_idx(lval->c_vtype,lval->c_tag),itag); lval->symbol->offset.p=ptr; if (df) force(temp_type,lval->val_type,0,0,0); lval->val_type=temp_type; lval->flags=( (lval->flags&FARACC) | lval->c_flags ); if (df) { lval->c_id=0; lval->c_vtype=0; lval->c_flags=0; } return(1); } /* * Check whether a type is unsigned.. */ int utype(LVALUE *lval) { if (lval->flags&UNSIGNED || lval->ptr_type) return (1); return(0); } /* * Check to see whether an operation should be testjumped or not * i.e. can we trust the carry flag to be an accurate indicator * of the actual function * * Returns 1 if we should testjump i.e. ld a,h or l jp z, or 0 for carry conds */ int DoTestJump(LVALUE *lval) { void (*fn)(); fn=lval->binop; if ( fn==zeq || fn==zne || fn==zge || fn==zle || fn==zgt || fn==zlt || fn==zle || fn==lneg || fn==dummy ) return (0); return(1); } /* * Check whether previous operation was comparison (used for testjump!) * At the same time set the result to be of type CINT */ int WasComp(LVALUE *lval) { void (*fn)(); fn=lval->binop; if ( fn==zeq || fn==zne || fn==zge || fn==zle || fn==zgt || fn==zlt || fn==zle ) { lval->val_type=CINT; return (0); } return(1); } /* Generate Code to Turn integer type of signed to double, Generic now does longs */ void DoDoubConv(char type, char zunsign) { if (type == CINT || type==CCHAR) { if (zunsign) convUint2long(); else convSint2long(); } if (zunsign) convUlong2doub(); else convSlong2doub(); } z88dk-1.8.ds1/src/sccz80/primary.h0000644000175000017500000000255707236523346016264 0ustar tygrystygrys/* primary.c */ extern int primary(LVALUE *lval); extern void dcerror(LVALUE *lval); extern int calc(int left, void (*oper)(void), int right); extern int calcun(unsigned int left, void (*oper)(void),unsigned int right); extern int CalcStand(int left, void (*oper)(void), int right); extern void intcheck(LVALUE *lval, LVALUE *lval2); extern void force(int t1, int t2, char sign1, char sign2, int lconst); extern int widen(LVALUE *lval, LVALUE *lval2); extern void widenlong(LVALUE *lval, LVALUE *lval2); extern int dbltest(LVALUE *lval, LVALUE *lval2); extern void result(LVALUE *lval, LVALUE *lval2); extern void prestep(LVALUE *lval, int n, void (*step)()); extern void poststep(int k, LVALUE *lval, int n, void (*step)(), void (*unstep)()); extern void nstep(LVALUE *lval, int n, void (*unstep)()); extern void store(LVALUE *lval); extern void smartpush(LVALUE *lval, char *before); extern void smartstore(LVALUE *lval); extern void rvaluest(LVALUE *lval); extern void rvalload(LVALUE *lval); extern void rvalue(LVALUE *lval); extern void test(int label, int parens); extern int constexpr(long *val,int flag); extern void cscale(int type, struct tag_symbol *tag, int *val); extern void addconst(int val, int opr, char zfar); extern int docast(LVALUE *lval,char df); extern void DoDoubConv(char type, char zunsign); extern int utype(LVALUE *lval); extern int DoTestJump(LVALUE *lval); z88dk-1.8.ds1/src/sccz80/sccz80.vcproj0000755000175000017500000001442410762606650016764 0ustar tygrystygrys z88dk-1.8.ds1/src/sccz80/stmt.c0000644000175000017500000005027710647730235015562 0ustar tygrystygrys/* * Small C+ Compiler * Split into parts djm 3/3/99 * * This part deals with statements * * $Id: stmt.c,v 1.15 2007/07/19 18:42:37 dom Exp $ */ #include "ccdefs.h" /* * Some variables for goto and cleaning up after compound * statements */ extern void dogoto(void); extern int dolabel(void); int stkstor[MAX_LEVELS]; /* ZSp for each compound level */ int lastline=0; /* * Statement parser * * called whenever syntax requires a statement. * this routine performs that statement * and returns a number telling which one */ int statement() { TAG_SYMBOL *otag ; int st ; struct varid var; char locstatic; /* have we had the static keyword */ blanks() ; if (lineno != lastline ) { lastline=lineno; EmitLine(lineno); } if ( ch()==0 && eof ) return (lastst=STEXP) ; else { char regit=NO; /* Ignore the register and auto keywords! */ regit=locstatic= ( (swallow("register")) | swallow("auto") ); /* Check to see if specified as static, and also for far and near */ if (amatch("static") ) { if (locstatic) { warning(W_BADSTC); locstatic=NO; } else locstatic=YES; } else locstatic=NO; /* * Now get the identity, STATIK is for struct definitions */ otag=GetVarID(&var,STATIK); if (var.type==STRUCT) { declloc(STRUCT, otag,var.sign,locstatic,var.zfar) ; return(lastst); } else if (var.type || regit) { if (regit && var.type == NO ) var.type=CINT; declloc(var.type, NULL_TAG,var.sign,locstatic,var.zfar); return (lastst) ; } /* not a definition */ if ( declared >= 0 ) { if (lstdecl) postlabel(lstlab); lstdecl=0; Zsp = modstk(Zsp-declared, NO,NO) ; declared = -1 ; } st = -1 ; switch ( ch() ) { case '{' : inbyte() ; compound() ; st = lastst ; break ; case 'i' : if ( amatch("iferror") ) { doiferror(); st=STIF; } else if ( amatch("if") ) { doif() ; st = STIF ; } break ; case 'w' : if ( amatch("while") ) { dowhile() ; st = STWHILE; } break ; case 'd' : if ( amatch("do") ) { dodo() ; st = STDO ; } else if ( amatch("default") ) { dodefault() ; st = STDEF ; } break ; case 'f' : if ( amatch("for") ) { dofor() ; st = STFOR ; } break ; case 's' : if ( amatch("switch") ) { doswitch() ; st = STSWITCH ; } break ; case 'c' : if ( amatch("case") ) { docase() ; st = STCASE; } else if ( amatch("continue") ) { docont() ; ns() ; st = STCONT ; } break ; case 'r' : if ( amatch("return") ) { doreturn(0) ; ns() ; st = STRETURN ; } else if ( amatch("return_c") ) { doreturn(1); ns(); st= STRETURN; } else if ( amatch("return_nc") ) { doreturn(2); ns(); st=STRETURN; } break ; case 'b' : if ( amatch("break") ) { dobreak() ; ns() ; st = STBREAK ; } break ; case ';' : inbyte() ; st = lastst ; break ; case 'a' : if ( amatch("asm") ) { doasmfunc(YES); ns(); st=STASM; } break; case 'g' : if ( amatch("goto") ) { dogoto(); ns(); st=STGOTO; } break; case '#' : if ( match("#asm") ) { doasm() ; st = STASM; } break ; } if ( st == -1 ) { /* if nothing else, assume it's an expression */ if (dolabel() == 0 ) { doexpr() ; ns() ; } st = STEXP ; } } return (lastst = st) ; } /* * Semicolon enforcer * * called whenever syntax requires a semicolon */ void ns() { if ( cmatch(';') == 0 ) warning(W_EXPSEMI); } /* * Compound statement * * allow any number of statements to fall between "{}" */ void compound() { SYMBOL *savloc ; if (ncmp == MAX_LEVELS ) error(E_MAXLEVELS,ncmp); stkstor[ncmp]=Zsp; savloc = locptr ; declared = 0 ; /* may declare local variables */ ++ncmp; /* new level open */ while (cmatch('}')==0) statement(); /* do one */ --ncmp; /* close current level */ if ( lastst != STRETURN ) { modstk(stkstor[ncmp],NO,NO) ; /* delete local variable space */ } Zsp = stkstor[ncmp]; locptr = savloc ; /* delete local symbols */ declared = -1 ; } /* * "iferror" statement * This is z88dk specific and is used to check for * an error from a package call..highly non standard! * * I sense getting into trouble with purists but trying * to combine C and asm compactly and efficiently requires * this sort of extension (much like return_c/_nc */ void doiferror() { int flab1,flab2; flab1=getlabel(); /* Get label for false branch */ jumpnc(flab1); statement(); if ( amatch("else") == 0 ) { /* no else, print false label and exit */ postlabel(flab1); return; } /* an "if...else" statement. */ flab2 = getlabel() ; if ( lastst != STRETURN ) { /* if last statement of 'if' was 'return' we needn't skip 'else' code */ jump(flab2); } postlabel(flab1); /* print false label */ statement(); /* and do 'else' clause */ postlabel(flab2); } /* * "if" statement */ void doif() { int flab1,flab2; flab1=getlabel(); /* get label for false branch */ test(flab1,YES); /* get expression, and branch false */ statement(); /* if true, do a statement */ if ( amatch("else") == 0 ) { /* no else, print false label and exit */ postlabel(flab1); return; } /* an "if...else" statement. */ flab2 = getlabel() ; if ( lastst != STRETURN ) { /* if last statement of 'if' was 'return' we needn't skip 'else' code */ jump(flab2); } postlabel(flab1); /* print false label */ statement(); /* and do 'else' clause */ postlabel(flab2); /* print true label */ } /* * perform expression (including commas) */ int doexpr() { char *before, *start ; int type, vconst, val ; while (1) { setstage(&before, &start) ; type = expression(&vconst, &val) ; clearstage( before, start ) ; if ( ch() != ',' ) return type ; inbyte() ; } } /* * "while" statement */ void dowhile() { WHILE_TAB wq ; /* allocate local queue */ addwhile(&wq) ; /* add entry to queue */ /* (for "break" statement) */ postlabel(wq.loop) ; /* loop label */ test(wq.exit, YES) ; /* see if true */ statement() ; /* if so, do a statement */ jump(wq.loop) ; /* loop to label */ postlabel(wq.exit) ; /* exit label */ delwhile() ; /* delete queue entry */ } /* * "do - while" statement */ void dodo() { WHILE_TAB wq ; int top ; addwhile(&wq) ; postlabel(top=getlabel()) ; statement() ; needtoken("while") ; postlabel(wq.loop) ; test(wq.exit, YES) ; jump(top); postlabel(wq.exit) ; delwhile() ; ns() ; } /* * "for" statement (zrin) */ void dofor() { WHILE_TAB wq ; int l_condition; t_buffer *buf2, *buf3; addwhile(&wq); l_condition = getlabel(); needchar('('); if (cmatch(';') == 0 ) { doexpr(); /* initialization */ ns(); } buf2 = startbuffer(1); /* save condition to buf2 */ if ( cmatch(';') == 0 ) { test(wq.exit, NO); /* expr 2 */ ns(); } suspendbuffer(); buf3 = startbuffer(1); /* save modification to buf3 */ if ( cmatch(')') == 0 ) { doexpr(); /* expr 3 */ needchar(')'); } suspendbuffer(); jump(l_condition); /* goto condition */ postlabel(wq.loop); /* .loop */ clearbuffer(buf3); /* modification */ postlabel(l_condition); /* .condition */ clearbuffer(buf2); /* if (!condition) goto exit */ statement(); /* statement */ jump(wq.loop); /* goto loop */ postlabel(wq.exit); /* .exit */ delwhile(); } /* * "switch" statement */ void doswitch() { WHILE_TAB wq ; int endlab, swact, swdef ; SW_TAB *swnex, *swptr ; char swtype; /* type of switch statement - CINT/LONG */ t_buffer *buf; swact = swactive ; swdef = swdefault ; swnex = swptr = swnext ; addwhile(&wq) ; (wqptr-1)->loop = 0 ; needchar('(') ; swtype=doexpr() ; /* evaluate switch expression */ needchar(')') ; swdefault = 0 ; swactive = 1 ; endlab=getlabel(); /* jump(endlab) ; */ buf = startbuffer(100); statement() ; /* cases, etc. */ /* jump(wq.exit) ; */ suspendbuffer(); postlabel(endlab) ; if (swtype==CCHAR) { LoadAccum(); while (swptr < swnext) { CpCharVal(swptr->value); opjump("z,",swptr->label); ++swptr; } } else { sw(swtype) ; /* insert code to match cases */ while ( swptr < swnext ) { defword() ; printlabel(swptr->label) ; /* case label */ if (swtype==LONG) { outbyte('\n'); deflong(); }else outbyte(',') ; outdec(swptr->value) ; /* case value */ nl() ; ++swptr ; } defword() ; outdec(0) ; nl() ; } if (swdefault) jump(swdefault) ; else jump(wq.exit); clearbuffer(buf); postlabel(wq.exit) ; delwhile() ; swnext = swnex ; swdefault = swdef ; swactive = swact ; } /* * "case" statement */ void docase() { if (swactive == 0) error(E_SWITCH) ; if (swnext > swend ) { error(E_CASE) ; return ; } postlabel(swnext->label = getlabel()) ; constexpr(&swnext->value,1) ; needchar(':') ; ++swnext ; } void dodefault() { if (swactive) { if (swdefault) error(E_DEFAULT) ; } else error(E_SWITCH) ; needchar(':') ; postlabel(swdefault=getlabel()) ; } /* * "return" statement */ void doreturn(char type) { /* if not end of statement, get an expression */ if ( endst() == 0 ) { if ( currfn->more ) { /* return pointer to value */ force(CINT, doexpr(),YES,dosigned,0) ; leave(CINT,type); } else { /* return actual value */ force(currfn->type, doexpr(), currfn->flags&UNSIGNED, dosigned,0) ; leave(currfn->type,type); } } else leave(NO,type) ; } /* * leave a function * If vartype is a value then save it * type: 1=c, 2=nc, 0=don't bother */ void leave(int vartype,char type) { int savesp; if ( vartype == CPTR ) /* they are the same in any case! */ vartype = LONG; else if ( vartype == DOUBLE ) vartype = NO; if ( noaltreg ) { if ( vartype == LONG ) savehl(); if ( vartype ) swap(); modstk(0,0,NO); if ( vartype ) swap(); } else { modstk(0,vartype,NO); } if ( (compactcode || currfn->flags&CALLEE) && (stackargs>2) ) { /* * We're exiting a function and we want to clean up after ourselves * (so calling function doesn't have to do this) (first of all we * have to grab the return address - easy just to exchange */ savesp=Zsp; if ( noaltreg ) { if ( vartype == LONG ) /* If long, then dump de somewhere */ savede(); if ( vartype ) swap(); } else { doexx(); } zpop(); /* Return address in de */ Zsp-=stackargs-2; modstk(0,NO,NO); zpushde(); /* return address back on stack */ if ( noaltreg ) { if ( vartype == LONG ) restorede(); if ( vartype ) swap(); } else { doexx(); } Zsp=savesp; } #ifdef USEFRAME popframe(); /* Restore previous frame pointer */ #endif if ( noaltreg && vartype == LONG ) restorehl(); if (type) setcond(type); zret(); /* and exit function */ } /* * "break" statement */ void dobreak() { WHILE_TAB *ptr ; /* see if any "whiles" are open */ if ((ptr=readwhile(wqptr))==0) return; /* no */ modstk(ptr->sp, NO,NO); /* else clean up stk ptr */ jump(ptr->exit) ; /* jump to exit label */ } /* * "continue" statement */ void docont() { WHILE_TAB *ptr; /* see if any "whiles" are open */ ptr = wqptr ; while (1) { if ((ptr=readwhile(ptr))==0) return ; /* try again if loop is zero (that's a switch statement) */ if ( ptr->loop ) break ; } modstk(ptr->sp, NO,NO) ; /* else clean up stk ptr */ jump(ptr->loop) ; /* jump to loop label */ } /* * asm() statement * * This doesn't do any label expansions - just chucks it out to * the file, it might be useful for setting a value to machine * code thing * * If wantbr==YES then we need the opening bracket (called by * itself) * * Actually, this caution may be unneccesary because it is also * dealt with as a function, we'll just have to see - i.e. maybe * it doesn't have to be statement as well! * * New: 3/3/99 djm */ void doasmfunc(char wantbr) { char c; if (wantbr) needchar('('); outbyte('\t'); needchar('"'); do { while (!acmatch('"')) { c=litchar(); if (c == 0) break; outbyte(c); if ( c == 10 || c == 13 ) outstr("\n\t"); } } while (acmatch ('"')); needchar (')'); outbyte('\n'); } /* * "asm" pseudo-statement (for #asm/#endasm) * enters mode where assembly language statement are * passed intact through parser */ void doasm() { char label[NAMEMAX]; int k; char lab=0; /* Got an good asm label */ SYMBOL *myptr; endasm=cmode=0; /* mark mode as "asm" */ #ifdef INBUILT_OPTIMIZER generate(); /* Dump queued stuff to be opt'd */ #endif while (1) { preprocess(); /* get and print lines */ if ( endasm || match("#endasm") || eof ) { break ; } /* * This is only relevent for z80asm since asxxx doesn't differentiate * between different types of .globl and assemble time * * If the first column contains a "." then it's a lebel and we * should check for the magic prefix ("smc_" or "_") and compare * to symbol table. If match then the symbol will be XDEF'd instead * of XREF'd */ if (line[0] == '.') { k=1; while ((line[k] != ' ') && (line[k] != '\n') && (line[k] != '\0') && (line[k] != '\t') ) { label[k-1]=line[k]; k++; } label[k-1]='\0'; /* * Snagged a label, we check form smc_ or _ prefix if so remove * it and check for symbol then switch to local defn * * Lab is where the actual label name starts from */ lab=0; if (label[0]=='_') { memmove(label,label+1,strlen(label+1)+1); lab=2; } else if ( strncmp(label,"smc_",4)==0 ) { strcpy(label,label+4); lab=5; } if (lab) { /* ATP Got assembler label, now check to see if defined as extern.. */ if ( (myptr=findglb(label)) ) { /* Have matched it to an extern, so now change type... */ if (myptr->storage == EXTERNAL) myptr->storage = DECLEXTN; } line[1]='_'; memmove(line+2,&line[(int)lab],strlen(&line[(int)lab])+1); } } #if 0 if ( output != NULL_FD ) { if ( fputs(line, output) == -1 ) { fabort() ; } fputc('\n',output); } else puts(line); #else ol(line); #endif } /* Print the line out, with the appropriate prefix */ clear() ; /* invalidate line */ if (eof) warning(W_UNTERM); cmode=1 ; /* then back to parse level */ } /* #pragma statement */ void dopragma() { if ( amatch("proto") ) addmac() ; else if ( amatch("set") ) addmac(); else if ( amatch("unproto") ) delmac() ; else if ( amatch("unset") ) delmac(); else if ( amatch("asm") ) doasm(); else if ( amatch("endasm") ) endasm=1; else if ( amatch("output") ) { char *ptr; int value = 0; if ( (ptr = strchr(line+lptr+1,'=') ) != NULL ) { value = atoi(ptr+1); *ptr = 0; } WriteDefined(line+lptr+1,value); } else if ( amatch("string") ) PragmaOutput(line+lptr+1); else if ( amatch("data") ) PragmaBytes(1); else if ( amatch("byte") ) PragmaBytes(0); else if ( rcmatch('-') ) ParseArgs(line+lptr+1); else { warning(W_PRAGMA); junk(); vinline(); } } z88dk-1.8.ds1/src/sccz80/stmt.h0000644000175000017500000000103107130401714015535 0ustar tygrystygrys/* stmt.c */ extern int statement(void); extern void ns(void); extern void compound(void); extern void doiferror(void); extern void doif(void); extern int doexpr(void); extern void dowhile(void); extern void dodo(void); extern void dofor(void); extern void doswitch(void); extern void docase(void); extern void dodefault(void); extern void doreturn(char); extern void leave(int save,char type); extern void dobreak(void); extern void docont(void); extern void doasm(void); extern void dopragma(void); extern void doasmfunc(char wantbr); z88dk-1.8.ds1/src/sccz80/sym.c0000644000175000017500000001077510031124521015360 0ustar tygrystygrys/* * Small C+ Compiler * * Routines for symbol hashing etc * * $Id: sym.c,v 1.3 2004/03/26 22:06:09 denniz Exp $ */ #include "ccdefs.h" int hash(char *sname) { int c, h ; h = *sname; while( (c = *(++sname)) ) h=(h<<1)+c; return (h & MASKGLBS) ; } /* djm * Find a local static variable - uses findglb after first kludging the * name to a hopefully unique identifier! */ SYMBOL *findstc(char *sname) { char sname2[3*NAMESIZE]; /* Should be enuff! */ strcpy(sname2,"st_"); if (currfn) strcat(sname2,currfn->name); strcat(sname2,"_"); strcat(sname2,sname); return (findglb(sname2)); } /* * find entry in global symbol table, * glbptr is set to relevant entry * return pointer if match is found, * else return zero and glbptr points to empty slot */ SYMBOL *findenum(char *sname) { SYMBOL *ptr; if ( (ptr=findglb(sname)) ) { if (ptr->ident==ENUM) return(ptr); else error(E_ENUMDEF); } return(0); } SYMBOL *findglb(char *sname) { glbptr = STARTGLB + hash(sname) ; while ( strcmp(sname, glbptr->name) ) { if ( glbptr->name[0] == 0 ) return 0 ; ++glbptr ; if (glbptr == ENDGLB) glbptr = STARTGLB; } return glbptr ; } SYMBOL *findloc(char *sname) { SYMBOL *ptr ; ptr = STARTLOC ; while ( ptr != locptr ) { if ( strcmp(sname, ptr->name) == 0 ) return ptr; ++ptr ; } return 0; } /* * find symbol in structure tag symbol table, return 0 if not found */ TAG_SYMBOL *findtag(char *sname) { TAG_SYMBOL *ptr ; ptr = STARTTAG ; while ( ptr != tagptr ) { if ( strcmp(ptr->name, sname) == 0 ) return ptr ; ++ptr ; } return 0 ; } /* * determine if 'sname' is a member of the struct with tag 'tag' * return pointer to member symbol if it is, else 0 */ SYMBOL *findmemb(TAG_SYMBOL *tag, char *sname) { SYMBOL *ptr ; ptr = tag->ptr ; while ( ptr < tag->end ) { if ( strcmp(ptr->name, sname) == 0 ) return ptr ; ++ptr ; } return 0 ; } SYMBOL *addglb( char *sname,char id,char typ, int value,int storage,int more, int itag) { SYMBOL *ptr; if ( (ptr=findglb(sname)) ) { /* * djm, this is not to be abused!!!! * * This bit of code allows us to overturn extern declaration of stuff, * Useful for those programs which extern everything in header files * */ if ( (ptr->storage==EXTERNAL && storage !=EXTERNAL) && ptr->type==typ && ptr->ident == id && ptr->more==more && itag==ptr->tag_idx ) { ptr->storage=storage; return (ptr); } if ( (ptr->storage==EXTERNAL && storage ==EXTERNAL) && ptr->type==typ && ptr->ident == id && ptr->more==more && itag==ptr->tag_idx ) { return (ptr); } multidef() ; return (glbptr) ; } if ( glbcnt >= NUMGLBS-1 ) { error(E_GLBOV); return 0; } addsym(glbptr, sname, id, typ, storage, more, itag) ; glbptr->offset.i = value ; ++glbcnt ; return (glbptr); } SYMBOL *addloc( char *sname, char id, char typ , int more, int itag) { SYMBOL *cptr ; if ( (cptr=findloc(sname)) ) { multidef() ; return cptr; } if ( locptr >= ENDLOC ) { error(E_LOCOV); return 0; } cptr = locptr++ ; addsym(cptr, sname, id, typ, STKLOC, more, itag) ; return cptr ; } /* * add new structure member to table */ SYMBOL *addmemb( char *sname, char id, char typ , int value, int storage, int more, int itag) { if ( membptr >= ENDMEMB ) { error(E_MEMOV) ; return 0; } addsym(membptr, sname, id, typ, storage, more, itag) ; membptr->offset.i = value ; ++membptr ; return(membptr); } /* * insert values into symbol table */ void addsym( SYMBOL *ptr , char *sname, char id, char typ , int storage, int more, int itag ) { strcpy(ptr->name, sname) ; ptr->ident = id ; ptr->type = typ ; ptr->storage = storage ; ptr->more = more ; ptr->tag_idx = itag ; ptr->flags = 0; } z88dk-1.8.ds1/src/sccz80/sym.h0000644000175000017500000000122307130401714015361 0ustar tygrystygrys/* sym.c */ extern int hash(char *sname); extern SYMBOL *findstc(char *sname); extern SYMBOL *findglb(char *sname); extern SYMBOL *findenum(char *sname); extern SYMBOL *findloc(char *sname); extern TAG_SYMBOL *findtag(char *sname); extern SYMBOL *findmemb(TAG_SYMBOL *tag, char *sname); extern SYMBOL *addglb(char *sname, char id, char typ, int value, int storage, int more, int itag); extern SYMBOL *addloc(char *sname, char id, char typ, int more, int itag); extern SYMBOL *addmemb(char *sname, char id, char typ, int value, int storage, int more, int itag); extern void addsym(SYMBOL *ptr, char *sname, char id, char typ, int storage, int more, int itag); z88dk-1.8.ds1/src/sccz80/vscmake.bat0000644000175000017500000000034410537314617016536 0ustar tygrystygrys@echo off rem $Id: vscmake.bat,v 1.3 2006/12/11 17:46:55 stefano Exp $ echo ******************* echo * Building sccz80 * echo ******************* cl /Fesccz80 -D _CRT_SECURE_NO_DEPRECATE *.c move sccz80.exe ..\..\bin del *.obj z88dk-1.8.ds1/src/sccz80/while.c0000644000175000017500000000144610031124521015653 0ustar tygrystygrys/* * Small C+ Compiler * * Couple of routines for while statements * * $Id: while.c,v 1.2 2004/03/26 22:06:09 denniz Exp $ */ #include "ccdefs.h" void addwhile(WHILE_TAB *ptr) { wqptr->sp = ptr->sp = Zsp ; /* record stk ptr */ wqptr->loop = ptr->loop = getlabel() ; /* and looping label */ wqptr->exit = ptr->exit = getlabel() ; /* and exit label */ if ( wqptr >= WQMAX ) { error(E_WHILE); return; } ++wqptr ; } void delwhile() { if ( wqptr > wqueue ) --wqptr ; } #ifndef SMALL_C WHILE_TAB * #endif readwhile(WHILE_TAB *ptr) { if ( ptr <= wqueue ) { error(E_CONTEXT); return 0; } else return (ptr-1) ; } z88dk-1.8.ds1/src/sccz80/while.h0000644000175000017500000000017507130401714015666 0ustar tygrystygrys/* while.c */ extern void addwhile(WHILE_TAB *ptr); extern void delwhile(void); extern WHILE_TAB *readwhile(WHILE_TAB *ptr); z88dk-1.8.ds1/src/vscmake.bat0000644000175000017500000000127210551007415015414 0ustar tygrystygrys@echo off rem $Id: vscmake.bat,v 1.3 2007/01/09 21:54:21 stefano Exp $ cl if %ERRORLEVEL% == 0 goto :build goto :nocompiler :build cls echo ************************** echo * Building with Visual C * echo ************************** echo * echo * echo #define WIN32 1 > config.h md ..\bin cd appmake call vscmake cd .. cd copt call vscmake cd .. cd cpp call vscmake cd .. cd sccz80 call vscmake cd .. cd z80asm call vscmake cd .. cd zcc call vscmake cd .. goto :end :nocompiler cls echo * echo * 'cl' not found echo * echo * Visual Studio is missing or environment isn't set correctly echo * please use the "Visual Studio command prompt" shortcut echo * or execute vcvars32.bat echo * :end z88dk-1.8.ds1/src/z80asm/0000755000175000017500000000000010765202715014422 5ustar tygrystygrysz88dk-1.8.ds1/src/z80asm/asmdrctv.c0000644000175000017500000005220507742022220016405 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/asmdrctv.c,v 1.6 2003/10/11 15:41:04 dom Exp $ */ /* $History: Asmdrctv.c $ */ /* */ /* ***************** Version 13 ***************** */ /* User: Gbs Date: 6-06-99 Time: 20:04 */ /* Updated in $/Z80asm */ /* MAXCODESIZE checking implemented for DEFB, DEFW, DEFL & DEFM. */ /* */ /* ***************** Version 11 ***************** */ /* User: Gbs Date: 6-06-99 Time: 12:12 */ /* Updated in $/Z80asm */ /* Added Ascii Art "Z80asm" at top of source file. */ /* */ /* ***************** Version 9 ***************** */ /* User: Gbs Date: 6-06-99 Time: 11:27 */ /* Updated in $/Z80asm */ /* "config.h" included before "symbol.h" */ /* */ /* ***************** Version 8 ***************** */ /* User: Gbs Date: 30-05-99 Time: 0:57 */ /* Updated in $/Z80asm */ /* Redundant system include files removed. */ /* Binary() rewritten to replace low I/O open() with fopen(), fread(). */ /* Fetchfilename() now doesn't changed parsed filename due to UNIX OS. */ /* */ /* ***************** Version 7 ***************** */ /* User: Gbs Date: 2-05-99 Time: 18:01 */ /* Updated in $/Z80asm */ /* IncludeFile() now validates for recursive including of identical files. */ /* */ /* ***************** Version 5 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 3 ***************** */ /* User: Gbs Date: 4-09-98 Time: 0:08 */ /* Updated in $/Z80asm */ /* DEFVARS functionality extended with -1 argument. */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 15:21 */ /* Updated in $/Z80asm */ /* Version History Comment block syntax layout corrected. */ /* */ /* ***************** Version 1 ***************** */ /* User: Gbs Date: 20-06-98 Time: 14:52 */ /* Created in $/Z80asm */ /* Improvements on defm() and Fetchfilename(): */ /* fgetc() logic now handled better according to EOF events. */ #include #include #include #include #include "config.h" #include "symbol.h" /* external functions */ enum symbols GetSym (void); int DefineSymbol (char *identifier, long value, unsigned char symboltype); int ExprSigned8 (int listoffset); int ExprUnsigned8 (int listoffset); int ExprAddress (int listoffset); int ExprLong (int listoffset); int DefineDefSym (char *identifier, long value, unsigned char symtype, avltree ** root); int DEFSP (void); int GetChar (FILE *fptr); char *AllocIdentifier (size_t len); long EvalPfixExpr (struct expr *pfixexpr); long GetConstant (char *evalerr); void Pass2info (struct expr *expression, char constrange, long lfileptr); void ReportError (char *filename, short linenr, int errnum); void ReportIOError(char *filename); void RemovePfixlist (struct expr *pfixexpr); void Z80pass1 (void); void Skipline (FILE *fptr); struct expr *ParseNumExpr (void); struct sourcefile *Newfile (struct sourcefile *curfile, char *fname); struct sourcefile *Prevfile (void); struct sourcefile *FindFile (struct sourcefile *srcfile, char *fname); int cmpidstr (symbol * kptr, symbol * p); void FreeSym (symbol * node); symbol *FindSymbol (char *identifier, avltree * treeptr); /* local functions */ void DeclModuleName (void); void Fetchfilename (FILE *fptr); void DefSym (void); void UnDefineSym (void); /* global variables */ extern FILE *z80asmfile, *listfile; extern unsigned char *codeptr, *codearea; extern char ident[], stringconst[]; extern unsigned short DEFVPC; extern long PC; extern enum symbols sym; extern enum flag verbose, writeline, EOL; extern struct modules *modulehdr; extern struct module *CURRENTMODULE; extern int ASSEMBLE_ERROR; extern int sourcefile_open; int DEFSP (void) { if (GetSym () == fullstop) if (GetSym () == name) switch (ident[0]) { case 'B': return 1; case 'W': return 2; case 'P': return 3; case 'L': return 4; default: return -1; } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return -1; } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return -1; } } long Parsevarsize (void) { struct expr *postfixexpr; long offset = 0, varsize, size_multiplier; if (strcmp (ident, "DS") != 0) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); else { if ((varsize = DEFSP ()) == -1) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 10); else { GetSym (); if ((postfixexpr = ParseNumExpr ()) != NULL) { if (postfixexpr->rangetype & NOTEVALUABLE) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); RemovePfixlist (postfixexpr); } else { size_multiplier = EvalPfixExpr (postfixexpr); RemovePfixlist (postfixexpr); if (size_multiplier > 0 && size_multiplier <= MAXCODESIZE) offset = varsize * size_multiplier; else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 4); } } } } return offset; } long Parsedefvarsize (long offset) { long varoffset = 0; switch (sym) { case name: if (strcmp (ident, "DS") != 0) { DefineSymbol (ident, offset, 0); GetSym (); } if (sym == name) varoffset = Parsevarsize (); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } return varoffset; } void DEFVARS (void) { struct expr *postfixexpr; long offset; enum flag globaldefv; writeline = OFF; /* DEFVARS definitions are not output'ed to listing file */ GetSym (); if ((postfixexpr = ParseNumExpr ()) != NULL) { /* expr. must not be stored in relocatable file */ if (postfixexpr->rangetype & NOTEVALUABLE) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); RemovePfixlist (postfixexpr); return; } else { offset = EvalPfixExpr (postfixexpr); /* offset expression must not contain undefined symbols */ RemovePfixlist (postfixexpr); } if ((offset != -1) && (offset != 0)) { DEFVPC = offset; globaldefv = ON; } else { if (offset == -1) { globaldefv = ON; offset = DEFVPC; } else { /* offset = 0, use temporarily without smashing DEFVPC */ globaldefv = OFF; } } } else return; /* syntax error - get next line from file... */ while (!feof (z80asmfile) && sym != lcurly) { Skipline (z80asmfile); EOL = OFF; ++CURRENTFILE->line; GetSym (); } if (sym == lcurly) { while (!feof (z80asmfile) && GetSym () != rcurly) { if (EOL == ON) { ++CURRENTFILE->line; EOL = OFF; } else offset += Parsedefvarsize (offset); } if (globaldefv == ON) { DEFVPC = offset; } } } void DEFGROUP (void) { struct expr *postfixexpr; long constant, enumconst = 0; writeline = OFF; /* DEFGROUP definitions are not output'ed to listing file */ while (!feof (z80asmfile) && GetSym () != lcurly) { Skipline (z80asmfile); EOL = OFF; ++CURRENTFILE->line; } if (sym == lcurly) { while (!feof (z80asmfile) && sym != rcurly) { if (EOL == ON) { ++CURRENTFILE->line; EOL = OFF; } else { do { GetSym (); switch (sym) { case rcurly: case semicolon: case newline: break; case name: strcpy (stringconst, ident); /* remember name */ if (GetSym () == assign) { GetSym (); if ((postfixexpr = ParseNumExpr ()) != NULL) { if (postfixexpr->rangetype & NOTEVALUABLE) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); else { constant = EvalPfixExpr (postfixexpr); enumconst = constant; DefineSymbol (stringconst, enumconst++, 0); } RemovePfixlist (postfixexpr); } GetSym (); /* prepare for next identifier */ } else DefineSymbol (stringconst, enumconst++, 0); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } while (sym == comma); /* get enum definitions separated by comma in current line */ Skipline (z80asmfile); /* ignore rest of line */ } } } } void DEFS () { struct expr *postfixexpr; struct expr *constexpr; long constant,val; GetSym (); /* get numerical expression */ if ((postfixexpr = ParseNumExpr ()) != NULL) { /* expr. must not be stored in relocatable file */ if (postfixexpr->rangetype & NOTEVALUABLE) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); else { constant = EvalPfixExpr (postfixexpr); if ( sym != comma ) { val = 0; } else { GetSym(); if ( (constexpr = ParseNumExpr ()) != NULL ) { if ( constexpr->rangetype & NOTEVALUABLE ) ReportError(CURRENTFILE->fname,CURRENTFILE->line,2); else val = EvalPfixExpr(constexpr); RemovePfixlist(constexpr); } } if (constant >= 0) { if ((PC + constant) <= MAXCODESIZE) { PC += constant; while (constant--) *codeptr++ = val; } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 12); return; } } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 7); return; } } RemovePfixlist (postfixexpr); /* remove linked list, expression evaluated */ } } void UnDefineSym(void) { symbol *sym; do { if (GetSym () == name) sym = FindSymbol(ident,CURRENTMODULE->localroot); if ( sym != NULL ) { delete (&CURRENTMODULE->localroot, sym, (int (*)()) cmpidstr, (void (*)()) FreeSym); } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } while (GetSym () == comma); } void DefSym (void) { do { if (GetSym () == name) DefineDefSym (ident, 1, 0, &CURRENTMODULE->localroot); else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } while (GetSym () == comma); } void DEFC (void) { struct expr *postfixexpr; long constant; do { if (GetSym () == name) { strcpy (stringconst, ident); /* remember name */ if (GetSym () == assign) { GetSym (); /* get numerical expression */ if ((postfixexpr = ParseNumExpr ()) != NULL) { /* expr. must not be stored in * relocatable file */ if (postfixexpr->rangetype & NOTEVALUABLE) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); break; } else { constant = EvalPfixExpr (postfixexpr); /* DEFC expression must not * contain undefined symbols */ DefineSymbol (stringconst, constant, 0); } RemovePfixlist (postfixexpr); } else break; /* syntax error - get next line from file... */ } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } while (sym == comma); /* get all DEFC definition separated by comma */ } void ORG (void) { struct expr *postfixexpr; long constant; GetSym (); /* get numerical expression */ if ((postfixexpr = ParseNumExpr ()) != NULL) { if (postfixexpr->rangetype & NOTEVALUABLE) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); else { constant = EvalPfixExpr (postfixexpr); /* ORG expression must not contain undefined symbols */ if (constant >= 0 && constant <= 65535U) CURRENTMODULE->origin = constant; else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 7); } RemovePfixlist (postfixexpr); } } void DEFB (void) { long bytepos = 0; do { if ((PC+1) > MAXCODESIZE) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 12); return; } GetSym (); if (!ExprUnsigned8 (bytepos)) break; /* syntax error - get next line from file... */ ++PC; /* DEFB allocated, update assembler PC */ ++bytepos; if (sym == newline) break; else if (sym != comma) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } while (sym == comma); /* get all DEFB definitions separated by comma */ } void DEFW (void) { long bytepos = 0; do { if ((PC+2) > MAXCODESIZE) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 12); return; } GetSym (); if (!ExprAddress (bytepos)) break; /* syntax error - get next line from file... */ PC += 2; /* DEFW allocated, update assembler PC */ bytepos += 2; if (sym == newline) break; else if (sym != comma) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } while (sym == comma); /* get all DEFB definitions separated by comma */ } void DEFP (void) { long bytepos = 0; do { if ((PC+3) > MAXCODESIZE) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 12); return; } GetSym (); if (!ExprAddress (bytepos)) break; /* syntax error - get next line from file... */ PC += 2; /* DEFW allocated, update assembler PC */ bytepos += 2; /* Pointers must be specified as WORD,BYTE pairs separated by commas */ if (sym != comma) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } GetSym (); if (!ExprUnsigned8 (bytepos)) break; /* syntax error - get next line from file... */ PC += 1; /* DEFB allocated, update assembler PC */ bytepos += 1; if (sym == newline) break; else if (sym != comma) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } while (sym == comma); /* get all DEFB definitions separated by comma */ } void DEFL (void) { long bytepos = 0; do { if ((PC+4) > MAXCODESIZE) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 12); return; } GetSym (); if (!ExprLong (bytepos)) break; /* syntax error - get next line from file... */ PC += 4; /* DEFL allocated, update assembler PC */ bytepos += 4; if (sym == newline) break; else if (sym != comma) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } while (sym == comma); /* get all DEFB definitions separated by comma */ } void DEFM (void) { long constant, bytepos = 0; do { if (GetSym () == dquote) { while (!feof (z80asmfile)) { if ((PC+1) > MAXCODESIZE) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 12); return; } constant = GetChar (z80asmfile); if (constant == EOF) { sym = newline; EOL = ON; ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return; } else { if (constant != '\"') { *codeptr++ = constant; ++bytepos; ++PC; } else { GetSym (); if (sym != strconq && sym != comma && sym != newline && sym != semicolon) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return; } break; /* get out of loop */ } } } } else { if ((PC+1) > MAXCODESIZE) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 12); return; } if (!ExprUnsigned8 (bytepos)) break; /* syntax error - get next line from file... */ if (sym != strconq && sym != comma && sym != newline && sym != semicolon) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); /* expression separator not found */ break; } ++bytepos; ++PC; } } while (sym != newline && sym != semicolon); } void IncludeFile (void) { if (GetSym () == dquote) { /* fetch filename of include file */ Fetchfilename (z80asmfile); if (FindFile(CURRENTFILE,ident) != NULL) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 31); return; } CURRENTFILE->filepointer = ftell (z80asmfile); /* get file position of current source file */ fclose (z80asmfile); /* close current source file */ if ((z80asmfile = fopen (ident, "rb")) == NULL) { /* Open include file */ ReportError (CURRENTFILE->fname, CURRENTFILE->line, 0); z80asmfile = fopen (CURRENTFILE->fname, "rb"); /* re-open current source file */ fseek (z80asmfile, CURRENTFILE->filepointer, SEEK_SET); /* file position to beginning of line * following INCLUDE line */ return; } else { sourcefile_open = 1; CURRENTFILE = Newfile (CURRENTFILE, ident); /* Allocate new file into file information list */ if (ASSEMBLE_ERROR == 3) return; /* No room... */ if (verbose) puts (CURRENTFILE->fname); /* display name of INCLUDE file */ Z80pass1 (); /* parse include file */ CURRENTFILE = Prevfile (); /* Now get back to current file... */ switch (ASSEMBLE_ERROR) { case 0: case 3: case 12: return; /* Fatal errors, return immediatly... */ } sourcefile_open = fclose (z80asmfile); if ((z80asmfile = fopen (CURRENTFILE->fname, "rb")) == NULL) { /* re-open current source file */ ReportIOError(CURRENTFILE->fname); } else { fseek (z80asmfile, CURRENTFILE->filepointer, 0); /* file position to beginning of */ sourcefile_open = 1; } } /* line following INCLUDE line */ } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); sym = newline; writeline = OFF; /* don't write current source line to listing file (empty line of INCLUDE file) */ } void BINARY (void) { FILE *binfile; long Codesize; if (GetSym () == dquote) { Fetchfilename (z80asmfile); if ((binfile = fopen (ident, "rb")) == NULL) { ReportIOError (ident); return; } fseek(binfile, 0L, SEEK_END); /* file pointer to end of file */ Codesize = ftell(binfile); fseek(binfile, 0L, SEEK_SET); /* file pointer to start of file */ if ((codeptr - codearea + Codesize) <= MAXCODESIZE) { fread (codeptr, sizeof (char), Codesize, binfile); /* read binary code */ codeptr += Codesize; /* codeptr updated */ PC += Codesize; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 12); fclose (binfile); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } void Fetchfilename (FILE *fptr) { int l, c = 0; char *stdpath; do { for (l = 0;l<255; l++) { if (!feof (fptr)) { c = GetChar (fptr); if ((c == '\n') || (c == EOF)) break; if (c != '"') { ident[l] = (char) c; } else { break; /* fatal - end of file reached! */ } } else { break; } } ident[l] = '\0'; /* null-terminate file name */ } while (strlen(ident) == 0 && !feof(fptr) ); if (c != '\n') Skipline (fptr); /* prepare for next line */ if (ident[0] == '#') { stdpath = getenv("Z80_OZFILES"); /* djm 3/1/2000 try to use the default path.. */ if ( stdpath == NULL ) stdpath = DEFLIBDIR; if ( stdpath != NULL) { strncpy (stringconst, stdpath, 255); /* copy standard path */ if (255 - strlen (stringconst) - strlen (ident) > 0) { strcat (stringconst, ident + 1); /* concatenate path and filename */ strcpy (ident, stringconst); /* new filename generated */ } } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 30); strcpy (ident, (ident + 1)); /* remove '#' from file name */ } } } void DeclModuleName (void) { if (CURRENTMODULE->mname == NULL) { if (sym == name) { if ((CURRENTMODULE->mname = AllocIdentifier (strlen (ident) + 1)) != NULL) strcpy (CURRENTMODULE->mname, ident); else ReportError (NULL, 0, 3); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 15); } z88dk-1.8.ds1/src/z80asm/avltree.c0000644000175000017500000002333707130401712016226 0ustar tygrystygrys /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/avltree.c,v 1.1.1.1 2000/07/04 15:33:30 dom Exp $ */ /* $History: AVLTREE.C $ */ /* */ /* ***************** Version 4 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 15:10 */ /* Updated in $/Z80asm */ /* SourceSafe Version History Comment Block added. */ #include #include "avltree.h" /* Internal manipulation functions */ void rotateleft (avltree ** p); void rotateright (avltree ** p); void fixheight (avltree * p); void balanceleft (avltree ** p, short adj); void balanceright (avltree ** p, short adj); void deletemin (avltree ** p, void **data); short difference (avltree * p); /* * rotate nodes pointed to by x and x->right */ void rotateleft (avltree ** x) { /* return *x to caller */ avltree *y; if ((*x) != NULL) if ((*x)->right != NULL) { y = (*x)->right; (*x)->right = y->left; /* left subtree of y becomes right subtree */ y->left = (*x); /* x becomes left child of y */ (*x) = y; /* y becomes new root of whole subtree */ } } /* * rotate nodes pointed to by x and x->left */ void rotateright (avltree ** x) { /* return *x to caller */ avltree *y; if ((*x) != NULL) if ((*x)->left != NULL) { y = (*x)->left; (*x)->left = y->right; /* left subtree of y becomes right subtree */ y->right = (*x); /* x becomes left child of y */ (*x) = y; /* y becomes new root of whole subtree */ } } /* * return the difference between the heights of the left and right subtree of node n */ short difference (avltree * n) { short leftheight, rightheight; if (n == NULL) return 0; else { if (n->left == NULL) leftheight = -1; else leftheight = n->left->height; /* get height of left subtree */ if (n->right == NULL) rightheight = -1; else rightheight = n->right->height; /* get height of right subtree */ return (leftheight - rightheight); } } /* * sets the correct height for node pointed to by n, used after insertion into subtree */ void fixheight (avltree * n) { short leftheight, rightheight; if (n->left == NULL) leftheight = -1; else leftheight = n->left->height; if (n->right == NULL) rightheight = -1; else rightheight = n->right->height; if (leftheight > rightheight) n->height = leftheight + 1; else n->height = rightheight + 1; } /* * restores balance at n after insertion, assuming that the right subtree of n is too high */ void balanceright (avltree ** n, short adjust) { short dif; dif = difference ((*n)->right); if (dif == 0) { rotateleft (n); /* both subtrees of right child of n have same height */ ((*n)->height) -= adjust; /* 'decrease' height of current node */ ((*n)->left->height) += adjust; /* 'increase' height of left subtree */ } else { if (dif < 0) { rotateleft (n); /* right subtree of right child of n is higher */ (*n)->left->height -= 2; } else { /* left subtree of right child of n is higher */ rotateright (&(*n)->right); /* pointer to n->right */ rotateleft (n); ++((*n)->height); /* increase height of current node */ (*n)->left->height -= 2; --((*n)->right->height); /* decrease height of right subtree */ } } } void balanceleft (avltree ** n, short adjust) { short dif; dif = difference ((*n)->left); if (dif == 0) { rotateright (n); /* both subtrees of left child of n have same height */ ((*n)->height) -= adjust; /* 'decrease' height of current node */ ((*n)->right->height) += adjust; /* 'increase' height of right subtree */ } else { if (dif > 0) { rotateright (n); /* left subtree of left child of n is higher */ (*n)->right->height -= 2; } else { /* right subtree of left child of n is higher */ rotateleft (&(*n)->left); /* pointer to n->left */ rotateright (n); ++((*n)->height); /* increase height of current node */ (*n)->right->height -= 2; --((*n)->left->height); /* decrease height of left subtree */ } } } void deletemin (avltree ** n, void **dataptr) { avltree *temp; short dif; if ((*n)->left != NULL) /* keep going for leftmost node */ deletemin (&(*n)->left, dataptr); else { /* leftmost node found */ *dataptr = (*n)->data; /* get pointer to data */ temp = *n; *n = (*n)->right; /* return pointer to right subtree */ free (temp); /* of leftmost node */ } if (*n != NULL) { fixheight (*n); dif = difference (*n); if (dif > 1) /* deletion caused left subtree to be too high */ balanceleft (n, -1); else if (dif < -1) /* deletion caused right subtree to be too high */ balanceright (n, -1); } } void delete (avltree ** n, void *key, int (*comp) (void *, void *), void (*deletekey) (void *)) { avltree *temp; void *dataptr; /* pointer to data record of avltree node */ short dif, cmp; if (*n != NULL) { cmp = comp (key, (*n)->data); if (cmp < 0) delete (&(*n)->left, key, comp, deletekey); else { if (cmp > 0) delete (&(*n)->right, key, comp, deletekey); /* node to be deleted is found */ else { if ((*n)->left != NULL && (*n)->right != NULL) { /* node has both left & right subtrees */ deletemin (&(*n)->right, &dataptr); deletekey ((*n)->data); /* release old data */ (*n)->data = dataptr; /* assign new data */ } else { temp = *n; if ((*n)->right == NULL) if ((*n)->left == NULL) *n = NULL; /* node has no children */ else *n = (*n)->left; /* node has left child only */ else *n = (*n)->right; /* node has right child only */ deletekey (temp->data); /* delete node data */ free (temp); /* delete avltree node */ } } } if (*n != NULL) { fixheight (*n); dif = difference (*n); if (dif > 1) /* deletion caused left subtree to be too high */ balanceleft (n, -1); else if (dif < -1) /* deletion caused right subtree to be too high */ balanceright (n, -1); } } } void deleteall (avltree ** p, void (*deldata) (void *)) { if (*p != NULL) { deleteall (&(*p)->left, deldata); deleteall (&(*p)->right, deldata); deldata ((*p)->data); free (*p); *p = NULL; } } /* * insert identifier in the subtree rooted at p */ void insert (avltree ** p, void *newdata, int (*comp) (void *, void *)) { int cmp, dif; if (*p == NULL) { *p = (avltree *) malloc (sizeof (avltree)); if (*p != NULL) { (*p)->height = 0; (*p)->data = newdata; /* new data linked to avltree node */ (*p)->left = NULL; /* initialized to no subtrees */ (*p)->right = NULL; } } else { cmp = comp (newdata, (*p)->data); if (cmp <= 0) insert (&(*p)->left, newdata, comp); /* put it in left subtree of p */ else if (cmp > 0) insert (&(*p)->right, newdata, comp); /* put it in right subtree of p */ fixheight (*p); /* may have to adjust height if subtree grew */ dif = difference (*p); if (dif > 1) /* insertion caused left subtree to be too high */ balanceleft (p, 1); else if (dif < -1) /* right subtree is too high */ balanceright (p, 1); } } /* * find identifier in the avltree rooted at p */ void * find (avltree * p, void *key, int (*comp) (void *, void *)) { int cmp; if (p == NULL) return NULL; else { if ((cmp = comp (key, p->data)) == 0) return p->data; else { if (cmp < 0) return find (p->left, key, comp); /* search left subtree of p */ else return find (p->right, key, comp); /* search right subtree of p */ } } } /* * interface function to move source avltree into destination avl-tree * source avltree will be empty, when completed. */ void move (avltree ** p, avltree ** newroot, int (*symcmp) (void *, void *)) { if (*p != NULL) { move (&(*p)->left, newroot, symcmp); move (&(*p)->right, newroot, symcmp); insert (newroot, (*p)->data, symcmp); /* insert node data by symcmp order */ free (*p); /* release avl-node */ *p = NULL; } } /* * interface function to copy source avltree into destination avl-tree */ void copy (avltree * p, avltree ** newroot, int (*symcmp) (void *, void *), void *(*create) (void *)) { void *sym; if (p != NULL) { copy (p->left, newroot, symcmp, create); copy (p->right, newroot, symcmp, create); sym = create (p->data); /* create a copy of data */ if (sym != NULL) insert (newroot, sym, symcmp); /* insert node data by symcmp order */ } } /* * interface function to re-order avltree */ void * reorder (avltree * p, int (*symcmp) (void *, void *)) { avltree *newroot = NULL; move (&p, &newroot, symcmp); /* re-order avl-tree */ return newroot; /* return pointer to new root */ } /* * interface function to traverse the avltree in inorder (left, node, right) * and perform appropriate action for each data node. */ void inorder (avltree * p, void (*action) (void *)) { if (p != NULL) { inorder (p->left, action); action (p->data); inorder (p->right, action); } } /* * interface function to traverse the avltree in preorder (node, left, right) * and perform appropriate action for each data node. */ void preorder (avltree * p, void (*action) (void *)) { if (p != NULL) { action (p->data); inorder (p->left, action); inorder (p->right, action); } } z88dk-1.8.ds1/src/z80asm/avltree.h0000644000175000017500000000175007130401712016226 0ustar tygrystygrys typedef struct avlnode { short height; /* height of avltree (max search levels from node) */ void *data; /* pointer to data of node */ struct avlnode *left, *right; /* pointers to left and right avl subtrees */ } avltree; void move(avltree **p, avltree **newroot, int (*symcmp)(void *,void *)); void copy(avltree *p, avltree **newroot, int (*symcmp)(void *,void *), void *(*create)(void *)); void delete(avltree **root, void *key, int (*comp)(void *,void *), void (*delkey)(void *)); void deleteall(avltree **p, void (*deldata)(void *)); void insert(avltree **root, void *key, int (*comp)(void *,void *)); void *find(avltree *p, void *key, int (*comp)(void *,void *)); void *reorder(avltree *p, int (*symcmp)(void *,void *)); void inorder(avltree *p, void (*action)(void *)); void preorder(avltree *p, void (*action)(void *)); z88dk-1.8.ds1/src/z80asm/config.h0000644000175000017500000000414210637517305016043 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* Pick up the default installation path */ #ifndef WIN32 #include "../config.h" #endif /* MSDOS definitions: */ #ifdef MSDOS #define OS_ID "MSDOS" #define MSDOS 1 #define DEFLIBDIR "c:\\z88dk\\lib\\" #endif /* UNIX definitions: */ #ifdef UNIX #define OS_ID "UNIX" #ifdef PREFIX #define DEFLIBDIR PREFIX "/lib/" #else #define DEFLIBDIR "/usr/local/lib/z88dk/lib/" #endif #endif /* QDOS definitions: */ #ifdef QDOS #define OS_ID "QDOS" #define QDOS 1 #define ENDIAN 1 #define DEFLIBDIR "" #endif /* AMIGA definitions: */ #ifdef AMIGA #define OS_ID "AMIGA" #define AMIGA 1 #define ENDIAN 1 #define DEFLIBDIR "zcc:lib/" #endif /* WIN32 definitions: */ #ifdef WIN32 #define OS_ID "WIN32" #define WIN32 1 #define DEFLIBDIR "c:\\z88dk\\lib\\" #endif #ifdef MSDOS #define MAXCODESIZE 65532 /* MSDOS 64K heap boundary */ #else #define MAXCODESIZE 65536 #endif /* Some clever config-ing if we're using GNUC */ #ifdef __BIG_ENDIAN__ /* Sadly the compiler on OS-X falls over with the #if below... */ #define ENDIAN #else #ifdef __GNUC__ #if #cpu(m68k) || #cpu(sparc) || #cpu(hppa) || #cpu(powerpc) #define ENDIAN 1 #endif #endif /* __GNUC__ */ #endif z88dk-1.8.ds1/src/z80asm/exprprsr.c0000644000175000017500000005677310635222017016466 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/exprprsr.c,v 1.3 2007/06/17 12:07:43 dom Exp $ */ /* $History: EXPRPRSR.C $ */ /* */ /* ***************** Version 15 ***************** */ /* User: Gbs Date: 26-01-00 Time: 22:10 */ /* Updated in $/Z80asm */ /* Expression range validation removed from 8bit unsigned (redundant). */ /* */ /* ***************** Version 13 ***************** */ /* User: Gbs Date: 6-06-99 Time: 20:05 */ /* Updated in $/Z80asm */ /* "PC" program counter changed to long (from unsigned short). */ /* */ /* ***************** Version 11 ***************** */ /* User: Gbs Date: 6-06-99 Time: 12:12 */ /* Updated in $/Z80asm */ /* Added Ascii Art "Z80asm" at top of source file. */ /* */ /* ***************** Version 9 ***************** */ /* User: Gbs Date: 6-06-99 Time: 11:29 */ /* Updated in $/Z80asm */ /* "config.h" included before "symbol.h" */ /* */ /* ***************** Version 8 ***************** */ /* User: Gbs Date: 2-05-99 Time: 18:04 */ /* Updated in $/Z80asm */ /* General improvements on EvalPfixExpr(), due to changes in declaration */ /* rules of XDEF, XREF and LIB. */ /* */ /* ***************** Version 6 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 5 ***************** */ /* User: Gbs Date: 7-03-99 Time: 14:24 */ /* Updated in $/Z80asm */ /* Minor changes to keep C compiler happy. */ /* */ /* ***************** Version 4 ***************** */ /* User: Gbs Date: 7-03-99 Time: 13:13 */ /* Updated in $/Z80asm */ /* Minor changes to keep C compiler happy. */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 15:06 */ /* Updated in $/Z80asm */ /* Improved handling of fgetc() character reading in relation to premature */ /* EOF handling (for character constants in expressions). */ #include #include #include #include #include #include "config.h" #include "symbol.h" /* external functions */ enum symbols GetSym (void); void ReportError (char *filename, short linenr, int errnum); void Pass2info (struct expr *expression, char constrange, long lfileptr); long GetConstant (char *evalerr); symbol *GetSymPtr (char *identifier); symbol *FindSymbol (char *identifier, avltree * symbolptr); char *AllocIdentifier (size_t len); int GetChar (FILE *fptr); /* local functions */ void list_PfixExpr (struct expr *pfixlist); void RemovePfixlist (struct expr *pfixexpr); void PushItem (long oprconst, struct pfixstack **stackpointer); void ClearEvalStack (struct pfixstack **stackptr); void CalcExpression (enum symbols opr, struct pfixstack **stackptr); void NewPfixSymbol (struct expr *pfixexpr, long oprconst, enum symbols oprtype, char *symident, unsigned char type); void StoreExpr (struct expr *pfixexpr, char range); int ExprSigned8 (int listoffset); int ExprUnsigned8 (int listoffset); int ExprAddress (int listoffset); int Condition (struct expr *pfixexpr); int Expression (struct expr *pfixexpr); int Term (struct expr *pfixexpr); int Pterm (struct expr *pfixexpr); int Factor (struct expr *pfixexpr); long EvalPfixExpr (struct expr *pfixexpr); long PopItem (struct pfixstack **stackpointer); long Pw (long x, long y); struct expr *Allocexpr (void); struct expr *ParseNumExpr (void); struct postfixlist *AllocPfixSymbol (void); struct pfixstack *AllocStackItem (void); /* global variables */ extern struct module *CURRENTMODULE; extern avltree *globalroot; extern enum symbols sym, pass1; extern enum flag listing; extern char ident[], separators[]; extern unsigned char *codearea, *codeptr; extern long PC; extern FILE *z80asmfile, *objfile; int Factor (struct expr *pfixexpr) { long constant; symbol *symptr; char eval_err; switch (sym) { case name: symptr = GetSymPtr (ident); if (symptr != NULL) { if (symptr->type & SYMDEFINED) { pfixexpr->rangetype |= (symptr->type & SYMTYPE); /* copy appropriate type bits */ NewPfixSymbol (pfixexpr, symptr->symvalue, number, NULL, symptr->type); } else { pfixexpr->rangetype |= ((symptr->type & SYMTYPE) | NOTEVALUABLE); /* copy appropriate declaration bits */ NewPfixSymbol (pfixexpr, 0, number, ident, symptr->type); /* symbol only declared, store symbol name */ } } else { pfixexpr->rangetype |= NOTEVALUABLE; /* expression not evaluable */ NewPfixSymbol (pfixexpr, 0, number, ident, SYM_NOTDEFINED); /* symbol not found */ } strcpy (pfixexpr->infixptr, ident); /* add identifier to infix expr */ pfixexpr->infixptr += strlen (ident); /* update pointer */ GetSym (); break; case hexconst: case binconst: case decmconst: strcpy (pfixexpr->infixptr, ident); /* add constant to infix expr */ pfixexpr->infixptr += strlen (ident); /* update pointer */ constant = GetConstant (&eval_err); if (eval_err == 1) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 5); return 0; /* syntax error in expression */ } else NewPfixSymbol (pfixexpr, constant, number, NULL, 0); GetSym (); break; case lparen: case lsquare: *pfixexpr->infixptr++ = separators[sym]; /* store '(' or '[' in infix expr */ GetSym (); if (Condition (pfixexpr)) { if (sym == rparen || sym == rsquare) { *pfixexpr->infixptr++ = separators[sym]; /* store ')' or ']' in infix expr */ GetSym (); break; } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 6); return 0; } } else return 0; case log_not: *pfixexpr->infixptr++ = '!'; GetSym (); if (!Factor (pfixexpr)) return 0; else NewPfixSymbol (pfixexpr, 0, log_not, NULL, 0); /* logical NOT... */ break; case squote: *pfixexpr->infixptr++ = '\''; /* store single quote in infix expr */ if (feof (z80asmfile)) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return 0; } else { constant = GetChar (z80asmfile); if (constant == EOF) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return 0; } else { *pfixexpr->infixptr++ = constant; /* store char in infix expr */ if (GetSym () == squote) { *pfixexpr->infixptr++ = '\''; NewPfixSymbol (pfixexpr, constant, number, NULL, 0); } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 5); return 0; } } } GetSym (); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 5); /* syntax error */ return 0; } return 1; /* syntax OK */ } int Pterm (struct expr *pfixexpr) { if (!Factor (pfixexpr)) return (0); while (sym == power) { *pfixexpr->infixptr++ = separators[power]; /* store '^' in infix expr */ GetSym (); if (Factor (pfixexpr)) NewPfixSymbol (pfixexpr, 0, power, NULL, 0); else return 0; } return (1); } int Term (struct expr *pfixexpr) { enum symbols mulsym; if (!Pterm (pfixexpr)) return (0); while ((sym == multiply) || (sym == divi) || (sym == mod)) { *pfixexpr->infixptr++ = separators[sym]; /* store '/', '%', '*' in infix expr */ mulsym = sym; GetSym (); if (Pterm (pfixexpr)) NewPfixSymbol (pfixexpr, 0, mulsym, NULL, 0); else return 0; } return (1); } int Expression (struct expr *pfixexpr) { enum symbols addsym = nil; if ((sym == plus) || (sym == minus)) { if (sym == minus) *pfixexpr->infixptr++ = '-'; addsym = sym; GetSym (); if (Term (pfixexpr)) { if (addsym == minus) NewPfixSymbol (pfixexpr, 0, negated, NULL, 0); /* operand is signed, * plus is redundant... */ } else return (0); } else if (!Term (pfixexpr)) return (0); while ((sym == plus) || (sym == minus) || (sym == bin_and) || (sym == bin_or) || (sym == bin_xor)) { *pfixexpr->infixptr++ = separators[sym]; addsym = sym; GetSym (); if (Term (pfixexpr)) NewPfixSymbol (pfixexpr, 0, addsym, NULL, 0); else return (0); } return (1); } int Condition (struct expr *pfixexpr) { enum symbols relsym = nil; if (!Expression (pfixexpr)) return 0; relsym = sym; switch (sym) { case less: *pfixexpr->infixptr++ = '<'; GetSym (); switch (sym) { case greater: *pfixexpr->infixptr++ = '>'; relsym = notequal; /* '<>' */ GetSym (); break; case assign: *pfixexpr->infixptr++ = '='; relsym = lessequal; /* '<=' */ GetSym (); break; default: break; } break; case assign: *pfixexpr->infixptr++ = '='; GetSym (); break; case greater: *pfixexpr->infixptr++ = '>'; if (GetSym () == assign) { *pfixexpr->infixptr++ = '='; relsym = greatequal; GetSym (); } break; default: return 1; /* implicit (left side only) expression */ } if (!Expression (pfixexpr)) return 0; else NewPfixSymbol (pfixexpr, 0, relsym, NULL, 0); /* condition... */ return (1); } struct expr * ParseNumExpr (void) { struct expr *pfixhdr; enum symbols constant_expression = nil; if ((pfixhdr = Allocexpr ()) == NULL) { ReportError (NULL, 0, 3); return NULL; } else { pfixhdr->firstnode = NULL; pfixhdr->currentnode = NULL; pfixhdr->rangetype = 0; pfixhdr->stored = OFF; pfixhdr->codepos = codeptr - codearea; pfixhdr->infixexpr = NULL; pfixhdr->infixptr = NULL; if ((pfixhdr->infixexpr = (char *) calloc (128,sizeof (char))) == NULL) { ReportError (NULL, 0, 3); free (pfixhdr); return NULL; } else pfixhdr->infixptr = pfixhdr->infixexpr; /* initialise pointer to start of buffer */ } if (sym == constexpr) { GetSym (); /* leading '#' : ignore relocatable address expression */ constant_expression = constexpr; /* convert to constant expression */ *pfixhdr->infixptr++ = '#'; } if (Condition (pfixhdr)) { /* parse expression... */ if (constant_expression == constexpr) NewPfixSymbol (pfixhdr, 0, constexpr, NULL, 0); /* convert to constant expression */ *pfixhdr->infixptr = '\0'; /* terminate infix expression */ return pfixhdr; } else { RemovePfixlist (pfixhdr); return NULL; /* syntax error in expression or no room */ } /* for postfix expression */ } void StoreExpr (struct expr *pfixexpr, char range) { unsigned char b; fputc (range, objfile); /* range of expression */ b = pfixexpr->codepos % 256U; fputc (b, objfile); /* low byte of patchptr */ b = pfixexpr->codepos / 256U; fputc (b, objfile); /* high byte of patchptr */ b = strlen (pfixexpr->infixexpr); fputc (b, objfile); /* length prefixed string */ fwrite (pfixexpr->infixexpr, sizeof (b), (size_t) b, objfile); fputc (0, objfile); /* nul-terminate expression */ pfixexpr->stored = ON; } long EvalPfixExpr (struct expr *pfixlist) { struct pfixstack *stackptr = NULL; struct postfixlist *pfixexpr; symbol *symptr; pfixlist->rangetype &= EVALUATED; /* prefix expression as evaluated */ pfixexpr = pfixlist->firstnode; /* initiate to first node */ do { switch (pfixexpr->operatortype) { case number: if (pfixexpr->id == NULL) /* Is operand an identifier? */ PushItem (pfixexpr->operandconst, &stackptr); else { /* symbol was not defined and not declared */ if (pfixexpr->type != SYM_NOTDEFINED) { /* if all bits are set to zero */ if (pfixexpr->type & SYMLOCAL) { symptr = FindSymbol (pfixexpr->id, CURRENTMODULE->localroot); pfixlist->rangetype |= (symptr->type & SYMTYPE); /* copy appropriate type * bits */ PushItem (symptr->symvalue, &stackptr); } else { symptr = FindSymbol (pfixexpr->id, globalroot); if (symptr != NULL) { pfixlist->rangetype |= (symptr->type & SYMTYPE); /* copy appropriate type * bits */ if (symptr->type & SYMDEFINED) PushItem (symptr->symvalue, &stackptr); else { pfixlist->rangetype |= NOTEVALUABLE; PushItem (0, &stackptr); } } else { pfixlist->rangetype |= NOTEVALUABLE; PushItem (0, &stackptr); } } } else { /* try to find symbol now as either */ symptr = GetSymPtr (pfixexpr->id); /* declared local or global */ if (symptr != NULL) { pfixlist->rangetype |= (symptr->type & SYMTYPE); /* copy appropriate type bits */ if (symptr->type & SYMDEFINED) PushItem (symptr->symvalue, &stackptr); else { pfixlist->rangetype |= NOTEVALUABLE; PushItem (0, &stackptr); } } else { pfixlist->rangetype |= NOTEVALUABLE; PushItem (0, &stackptr); } } } break; case negated: stackptr->stackconstant = -stackptr->stackconstant; break; case log_not: stackptr->stackconstant = !(stackptr->stackconstant); break; case constexpr: pfixlist->rangetype &= CLEAR_EXPRADDR; /* convert to constant expression */ break; default: CalcExpression (pfixexpr->operatortype, &stackptr); /* plus minus, multiply, div, * mod */ break; } pfixexpr = pfixexpr->nextoperand; /* get next operand in postfix expression */ } while (pfixexpr != NULL); if (stackptr != NULL) return PopItem (&stackptr); else return 0; /* Unbalanced stack - probably during low memory... */ } long Pw (long x, long y) { long i; for (i = 1; y > 0; --y) i *= x; return i; } void CalcExpression (enum symbols opr, struct pfixstack **stackptr) { long leftoperand, rightoperand; rightoperand = PopItem (stackptr); /* first get right operator */ leftoperand = PopItem (stackptr); /* then get left operator... */ switch (opr) { case bin_and: PushItem ((leftoperand & rightoperand), stackptr); break; case bin_or: PushItem ((leftoperand | rightoperand), stackptr); break; case bin_xor: PushItem ((leftoperand ^ rightoperand), stackptr); break; case plus: PushItem ((leftoperand + rightoperand), stackptr); break; case minus: PushItem ((leftoperand - rightoperand), stackptr); break; case multiply: PushItem ((leftoperand * rightoperand), stackptr); break; case divi: PushItem ((leftoperand / rightoperand), stackptr); break; case mod: PushItem ((leftoperand % rightoperand), stackptr); break; case power: PushItem (Pw (leftoperand, rightoperand), stackptr); break; case assign: PushItem ((leftoperand == rightoperand), stackptr); break; case lessequal: PushItem ((leftoperand <= rightoperand), stackptr); break; case greatequal: PushItem ((leftoperand >= rightoperand), stackptr); break; case notequal: PushItem ((leftoperand != rightoperand), stackptr); break; default: PushItem (0, stackptr); } } void RemovePfixlist (struct expr *pfixexpr) { struct postfixlist *node, *tmpnode; if (pfixexpr == NULL) return; node = pfixexpr->firstnode; while (node != NULL) { tmpnode = node->nextoperand; if (node->id != NULL) free (node->id); /* Remove symbol id, if defined */ free (node); node = tmpnode; } if (pfixexpr->infixexpr != NULL) free (pfixexpr->infixexpr); /* release infix expr. string */ free (pfixexpr); /* release header of postfix expression */ } void NewPfixSymbol (struct expr *pfixexpr, long oprconst, enum symbols oprtype, char *symident, unsigned char symtype) { struct postfixlist *newnode; if ((newnode = AllocPfixSymbol ()) != NULL) { newnode->operandconst = oprconst; newnode->operatortype = oprtype; newnode->nextoperand = NULL; newnode->type = symtype; if (symident != NULL) { newnode->id = AllocIdentifier (strlen (symident) + 1); /* Allocate symbol */ if (newnode->id == NULL) { free (newnode); ReportError (NULL, 0, 3); return; } strcpy (newnode->id, symident); } else newnode->id = NULL; } else { ReportError (NULL, 0, 3); return; } if (pfixexpr->firstnode == NULL) { pfixexpr->firstnode = newnode; pfixexpr->currentnode = newnode; } else { pfixexpr->currentnode->nextoperand = newnode; pfixexpr->currentnode = newnode; } } void PushItem (long oprconst, struct pfixstack **stackpointer) { struct pfixstack *newitem; if ((newitem = AllocStackItem ()) != NULL) { newitem->stackconstant = oprconst; newitem->prevstackitem = *stackpointer; /* link new node to current node */ *stackpointer = newitem; /* update stackpointer to new item */ } else ReportError (NULL, 0, 3); } long PopItem (struct pfixstack **stackpointer) { struct pfixstack *stackitem; long constant; constant = (*stackpointer)->stackconstant; stackitem = *stackpointer; *stackpointer = (*stackpointer)->prevstackitem; /* move stackpointer to previous item */ free (stackitem); /* return old item memory to OS */ return (constant); } void ClearEvalStack (struct pfixstack **stackptr) { while (*stackptr != NULL) PopItem (stackptr); /* clear evaluation stack */ } int ExprLong (int listoffset) { struct expr *pfixexpr; long constant, i; int flag = 1; if ((pfixexpr = ParseNumExpr ()) != NULL) { /* parse numerical expression */ if ((pfixexpr->rangetype & EXPREXTERN) || (pfixexpr->rangetype & EXPRADDR)) /* expression contains external reference or address label, must be recalculated during linking */ StoreExpr (pfixexpr, 'L'); if (pfixexpr->rangetype & EXPREXTERN) RemovePfixlist (pfixexpr); else { if ((pfixexpr->rangetype & EXPRADDR) && (listing == OFF)) /* expression contains address * label */ RemovePfixlist (pfixexpr); /* no listing - evaluate during linking... */ else { if (pfixexpr->rangetype & NOTEVALUABLE) Pass2info (pfixexpr, RANGE_32SIGN, listoffset); else { constant = EvalPfixExpr (pfixexpr); RemovePfixlist (pfixexpr); if (constant >= LONG_MIN && constant <= LONG_MAX) { for (i = 0; i < 4; i++) { *(codeptr + i) = constant & 255; constant >>= 8; } } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 4); } } } } else flag = 0; codeptr += 4; return flag; } int ExprAddress (int listoffset) { struct expr *pfixexpr; long constant; int flag = 1; if ((pfixexpr = ParseNumExpr ()) != NULL) { /* parse numerical expression */ if ((pfixexpr->rangetype & EXPREXTERN) || (pfixexpr->rangetype & EXPRADDR)) /* expression contains external reference or address label, must be recalculated during linking */ StoreExpr (pfixexpr, 'C'); if (pfixexpr->rangetype & EXPREXTERN) RemovePfixlist (pfixexpr); else { if ((pfixexpr->rangetype & EXPRADDR) && (listing == OFF)) /* expression contains address * label */ RemovePfixlist (pfixexpr); /* no listing - evaluate during linking... */ else { if (pfixexpr->rangetype & NOTEVALUABLE) Pass2info (pfixexpr, RANGE_16CONST, listoffset); else { constant = EvalPfixExpr (pfixexpr); RemovePfixlist (pfixexpr); if (constant >= -32768 && constant <= 65535) { *codeptr = (unsigned short) constant % 256U; *(codeptr + 1) = (unsigned short) constant / 256U; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 4); } } } } else flag = 0; codeptr += 2; return flag; } int ExprUnsigned8 (int listoffset) { struct expr *pfixexpr; long constant; int flag = 1; if ((pfixexpr = ParseNumExpr ()) != NULL) { /* parse numerical expression */ if ((pfixexpr->rangetype & EXPREXTERN) || (pfixexpr->rangetype & EXPRADDR)) /* expression contains external reference or address label, must be recalculated during linking */ StoreExpr (pfixexpr, 'U'); if (pfixexpr->rangetype & EXPREXTERN) RemovePfixlist (pfixexpr); else { if ((pfixexpr->rangetype & EXPRADDR) && (listing == OFF)) /* expression contains address * label */ RemovePfixlist (pfixexpr); /* no listing - evaluate during linking... */ else { if (pfixexpr->rangetype & NOTEVALUABLE) Pass2info (pfixexpr, RANGE_8UNSIGN, listoffset); else { constant = EvalPfixExpr (pfixexpr); RemovePfixlist (pfixexpr); *codeptr = (unsigned char) constant; } } } } else flag = 0; ++codeptr; return flag; } int ExprSigned8 (int listoffset) { struct expr *pfixexpr; long constant; int flag = 1; if ((pfixexpr = ParseNumExpr ()) != NULL) { /* parse numerical expression */ if ((pfixexpr->rangetype & EXPREXTERN) || (pfixexpr->rangetype & EXPRADDR)) /* expression contains external reference or address label, must be recalculated during linking */ StoreExpr (pfixexpr, 'S'); if (pfixexpr->rangetype & EXPREXTERN) RemovePfixlist (pfixexpr); else { if ((pfixexpr->rangetype & EXPRADDR) && (listing == OFF)) /* expression contains address label */ RemovePfixlist (pfixexpr); /* no listing - evaluate during linking... */ else { if (pfixexpr->rangetype & NOTEVALUABLE) Pass2info (pfixexpr, RANGE_8SIGN, listoffset); else { constant = EvalPfixExpr (pfixexpr); RemovePfixlist (pfixexpr); if (constant >= -128 && constant <= 255) *codeptr = (char) constant; else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 4); } } } } else flag = 0; ++codeptr; return flag; } struct expr * Allocexpr (void) { return (struct expr *) malloc (sizeof (struct expr)); } struct postfixlist * AllocPfixSymbol (void) { return (struct postfixlist *) malloc (sizeof (struct postfixlist)); } struct pfixstack * AllocStackItem (void) { return (struct pfixstack *) malloc (sizeof (struct pfixstack)); } z88dk-1.8.ds1/src/z80asm/hist.c0000644000175000017500000006547207461021037015546 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* * Z80 Module Assembler - C version, by Gunther Strube - InterLogic 1992-1999 * * converted from QL SuperBASIC version 0.956. Initially ported to Lattice C then C68 on QDOS. */ /* * Main Source file - definition of global identifiers etc. * * 26.08.91, V0.000: * Work on Draft version of GetIdentifier started. * * 28.08.91, V0.001: * GetIdentifier tested - working. * * 31.08.91, V0.002: * Work on Pass 1 - Z80 commands. * * 13.09.91, V0.003: * Getidentifier() renamed to Getident(). * Main body of Z80pass1() finished - all parsing of Z80 instructions and assembler directives implemented. CheckCondition() * implemented. CheckRegister8() implemented. CheckRegister16() implemented. functions now split up into modules: * * 25.02.92, V0.004: * Algortihms for symbol storing & lookup, using hash table and linked lists: * * 03.03.92, V0.005: * Algorithms for converting ASCII symbols into integer values implemented: * Symbol storing algorithms now changed to infinite numbers of symbol allocation (as long as memory are available). Also, * it is now allowed to have identifiers with dynamic length's though only a maximum of 254 chars (maximum length of * line minus a dot to indicate a label definition). * * 01.05.92, V0.006: * Hashtable array, 'SymPtrIndex', and relative jump address label array, 'JR_address', now created at * runtime. This saves 12K of program space! * Reporterror() implemented in 'Parseline_c' - all return error in various functions are now standardised. * * 17.09.92, V0.007: * Ported to C68 - the Public Domain C compiler for QL. Improved with ANSI C prototyping and function * parameters. Minor bugs detected. * * 10.02.92, V0.008: * Parsing of numerical expressions rewritten. New operators implemented: /, %, * Expressions now stored * in linked lists as postfix expressions. Getident() -> Getsym() (also modified to return an enumerated symbol) * Numexpression() removed. 28.10.92 V0.009 Many changes and implementations of Z80 instructions. More Source file * modules. * * 05.11.92, V0.010: * Parsing & code generation of all Z80 instructions. Command line argument implemented. Simple listing * file implemented. * * 08.11.92, V0.011: * Removal of parsing information after pass 2. Parsing error system improved. * * 09.11.92, V0.12: * List file layout finished (header, datestamp, etc.) * * 15.11.92, V0.13: * INCLUDE directive implemented. Improvement on general error handling. * * 23.11.92, V0.14: * Sorted symbol table output in listing file - output'ed only if no errors ocurred. The assembler no * longer distinguishes upper and lower case identifiers. The source can now be written any mixture of upper and lower * case letters. * * 26.11.92, V0.15: * Listfile Page Number References included in symbol table output. BINARY directive implemented. Phase 1 * of Z80 Cross Assembler Completed. * * 16.03.93, V0.15b: * Bug in Expression evaluation algorithms fixed: Allocation/Deallocation of memory in ParseNumExpr() and * EvalExpr() rewritten. * * 24.03.93, V0.15c: * PrsIdent() rewritten. Uses standard ANSI C bsearch function to locate Z80 identifier. (array of * structure containing the identifier and a pointer to a function) * * 01.04.93, V0.16: * Allocation & search of symbols restructured into AVL tree. * * 13.05.93, V0.18b: * Modular assembly processing implemented. * * 14.05.93, V0.19: * Date stamp control feature implemented. * * 21.05.93, V0.19b: * List file & object file removed if errors encountered in module Error file feature implemented. * * 09.06.93, V0.19c: * Bugs in page reference algorithms fixed. Phase 2 of Z80 Cross Assembler Completed. * * 22.06.93, V0.19d: * ANSI source ported to Borland C++ V3.1 on the IBM PC. Many small inconsistencies removed to be 100% * compilable by Borland C++. ParseIdent() rewritten. A few bugs fixed in Z80asm_c module. 'relocfile' option flag * removed - object file is always created. -v option at command line (verbose assembly) implemented. * * 24.06.93, V0.19e: * -r option at command line (define ORG) implemented. 27.06.93 file pointer read/write in object * standardised to low byte -> high byte order (V0.19d stored internal representation of long) this means that object * files are now portable to all computer platforms using the Z80 Module Assembler (Z88, QL, PC, ?) * * 06.07.93, V0.19f: * Bug in TestAsmFile() fixed. The assembler now only reports 'file open error' if both source and object * file wasn't available. * * 20.07.93, V0.19g: * AVLTREE insertion optimized. * * 17.08.93, V0.19h: * Symbol values are stored as signed long integers in object file. Symbol table (in listing file) also * altered to allow long integer display. Memory now no longer released after completed assembly in QDOS version. * * 31.08.93, V0.21: * Bug in mapfile routine fixed: Trying to release the mapfile even if was empty. Symbols, constants and * expressions are now all treated as base type long. Name definitions are now also stored as long in the object file. * DEFL implemented to store 32bit signed integers in low byte - high byte sequense. FPP implemented to identify a * better interface to the OZ floating point package. Map file writes 'None.' if no map item are present. * * 02.09.93, V0.22: * Binary operators AND, OR, XOR implemeneted in expression evalution. Constants are now globally * accessible, if defined with XDEF. Bug in Z80asm module code loading fixed: There was no check that code was * generated at all. Since the fptr_modcode was 0, the file pointer were set to the beginning of the file, and the * first two bytes were used as the length id (the 'Z80RMF' !) A check is now made to ensure that machine is available. * Assembler function implemented, 'ASMPC' which returns the current assembler PC: This is can be useful during code * generation. * * 06.09.93, V0.23: * LSTON, LSTOFF directives implemented. * * 06.12.93, V0.24: * All expressions may now be specified as logical expressions returning 1 for TRUE and 0 for FALSE. * logical operators are: =, <>, <, >, <= and >= . * Conditional assembly implemented with #if, #else and #endif. Unlimited nesting of #if expressions allowed. * pass1 algorithm optimized and rewritten to facilitate conditional assembly. * * 12.12.93, V0.25: * Expression evaluation improved with logical NOT (using '!' in expressions) Some module pointer * algorithms rewritten. * * 16.12.93, V0.26: * Pass1 parsing now directly read by fgetc() instead of fgets(), since fgets() couldn't handle control * characters (tabs, etc.) in the assembler source file. Algorithms to parse expressions have been slightly changed, * since the underlying parsing have changed. The object file format has been changed in the expression section: Infix * expressions are now terminated with '\0' in stead of length identifier. This is necessary, since expression parsing * is also executed directly on the object file (expression). The listing file gets the complete line as usual * (directly from the source file). * Assembly optimised: Expressions are NOT evaluated if they contain address labels and no listing output is active (no * listing file or temporarily switched off). * * 18.12.93, V0.27: * Line parsing bugs corrected in both normal and conditional assembly. EOL flag implemented to control * linefeed during recursive parsing. * * 31.01.94, V0.28: * JP, CALL functions improved with better algorithm interface Bit manipulation functions improved (lack * of syntax check). '#IF', '#ELSE', '#ENDIF' changed to 'IF', 'ELSE', 'ENDIF' Listing file now also contains source * file line numbers The module code size is now displayed during verbose assembly. * 08.02.94 Expression parsing optimised: Factor(), Term(), Expression() & Condition() - redundant pointer reference * level removed during parsing. Bug in ParseNumExpr() fixed: pfixhdr wasn't released if there wasn't room for * infixexpr area. * 14.02.94 Bug in BINARY() fixed: binfile wasn't closed after read process. * 17.02.94 Bug in EvalLogExpr() fixed: if syntax error occurred in a logical expression, a random integer were * returned, in stead of 0. * 18.02.94 Bugs in PushItem() and PopItem() fixed: Logic control were missing to handle a stack with no elements on * it! * * 19.02.94, V0.29: * A help prompt is displayed if no arguments are defined. * * 23.02.94, V0.30: * BINARY facility changed to used file name parameter as in INCLUDE. Bug in INCLUDE function fixed: * Did'nt set the EOL flag if end of line encoun- tered during reading of file name. * Expression evaluation altered: Expression are now evaluated completely, even though a single identifier is not known * (making the expression NOT EVALUABLE). The result of the evaluation is returned (but probably incorrect). This * allowes specification of several -D symbols in an conditional assembly line, e.g. "if MSDOS | UNIX", to be * evaluated to TRUE if just one symbol is defined (the expression is however detected as UNEVALUABLE). * -D symbols now saved separately in new STATIC tree structure, and copied into local symbols during assembly of each * module. This fixes the problem of -D used on multi-module-assembly (otherwise the -D symbol is removed after the * assembly of the first module). STATICs are first removed after the linking process. * The -D symbol is however stored into the object file if it were used in an expression (e.g. in an IF expression). It * should not, as it is of a different type of symbol than a CONSTANT or an ADDRESS. This must be fixed in a future * version. * On execution of the assembler, a unique -D symbol is created to identify the particular platform the assembler is * running in: 'QDOS' : Z80asm running on the QL and compatibles (ANSI C). * 'MSDOS' : Z80asm running on the IBM PC and compatibles (ANSI C). * 'LINUX' : Z80asm running on the LINUX/UNIX operating system (ANSI C). * 'Z88' : Z80asm running on the Cambridge Z88 portable computer (handwritten machine code application). * * 25.02.94 New typ implemented for -D symbols. New keyword implemented: 'define' to execute the equivalent of -D on * the command line. * * 04.03.94, V0.31: * -lib and -xlib implemented. Major rewrite of module linking routines. New keyword implemented: 'LIB' * to declare external library routine (included during linking). New global variable for CURRENTMODULE (previously * used as the indirect pointers of the modulehdr structure. The global variable saves time and is more code efficient. * * 08.04.94, V0.32: * New keyword for library type declaration implemented: XLIB, define library routine address (also * declared as global). The type is stored as 'X' in the names declaration in object files. * The new type was needed to distinuish between names during output of a -g list, hence included library routine names * may not be in the list. * 13.03.94 Bug in ParseLine() fixed: If a label was encountered during non-interpretation of a source line, a syntax * error was reported. The should just have been skipped. * * 14.03.94, V0.33: * Global definition file algorithm rewritten. The global definitions are now written continously after * completion of each module and NOT after linking. This eliminates the problem of not getting a def. file, if linking * couldn't be performed due to assembly errors. * * 25.03.94, V0.34: * DEFVARS implemented to define variables and records in a more structured design. The old 'DS' renamed * to 'DEFS' (define storage). The following DS (define space) are available: ds.b (byte size) ds.w (word size) ds.p * (pointer size) ds.l (long word size) * 26.03.94 DEFGROUP implemented to allow ENUM - alike symbols to be created just as easy as in C. * 06.04.94, V0.35: '-lib' changed to '-i', '-xlib' changed to '-x'. DEFINE algorithm didn't check if a symbol was already * defined. * 19.04.94 New window interface for QDOS / C68 version. config_h now defines the platform defintions (line feed size, * etc.) * * 25.04.94, V0.36: * enum flag introduced in expression record to identify whether the expression has been stored to * the object file or not. Label declarations are now always touched due to problems of forward referencing problems in * expressions and identifiers in object files. This had been implemented in an earlier version, but had apparently * been removed by accident - The drawback of this is that label declarations, that aren't used in a source file will * become redundant in the object file. However, this is rare and will not create more than 5% of additional size in * object files in worst case situations. * * 03.05.94, V0.37: * Bug fixes in exprprsr_c, z80pass_c and modlink_c: All expression evaluation did a type casting of the * evaluated expression before the legal range were examined. This caused illegal ranges to be allowed in expressions. * 13.05.94 Bug fixed in LinkModules(): Z80header were null-terminated beyond local array. This made created peculiar * crashes occasionally on the QL version. MSDOS-version now running perfectly. Releasing of module & global data * structures are now only released by Z80asm running on platforms other than the QL - the allocated data is released * automatically when the job is killed. * * 15.05.94, V0.38: * Z80RMF level 01 implemented: Infix expression string now also length prefixed. GetModuleSize() improved * to check if it is a proper 'Z80RMF01' file that is to be read. Library files now also checked to have the 'Z80LMF01' * header. * 01.06.94 "DS" has been removed from identifier function call table. DEFVARS() now executes a normal strcmp() to * check for the correct "DS" directive. * * 07.06.94, V0.39: * Symbol file implemented. This will be created if the user wants the symbol table, but not the listing * file. _def, _map and _sym (and in listing file) uses new tabulated space algorithm (to save file storage). * 15.06.94 Internal improvement of module & library linking routines. * * 17.06.94, V0.40: * DEFVARS origin parameter may now be an expression (with no forward references) Default tabulator * distance now set to 8, column width is 4 times t. distance. * * 16.09.94, V0.41: * Size specifier in DEFVARS variable offset may now be specified as an expression. However, the * expression may not contain forward referenced symbols. The algorithm has been re-structurized. * * 22.09.94, V0.42: * INCLUDE directive improved: Environment variable "Z80_OZFILES" introduced to read a fixed path of all * Z88 OZ definition files. This makes it easier to port source code with regard to fetch the standard OZ files. Each * platform just presets the variable and the assembler will automatically expand the system file '#file' with a * leading path followed by 'file'. * O_BINARY mode included in open() function when creating a library file. This ensures compatibility with MSDOS files. * Bug in Z80asm_c fixed: -x option created library file as text file (no binary open mode). The file is now created as a * binary file. NB: This is only relevant for MSDOS (and LINUX/UNIX?). * 27.09.94 LSTON/LSTOFF bug fixed: During INCLUDE file management, the old line of the previous file was written to * the list file when beginning/continuing on a new file. The listing file line is now initially cleared before pass 1 * is executed. * * 19.10.94, V0.45: * New option added: -R. This Feature generates relocatable code, i.e. relocates it self before being * executed. A standard machine code routine is put in front of the code together wth a relocation table. * The generated machine code is self modifying and may only be executed in RAM (e.g.in Z88 BBC BASIC). * The help page has been slighty improved. * * 31.10.94: Relocator & relocation table structure changed. Each entry in the table is now defined as offsets from each * relocation address. Since relocation addresses mostly are less than 255 bytes apart, this design saves a lot of space * on the relocation header, about 50%. The idea was suggested by Erling Jacobsen who noticed the principle in the C68 * C compiler. * The relocation table contents allowes negative offsets. This may be useful since not all relocation code patch pointers * is historically organised. However, if two adjacent patch pointers are more than 32K apart it will not create the * proper offset pointer (due to an integer overflow). * 01.11.94: -i option opened the library file with unnecessary mode flags. If the specified library file didn't exist, it * was automatically created. The routine then made the wrong assumptions of that file. * * 17.11.94, V0.46: * Expression parsing & evaluation added with ^ (power) operator. Binary XOR now uses the ':' symbol. * The power operator is useful it may be necessary to convert bit numbers 0-7 into an 8bit value using: 2^bitnumber. * * 18.11.94, V0.47: * The following undocumented Z80 instructions have been implemented: * SLL instruction (Shift Logical Left). 8Bit LD r,IXh/IXl/IYl/IYh & LD IXh/IXl/IYl/IYh,r . INC/DEC IXl,IXh,IYl,IYh. * AND, ADD, ADC, SUB, SBC, CP, OR & XOR IXl/IXh/IYl/IYh . * * 30.11.94, V0.48: * Library filenames may now be omitted which is interpreted as the standard library filename. * Since the standard library is used most of the time it is considerably easier to just specify '-i' or '-x' without * a filename. * The default library filename is defined in an environment variable 'Z80_STDLIB'. * * 01.01.95, V0.49: * New feature in expressions implemented: Leading '#' in expressions defines a constant expression. * This is necessary when calculating relocatable address offsets and avoiding it to be interpreted as a relocatable * address to be manipulated during a -R option. * '#ASMPC' changed to 'ASMPC' * 05.01.95: Bug in -D option fixed: first character of identifier wasn't converted to upper case. * 03.03.95: Evaluation stack algorithms optimized. * 12.03.95: Patching on 16bit addresses optimized. * * 14.03.95, V0.50: * Bug in Condition() fixed: logical NOT algorithm were misplaced. Moved to Factor(). * 17.03.95: ORG is now only defined from keyboard at the beginning of the linking process, if no ORG * were defined during assembly of the first module. * * 21.04.95, V0.52: * New avltree algorithms used in Z80asm. Many symbol-related routines changed to new interface. * Forward-referenced symbols now finally deleted, in stead of being marked SYMREMOVED. FindSymbol() now faster. * * 24.04.95, V0.53: * 'ASMPC' standard identifier now implemented as part of the global symbol tables. This means that * that it is equal to all other created symbols. Both pass1(), pass2() and the linking process use the assembler PC. * The explicit code in DefineSymbol() and Factor() are finally removed, which has speeded up the algorithms. * * 25.04.95, V0.54: * standard avltree move() and copy() now used in stead of CopyTree() and ReorderSymbol(). * * 27.04.95, V0.55: * -c option added, which split the compiled machine code into 16K blocks. Each file is identified * with a '_bnx' extension where 'x' defines the blocks 0 (the first) to 3 (total of 64K). * * 03.05.95, V0.56: * DEFGROUP improved; evaluable expressions may now be used (previously only constants). * * 03.06.95, V0.57: * compile option messages displayed before processing (response to selected command line option). * EvalExpr() slightly optimised: Identifier logic in expressions made faster. * * 22.06.95, V0.58: * Parsing logic improved, with a bugfix in IF conditional expressions: A comment after a conditional * expression wasn't skipped. Getsym() has now been improved to skip the rest of a line of a comment ; is found. * This has also lead to various improvements in the parsing logic code of the assembler. * Total of lines assembled is now also displayed after successfull compilation. * * 28.06.95, V0.59: * New Relocator routine implemented. Mapfile now adds relocation header offset to address labels if * relocation option, -R, was selected). * * 13.07.95, V0.60: * Syntax parsing improvement in DEFB, DEFW and DEFL directives. * * 14.11.95, V1.00: * Last changes before final release: * CheckRegister8(): 'F' now returns 6. * Syntax check on register mnemonics improved. * XLIB improved to issue implicit MODULE definition. * * 20.02.96, V1.01 (gbs): * Minor bug fixed for signed 8bit operands: * If say, LD (IX+$FF),A were used, the assembler gave an error. It shouldn't. The operand is now properly * sign-converted. * * 20.06.98, V1.0.3 (gbs): * Minor bug fixes in EOF handling in prsline.c, exprprsr.c and asmdrctv.c * prsident.c : SUB, AND, OR, XOR and CP instructions improved with "instr [A,]" syntax (allowing to specify "A," * explicitly and thereby avoiding mis-interpretations). * * 03.09.98, V1.0.4 (gbs): * New command line option added: Use self defined source file extension, -e in stead of ".asm". * DEFVARS functionality extended with -1 which remembers last used offset. * * 07.03.99, V1.0.5 (dom): * Program terminates with 1 if an error occurs, otherwise 0 (implemented by Dominic Morris djm@jb.man.ac.uk). * Minor changes to remove silly warnings. * * 11.04.99, V1.0.6 (gbs): * C sources modified slighly a few lines to eliminate -Wall compiler warnings when using GNU C compiler * on Linux (now truly ANSI C conformant). All sources now reformatted according to GNU C programming style. * New option added: -o which allowes a different binary outfilename than otherwise based on * project filename. * * 16.04.99, V1.0.7 (gbs): * Assembler parses text files of arbitrary line feed standards; CR, LF or CRLF (OS independant text file parsing). * Command line symbol option to identify project files, #, has been changed to @ because # is regarded * as comment line identifier in UNIX shell environments - the result of this means that the file name is * discarded by the command line environment, when trying to compile a z80asm project. * Default -v option changed to -nv (verbose mode disabled by default). * * 30.04.99, V1.0.8 (gbs): * Error messages now extended with display of module name, if possible (request by Dominic Morris) * Basic file I/O error reported in new error message function to display proper error message. * * 02.05.99, V1.0.9 (gbs): * Directives XDEF, XREF, XLIB and LIB can now be defined arbitrarily in the asm source (before or after * the actual symbols names in question). Request by Dominic Morris of SmallC fame. * "LINUX" OS ID now changed to generic "UNIX" in compilation, since there's no Linux specifics in the * sources. Further, all UNIX's can successfully compile and execute z80asm. * Recursive include of same or mutual files now error trapped (new FindFile() function and changes to * IncludeFile() function). * * 04.05.99, V1.0.10 (gbs): * Bug fixes related to reading filenames from source files (filenames should not be case converted * because some filing systems look at filenames explicitely - with no case independency). * During create library, object offset now only displayed in verbose mode. * Filenames may now be specified with .asm at command line (stripped again internally). This is * useful since some OS's have true command line expansion, now allowing "z80asm *.asm" to get * all assembler source files pre-assembled. * * 30.05.99, V1.0.11 (gbs): * Binary() rewritten due to misbehaving functionality on MSDOS platform. * (reported by Keith Rickard, keithrickard@compuserve.com). * CreateLib() rewritten to replace the open() low level file I/O with high level * fopen() and fread() calls. * * 06.06.99, V1.0.12 (gbs): * MAXCODESIZE define moved to "config.h" where it also is defined for specific platforms. * For MSDOS the value is 65532 due to max heap size allocation per malloc() call. * (MSDOS BorlandC limitation reported by Dennis Grning ) * * DEFB, DEFW, DEFL & DEFM now implemented with proper MAXCODESIZE checking. * ReportError() now displays to stderr the actual MAXCODESIZE limit if it has been reached. * * 30.09.99, V1.0.13 (gbs) * CALL_PKG hard coded macro implemented for Garry Lancaster's Package system. * * 03.10.99, V1.0.13 (gbs) * Slight change to CALL_PKG(): 0 (zero) is allowed as parameter. * * 26.01.2000, V1.0.14 (gbs) * Expression range validation removed from 8bit unsigned (redundant) data storage. * * 28.01.2000, V1.0.15 (dom) * Fixed ParseIdent routine (was searching for IF,ELSE,ENDIF at one * position below there true place in the table) - this zapped * the HALT instruction and caused a Syntax Error report * * Added the -M flag the change output files to .o from .obj * * 30.1.2000, V1.0.16 (gbs) * Dominic's -M option extended with argument, so that it may be possible * to define an arbitrary object file extension (max 3 chars), e.g. * -Mo to define .o extension. * * 26.02.2000, V1.0.17 (djm) * Added -C flag to output C source line number instead of asm line number * (if defined) * Added directive LINE to enable this * Allowed labels to start with an '_' * * 23.04.2000 (djm) [No version increment] * Added auto ENDIAN config if using GNU C * * 20.01.2001 [No version increment] * Added hardcoded macro instruction Invoke and command line ti83plus * to make assembler ti83/83plus compatible * * 28.02.2001 V1.0.18 (djm) * Added UNDEFINE command to allow undefinition of a DEFINE * * 21.03.2001 v1.0.19 (djm) * Allowed labels to end in ':' and forsake the initial '.' * * 27.06.2001 [no version increment] (djm) * defs now takes a second parameter indicating what the filler byte should be, if not * set the defaults to 0 * * 17.01.2001 [no version increment] (djm) * 20h is now accepted as a synonym for $20 * * 18.01.2001 [no version increment] (djm) * Dropped the requirement for add, sbc, and adc to specify "a," for 8 bit * operations * Added d and b specifiers for constants - decimal and binary * C-style 0x prefix for hex digits is permitted * * 22.04.2002 [no version increment] (Stefano) * IX <-> IY swap option added (-IXIY) */ z88dk-1.8.ds1/src/z80asm/ldinstr.c0000644000175000017500000003067107130401712016242 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/ldinstr.c,v 1.1.1.1 2000/07/04 15:33:30 dom Exp $ */ /* $History: LDINSTR.C $ */ /* */ /* ***************** Version 10 ***************** */ /* User: Gbs Date: 6-06-99 Time: 20:05 */ /* Updated in $/Z80asm */ /* "PC" program counter changed to long (from unsigned short). */ /* */ /* ***************** Version 8 ***************** */ /* User: Gbs Date: 6-06-99 Time: 12:12 */ /* Updated in $/Z80asm */ /* Added Ascii Art "Z80asm" at top of source file. */ /* */ /* ***************** Version 6 ***************** */ /* User: Gbs Date: 6-06-99 Time: 11:29 */ /* Updated in $/Z80asm */ /* "config.h" included before "symbol.h" */ /* */ /* ***************** Version 4 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 15:10 */ /* Updated in $/Z80asm */ /* SourceSafe Version History Comment Block added. */ #include #include "config.h" #include "symbol.h" /* external functions */ enum symbols GetSym (void); void ReportError (char *filename, short linenr, int errnum); void RemovePfixlist (struct expr *pfixexpr); int ExprUnsigned8 (int listoffset); int ExprSigned8 (int listoffset); int ExprAddress (int listoffset); int CheckRegister16 (void); int CheckRegister8 (void); struct expr *ParseNumExpr (void); int IndirectRegisters (void); /* local functions */ void LD_HL8bit_indrct (void); void LD_16bit_reg (void); void LD_index8bit_indrct (int reg); void LD_address_indrct (long exprptr); void LD_r_8bit_indrct (int reg); /* global variables */ extern unsigned char *codeptr, *codearea; extern long PC; extern enum symbols sym, GetSym (void); extern enum flag relocfile; extern struct module *CURRENTMODULE; extern FILE *z80asmfile; void LD (void) { long exprptr; int sourcereg, destreg; if (GetSym () == lparen) { exprptr = ftell (z80asmfile); /* remember start of expression */ switch (destreg = IndirectRegisters ()) { case 2: LD_HL8bit_indrct (); /* LD (HL), */ break; case 5: case 6: LD_index8bit_indrct (destreg); /* LD (IX|IY+d), */ break; case 0: if (sym == comma) { /* LD (BC),A */ GetSym (); if (CheckRegister8 () == 7) { *codeptr++ = 2; ++PC; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; case 1: if (sym == comma) { /* LD (DE),A */ GetSym (); if (CheckRegister8 () == 7) { *codeptr++ = 18; ++PC; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; case 7: LD_address_indrct (exprptr); /* LD (nn),rr ; LD (nn),A */ break; } } else switch (destreg = CheckRegister8 ()) { case -1: LD_16bit_reg (); /* LD rr,(nn) ; LD rr,nn ; LD SP,HL|IX|IY */ break; case 6: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); /* LD F,? */ break; case 8: if (GetSym () == comma) { GetSym (); if (CheckRegister8 () == 7) { /* LD I,A */ *codeptr++ = 237; *codeptr++ = 71; PC += 2; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; case 9: if (GetSym () == comma) { GetSym (); if (CheckRegister8 () == 7) { /* LD R,A */ *codeptr++ = 237; *codeptr++ = 79; PC += 2; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; default: if (GetSym () == comma) { if (GetSym () == lparen) LD_r_8bit_indrct (destreg); /* LD r,(HL) ; LD r,(IX|IY+d) */ else { sourcereg = CheckRegister8 (); if (sourcereg == -1) { /* LD r,n */ if (destreg & 8) { *codeptr++ = 221; /* LD IXl,n or LD IXh,n */ ++PC; } else if (destreg & 16) { *codeptr++ = 253; /* LD IYl,n or LD IYh,n */ ++PC; } destreg &= 7; *codeptr++ = destreg * 8 + 6; ExprUnsigned8 (1); PC += 2; return; } if (sourcereg == 6) { /* LD x, F */ ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } if ((sourcereg == 8) && (destreg == 7)) { /* LD A,I */ *codeptr++ = 237; *codeptr++ = 87; PC += 2; return; } if ((sourcereg == 9) && (destreg == 7)) { /* LD A,R */ *codeptr++ = 237; *codeptr++ = 95; PC += 2; return; } if ((destreg & 8) || (sourcereg & 8)) { /* IXl or IXh */ *codeptr++ = 221; ++PC; } else if ((destreg & 16) || (sourcereg & 16)) { /* IYl or IYh */ *codeptr++ = 253; ++PC; } sourcereg &= 7; destreg &= 7; *codeptr++ = 64 + destreg * 8 + sourcereg; /* LD r,r */ ++PC; } } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } /* * LD (HL),r LD (HL),n */ void LD_HL8bit_indrct (void) { int sourcereg; if (sym == comma) { GetSym (); switch (sourcereg = CheckRegister8 ()) { case 6: case 8: case 9: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; case -1: /* LD (HL),n */ *codeptr++ = 54; ExprUnsigned8 (1); PC += 2; break; default: *codeptr++ = 112 + sourcereg; /* LD (HL),r */ ++PC; break; } } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } /* * LD (IX|IY+d),r LD (IX|IY+d),n */ void LD_index8bit_indrct (int destreg) { int sourcereg; unsigned char *opcodeptr; if (destreg == 5) *codeptr++ = 221; else *codeptr++ = 253; opcodeptr = codeptr; /* pointer to instruction opcode */ *codeptr++ = 54; /* preset 2. opcode to LD (IX|IY+d),n */ if (!ExprSigned8 (2)) return; /* IX/IY offset expression */ if (sym != rparen) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); /* ')' wasn't found in line */ return; } if (GetSym () == comma) { GetSym (); switch (sourcereg = CheckRegister8 ()) { case 6: case 8: case 9: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; case -1: ExprUnsigned8 (3); /* Execute, store & patch 8bit expression for */ PC += 4; break; default: *opcodeptr = 112 + sourcereg; /* LD (IX|IY+d),r */ PC += 3; break; } /* end switch */ } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } /* * LD r,(HL) LD r,(IX|IY+d) LD A,(nn) */ void LD_r_8bit_indrct (int destreg) { int sourcereg; switch (sourcereg = IndirectRegisters ()) { case 2: *codeptr++ = 64 + destreg * 8 + 6; /* LD r,(HL) */ ++PC; break; case 5: case 6: if (sourcereg == 5) *codeptr++ = 221; else *codeptr++ = 253; *codeptr++ = 64 + destreg * 8 + 6; ExprSigned8 (2); PC += 3; break; case 7: /* LD A,(nn) */ if (destreg == 7) { *codeptr++ = 58; ExprAddress (1); PC += 3; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; case 0: if (destreg == 7) { /* LD A,(BC) */ *codeptr++ = 10; ++PC; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; case 1: if (destreg == 7) { /* LD A,(DE) */ *codeptr++ = 26; ++PC; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; } } void LD_address_indrct (long exprptr) { int sourcereg; long bytepos; struct expr *addrexpr; if ((addrexpr = ParseNumExpr ()) == NULL) return; /* parse to right bracket */ else RemovePfixlist (addrexpr); /* remove this expression again */ if (sym != rparen) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); /* Right bracket missing! */ return; } if (GetSym () == comma) { GetSym (); switch (sourcereg = CheckRegister16 ()) { case 2: *codeptr++ = 34; /* LD (nn),HL */ bytepos = 1; ++PC; break; case 0: case 1: /* LD (nn),dd => dd: BC,DE,SP */ case 3: *codeptr++ = 237; *codeptr++ = 67 + sourcereg * 16; bytepos = 2; PC += 2; break; case 5: /* LD (nn),IX ; LD (nn),IY */ case 6: if (sourcereg == 5) *codeptr++ = 221; else *codeptr++ = 253; *codeptr++ = 34; bytepos = 2; PC += 2; break; case -1: if (CheckRegister8 () == 7) { *codeptr++ = 50; /* LD (nn),A */ ++PC; bytepos = 1; } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return; } fseek (z80asmfile, exprptr, SEEK_SET); /* rewind fileptr to beginning of address expression */ GetSym (); ExprAddress (bytepos); /* re-parse, evaluate, etc. */ PC += 2; } void LD_16bit_reg (void) { int sourcereg, destreg; long bytepos; destreg = CheckRegister16 (); if (destreg != -1) if (GetSym () == comma) if (GetSym () == lparen) { switch (destreg) { case 4: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; case 2: *codeptr++ = 42; /* LD HL,(nn) */ bytepos = 1; ++PC; break; case 5: /* LD IX,(nn) LD IY,(nn) */ case 6: if (destreg == 5) *codeptr++ = 221; else *codeptr++ = 253; *codeptr++ = 42; bytepos = 2; PC += 2; break; default: *codeptr++ = 237; *codeptr++ = 75 + destreg * 16; bytepos = 2; PC += 2; break; } GetSym (); ExprAddress (bytepos); PC += 2; } else switch (sourcereg = CheckRegister16 ()) { case -1: /* LD rr,nn */ switch (destreg) { case 4: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; case 5: case 6: if (destreg == 5) *codeptr++ = 221; else *codeptr++ = 253; *codeptr++ = 33; bytepos = 2; PC += 2; break; default: *codeptr++ = destreg * 16 + 1; bytepos = 1; ++PC; break; } ExprAddress (bytepos); PC += 2; break; case 2: if (destreg == 3) { /* LD SP,HL */ *codeptr++ = 249; ++PC; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; case 5: /* LD SP,IX LD SP,IY */ case 6: if (destreg == 3) { if (sourcereg == 5) *codeptr++ = 221; else *codeptr++ = 253; *codeptr++ = 249; PC += 2; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } z88dk-1.8.ds1/src/z80asm/Makefile0000644000175000017500000000156107575162712016074 0ustar tygrystygrys# # $Id # OBJS = asmdrctv.o \ avltree.o \ exprprsr.o \ hist.o \ ldinstr.o \ modlink.o \ prsident.o \ prsline.o \ symbols.o \ z80asm.o \ z80instr.o \ z80pass.o all: z80asm z80asm : $(OBJS) $(CC) $(LDFLAGS) -o z80asm $(OBJS) install: install z80asm $(PREFIX)/bin/ clean : $(RM) *.o *~ core z80asm # Dependencies asmdrctv.o: asmdrctv.c symbol.h avltree.h config.h avltree.o: avltree.c avltree.h exprprsr.o: exprprsr.c symbol.h avltree.h config.h hist.o: hist.c ldinstr.o: ldinstr.c symbol.h avltree.h config.h modlink.o: modlink.c symbol.h avltree.h config.h prsident.o: prsident.c symbol.h avltree.h config.h prsline.o: prsline.c symbol.h avltree.h config.h symbols.o: symbols.c symbol.h avltree.h config.h z80asm.o: z80asm.c symbol.h avltree.h config.h z80instr.o: z80instr.c symbol.h avltree.h config.h z80pass.o: z80pass.c symbol.h avltree.h config.h z88dk-1.8.ds1/src/z80asm/modlink.c0000644000175000017500000010434607561727564016251 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/modlink.c,v 1.4 2002/11/05 11:45:56 dom Exp $ */ /* $History: MODLINK.C $ */ /* */ /* ***************** Version 16 ***************** */ /* User: Gbs Date: 26-01-00 Time: 22:10 */ /* Updated in $/Z80asm */ /* Expression range validation removed from 8bit unsigned (redundant). */ /* */ /* ***************** Version 14 ***************** */ /* User: Gbs Date: 6-06-99 Time: 20:06 */ /* Updated in $/Z80asm */ /* "PC" program counter changed to long (from unsigned short). */ /* */ /* ***************** Version 12 ***************** */ /* User: Gbs Date: 6-06-99 Time: 12:12 */ /* Updated in $/Z80asm */ /* Added Ascii Art "Z80asm" at top of source file. */ /* */ /* ***************** Version 10 ***************** */ /* User: Gbs Date: 6-06-99 Time: 11:30 */ /* Updated in $/Z80asm */ /* "config.h" included before "symbol.h" */ /* */ /* ***************** Version 9 ***************** */ /* User: Gbs Date: 30-05-99 Time: 1:00 */ /* Updated in $/Z80asm */ /* Redundant system include files removed. */ /* Createlib() rewritten to replace low I/O open() with fopen() and */ /* fread(). */ /* */ /* ***************** Version 8 ***************** */ /* User: Gbs Date: 2-05-99 Time: 18:06 */ /* Updated in $/Z80asm */ /* File IO errors now handled through new ReportIOError() function. */ /* */ /* ***************** Version 6 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 5 ***************** */ /* User: Gbs Date: 7-03-99 Time: 13:13 */ /* Updated in $/Z80asm */ /* Minor changes to keep C compiler happy. */ /* */ /* ***************** Version 3 ***************** */ /* User: Gbs Date: 4-09-98 Time: 0:10 */ /* Updated in $/Z80asm */ /* Various changes by Dominic Morris (ENDIAN #if). */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 15:10 */ /* Updated in $/Z80asm */ /* SourceSafe Version History Comment Block added. */ /* ifdef QDOS changed to ifdef ENDIAN to sort ENDIAN djm 26/6/98 */ #include #include #include #include #include "config.h" #include "symbol.h" /* external functions */ void FreeSym (symbol * node); void ReportError (char *filename, short linenr, int errnum); void ReportIOError (char *filename); void RemovePfixlist (struct expr *pfixexpr); char *AllocIdentifier (size_t len); struct module *NewModule (void); struct libfile *NewLibrary (void); struct sourcefile *Newfile (struct sourcefile *curfile, char *fname); long EvalPfixExpr (struct expr *pass2expr); int DefineDefSym (char *identifier, long value, unsigned char symtype, avltree ** root); int cmpidstr (symbol * kptr, symbol * p); int cmpidval (symbol * kptr, symbol * p); int GetChar (FILE *fptr); struct expr *ParseNumExpr (void); symbol *FindSymbol (char *identifier, avltree * symbolptr); symbol *CreateSymbol (char *identifier, long value, unsigned char symboltype, struct module *symowner); /* local functions */ int LinkModule (char *filename, long fptr_base); int LinkTracedModule (char *filename, long baseptr); int LinkLibModules (char *objfilename, long fptr_base, long startnames, long endnames); int LinkLibModule (struct libfile *library, long curmodule, char *modname); int SearchLibfile (struct libfile *curlib, char *modname); char *ReadName (void); long ReadLong (FILE * fileid); void redefinedmsg (void); void CreateLib (void); void SearchLibraries (char *modname); void WriteLong (long fptr, FILE * fileid); void LinkModules (void); void ModuleExpr (void); void CreateBinFile (void); void WriteExprMsg (void); void DefineOrigin (void); void WriteMapFile (void); void ReadNames (long nextname, long endnames); void ReadExpr (long nextexpr, long endexpr); void ReOrderSymbol (avltree * node, avltree ** maproot, int (*symcmp) (void *, void *)); void WriteMapSymbol (symbol * mapnode); void WriteGlobal (symbol * node); void CreateDeffile (void); void ReleaseLinkInfo (void); struct linklist *AllocLinkHdr (void); struct linkedmod *AllocTracedModule (void); /* global variables */ extern FILE *listfile, *mapfile, *z80asmfile, *errfile, *deffile, *libfile; extern char line[], ident[]; extern char *lstfilename, *objfilename, *errfilename, *libfilename; extern char objext[], segmbinext[], binext[], mapext[], errext[], defext[], binfilename[]; extern char Z80objhdr[]; extern enum symbols sym, GetSym (void); extern enum flag listing, writeline, symtable, mapref, z80bin, autorelocate, codesegment; extern enum flag verbose, deforigin, globaldef, EOL, library, ASMERROR, expl_binflnm; extern long PC; extern long EXPLICIT_ORIGIN; extern size_t CODESIZE; extern unsigned char *codearea, PAGELEN; extern unsigned char reloc_routine[]; extern int ASSEMBLE_ERROR, listfileptr; extern struct modules *modulehdr; extern struct liblist *libraryhdr; extern struct module *CURRENTMODULE; extern int PAGENR, TOTALERRORS; extern int TAB_DIST, COLUMN_WIDTH; extern avltree *globalroot; extern char *reloctable, *relocptr; extern size_t sizeof_relocroutine; struct linklist *linkhdr; struct libfile *CURRENTLIB; unsigned short totaladdr, curroffset, sizeof_reloctable; void ReadNames (long nextname, long endnames) { char scope, symtype; long value; symbol *foundsymbol; do { scope = fgetc (z80asmfile); symtype = fgetc (z80asmfile); /* type of name */ value = ReadLong (z80asmfile); /* read symbol (long) integer */ ReadName (); /* read symbol name */ nextname += 1 + 1 + 4 + 1 + strlen (line); switch (symtype) { case 'A': symtype = SYMADDR | SYMDEFINED; value += modulehdr->first->origin + CURRENTMODULE->startoffset; /* Absolute address */ break; case 'C': symtype = SYMDEFINED; break; } switch (scope) { case 'L': if ((foundsymbol = FindSymbol (line, CURRENTMODULE->localroot)) == NULL) { foundsymbol = CreateSymbol (line, value, symtype | SYMLOCAL, CURRENTMODULE); if (foundsymbol != NULL) insert (&CURRENTMODULE->localroot, foundsymbol, (int (*)()) cmpidstr); } else { foundsymbol->symvalue = value; foundsymbol->type |= symtype | SYMLOCAL; foundsymbol->owner = CURRENTMODULE; redefinedmsg (); } break; case 'G': if ((foundsymbol = FindSymbol (line, globalroot)) == NULL) { foundsymbol = CreateSymbol (line, value, symtype | SYMXDEF, CURRENTMODULE); if (foundsymbol != NULL) insert (&globalroot, foundsymbol, (int (*)()) cmpidstr); } else { foundsymbol->symvalue = value; foundsymbol->type |= symtype | SYMXDEF; foundsymbol->owner = CURRENTMODULE; redefinedmsg (); } break; case 'X': if ((foundsymbol = FindSymbol (line, globalroot)) == NULL) { foundsymbol = CreateSymbol (line, value, symtype | SYMXDEF | SYMDEF, CURRENTMODULE); if (foundsymbol != NULL) insert (&globalroot, foundsymbol, (int (*)()) cmpidstr); } else { foundsymbol->symvalue = value; foundsymbol->type |= symtype | SYMXDEF | SYMDEF; foundsymbol->owner = CURRENTMODULE; redefinedmsg (); } break; } } while (nextname < endnames); } void redefinedmsg (void) { printf ("Symbol <%s> redefined in module '%s'\n", line, CURRENTMODULE->mname); } void ReadExpr (long nextexpr, long endexpr) { char type; long lowbyte, highbyte, offsetptr; long constant, i, fptr; struct expr *postfixexpr; unsigned char *patchptr; do { type = fgetc (z80asmfile); lowbyte = fgetc (z80asmfile); highbyte = fgetc (z80asmfile); offsetptr = highbyte * 256U + lowbyte; /* assembler PC as absolute address */ PC = modulehdr->first->origin + CURRENTMODULE->startoffset + offsetptr; FindSymbol (ASSEMBLERPC, globalroot)->symvalue = PC; i = fgetc (z80asmfile); /* get length of infix expression */ fptr = ftell (z80asmfile); /* file pointer is at start of expression */ fgets (line, i + 1, z80asmfile); /* read string for error reference */ fseek (z80asmfile, fptr, SEEK_SET); /* reset file pointer to start of expression */ nextexpr += 1 + 1 + 1 + 1 + i + 1; EOL = OFF; /* reset end of line parsing flag - a line is to be parsed... */ GetSym (); if ((postfixexpr = ParseNumExpr ()) != NULL) { /* parse numerical expression */ if (postfixexpr->rangetype & NOTEVALUABLE) { ReportError (CURRENTFILE->fname, 0, 2); WriteExprMsg (); } else { constant = EvalPfixExpr (postfixexpr); patchptr = codearea + CURRENTMODULE->startoffset + offsetptr; /* absolute patch pos. * in memory buffer */ switch (type) { case 'U': *patchptr = (unsigned char) constant; break; case 'S': if ((constant >= -128) && (constant <= 255)) *patchptr = (char) constant; /* opcode is stored, now store * relative jump */ else { ReportError (CURRENTFILE->fname, 0, 7); WriteExprMsg (); } break; case 'C': if ((constant >= -32768) && (constant <= 65535)) { *patchptr++ = (unsigned short) constant % 256U; *patchptr = (unsigned short) constant / 256U; } else { ReportError (CURRENTFILE->fname, 0, 7); WriteExprMsg (); } if (autorelocate) if (postfixexpr->rangetype & SYMADDR) { /* Expression contains relocatable address */ constant = PC - curroffset; if ((constant >= 0) && (constant <= 255)) { *relocptr++ = (unsigned char) constant; sizeof_reloctable++; } else { *relocptr++ = 0; *relocptr++ = (unsigned short) (PC - curroffset) % 256U; *relocptr++ = (unsigned short) (PC - curroffset) / 256U; sizeof_reloctable += 3; } totaladdr++; curroffset = PC; } break; case 'L': if (constant >= LONG_MIN && constant <= LONG_MAX) for (i = 0; i < 4; i++) { *patchptr++ = constant & 255; constant >>= 8; } else { ReportError (CURRENTFILE->fname, 0, 7); WriteExprMsg (); } break; } } RemovePfixlist (postfixexpr); } else WriteExprMsg (); } while (nextexpr < endexpr); } void WriteExprMsg (void) { fprintf (errfile, "Error in expression %s\n\n", line); } void LinkModules (void) { char fheader[9]; size_t lowbyte, highbyte; struct module *lastobjmodule; symtable = listing = OFF; linkhdr = NULL; if (verbose) puts ("linking module(s)...\nPass1..."); if (autorelocate == ON) { reloctable = (char *) malloc (32768U); if (reloctable == NULL) { ReportError (NULL, 0, 3); return; /* No more room */ } else { relocptr = reloctable; relocptr += 4; /* point at first offset to store */ totaladdr = 0; sizeof_reloctable = 0; /* relocation table, still 0 elements .. */ curroffset = 0; } } CURRENTMODULE = modulehdr->first; /* begin with first module */ lastobjmodule = modulehdr->last; /* remember this last module, further modules are libraries */ if ((errfilename = AllocIdentifier (strlen (CURRENTFILE->fname) + 1)) != NULL) { strcpy (errfilename, CURRENTFILE->fname); strcpy (errfilename + strlen (errfilename) - 4, errext); /* overwrite '_asm' extension with '_err' */ } else { ReportError (NULL, 0, 3); return; /* No more room */ } if ((errfile = fopen (errfilename, "w")) == NULL) { /* open error file */ ReportIOError (errfilename); /* couldn't open relocatable file */ free (errfilename); errfilename = NULL; return; } PC = 0; if (DefineDefSym (ASSEMBLERPC, PC, 0, &globalroot) == 0) { /* Create standard 'ASMPC' identifier */ ReportError (NULL, 0, 3); /* no more room */ free (errfilename); return; } do { /* link machine code & read symbols in all modules */ if (library) { CURRENTLIB = libraryhdr->firstlib; /* begin library search from first library for each * module */ CURRENTLIB->nextobjfile = 8; /* point at first library module (past header) */ } CURRENTFILE->line = 0; /* no line references on errors during link processing */ if ((objfilename = AllocIdentifier (strlen (CURRENTFILE->fname) + 1)) != NULL) { strcpy (objfilename, CURRENTFILE->fname); strcpy (objfilename + strlen (objfilename) - 4, objext); /* overwrite '_asm' extension with * '_obj' */ } else { ReportError (NULL, 0, 3); break; /* No more room */ } if ((z80asmfile = fopen (objfilename, "rb")) != NULL) { /* open relocatable file for reading */ fread (fheader, 1U, 8U, z80asmfile); /* read first 6 chars from file into array */ fheader[8] = '\0'; } else { ReportIOError (objfilename); /* couldn't open relocatable file */ break; } if (strcmp (fheader, Z80objhdr) != 0) { /* compare header of file */ ReportError (objfilename, 0, 26); /* not a object file */ fclose (z80asmfile); z80asmfile = NULL; break; } lowbyte = fgetc (z80asmfile); highbyte = fgetc (z80asmfile); if (modulehdr->first == CURRENTMODULE) { /* origin of first module */ if (autorelocate) CURRENTMODULE->origin = 0; /* ORG 0 on auto relocation */ else { if (deforigin) CURRENTMODULE->origin = EXPLICIT_ORIGIN; /* use origin from command line */ else { CURRENTMODULE->origin = highbyte * 256U + lowbyte; if (CURRENTMODULE->origin == 65535U) DefineOrigin (); /* Define origin of first module from the keyboard */ } } if (verbose == ON) printf ("ORG address for code is %04lX\n", CURRENTMODULE->origin); } fclose (z80asmfile); LinkModule (objfilename, 0); /* link code & read name definitions */ free (objfilename); /* release allocated file name */ objfilename = NULL; CURRENTMODULE = CURRENTMODULE->nextmodule; /* get next module, if any */ } while (CURRENTMODULE != lastobjmodule->nextmodule); /* parse only object modules, not added library modules */ if (verbose == ON) printf ("Code size of linked modules is %d bytes\n", CODESIZE); if (ASMERROR == OFF) ModuleExpr (); /* Evaluate expressions in all modules */ ReleaseLinkInfo (); /* Release module link information */ fclose (errfile); if (TOTALERRORS == 0) remove (errfilename); free (errfilename); errfilename = NULL; errfile = NULL; } int LinkModule (char *filename, long fptr_base) { long fptr_namedecl, fptr_modname, fptr_modcode, fptr_libnmdecl; size_t lowbyte, highbyte, size; int flag = 0; z80asmfile = fopen (filename, "rb"); /* open object file for reading */ fseek (z80asmfile, fptr_base + 10U, SEEK_SET); fptr_modname = ReadLong (z80asmfile); /* get file pointer to module name */ ReadLong (z80asmfile); /* get file pointer to expression declarations */ fptr_namedecl = ReadLong (z80asmfile); /* get file pointer to name declarations */ fptr_libnmdecl = ReadLong (z80asmfile); /* get file pointer to library name declarations */ fptr_modcode = ReadLong (z80asmfile); /* get file pointer to module code */ if (fptr_modcode != -1) { fseek (z80asmfile, fptr_base + fptr_modcode, SEEK_SET); /* set file pointer to module code */ lowbyte = fgetc (z80asmfile); highbyte = fgetc (z80asmfile); size = lowbyte + highbyte * 256U; if (CURRENTMODULE->startoffset + size > MAXCODESIZE) { ReportError (filename, 0, 12); return 0; } else fread (codearea + CURRENTMODULE->startoffset, sizeof (char), size, z80asmfile); /* read module code */ if (CURRENTMODULE->startoffset == CODESIZE) CODESIZE += size; /* a new module has been added */ } if (fptr_namedecl != -1) { fseek (z80asmfile, fptr_base + fptr_namedecl, SEEK_SET); /* set file pointer to point at name * declarations */ if (fptr_libnmdecl != -1) ReadNames (fptr_namedecl, fptr_libnmdecl); /* Read symbols until library declarations */ else ReadNames (fptr_namedecl, fptr_modname); /* Read symbol suntil module name */ } fclose (z80asmfile); if (fptr_libnmdecl != -1) { if (library) { /* search in libraries, if present */ flag = LinkLibModules (filename, fptr_base, fptr_libnmdecl, fptr_modname); /* link library modules */ if (!flag) return 0; } } return LinkTracedModule (filename, fptr_base); /* Remember module for pass2 */ } int LinkLibModules (char *filename, long fptr_base, long nextname, long endnames) { long l; char *modname; do { z80asmfile = fopen (filename, "rb"); /* open object file for reading */ fseek (z80asmfile, fptr_base + nextname, SEEK_SET); /* set file pointer to point at library name * declarations */ ReadName (); /* read library reference name */ fclose (z80asmfile); l = strlen (line); nextname += 1 + l; /* remember module pointer to next name in this object module */ if (FindSymbol (line, globalroot) == NULL) { modname = AllocIdentifier ((size_t) l + 1); if (modname == NULL) { ReportError (NULL, 0, 3); /* Ups - system out of memory! */ return 0; } strcpy (modname, line); SearchLibraries (modname); /* search name in libraries */ free (modname); /* remove copy of module name */ } } while (nextname < endnames); return 1; } void SearchLibraries (char *modname) { int i; for (i = 0; i < 2; i++) { /* Libraries searched in max. 2 passes */ while (CURRENTLIB != NULL) { if (SearchLibfile (CURRENTLIB, modname)) return; CURRENTLIB = CURRENTLIB->nextlib; if (CURRENTLIB != NULL) if (CURRENTLIB->nextobjfile != 8) CURRENTLIB->nextobjfile = 8; /* search at start of next lib */ } /* last library read ... */ CURRENTLIB = libraryhdr->firstlib; /* start at the beginning of the first module */ CURRENTLIB->nextobjfile = 8; /* in the first library */ } } int SearchLibfile (struct libfile *curlib, char *modname) { long currentlibmodule, modulesize, fptr_mname; int flag; char *mname; z80asmfile = fopen (curlib->libfilename, "rb"); flag = 0; while (curlib->nextobjfile != -1) { /* search name in all available library modules */ do { /* point at first available module in library */ fseek (z80asmfile, curlib->nextobjfile, SEEK_SET); /* point at beginning of a module */ currentlibmodule = curlib->nextobjfile; curlib->nextobjfile = ReadLong (z80asmfile); /* get file pointer to next module in library */ modulesize = ReadLong (z80asmfile); /* get size of current module */ } while (modulesize == 0 && curlib->nextobjfile != -1); if (modulesize != 0) { /* found module name? */ fseek (z80asmfile, currentlibmodule + 4 + 4 + 8 + 2, SEEK_SET); /* point at module name file * pointer */ fptr_mname = ReadLong (z80asmfile); /* get module name file pointer */ fseek (z80asmfile, currentlibmodule + 4 + 4 + fptr_mname, SEEK_SET); /* point at module name */ mname = ReadName (); /* read module name */ if (strcmp (mname, modname) == 0) { fclose (z80asmfile); return LinkLibModule (curlib, currentlibmodule + 4 + 4, modname); } } } fclose (z80asmfile); return flag; } int LinkLibModule (struct libfile *library, long curmodule, char *modname) { struct module *tmpmodule; int flag; char *mname; tmpmodule = CURRENTMODULE; /* remember current module */ if ((CURRENTMODULE = NewModule ()) != NULL) { mname = AllocIdentifier (strlen (modname) + 1); /* get a copy of module name */ if (mname != NULL) { strcpy (mname, modname); CURRENTMODULE->mname = mname; /* create new module for library */ CURRENTFILE = Newfile (NULL, library->libfilename); /* filename for 'module' */ if (verbose) printf ("Linking library module <%s>\n", modname); flag = LinkModule (library->libfilename, curmodule); /* link module & read names */ } else { ReportError (NULL, 0, 3); flag = 0; } } else flag = 0; CURRENTMODULE = tmpmodule; /* restore previous current module */ return flag; } char * ReadName (void) { size_t strlength; strlength = fgetc (z80asmfile); fread (line, sizeof (char), strlength, z80asmfile); /* read name */ line[strlength] = '\0'; return line; } void ModuleExpr (void) { long fptr_namedecl, fptr_modname, fptr_exprdecl, fptr_libnmdecl; long fptr_base; struct linkedmod *curlink; if (verbose) puts ("Pass2..."); curlink = linkhdr->firstlink; do { CURRENTMODULE = curlink->moduleinfo; fptr_base = curlink->modulestart; if ((z80asmfile = fopen (curlink->objfilename, "rb")) != NULL) { /* open relocatable file for reading */ fseek (z80asmfile, fptr_base + 10, SEEK_SET); /* point at module name pointer */ fptr_modname = ReadLong (z80asmfile); /* get file pointer to module name */ fptr_exprdecl = ReadLong (z80asmfile); /* get file pointer to expression declarations */ fptr_namedecl = ReadLong (z80asmfile); /* get file pointer to name declarations */ fptr_libnmdecl = ReadLong (z80asmfile); /* get file pointer to library name declarations */ } else { ReportIOError (curlink->objfilename); /* couldn't open relocatable file */ return; } if (fptr_exprdecl != -1) { fseek (z80asmfile, fptr_base + fptr_exprdecl, SEEK_SET); if (fptr_namedecl != -1) ReadExpr (fptr_exprdecl, fptr_namedecl); /* Evaluate until beginning of name * declarations */ else if (fptr_libnmdecl != -1) ReadExpr (fptr_exprdecl, fptr_libnmdecl); /* Evaluate until beginning of library * reference declarations */ else ReadExpr (fptr_exprdecl, fptr_modname); /* Evaluate until beginning of module name */ } fclose (z80asmfile); z80asmfile = NULL; curlink = curlink->nextlink; } while (curlink != NULL); } void CreateBinFile (void) { char *tmpstr; char binfilenumber = '0'; FILE *binaryfile; unsigned short codeblock, offset; if (expl_binflnm == ON) /* use predined output filename from command line */ tmpstr = binfilename; else { /* create output filename, based on project filename */ tmpstr = modulehdr->first->cfile->fname; /* get source filename from first module */ if (codesegment == ON && CODESIZE > 16384) strcpy (tmpstr + strlen (tmpstr) - 4, segmbinext); /* replace '.asm' with '.bn0' extension */ else strcpy (tmpstr + strlen (tmpstr) - 4, binext); /* replace '.asm' with '.bin' extension */ } binaryfile = fopen (tmpstr, "wb"); /* binary output to srcfilename.bin */ if (binaryfile != NULL) { if (autorelocate == ON && totaladdr != 0) { fwrite (reloc_routine, sizeof (char), sizeof_relocroutine, binaryfile); /* relocate routine */ *(reloctable + 0) = (unsigned short) totaladdr % 256U; *(reloctable + 1) = (unsigned short) totaladdr / 256U; /* total of relocation elements */ *(reloctable + 2) = (unsigned short) sizeof_reloctable % 256U; *(reloctable + 3) = (unsigned short) sizeof_reloctable / 256U;/* total size of relocation table elements */ fwrite (reloctable, 1U, sizeof_reloctable + 4, binaryfile); /* write relocation table, inclusive 4 byte header */ printf ("Relocation header is %d bytes.\n", sizeof_relocroutine + sizeof_reloctable + 4); fwrite (codearea, sizeof (char), CODESIZE, binaryfile); /* write code as one big chunk */ fclose (binaryfile); } else if (codesegment == ON && CODESIZE > 16384) { fclose (binaryfile); offset = 0; do { codeblock = (CODESIZE / 16384U) ? 16384U : CODESIZE % 16384U; CODESIZE -= codeblock; tmpstr[strlen (tmpstr) - 1] = binfilenumber++; /* path code file with number */ binaryfile = fopen (tmpstr, "wb"); if (binaryfile != NULL) { fwrite (codearea + offset, sizeof (char), codeblock, binaryfile); /* code in 16K chunks */ fclose (binaryfile); } offset += codeblock; } while (CODESIZE); } else { fwrite (codearea, sizeof (char), CODESIZE, binaryfile); /* write code as one big chunk */ fclose (binaryfile); } if (verbose) puts ("Code generation completed."); } else ReportIOError (tmpstr); } void CreateLib (void) { long Codesize; FILE *objectfile = NULL; long fptr; char *filebuffer, *fname; if (verbose) puts ("Creating library..."); CURRENTMODULE = modulehdr->first; if ((errfilename = AllocIdentifier (strlen (libfilename) + 1)) != NULL) { strcpy (errfilename, libfilename); strcpy (errfilename + strlen (errfilename) - 4, errext); /* overwrite '_lib' extension with '_err' */ } else { ReportError (NULL, 0, 3); return; /* No more room */ } if ((errfile = fopen (errfilename, "w")) == NULL) { /* open error file */ ReportIOError (errfilename); free (errfilename); errfilename = NULL; return; } do { fname = CURRENTFILE->fname; strcpy (fname + strlen (fname) - 4, objext); /* overwrite '_asm' extension with '_obj' */ if ((objectfile = fopen (CURRENTFILE->fname, "rb")) != NULL) { fseek(objectfile, 0L, SEEK_END); /* file pointer to end of file */ Codesize = ftell(objectfile); fseek(objectfile, 0L, SEEK_SET); /* file pointer to start of file */ filebuffer = (char *) malloc ((size_t) Codesize); if (filebuffer == NULL) { ReportError (CURRENTFILE->fname, 0, 3); fclose (objectfile); break; } fread (filebuffer, sizeof (char), Codesize, objectfile); /* load object file */ fclose (objectfile); if (memcmp (filebuffer, Z80objhdr, 8U) == 0) { if (verbose) printf ("<%s> module at %04lX.\n", CURRENTFILE->fname, ftell (libfile)); if (CURRENTMODULE->nextmodule == NULL) WriteLong (-1, libfile); /* this is the last module */ else { fptr = ftell (libfile) + 4 + 4; WriteLong (fptr + Codesize, libfile); /* file pointer to next module */ } WriteLong (Codesize, libfile); /* size of this module */ fwrite (filebuffer, sizeof (char), (size_t) Codesize, libfile); /* write module to library */ free (filebuffer); } else { free (filebuffer); ReportError (CURRENTFILE->fname, 0, 26); break; } } else { ReportError (CURRENTFILE->fname, 0, 0); break; } CURRENTMODULE = CURRENTMODULE->nextmodule; } while (CURRENTMODULE != NULL); fclose (errfile); errfile = NULL; if (ASMERROR == OFF) remove (errfilename); /* no errors */ free (errfilename); errfilename = NULL; } int LinkTracedModule (char *filename, long baseptr) { struct linkedmod *newm; char *fname; if (linkhdr == NULL) { if ((linkhdr = AllocLinkHdr ()) == NULL) { ReportError (NULL, 0, 3); return 0; } else { linkhdr->firstlink = NULL; linkhdr->lastlink = NULL; /* Library header initialised */ } } fname = AllocIdentifier (strlen (filename) + 1); /* get a copy module file name */ if (fname != NULL) strcpy (fname, filename); else { ReportError (NULL, 0, 3); return 0; } if ((newm = AllocTracedModule ()) == NULL) { free (fname); /* release redundant copy of filename */ ReportError (NULL, 0, 3); return 0; } else { newm->nextlink = NULL; newm->objfilename = fname; newm->modulestart = baseptr; newm->moduleinfo = CURRENTMODULE; /* pointer to current (active) module structure */ } if (linkhdr->firstlink == NULL) { linkhdr->firstlink = newm; linkhdr->lastlink = newm; /* First module trace information */ } else { linkhdr->lastlink->nextlink = newm; /* current/last linked module points now at new current */ linkhdr->lastlink = newm; /* pointer to current linked module updated */ } return 1; } long ReadLong (FILE * fileid) { #ifdef ENDIAN /* high byte, low byte order... */ int i; unsigned long c, fptr = 0; for (i = 1; i <= 3; i++) { fptr |= fgetc (fileid) << 24; fptr >>= 8; } fptr |= fgetc (fileid) << 24; return fptr; #else /* low byte, high byte order... */ long fptr = 0; /* long is *at least* 4 bytes long, and we have to write exactly 4 bytes */ fread (&fptr, 4, 1, fileid); return fptr; #endif } void WriteLong (long fptr, FILE * fileid) { #ifdef ENDIAN /* high byte, low byte order... */ int i; for (i = 0; i < 4; i++) { fputc (fptr & 255, fileid); fptr >>= 8; } #else /* low byte, high byte order... */ /* long is *at least* 4 bytes long, and we have to write exactly 4 bytes */ fwrite (&fptr, 4, 1, fileid); #endif } void DefineOrigin (void) { printf ("ORG not yet defined!\nPlease enter as hexadecimal: "); scanf ("%lx", &modulehdr->first->origin); } void CreateDeffile (void) { char *globaldefname; /* use first module filename to create global definition file */ if ((globaldefname = AllocIdentifier (strlen (modulehdr->first->cfile->fname) + 1)) != NULL) { strcpy (globaldefname, modulehdr->first->cfile->fname); strcpy (globaldefname + strlen (globaldefname) - 4, defext); /* overwrite '_asm' extension with * '_def' */ if ((deffile = fopen (globaldefname, "w")) == NULL) { /* Create DEFC file with global label declarations */ ReportIOError (globaldefname); globaldef = OFF; } } else { ReportError (NULL, 0, 3); globaldef = OFF; } free (globaldefname); globaldefname = NULL; } void WriteMapFile (void) { avltree *maproot = NULL, *newmaproot = NULL; struct module *cmodule; char *mapfilename; cmodule = modulehdr->first; /* begin with first module */ if ((mapfilename = AllocIdentifier (strlen (cmodule->cfile->fname) + 1)) != NULL) { strcpy (mapfilename, cmodule->cfile->fname); strcpy (mapfilename + strlen (mapfilename) - 4, mapext); /* overwrite '_asm' extension with '_map' */ } else { ReportError (NULL, 0, 3); return; /* No more room */ } if ((mapfile = fopen (mapfilename, "w")) != NULL) { /* Create MAP file */ if (verbose) puts ("Creating map..."); do { move (&cmodule->localroot, &maproot, (int (*)()) cmpidstr); /* move all local address symbols alphabetically */ cmodule = cmodule->nextmodule; /* alphabetically */ } while (cmodule != NULL); move (&globalroot, &maproot, (int (*)()) cmpidstr); /* move all global address symbols alphabetically */ if (maproot == NULL) fputs ("None.\n", mapfile); else { inorder (maproot, (void (*)()) WriteMapSymbol); /* Write map symbols alphabetically */ move (&maproot, &newmaproot, (int (*)()) cmpidval); /* then re-order symbols numerically */ fputs ("\n\n", mapfile); inorder (newmaproot, (void (*)()) WriteMapSymbol); /* Write map symbols numerically */ deleteall (&newmaproot, (void (*)()) FreeSym); /* then release all map symbols */ } fclose (mapfile); } else { ReportIOError (mapfilename); return; } free (mapfilename); } void WriteMapSymbol (symbol * mapnode) { int tabulators, space; if (mapnode->type & SYMADDR) { fprintf (mapfile, "%s", mapnode->symname); space = COLUMN_WIDTH - strlen (mapnode->symname); for (tabulators = space % TAB_DIST ? space / TAB_DIST + 1 : space / TAB_DIST; tabulators > 0; tabulators--) fputc ('\t', mapfile); if (autorelocate) fprintf (mapfile, "= %04lX, ", sizeof_relocroutine + sizeof_reloctable + 4 + mapnode->symvalue); else fprintf (mapfile, "= %04lX, ", mapnode->symvalue); if (mapnode->type & SYMLOCAL) fputc ('L', mapfile); else fputc ('G', mapfile); fprintf (mapfile, ": %s\n", mapnode->owner->mname); } } void WriteGlobal (symbol * node) { int tabulators, space; if ((node->type & SYMTOUCHED) && (node->type & SYMADDR) && (node->type & SYMXDEF) && !(node->type & SYMDEF)) { /* Write only global definitions - not library routines */ fprintf (deffile, "DEFC %s", node->symname); space = COLUMN_WIDTH - 5 - strlen (node->symname); for (tabulators = space % TAB_DIST ? space / TAB_DIST + 1 : space / TAB_DIST; tabulators > 0; tabulators--) fputc ('\t', deffile); fprintf (deffile, "= $%04lX; ", node->symvalue + modulehdr->first->origin + CURRENTMODULE->startoffset); fprintf (deffile, "Module %s\n", node->owner->mname); } } void ReleaseLinkInfo (void) { struct linkedmod *m, *n; if (linkhdr == NULL) return; m = linkhdr->firstlink; do { if (m->objfilename != NULL) free (m->objfilename); n = m->nextlink; free (m); m = n; } while (m != NULL); free (linkhdr); linkhdr = NULL; } struct linklist * AllocLinkHdr (void) { return (struct linklist *) malloc (sizeof (struct linklist)); } struct linkedmod * AllocTracedModule (void) { return (struct linkedmod *) malloc (sizeof (struct linkedmod)); } z88dk-1.8.ds1/src/z80asm/prsident.c0000644000175000017500000003777210635222017016427 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/prsident.c,v 1.8 2007/06/17 12:07:43 dom Exp $ */ /* $History: PRSIDENT.C $ */ /* */ /* ***************** Version 14 ***************** */ /* User: Gbs Date: 30-01-00 Time: 12:51 */ /* Updated in $/Z80asm */ /* Bug fix from v1.0.14 where IF, ELSE & ENDIF id's were wrong in */ /* ParseIdent () due to new CALL_PKG pseudo macro. */ /* */ /* ***************** Version 13 ***************** */ /* User: Gbs Date: 30-09-99 Time: 22:39 */ /* Updated in $/Z80asm */ /* CALL_PKG hard coded macro implemented for Garry Lancaster's Package */ /* System. */ /* */ /* ***************** Version 11 ***************** */ /* User: Gbs Date: 6-06-99 Time: 20:06 */ /* Updated in $/Z80asm */ /* "PC" program counter changed to long (from unsigned short). */ /* */ /* ***************** Version 9 ***************** */ /* User: Gbs Date: 6-06-99 Time: 12:13 */ /* Updated in $/Z80asm */ /* Added Ascii Art "Z80asm" at top of source file. */ /* */ /* ***************** Version 7 ***************** */ /* User: Gbs Date: 6-06-99 Time: 11:30 */ /* Updated in $/Z80asm */ /* "config.h" included before "symbol.h" */ /* */ /* ***************** Version 5 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 4 ***************** */ /* User: Gbs Date: 7-03-99 Time: 13:13 */ /* Updated in $/Z80asm */ /* Minor changes to keep C compiler happy. */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 15:04 */ /* Updated in $/Z80asm */ /* SUB, AND, OR, XOR and CP instruction improved with alternative syntax: */ /* " [A,]xxx", allowing for specification of accumulator. This */ /* makes all accumulator related instructions equal in syntax and removes */ /* ambiguity. */ #include #include #include #include "config.h" #include "symbol.h" /* external functions */ void Skipline (FILE *fptr); void ReportError (char *filename, short linenr, int errnum); void Subroutine_addr (int opc0, int opc); void JP_instr (int opc0, int opc); void PushPop_instr (int opcode); void RotShift_instr (int opcode); void BitTest_instr (int opcode); void ArithLog8_instr (int opcode); void DeclSymGlobal (char *identifier, unsigned char libtype); void DeclSymExtern (char *identifier, unsigned char libtype); void DeclModuleName (void); void DefSym (void); void ifstatement (enum flag interpret); void DEFVARS (void), DEFS (void), ORG (void), IncludeFile (void), BINARY (void), CALLOZ (void), CALLPKG (void), FPP (void); void ADC (void), ADD (void), DEC (void), IM (void), IN (void), INC (void), INVOKE (void); void JR (void), LD (void), OUT (void), RET (void), SBC (void); void DEFB (void), DEFC (void), DEFM (void), DEFW (void), DEFL (void), DEFP (void); void RST (void), DEFGROUP (void); long GetConstant(char *); int CheckRegister8 (void); void UnDefineSym(void); /* local functions */ void ParseIdent (enum flag interpret); void AND (void), BIT (void), CALL (void), CCF (void), CP (void), CPD (void); void CPDR (void), CPI (void), CPIR (void), CPL (void), DAA (void); void DI (void), DJNZ (void); void EI (void), EX (void), EXX (void), HALT (void); void IND (void); void INDR (void), INI (void), INIR (void), JP (void); void LDD (void), LDDR (void); void LDI (void), LDIR (void), NEG (void), NOP (void), OR (void), OTDR (void), OTIR (void); void OUTD (void), OUTI (void), POP (void), PUSH (void), RES (void); void RETI (void), RETN (void); void RL (void), RLA (void), RLC (void), RLCA (void), RLD (void), RR (void), RRA (void), RRC (void); void RRCA (void), RRD (void); void SCF (void), SET (void), SLA (void), SLL (void), SRA (void); void SRL (void), SUB (void), XOR (void); void DeclExternIdent (void), DeclGlobalIdent (void), ListingOn (void), ListingOff (void); void DeclLibIdent (void), DeclGlobalLibIdent (void); void IFstat (void), ELSEstat (void), ENDIFstat (void); void DeclModule (void); void LINE (void); void SetTemporaryLine(char *line); /* global variables */ extern FILE *z80asmfile; extern enum symbols sym, GetSym (void); extern enum flag listing, writeline, listing_CPY, EOL; extern char ident[], line[]; extern long PC; extern unsigned char *codeptr; extern struct module *CURRENTMODULE; extern long clineno; extern enum flag rcmX000; typedef void (*ptrfunc) (void); /* ptr to function returning void */ typedef int (*fptr) (const void *, const void *); struct Z80sym { char *z80mnem; ptrfunc z80func; }; struct Z80sym Z80ident[] = { {"ADC", ADC}, /* 0 */ {"ADD", ADD}, {"AND", AND}, {"BINARY", BINARY}, {"BIT", BIT}, {"CALL", CALL}, /* 5 */ {"CALL_OZ", CALLOZ}, {"CALL_PKG", CALLPKG}, {"CCF", CCF}, {"CP", CP}, {"CPD", CPD}, /* 10 */ {"CPDR", CPDR}, {"CPI", CPI}, {"CPIR", CPIR}, {"CPL", CPL}, {"DAA", DAA}, /* 15 */ {"DEC", DEC}, {"DEFB", DEFB}, {"DEFC", DEFC}, {"DEFGROUP", DEFGROUP}, {"DEFINE", DefSym}, /* 20 */ {"DEFL", DEFL}, {"DEFM", DEFM}, {"DEFP", DEFP}, {"DEFS", DEFS}, {"DEFVARS", DEFVARS}, /* 25 */ {"DEFW", DEFW}, {"DI", DI}, {"DJNZ", DJNZ}, {"EI", EI}, {"ELSE", ELSEstat}, /* 30 */ {"ENDIF", ENDIFstat}, {"EX", EX}, {"EXX", EXX}, {"FPP", FPP}, {"HALT", HALT}, /* 35 */ {"IF", IFstat}, {"IM", IM}, {"IN", IN}, {"INC", INC}, {"INCLUDE", IncludeFile}, /* 40 */ {"IND", IND}, {"INDR", INDR}, {"INI", INI}, {"INIR", INIR}, {"INVOKE", INVOKE}, /* 45 */ {"JP", JP}, {"JR", JR}, {"LD", LD}, {"LDD", LDD}, {"LDDR", LDDR}, /* 50 */ {"LDI", LDI}, {"LDIR", LDIR}, {"LIB", DeclLibIdent}, {"LINE", LINE}, {"LSTOFF", ListingOff}, /* 55 */ {"LSTON", ListingOn}, {"MODULE", DeclModule}, {"NEG", NEG}, {"NOP", NOP}, {"OR", OR}, /* 60 */ {"ORG", ORG}, {"OTDR", OTDR}, {"OTIR", OTIR}, {"OUT", OUT}, {"OUTD", OUTD}, /* 65 */ {"OUTI", OUTI}, {"OZ", CALLOZ}, {"POP", POP}, {"PUSH", PUSH}, {"RES", RES}, /* 70 */ {"RET", RET}, {"RETI", RETI}, {"RETN", RETN}, {"RL", RL}, {"RLA", RLA}, /* 75 */ {"RLC", RLC}, {"RLCA", RLCA}, {"RLD", RLD}, {"RR", RR}, {"RRA", RRA}, /* 80 */ {"RRC", RRC}, {"RRCA", RRCA}, {"RRD", RRD}, {"RST", RST}, {"SBC", SBC}, /* 85 */ {"SCF", SCF}, {"SET", SET}, {"SLA", SLA}, {"SLL", SLL}, {"SRA", SRA}, /* 90 */ {"SRL", SRL}, {"SUB", SUB}, {"UNDEFINE",UnDefineSym}, {"XDEF", DeclGlobalIdent}, {"XLIB", DeclGlobalLibIdent}, /* 95 */ {"XOR", XOR}, {"XREF", DeclExternIdent} }; size_t totalz80id = sizeof(Z80ident) / sizeof(Z80ident[0]); int idcmp (const char *idptr, const struct Z80sym *symptr) { return strcmp (idptr, symptr->z80mnem); } int SearchId (void) { struct Z80sym *foundsym; foundsym = (struct Z80sym *) bsearch (ident, Z80ident, totalz80id, sizeof (struct Z80sym), (fptr) idcmp); if (foundsym == NULL) return -1; else return foundsym - Z80ident; } void ParseIdent (enum flag interpret) { int id; if ((id = SearchId ()) == -1 && interpret == ON) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 10); } else { switch (id) { case 36: /* IF */ if (interpret == OFF) Skipline (z80asmfile); /* skip current line until EOL */ ifstatement (interpret); break; case 30: /* ELSE */ case 31: /* ENDIF */ (Z80ident[id].z80func) (); Skipline (z80asmfile); break; default: if (interpret == ON) { (Z80ident[id].z80func) (); } Skipline (z80asmfile); /* skip current line until EOL */ } } } void ListingOn (void) { if (listing_CPY == ON) { listing = ON; /* switch listing ON again... */ writeline = OFF; /* but don't write this line in listing file */ line[0] = '\0'; } } void ListingOff (void) { if (listing_CPY == ON) { listing = writeline = OFF; /* but don't write this line in listing file */ line[0] = '\0'; } } /* Function for Line number in C source */ void LINE(void) { char err; GetSym(); clineno=GetConstant(&err); line[0]='\0'; } /* dummy function - not used */ void IFstat (void) { } void ELSEstat (void) { sym = elsestatm; writeline = OFF; /* but don't write this line in listing file */ } void ENDIFstat (void) { sym = endifstatm; writeline = OFF; /* but don't write this line in listing file */ } void DeclGlobalIdent (void) { do { if (GetSym () == name) DeclSymGlobal (ident, 0); else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return; } } while (GetSym () == comma); if (sym != newline) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } void DeclGlobalLibIdent (void) { if (GetSym () == name) { DeclModuleName (); /* XLIB name is implicit MODULE name */ DeclSymGlobal (ident, SYMDEF); } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return; } } void DeclExternIdent (void) { do { if (GetSym () == name) DeclSymExtern (ident, 0); /* Define symbol as extern */ else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return; } } while (GetSym () == comma); if (sym != newline) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } void DeclLibIdent (void) { do { if (GetSym () == name) { DeclSymExtern (ident, SYMDEF); /* Define symbol as extern LIB reference */ } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return; } } while (GetSym () == comma); if (sym != newline) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } void DeclModule (void) { GetSym (); DeclModuleName (); } void NOP (void) { *codeptr++ = 0; ++PC; } void HALT (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 118; ++PC; } void LDI (void) { *codeptr++ = 237; *codeptr++ = 160; PC += 2; } void LDIR (void) { *codeptr++ = 237; *codeptr++ = 176; PC += 2; } void LDD (void) { *codeptr++ = 237; *codeptr++ = 168; PC += 2; } void LDDR (void) { *codeptr++ = 237; *codeptr++ = 184; PC += 2; } void CPI (void) { if (rcmX000) { SetTemporaryLine("\ncall rcmx_cpi\n"); return; } *codeptr++ = 237; *codeptr++ = 161; PC += 2; } void CPIR (void) { if (rcmX000) { SetTemporaryLine("\ncall rcmx_cpir\n"); return; } *codeptr++ = 237; *codeptr++ = 177; PC += 2; } void CPD (void) { if (rcmX000) { SetTemporaryLine("\ncall rcmx_cpd\n"); ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 237; *codeptr++ = 169; PC += 2; } void CPDR (void) { if (rcmX000) { SetTemporaryLine("\ncall rcmx_cpdr\n"); return; } *codeptr++ = 237; *codeptr++ = 185; PC += 2; } void IND (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 237; *codeptr++ = 170; PC += 2; } void INDR (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 237; *codeptr++ = 186; PC += 2; } void INI (void) { *codeptr++ = 237; *codeptr++ = 162; PC += 2; } void INIR (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 237; *codeptr++ = 178; PC += 2; } void OUTI (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 237; *codeptr++ = 163; PC += 2; } void OUTD (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 237; *codeptr++ = 171; PC += 2; } void OTIR (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 237; *codeptr++ = 179; PC += 2; } void OTDR (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 237; *codeptr++ = 187; PC += 2; } /* * Allow specification of " [A,]xxx" * in SUB, AND, OR, XOR, CP instructions */ void ExtAccumulator (int opcode) { long fptr; fptr = ftell (z80asmfile); if (GetSym () == name) { if (CheckRegister8 () == 7) { if (GetSym () == comma) { /* A, ... */ ArithLog8_instr (opcode); return; } } } /* reparse and code generate (if possible) */ sym = nil; EOL = OFF; fseek (z80asmfile, fptr, SEEK_SET); ArithLog8_instr (opcode); } void CP (void) { ExtAccumulator (7); } void AND (void) { ExtAccumulator (4); } void OR (void) { ExtAccumulator (6); } void XOR (void) { ExtAccumulator (5); } void SUB (void) { ExtAccumulator (2); } void SET (void) { BitTest_instr (192); } void RES (void) { BitTest_instr (128); } void BIT (void) { BitTest_instr (64); } void RLC (void) { RotShift_instr (0); } void RRC (void) { RotShift_instr (1); } void RL (void) { RotShift_instr (2); } void RR (void) { RotShift_instr (3); } void SLA (void) { RotShift_instr (4); } void SRA (void) { RotShift_instr (5); } void SLL (void) { RotShift_instr (6); } void SRL (void) { RotShift_instr (7); } void CPL (void) { *codeptr++ = 47; ++PC; } void RLA (void) { *codeptr++ = 23; ++PC; } void RRA (void) { *codeptr++ = 31; ++PC; } void RRCA (void) { *codeptr++ = 15; ++PC; } void RLCA (void) { *codeptr++ = 7; ++PC; } void EXX (void) { *codeptr++ = 217; ++PC; } void PUSH (void) { PushPop_instr (197); } void POP (void) { PushPop_instr (193); } void RETI (void) { *codeptr++ = 237; *codeptr++ = 77; PC += 2; } void RETN (void) { *codeptr++ = 237; *codeptr++ = 69; PC += 2; } void RLD (void) { if (rcmX000) { SetTemporaryLine("\ncall rcmx_rld\n"); return; } *codeptr++ = 237; *codeptr++ = 111; PC += 2; } void RRD (void) { if (rcmX000) { SetTemporaryLine("\ncall rcmx_rrd\n"); return; } *codeptr++ = 237; *codeptr++ = 103; PC += 2; } void NEG (void) { *codeptr++ = 237; *codeptr++ = 68; PC += 2; } void CALL (void) { Subroutine_addr (205, 196); } void JP (void) { JP_instr (195, 194); } void CCF (void) { *codeptr++ = 63; ++PC; } void SCF (void) { *codeptr++ = 55; ++PC; } void DI (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 243; ++PC; } void EI (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 251; ++PC; } void DAA (void) { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } *codeptr++ = 39; ++PC; } z88dk-1.8.ds1/src/z80asm/prsline.c0000644000175000017500000003312710635222017016241 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/prsline.c,v 1.10 2007/06/17 12:07:43 dom Exp $ */ /* $History: PRSLINE.C $ */ /* */ /* ***************** Version 8 ***************** */ /* User: Gbs Date: 6-06-99 Time: 12:13 */ /* Updated in $/Z80asm */ /* Added Ascii Art "Z80asm" at top of source file. */ /* */ /* ***************** Version 6 ***************** */ /* User: Gbs Date: 6-06-99 Time: 11:30 */ /* Updated in $/Z80asm */ /* "config.h" included before "symbol.h" */ /* */ /* ***************** Version 4 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 15:02 */ /* Updated in $/Z80asm */ /* GetSym() and Skipline() improved with EOF handling. */ #include #include #include #include #include "config.h" #include "symbol.h" /* external functions */ void ReportError (char *filename, short linenr, int errnum); /* local functions */ long GetConstant (char *evalerr); int IndirectRegisters (void); int CheckRegister16 (void); int CheckRegister8 (void); int CheckCondition (void); int GetChar (FILE *fptr); enum symbols GetSym (void); void Skipline (FILE *fptr); int CheckBaseType(int chcount); /* global variables */ extern FILE *z80asmfile; extern char ident[]; extern char separators[]; extern enum symbols sym, ssym[]; extern short currentline; extern struct module *CURRENTMODULE; extern enum flag EOL, swapIXIY; enum flag rcmX000; char *temporary_start; char *temporary_ptr = NULL; void UnGet(int c, FILE *fp) { if ( temporary_ptr ) { temporary_ptr--; } else { ungetc(c,fp); } } void SetTemporaryLine(char *line) { temporary_start = temporary_ptr = line; } /* get a character from file with CR/LF/CRLF parsing capability. * * return '\n' byte if a CR/LF/CRLF variation line feed is found * */ int GetChar (FILE *fptr) { int c; if ( temporary_ptr != NULL ) { if ( *temporary_ptr != 0 ) { c = *temporary_ptr++; return c; } temporary_ptr = NULL; } c = fgetc (fptr); if (c == 13) { /* Mac/Z88 line feed found,poll for MSDOS line feed */ c = fgetc (fptr); if (c != 10) ungetc (c, fptr); /* push non-line-feed character back into file stream */ c = '\n'; /* always return the symbolic '\n' for line feed */ } else if (c == 10) c = '\n'; /* UNIX/QDOS line feed */ return c; /* return all other characters */ } enum symbols GetSym (void) { char *instr; int c, i, chcount = 0; ident[0] = '\0'; if (EOL == ON) { sym = newline; return sym; } for (;;) { /* Ignore leading white spaces, if any... */ if (feof (z80asmfile)) { sym = newline; EOL = ON; return newline; } else { c = GetChar (z80asmfile); if ((c == '\n') || (c == EOF) || (c == '\x1A')) { sym = newline; EOL = ON; return newline; } else if (!isspace (c)) break; } } instr = strchr (separators, c); if (instr != NULL) { sym = ssym[instr - separators]; /* index of found char in separators[] */ if (sym == semicolon) { Skipline (z80asmfile); /* ignore comment line, prepare for next line */ sym = newline; } return sym; } ident[chcount++] = (char) toupper (c); switch (c) { case '$': sym = hexconst; break; case '@': case '%': sym = binconst; break; case '#': sym = name; break; default: if (isdigit (c)) { sym = decmconst; /* a decimal number found */ } else { if (isalpha (c) || c == '_' ) { sym = name; /* an identifier found */ } else { sym = nil; /* rubbish ... */ } } break; } /* Read identifier until space or legal separator is found */ if (sym == name) { for (;;) { if (feof (z80asmfile)) { break; } else { c = GetChar (z80asmfile); if ((c != EOF) && (!iscntrl (c)) && (strchr (separators, c) == NULL)) { if (!isalnum (c)) { if (c != '_') { sym = nil; break; } else { ident[chcount++] = '_'; /* underscore in identifier */ } } else { ident[chcount++] = (char) toupper (c); } } else { if ( c != ':' ) UnGet (c, z80asmfile); /* puch character back into stream for next read */ else sym = label; break; } } } chcount = CheckBaseType(chcount); } else { for (;;) { if (feof (z80asmfile)) { break; } else { c = GetChar (z80asmfile); if ((c != EOF) && !iscntrl (c) && (strchr (separators, c) == NULL)) { ident[chcount++] = c; } else { UnGet (c, z80asmfile); /* puch character back into stream for next read */ break; } } } chcount = CheckBaseType(chcount); } ident[chcount] = '\0'; return sym; } int CheckBaseType(int chcount) { int i; if ( !isxdigit(ident[0]) || chcount < 2 ) /* If it's not a hex digit straight off then reject it */ return chcount; /* C style hex number */ if ( chcount > 2 && strncmp(ident,"0x",2) == 0 ) { for ( i = 2; i < chcount; i++ ) { if ( !isxdigit(ident[i]) ) break; } if ( i == chcount ) { for ( i = 2; i < chcount ; i++ ) ident[i-1] = ident[i]; ident[0] = '$'; sym = hexconst; return ( chcount - 1 ); } } /* Check for this to be a hex num here */ for ( i = 0; i < chcount ; i++ ) { if ( !isxdigit(ident[i]) ) break; } if ( i == ( chcount - 1) ) { if ( toupper(ident[i]) == 'H' ) { for ( i = (chcount-1); i >= 0 ; i-- ) ident[i+1] = ident[i]; ident[0] = '$'; sym = hexconst; return chcount; } else { return chcount; /* If we reached end of hex digits and the last one wasn't a 'h', then something is wrong, so return */ } } /* Check for binary constant (ends in b) */ for ( i = 0; i < chcount ; i++ ) { if ( ident[i] != '0' && ident[i] != '1' ) break; } if ( i == ( chcount - 1) && toupper(ident[i]) == 'B' ) { for ( i = (chcount-1); i >= 0 ; i-- ) ident[i+1] = ident[i]; ident[0] = '@'; sym = binconst; return chcount; } /* Check for decimal (we default to it in anycase..but */ for ( i = 0; i < chcount ; i++ ) { if ( !isdigit(ident[i]) ) break; } if ( i == ( chcount - 1) && toupper(ident[i]) == 'D' ) { sym = decmconst; return chcount-1; } return chcount; } void Skipline (FILE *fptr) { int c; if (EOL == OFF) { while (!feof (fptr)) { c = GetChar (fptr); if ((c == '\n') || (c == EOF)) break; /* get to beginning of next line... */ } EOL = ON; } } int CheckCondition (void) { switch (*ident) { case 'Z': /* is it zero flag ? */ if (*(ident + 1) == '\0') return (1); else return -1; case 'N': /* is it NZ, NC ? */ if (*(ident + 2) == '\0') switch (*(ident + 1)) { case 'Z': return (0); case 'C': return (2); default: return (-1); } else return -1; case 'C': /* is it carry flag ? */ if (*(ident + 1) == '\0') return (3); else return -1; case 'P': switch (*(ident + 1)) { case '\0': return (6); /* P */ case 'O': if (*(ident + 2) == '\0') return (4); /* PO */ else return -1; case 'E': if (*(ident + 2) == '\0') return (5); /* PO */ else return (-1); default: return (-1); } case 'M': /* is it minus flag ? */ if (*(ident + 1) == '\0') return (7); else return -1; default: return -1; } } int CheckRegister8 (void) { if (sym == name) if (*(ident + 1) == '\0') { switch (*ident) { case 'A': return 7; case 'H': return 4; case 'B': return 0; case 'L': return 5; case 'C': return 1; case 'D': return 2; case 'E': return 3; case 'I': { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return -1; } return 8; } case 'R': { if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return -1; } return 9; } case 'F': return 6; } } else { if (strcmp (ident, "IXL") == 0) { if (swapIXIY == ON) return (16 + 5); else return (8 + 5); } else if (strcmp (ident, "IXH") == 0) { if (swapIXIY == ON) return (16 + 4); else return (8 + 4); } else if (strcmp (ident, "IYL") == 0) { if (swapIXIY == ON) return (8 + 5); else return (16 + 5); } else if (strcmp (ident, "IYH") == 0) { if (swapIXIY == ON) return (8 + 4); else return (16 + 4); } else if (strcmp (ident, "IIR") == 0) /** Was 'I' register */ { if (rcmX000) { return 8; } } else if (strcmp (ident, "EIR") == 0) /** Was 'R' register */ { if (rcmX000) { return 9; } } } return -1; } int CheckRegister16 (void) { if (sym == name) if (*(ident + 2) == '\0') switch (*ident) { case 'H': if (*(ident + 1) == 'L') return (2); break; case 'B': if (*(ident + 1) == 'C') return (0); break; case 'D': if (*(ident + 1) == 'E') return (1); break; case 'A': if (*(ident + 1) == 'F') return (4); break; case 'S': if (*(ident + 1) == 'P') return (3); break; case 'I': switch (*(ident + 1)) { case 'X': { if (swapIXIY == ON) return (6); else return (5); } case 'Y': { if (swapIXIY == ON) return (5); else return (6); } } } return -1; } /* * This function will parse the current line for an indirect addressing mode. The return code can be: * * 0 - 2 : (BC); (DE); (HL) 5,6 : (IX <+|- expr.> ); (IY <+|- expr.> ) 7 : (nn), nn = 16bit address * expression * * The function also returns a pointer to the parsed expression, now converted to postfix. */ int IndirectRegisters (void) { int reg16; GetSym (); reg16 = CheckRegister16 (); switch (reg16) { case 0: /* 0 to 2 = BC, DE, HL */ case 1: case 2: if (GetSym () == rparen) { /* (BC) | (DE) | (HL) | ? */ GetSym (); return (reg16); /* indicate (BC), (DE), (HL) */ } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); /* Right bracket missing! */ return -1; } case 5: /* 5, 6 = IX, IY */ case 6: GetSym (); /* prepare expression evaluation */ return (reg16); case -1: /* sym could be a '+', '-' or a symbol... */ return 7; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return -1; } } long GetConstant (char *evalerr) { long size, l, intresult = 0; unsigned short bitvalue = 1; *evalerr = 0; /* preset to no errors */ if ((sym != hexconst) && (sym != binconst) && (sym != decmconst)) { *evalerr = 1; return (0); /* syntax error - illegal constant definition */ } size = strlen (ident); if (sym != decmconst) if ((--size) == 0) { *evalerr = 1; return (0); /* syntax error - no constant specified */ } switch (ident[0]) { case '@': case '%': if (size > 8) { *evalerr = 1; return (0); /* max 8 bit */ } for (l = 1; l <= size; l++) if (strchr ("01", ident[l]) == NULL) { *evalerr = 1; return (0); } /* convert ASCII binary to integer */ for (l = size; l >= 1; l--) { if (ident[l] == '1') intresult += bitvalue; bitvalue <<= 1; /* logical shift left & 16 bit 'adder' */ } return (intresult); case '$': for (l = 1; l <= size; l++) if (isxdigit (ident[l]) == 0) { *evalerr = 1; return (0); } sscanf ((char *) (ident + 1), "%lx", &intresult); return (intresult); default: for (l = 0; l <= (size - 1); l++) if (isdigit (ident[l]) == 0) { *evalerr = 1; return (0); } return (atol (ident)); } } z88dk-1.8.ds1/src/z80asm/symbol.h0000644000175000017500000002510307742022220016071 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ #include "avltree.h" /* base symbol data structures and routines */ /* Structured data types : */ enum flag { OFF, ON }; enum symbols { space, strconq, dquote, squote, semicolon, comma, fullstop, lparen, lcurly, lsquare, rsquare, rcurly, rparen, plus, minus, multiply, divi, mod, power, assign, bin_and, bin_or, bin_xor, less, greater, log_not, constexpr, newline, lessequal, greatequal, notequal, name, number, decmconst, hexconst, binconst, charconst, negated, nil, ifstatm, elsestatm, endifstatm, label }; struct pageref { struct pageref *nextref; /* pointer to next page reference of symbol */ short pagenr; /* page number where symbol is referenced */ }; /* the first symbol node in identifies the symbol definition */ struct symref { struct pageref *firstref; /* Pointer to first page number reference of symbol */ struct pageref *lastref; /* Pointer to last/current page number reference */ }; /* NB: First reference defines creation of symbol */ struct pfixstack { long stackconstant; /* stack structure used to evaluate postfix expressions */ struct pfixstack *prevstackitem; /* pointer to previous element on stack */ }; struct postfixlist { struct postfixlist *nextoperand; /* pointer to next element in postfix expression */ long operandconst; enum symbols operatortype; char *id; /* pointer to identifier */ unsigned char type; /* type of identifier (local, global, rel. address or constant) */ }; struct expr { struct expr *nextexpr; /* pointer to next expression */ struct postfixlist *firstnode; struct postfixlist *currentnode; unsigned char rangetype; /* range type of evaluated expression */ enum flag stored; /* Flag to indicate that expression has been stored to object file */ char *infixexpr; /* pointer to ASCII infix expression */ char *infixptr; /* pointer to current char in infix expression */ int codepos; /* rel. position in module code to patch (in pass 2) */ char *srcfile; /* expr. in file 'srcfile' - allocated name area deleted by ReleaseFile */ short curline; /* expression in line of source file */ long listpos; /* position in listing file to patch (in pass 2) */ }; struct expression { struct expr *firstexpr; /* header of list of expressions in current module */ struct expr *currexpr; }; struct usedfile { struct usedfile *nextusedfile; struct sourcefile *ownedsourcefile; }; struct sourcefile { struct sourcefile *prevsourcefile; /* pointer to previously parsed source file */ struct sourcefile *newsourcefile; /* pointer to new source file to be parsed */ struct usedfile *usedsourcefile; /* list of pointers to used files owned by this file */ long filepointer; /* file pointer of current source file */ short line; /* current line number of current source file */ char *fname; /* pointer to file name of current source file */ }; struct JRPC_Hdr { struct JRPC *firstref; /* pointer to first JR address reference in list */ struct JRPC *lastref; /* pointer to last JR address reference in list */ }; struct JRPC { struct JRPC *nextref; /* pointer to next JR address reference */ unsigned short PCaddr; /* absolute of PC address of JR instruction */ }; typedef struct node { unsigned char type; /* type of symbol */ char *symname; /* pointer to symbol identifier */ long symvalue; /* value of symbol */ struct symref *references; /* pointer to all found references of symbol */ struct module *owner; /* pointer to module which ownes symbol */ } symbol; struct modules { struct module *first; /* pointer to first module */ struct module *last; /* pointer to current/last module */ }; struct module { struct module *nextmodule; /* pointer to next module */ char *mname; /* pointer to string of module name */ long startoffset; /* this module's start offset from start of code buffer */ long origin; /* Address Origin of current machine code module during linking */ struct sourcefile *cfile; /* pointer to current file record */ avltree *notdeclroot; /* pointer to root of symbols not yet declared/defined */ avltree *localroot; /* pointer to root of local symbols tree */ struct expression *mexpr; /* pointer to expressions in this module */ struct JRPC_Hdr *JRaddr; /* pointer to list of JR PC addresses */ }; struct liblist { struct libfile *firstlib; /* pointer to first library file specified from command line */ struct libfile *currlib; /* pointer to current library file specified from command line */ }; struct libfile { struct libfile *nextlib; /* pointer to next library file in list */ char *libfilename; /* filename of library (incl. extension) */ long nextobjfile; /* file pointer to next object file in library */ }; struct linklist { struct linkedmod *firstlink; /* pointer to first linked object module */ struct linkedmod *lastlink; /* pointer to last linked module in list */ }; struct linkedmod { struct linkedmod *nextlink; /* pointer to next module link */ char *objfilename; /* filename of library/object file (incl. extension) */ long modulestart; /* base pointer of beginning of object module */ struct module *moduleinfo; /* pointer to main module information */ }; #define CURRENTFILE CURRENTMODULE->cfile #define ASSEMBLERPC "ASMPC" /* Bitmasks for symtype */ #define SYMDEFINED 1 /* bitmask 00000001 */ #define SYMTOUCHED 2 /* bitmask 00000010 */ #define SYMDEF 4 /* bitmask 00000100 */ #define SYMADDR 8 /* bitmask 00001000 */ #define SYMLOCAL 16 /* bitmask 00010000 */ #define SYMXDEF 32 /* bitmask 00100000 */ #define SYMXREF 64 /* bitmask 01000000 */ #define XDEF_OFF 223 /* bitmask 11011111 */ #define XREF_OFF 191 /* bitmask 10111111 */ #define SYMLOCAL_OFF 239 /* bitmask 11101111 */ #define SYMTYPE 120 /* bitmask 01111000 */ #define SYM_NOTDEFINED 0 /* bitmasks for expression evaluation in rangetype */ #define RANGE 7 /* bitmask 00000111 */ /* Range types are 0 - 4 */ #define EXPRADDR 8 /* bitmask 00001000 */ /* Expression contains reloc. address label */ #define EXPRLOCAL 16 /* bitmask 00010000 */ /* Expression contains local symbol */ #define EXPRGLOBAL 32 /* bitmask 00100000 */ /* Expression contains global symbol */ #define EXPREXTERN 64 /* bitmask 01000000 */ /* Expression contains extern symbol */ #define NOTEVALUABLE 128 /* bitmask 10000000 */ /* Expression is not evaluable */ #define EVALUATED 127 /* bitmask 01111111 */ /* Expression is not evaluable */ #define CLEAR_EXPRADDR 247 /* bitmask 11110111 */ /* Convert to constant expression */ #define RANGE_JROFFSET 0 #define RANGE_8UNSIGN 1 #define RANGE_8SIGN 2 #define RANGE_16CONST 3 #define RANGE_32SIGN 4 z88dk-1.8.ds1/src/z80asm/symbols.c0000644000175000017500000004650010645637716016275 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/symbols.c,v 1.2 2007/07/13 09:03:10 dom Exp $ */ /* $History: SYMBOLS.C $ */ /* */ /* ***************** Version 9 ***************** */ /* User: Gbs Date: 6-06-99 Time: 12:13 */ /* Updated in $/Z80asm */ /* Added Ascii Art "Z80asm" at top of source file. */ /* */ /* ***************** Version 7 ***************** */ /* User: Gbs Date: 6-06-99 Time: 11:31 */ /* Updated in $/Z80asm */ /* "config.h" included before "symbol.h" */ /* */ /* ***************** Version 6 ***************** */ /* User: Gbs Date: 2-05-99 Time: 18:09 */ /* Updated in $/Z80asm */ /* DeclSymGlobal() and DeclSymExtern() functions improved to handle scope */ /* resolution of identifers even after the actual identifiers have been */ /* created (typically re-declaring a local symbol to a global symbol). */ /* */ /* ***************** Version 4 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 15:10 */ /* Updated in $/Z80asm */ /* SourceSafe Version History Comment Block added. */ #include #include #include #include "config.h" #include "symbol.h" /* external functions */ void ReportError (char *filename, short linenr, int errnum); /* local functions */ struct symref *AllocSymRef (void); struct pageref *AllocPageRef (void); symbol *GetSymPtr (char *identifier); symbol *FindSymbol (char *identifier, avltree * treeptr); symbol *AllocSymbol (void); symbol *CreateSymbol (char *identifier, long value, unsigned char symboltype, struct module *symowner); char *AllocIdentifier (size_t len); int DefineSymbol (char *identifier, long value, unsigned char symboltype); int DefLocalSymbol (char *identifier, long value, unsigned char symboltype); int DefineDefSym (char *identifier, long value, unsigned char symtype, avltree ** root); int cmpidstr (symbol * kptr, symbol * p); int cmpidval (symbol * kptr, symbol * p); void InsertPageRef (symbol * symptr); void AppendPageRef (symbol * symptr); void DeclSymGlobal (char *identifier, unsigned char libtype); void DeclSymExtern (char *identifier, unsigned char libtype); void MovePageRefs (char *identifier, symbol * definedsym); void FreeSym (symbol * node); /* global variables */ extern int PAGENR; extern enum flag symtable, listing, listing_CPY, pass1; extern struct module *CURRENTMODULE; /* pointer to current module */ extern avltree *globalroot; symbol * CreateSymbol (char *identifier, long value, unsigned char symboltype, struct module *symowner) { symbol *newsym; if ((newsym = AllocSymbol ()) == NULL) { /* Create area for a new symbol structure */ ReportError (NULL, 0, 3); return NULL; } newsym->symname = AllocIdentifier (strlen (identifier) + 1); /* Allocate area for a new symbol identifier */ if (newsym->symname != NULL) strcpy (newsym->symname, identifier); /* store identifier symbol */ else { free (newsym); /* Ups no more memory left.. */ ReportError (NULL, 0, 3); return NULL; } if (symtable && listing_CPY) { if ((newsym->references = AllocSymRef ()) == NULL) { /* Create area for a new symbol structure */ free (newsym->symname); free (newsym); /* release created records */ ReportError (NULL, 0, 3); return NULL; } newsym->references->firstref = NULL; newsym->references->lastref = NULL; /* Page reference list initialised... */ AppendPageRef (newsym); /* store first page reference in listfile of this symbol */ } else newsym->references = NULL; /* No listing file, no page references... */ newsym->owner = symowner; newsym->type = symboltype; newsym->symvalue = value; return newsym; /* pointer to new symbol node */ } int cmpidstr (symbol * kptr, symbol * p) { return strcmp (kptr->symname, p->symname); } int cmpidval (symbol * kptr, symbol * p) { return kptr->symvalue - p->symvalue; } /* * DefineSymbol will create a record in memory, inserting it into an AVL tree (or creating the first record) */ int DefineSymbol (char *identifier, long value, /* value of symbol, label */ unsigned char symboltype) { /* symbol is either address label or constant */ symbol *foundsymbol; if ((foundsymbol = FindSymbol (identifier, globalroot)) == NULL) /* Symbol not declared as global/extern */ return DefLocalSymbol (identifier, value, symboltype); else if (foundsymbol->type & SYMXDEF) { if ((foundsymbol->type & SYMDEFINED) == 0) { /* symbol declared global, but not yet defined */ foundsymbol->symvalue = value; foundsymbol->type |= (symboltype | SYMDEFINED); /* defined, and typed as address label or * constant */ foundsymbol->owner = CURRENTMODULE; /* owner of symbol is always creator */ if (pass1 && symtable && listing) { InsertPageRef (foundsymbol); /* First element in list is definition of symbol */ MovePageRefs (identifier, foundsymbol); /* Move page references from possible forward * referenced symbol */ } return 1; } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 14); /* global symbol already defined */ return 0; } } else return DefLocalSymbol (identifier, value, symboltype); /* Extern declaration of symbol, now define * local symbol. */ /* the extern symbol is now no longer accessible */ } int DefLocalSymbol (char *identifier, long value, /* value of symbol, label */ unsigned char symboltype) { /* symbol is either address label or constant */ symbol *foundsymbol; if ((foundsymbol = FindSymbol (identifier, CURRENTMODULE->localroot)) == NULL) { /* Symbol not declared as local */ foundsymbol = CreateSymbol (identifier, value, symboltype | SYMLOCAL | SYMDEFINED, CURRENTMODULE); if (foundsymbol == NULL) return 0; else insert (&CURRENTMODULE->localroot, foundsymbol, (int (*)()) cmpidstr); if (pass1 && symtable && listing) MovePageRefs (identifier, foundsymbol); /* Move page references from forward referenced symbol */ return 1; } else if ((foundsymbol->type & SYMDEFINED) == 0) { /* symbol declared local, but not yet defined */ foundsymbol->symvalue = value; foundsymbol->type |= symboltype | SYMLOCAL | SYMDEFINED; /* local symbol type set to address * label or constant */ foundsymbol->owner = CURRENTMODULE; /* owner of symbol is always creator */ if (pass1 && symtable && listing) { InsertPageRef (foundsymbol); /* First element in list is definition of symbol */ MovePageRefs (identifier, foundsymbol); /* Move page references from possible forward * referenced symbol */ } return 1; } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 14); /* local symbol already defined */ return 0; } } /* * Move pointer to list of page references from forward symbol and append it to first reference of defined symbol. */ void MovePageRefs (char *identifier, symbol * definedsym) { symbol *forwardsym; struct pageref *tmpref; if ((forwardsym = FindSymbol (identifier, CURRENTMODULE->notdeclroot)) != NULL) { if (definedsym->references->firstref->pagenr == forwardsym->references->lastref->pagenr) { if (forwardsym->references->firstref != forwardsym->references->lastref) { tmpref = forwardsym->references->firstref; /* more than one reference */ while (tmpref->nextref != forwardsym->references->lastref) tmpref = tmpref->nextref; /* get reference before last reference */ free (tmpref->nextref); /* remove redundant reference */ tmpref->nextref = NULL; /* end of list */ forwardsym->references->lastref = tmpref; /* update pointer to last reference */ definedsym->references->firstref->nextref = forwardsym->references->firstref; definedsym->references->lastref = forwardsym->references->lastref; /* forward page * reference list * appended */ } else free (forwardsym->references->firstref); /* remove the redundant reference */ } else { definedsym->references->firstref->nextref = forwardsym->references->firstref; definedsym->references->lastref = forwardsym->references->lastref; /* last reference not on the same page as definition */ /* forward page reference list now appended */ } free (forwardsym->references); /* remove pointer information to forward page reference list */ forwardsym->references = NULL; /* symbol is not needed anymore, remove from symbol table of forward references */ delete (&CURRENTMODULE->notdeclroot, forwardsym, (int (*)()) cmpidstr, (void (*)()) FreeSym); } } /* * search for symbol in either local tree or global tree, return found pointer if defined/declared, otherwise return * NULL */ symbol * GetSymPtr (char *identifier) { symbol *symbolptr; /* pointer to current search node in AVL tree */ if ((symbolptr = FindSymbol (identifier, CURRENTMODULE->localroot)) == NULL) { if ((symbolptr = FindSymbol (identifier, globalroot)) == NULL) { if (pass1 && symtable && listing_CPY) { if ((symbolptr = FindSymbol (identifier, CURRENTMODULE->notdeclroot)) == NULL) { symbolptr = CreateSymbol (identifier, 0, SYM_NOTDEFINED, CURRENTMODULE); if (symbolptr != NULL) insert (&CURRENTMODULE->notdeclroot, symbolptr, (int (*)()) cmpidstr); } else AppendPageRef (symbolptr); /* symbol found in forward referenced tree, * note page reference */ } return NULL; } else { if (pass1 && symtable && listing) AppendPageRef (symbolptr); /* symbol found as global/extern declaration */ return symbolptr; /* symbol at least declared - return pointer to it... */ } } else { if (pass1 && symtable && listing) AppendPageRef (symbolptr); /* symbol found as local declaration */ return symbolptr; /* symbol at least declared - return pointer to it... */ } } int compidentifier (char *identifier, symbol * p) { return strcmp (identifier, p->symname); } /* * return pointer to found symbol in a symbol tree, otherwise NULL if not found */ symbol * FindSymbol (char *identifier, /* pointer to current identifier */ avltree * treeptr) { /* pointer to root of AVL tree */ symbol *found; if (treeptr == NULL) return NULL; else { found = find (treeptr, identifier, (int (*)()) compidentifier); if (found == NULL) return NULL; else { found->type |= SYMTOUCHED; return found; /* symbol found (declared/defined) */ } } } void DeclSymGlobal (char *identifier, unsigned char libtype) { symbol *foundsym, *clonedsym; if ((foundsym = FindSymbol (identifier, CURRENTMODULE->localroot)) == NULL) { if ((foundsym = FindSymbol (identifier, globalroot)) == NULL) { foundsym = CreateSymbol (identifier, 0, SYM_NOTDEFINED | SYMXDEF | libtype, CURRENTMODULE); if (foundsym != NULL) insert (&globalroot, foundsym, (int (*)()) cmpidstr); /* declare symbol as global */ } else { if (foundsym->owner != CURRENTMODULE) { /* this symbol is declared in another module */ if (foundsym->type & SYMXREF) { foundsym->owner = CURRENTMODULE; /* symbol now owned by this module */ foundsym->type &= XREF_OFF; /* re-declare symbol as global if symbol was */ foundsym->type |= SYMXDEF | libtype; /* declared extern in another module */ } else /* cannot declare two identical global's */ ReportError (CURRENTFILE->fname, CURRENTFILE->line, 22); /* Already declared global */ } else if ( (foundsym->type & (SYMXDEF|libtype)) != (SYMXDEF|libtype) ) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 23); /* re-declaration not allowed */ } } } else { if (FindSymbol (identifier, globalroot) == NULL) { /* If no global symbol of identical name has been created, then re-declare local symbol as global symbol */ foundsym->type &= SYMLOCAL_OFF; foundsym->type |= SYMXDEF; clonedsym = CreateSymbol (foundsym->symname, foundsym->symvalue, foundsym->type, CURRENTMODULE); if (clonedsym != NULL) { insert (&globalroot, clonedsym, (int (*)()) cmpidstr); /* original local symbol cloned as global symbol, now delete old local ... */ delete (&CURRENTMODULE->localroot, foundsym, (int (*)()) cmpidstr, (void (*)()) FreeSym); } } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 18); /* already declared global */ } } } void DeclSymExtern (char *identifier, unsigned char libtype) { symbol *foundsym, *extsym; if ((foundsym = FindSymbol (identifier, CURRENTMODULE->localroot)) == NULL) { if ((foundsym = FindSymbol (identifier, globalroot)) == NULL) { foundsym = CreateSymbol (identifier, 0, SYM_NOTDEFINED | SYMXREF | libtype, CURRENTMODULE); if (foundsym != NULL) insert (&globalroot, foundsym, (int (*)()) cmpidstr); /* declare symbol as extern */ } else if (foundsym->owner == CURRENTMODULE) { if ( (foundsym->type & (SYMXREF | libtype)) != (SYMXREF |libtype) ) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 23); /* Re-declaration not allowed */ } } else { if (FindSymbol (identifier, globalroot) == NULL) { /* If no external symbol of identical name has been declared, then re-declare local symbol as external symbol, but only if local symbol is not defined yet */ if ((foundsym->type & SYMDEFINED) == 0) { foundsym->type &= SYMLOCAL_OFF; foundsym->type |= (SYMXREF | libtype); extsym = CreateSymbol (identifier, 0, foundsym->type, CURRENTMODULE); if (extsym != NULL) { insert (&globalroot, extsym, (int (*)()) cmpidstr); /* original local symbol cloned as external symbol, now delete old local ... */ delete (&CURRENTMODULE->localroot, foundsym, (int (*)()) cmpidstr, (void (*)()) FreeSym); } } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 17); /* already declared local */ } else if ( (foundsym->type & (SYMXREF|libtype)) != (SYMXREF|libtype) ) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 23); /* re-declaration not allowed */ } } } void AppendPageRef (symbol * symptr) { struct pageref *newref = NULL; if (symptr->references->lastref != NULL) if (symptr->references->lastref->pagenr == PAGENR || symptr->references->firstref->pagenr == PAGENR) /* symbol reference on the same page - ignore */ return; if ((newref = AllocPageRef ()) == NULL) { /* new page reference of symbol - allocate... */ ReportError (NULL, 0, 3); return; } else { newref->pagenr = PAGENR; newref->nextref = NULL; } if (symptr->references->lastref == NULL) { symptr->references->lastref = newref; symptr->references->firstref = newref; /* First page reference in list */ } else { symptr->references->lastref->nextref = newref; /* current reference (last) points at new reference */ symptr->references->lastref = newref; /* ptr to last reference updated to new reference */ } } void InsertPageRef (symbol * symptr) { struct pageref *newref = NULL, *tmpptr = NULL; if (symptr->references->firstref != NULL) if (symptr->references->firstref->pagenr == PAGENR) /* symbol reference on the same page - ignore */ return; if ((newref = AllocPageRef ()) == NULL) { /* new page reference of symbol - allocate... */ ReportError (NULL, 0, 3); return; } else { newref->pagenr = PAGENR; newref->nextref = symptr->references->firstref; /* next reference will be current first reference */ } if (symptr->references->firstref == NULL) { /* If this is the first reference, then the... */ symptr->references->firstref = newref; /* Current reference (last) points at new reference */ symptr->references->lastref = newref; /* first page reference is also last page reference. */ } else { symptr->references->firstref = newref; /* Current reference (last) points at new reference */ if (newref->pagenr == symptr->references->lastref->pagenr) { /* last reference = new reference */ tmpptr = newref; while (tmpptr->nextref != symptr->references->lastref) tmpptr = tmpptr->nextref; /* get reference before last reference */ free (tmpptr->nextref); /* remove redundant reference */ tmpptr->nextref = NULL; /* end of list */ symptr->references->lastref = tmpptr; /* update pointer to last reference */ } } } int DefineDefSym (char *identifier, long value, unsigned char symtype, avltree ** root) { symbol *staticsym; if (FindSymbol (identifier, *root) == NULL) { staticsym = CreateSymbol (identifier, value, symtype | SYMDEF | SYMDEFINED, NULL); if (staticsym != NULL) { insert (root, staticsym, (int (*)()) cmpidstr); return 1; } else return 0; } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 14); /* Symbol already defined */ return 0; } } void FreeSym (symbol * node) { struct pageref *pref, *tmpref; if (node->references != NULL) { if (node->references->firstref != NULL) { pref = node->references->firstref; /* get first page reference in list */ do { tmpref = pref; pref = pref->nextref; free (tmpref); } while (pref != NULL); /* free page reference list... */ } free (node->references); /* Then remove head/end pointer record to list */ } if (node->symname != NULL) free (node->symname); /* release symbol identifier */ free (node); /* then release the symbol record */ } symbol * AllocSymbol (void) { return (symbol *) malloc (sizeof (symbol)); } struct symref * AllocSymRef (void) { return (struct symref *) malloc (sizeof (struct symref)); } struct pageref * AllocPageRef (void) { return (struct pageref *) malloc (sizeof (struct pageref)); } char * AllocIdentifier (size_t len) { return (char *) malloc (len); } z88dk-1.8.ds1/src/z80asm/vscmake.bat0000644000175000017500000000034410537314617016546 0ustar tygrystygrys@echo off rem $Id: vscmake.bat,v 1.3 2006/12/11 17:46:55 stefano Exp $ echo ******************* echo * Building z80asm * echo ******************* cl /Fez80asm -D _CRT_SECURE_NO_DEPRECATE *.c move z80asm.exe ..\..\bin del *.obj z88dk-1.8.ds1/src/z80asm/z80asm.c0000644000175000017500000012305410650506027015711 0ustar tygrystygrys /* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/z80asm.c,v 1.19 2007/07/21 22:43:35 dom Exp $ */ /* $History: Z80ASM.C $ */ /* */ /* ***************** Version 22 ***************** */ /* User: Gbs Date: 30-01-00 Time: 12:49 */ /* Updated in $/Z80asm */ /* New option -M implemented, which defines arbitrary object file name */ /* extension. */ /* */ /* ***************** Version 21 ***************** */ /* User: Gbs Date: 26-01-00 Time: 22:12 */ /* Updated in $/Z80asm */ /* "V1.0.14" version text changes. */ /* */ /* ***************** Version 20 ***************** */ /* User: Gbs Date: 30-09-99 Time: 22:39 */ /* Updated in $/Z80asm */ /* CALL_PKG hard coded macro implemented for Garry Lancaster's Package */ /* System. */ /* */ /* ***************** Version 18 ***************** */ /* User: Gbs Date: 6-06-99 Time: 20:07 */ /* Updated in $/Z80asm */ /* "PC" program counter changed to long (from unsigned short). */ /* */ /* ***************** Version 16 ***************** */ /* User: Gbs Date: 6-06-99 Time: 12:13 */ /* Updated in $/Z80asm */ /* Added Ascii Art "Z80asm" at top of source file. */ /* '#' changed to '@' in default help page. */ /* ReportError() changed to display the platform specific MAXCODESIZE */ /* value when the maximum code generation size has been reached. */ /* */ /* ***************** Version 11 ***************** */ /* User: Gbs Date: 30-05-99 Time: 1:04 */ /* Updated in $/Z80asm */ /* Redundant system include files removed. */ /* Explicitly specified file source file extension automaticlly removed. */ /* Slight changes to default help page. */ /* */ /* ***************** Version 10 ***************** */ /* User: Gbs Date: 2-05-99 Time: 18:12 */ /* Updated in $/Z80asm */ /* New function, ReportIOError(). */ /* ReportError() improved to display to when no error filename is */ /* available and to display the name of the module in which the error */ /* occurred (this is especially useful during linking errors). */ /* */ /* ***************** Version 8 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 7 ***************** */ /* User: Gbs Date: 7-03-99 Time: 13:14 */ /* Updated in $/Z80asm */ /* Program terminates with 1 if error occurs, otherwise 0 if all went OK. */ /* (Dominic Morris - djm@jb.man.ac.uk) */ /* */ /* ***************** Version 5 ***************** */ /* User: Gbs Date: 6-09-98 Time: 12:53 */ /* Updated in $/Z80asm */ /* -o logic replaced with -e option. This makes Z80asm completely */ /* configurable on which filename extension to use for source files. */ /* */ /* ***************** Version 3 ***************** */ /* User: Gbs Date: 4-09-98 Time: 0:11 */ /* Updated in $/Z80asm */ /* ".opt" source files now parsed in stead of ".asm" files using new -o */ /* option. */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 15:00 */ /* Updated in $/Z80asm */ /* SourceSafe Version History comment block added. */ /* program version strings updated, "V1.0.3". */ /* All exit(-1) changed to exit(0) - djm 26/6/98 */ /* Cleaned up info so doesn't linewrap on Amiga */ /* Oops, screw up! exit(0) (was exit(-1)) should be exit(1) - djm 29/2/99 */ #include #include #include #include #include #include #include "config.h" #include "symbol.h" /* external functions */ char *AllocIdentifier (size_t len); void RemovePfixlist (struct expr *pfixexpr); void Z80pass1 (void); void Z80pass2 (void); void CreateLib (void); void LinkModules (void); void DeclModuleName (void); void DeclSymGlobal (void); void FreeSym (symbol * node); void CreateDeffile (void); void WriteGlobal (symbol * node); void WriteMapFile (void); void CreateBinFile (void); void Fetchfilename(FILE *fptr); struct sourcefile *Newfile (struct sourcefile *curfile, char *fname); enum symbols GetSym (void); long GetConstant (char *evalerr); long ReadLong (FILE * fileid); int cmpidstr (symbol * kptr, symbol * p); int DefineSymbol (char *identifier, long value, unsigned char symboltype); int DefineDefSym (char *ident, long value, unsigned char symtype, avltree ** root); symbol *CreateSymbol (char *identifier, long value, unsigned char symboltype, struct module *symowner); /* local functions */ void prompt (void); void usage (void); void ReportError (char *filename, short linenr, int errnum); void ReportIOError (char *filename); void SetAsmFlag (char *flagid); void WriteHeader (void); void ReleaseFile (struct sourcefile *srcfile); void ReleaseLibraries (void); void ReleaseOwnedFile (struct usedfile *ownedfile); void ReleaseModules (void); void ReleaseFilenames (void); void ReleaseExprns (struct expression *express); void CloseFiles (void); void CreateLibfile (char *libfilename); int AssembleSourceFile (void); int TestAsmFile (void); int GetModuleSize (void); symbol *createsym (symbol * symptr); struct modules *AllocModuleHdr (void); struct module *AllocModule (void); struct liblist *AllocLibHdr (void); struct libfile *AllocLib (void); struct module *NewModule (void); struct libfile *NewLibrary (void); struct expression *AllocExprHdr (void); struct JRPC_Hdr *AllocJRaddrHdr (void); #ifdef QDOS #include char _prog_name[] = "Z80asm"; char _version[] = "1.0.30"; char _copyright[] = "\x7f InterLogic 1993-2007"; void consetup_title (); void (*_consetup) () = consetup_title; int (*_readkbd) (chanid_t, timeout_t, char *) = readkbd_move; struct WINDOWDEF _condetails = {2, 1, 0, 7, 484, 256, 0, 0}; #endif #ifdef AMIGA char amiver[] = "$VER: z80asm v1.0.30, (c) InterLogic 1993-2007"; #endif char copyrightmsg[] = "Z80 Module Assembler V1.0.30 (21.7.2007), (c) InterLogic 1993-2007"; FILE *z80asmfile, *listfile, *errfile, *objfile, *mapfile, *modsrcfile, *deffile, *libfile; long clineno; char *errmsg[] = {"File open/read error", /* 0 */ "Syntax error", /* 1 */ "Symbol not defined", /* 2 */ "Not enough memory", /* 3 */ "Integer out of range", /* 4 */ "Syntax error in expression", /* 5 */ "Right bracket missing", /* 6 */ "Out of range", /* 7 */ "Source filename missing", /* 8 */ "Illegal option", /* 9 */ "Unknown identifier", /* 10 */ "Illegal identifier", /* 11 */ "Max. code size of %ld bytes reached", /* 12 */ "errors occurred during assembly", /* 13 */ "Symbol already defined", /* 14 */ "Module name already defined", /* 15 */ "Module name not defined", /* 16 */ "Symbol already declared local", /* 17 */ "Symbol already declared global", /* 18 */ "Symbol already declared external", /* 19 */ "No command line arguments", /* 20 */ "Illegal source filename", /* 21 */ "Symbol declared global in another module", /* 22 */ "Re-declaration not allowed", /* 23 */ "ORG already defined", /* 24 */ "Relative jump address must be local", /* 25 */ "Not an object file", /* 26 */ "Reserved name", /* 27 */ "Couldn't open library file", /* 28 */ "Not a library file", /* 29 */ "Environment variable not defined", /* 30 */ "Cannot include file recursively", /* 31 */ }; enum symbols sym, ssym[] = {space, strconq, dquote, squote, semicolon, comma, fullstop, lparen, lcurly, lsquare, rsquare, rcurly, rparen, plus, minus, multiply, divi, mod, power, assign, bin_and, bin_or, bin_xor, less, greater, log_not, constexpr}; enum flag pass1, listing, listing_CPY, symtable, z80bin, writeline, mapref, globaldef, datestamp, ti83plus; enum flag deforigin, verbose, ASMERROR, EOL, symfile, library, createlibrary, autorelocate; enum flag smallc_source, codesegment, expl_binflnm, clinemode, swapIXIY; enum flag rcmX000; int ASSEMBLE_ERROR, ERRORS, TOTALERRORS, PAGENR, LINENR; long TOTALLINES; int sourcefile_open; char PAGELEN; int TAB_DIST = 8, COLUMN_WIDTH; char separators[] = " &\"\';,.({[]})+-*/%^=~|:<>!#:"; char line[255], stringconst[255], ident[255]; char *srcfilename, *lstfilename, *objfilename, *errfilename, *libfilename; #ifdef QDOS char asmext[] = "_asm", lstext[] = "_lst", objext_templ[] = "_obj", defext[] = "_def", errext[] = "_err"; char binext[] = "_bin", libext[] = "_lib", symext[] = "_sym", mapext[] = "_map"; char segmbinext[] = "_bn0"; #else char asmext[] = ".asm", lstext[] = ".lst", objext_templ[] = ".obj", defext[] = ".def", binext[] = ".bin"; char mapext[] = ".map", errext[] = ".err", symext[] = ".sym", libext[] = ".lib"; char segmbinext[] = ".bn0"; #endif char srcext[5]; /* contains default source file extension */ char objext[5]; /* contains default object file extension */ char binfilename[64]; /* -o explicit filename buffer */ char Z80objhdr[] = "Z80RMF01"; char objhdrprefix[] = "oomodnexprnamelibnmodc"; char Z80libhdr[] = "Z80LMF01"; unsigned char reloc_routine[] = "\x08\xD9\xFD\xE5\xE1\x01\x49\x00\x09\x5E\x23\x56\xD5\x23\x4E\x23" "\x46\x23\xE5\x09\x44\x4D\xE3\x7E\x23\xB7\x20\x06\x5E\x23\x56\x23" "\x18\x03\x16\x00\x5F\xE3\x19\x5E\x23\x56\xEB\x09\xEB\x72\x2B\x73" "\xD1\xE3\x2B\x7C\xB5\xE3\xD5\x20\xDD\xF1\xF1\xFD\x36\x00\xC3\xFD" "\x71\x01\xFD\x70\x02\xD9\x08\xFD\xE9"; size_t sizeof_relocroutine = 73; char *reloctable = NULL, *relocptr = NULL; long listfileptr; unsigned char *codearea, *codeptr; size_t CODESIZE; long PC, oldPC; /* Program Counter */ unsigned short DEFVPC; /* DEFVARS address counter */ size_t EXPLICIT_ORIGIN; /* origin defined from command line */ time_t asmtime; /* time of assembly in seconds */ char *date; /* pointer to datestring calculated from asmtime */ struct modules *modulehdr; struct module *CURRENTMODULE; struct liblist *libraryhdr; avltree *globalroot, *staticroot; int AssembleSourceFile (void) { char *dotptr; if ((errfile = fopen (errfilename, "w")) == NULL) { /* Create error file */ ReportIOError (errfilename); return 0; } if (listing_CPY || symfile) { if ((listfile = fopen (lstfilename, "w+")) != NULL) { /* Create LIST or SYMBOL file */ PAGENR = 0; LINENR = 6; WriteHeader (); /* Begin list file with a header */ listfileptr = ftell (listfile); /* Get file pos. of next line in list file */ } else { ReportIOError (lstfilename); return 0; } } if ((objfile = fopen (objfilename, "w+b")) != NULL) { /* Create relocatable object file */ fwrite (Z80objhdr, sizeof (char), strlen (Z80objhdr), objfile); fwrite (objhdrprefix, sizeof (char), strlen (objhdrprefix), objfile); } else { ReportIOError (objfilename); return 0; } PC = oldPC = 0; copy (staticroot, &CURRENTMODULE->localroot, (int (*)()) cmpidstr, (void *(*)()) createsym); if (DefineDefSym (ASSEMBLERPC, PC, 0, &globalroot) == 0) { /* Create standard 'ASMPC' identifier */ ReportError (NULL, 0, 3); return 0; } if (verbose) printf ("Assembling '%s'...\nPass1...\n", srcfilename); pass1 = ON; Z80pass1 (); pass1 = OFF; /* GetSymPtr will only generate page references in Pass1 (if listing is ON) */ /* * Source file no longer needed (file could already have been closed, if fatal error occurred during INCLUDE * processing). */ if (sourcefile_open) { fclose (z80asmfile); z80asmfile = NULL; } if (CURRENTMODULE->mname == NULL) { /* Module name must be defined */ dotptr = strrchr(srcfilename,'/'); if ( dotptr == NULL ) dotptr = strrchr(srcfilename,'\\'); if ( dotptr == NULL ) dotptr = srcfilename-1; strcpy(ident,dotptr+1); dotptr = strchr(ident,asmext[0]); if ( dotptr ) *dotptr = 0; sym = name; dotptr = ident; while ( *dotptr ) { *dotptr = toupper(*dotptr); dotptr++; } DeclModuleName(); /* ReportError (CURRENTFILE->fname, 0, 16); */ } if (ERRORS == 0) { if (verbose) puts ("Pass2..."); Z80pass2 (); } if (listing_CPY || symfile) { fseek (listfile, 0, SEEK_END); fputc (12, listfile); /* end listing with a FF */ fclose (listfile); listfile = NULL; if (ERRORS) remove (lstfilename); /* remove incomplete list file */ } fclose (objfile); objfile = NULL; if (ERRORS) remove (objfilename); /* remove incomplete object file */ if (errfile != NULL) { fclose (errfile); errfile = NULL; if (ERRORS == 0 && errfilename != NULL) remove (errfilename); /* remove empty error file */ } if (globaldef) { fputc ('\n', deffile); /* separate DEFC lines for each module */ inorder (globalroot, (void (*)()) WriteGlobal); } deleteall (&CURRENTMODULE->localroot, (void (*)()) FreeSym); deleteall (&CURRENTMODULE->notdeclroot, (void (*)()) FreeSym); deleteall (&globalroot, (void (*)()) FreeSym); return 1; } void ReleaseFilenames (void) { if (srcfilename != NULL) free (srcfilename); if (lstfilename != NULL) free (lstfilename); if (objfilename != NULL) free (objfilename); if (errfilename != NULL) free (errfilename); srcfilename = lstfilename = objfilename = errfilename = NULL; } void CloseFiles (void) { if (z80asmfile != NULL) fclose (z80asmfile); if (listfile != NULL) fclose (listfile); if (objfile != NULL) fclose (objfile); if (errfile != NULL) fclose (errfile); z80asmfile = listfile = objfile = errfile = NULL; } int TestAsmFile (void) { struct stat afile, ofile; if (datestamp) { /* assemble only updated files */ if (stat (srcfilename, &afile) == -1) return GetModuleSize (); /* source file not available... */ else if (stat (objfilename, &ofile) != -1) if (afile.st_mtime <= ofile.st_mtime) return GetModuleSize (); /* source is older than object module */ } if ((z80asmfile = fopen (srcfilename, "rb")) == NULL) { /* Open source file */ ReportIOError (srcfilename); /* Object module is not found or */ return -1; /* source is has recently been updated */ } sourcefile_open = 1; return 1; /* assemble if no datestamp check */ } int GetModuleSize (void) { char fheader[9]; long fptr_modcode, fptr_modname; long highbyte, lowbyte; size_t size; if ((objfile = fopen (objfilename, "rb")) != NULL) { /* open relocatable object file */ fread (fheader, 1U, 8U, objfile); /* read first 8 chars from file into array */ fheader[8] = '\0'; if (strcmp (fheader, Z80objhdr) != 0) { /* compare header of file */ ReportError (objfilename, 0, 26); /* not an object file */ fclose (objfile); objfile = NULL; return -1; } fseek (objfile, 8 + 2, SEEK_SET); /* set file pointer to point at module name */ fptr_modname = ReadLong (objfile); /* get file pointer to module name */ fseek (objfile, fptr_modname, SEEK_SET); /* set file pointer to module name */ size = fgetc (objfile); fread (line, sizeof (char), size, objfile); /* read module name */ line[size] = '\0'; if ((CURRENTMODULE->mname = AllocIdentifier (size + 1)) == NULL) { ReportError (NULL, 0, 3); return -1; } else strcpy (CURRENTMODULE->mname, line); fseek (objfile, 26, SEEK_SET); /* set file pointer to point at module code pointer */ fptr_modcode = ReadLong (objfile); /* get file pointer to module code */ if (fptr_modcode != -1) { fseek (objfile, fptr_modcode, SEEK_SET); /* set file pointer to module code */ lowbyte = fgetc (objfile); highbyte = fgetc (objfile); size = lowbyte + highbyte * 256; if (CURRENTMODULE->startoffset + size > MAXCODESIZE) ReportError (objfilename, 0, 12); else CODESIZE += size; } fclose (objfile); return 0; } else { ReportIOError (objfilename); return -1; } } void CreateLibfile (char *filename) { size_t l; l = strlen (filename); if (l) { if (strcmp (filename + (l - 4), libext) != 0) { /* 'lib' extension not specified */ if ((libfilename = AllocIdentifier (l + 4 + 1)) != NULL) { strcpy (libfilename, filename); strcat (libfilename, libext); /* add '_lib' extension */ } else { ReportError (NULL, 0, 3); return; } } else { if ((libfilename = AllocIdentifier (l + 1)) != NULL) /* 'lib' extension specified */ strcpy (libfilename, filename); else { ReportError (NULL, 0, 3); return; } } } else { if ((filename = getenv ("Z80_STDLIB")) != NULL) { if ((libfilename = AllocIdentifier (strlen (filename))) != NULL) strcpy (libfilename, filename); else { ReportError (NULL, 0, 3); return; } } else { ReportError (NULL, 0, 30); return; } } if ((libfile = fopen (libfilename, "w+b")) == NULL) { /* create library as BINARY file */ free (libfilename); libfilename = NULL; ReportError (libfilename, 0, 28); } else { createlibrary = ON; fwrite (Z80libhdr, sizeof (char), 8U, libfile); /* write library header */ } } void GetLibfile (char *filename) { struct libfile *newlib; char *f, fheader[9]; int l; if ((newlib = NewLibrary ()) == NULL) { ReportError (NULL, 0, 3); return; } l = strlen (filename); if (l) { if (strcmp (filename + (l - 4), libext) != 0) { /* 'lib' extension not specified */ if ((f = AllocIdentifier (l + 4 + 1)) != NULL) { strcpy (f, filename); strcat (f, libext); /* add '_lib' extension */ } else { ReportError (NULL, 0, 3); return; } } else { if ((f = AllocIdentifier (l + 1)) != NULL) /* 'lib' extension specified */ strcpy (f, filename); else { ReportError (NULL, 0, 3); return; } } } else { filename = getenv ("Z80_STDLIB"); if (filename != NULL) { if ((f = AllocIdentifier (strlen (filename))) != NULL) strcpy (f, filename); else { ReportError (NULL, 0, 3); return; } } else { ReportError (NULL, 0, 30); return; } } newlib->libfilename = f; if ((z80asmfile = fopen (f, "rb")) == NULL) { /* Does file exist? */ ReportError (f, 0, 28); return; } else { fread (fheader, 1U, 8U, z80asmfile); /* read first 8 chars from file into array */ fheader[8] = '\0'; } if (strcmp (fheader, Z80libhdr) != 0) /* compare header of file */ ReportError (f, 0, 29); /* not a library file */ else library = ON; fclose (z80asmfile); z80asmfile = NULL; } void SetAsmFlag (char *flagid) { int i; if (*flagid == 'e') { smallc_source = ON; /* use ".xxx" as source file in stead of ".asm" */ srcext[0] = '.'; strncpy ((srcext + 1), (flagid + 1), 3); /* copy argument string */ srcext[4] = '\0'; /* max. 3 letters extension */ return; } /* djm: mod to get .o files produced instead of .obj */ /* gbs: extended to use argument as definition, e.g. -Mo, which defines .o extension */ if (*flagid == 'M') { strncpy ((objext + 1), (flagid + 1), 3); /* copy argument string (append after '.') */ objext[4] = '\0'; /* max. 3 letters extension */ } /** Check whether this is for the RCM2000/RCM3000 series of Z80-like CPU's */ if (strcmp (flagid, "RCMX000") == 0) { rcmX000=ON; return; } /* check weather to use an RST or CALL when Invoke is used */ if (strcmp(flagid, "plus") == 0 ) { ti83plus = ON; return; } /* (stefano) IX and IY swap option */ if (strcmp (flagid, "IXIY") == 0) { swapIXIY = ON; return; } /* djm turn on c line mode to report line number of C source */ if (strcmp(flagid, "C") == 0 ) { clinemode = ON; return; } if (strcmp(flagid, "c") == 0) { codesegment = ON; return; } if (strcmp (flagid, "a") == 0) { z80bin = ON; datestamp = ON; return; } if (strcmp (flagid, "l") == 0) { listing_CPY = listing = ON; if (symtable) symfile = OFF; return; } if (strcmp (flagid, "nl") == 0) { listing_CPY = listing = OFF; if (symtable) symfile = ON; return; } if (strcmp (flagid, "s") == 0) { symtable = ON; if (listing_CPY) symfile = OFF; else symfile = ON; return; } if (strcmp (flagid, "ns") == 0) { symtable = symfile = OFF; return; } if (strcmp (flagid, "nb") == 0) { z80bin = OFF; mapref = OFF; return; } if (strcmp (flagid, "b") == 0) { z80bin = ON; /* perform address relocation & linking */ return; } if (strcmp (flagid, "v") == 0) { verbose = ON; /* perform address relocation & linking */ return; } if (strcmp (flagid, "nv") == 0) { verbose = OFF; /* perform address relocation & linking */ return; } if (strcmp (flagid, "d") == 0) { datestamp = ON; /* assemble only if source > object file */ return; } if (strcmp (flagid, "nd") == 0) { datestamp = OFF; return; } if (strcmp (flagid, "m") == 0) { mapref = ON; return; } if (strcmp (flagid, "g") == 0) { globaldef = ON; return; } if (strcmp (flagid, "ng") == 0) { globaldef = OFF; return; } if (strcmp (flagid, "nm") == 0) { mapref = OFF; return; } if (strcmp (flagid, "nR") == 0) { autorelocate = OFF; return; } if (*flagid == 'h') { usage(); exit(1); } if (*flagid == 'i') { GetLibfile ((flagid + 1)); return; } if (*flagid == 'x') { CreateLibfile ((flagid + 1)); return; } if (*flagid == 'r') { sscanf (flagid + 1, "%x", &EXPLICIT_ORIGIN); deforigin = ON; /* explicit origin has been defined */ return; } if (*flagid == 'o') { sscanf (flagid + 1, "%s", binfilename); /* store explicit filename for .BIN file */ expl_binflnm = ON; return; } if (*flagid == 'R') { autorelocate = ON; return; } if (*flagid == 't') { sscanf (flagid + 1, "%d", &TAB_DIST); return; } if (*flagid == 'D') { strcpy (ident, (flagid + 1)); /* copy argument string */ if (!isalpha (ident[0])) { ReportError (NULL, 0, 11); /* symbol must begin with alpha */ return; } i = 0; while (ident[i] != '\0') { if (strchr (separators, ident[i]) == NULL) { if (!isalnum (ident[i])) { if (ident[i] != '_') { ReportError (NULL, 0, 11); /* illegal char in identifier */ return; } else ident[i] = '_'; /* underscore in identifier */ } else ident[i] = toupper (ident[i]); } else { ReportError (NULL, 0, 11); /* illegal char in identifier */ return; } ++i; } DefineDefSym (ident, 1, 0, &staticroot); } } struct module * NewModule (void) { struct module *newm; if (modulehdr == NULL) { if ((modulehdr = AllocModuleHdr ()) == NULL) return NULL; else { modulehdr->first = NULL; modulehdr->last = NULL; /* Module header initialised */ } } if ((newm = AllocModule ()) == NULL) return NULL; else { newm->nextmodule = NULL; newm->mname = NULL; newm->startoffset = CODESIZE; newm->origin = 65535; newm->cfile = NULL; newm->localroot = NULL; newm->notdeclroot = NULL; if ((newm->mexpr = AllocExprHdr ()) != NULL) { /* Allocate room for expression header */ newm->mexpr->firstexpr = NULL; newm->mexpr->currexpr = NULL; /* Module expression header initialised */ } else { free (newm); /* remove partial module definition */ return NULL; /* No room for header */ } if ((newm->JRaddr = AllocJRaddrHdr ()) != NULL) { newm->JRaddr->firstref = NULL; newm->JRaddr->lastref = NULL; /* Module JRaddr list header initialised */ } else { free (newm->mexpr); /* remove expression header */ free (newm); /* remove partial module definition */ return NULL; /* No room for header */ } } if (modulehdr->first == NULL) { modulehdr->first = newm; modulehdr->last = newm; /* First module in list */ } else { modulehdr->last->nextmodule = newm; /* current/last module points now at new current */ modulehdr->last = newm; /* pointer to current module updated */ } return newm; } struct libfile * NewLibrary (void) { struct libfile *newl; if (libraryhdr == NULL) { if ((libraryhdr = AllocLibHdr ()) == NULL) return NULL; else { libraryhdr->firstlib = NULL; libraryhdr->currlib = NULL; /* Library header initialised */ } } if ((newl = AllocLib ()) == NULL) return NULL; else { newl->nextlib = NULL; newl->libfilename = NULL; newl->nextobjfile = -1; } if (libraryhdr->firstlib == NULL) { libraryhdr->firstlib = newl; libraryhdr->currlib = newl; /* First library in list */ } else { libraryhdr->currlib->nextlib = newl; /* current/last library points now at new current */ libraryhdr->currlib = newl; /* pointer to current module updated */ } return newl; } void ReleaseModules (void) { struct module *tmpptr, *curptr; if (modulehdr == NULL) return; curptr = modulehdr->first; do { if (curptr->cfile != NULL) ReleaseFile (curptr->cfile); deleteall (&curptr->localroot, (void (*)()) FreeSym); deleteall (&curptr->notdeclroot, (void (*)()) FreeSym); if (curptr->mexpr != NULL) ReleaseExprns (curptr->mexpr); if (curptr->mname != NULL) free (curptr->mname); tmpptr = curptr; curptr = curptr->nextmodule; free (tmpptr); /* Release module */ } while (curptr != NULL); /* until all modules are released */ free (modulehdr); modulehdr = NULL; CURRENTMODULE = NULL; } void ReleaseLibraries (void) { struct libfile *curptr, *tmpptr; curptr = libraryhdr->firstlib; do { if (curptr->libfilename != NULL) free (curptr->libfilename); tmpptr = curptr; curptr = curptr->nextlib; free (tmpptr); /* release library */ } while (curptr != NULL); /* until all libraries are released */ free (libraryhdr); /* Release library header */ libraryhdr = NULL; } void ReleaseExprns (struct expression *express) { struct expr *tmpexpr, *curexpr; curexpr = express->firstexpr; while (curexpr != NULL) { tmpexpr = curexpr->nextexpr; RemovePfixlist (curexpr); curexpr = tmpexpr; } free (express); } void ReleaseFile (struct sourcefile *srcfile) { if (srcfile->usedsourcefile != NULL) ReleaseOwnedFile (srcfile->usedsourcefile); free (srcfile->fname); /* Release allocated area for filename */ free (srcfile); /* Release file information record for this file */ } void ReleaseOwnedFile (struct usedfile *ownedfile) { /* Release first other files called by this file */ if (ownedfile->nextusedfile != NULL) ReleaseOwnedFile (ownedfile->nextusedfile); /* Release first file owned by this file */ if (ownedfile->ownedsourcefile != NULL) ReleaseFile (ownedfile->ownedsourcefile); free (ownedfile); /* Then release this owned file */ } void ReportError (char *filename, short lineno, int errnum) { char errstr[256], errflnmstr[128], errmodstr[128], errlinestr[64]; ASSEMBLE_ERROR = errnum; /* set the global error variable for general error trapping */ ASMERROR = ON; errflnmstr[0] = '\0'; errmodstr[0] = '\0'; errlinestr[0] = '\0'; errstr[0] = '\0'; if (clinemode && clineno ) lineno=clineno; if (filename != NULL) sprintf (errflnmstr,"File '%s', ", filename); if (CURRENTMODULE != NULL) if ( CURRENTMODULE->mname != NULL ) sprintf(errmodstr,"Module '%s', ", CURRENTMODULE->mname); if (lineno != 0) sprintf (errlinestr, "at line %d, ", lineno); strcpy(errstr, errflnmstr); strcat(errstr, errmodstr); strcat(errstr, errlinestr); strcat(errstr, errmsg[errnum]); switch(errnum) { case 12: if (errfile == NULL) { fprintf (stderr, errstr, MAXCODESIZE); fputc ('\n',stderr); } else { fprintf (errfile, errstr, MAXCODESIZE); fputc ('\n',errfile); } break; case 13: fprintf (stderr, "%d %s\n", TOTALERRORS, errmsg[errnum]); break; default: if (errfile == NULL) fprintf (stderr, "%s\n", errstr); else fprintf (errfile, "%s\n", errstr); } ++ERRORS; ++TOTALERRORS; } void ReportIOError (char *filename) { ASSEMBLE_ERROR = 0; ASMERROR = ON; if (CURRENTMODULE != NULL) if ( CURRENTMODULE->mname != NULL ) fprintf(stderr,"Module '%s', ", CURRENTMODULE->mname); fprintf (stderr,"file '%s' couldn't be opened or created\n", filename); ++ERRORS; ++TOTALERRORS; } void display_options (void) { if (datestamp == ON) puts ("Assemble only updated files."); else puts ("Assemble all files"); if (symfile == ON) puts ("Create symbol table file."); if (listing == ON) puts ("Create listing file."); if (globaldef == ON) puts ("Create global definition file."); if (createlibrary == ON) puts ("Create library from specified modules."); if (z80bin == ON) puts ("Link/relocate assembled modules."); if (library == ON) puts ("Link library modules with code."); if (z80bin == ON && mapref == ON) puts ("Create address map file."); if (codesegment == ON && autorelocate == OFF) puts ("Split code into 16K banks."); if (autorelocate == ON) puts ("Create relocatable code."); putchar ('\n'); } /*************************************************************************************************** * Main entry of Z80asm ***************************************************************************************************/ int main (int argc, char *argv[]) { int asmflag; int include_level = 0; FILE *includes[10]; /* 10 levels of inclusion should be enough */ symtable = symfile = writeline = mapref = ON; verbose = smallc_source = listing = listing_CPY = z80bin = datestamp = ASMERROR = codesegment = clinemode = OFF; deforigin = globaldef = library = createlibrary = autorelocate = clineno = OFF; rcmX000=OFF; libfilename = NULL; modsrcfile = NULL; CURRENTMODULE = NULL; modulehdr = NULL; /* initialise to no modules */ libraryhdr = NULL; /* initialise to no library files */ globalroot = NULL; /* global identifier tree initialized */ staticroot = NULL; /* static identifier tree initialized */ asmflag = DefineDefSym (OS_ID, 1, 0, &staticroot); if (!asmflag) exit (1); strcpy (objext, objext_templ); /* use ".obj" as default object file extension */ /* Get command line arguments, if any... */ if (argc == 1) { prompt (); exit (1); } time (&asmtime); date = asctime (localtime (&asmtime)); /* get current system time for date in list file */ codearea = (unsigned char *) calloc (MAXCODESIZE, sizeof (char)); /* Allocate Memory for Z80 machine code */ if (codearea == NULL) { ReportError (NULL, 0, 3); exit (1); } CODESIZE = 0; PAGELEN = 66; TOTALERRORS = 0; TOTALLINES = 0; if ((CURRENTMODULE = NewModule ()) == NULL) { /* then create a dummy module */ ReportError (NULL, 0, 3); /* this is needed during command line parsing */ exit (1); } while (--argc > 0) { /* Get options first */ ++argv; if ((*argv)[0] == '-') SetAsmFlag (((*argv) + 1)); else { if ((*argv)[0] == '@') if ((modsrcfile = fopen ((*argv + 1), "rb")) == NULL) ReportIOError ((*argv + 1)); break; } } ReleaseModules (); /* Now remove dummy module again, not needed */ if (!argc && modsrcfile == NULL) { ReportError (NULL, 0, 8); exit (1); } COLUMN_WIDTH = 4 * TAB_DIST; /* define column width for output files */ if (verbose == ON) display_options (); /* display status messages of select assembler options */ if (smallc_source == OFF) { strcpy (srcext, asmext); /* use ".asm" as default source file extension */ } for (;;) { /* Module loop */ z80asmfile = listfile = objfile = errfile = NULL; codeptr = codearea; /* Pointer (PC) to store z80 instruction */ ERRORS = 0; ASSEMBLE_ERROR = -1; /* General error flag */ if (modsrcfile == NULL) { if (argc > 0) { if ((*argv)[0] != '-') { strncpy(ident, *argv, 254); --argc; ++argv; /* get ready for next filename */ } else { ReportError (NULL, 0, 21); /* Illegal source file name */ break; } } else break; } else { again: Fetchfilename(modsrcfile); if (strlen (ident) == 0) { fclose (modsrcfile); if ( include_level ) { include_level--; modsrcfile = includes[include_level]; goto again; } break; } else if ( ident[0] == '@' && include_level < sizeof(includes) - 1 ) { includes[include_level++] = modsrcfile; if ( ( modsrcfile = fopen(ident + 1, "rb") ) == NULL ) { ReportIOError(ident+1); } else { goto again; } } } #ifdef QDOS /* explicit extension are automatically discarded */ if (strrchr(ident,'_') != NULL) *(strrchr(ident, '_')) ='\0'; #else if (strrchr(ident,'.') != NULL) *(strrchr(ident, '.')) ='\0'; #endif if ((srcfilename = AllocIdentifier (strlen (ident) + 5)) != NULL) { strcpy (srcfilename, ident); strcat (srcfilename, srcext); /* add '_asm' or '_opt' extension */ } else { ReportError (NULL, 0, 3); break; } if ((objfilename = AllocIdentifier (strlen (srcfilename) + 1)) != NULL) { strcpy (objfilename, srcfilename); strcpy (objfilename + strlen (srcfilename) - 4, objext); /* overwrite '_asm' extension with * '_obj' */ } else { ReportError (NULL, 0, 3); break; /* No more room */ } if ((lstfilename = AllocIdentifier (strlen (srcfilename) + 1)) != NULL) { strcpy (lstfilename, srcfilename); if (listing) strcpy (lstfilename + strlen (srcfilename) - 4, lstext); /* overwrite '_asm' extension * with '_lst' */ else strcpy (lstfilename + strlen (srcfilename) - 4, symext); /* overwrite '_asm' extension * with '_sym' */ } else { ReportError (NULL, 0, 3); break; /* No more room */ } if ((errfilename = AllocIdentifier (strlen (srcfilename) + 1)) != NULL) { strcpy (errfilename, srcfilename); strcpy (errfilename + strlen (srcfilename) - 4, errext); /* overwrite '_asm' extension with * '_err' */ } else { ReportError (NULL, 0, 3); break; /* No more room */ } if ((CURRENTMODULE = NewModule ()) == NULL) { /* Create module data structures for new file */ ReportError (NULL, 0, 3); break; } if ((CURRENTFILE = Newfile (NULL, srcfilename)) == NULL) break; /* Create first file record, if possible */ if (globaldef && CURRENTMODULE == modulehdr->first) CreateDeffile (); if ((asmflag = TestAsmFile ()) == 1) { AssembleSourceFile (); /* begin assembly... */ if (verbose) putchar ('\n'); /* separate module texts */ } else if (asmflag == -1) break; /* file open error - stop assembler */ ReleaseFilenames (); } /* for */ ReleaseFilenames (); CloseFiles (); if (globaldef) fclose (deffile); if (createlibrary && ASMERROR == OFF) CreateLib (); if (createlibrary) { fclose (libfile); if (ASMERROR) remove (libfilename); free (libfilename); libfilename = NULL; } if ((ASMERROR == OFF) && verbose) printf ("Total of %ld lines assembled.\n", TOTALLINES); if ((ASMERROR == OFF) && z80bin) LinkModules (); if ((TOTALERRORS == 0) && z80bin) { if (mapref) WriteMapFile (); CreateBinFile (); } ReleaseFilenames (); CloseFiles (); #ifndef QDOS deleteall (&globalroot, (void (*)()) FreeSym); deleteall (&staticroot, (void (*)()) FreeSym); if (modulehdr != NULL) ReleaseModules (); /* Release module information (symbols, etc.) */ if (libraryhdr != NULL) ReleaseLibraries (); /* Release library information */ free (codearea); /* Release area for machine code */ if (autorelocate) if (reloctable != NULL) free (reloctable); #endif if (ASMERROR) ReportError (NULL, 0, 13); /* , if errors, then we really want to return an error number * surely? */ if (ASMERROR) return 1; else return 0; /* assembler successfully ended */ } void prompt (void) { printf("%s\n",copyrightmsg); } void usage (void) { printf ("%s\n", copyrightmsg); puts ("z80asm [options] [ @ | {} ]"); puts ("[] = may be ignored. {} = may be repeated. | = OR clause."); printf ("To assemble 'fred%s' use 'fred' or 'fred%s'\n", asmext, asmext); puts (" contains file names of all modules to be linked:"); puts ("File names are put on separate lines ended with \\n. File types recognized or"); puts ("created by z80asm (defined by the following extension):"); printf ("%s = source file (default), or alternative -e\n", asmext); printf ("%s = object file (default), or alternative -M\n", objext); printf ("%s = list file, %s = Z80 code file\n", lstext, binext); printf ("%s = symbols file, %s = map file, %s = XDEF file, %s = error file\n", symext, mapext, defext, errext); puts ("Options: -n defines option to be turned OFF (except -r -R -i -x -D -t -o)"); printf ("-v verbose, -l listing file, -s symbol table, -m map listing file\n"); puts ("-r Explicit relocation defined in hex (ignore ORG in first module)"); puts ("-plus Interpret 'Invoke' as RST 28h"); puts ("-R Generate relocatable code (Automatical relocation before execution)"); puts ("-D define symbol as logically TRUE (used for conditional assembly)"); puts ("-b assemble files & link to ORG address. -c split code in 16K banks"); puts ("-d date stamp control, assemble only if source file > object file"); puts ("-a: -b & -d (assemble only updated source files, then link & relocate)"); puts ("-o expl. output filename, -g XDEF reloc. addr. from all modules"); printf ("-i include LIB modules with %s modules during linking\n", objext); puts ("-x create library from specified modules ( e.g. with @ )"); printf ("-t tabulator width for %s, %s, %s files. Column width is 4 times -t\n", mapext, defext, symext); puts ("Default options: -nv -nd -nb -nl -s -m -ng -nc -nR -t8"); } symbol * createsym (symbol * symptr) { return CreateSymbol (symptr->symname, symptr->symvalue, symptr->type, symptr->owner); } struct expression * AllocExprHdr (void) { return (struct expression *) malloc (sizeof (struct expression)); } struct JRPC_Hdr * AllocJRaddrHdr (void) { return (struct JRPC_Hdr *) malloc (sizeof (struct JRPC_Hdr)); } struct modules * AllocModuleHdr (void) { return (struct modules *) malloc (sizeof (struct modules)); } struct module * AllocModule (void) { return (struct module *) malloc (sizeof (struct module)); } struct liblist * AllocLibHdr (void) { return (struct liblist *) malloc (sizeof (struct liblist)); } struct libfile * AllocLib (void) { return (struct libfile *) malloc (sizeof (struct libfile)); } /* * Local Variables: * indent-tabs-mode:nil * require-final-newline:t * c-basic-offset: 2 * eval: (c-set-offset 'case-label 0) * eval: (c-set-offset 'substatement-open 2) * eval: (c-set-offset 'access-label 0) * eval: (c-set-offset 'class-open 2) * eval: (c-set-offset 'class-close 2) * End: */ z88dk-1.8.ds1/src/z80asm/z80asm.vcproj0000755000175000017500000001124410762606650017001 0ustar tygrystygrys z88dk-1.8.ds1/src/z80asm/z80instr.c0000644000175000017500000007337610637501700016301 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/z80instr.c,v 1.6 2007/06/24 14:46:24 dom Exp $ */ /* $History: Z80INSTR.C $ */ /* */ /* ***************** Version 13 ***************** */ /* User: Gbs Date: 3-10-99 Time: 12:59 */ /* Updated in $/Z80asm */ /* Change in CALLPKG(): */ /* 0 is allowed as parameter. 16 bit address 8bi split using % 256 and / */ /* 256. */ /* */ /* ***************** Version 12 ***************** */ /* User: Gbs Date: 30-09-99 Time: 22:39 */ /* Updated in $/Z80asm */ /* CALL_PKG hard coded macro implemented for Garry Lancaster's Package */ /* System. */ /* */ /* ***************** Version 10 ***************** */ /* User: Gbs Date: 6-06-99 Time: 20:07 */ /* Updated in $/Z80asm */ /* "PC" program counter changed to long (from unsigned short). */ /* */ /* ***************** Version 8 ***************** */ /* User: Gbs Date: 6-06-99 Time: 12:13 */ /* Updated in $/Z80asm */ /* Added Ascii Art "Z80asm" at top of source file. */ /* */ /* ***************** Version 6 ***************** */ /* User: Gbs Date: 6-06-99 Time: 11:31 */ /* Updated in $/Z80asm */ /* "config.h" included before "symbol.h" */ /* */ /* ***************** Version 4 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 14:59 */ /* Updated in $/Z80asm */ /* SourceSafe version history comment block added. */ #include #include #include #include "config.h" #include "symbol.h" /* external functions */ struct expr *ParseNumExpr (void); void ReportError (char *filename, short linenr, int errnum); void RemovePfixlist (struct expr *pfixexpr); void Pass2info (struct expr *expression, char constrange, long lfileptr); long EvalPfixExpr (struct expr *pfixexpr); int ExprSigned8 (int listpatchoffset); int CheckRegister8 (void); int IndirectRegisters (void); int CheckCondition (void); int CheckRegister16 (void); int ExprUnsigned8 (int listoffset); int ExprAddress (int listoffset); void ExtAccumulator(int opcode); /* local functions */ struct JRPC *AllocJRPC (void); void ADD_8bit_instr (void); void ADC_8bit_instr (void); void SBC_8bit_instr (void); void IncDec_8bit_instr (int opcode); void ArithLog8_instr (int opcode); void NewJRaddr (void); void JP_instr (int opc0, int opc); void Subroutine_addr (int opc0, int opc); /* global variables */ extern FILE *z80asmfile; extern unsigned char *codeptr, *codearea; extern long PC; extern struct module *CURRENTMODULE; extern enum symbols GetSym (void), sym; extern enum flag relocfile, ti83plus; extern int rcmX000; void PushPop_instr (int opcode) { int qq; if (GetSym () == name) switch (qq = CheckRegister16 ()) { case 0: case 1: case 2: *codeptr++ = opcode + qq * 16; ++PC; break; case 4: *codeptr++ = opcode + 48; ++PC; break; case 5: *codeptr++ = 221; *codeptr++ = opcode + 32; PC += 2; break; case 6: *codeptr++ = 253; *codeptr++ = opcode + 32; PC += 2; break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } void RET (void) { long constant; switch (GetSym ()) { case name: if ((constant = CheckCondition ()) != -1) *codeptr++ = 192 + constant * 8; /* RET cc instruction opcode */ else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; case newline: *codeptr++ = 201; break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return; } ++PC; } void EX (void) { if (GetSym () == lparen) if (GetSym () == name) if (CheckRegister16 () == 3) /* EX (SP) */ if (GetSym () == rparen) if (GetSym () == comma) if (GetSym () == name) switch (CheckRegister16 ()) { case 2: if (rcmX000) { /* Instruction code changed */ *codeptr++ = 0xED; *codeptr++ = 0x54; PC+=2; } else { *codeptr++ = 227; /* EX (SP),HL */ ++PC; } break; case 5: *codeptr++ = 221; *codeptr++ = 227; /* EX (SP),IX */ PC += 2; break; case 6: *codeptr++ = 253; *codeptr++ = 227; /* EX (SP),IY */ PC += 2; break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else if (sym == name) { switch (CheckRegister16 ()) { case 1: if (GetSym () == comma) /* EX DE,HL */ if (GetSym () == name) if (CheckRegister16 () == 2) { *codeptr++ = 235; ++PC; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; case 4: if (GetSym () == comma) /* EX AF,AF' */ if (GetSym () == name) if (CheckRegister16 () == 4) { *codeptr++ = 8; ++PC; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } void OUT (void) { long reg; if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } if (GetSym () == lparen) { GetSym (); if (CheckRegister8 () == 1) { /* OUT (C) */ if (GetSym () == rparen) if (GetSym () == comma) if (GetSym () == name) switch (reg = CheckRegister8 ()) { case 6: case 8: case 9: case -1: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; default: *codeptr++ = 237; *codeptr++ = 65 + reg * 8; /* OUT (C),r */ PC += 2; break; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } else { *codeptr++ = 211; if (!ExprUnsigned8 (1)) return; PC += 2; if (sym == rparen) if (GetSym () == comma) if (GetSym () == name) { if (CheckRegister8 () != 7) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } void IN (void) { long inreg; if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } if (GetSym () == name) { switch (inreg = CheckRegister8 ()) { case 8: case 9: case -1: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; default: if (GetSym () != comma) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } if (GetSym () != lparen) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } GetSym (); switch (CheckRegister8 ()) { case 1: *codeptr++ = 237; *codeptr++ = 64 + inreg * 8; /* IN r,(C) */ PC += 2; break; case -1: if (inreg == 7) { *codeptr++ = 219; if (ExprUnsigned8 (1)) if (sym != rparen) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); PC += 2; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; } break; } } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } void IM (void) { long constant; struct expr *postfixexpr; if (rcmX000) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } GetSym (); if ((postfixexpr = ParseNumExpr ()) != NULL) { if (postfixexpr->rangetype & NOTEVALUABLE) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); else { constant = EvalPfixExpr (postfixexpr); switch (constant) { case 0: *codeptr++ = 237; *codeptr++ = 70; /* IM 0 */ break; case 1: *codeptr++ = 237; *codeptr++ = 86; /* IM 1 */ break; case 2: *codeptr++ = 237; *codeptr++ = 94; /* IM 2 */ break; } PC += 2; } RemovePfixlist (postfixexpr); /* remove linked list, because expr. was evaluated */ } } void RST (void) { long constant; struct expr *postfixexpr; GetSym (); if ((postfixexpr = ParseNumExpr ()) != NULL) { if (postfixexpr->rangetype & NOTEVALUABLE) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); else { constant = EvalPfixExpr (postfixexpr); if ((constant >= 0 && constant <= 56) && (constant % 8 == 0)) { if ( (rcmX000) && ((constant == 0) || (constant == 8) || (constant == 0x30))) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else { *codeptr++ = 199 + constant; /* RST 00H, ... 38H */ ++PC; } } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 4); } RemovePfixlist (postfixexpr); } } void CALLOZ (void) { long constant; struct expr *postfixexpr; *codeptr++ = 231; /* RST 20H instruction */ ++PC; if (GetSym () == lparen) GetSym (); /* Optional parenthesis around expression */ if ((postfixexpr = ParseNumExpr ()) != NULL) { if (postfixexpr->rangetype & NOTEVALUABLE) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); /* CALL_OZ expression must be evaluable */ else { constant = EvalPfixExpr (postfixexpr); if ((constant > 0) && (constant <= 255)) { *codeptr++ = constant; /* 1 byte OZ parameter */ ++PC; } else if ((constant > 255) && (constant <= 65535)) { *codeptr++ = constant & 255; /* 2 byte OZ parameter */ *codeptr++ = constant >> 8; PC += 2; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 4); } RemovePfixlist (postfixexpr); /* remove linked list, because expr. was evaluated */ } } void CALLPKG (void) { long constant; struct expr *postfixexpr; *codeptr++ = 0xCF; /* RST 08H instruction */ ++PC; if (GetSym () == lparen) GetSym (); /* Optional parenthesis around expression */ if ((postfixexpr = ParseNumExpr ()) != NULL) { if (postfixexpr->rangetype & NOTEVALUABLE) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); /* CALL_OZ expression must be evaluable */ else { constant = EvalPfixExpr (postfixexpr); if ((constant >= 0) && (constant <= 65535)) { *codeptr++ = constant % 256; /* 2 byte parameter always */ *codeptr++ = constant / 256; PC += 2; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 4); } RemovePfixlist (postfixexpr); /* remove linked list, because expr. was evaluated */ } } void INVOKE (void) { long constant; struct expr *postfixexpr; if (ti83plus == ON) *codeptr++ = 0xEF; /* Ti83Plus: RST 28H instruction */ else *codeptr++ = 0xCD; /* Ti83: CALL */ ++PC; if (GetSym () == lparen) GetSym (); /* Optional parenthesis around expression */ if ((postfixexpr = ParseNumExpr ()) != NULL) { if (postfixexpr->rangetype & NOTEVALUABLE) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); /* INVOKE expression must be evaluable */ else { constant = EvalPfixExpr (postfixexpr); if ((constant >= 0) && (constant <= 65535)) { *codeptr++ = constant % 256; /* 2 byte parameter always */ *codeptr++ = constant / 256; PC += 2; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 4); } RemovePfixlist (postfixexpr); /* remove linked list, because expr. was evaluated */ } } void FPP (void) { long constant; struct expr *postfixexpr; *codeptr++ = 223; /* RST 18H instruction */ ++PC; if (GetSym () == lparen) GetSym (); /* Optional parenthesis around expression */ if ((postfixexpr = ParseNumExpr ()) != NULL) { if (postfixexpr->rangetype & NOTEVALUABLE) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); /* FPP expression must be evaluable */ else { constant = EvalPfixExpr (postfixexpr); if ((constant > 0) && (constant < 255)) { *codeptr++ = constant; /* 1 byte OZ parameter */ ++PC; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 4); } RemovePfixlist (postfixexpr); /* remove linked list, because expr. was evaluated */ } } void Subroutine_addr (int opcode0, int opcode) { long constant; extern enum flag EOL; GetSym (); if ((constant = CheckCondition ()) != -1) { /* Check for condition */ if (GetSym () != comma) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); return; } if (opcode0==205 && rcmX000) { static char buffer[200]; extern char *ident; #if 0 if ( constant >= 4 ) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } #endif switch ( constant ) { case 0: /* nz */ *codeptr++ = 0x28; /* jr z */ *codeptr++ = 0x03; *codeptr++ = opcode0; PC += 2; break; case 1: /* z */ *codeptr++ = 0x20; /* jr nz */ *codeptr++ = 0x03; *codeptr++ = opcode0; PC += 2; break; case 2: /* nc */ *codeptr++ = 0x38; /* jr c */ *codeptr++ = 0x03; *codeptr++ = opcode0; PC += 2; break; case 3: /* c */ *codeptr++ = 0x30; /* jr nc */ *codeptr++ = 0x03; *codeptr++ = opcode0; PC += 2; break; case 4: /* po */ *codeptr++ = 0xea; /* jp pe */ sprintf(buffer,"ASMPC+6\n"); SetTemporaryLine(buffer); GetSym(); ExprAddress (1); EOL = OFF; *codeptr++ = 205; PC += 3; break; case 5: /* pe */ *codeptr++ = 0xe2; /* jp po */ sprintf(buffer,"ASMPC+6\n"); SetTemporaryLine(buffer); GetSym(); ExprAddress (1); EOL = OFF; *codeptr++ = 205; PC += 3; break; case 6: /* p */ *codeptr++ = 0xfa; /* jp m */ sprintf(buffer,"ASMPC+6\n"); SetTemporaryLine(buffer); GetSym(); ExprAddress (1); EOL = OFF; *codeptr++ = 205; PC += 3; break; case 7: /* m */ *codeptr++ = 0xf2; /* jp p */ sprintf(buffer,"ASMPC+6\n"); SetTemporaryLine(buffer); GetSym(); ExprAddress (1); EOL = OFF; *codeptr++ = 205; PC += 3; break; } } else { *codeptr++ = opcode + constant * 8; /* get instruction opcode */ } GetSym(); } else { *codeptr++ = opcode0; /* JP nn, CALL nn */ } ExprAddress (1); PC += 3; } void JP_instr (int opc0, int opc) { long startexpr; /* file pointer to start of address expression */ startexpr = ftell (z80asmfile); /* remember position of possible start of expression */ if (GetSym () == lparen) { GetSym (); switch (CheckRegister16 ()) { case 2: /* JP (HL) */ *codeptr++ = 233; ++PC; break; case 5: /* JP (IX) */ *codeptr++ = 221; *codeptr++ = 233; PC += 2; break; case 6: /* JP (IY) */ *codeptr++ = 253; *codeptr++ = 233; PC += 2; break; case -1: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; } } else { fseek (z80asmfile, startexpr, SEEK_SET); /* no indirect register were found, reparse line after 'JP' */ Subroutine_addr (opc0, opc); /* base opcode for nn; cc, nn */ } } void JR (void) { struct expr *postfixexpr; long constant; if (GetSym () == name) { switch (constant = CheckCondition ()) { /* check for a condition */ case 0: case 1: case 2: case 3: *codeptr++ = 32 + constant * 8; if (GetSym () == comma) { GetSym (); /* point at start of address expression */ break; } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); /* comma missing */ return; } case -1: *codeptr++ = 24; /* opcode for JR e */ break; /* identifier not a condition id - check for legal expression */ default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); /* illegal condition, syntax * error */ return; } } PC += 2; /* assembler PC points at next instruction */ if ((postfixexpr = ParseNumExpr ()) != NULL) { /* get numerical expression */ if (postfixexpr->rangetype & NOTEVALUABLE) { NewJRaddr (); /* Amend another JR PC address to the list */ Pass2info (postfixexpr, RANGE_JROFFSET, 1); ++codeptr; /* update code pointer */ } else { constant = EvalPfixExpr (postfixexpr); constant -= PC; RemovePfixlist (postfixexpr); /* remove linked list - expression evaluated. */ if ((constant >= -128) && (constant <= 127)) *codeptr++ = constant; /* opcode is stored, now store relative jump */ else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 7); } } } void DJNZ (void) { struct expr *postfixexpr; long constant; *codeptr++ = 16; /* DJNZ opcode */ if (GetSym () == comma) GetSym (); /* optional comma */ PC += 2; if ((postfixexpr = ParseNumExpr ()) != NULL) { /* get numerical expression */ if (postfixexpr->rangetype & NOTEVALUABLE) { NewJRaddr (); /* Amend another JR PC address to the list */ Pass2info (postfixexpr, RANGE_JROFFSET, 1); ++codeptr; /* update code pointer */ } else { constant = EvalPfixExpr (postfixexpr); constant -= PC; RemovePfixlist (postfixexpr); /* remove linked list - expression evaluated. */ if ((constant >= -128) && (constant <= 127)) *codeptr++ = constant; /* opcode is stored, now store relative jump */ else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 7); } } } void NewJRaddr (void) { struct JRPC *newJRPC; if ((newJRPC = AllocJRPC ()) == NULL) { ReportError (NULL, 0, 3); return; } else { newJRPC->nextref = NULL; newJRPC->PCaddr = PC; } if (CURRENTMODULE->JRaddr->firstref == NULL) { /* no list yet */ CURRENTMODULE->JRaddr->firstref = newJRPC; /* initialise first reference */ CURRENTMODULE->JRaddr->lastref = newJRPC; } else { CURRENTMODULE->JRaddr->lastref->nextref = newJRPC; /* update last entry with new entry */ CURRENTMODULE->JRaddr->lastref = newJRPC; /* point to new entry */ } } struct JRPC * AllocJRPC (void) { return (struct JRPC *) malloc (sizeof (struct JRPC)); /* allocate new JR PC address */ } void ADD (void) { int acc16, reg16; long fptr; fptr = ftell (z80asmfile); GetSym (); switch (acc16 = CheckRegister16 ()) { case -1: fseek (z80asmfile, fptr, SEEK_SET); ExtAccumulator(0); /* 16 bit register wasn't found - try to evaluate the 8 bit version */ break; case 2: if (GetSym () == comma) { GetSym (); reg16 = CheckRegister16 (); if (reg16 >= 0 && reg16 <= 3) { *codeptr++ = 9 + 16 * reg16; /* ADD HL,rr */ ++PC; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; case 5: case 6: if (GetSym () == comma) { GetSym (); reg16 = CheckRegister16 (); switch (reg16) { case 0: case 1: case 3: break; case 5: case 6: if (acc16 == reg16) reg16 = 2; else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); return; } if (acc16 == 5) *codeptr++ = 221; else *codeptr++ = 253; *codeptr++ = 9 + 16 * reg16; PC += 2; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 10); break; } } void SBC (void) { int reg16; long fptr; fptr = ftell (z80asmfile); GetSym (); switch (CheckRegister16 ()) { case -1: fseek (z80asmfile, fptr, SEEK_SET); ExtAccumulator(3); /* 16 bit register wasn't found - try to evaluate the 8 bit version */ break; case 2: if (GetSym () == comma) { GetSym (); reg16 = CheckRegister16 (); if (reg16 >= 0 && reg16 <= 3) { *codeptr++ = 237; *codeptr++ = 66 + 16 * reg16; PC += 2; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; } } void ADC (void) { int reg16; long fptr; fptr = ftell (z80asmfile); GetSym (); switch (CheckRegister16 ()) { case -1: fseek (z80asmfile, fptr, SEEK_SET); ExtAccumulator(1); /* 16 bit register wasn't found - try to evaluate the 8 bit version */ break; case 2: if (GetSym () == comma) { GetSym (); reg16 = CheckRegister16 (); if (reg16 >= 0 && reg16 <= 3) { *codeptr++ = 237; *codeptr++ = 74 + 16 * reg16; PC += 2; } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; } } void ArithLog8_instr (int opcode) { long reg; if (GetSym () == lparen) switch (reg = IndirectRegisters ()) { case 2: *codeptr++ = 128 + opcode * 8 + 6; /* xxx A,(HL) */ ++PC; break; case 5: /* xxx A,(IX+d) */ case 6: if (reg == 5) *codeptr++ = 221; else *codeptr++ = 253; /* xxx A,(IY+d) */ *codeptr++ = 128 + opcode * 8 + 6; ExprSigned8 (2); PC += 3; break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } else { /* no indirect addressing, try to get an 8bit register */ reg = CheckRegister8 (); switch (reg) { /* 8bit register wasn't found, try to evaluate an expression */ case -1: *codeptr++ = 192 + opcode * 8 + 6; /* xxx A,n */ ExprUnsigned8 (1); PC += 2; break; case 6: /* xxx A,F illegal */ case 8: /* xxx A,I illegal */ case 9: /* xxx A,R illegal */ ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; default: if (reg & 8) { /* IXl or IXh */ *codeptr++ = 221; ++PC; } else if (reg & 16) { /* IYl or IYh */ *codeptr++ = 253; ++PC; } reg &= 7; *codeptr++ = 128 + opcode * 8 + reg; /* xxx A,r */ ++PC; break; } } } void INC (void) { int reg16; GetSym (); switch (reg16 = CheckRegister16 ()) { case -1: IncDec_8bit_instr (4); /* 16 bit register wasn't found - try to evaluate the 8bit version */ break; case 4: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; case 5: *codeptr++ = 221; *codeptr++ = 35; PC += 2; break; case 6: *codeptr++ = 253; *codeptr++ = 35; PC += 2; break; default: *codeptr++ = 3 + reg16 * 16; ++PC; break; } } void DEC (void) { int reg16; GetSym (); switch (reg16 = CheckRegister16 ()) { case -1: IncDec_8bit_instr (5); /* 16 bit register wasn't found - try to evaluate the 8bit version */ break; case 4: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; case 5: *codeptr++ = 221; *codeptr++ = 43; PC += 2; break; case 6: *codeptr++ = 253; *codeptr++ = 43; PC += 2; break; default: *codeptr++ = 11 + reg16 * 16; ++PC; break; } } void IncDec_8bit_instr (int opcode) { long reg; if (sym == lparen) { switch (reg = IndirectRegisters ()) { case 2: *codeptr++ = 48 + opcode; /* INC/DEC (HL) */ ++PC; break; case 5: /* INC/DEC (IX+d) */ case 6: if (reg == 5) *codeptr++ = 221; else *codeptr++ = 253; /* INC/DEC (IY+d) */ *codeptr++ = 48 + opcode; ExprSigned8 (2); PC += 3; break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } else { /* no indirect addressing, try to get an 8bit register */ reg = CheckRegister8 (); switch (reg) { case 6: case 8: case 9: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); /* INC/DEC I ; INC/DEC R * illegal */ break; case 12: case 13: *codeptr++ = 221; *codeptr++ = (reg & 7) * 8 + opcode; /* INC/DEC ixh,ixl */ PC += 2; break; case 20: case 21: *codeptr++ = 253; *codeptr++ = (reg & 7) * 8 + opcode; /* INC/DEC iyh,iyl */ PC += 2; break; default: *codeptr++ = reg * 8 + opcode; /* INC/DEC r */ ++PC; break; } } } void BitTest_instr (int opcode) { long bitnumber, reg; struct expr *postfixexpr; GetSym (); if ((postfixexpr = ParseNumExpr ()) != NULL) { /* Expression must not be stored in object file */ if (postfixexpr->rangetype & NOTEVALUABLE) { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 2); } else { bitnumber = EvalPfixExpr (postfixexpr); if (bitnumber >= 0 && bitnumber <= 7) { /* bit 0 - 7 */ if (sym == comma) { if (GetSym () == lparen) { switch ((reg = IndirectRegisters ())) { case 2: *codeptr++ = 203; /* (HL) */ *codeptr++ = opcode + bitnumber * 8 + 6; PC += 2; break; case 5: case 6: if (reg == 5) *codeptr++ = 221; else *codeptr++ = 253; *codeptr++ = 203; ExprSigned8 (2); *codeptr++ = opcode + bitnumber * 8 + 6; PC += 4; break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } } else { /* no indirect addressing, try to get an 8bit register */ reg = CheckRegister8 (); switch (reg) { case 6: case 8: case 9: case -1: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; default: *codeptr++ = 203; *codeptr++ = opcode + bitnumber * 8 + reg; PC += 2; } } } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); } else ReportError (CURRENTFILE->fname, CURRENTFILE->line, 4); } RemovePfixlist (postfixexpr); } } void RotShift_instr (int opcode) { long reg; if (GetSym () == lparen) switch ((reg = IndirectRegisters ())) { case 2: *codeptr++ = 203; *codeptr++ = opcode * 8 + 6; PC += 2; break; case 5: case 6: if (reg == 5) *codeptr++ = 221; else *codeptr++ = 253; *codeptr++ = 203; ExprSigned8 (2); *codeptr++ = opcode * 8 + 6; PC += 4; break; default: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); break; } else { /* no indirect addressing, try to get an 8bit register */ reg = CheckRegister8 (); switch (reg) { case 6: case 8: case 9: case -1: ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); break; default: *codeptr++ = 203; *codeptr++ = opcode * 8 + reg; PC += 2; } } } z88dk-1.8.ds1/src/z80asm/z80pass.c0000644000175000017500000006330207467275202016110 0ustar tygrystygrys/* ZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 ZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 ZZZZZ 888 888 0000 0000 ZZZZZ 88888888888888888 0000 0000 ZZZZZ 8888888888888 0000 0000 AAAAAA SSSSSSSSSSS MMMM MMMM ZZZZZ 88888888888888888 0000 0000 AAAAAAAA SSSS MMMMMM MMMMMM ZZZZZ 8888 8888 0000 0000 AAAA AAAA SSSSSSSSSSS MMMMMMMMMMMMMMM ZZZZZ 8888 8888 0000 0000 AAAAAAAAAAAA SSSSSSSSSSS MMMM MMMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 88888888888888888 0000000000000 AAAA AAAA SSSSS MMMM MMMM ZZZZZZZZZZZZZZZZZZZZZ 8888888888888 00000000000 AAAA AAAA SSSSSSSSSSS MMMM MMMM Copyright (C) Gunther Strube, InterLogic 1993-99 */ /* $Header: /cvsroot/z88dk/z88dk/src/z80asm/z80pass.c,v 1.3 2002/05/11 20:09:38 dom Exp $ */ /* $History: Z80PASS.C $ */ /* */ /* ***************** Version 14 ***************** */ /* User: Gbs Date: 26-01-00 Time: 22:10 */ /* Updated in $/Z80asm */ /* Expression range validation removed from 8bit unsigned (redundant). */ /* */ /* ***************** Version 12 ***************** */ /* User: Gbs Date: 6-06-99 Time: 20:07 */ /* Updated in $/Z80asm */ /* "PC" program counter changed to long (from unsigned short). */ /* */ /* ***************** Version 10 ***************** */ /* User: Gbs Date: 6-06-99 Time: 12:13 */ /* Updated in $/Z80asm */ /* Added Ascii Art "Z80asm" at top of source file. */ /* */ /* ***************** Version 8 ***************** */ /* User: Gbs Date: 6-06-99 Time: 11:39 */ /* Updated in $/Z80asm */ /* parseline() bug fix: code size may reach <= MAXCODESIZE. */ /* */ /* ***************** Version 7 ***************** */ /* User: Gbs Date: 30-05-99 Time: 1:06 */ /* Updated in $/Z80asm */ /* New function, Flncmp() to compare two filenames after internal lower */ /* case conversion (used by Include file mutual recursion validation). */ /* */ /* ***************** Version 6 ***************** */ /* User: Gbs Date: 2-05-99 Time: 18:16 */ /* Updated in $/Z80asm */ /* New function, FindFile(), to validate whether an include file already */ /* has been included in a previous include level. */ /* Z80pass2() bug fix: Expressions that are saved to object file */ /* (typically containing external symbols) shouldn't get evaluated - this */ /* can create unnecessary error messages. */ /* */ /* ***************** Version 4 ***************** */ /* User: Gbs Date: 17-04-99 Time: 0:30 */ /* Updated in $/Z80asm */ /* New GNU programming style C format. Improved ANSI C coding style */ /* eliminating previous compiler warnings. New -o option. Asm sources file */ /* now parsed even though any line feed standards (CR,LF or CRLF) are */ /* used. */ /* */ /* ***************** Version 2 ***************** */ /* User: Gbs Date: 20-06-98 Time: 15:10 */ /* Updated in $/Z80asm */ /* SourceSafe Version History Comment Block added. */ #include #include #include #include #include #include #include "config.h" #include "symbol.h" /* external functions */ void Skipline (FILE *fptr); void WriteLong (long fptr, FILE * fileid); void LinkModules (void); void DefineOrigin (void); void ParseIdent (enum flag interpret); void ReportError (char *filename, short linenr, int errnum); void RemovePfixlist (struct expr *pfixexpr); void StoreExpr (struct expr *pfixexpr, char range); int DefineSymbol (char *identifier, long value, unsigned char symboltype); int GetChar(FILE *fptr); long EvalPfixExpr (struct expr *pass2expr); struct expr *ParseNumExpr (void); enum symbols GetSym (void); symbol *FindSymbol (char *identifier, avltree * treeptr); char *AllocIdentifier (size_t len); /* local functions */ void ifstatement (enum flag interpret); void parseline (enum flag interpret); void getline (void); void Pass2info (struct expr *expression, char constrange, long lfileptr); void Z80pass1 (void); void Z80pass2 (void); void WriteSymbolTable (char *msg, avltree * root); void WriteListFile (void); void WriteHeader (void); void LineCounter (void); void PatchListFile (struct expr *pass2expr, long c); void WriteMapFile (void); void StoreName (symbol * node, unsigned char symscope); void StoreLibReference (symbol * node); void StoreGlobalName (symbol * node); void StoreLocalName (symbol * node); long Evallogexpr (void); struct sourcefile *Prevfile (void); struct sourcefile *Newfile (struct sourcefile *curfile, char *fname); struct sourcefile *Setfile (struct sourcefile *curfile, struct sourcefile *newfile, char *fname); struct sourcefile *FindFile (struct sourcefile *srcfile, char *fname); struct sourcefile *AllocFile (void); struct usedfile *AllocUsedFile (void); /* global variables */ extern FILE *z80asmfile, *listfile, *objfile, *mapfile; extern char *date, line[], ident[], separators[]; extern char *lstfilename, *objfilename, objext[], binext[]; extern enum symbols sym; extern enum flag listing, listing_CPY, verbose, writeline, symtable, z80bin, deforigin, EOL; extern long PC, oldPC; extern long EXPLICIT_ORIGIN; extern unsigned char *codearea, *codeptr, PAGELEN; extern size_t CODESIZE; extern int ASSEMBLE_ERROR; extern long listfileptr, TOTALLINES; extern struct modules *modulehdr; /* pointer to module header */ extern struct module *CURRENTMODULE; extern int PAGENR, LINENR, TOTALERRORS; extern int COLUMN_WIDTH, TAB_DIST; extern avltree *globalroot; #ifdef QDOS extern char _prog_name[], _version[], _copyright[]; #else extern char copyrightmsg[]; #endif void Z80pass1 (void) { line[0] = '\0'; /* reset contents of list buffer */ while (!feof (z80asmfile)) { if (listing) writeline = ON; parseline (ON); /* before parsing it */ switch (ASSEMBLE_ERROR) { case 3: case 12: return; /* Fatal errors, return immediatly... */ } } } void getline (void) { long fptr; int l,c; fptr = ftell (z80asmfile); /* remember file position */ c = '\0'; for (l=0; (l<254) && (c!='\n'); l++) { c = GetChar(z80asmfile); if (c != EOF) line[l] = c; /* line feed inclusive */ else break; } line[l] = '\0'; fseek (z80asmfile, fptr, SEEK_SET); /* resume file position */ } void parseline (enum flag interpret) { FindSymbol (ASSEMBLERPC, globalroot)->symvalue = PC; /* update assembler program counter */ if (PC <= MAXCODESIZE) { /* room for z80 machine code? */ ++CURRENTFILE->line; ++TOTALLINES; if (listing) getline (); /* get a copy of current source line */ EOL = OFF; /* reset END OF LINE flag */ GetSym (); if (sym == fullstop || sym == label) { if (interpret == ON) { /* Generate only possible label declaration if line parsing is allowed */ if (sym == label || GetSym () == name) { DefineSymbol (ident, PC, SYMADDR | SYMTOUCHED); /* labels must always be * touched due to forward */ GetSym (); /* check for another identifier *//* referencing problems in * expressions */ } else { ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11); /* a name must follow a * label declaration */ return; /* read in a new source line */ } } else { Skipline (z80asmfile); sym = newline; /* ignore label and rest of line */ } } switch (sym) { case name: ParseIdent (interpret); break; case newline: break; /* empty line, get next... */ default: if ( interpret == ON ) ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1); /* Syntax error */ } if (listing && writeline) WriteListFile (); /* Write current source line to list file, if allowed */ } else ReportError (NULL, 0, 12); /* no more room in machine code area */ } /* multilevel contitional assembly logic */ void ifstatement (enum flag interpret) { if (interpret == ON) { /* evaluate #if expression */ if (Evallogexpr () != 0) { do { /* expression is TRUE, interpret lines until #else or #endif */ if (!feof (z80asmfile)) { writeline = ON; parseline (ON); } else return; /* end of file - exit from this #if level */ } while ((sym != elsestatm) && (sym != endifstatm)); if (sym == elsestatm) { do { /* then ignore lines until #endif ... */ if (!feof (z80asmfile)) { writeline = OFF; parseline (OFF); } else return; } while (sym != endifstatm); } } else { do { /* expression is FALSE, ignore until #else or #endif */ if (!feof (z80asmfile)) { writeline = OFF; parseline (OFF); } else return; } while ((sym != elsestatm) && (sym != endifstatm)); if (sym == elsestatm) { do { if (!feof (z80asmfile)) { writeline = ON; parseline (ON); } else return; } while (sym != endifstatm); } } } else { do { /* don't evaluate #if expression and ignore all lines until #endif */ if (!feof (z80asmfile)) { writeline = OFF; parseline (OFF); } else return; /* end of file - exit from this IF level */ } while (sym != endifstatm); } sym = nil; } long Evallogexpr (void) { struct expr *postfixexpr; long constant = 0; GetSym (); /* get logical expression */ if ((postfixexpr = ParseNumExpr ()) != NULL) { constant = EvalPfixExpr (postfixexpr); RemovePfixlist (postfixexpr); /* remove linked list, expression evaluated */ } return constant; } void Z80pass2 (void) { struct expr *pass2expr, *prevexpr; struct JRPC *curJR, *prevJR; long constant, i; long fptr_exprdecl, fptr_namedecl, fptr_modname, fptr_modcode, fptr_libnmdecl; unsigned char *patchptr; if ((pass2expr = CURRENTMODULE->mexpr->firstexpr) != NULL) { curJR = CURRENTMODULE->JRaddr->firstref; /* point at first JR PC address in this module */ do { constant = EvalPfixExpr (pass2expr); if (pass2expr->stored == OFF) { if ((pass2expr->rangetype & EXPREXTERN) || (pass2expr->rangetype & EXPRADDR)) { /* * Expression contains symbol declared as external or defined as a relocatable * address, */ /* store expression in relocatable file */ switch (pass2expr->rangetype & RANGE) { case RANGE_32SIGN: StoreExpr (pass2expr, 'L'); break; case RANGE_16CONST: StoreExpr (pass2expr, 'C'); break; case RANGE_8UNSIGN: StoreExpr (pass2expr, 'U'); break; case RANGE_8SIGN: StoreExpr (pass2expr, 'S'); break; } } } if ((pass2expr->rangetype & NOTEVALUABLE) && (pass2expr->stored==OFF)) { if ((pass2expr->rangetype & RANGE) == RANGE_JROFFSET) { if (pass2expr->rangetype & EXPREXTERN) ReportError (pass2expr->srcfile, pass2expr->curline, 25); /* JR, DJNZ used an * external label - */ else ReportError (pass2expr->srcfile, pass2expr->curline, 2); prevJR = curJR; curJR = curJR->nextref; /* get ready for next JR instruction */ free (prevJR); } else ReportError (pass2expr->srcfile, pass2expr->curline, 2); } else { patchptr = codearea + pass2expr->codepos; /* absolute patch pos. in memory buffer */ switch (pass2expr->rangetype & RANGE) { case RANGE_JROFFSET: constant -= curJR->PCaddr; /* get module PC at JR instruction */ if (constant >= -128 && constant <= 127) { *patchptr = (char) constant; /* opcode is stored, now store * relative jump */ } else ReportError (pass2expr->srcfile, pass2expr->curline, 7); prevJR = curJR; curJR = curJR->nextref; /* get ready for JR instruction */ free (prevJR); break; case RANGE_8UNSIGN: *patchptr = (unsigned char) constant; /* opcode is stored, now store byte */ break; case RANGE_8SIGN: if (constant >= -128 && constant <= 255) { *patchptr = (char) constant; /* opcode is stored, now store * signed operand */ } else ReportError (pass2expr->srcfile, pass2expr->curline, 7); break; case RANGE_16CONST: if (constant >= -32768 && constant <= 65535) { *patchptr++ = (unsigned short) constant & 255; /* modulus 256 */ *patchptr = (unsigned short) constant >> 8; /* div 256 */ } else ReportError (pass2expr->srcfile, pass2expr->curline, 7); break; case RANGE_32SIGN: if (constant >= LONG_MIN && constant <= LONG_MAX) { for (i = 0; i < 4; i++) { *patchptr++ = (unsigned char) constant & 255; constant >>= 8; } } else ReportError (pass2expr->srcfile, pass2expr->curline, 7); break; } } if (listing_CPY) PatchListFile (pass2expr, constant); prevexpr = pass2expr; pass2expr = pass2expr->nextexpr; /* get next pass2 expression */ RemovePfixlist (prevexpr); /* release current expression */ } while (pass2expr != NULL); /* re-evaluate expressions and patch in code */ free (CURRENTMODULE->mexpr); /* Release header of expressions list */ free (CURRENTMODULE->JRaddr); /* Release header of relative jump address list */ CURRENTMODULE->mexpr = NULL; CURRENTMODULE->JRaddr = NULL; } if ((TOTALERRORS == 0) && symtable) { WriteSymbolTable ("Local Module Symbols:", CURRENTMODULE->localroot); WriteSymbolTable ("Global Module Symbols:", globalroot); } fptr_namedecl = ftell (objfile); inorder (CURRENTMODULE->localroot, (void (*)()) StoreLocalName); /* Store Local Name declarations to relocatable file */ inorder (globalroot, (void (*)()) StoreGlobalName); /* Store Global name declarations to relocatable file */ fptr_libnmdecl = ftell (objfile); /* Store library reference names */ inorder (globalroot, (void (*)()) StoreLibReference); /* Store library reference name declarations to relocatable file */ fptr_modname = ftell (objfile); constant = strlen (CURRENTMODULE->mname); fputc (constant, objfile); /* write length of module name to relocatable file */ fwrite (CURRENTMODULE->mname, sizeof (char), (size_t) constant, objfile); /* write module name to relocatable * file */ if ((constant = codeptr - codearea) == 0) fptr_modcode = -1; /* no code generated! */ else { fptr_modcode = ftell (objfile); fputc (constant % 256, objfile); /* low byte of module code size */ fputc (constant / 256, objfile); /* high byte of module code size */ fwrite (codearea, sizeof (char), (size_t) constant, objfile); } CODESIZE += constant; if (verbose) printf ("Size of module is %ld bytes\n", constant); fseek (objfile, 8, SEEK_SET); /* set file pointer to point at ORG */ if ((modulehdr->first == CURRENTMODULE)) { if (deforigin) CURRENTMODULE->origin = EXPLICIT_ORIGIN; /* use origin from command line */ } fputc (CURRENTMODULE->origin % 256, objfile); /* low byte of origin */ fputc (CURRENTMODULE->origin / 256, objfile); /* high byte of origin */ fptr_exprdecl = 30; /* expressions always begins at file position 24 */ if (fptr_namedecl == fptr_exprdecl) fptr_exprdecl = -1; /* no expressions */ if (fptr_libnmdecl == fptr_namedecl) fptr_namedecl = -1; /* no name declarations */ if (fptr_modname == fptr_libnmdecl) fptr_libnmdecl = -1; /* no library reference declarations */ WriteLong (fptr_modname, objfile); /* write fptr. to module name */ WriteLong (fptr_exprdecl, objfile); /* write fptr. to name declarations */ WriteLong (fptr_namedecl, objfile); /* write fptr. to name declarations */ WriteLong (fptr_libnmdecl, objfile); /* write fptr. to library name declarations */ WriteLong (fptr_modcode, objfile); /* write fptr. to module code */ } void StoreGlobalName (symbol * node) { if ((node->type & SYMXDEF) && (node->type & SYMTOUCHED)) StoreName (node, SYMXDEF); } void StoreLocalName (symbol * node) { if ((node->type & SYMLOCAL) && (node->type & SYMTOUCHED)) StoreName (node, SYMLOCAL); } void StoreName (symbol * node, unsigned char scope) { int b; switch (scope) { case SYMLOCAL: fputc ('L', objfile); break; case SYMXDEF: if (node->type & SYMDEF) fputc ('X', objfile); else fputc ('G', objfile); break; } if (node->type & SYMADDR) /* then write type of symbol */ fputc ('A', objfile); /* either a relocatable address */ else fputc ('C', objfile); /* or a constant */ WriteLong (node->symvalue, objfile); b = strlen (node->symname); fputc (b, objfile); /* write length of symbol name to relocatable file */ fwrite (node->symname, sizeof (char), (size_t) b, objfile); /* write symbol name to relocatable file */ } void StoreLibReference (symbol * node) { size_t b; if ((node->type & SYMXREF) && (node->type & SYMDEF) && (node->type & SYMTOUCHED)) { b = strlen (node->symname); fputc ((int) b, objfile); /* write length of symbol name to relocatable file */ fwrite (node->symname, sizeof (char), b, objfile); /* write symbol name to relocatable file */ } } void Pass2info (struct expr *pfixexpr, /* pointer to header of postfix expression linked list */ char constrange, /* allowed size of value to be parsed */ long byteoffset) { /* position in listing file to patch */ if (listing) byteoffset = listfileptr + 12 + 3 * byteoffset + 6 * ((byteoffset) / 32); /* * | | | | | add extra line, if hex bytes more than 1 line start of | | | no. of hex bytes * rel. to start current line in | length of hex number + space listfile | linenumber & 2 spaces + * hex address and 2 spaces */ else byteoffset = -1; /* indicate that this expression is not going to be patched in listing file */ pfixexpr->nextexpr = NULL; pfixexpr->rangetype = constrange; pfixexpr->srcfile = CURRENTFILE->fname; /* pointer to record containing current source file name */ pfixexpr->curline = CURRENTFILE->line; /* pointer to record containing current line number */ pfixexpr->listpos = byteoffset; /* now calculated as absolute file pointer */ if (CURRENTMODULE->mexpr->firstexpr == NULL) { CURRENTMODULE->mexpr->firstexpr = pfixexpr; CURRENTMODULE->mexpr->currexpr = pfixexpr; /* Expression header points at first expression */ } else { CURRENTMODULE->mexpr->currexpr->nextexpr = pfixexpr; /* Current expr. node points to new expression * node */ CURRENTMODULE->mexpr->currexpr = pfixexpr; /* Pointer to current expr. node updated */ } } struct sourcefile * Prevfile (void) { struct usedfile *newusedfile; struct sourcefile *ownedfile; if ((newusedfile = AllocUsedFile ()) == NULL) { ReportError (NULL, 0, 3); /* No room in operating system - stop assembler */ return (CURRENTFILE); /* return parameter pointer - nothing happended! */ } ownedfile = CURRENTFILE; CURRENTFILE = CURRENTFILE->prevsourcefile; /* get back to owner file - now the current */ CURRENTFILE->newsourcefile = NULL; /* current file is now the last in the list */ ownedfile->prevsourcefile = NULL; /* pointer to owner now obsolete... */ newusedfile->nextusedfile = CURRENTFILE->usedsourcefile; /* set ptr to next record to current ptr to * another used file */ CURRENTFILE->usedsourcefile = newusedfile; /* new used file now inserted into list */ newusedfile->ownedsourcefile = ownedfile; /* the inserted record now points to previously owned file */ return (CURRENTFILE); } struct sourcefile * Newfile (struct sourcefile *curfile, char *fname) { struct sourcefile *nfile; if (curfile == NULL) { /* file record has not yet been created */ if ((curfile = AllocFile ()) == NULL) { ReportError (NULL, 0, 3); return (NULL); } else return (Setfile (NULL, curfile, fname)); } else if ((nfile = AllocFile ()) == NULL) { ReportError (NULL, 0, 3); return (curfile); } else return (Setfile (curfile, nfile, fname)); } struct sourcefile * Setfile (struct sourcefile *curfile, /* pointer to record of current source file */ struct sourcefile *nfile, /* pointer to record of new * source file */ char *filename) { /* pointer to filename string */ if ((nfile->fname = AllocIdentifier (strlen (filename) + 1)) == NULL) { ReportError (NULL, 0, 3); return (nfile); } nfile->prevsourcefile = curfile; nfile->newsourcefile = NULL; nfile->usedsourcefile = NULL; nfile->filepointer = 0; nfile->line = 0; /* Reset to 0 as line counter during parsing */ nfile->fname = strcpy (nfile->fname, filename); return (nfile); } int Flncmp(char *f1, char *f2) { int i; if (strlen(f1) != strlen(f2)) return -1; else { i = strlen(f1); while(--i >= 0) if( tolower(f1[i]) != tolower(f2[i]) ) return -1; /* filenames equal */ return 0; } } struct sourcefile * FindFile (struct sourcefile *srcfile, char *flnm) { struct sourcefile *foundfile; if (srcfile != NULL) { if ((foundfile = FindFile(srcfile->prevsourcefile, flnm)) != NULL) return foundfile; /* trying to include an already included file recursively! */ if (Flncmp(srcfile->fname,flnm) == 0) return srcfile; /* this include file already used! */ else return NULL; /* this include file didn't match filename searched */ } else return NULL; } void PatchListFile (struct expr *pass2expr, long c) { int i; if (pass2expr->listpos == -1) return; /* listing wasn't switched ON during pass1 */ else { fseek (listfile, pass2expr->listpos, SEEK_SET); /* set file pointer in list file */ switch (pass2expr->rangetype & RANGE) { /* look only at range bits */ case RANGE_JROFFSET: case RANGE_8UNSIGN: case RANGE_8SIGN: fprintf (listfile, "%02X", (unsigned int) c); break; case RANGE_16CONST: fprintf (listfile, "%02X %02X", (unsigned int) (c % 256), (unsigned int) (c / 256) ); break; case RANGE_32SIGN: for (i = 0; i < 4; i++) { fprintf (listfile, "%02X ", (unsigned int) (c & 255) ); c >>= 8; } break; } } } /* * Write current source line to list file with Hex dump of assembled instruction */ void WriteListFile (void) { int l, k; if (strlen (line) == 0) strcpy (line, "\n"); l = PC - oldPC; if (l == 0) fprintf (listfile, "%-4d %04X%14s%s", CURRENTFILE->line, (unsigned short) oldPC, "", line); /* no bytes generated */ else if (l <= 4) { fprintf (listfile, "%-4d %04X ", CURRENTFILE->line, (unsigned short) oldPC); for (; l; l--) fprintf (listfile, "%02X ", *(codeptr - l)); fprintf (listfile, "%*s%s", (unsigned short) (4 - (PC - oldPC)) * 3, "", line); } else { while (l) { LineCounter (); if (l) fprintf (listfile, "%-4d %04X ", CURRENTFILE->line, (unsigned short) (PC - l)); for (k = (l - 32 > 0) ? 32 : l; k; k--) fprintf (listfile, "%02X ", *(codeptr - l--)); fprintf (listfile, "\n"); } fprintf (listfile, "%18s%s", "", line); LineCounter (); } LineCounter (); /* Update list file line counter - check page boundary */ listfileptr = ftell (listfile); /* Get file position for beginning of next line in list file */ oldPC = PC; } void LineCounter (void) { if (++LINENR > PAGELEN) { fprintf (listfile, "\x0C\n"); /* send FORM FEED to file */ WriteHeader (); LINENR = 6; } } void WriteHeader (void) { #ifdef QDOS fprintf (listfile, "%s %s, %s", _prog_name, _version, _copyright); fprintf (listfile, "%*.*s", 122 - strlen (_prog_name) - strlen (_version) - strlen (_copyright) - 3, strlen (date), date); #else fprintf (listfile, "%s", copyrightmsg); fprintf (listfile, "%*.*s", (int) 122 - strlen (copyrightmsg), (int) strlen (date), date); #endif fprintf (listfile, "Page %03d%*s'%s'\n\n\n", ++PAGENR, (int) 122 - 9 - 2 - strlen (lstfilename), "", lstfilename); } void WriteSymbol (symbol * n) { int k; int space, tabulators; struct pageref *page; if (n->owner == CURRENTMODULE) { /* Write only symbols related to current module */ if ((n->type & SYMLOCAL) || (n->type & SYMXDEF)) { if ((n->type & SYMTOUCHED)) { fprintf (listfile, "%s", n->symname); space = COLUMN_WIDTH - strlen (n->symname); for (tabulators = space % TAB_DIST ? space / TAB_DIST + 1 : space / TAB_DIST; tabulators > 0; tabulators--) fputc ('\t', listfile); fprintf (listfile, "= %08lX", n->symvalue); if (n->references != NULL) { page = n->references->firstref; fprintf (listfile, " : %3d* ", page->pagenr); page = page->nextref; k = 17; while (page != NULL) { if (k-- == 0) { fprintf (listfile, "\n%45s", ""); k = 16; LineCounter (); } fprintf (listfile, "%3d ", page->pagenr); page = page->nextref; } } fprintf (listfile, "\n"); LineCounter (); } } } } void WriteSymbolTable (char *msg, avltree * root) { fseek (listfile, 0, SEEK_END); /* File position to end of file */ fputc ('\n', listfile); LineCounter (); fputc ('\n', listfile); LineCounter (); fprintf (listfile, "%s", msg); LineCounter (); fputc ('\n', listfile); LineCounter (); fputc ('\n', listfile); LineCounter (); inorder (root, (void (*)()) WriteSymbol); /* write symbol table */ } struct usedfile * AllocUsedFile (void) { return (struct usedfile *) malloc (sizeof (struct usedfile)); } struct sourcefile * AllocFile (void) { return (struct sourcefile *) malloc (sizeof (struct sourcefile)); } z88dk-1.8.ds1/src/zcc/0000755000175000017500000000000010765202715014057 5ustar tygrystygrysz88dk-1.8.ds1/src/zcc/Makefile0000644000175000017500000000030207575162713015522 0ustar tygrystygrys OBJS = zcc.o CC = gcc all: zcc zcc: $(OBJS) ${CC} -o zcc ${CFLAGS} ${CCOPT} ${OBJS} install: install zcc $(PREFIX)/bin/ clean: $(RM) zcc zcc.o core #Dependencies zcc.o: zcc.c zcc.h z88dk-1.8.ds1/src/zcc/vscmake.bat0000644000175000017500000000033510537314617016203 0ustar tygrystygrys@echo off rem $Id: vscmake.bat,v 1.3 2006/12/11 17:46:55 stefano Exp $ echo **************** echo * Building zcc * echo **************** cl /Fezcc -DMSDOS -D _CRT_SECURE_NO_DEPRECATE *.c move zcc.exe ..\..\bin del *.obj z88dk-1.8.ds1/src/zcc/zcc.c0000644000175000017500000012632010702201153014770 0ustar tygrystygrys/* * Front End for The Small C+ Compiler * * Based on the frontend from zcc096 but substantially * reworked * * Each file is now processed in turn (all the way through) * And then everything is linked at the end, this makes it * quite a bit nicer, and a bit more standard - saves having * to preprocess all files and then find out there's an error * at the start of the first one! * * 3/12/98 djm * * 16/2/99 djm * Reworking so that we read a config file which tells us all we * need to know about paths etc - removes the variable things * from the executable - and makes it more portable - thanks * to Dennis for suggesting this one! * * 28/2/99 djm * Added an extra option CRT0 - this allows us to do wildcard * compiles such that main() doesn't have to be in the first * file. We also have the parameter COPYCMD which is whatever * the commmand is for copy files (COPYCMD [source] [dest]), * this is needed because the output file gets dumped in * {zcc}/lib/{CRT0}.bin because Z80 doesn't like being * specified an output filename. * * Also added the cleanup routines, these are a bit nasty, so * perhaps we could create temporary files (using tmpnam) - * but we'll leave that for the moment (till a later release!) * * An unwanted side effect of the cleanup routines is that if * you supply a filename which isn't .c and you compile all * the way through then the file will be zapped - for safety * don't use -cleanup if you have non .c files! * * 30/3/99 * Another rejig! This time we pass any unknown options through * to the compiler - so we can support other maths targets * without recompiling this thing all the time. * * Also, all specific references to the Z88 are out - we use the * config file to specify if what the flag is if -lmz is supplied * All libraries are now linked in via their name after -l after * being appended to the LIBPATH flag - so we don't have to * specify ghastly long paths * * I've dumped all the ** stuff for argument lists - now everything * is appended to one whopper of a line in memory - makes the code * quite a bit simpler - not possible for files since we change * the suffices constantly * * Just one slight problem still, this kit can't really be used * on a multiuser system because we assemble in zlib - sorting * this out might require a few changes to the system so that * we link pre-compiled object files for the maths files * * 1/4/99 More changes, this time allowing us to preserve zcc_opt.def * and to go the next stage and create applications, well, it would * except for my misunderstanding of the -g flag in z80asm - I * thought that it outputted .def files at link time of objects, but * I can't quite get it do it...pesky kids! * * 5/4/99 z80asm it seems doesn't treat DEFVARS -1 statements * correctly if they aren't assembled together, so, a temporary * patch to allow this to be done is not to assemble before linking * (this ensures DEFVARS are treated correctly) * * 15/4/99 Fixed it so temporary files are created in /tmp where * all the processing will take place, we can cleanup with a clear * conscience..we can cleanup with a clear consience, if we specify * -a the program won't compile because of the header file thing.. * Still dependent on zlib: but if Gunther implements -o function * then I think we might be able to get around it... * * * 19/4/99 We now copy the crt0 file to /tmp so multiusers and also * gets around removing the file problems..total bonus! * * 26/4/99 Tidied up a few things, made all errors printable, though * we do use a bizarre method to do it! * * 29/4/99 Fixed output name to be a.bin for apps (default name) * * 3/5/99 Made -make-lib pass through -make-lib to compiler (now * it accepts it, remove all references to .hdr files) * * 10/5/99 New option -notemp does all processing in the current * directory (copies CRT0 files over to a.#?) map files copied over * if required in the case of usetemp and requested. * * 18/5/99 -notemp copies over to crt0.#? instead of a.#? * * 12/1/2000 - Added -nt option for appmake to avoid page * truncation when making an app * * 23/1/2000 - Adding kludge for z80asm and removing any '.' * in the temporary name and replacing with '_' * * 27/1/2000 - Third level of optimization * * 28/1/2000 - Added MSDOS tmpnam() code and decided to make * zcc Makefile compatible by allow the -o option to come in * the next argument * * 31/1/2000 - Added the STYLECPP command, works for outspec'd * dunno about the others.. * * 17/4/2000 - Added in the ability to have a config directory * and made the + operator a tad more useful in specifying machines * within that directory * * 29/1/2001 - Added in -Ca flag to pass commands to assembler on * assemble pass (matches -Cp for preprocessor) * * $Id: zcc.c,v 1.33 2007/10/07 15:59:39 dom Exp $ */ #include #include #include #include #include "zcc.h" /* All our function prototypes */ void ParseArgs(char *); void AddComp(char *); void AddPreProc(char *); void AddToPreProc(char *); void AddToAssembler(char *); void AddAppmake(char *); void AddToAppmake(char *); void AddLink(char *); void DispInfo(void); void DispVer(char *); void SetVerbose(char *); void SetCompileOnly(char *); void SetAssembleOnly(char *); void SetOutputMap(char *); void SetOutputSym(char *); void SetPeepHole(char *); void AddToFileList(char *); void SetPeepHole(char *); void SetZ80Verb(char *); void SetOutputFile(char *); void SetCleanUp(char *); void UnSetCleanUp(char *); void SetPreProcessOnly(char *); void SetShowErrs(char *); void SetLibMake(char *); void SetPreserve(char *); void SetCreateApp(char *); void SetShortObj(char *); void SetLateAssemble(char *); void SetMPM(char *); void *mustmalloc(int); int hassuffix(char *, char *); char *changesuffix(char *, char *); int process(char *, char *, char *, char *, enum iostyle, int, int); int linkthem(char *); int main(int, char **); int FindSuffix(char *); void BuildAsmLine(char *, char *); void ParseArgs(char *); void BuildOptions(char **, char *); void BuildOptions_start(char **, char *); void CopyOutFiles(char *); void ParseOpts(char *); void SetNormal(char *,int); void SetOptions(char *,int); void SetNumber(char *,int); void SetConfig(char *, int); void KillEOL(char *); void CleanUpFiles(void); void CleanFile(char *, char *); void CopyCrt0(void); void ShowErrors(char *,char *); void SetTemp(char *); void UnSetTemp(char *); void SetRelocate(char *); int CopyFile(char *,char *, char *, char *); void tempname(char *); int FindConfigFile(char *, int); void parse_option(char *option); void linkargs_mangle(); /* Mode Options, used for parsing arguments */ struct args myargs[]= { {"z80-verb",NO,SetZ80Verb, "Make the assembler more verbose" }, {"cleanup",NO,SetCleanUp, "(default) Cleanup temporary files" }, {"no-cleanup",NO,UnSetCleanUp, "Don't cleanup temporary files" }, {"make-lib",NO,SetLibMake, "Compile as if to make a library" }, {"preserve",NO,SetPreserve, "Don't remove zcc_opt.def and start of run"}, {"make-app",NO,SetLateAssemble, "Create binary suitable for generated application" }, {"create-app",NO,SetCreateApp, "Run appmake on the resulting binary to create emulator usable file" }, {"usetemp",NO,SetTemp, "(default) Use the temporary directory for intermediate files"}, {"notemp",NO,UnSetTemp, "Don't use the temporary directory for intermediate files"}, {"mpm", NO, SetMPM, "Use MPM rather than Z80asm as the assembler"}, {"Cp",YES,AddToPreProc, "Add an option to the preprocessor" }, {"Ca",YES,AddToAssembler, "Add an option to the assembler" }, {"Cz",YES,AddToAppmake, "Add an option to appmake" }, {"E",NO,SetPreProcessOnly, "Only preprocess files" }, {"R",NO,SetRelocate, "Generate relocatable code"}, {"D",YES,AddPreProc, "Define a preprocessor option"}, {"U",YES,AddPreProc, "Undefine a preprocessor option"}, {"I",YES,AddPreProc, "Add an include directory for the preprocessor"}, {"l",YES,AddLink, "Add a library" }, {"O",YES,SetPeepHole, "Set the peephole optimiser setting" }, {"h",NO,DispVer, "Display this text"}, {"v",YES,SetVerbose, "Output all commands that are run (-vn suppresses)" }, {"c",NO,SetCompileOnly, "Only compile the .c files to .o files" }, {"a",NO,SetAssembleOnly, "Only compile the .c files to .asm/.opt files" }, {"m",NO,SetOutputMap, "Generate an output map of the final executable" }, {"s",NO,SetOutputSym, "Generate a symbol map of the final executable" }, {"o",YES,SetOutputFile, "Set the output files" }, {"nt",NO,AddAppmake, "Set notruncate on the appmake options" }, {"M",NO,SetShortObj, "Define the suffix of the object files (eg -Mo)" }, {"+",NO,AddPreProc, NULL}, /* Strips // comments in vcpp */ {"",0,NULL, NULL} }; struct confs myconf[]={ {"OPTIONS",SetOptions,NULL}, {"Z80EXE",SetNormal,NULL}, {"CPP",SetNormal,NULL}, {"LINKER",SetNormal,NULL}, {"COMPILER",SetNormal,NULL}, {"COPTEXE",SetNormal,NULL}, {"COPYCMD",SetNormal,NULL}, {"INCPATH",SetNormal,NULL}, {"COPTRULES1",SetNormal,NULL}, {"COPTRULES2",SetNormal,NULL}, {"COPTRULES3",SetNormal,NULL}, {"CRT0",SetNormal,NULL}, {"LIBPATH",SetNormal,NULL}, {"LINKOPTS",SetOptions,NULL}, {"ASMOPTS",SetOptions,NULL}, {"APPMAKE",SetNormal,NULL}, {"Z88MATHLIB",SetNormal,NULL}, {"Z88MATHFLG",SetNormal,NULL}, {"STARTUPLIB",SetNormal,NULL}, {"GENMATHLIB",SetNormal,NULL}, {"STYLECPP",SetNumber,NULL}, {"MPMEXE",SetNormal,NULL}, {"",NULL,NULL} }; /* * Oh, I know these could be chars, but I'm lazy! */ #if defined(__MSDOS__) && defined(__TURBOC__) /* Both predefined by Borland's Turbo C/C++ and Borland C/C++ */ int usetemp = 0; #else int usetemp = 1; #endif int preserve = 0; /* don't destroy zcc_opt */ int createapp = 0; /* Go the next stage and create the app */ int makelib = 0; int lateassemble = 0; int makeapp = 0; int z80verbose = 0; int cleanup = 1; int assembleonly = 0; int compileonly = 0; int verbose = 0; int peepholeopt = 0; int symbolson = 0; int mapon = 0; int ncppargs = 0; int preprocessonly = 0; int relocate = 0; int crtcopied = 0; /* Copied the crt0 code over? */ int gargc; /* Copies of argc and argv */ char **gargv; /* filelist has to stay as ** because we change suffix all the time */ int nfiles = 0; int usempm = 0; char **filelist; char **orgfiles; /* Original filenames... */ int ncompargs = 0; char *outputfile; char *cpparg; char *comparg; char *linkargs; char *asmargs; char *appmakeargs; char outfilename[FILENAME_MAX+1]; char extension[5]; #define OBJEXT extension /* * Default output binary filename - why mess with genius?!?! */ char *defaultout="a.bin"; char *defaultbin="a.bin"; /* Okay! Off we Go! */ void *mustmalloc(n) int n; { void *p; if ((p = malloc(n)) == 0) { fprintf(stderr, "malloc failed\n"); exit(1); } return (p); } int hassuffix(name, suffix) char *name, *suffix; { int nlen, slen; nlen = strlen(name); slen = strlen(suffix); if (slen > nlen) return (0); return (strcmp(&name[nlen-slen], suffix) == 0); } char *changesuffix(name, suffix) char *name, *suffix; { char *p, *r; if ((p = strrchr(name, '.')) == 0) { r = mustmalloc(strlen(name) + strlen(suffix) + 1); sprintf(r, "%s%s", name, suffix); } else { r = mustmalloc(p - name + strlen(suffix) + 1); r[0] = '\0'; strncat(r, name, p - name); strcat(r, suffix); } return (r); } int process(suffix, nextsuffix, processor, extraargs, ios,number,needsuffix) char *suffix, *nextsuffix, *processor, *extraargs; enum iostyle ios; int number; int needsuffix; /* Should dump suffix (z80) oi! */ { int status, errs; int tstore; char *buffer, *outname; errs = 0; if (!hassuffix(filelist[number], suffix)) return(0); switch (ios) { case outimplied: buffer = mustmalloc(strlen(processor) + strlen(extraargs)+ strlen(filelist[number]) + 3); /* Dropping the suffix for Z80..cheating! */ tstore=strlen(filelist[number])-strlen(suffix); if (!needsuffix) filelist[number][tstore]=0; sprintf(buffer, "%s %s %s", processor, extraargs, filelist[number]); filelist[number][tstore]='.'; break; case outspecified: /* This is only used for preprocessor, so, a quicj change here and * there.. */ outname = changesuffix(filelist[number], nextsuffix); buffer = mustmalloc(strlen(processor) + strlen(extraargs) + strlen(orgfiles[number]) + strlen(outname) + 4); sprintf(buffer, "%s %s %s %s", processor, extraargs, orgfiles[number], outname); free(outname); break; case filter: outname = changesuffix(filelist[number], nextsuffix); buffer = mustmalloc(strlen(processor) + strlen(extraargs) + strlen(filelist[number]) + strlen(outname) + 8); sprintf(buffer, "%s %s < %s > %s", processor, extraargs, filelist[number], outname); free(outname); } if (verbose) puts(buffer); status = system(buffer); if (status != 0) errs = 1; else { /* * Free up the allocated memory */ outname = changesuffix(filelist[number], nextsuffix); free(filelist[number]); filelist[number]=outname; } free(buffer); return (errs); } int linkthem(linker) char *linker; { int i, n, status; char *p; char *asmline; /* patch for z80asm */ char *ext; char *linkprog = myconf[LINKER].def; /* patch for z80asm */ if (peepholeopt) { asmline="-eopt "; ext=".opt"; } else { asmline="-easm "; ext=".asm"; } n = (strlen(linker) + 1); if (lateassemble) n+=strlen(asmline); /* patch for z80asm */ n += (strlen("-nm -nv -o -R -M ")+strlen(outputfile)); n += (strlen(linkargs) + 1); n += (strlen(myconf[CRT0].def)+strlen(ext) + 2 ); n += (2*strlen(myconf[LINKOPTS].def)); for (i = 0; i < nfiles; ++i) { n += strlen(filelist[i]); } p = mustmalloc(n); sprintf(p, "%s %s -o%s ", linker,myconf[LINKOPTS].def,outputfile); if (lateassemble) /* patch */ strcat(p,asmline); /* patch */ if (z80verbose) strcat(p,"-v "); if (relocate) { if (lateassemble) fprintf(stderr,"Cannot relocate an application..\n"); else strcat(p,"-R "); } if ( usempm ) { linkargs_mangle(linkargs); } strcat(p,linkargs); /* Now insert the 0crt file (so main doesn't have to be the first file * linkargs last character is space.. */ strcat(p,myconf[CRT0].def); strcat(p,ext); for (i = 0; i < nfiles; ++i) { if ( (!lateassemble && hassuffix(filelist[i], OBJEXT) ) || lateassemble ) { strcat(p, " "); //filelist[i][strlen(filelist[i])-strlen(OBJEXT)]='\0'; strcat(p, filelist[i]); } } if (verbose) printf("%s\n", p); status = system(p); free(p); return (status); } int main(argc, argv) int argc; char **argv; { int i, gc; char *temp,*temp2; char asmarg[4096]; /* Hell, that should be long enough! */ char buffer[LINEMAX+1]; /* For reading in option file */ FILE *fp; /* * Okay, the fun begins now, first of all, lets use atexit so we can * cleanup after ourselves.. */ if (( atexit(CleanUpFiles)) != 0) printf("Couldn't register atexit() routine\n"); strcpy(buffer," "); AddComp(buffer+1); asmargs=linkargs=cpparg=0; /* allocate enough pointers for all files, slight overestimate */ filelist = (char **)mustmalloc(sizeof(char *) * argc); orgfiles = (char **)mustmalloc(sizeof(char *) * argc); /* Now, find the environmental variable ZCCFILE which contains the * filename of our config file.. */ gc=1; /* Set for the first argument to scan for */ /* * If we only have one parameter, we don't want to go any further.. * (Linux quite rightly baulks..) */ if (argc == 1 ) { DispInfo(); exit(1); } gc=FindConfigFile(argv[gc],gc); /* * Okay, so now we read in the options file and get some info for us */ if ( (fp=fopen(outfilename,"r") ) == NULL ) { fprintf(stderr,"Can't open config file %s\n",outfilename); exit(1); } while (fgets(buffer,LINEMAX,fp) != NULL) { if (!isupper(buffer[0])) continue; ParseOpts(buffer); } fclose(fp); /* * Check to see if we are missing any definitions, if we are * exit.. */ for (i= Z80EXE ; i<= GENMATHLIB ; i++ ) { if ( myconf[i].def == NULL ) { fprintf(stderr,"Missing definition for %s\n",myconf[i].name); exit(1); } } /* * Now, set the linkargs list up to initially consist of * the startuplib */ snprintf(buffer,sizeof(buffer),"%s%s ",myconf[LIBPATH].def,myconf[STARTUPLIB].def); BuildOptions(&linkargs,buffer); /* * Set the default output file */ outputfile=defaultout; strcpy(outfilename,defaultout); /* * Copy the .obj into the extension var (used for linking &c) */ strcpy(extension,".obj"); /* * That's dealt with the options, so onto real stuff now! */ /* Now, parse the default options list */ if ( myconf[OPTIONS].def != NULL ) { parse_option(myconf[OPTIONS].def); } /* Parse the argument list */ gargv=argv; /* Point argv to start of command line */ for (gargc=gc;gargchelp ) { printf("-%-15s %s\n",cur->name, cur->help); cur++; } exit(0); } void SetRelocate(char *arg) { relocate=YES; } void SetShortObj(char *arg) { strcpy(extension,".o"); } void DispInfo(void) { printf("zcc - Frontend for the z88dk Cross-C Compiler\n"); printf(version); } void ParseArgs(char *arg) { struct args *pargs; int flag; pargs=myargs; flag=0; while(pargs->setfunc) { switch(pargs->more) { /* More info follows the initial thing.. */ case YES: if (strncmp(arg,pargs->name,strlen(pargs->name))==0) { (*pargs->setfunc)(arg); flag=1; } break; case NO: if (strcmp(arg,pargs->name)==0) { (*pargs->setfunc)(arg); flag=1; } } if (flag) return; pargs++; } AddComp(arg); } void ParseOpts(char *arg) { struct confs *pargs; int num=0; pargs=myconf; while(pargs->setfunc) { if (strncmp(arg,pargs->name,strlen(pargs->name))==0) { (*pargs->setfunc)(arg,num); return; } num++; pargs++; } printf("Unrecognised config option: %s\n",arg); return; } /* * Set the pointer in the myconf structure to be for out inputted thing * malloc the space for it, and then flunk if die.. */ void SetConfig(char *arg, int num) { if (myconf[num].def == NULL ) { myconf[num].def=(char *) mustmalloc(strlen(arg)+1); strcpy(myconf[num].def,arg); } else { fprintf(stderr,"%s already defined as %s",myconf[num].name,myconf[num].def); } } /* * Set a number option, very nasty, force our integer (0-2) to be * a char * type (saves a lot of rewriting really.. */ void SetNumber(char *arg,int num) { char name[LINEMAX+1]; int style; sscanf(arg,"%s%d",name,&style); if (style) myconf[num].def=(char *)(style-1); } void SetNormal(char *arg,int num) { char name[LINEMAX+1]; char *ptr,*ptr2; sscanf(arg,"%s%s",name,name); ptr = &arg[strlen(myconf[num].name)+1]; while (*ptr && isspace(*ptr)) ++ptr; if ( ptr2 = strchr(ptr,'\n') ) *ptr2 = 0; if ( ptr2 = strchr(ptr,'\r') ) *ptr2 = 0; if (strncmp(name,myconf[num].name,strlen(myconf[num].name)) != 0 ) { SetConfig(ptr,num); } } void SetOptions(char *arg,int num) { char name[LINEMAX+1]; char *ptr,*ptr2; sscanf(arg,"%s%s",name,name); ptr = &arg[strlen(myconf[num].name)+1]; while (*ptr && isspace(*ptr)) ++ptr; if ( ptr2 = strchr(ptr,'\n') ) *ptr2 = 0; if ( ptr2 = strchr(ptr,'\r') ) *ptr2 = 0; if (strncmp(name,myconf[num].name,strlen(myconf[num].name)) != 0 ) { SetConfig(ptr,num); } else { myconf[num].def = ""; } } /* * If there's a \n in the option line then kill it */ void KillEOL(char *str) { char *ptr; if ( (ptr=strrchr(str,'\n')) ) *ptr=0; } /* * Function to copy the files from /tmp to where they should be.. * if we want to keep them that is! */ void CopyOutFiles(char *suffix) { int j,k; char *ptr1,*ptr2; for (j=0;j FILENAME_MAX) { fprintf(stderr,"Possibly corrupt env variable ZCCCFG\n"); exit(1); } /* Config file in config directory */ strcpy(outfilename,cfgfile); strcat(outfilename,arg+1); strcat(outfilename,".cfg"); return(gc); } else { #ifdef __MSDOS__ snprintf(outfilename,sizeof(outfilename),"%s\\lib\\config\\%s.cfg",PREFIX,arg+1); #else #ifdef AMIGA snprintf(outfilename,sizeof(outfilename),"%slib/config/%s.cfg",PREFIX,arg+1); #else snprintf(outfilename,sizeof(outfilename),"%s/lib/config/%s.cfg",PREFIX,arg+1); #endif #endif } /* User supplied invalid config file, let it fall over back when */ return(gc); } /* * Okay, nowt specified so get the old style entry */ cfgfile=getenv("ZCCFILE"); if (cfgfile != NULL ) { if (strlen(cfgfile) > FILENAME_MAX) { fprintf(stderr,"Possibly corrupt env variable ZCCFILE\n"); exit(1); } strcpy(outfilename,cfgfile); return (gc); } /* * Last resort! * New style config take ZCCCFG/zcc.cfg */ cfgfile=getenv("ZCCCFG"); if (cfgfile !=NULL ) { if (strlen(cfgfile) > FILENAME_MAX) { fprintf(stderr,"Possibly corrupt env variable ZCCCFG\n"); exit(1); } strcpy(outfilename,cfgfile); strcat(outfilename,"zcc.cfg"); } else { #if 1 #if defined(__MSDOS__) && defined(__TURBOC__) /* Both predefined by Borland's Turbo C/C++ and Borland C/C++ */ snprintf(outfilename,sizeof(outfilename),"%s\\lib\\config\\zcc.cfg",PREFIX); #else snprintf(outfilename,sizeof(outfilename),"%s/lib/config/zcc.cfg",PREFIX); #endif #else fprintf(stderr,"Couldn't find env variable ZCCCFG\n"); exit(1); #endif } return(gc); } #if defined(AMIGA) && defined(_DCC) /* Dice has no snprintf */ #include int snprintf(char * buffer, size_t bufsize, const char * format, ...) { va_list argptr; int num_chars; va_start(argptr,format); num_chars = vsprintf(buffer, format, argptr); va_end(argptr); return num_chars; } #endif #if defined(__MSDOS__) && defined(__TURBOC__) /* Both predefined by Borland's Turbo C/C++ and Borland C/C++ */ int snprintf(char * buffer, size_t bufsize, const char * format, ...) { va_list argptr; int num_chars; va_start(argptr,format); num_chars = vsprintf(buffer, format, argptr); va_end(argptr); return num_chars; } #endif /* Parse options - rewritten to use strtok cos that's nice and easy */ void parse_option(char *option) { char *ptr; ptr = strtok(option," \t\r\n"); while ( ptr != NULL ) { if ( ptr[0] == '-' ) { ParseArgs(ptr+1); } else { AddToFileList(ptr); } ptr = strtok(NULL," \r\n"); } } /* Check link arguments (-i) to -l for mpm */ void linkargs_mangle() { char *ptr = linkargs; while ( ( ptr = strstr(linkargs,"-i") ) != NULL ) { ptr[1] = 'l'; } } z88dk-1.8.ds1/src/zcc/zcc.h0000644000175000017500000000411210702201153014767 0ustar tygrystygrys/* * Some standard defines which are the same for all machines - hopefully! * * rcs messing up..hohum! (twiddle, keep adding here till I sort it!) * * $Id: zcc.h,v 1.23 2007/10/07 15:59:39 dom Exp $ */ /* Very contrived, if not a Windows target then include the config file */ #if !defined(__MSDOS__) && !defined(__TURBOC__) #ifndef _WIN32 #include "../config.h" #endif #endif /* Some machine specific definitions (paths etc!) */ char *version = "v2.57 (C) 7.10.2007 D.J.Morris\n"; #ifdef AMIGA char *amiver="$VER: zcc v2.57 (7.10.2007)"; #endif #if defined(__MSDOS__) && defined(__TURBOC__) /* Both predefined by Borland's Turbo C/C++ and Borland C/C++ */ #define PREFIX "c:\\z88dk" #include int snprintf(char * buffer, size_t bufsize, const char * format, ...); #endif #ifdef _WIN32 /* Predefined in 32-bit MS Visual C/C++ and Borland Builder C/C++ */ #define PREFIX "c:/z88dk" #endif #if _MSC_VER >= 1200 /* Predefined by Microsoft Visual C++ 6.0 */ #define snprintf _snprintf #endif /* hpux 9 has a slightly odd FILENAME_MAX defined */ #ifdef hpux #undef FILENAME_MAX #define FILENAME_MAX 1024 #endif /* * Now some fun stuff - all this moved out of zcc.c to clean * things up a little bit! */ #define CFILE 1 #define PFILE 2 #define AFILE 3 #define OFILE 4 #define NO 0 #define YES 1 #define Z88MATH 1 #define GENMATH 2 #define LINEMAX 1024 /* Max number of chars to read from config file*/ /* * Sorry, this is hard coded, hopefully won't cause too many * problems - needed to ensure math libs are linked in correctly! */ #define DEFFILE "zcc_opt.def" struct args { char *name; char more; void (*setfunc)(char *); char *help; }; struct confs { char *name; void (*setfunc)(char *,int); char *def; }; enum iostyle { outimplied=0, outspecified, filter }; enum conf { OPTIONS, Z80EXE, CPP, LINKER, COMPILER, COPTEXE, COPYCMD, INCPATH, COPTRULES1, COPTRULES2, COPTRULES3, CRT0, LIBPATH, LINKOPTS, ASMOPTS, APPMAKE, Z88MATHLIB, Z88MATHFLG, STARTUPLIB, GENMATHLIB, CPPSTYLE, MPMEXE }; z88dk-1.8.ds1/src/zcc/zcc.vcproj0000755000175000017500000000752110762606650016076 0ustar tygrystygrys z88dk-1.8.ds1/support/0000755000175000017500000000000010765202715014225 5ustar tygrystygrysz88dk-1.8.ds1/support/8080/0000755000175000017500000000000010765202715014624 5ustar tygrystygrysz88dk-1.8.ds1/support/8080/README0000755000175000017500000000037610023343443015504 0ustar tygrystygrys$Id: README,v 1.1 2004/03/09 13:31:15 stefano Exp $ 8080 conversion and support tools. toz80.awk usage (awk or gawk required): gawk -f toz80.awk < 8080code.asm > z80code.asm You might need to tweak the script a bit by changing the record separator. z88dk-1.8.ds1/support/8080/toZ80.awk0000755000175000017500000005414010732675645016275 0ustar tygrystygrys# toZ80.awk # Convert any 8080 assembler source file to Z80 mnemonics # Copyright (c) 2003 Douglas Beattie Jr. # All rights reserved world-wide # # Re-arranged for Z88DK by Stefano Bodrato # # There's an experimental section specific for z80asm (labels); # remove the whole section for a more classic output # # $Id: toZ80.awk,v 1.2 2007/12/21 08:39:01 stefano Exp $ # BEGIN { temp_xyz = "zyx" # temporary replacement for Mnemonic temp_label = "zz" # temporary replacement for ^LABEL label = "?" # storage for label during conversion label_reg_exp = "^[^; \t]+" instr_tabulator = "\t" # space between operator and operand on some converted # Record separator RS = "\r\n" # CRLF ...comment out for newline only or alter as required #RS = "\n" # CR only ...sometimes this is the right option } function save_label() { if (match($0,/^[^; \t]+/)) { label = substr($0,RSTART,RLENGTH) #printf("%d %d",RSTART,RLENGTH); sub(label_reg_exp,temp_label) } #save symbols sub(/@/,"czhzi"); sub(/+/,"pzlzs"); sub(/-/,"mzizn"); sub(/*/,"mzuzl"); #*/ just to fix the colouring of some editor :o) sub("/","dzizv"); } function restore_label() { if (label != "?") { sub(temp_label,label) label = "?" # init for next label } #restore symbols sub("czhzi",/@/); sub("pzlzs","+"); sub("mzizn","-"); sub("mzuzl","*"); sub("dzizv","/"); } function get_operand(op_regexp,op_len) { regexp_str = op_regexp "[ \t]+[^ \t,]+([, \t]|$)" match($0,regexp_str); tmp_str = substr($0,(RSTART+op_len),(RLENGTH-(op_len))) match(tmp_str,/[^ \t,]+/); tmp_str = substr(tmp_str,(RSTART),(RLENGTH)) return tmp_str } # Substitute BC for B, DE for D, or HL for H in operand field function sub_bdh() { if (match(wkg_str,/[BbDdHh]/)) { if (match(wkg_str,/[Bb]/)) { sub(/[Bb]/,"BC"); } else if (match(wkg_str,/[Dd]/)) { sub(/[Dd]/,"DE"); } else if (match(wkg_str,/[Hh]/)) { sub(/[Hh]/,"HL"); } } } #### Z80ASM label redefinition #### EQU to "defc" (/^[^;]*[ \t]+[eE][qQ][uU][ \t]/) { match_counter=match($0,";"); match_result=""; if (match_counter>0) match_result=substr($0,match_counter); print "defc", $1, " = " ,$3, match_result; next } #### db to "defm" (/^[^; \t]*[ \t]+([Dd][Bb])[ \t]+[^ \t]+([; \t]|$)/) { save_label() sub(/''/,"zpicettaz"); sub(/'/,"\""); sub(/'/,"\""); sub(/[Dd][Bb]/,"defm"); sub("zpicettaz","'"); restore_label() print $0 next } #### ds to "defs" (/^[^; \t]*[ \t]+([Dd][Ss])[ \t]+[^ \t]+([; \t]|$)/) { save_label() sub(/[Dd][Ss]/,"defs"); restore_label() print $0 next } #### dw to "defw" (/^[^; \t]*[ \t]+([Dd][Ww])[ \t]+[^ \t]+([; \t]|$)/) { save_label() sub(/[Dd][Ww]/,"defw"); restore_label() print $0 next } #### Label section end #### look for "r,M" (/^[^; \t]*[ \t]+[^; \t]+[ \t]+[^; \t]+,[mM]/) { sub(/,[mM]/,",(HL)"); } #### look for "M,r" (/^[^; \t]*[ \t]+[^; \t]+[ \t]+[mM],[^; \t]+([; \t]|$)/) { sub(/[mM],/,"(HL),"); } #### MOV ############################ (/^[^; \t]*[ \t]+[Mm][Oo][Vv][ \t]/) { save_label() sub(/[Mm][Oo][Vv]/,"LD "); restore_label() print $0 next } #### MVI ############################ (/^[^; \t]*[ \t]+[Mm][Vv][Ii][ \t]/) { save_label() sub(/[Mm][Vv][Ii]/,"LD "); restore_label() print $0 next } #### LDAX ############################ (/^[^; \t]*[ \t]+([Ll][Dd][Aa][Xx])/) { save_label() wkg_str = get_operand("[Ll][Dd][Aa][Xx]",4); if (match(wkg_str,/[Dd]/)) { sub(/[Ll][Dd][Aa][Xx]/,temp_xyz); sub(wkg_str,"A,(DE)"); sub(temp_xyz,"LD"); restore_label() print $0 next } else if (match(wkg_str,/[Bb]/)) { sub(/[Ll][Dd][Aa][Xx]/,temp_xyz); sub(wkg_str,"A,(BC)"); sub(temp_xyz,"LD"); restore_label() print $0 next } } #### STAX ############################ (/^[^; \t]*[ \t]+([Ss][Tt][Aa][Xx])/) { save_label() wkg_str = get_operand("[Ss][Tt][Aa][Xx]",4); if (match(wkg_str,/[Dd]/)) { sub(/[Ss][Tt][Aa][Xx]/,temp_xyz); sub(wkg_str,"(DE),A"); sub(temp_xyz,"LD"); restore_label() print $0 next } else if (match(wkg_str,/[Bb]/)) { sub(/[Ss][Tt][Aa][Xx]/,temp_xyz); sub(wkg_str,"(BC),A"); sub(temp_xyz,"LD"); restore_label() print $0 next } } ### LDA word ############################ (/^[^; \t]*[ \t]+([Ll][Dd][Aa])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("[Ll][Dd][Aa]",3); sub(/[Ll][Dd][Aa]/,temp_xyz); sub(wkg_str,"A,(" wkg_str ")" ); sub(temp_xyz,"LD"); restore_label() print $0 next } ### STA word ############################ (/^[^; \t]*[ \t]+([Ss][Tt][Aa])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("[Ss][Tt][Aa]",3); sub(/[Ss][Tt][Aa]/,temp_xyz); sub(wkg_str,"(" wkg_str "),A" ); sub(temp_xyz,"LD"); restore_label() print $0 next } ### LXI B/D/H/SP,word ############################ (/^[^; \t]*[ \t]+([Ll][Xx][Ii])/) { save_label() wkg_str = get_operand("[Ll][Xx][Ii]",3); sub_bdh() sub(/[Ll][Xx][Ii]/,"LD"); restore_label() print $0 next } ### LHLD word ############################ (/^[^; \t]*[ \t]+([Ll][Hh][Ll][Dd])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("[Ll][Hh][Ll][Dd]",4); sub(/[Ll][Hh][Ll][Dd]/,temp_xyz); sub(wkg_str,"HL,(" wkg_str ")" ); sub(temp_xyz,"LD") restore_label() print $0 next } ### SHLD word ############################ (/^[^; \t]*[ \t]+([Ss][Hh][Ll][Dd])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("[Ss][Hh][Ll][Dd]",4); sub(/[Ss][Hh][Ll][Dd]/,temp_xyz); sub(wkg_str,"(" wkg_str "),HL" ); sub(temp_xyz,"LD") restore_label() print $0 next } #### Simple replacements (no operand) ############################ ###### SPHL (/^[^; \t]*[ \t]+([Ss][Pp][Hh][Ll])([; \t]|$)/) { save_label() sub(/[Ss][Pp][Hh][Ll]/,"LD"instr_tabulator"SP,HL"); restore_label() print $0 next } ###### XCHG (/^[^; \t]*[ \t]+([Xx][Cc][Hh][Gg])([; \t]|$)/) { save_label() sub(/[Xx][Cc][Hh][Gg]/,"EX"instr_tabulator"DE,HL"); restore_label() print $0 next } ###### XTHL (/^[^; \t]*[ \t]+([Xx][Tt][Hh][Ll])([; \t]|$)/) { save_label() sub(/[Xx][Tt][Hh][Ll]/,"EX"instr_tabulator"(SP),HL"); restore_label() print $0 next } ###### HLT (/^[^; \t]*[ \t]+([Hh][Ll][Tt])/) { save_label() sub(/[Hh][Ll][Tt]/,"HALT"); restore_label() print $0 next } ###### PCHL (/^[^; \t]*[ \t]+([Pp][Cc][Hh][Ll])([; \t]|$)/) { save_label() sub(/[Pp][Cc][Hh][Ll]/,"JP"instr_tabulator"(HL)"); restore_label() print $0 next } ###### ADI ACI ############################ (/^[^; \t]*[ \t]+[aA]([dD]|[cC])[iI][ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("[aA]([dD]|[cC])[iI]",3); if (match($0,/[Aa][Dd][Ii]/)) { sub(/[Aa][Dd][Ii]/,temp_xyz); sub(wkg_str,"A," wkg_str ); sub(temp_xyz,"ADD") } else if (match($0,/[Aa][Cc][Ii]/)) { sub(/[Aa][Cc][Ii]/,temp_xyz); sub(wkg_str,"A," wkg_str ); sub(temp_xyz,"ADC") } restore_label() print $0; next } ###### SUI SBI ############################ (/^[^; \t]*[ \t]+[sS]([uU]|[bB])[iI][ \t]+[^ \t]+([; \t]|$)/) { save_label() if (match($0,/[Ss][Uu][Ii]/)) { sub(/[Ss][Uu][Ii]/,"SUB"); } else if (match($0,/[Ss][Bb][Ii]/)) { sub(/[Ss][Bb][Ii]/,"SBC"); } restore_label() print $0; next } ###### SBB (/^[^; \t]*[ \t]+[sS][bB][bB][ \t]+[^ \t]+([; \t]|$)/) { wkg_str = get_operand("([Ss][Bb][Bb])",3); if (match(wkg_str,/^[^;]*[Mm]/)) { sub(/[Mm]/,"(HL)"); } save_label() if (match($0,/[sS][bB][bB]/)) { sub(/[sS][bB][bB]/,"SBC"); } restore_label() print $0; next } ###### SUB M (/^[^; \t]*[ \t]+[sS][uU][bB][ \t]+[^ \t]+([; \t]|$)/) { wkg_str = get_operand("([Ss][Uu][Bb])",3); if (match(wkg_str,/^[^;]*[Mm]/)) { sub(/[Mm]/,"(HL)"); } print $0; next } ###### ADD ADC ############################ (/^[^; \t]*[ \t]+([aA][dD][dD]|[aA][dD][cC])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("([aA][dD][dD]|[aA][dD][cC])",3); if (match($0,/[Aa][Dd][Dd]/)) { sub(/[Aa][Dd][Dd]/,temp_xyz); sub(wkg_str,"A," wkg_str ); sub(temp_xyz,"ADD") } else if (match($0,/[Aa][Dd][Cc]/)) { sub(/[Aa][Dd][Cc]/,temp_xyz); sub(wkg_str,"A," wkg_str ); sub(temp_xyz,"ADC") } if (match(wkg_str,/^[^;]*[Mm]/)) { sub(/[Mm]/,"(HL)"); } restore_label() print $0 next } ###### DAD ############################ (/^[^; \t]*[ \t]+([dD][aA][dD])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("[dD][aA][dD]",3); sub(/[dD][aA][dD]/,temp_xyz); sub_bdh() sub(temp_xyz,"ADD") sub(/ADD[ \t]*/,"ADD"instr_tabulator"HL,") restore_label() print $0 next } ###### INR DCR ############################ (/^[^; \t]*[ \t]+([Ii][Nn][Rr]|[Dd][Cc][Rr])[ \t]/) { save_label() wkg_str = get_operand("([Ii][Nn][Rr]|[Dd][Cc][Rr])",3); if (match(wkg_str,/^[^;]*[Mm]/)) { sub(/[Mm]/,"(HL)"); } if (match($0,/[Ii][Nn][Rr]/)) { sub(/[Ii][Nn][Rr]/,"INC"); } else if (match($0,/[Dd][Cc][Rr]/)) { sub(/[Dd][Cc][Rr]/,"DEC"); } restore_label() print $0 next } ###### INX DCX ############################ (/^[^; \t]*[ \t]+([Ii][Nn][Xx]|[Dd][Cc][Xx])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("([Ii][Nn][Xx]|[Dd][Cc][Xx])",3); if (match($0,/[Ii][Nn][Xx]/)) { sub(/[Ii][Nn][Xx]/,temp_xyz); sub_bdh() sub(temp_xyz,"INC") } else if (match($0,/[Dd][Cc][Xx]/)) { sub(/[Dd][Cc][Xx]/,temp_xyz); sub_bdh() sub(temp_xyz,"DEC") } restore_label() print $0 next } ###### CMA ############################ (/^[^; \t]*[ \t]+([Cc][Mm][Aa])([; \t]|$)/) { save_label() sub(/[Cc][Mm][Aa]/,"CPL"); restore_label() print $0 next } ###### STC ############################ (/^[^; \t]*[ \t]+([Ss][Tt][Cc])([; \t]|$)/) { save_label() sub(/[Ss][Tt][Cc]/,"SCF"); restore_label() print $0 next } ###### CMC ############################ (/^[^; \t]*[ \t]+([Cc][Mm][Cc])([; \t]|$)/) { save_label() sub(/[Cc][Mm][Cc]/,"CCF"); restore_label() print $0 next } ###### RLC ############################ (/^[^; \t]*[ \t]+([Rr][Ll][Cc])([; \t]|$)/) { save_label() sub(/[Rr][Ll][Cc]/,"RLCA"); restore_label() print $0 next } ###### RRC ############################ (/^[^; \t]*[ \t]+([Rr][Rr][Cc])([; \t]|$)/) { save_label() sub(/[Rr][Rr][Cc]/,"RRCA"); restore_label() print $0 next } ###### RAL ############################ (/^[^; \t]*[ \t]+([Rr][Aa][Ll])([; \t]|$)/) { save_label() sub(/[Rr][Aa][Ll]/,"RLA"); restore_label() print $0 next } ###### RAR ############################ (/^[^; \t]*[ \t]+([Rr][Aa][Rr])([; \t]|$)/) { save_label() sub(/[Rr][Aa][Rr]/,"RRA"); restore_label() print $0 next } ###### ANI XRI ORI ############################ (/^[^; \t]*[ \t]+([Aa][Nn][Ii]|[Xx][Rr][Ii]|[Oo][Rr][Ii])[ \t]+[^ \t]+([; \t]|$)/) { save_label() if (match($0,/[Aa][Nn][Ii]/)) { sub(/[Aa][Nn][Ii]/,"AND"); } else if (match($0,/[Xx][Rr][Ii]/)) { sub(/[Xx][Rr][Ii]/,"XOR"); } else if (match($0,/[Oo][Rr][Ii]/)) { sub(/[Oo][Rr][Ii]/,"OR"); } restore_label() print $0; next } ###### ANA XRA ORA ############################ (/^[^; \t]*[ \t]+([Aa][Nn][Aa]|[Xx][Rr][Aa]|[Oo][Rr][Aa])[ \t]/) { save_label() wkg_str = get_operand("([Aa][Nn][Aa]|[Xx][Rr][Aa]|[Oo][Rr][Aa])",3); if (match(wkg_str,/^[^;]*[Mm]/)) { sub(/[Mm]/,"(HL)"); } if (match($0,/[Aa][Nn][Aa]/)) { sub(/[Aa][Nn][Aa]/,"AND"); } else if (match($0,/[Xx][Rr][Aa]/)) { sub(/[Xx][Rr][Aa]/,"XOR"); } else if (match($0,/[Oo][Rr][Aa]/)) { sub(/[Oo][Rr][Aa]/,"OR"); } restore_label() print $0 next } ###### CPI ############################ (/^[^; \t]*[ \t]+([Cc][Pp][Ii])[ \t]+[^ \t]+([; \t]|$)/) { save_label() sub(/[Cc][Pp][Ii]/,"CP"); restore_label() print $0; next } ###### CMP ############################ (/^[^; \t]*[ \t]+([Cc][Mm][Pp])[ \t]/) { save_label() wkg_str = get_operand("[Cc][Mm][Pp]",3); sub(/[Cc][Mm][Pp]/,temp_xyz); if (match(wkg_str,/^[^;]*[Mm]/)) { sub(/[Mm]/,"(HL)"); } sub(temp_xyz,"CP") restore_label() print $0 next } ###### JMP ############################ (/^[^; \t]*[ \t]+([Jj][Mm][Pp])[ \t]+[^ \t]+([; \t]|$)/) { save_label() sub(/[Jj][Mm][Pp]/,"JP"); restore_label() print $0; next } ###### JNZ JNC JPO JPE ############################ (/^[^; \t]*[ \t]+[Jj]([Nn][Zz]|[Nn][Cc]|[Pp][Oo]|[Pp][Ee])[ \t]+[^ \t]+([; \t]|$)/) { save_label() if (match($0,/[Jj][Nn][Zz][ \t]+/)) { sub(/[Jj][Nn][Zz][ \t]+/,"JP"instr_tabulator"NZ,"); } else if (match($0,/[Jj][Nn][Cc][ \t]+/)) { sub(/[Jj][Nn][Cc][ \t]+/,"JP"instr_tabulator"NC,"); } else if (match($0,/[Jj][Pp][Oo][ \t]+/)) { sub(/[Jj][Pp][Oo][ \t]+/,"JP"instr_tabulator"PO,"); } else if (match($0,/[Jj][Pp][Ee][ \t]+/)) { sub(/[Jj][Pp][Ee][ \t]+/,"JP PE,"); } restore_label() print $0; next } ###### JZ JC JP JM ############################ (/^[^; \t]*[ \t]+[Jj]([Zz]|[Cc]|[Pp]|[Mm])[ \t]+[^ \t]+([; \t]|$)/) { save_label() if (match($0,/^[^;]*[Jj][Zz][ \t]+/)) { sub(/[Jj][Zz][ \t]+/,"JP"instr_tabulator"Z,"); } else if (match($0,/^[^;]*[Jj][Cc][ \t]+/)) { sub(/[Jj][Cc][ \t]+/,"JP"instr_tabulator"C,"); } else if (match($0,/^[^;]*[Jj][Pp][ \t]+/)) { sub(/[Jj][Pp][ \t]+/,"JP"instr_tabulator"P,"); } else if (match($0,/^[^;]*[Jj][Mm][ \t]+/)) { sub(/[Jj][Mm][ \t]+/,"JP"instr_tabulator"M,"); } restore_label() print $0; next } ###### CNZ CNC CPO CPE ############################ (/^[^; \t]*[ \t]+[Cc]([Nn]([Zz]|[Cc])|([Pp]([Oo]|[Ee])))[ \t]+[^ \t]+([; \t]|$)/) { save_label() if (match($0,/[Cc][Nn][Zz][ \t]+/)) { sub(/[Cc][Nn][Zz][ \t]+/,"CALL"instr_tabulator"NZ,"); } else if (match($0,/[Cc][Nn][Cc][ \t]+/)) { sub(/[Cc][Nn][Cc][ \t]+/,"CALL"instr_tabulator"NC,"); } else if (match($0,/[Cc][Pp][Oo][ \t]+/)) { sub(/[Cc][Pp][Oo][ \t]+/,"CALL"instr_tabulator"PO,"); } else if (match($0,/[Cc][Pp][Ee][ \t]+/)) { sub(/[Cc][Pp][Ee][ \t]+/,"CALL"instr_tabulator"PE,"); } restore_label() print $0; next } ###### CZ CC CP CM ############################ (/^[^; \t]*[ \t]+[Cc]([Zz]|[Cc]|[Pp]|[Mm])[ \t]+[^ \t]+([; \t]|$)/) { save_label() if (match($0,/[Cc][Zz][ \t]+/)) { sub(/[Cc][Zz][ \t]+/,"CALL"instr_tabulator"Z,"); } else if (match($0,/[Cc][Cc][ \t]+/)) { sub(/[Cc][Cc][ \t]+/,"CALL"instr_tabulator"C,"); } else if (match($0,/[Cc][Pp][ \t]+/)) { sub(/[Cc][Pp][ \t]+/,"CALL"instr_tabulator"P,"); } else if (match($0,/[Cc][Mm][ \t]+/)) { sub(/[Cc][Mm][ \t]+/,"CALL"instr_tabulator"M,"); } restore_label() print $0; next } ###### RNZ RNC RPO RPE ############################ (/^[^; \t]*[ \t]+[Rr]([Nn]([Zz]|[Cc])|([Pp]([Oo]|[Ee])))/) { save_label() if (match($0,/[Rr][Nn][Zz]+/)) { sub(/[Rr][Nn][Zz]+/,"RET"instr_tabulator"NZ"); } else if (match($0,/[Rr][Nn][Cc]+/)) { sub(/[Rr][Nn][Cc]+/,"RET"instr_tabulator"NC"); } else if (match($0,/[Rr][Pp][Oo][ \t]+/)) { sub(/[Rr][Pp][Oo]+/,"RET"instr_tabulator"PO"); } else if (match($0,/[Rr][Pp][Ee][ \t]+/)) { sub(/[Rr][Pp][Ee]+/,"RET"instr_tabulator"PE"); } restore_label() print $0; next } ###### RZ RC RP RM ############################ (/^[^; \t]*[ \t]+[Rr]([Zz]|[Cc]|[Pp]|[Mm])/) { save_label() if (match($0,/[Rr][Zz]+/)) { sub(/[Rr][Zz]+/,"RET"instr_tabulator"Z"); } else if (match($0,/[Rr][Cc]+/)) { sub(/[Rr][Cc]+/,"RET"instr_tabulator"C"); } else if (match($0,/[Rr][Pp]+/)) { sub(/[Rr][Pp]+/,"RET"instr_tabulator"P"); } else if (match($0,/[Rr][Mm]+/)) { sub(/[Rr][Mm]+/,"RET"instr_tabulator"M"); } restore_label() print $0; next } ###### RST 0..7 ############################ (/^[^; \t]*[ \t]+([Rr][Ss][Tt])[ \t]/) { save_label() wkg_str = get_operand("[Rr][Ss][Tt]",3); if (match(wkg_str,/^[^;]*1/)) { sub(/1/,"08h"); } else if (match(wkg_str,/^[^;]*2/)) { sub(/2/,"10h"); } else if (match(wkg_str,/^[^;]*3/)) { sub(/3/,"18h"); } else if (match(wkg_str,/^[^;]*4/)) { sub(/4/,"20h"); } else if (match(wkg_str,/^[^;]*5/)) { sub(/5/,"28h"); } else if (match(wkg_str,/^[^;]*6/)) { sub(/6/,"30h"); } else if (match(wkg_str,/^[^;]*7/)) { sub(/7/,"38h"); } restore_label() print $0 next } ###### PUSH B/D/H/PSW ############################ (/^[^; \t]*[ \t]+([Pp][Uu][Ss][Hh])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("[Pp][Uu][Ss][Hh]",4); sub(/[Pp][Uu][Ss][Hh]/,temp_xyz); sub_bdh() if (match(wkg_str,/[Pp][Ss][Ww]/)) { sub(/[Pp][Ss][Ww]/,"AF"); } sub(temp_xyz,"PUSH") restore_label() print $0 next } ###### POP B/D/H/PSW ############################ (/^[^; \t]*[ \t]+([Pp][Oo][Pp])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("[Pp][Oo][Pp]",3); #sub(/[Pp][Oo][Pp]/,temp_xyz); sub_bdh() if (match(wkg_str,/[Pp][Ss][Ww]/)) { sub(/[Pp][Ss][Ww]/,"AF"); } #sub(temp_xyz,"POP") restore_label() print $0 next } ### OUT byte ############################ (/^[^; \t]*[ \t]+([Oo][Uu][Tt])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("[Oo][Uu][Tt]",3); sub(/[Oo][Uu][Tt]/,temp_xyz); sub(wkg_str,"(" wkg_str "),A" ); sub(temp_xyz,"OUT") restore_label() print $0 next } ### IN byte ############################ (/^[^; \t]*[ \t]+([Ii][Nn])[ \t]+[^ \t]+([; \t]|$)/) { save_label() wkg_str = get_operand("[Ii][Nn]",2); sub(/[Ii][Nn]/,temp_xyz); sub(wkg_str,"A,(" wkg_str ")" ); sub(temp_xyz,"IN") restore_label() print $0 next } ###### END # (/^[^; \t]*[ \t]+([Ee][Nn][Dd])/) { # save_label() # sub(/[Ee][Nn][Dd]/,";END of program"); # restore_label() # print $0 # next # } ###### Default (/^.*/) { print $0 next } z88dk-1.8.ds1/support/abc80/0000755000175000017500000000000010765202715015122 5ustar tygrystygrysz88dk-1.8.ds1/support/Ace/0000755000175000017500000000000010765202715014715 5ustar tygrystygrysz88dk-1.8.ds1/support/Ace/README0000644000175000017500000000320607365216303015576 0ustar tygrystygrys$Id: README,v 1.3 2001/10/23 07:31:15 stefano Exp $ The Jupiter ACE has a built-in FORTH interpreter in ROM (no BASIC, here!) There is very little software for it; maybe the Z88DK will help ! FORTH command syntax: s l bsave saves l bytes from the memory starting at address s as s l bload loades l bytes to the memory starting at address s as . If s or l is zero will their value be taken from the file. addr call will call Z80 machine code at addr, should be terminated with a jp (iy) Z80 instruction. So (HOWTO for the "VACE" emulator): - compile the program: zcc +ace program.c - convert it: bin2byt a.bin program.byt - run the emulator vace - from within the emulator, load the program: 16384 40000 bload program - run the thing: 16384 call Have fun ! --- --- 22-10-2001 Using ACE32 on WinNT/Win2000 Get the file: http://users.aol.com/autismuk/ace/ace32.zip It is compiled with an old DOS extender and gives compatibility problems when used on WinNT. To override this, get the updated extender from: http://michael.tippach.bei.t-online.de/wdosx/ Download the latest release and unzip the binary folder. Then update the ACE32 DOS extender stub with the "stubtit" utility: stubit ace32.exe It will replace the faulty stub with a working one. Then (HOWTO for the "ACE32" emulator): - compile the program: zcc +ace program.c - delete the old TAP file del prog.tap - convert it: acetap a.bin prog.tap - run the emulator ace32 prog.tap - from within the emulator, load the program: 16384 40000 bload - run the thing: 16384 call Have fun ! z88dk-1.8.ds1/support/aquarius/0000755000175000017500000000000010765202715016057 5ustar tygrystygrysz88dk-1.8.ds1/support/aquarius/README0000644000175000017500000000124207411626074016740 0ustar tygrystygrys$Id: README,v 1.1 2001/12/24 13:23:08 stefano Exp $ Mattel Aquarius !! Tested under the "Virtual Aquarius" emulator, by James the Animal Tamer. The "bin2caq" tool creates two files: a basic loader and a pseudo array file. To compile and run - compile the program: zcc +aquarius program.c - convert it: bin2caq a.bin program.caq - run the emulator aquarius - from within the emulator, load the loader: cload - press ENTER twice, then play the "_program.caq" cassette file (loader) - at the "OK" prompt, type RUN - press ENTER twice, then play the "program.caq" cassette file - wait... then have fun ! Stefano Bodrato - Dec 2001z88dk-1.8.ds1/support/ar/0000755000175000017500000000000010765202715014627 5ustar tygrystygrysz88dk-1.8.ds1/support/ar/ar.c0000644000175000017500000001126507566236202015405 0ustar tygrystygrys/* * Library file snooper * * (C) 17/11/2002 Dominic Morris * * Prints the contents of a z80asm library file including local symbols * and dependencies of a particular library */ #include #include #include #include #include static FILE *open_library(char *name); static unsigned long read_intel32(FILE *fp, unsigned long *offs); static unsigned int read_intel16(FILE *fp, unsigned long *offs); static void object_dump(FILE *fp, unsigned long start, char flags); enum { showlocal = 1, showexpr = 2 }; static void usage(char *name) { fprintf(stderr,"Usage %s [-l] library\n",name); fprintf(stderr,"Display the contents of a z80asm library file\n"); fprintf(stderr,"\n-l\tShow local symbols\n"); fprintf(stderr,"-e\tShow expression patches\n"); fprintf(stderr,"-h\tDisplay this help\n"); exit(1); } int main(int argc, char *argv[]) { char *file; unsigned long next,len,start; FILE *fp; char flags = 0; int opt; while ((opt = getopt(argc,argv,"hle")) != -1 ) { switch (opt ) { case 'l': flags |= showlocal; break; case 'e': flags |= showexpr; break; default: usage(argv[0]); } } if ( optind == argc ) { usage(argv[0]); } file = argv[optind++]; if ( ( fp = open_library(file) ) == NULL ) { if ( ( fp = fopen(file,"rb") ) != NULL ) { object_dump(fp,0,flags); exit(0); } else { exit(1); } } next = 8; do { start = next + 8; fseek(fp,next,SEEK_SET); next = read_intel32(fp,NULL); len = read_intel32(fp,NULL); if ( len == 0xFFFFFFFF ) break; if ( len == 0x0 ) printf("Deleted..."); object_dump(fp,start,flags); } while ( next != 0xFFFFFFFF ); fclose(fp); } void object_dump(FILE *fp, unsigned long start, char flags) { char buf[8]; unsigned long modname,expr,name,libname,code,red; unsigned int org; char c; int len,i; fread(buf,8,1,fp); if ( strncmp(buf,"Z80RMF01",8) != 0 ) { return; } org = read_intel16(fp,&red); modname = read_intel32(fp,&red); expr = read_intel32(fp,&red); name = read_intel32(fp,&red); libname = read_intel32(fp,&red); code = read_intel32(fp,&red); fseek(fp,start+modname,SEEK_SET); len = fgetc(fp); for ( i = 0; i < len; i++ ) { c = fgetc(fp); fputc(c,stdout); red++; } fseek(fp,start+code,SEEK_SET); len = read_intel16(fp,&red); printf("\t\t@%08x (%d bytes)\n",start,len); /* Now print any dependencies under that */ if ( name != 0 ) { char scope,type; unsigned long temp; fseek(fp,start+name,SEEK_SET); red = 0; while ( red < ( modname - name ) ) { scope = fgetc(fp); red++; type = fgetc(fp); red++; temp = read_intel32(fp,&red); len = fgetc(fp); red++; if ( type == 'A' && ( ( flags & showlocal) || scope != 'L' ) ) printf(" %c ",scope); for ( i = 0; i < len; i++ ) { c = fgetc(fp); if ( type == 'A' && ( (flags & showlocal) || scope != 'L' ) ) fputc(c,stdout); red++; } if ( type == 'A' && ( (flags & showlocal) || scope != 'L' ) ) printf("\t+%04x\n",temp); } } if ( libname != 0xFFFFFFFF ) { fseek(fp,start+libname,SEEK_SET); red = 0; while ( red < (modname - libname) ) { len = fgetc(fp); red++; printf(" U "); for ( i = 0; i < len; i++ ) { c = fgetc(fp); fputc(c,stdout); red++; } printf("\n"); } } if ( expr != 0xFFFFFFFF && (flags & showexpr ) ) { char type; int patch; unsigned long end; fseek(fp,start+expr,SEEK_SET); red = 0; end = name; if (end == 0xFFFFFFFF ) end = code; while ( red < ( end - expr) ) { type = fgetc(fp); red++; patch = read_intel16(fp,&red); len = fgetc(fp); red++; printf(" E "); for ( i = 0; i < len; i++ ) { c = fgetc(fp); fputc(c,stdout); red++; } printf(" %c @ %04x\n",type,patch); c = fgetc(fp); red++; if ( c != 0 ) break; } } } FILE *open_library(char *name) { char buf[9]; FILE *fp; if ( ( fp = fopen(name,"rb") ) == NULL ) { return NULL; } fread(buf,8,1,fp); if ( strncmp(buf,"Z80LMF01",8) == 0 ) { return fp; } fclose(fp); return NULL; } static unsigned long read_intel32(FILE *fp, unsigned long *offs) { unsigned char buf[4]; int i; i = fread(buf,1,4,fp); if ( offs ) *offs += 4; return ( buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0] ); } static unsigned int read_intel16(FILE *fp, unsigned long *offs) { unsigned char buf[2]; fread(buf,1,2,fp); if ( offs ) *offs += 2; return ( buf[1] << 8 | buf[0] ); } z88dk-1.8.ds1/support/ar/getopt/0000755000175000017500000000000010765202715016131 5ustar tygrystygrysz88dk-1.8.ds1/support/ar/getopt/getopt.c0000644000175000017500000001447710637511673017620 0ustar tygrystygrys/***************************************************************************** * getopt.c - competent and free getopt library. * $Header: /cvsroot/z88dk/z88dk/support/ar/getopt/getopt.c,v 1.1 2007/06/24 15:54:35 dom Exp $ * * Copyright (c)2002-2003 Mark K. Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the original author of this software nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #include #include #include #include "getopt.h" static const char* ID = "$Id: getopt.c,v 1.1 2007/06/24 15:54:35 dom Exp $"; char* optarg = NULL; int optind = 0; int opterr = 1; int optopt = '?'; static char** prev_argv = NULL; /* Keep a copy of argv and argc to */ static int prev_argc = 0; /* tell if getopt params change */ static int argv_index = 0; /* Option we're checking */ static int argv_index2 = 0; /* Option argument we're checking */ static int opt_offset = 0; /* Index into compounded "-option" */ static int dashdash = 0; /* True if "--" option reached */ static int nonopt = 0; /* How many nonopts we've found */ static void increment_index() { /* Move onto the next option */ if(argv_index < argv_index2) { while(prev_argv[++argv_index] && prev_argv[argv_index][0] != '-' && argv_index < argv_index2+1); } else argv_index++; opt_offset = 1; } /* * Permutes argv[] so that the argument currently being processed is moved * to the end. */ static int permute_argv_once() { /* Movability check */ if(argv_index + nonopt >= prev_argc) return 1; /* Move the current option to the end, bring the others to front */ else { char* tmp = prev_argv[argv_index]; /* Move the data */ memmove(&prev_argv[argv_index], &prev_argv[argv_index+1], sizeof(char**) * (prev_argc - argv_index - 1)); prev_argv[prev_argc - 1] = tmp; nonopt++; return 0; } } int getopt(int argc, char** argv, char* optstr) { int c = 0; /* If we have new argv, reinitialize */ if(prev_argv != argv || prev_argc != argc) { /* Initialize variables */ prev_argv = argv; prev_argc = argc; argv_index = 1; argv_index2 = 1; opt_offset = 1; dashdash = 0; nonopt = 0; } /* Jump point in case we want to ignore the current argv_index */ getopt_top: /* Misc. initializations */ optarg = NULL; /* Dash-dash check */ if(argv[argv_index] && !strcmp(argv[argv_index], "--")) { dashdash = 1; increment_index(); } /* If we're at the end of argv, that's it. */ if(argv[argv_index] == NULL) { c = -1; } /* Are we looking at a string? Single dash is also a string */ else if(dashdash || argv[argv_index][0] != '-' || !strcmp(argv[argv_index], "-")) { /* If we want a string... */ if(optstr[0] == '-') { c = 1; optarg = argv[argv_index]; increment_index(); } /* If we really don't want it (we're in POSIX mode), we're done */ else if(optstr[0] == '+' || getenv("POSIXLY_CORRECT")) { c = -1; /* Everything else is a non-opt argument */ nonopt = argc - argv_index; } /* If we mildly don't want it, then move it back */ else { if(!permute_argv_once()) goto getopt_top; else c = -1; } } /* Otherwise we're looking at an option */ else { char* opt_ptr = NULL; /* Grab the option */ c = argv[argv_index][opt_offset++]; /* Is the option in the optstr? */ if(optstr[0] == '-') opt_ptr = strchr(optstr+1, c); else opt_ptr = strchr(optstr, c); /* Invalid argument */ if(!opt_ptr) { if(opterr) { fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c); } optopt = c; c = '?'; /* Move onto the next option */ increment_index(); } /* Option takes argument */ else if(opt_ptr[1] == ':') { /* ie, -oARGUMENT, -xxxoARGUMENT, etc. */ if(argv[argv_index][opt_offset] != '\0') { optarg = &argv[argv_index][opt_offset]; increment_index(); } /* ie, -o ARGUMENT (only if it's a required argument) */ else if(opt_ptr[2] != ':') { /* One of those "you're not expected to understand this" moment */ if(argv_index2 < argv_index) argv_index2 = argv_index; while(argv[++argv_index2] && argv[argv_index2][0] == '-'); optarg = argv[argv_index2]; /* Don't cross into the non-option argument list */ if(argv_index2 + nonopt >= prev_argc) optarg = NULL; /* Move onto the next option */ increment_index(); } else { /* Move onto the next option */ increment_index(); } /* In case we got no argument for an option with required argument */ if(optarg == NULL && opt_ptr[2] != ':') { optopt = c; c = '?'; if(opterr) { fprintf(stderr,"%s: option requires an argument -- %c\n", argv[0], optopt); } } } /* Option does not take argument */ else { /* Next argv_index */ if(argv[argv_index][opt_offset] == '\0') { increment_index(); } } } /* Calculate optind */ if(c == -1) { optind = argc - nonopt; } else { optind = argv_index; } return c; } /* vim:ts=3 */ z88dk-1.8.ds1/support/ar/getopt/getopt.h0000644000175000017500000000403710637511673017614 0ustar tygrystygrys/***************************************************************************** * getopt.h - competent and free getopt library. * $Header: /cvsroot/z88dk/z88dk/support/ar/getopt/getopt.h,v 1.1 2007/06/24 15:54:35 dom Exp $ * * Copyright (c)2002-2003 Mark K. Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the original author of this software nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #ifndef GETOPT_H_ #define GETOPT_H_ #ifdef __cplusplus extern "C" { #endif extern char* optarg; extern int optind; extern int opterr; extern int optopt; int getopt(int argc, char** argv, char* optstr); #ifdef __cplusplus } #endif #endif /* GETOPT_H_ */ /* vim:ts=3 */ z88dk-1.8.ds1/support/ar/getopt/LICENSE0000644000175000017500000000277010637511673017150 0ustar tygrystygrysFree Getopt Copyright (c)2002-2003 Mark K. Kim All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the original author of this software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. z88dk-1.8.ds1/support/ar/getopt/Makefile0000644000175000017500000000113710637511673017577 0ustar tygrystygrys############################################################################## # $Header: /cvsroot/z88dk/z88dk/support/ar/getopt/Makefile,v 1.1 2007/06/24 15:54:35 dom Exp $ CC=gcc OBJECTS=getopt.o BINARIES=test ############################################################################## # PHONIES all: test clean: rm -f $(BINARIES) *.o ############################################################################## # FILES test: test.o $(OBJECTS) $(CC) $(LDFLAGS) test.o $(OBJECTS) -o $@ $(LDLIBS) test.o: test.c $(CC) $(CFLAGS) $< -o $@ -c getopt.o: getopt.c $(CC) $(CFLAGS) $< -o $@ -c z88dk-1.8.ds1/support/ar/getopt/README0000644000175000017500000000346410637511673017024 0ustar tygrystygrysFree Getopt ****************************************************************************** Please read the file LICENSE for the terms of use and distribution of this software. ****************************************************************************** "getopt" is a library that allows a parsing of arguments passed to a program. This is a useful library used in many software. There are many versions of the getopt library available, two popular versions being the BSD getopt and the GNU getopt. BSD getopt is somewhat old, dated, and isn't very user-friendly. The GNU getopt is great, except the user license doesn't let you statically link the library to a proprietary software. This is usually not a problem on modern operating systems that allow dynamic links to libraries, but sometimes you just gotta link the library statically for one reason or another. That's where Free Getopt steps in. Functionally, this getopt library is equivalent to GNU's getopt library (the short option version, not the long one) in almost every aspect. The only exception is how the "optind" variable increments. Apparently due to different algorithms used by my program and the GNU getopt, the "optind" changes quite differently between our two software. I personally find my algorithm to be quite elegant; I couldn't tell you about the GNU version since I never looked at its source. GNU's getopt_long support is in progress. This library was deliberately left in non-library (not in *.lib, *.so, or *.a) form because it's most likely to be statically-linked in various platforms, and linking it directly from source is probably the most straight-forward way to use the software in any platform. I hope you find this software useful. Mark K. Kim $Header: /cvsroot/z88dk/z88dk/support/ar/getopt/README,v 1.1 2007/06/24 15:54:35 dom Exp $ z88dk-1.8.ds1/support/ar/getopt/test.c0000644000175000017500000001242510637511673017264 0ustar tygrystygrys/***************************************************************************** * getopt test program. * $Header: /cvsroot/z88dk/z88dk/support/ar/getopt/test.c,v 1.1 2007/06/24 15:54:35 dom Exp $ * * Copyright (c)2002-2003 Mark K. Kim * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the original author of this software nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ #include #include #include "getopt.h" /***************************************************************************** * DEFINES */ /** * flags for different command-line options * * these options don't do anything - there's just here * as examples */ #define FLAG_INTERACT 0x0001 /* interactive mode */ #define FLAG_FORCE 0x0002 /* force mode */ #define FLAG_RECURSIVE 0x0004 /* recursive mode */ /***************************************************************************** * GLOBALS */ int flags = 0; /* store flags here */ int verbose = 5; /* verbosity level */ const char* in_fname = NULL; /* input filename */ const char* out_fname = NULL; /* output filename */ /***************************************************************************** * arg_to_int - Convert argument string to integer. * * min - Minimum allowed value, inclusive. * max - Maximum allowed value, inclusive. * defalt - The default value, in case of an error. * opt - Option string of this argument. (ex., "-h"); */ int arg_to_int(const char* arg, int min, int max, int defalt, const char* opt) { int i = defalt; int rv; /* no argument means we use the default value */ if(!arg) goto done; /* make sure we got an integer argument */ rv = sscanf(arg, "%d", &i); if(rv != 1) { fprintf(stderr, "%s: integer argument required.\n", opt); i = defalt; goto done; } /* make sure the integer argument is within the desired range */ if(i < min || max < i) { fprintf(stderr, "%s: argument out of integer range.\n", opt); i = defalt; goto done; } done: return i; } /***************************************************************************** * help */ void help() { printf( "getopt test program\n" "Usage: test [OPTION] [INPUT]\n" " INPUT set input filename (doesn't do anything)\n" " -h help menu (this screen)\n" " -i interactive mode (doesn't do anything)\n" " -f force mode (doesn't do anything)\n" " -r recursive mode (doesn't do anything)\n" " -v[level] set verbosity level (5 is default; doesn't do anything)\n" " -o filename set output filename (doesn't do anything)\n" ); } /***************************************************************************** * MAIN */ int main(int argc, char* argv[]) { /* check arguments */ while(1) { int c = getopt(argc, argv, "-ifrhv::o:"); if(c == -1) break; switch(c) { case 'i': flags |= FLAG_INTERACT; break; case 'f': flags |= FLAG_FORCE; break; case 'r': flags |= FLAG_RECURSIVE; break; case 'h': help(); exit(0); case 'v': verbose = arg_to_int(optarg, 0, 10, 5, "v"); break; case 'o': out_fname = optarg; break; case 1: in_fname = optarg; break; #ifdef DEBUG default: printf("Option '%c' (%d) with '%s'\n", c, c, optarg); #endif } } #ifdef DEBUG printf("optind at %d; argv[optind] = '%s'\n", optind, argv[optind]); #endif /* print out what we got */ if(flags & FLAG_INTERACT) printf("in interactive mode\n"); else printf("not in interactive mode\n"); if(flags & FLAG_FORCE) printf("in force mode\n"); else printf("not in force mode\n"); if(flags & FLAG_RECURSIVE) printf("in recursive mode\n"); else printf("not in recursive mode\n"); printf("verbosity level: %d\n", verbose); if(in_fname) printf("input filename: %s\n", in_fname); else printf("no input filename\n"); if(out_fname) printf("output filename: %s\n", out_fname); else printf("no output filename\n"); return 0; } /* vim:ts=3 */ z88dk-1.8.ds1/support/ar/Makefile0000644000175000017500000000013607566231762016300 0ustar tygrystygrys all: z80nm z80nm: ar.c $(CC) -o z80nm $(CFLAGS) ar.c clean: $(RM) ar.o z80nm *~ core z88dk-1.8.ds1/support/ar/z80nm.vcproj0000755000175000017500000000665110762606702017044 0ustar tygrystygrys z88dk-1.8.ds1/support/bin2var/0000755000175000017500000000000010765202715015570 5ustar tygrystygrysz88dk-1.8.ds1/support/bin2var/83asm.bat0000644000175000017500000000011607237752755017227 0ustar tygrystygrys@echo off tasm -80 -i -b %1.z80 %1.bin bin2var2 %1.bin %1.83p del %1.bin >nul z88dk-1.8.ds1/support/bin2var/83pasm.bat0000644000175000017500000000011607237752755017407 0ustar tygrystygrys@echo off tasm -80 -i -b %1.z80 %1.bin bin2var2 %1.bin %1.8xp del %1.bin >nul z88dk-1.8.ds1/support/bin2var/83psqasm.bat0000644000175000017500000000011507237752755017752 0ustar tygrystygrys@echo off tasm -80 -i -b %1.z80 %1.bin bin2var %1.bin %1.8xp del %1.bin >nul z88dk-1.8.ds1/support/bin2var/83squasm.bat0000644000175000017500000000011507237752755017757 0ustar tygrystygrys@echo off tasm -80 -i -b %1.z80 %1.bin bin2var %1.bin %1.83p del %1.bin >nul z88dk-1.8.ds1/support/bin2var/bin2var0000755000175000017500000004136607237752755017111 0ustar tygrystygrysELF4(44 (444,L /lib/ld-linux.so.2GNU    g83HgXt"Ah$x2yI"IaȆ؆4!)9(n8_HXhF(xy "__gmon_start__libc.so.6strcpyprintf__ctype_bmallocstrrchrfprintf__deregister_frame_infofseekferrorstrcasecmpfreadmemsetftellfclosestderrfwriteexitfopen_IO_stdin_used__libc_start_mainstrlentoupperstrchr__register_frame_infovfprintffreeGLIBC_2.1GLIBC_2.0ii ii  ĥȥ̥Хԥ إ ܥ   US[çhty ]5%%h%h%h%h%ĥh %ȥh(%̥h0%Хh8p%ԥh@`%إhHP%ܥhP@%hX0%h` %hh%hp%hx%h%h%h%h%h%h% h1^PTRhlhQVh܊U=u8PС8u鸨t hÉUÍvUXthh ÍvUÐU}t$E EEPEPP3 hPjvÉUEPEjjEP EPEjEPEP UÐUVSEPjE PEPiE&E;E |&EUM]ff2f0Eѐe[^ÐU4EPjE P[PE Pj*jEP EPjE P**)PEPÍvUEPPj.PN)ƒ~ HRUffu 8u랍P*u h@PE PÍvU$Eoh}t jZj.E RE}u h/hEPuDžh EPuDžhEPuDžt&hEPzu Dž^hEPWu Dž;hEP4uDž&EPh@2PE RhbE RE}uE RhEP+PEEPjPEPEPntE RhzEP&hE RpE}uE Rh7fDžuEPjj h8uEPjj hmuEPjj hMuEPjj h-ttt&EPjj hEPEPvtt &^uDt&u'PP щvEPjjPtt tPEPjh:{uWPHPEPjPPEPjh"t&PEPjh'uPEPjPxttt$t&PEPjh-=^t&uPEPjh/5tt !&PEPjh1Pttt t&PEPjPPEPPPjjjP t(PEP+PP&u&!PEPjPPEPjPu4PEPjh3PEPjh5gPEPPEPIEPjjPEPZtE Rh@fEPEPFE RE Rh` 1ÐUS=t Ѓ;u]ÐUÐUS[3_]Usage: bin2var input.bin output.ext Valid extensions for the output file: 82p, 83p, 8xp, 85s, 86p, 86s A valid variable name could not be generated! Created with Bin2Var v1.10Bin2Var v1.20 by David Phillips Output file must have an extension! .82p.83p.8xp.85s.86p.86sExtension '%s' is not supported! rbFailed to open input file: %s Error reading input file: %s wbFailed to open output file: %s **TI82** **TI83** **TI83F* **TI85** **TI86** x00x00 x00 mFailed writing output file: %s '%s' successfully converted to '%s' >N^n~Άކ.>N^n~  l(  @(oooOdԇdԇ+<:i,x:_y5_s-n-Y=t(;-s$B?- 1!I"_#v%&1234 5" 6< 8U 9o ; = > ? @ A B% C< DU El F G H I N Q+ RE S] Tv V Y o r u' {A |^ { ' D ^ UO  7"vS3;BE<zRY]5k7wsx- #$%&9 "dԇinit.c/usr/src/bs/BUILD/glibc-2.1.3/csu/gcc2_compiled.int:t(0,1)=r(0,1);0020000000000;0017777777777;char:t(0,2)=r(0,2);0;127;long int:t(0,3)=r(0,1);0020000000000;0017777777777;unsigned int:t(0,4)=r(0,1);0000000000000;0037777777777;long unsigned int:t(0,5)=r(0,1);0000000000000;0037777777777;long long int:t(0,6)=r(0,1);01000000000000000000000;0777777777777777777777;long long unsigned int:t(0,7)=r(0,1);0000000000000;01777777777777777777777;short int:t(0,8)=r(0,8);-32768;32767;short unsigned int:t(0,9)=r(0,9);0;65535;signed char:t(0,10)=r(0,10);-128;127;unsigned char:t(0,11)=r(0,11);0;255;float:t(0,12)=r(0,1);4;0;double:t(0,13)=r(0,1);8;0;long double:t(0,14)=r(0,1);12;0;complex int:t(0,15)=s8real:(0,1),0,32;imag:(0,1),32,32;;complex float:t(0,16)=r(0,16);4;0;complex double:t(0,17)=r(0,17);8;0;complex long double:t(0,18)=r(0,18);12;0;void:t(0,19)=(0,19)../include/libc-symbols.h/usr/src/bs/BUILD/glibc-2.1.3/build-i386-linux/config.h../include/libintl.h../intl/libintl.h../include/features.h../include/sys/cdefs.h../misc/sys/cdefs.h/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h../include/locale.h../locale/locale.hlconv:T(10,1)=s48decimal_point:(10,2)=*(0,2),0,32;thousands_sep:(10,2),32,32;\grouping:(10,2),64,32;int_curr_symbol:(10,2),96,32;\currency_symbol:(10,2),128,32;mon_decimal_point:(10,2),160,32;\mon_thousands_sep:(10,2),192,32;mon_grouping:(10,2),224,32;\positive_sign:(10,2),256,32;negative_sign:(10,2),288,32;\int_frac_digits:(0,2),320,8;frac_digits:(0,2),328,8;\p_cs_precedes:(0,2),336,8;p_sep_by_space:(0,2),344,8;\n_cs_precedes:(0,2),352,8;n_sep_by_space:(0,2),360,8;\p_sign_posn:(0,2),368,8;n_sign_posn:(0,2),376,8;;../include/xlocale.h../locale/xlocale.h__locale_struct:T(13,1)=s36__locales:(13,2)=ar(0,1);0;5;(13,3)=*(13,4)=xslocale_data:,0,192;\__ctype_b:(13,5)=*(0,9),192,32;__ctype_tolower:(13,6)=*(0,1),224,32;\__ctype_toupper:(13,6),256,32;;__locale_t:t(13,7)=(13,8)=*(13,1)../sysdeps/unix/sysv/linux/_G_config.h../sysdeps/unix/sysv/linux/bits/types.hsize_t:t(16,1)=(0,4)__u_char:t(15,1)=(0,11)__u_short:t(15,2)=(0,9)__u_int:t(15,3)=(0,4)__u_long:t(15,4)=(0,5)__u_quad_t:t(15,5)=(0,7)__quad_t:t(15,6)=(0,6)__int8_t:t(15,7)=(0,10)__uint8_t:t(15,8)=(0,11)__int16_t:t(15,9)=(0,8)__uint16_t:t(15,10)=(0,9)__int32_t:t(15,11)=(0,1)__uint32_t:t(15,12)=(0,4)__int64_t:t(15,13)=(0,6)__uint64_t:t(15,14)=(0,7)__qaddr_t:t(15,15)=(15,16)=*(15,6)__dev_t:t(15,17)=(15,5)__uid_t:t(15,18)=(15,3)__gid_t:t(15,19)=(15,3)__ino_t:t(15,20)=(15,4)__mode_t:t(15,21)=(15,3)__nlink_t:t(15,22)=(15,3)__off_t:t(15,23)=(0,3)__loff_t:t(15,24)=(15,6)__pid_t:t(15,25)=(0,1)__ssize_t:t(15,26)=(0,1)__rlim_t:t(15,27)=(0,3)__rlim64_t:t(15,28)=(15,6)__id_t:t(15,29)=(15,3)__fsid_t:t(15,30)=(15,31)=s8__val:(15,32)=ar(0,1);0;1;(0,1),0,64;;__daddr_t:t(15,33)=(0,1)__caddr_t:t(15,34)=(10,2)__time_t:t(15,35)=(0,3)__swblk_t:t(15,36)=(0,3)__clock_t:t(15,37)=(0,3)__fd_mask:t(15,38)=(0,5)__fd_set:t(15,39)=(15,40)=s128fds_bits:(15,41)=ar(0,1);0;31;(15,38),0,1024;;__key_t:t(15,42)=(0,1)__ipc_pid_t:t(15,43)=(0,9)__blkcnt_t:t(15,44)=(0,3)__blkcnt64_t:t(15,45)=(15,6)__fsblkcnt_t:t(15,46)=(15,4)__fsblkcnt64_t:t(15,47)=(15,5)__fsfilcnt_t:t(15,48)=(15,4)__fsfilcnt64_t:t(15,49)=(15,5)__ino64_t:t(15,50)=(15,4)__off64_t:t(15,51)=(15,24)__t_scalar_t:t(15,52)=(0,3)__t_uscalar_t:t(15,53)=(0,5)__intptr_t:t(15,54)=(0,1)../linuxthreads/sysdeps/pthread/bits/pthreadtypes.h../sysdeps/unix/sysv/linux/bits/sched.h__sched_param:T(18,1)=s4sched_priority:(0,1),0,32;;_pthread_fastlock:T(17,1)=s8__status:(0,3),0,32;__spinlock:(0,1),32,32;;_pthread_descr:t(17,2)=(17,3)=*(17,4)=xs_pthread_descr_struct:pthread_attr_t:t(17,5)=(17,6)=s36__detachstate:(0,1),0,32;\__schedpolicy:(0,1),32,32;__schedparam:(18,1),64,32;\__inheritsched:(0,1),96,32;__scope:(0,1),128,32;\__guardsize:(16,1),160,32;__stackaddr_set:(0,1),192,32;\__stackaddr:(17,7)=*(0,19),224,32;__stacksize:(16,1),256,32;;pthread_cond_t:t(17,8)=(17,9)=s12__c_lock:(17,1),0,64;\__c_waiting:(17,2),64,32;;pthread_condattr_t:t(17,10)=(17,11)=s4__dummy:(0,1),0,32;;pthread_key_t:t(17,12)=(0,4)pthread_mutex_t:t(17,13)=(17,14)=s24__m_reserved:(0,1),0,32;\__m_count:(0,1),32,32;__m_owner:(17,2),64,32;\__m_kind:(0,1),96,32;__m_lock:(17,1),128,64;;pthread_mutexattr_t:t(17,15)=(17,16)=s4__mutexkind:(0,1),0,32;;pthread_once_t:t(17,17)=(0,1)_pthread_rwlock_t:T(17,18)=s32__rw_lock:(17,1),0,64;__rw_readers:(0,1),64,32;\__rw_writer:(17,2),96,32;__rw_read_waiting:(17,2),128,32;\__rw_write_waiting:(17,2),160,32;__rw_kind:(0,1),192,32;\__rw_pshared:(0,1),224,32;;pthread_rwlock_t:t(17,19)=(17,18)pthread_rwlockattr_t:t(17,20)=(17,21)=s8__lockkind:(0,1),0,32;\__pshared:(0,1),32,32;;pthread_t:t(17,22)=(0,5)wchar_t:t(19,1)=(0,3)wint_t:t(19,2)=(0,4)_G_int16_t:t(14,1)=(0,8)_G_int32_t:t(14,2)=(0,1)_G_uint16_t:t(14,3)=(0,9)_G_uint32_t:t(14,4)=(0,4)_IO_stdin_used:G(0,1)GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)01.0101.0101.0101.0101.0101.01.symtab.strtab.shstrtab.interp.note.ABI-tag.hash.dynsym.dynstr.gnu.version.gnu.version_r.rel.got.rel.bss.rel.plt.init.plt.text.fini.rodata.data.eh_frame.ctors.dtors.got.dynamic.bss.stab.stabstr.comment.note# 1((7 ?Go8To0c ((l 00u @@ ~/(( ll  l P OS1nԦ2x938p: H?((0 @  (  lԦ ԇ "  -1?K at( 0 P " @ @ d  l  ` 83Hg'0c 8l?he LXt"mth$x "I Ȇ "؆4@܊^ EЉ  Mj4}`R  )l(8_H XԦ!hF3HxyYhO n "initfini.cgcc2_compiled.init.ccrtstuff.cp.2__DTOR_LIST__completed.3__do_global_dtors_aux__EH_FRAME_BEGIN__fini_dummyobject.8frame_dummyinit_dummyforce_to_data__CTOR_LIST____do_global_ctors_aux__CTOR_END____DTOR_END____FRAME_END__bin2var.cferror@@GLIBC_2.0strchr@@GLIBC_2.0_DYNAMICcfwrite_etextwritecomment__register_frame_info@@GLIBC_2.0_fp_hwfprintf@@GLIBC_2.0ftell@@GLIBC_2.0_initmalloc@@GLIBC_2.0fread@@GLIBC_2.0__deregister_frame_info@@GLIBC_2.0stderr@@GLIBC_2.0vfprintf@@GLIBC_2.0fseek@@GLIBC_2.0_startstrlen@@GLIBC_2.0__bss_startmaingenname__libc_start_main@@GLIBC_2.0toupper@@GLIBC_2.0diedata_startprintf@@GLIBC_2.0_finifclose@@GLIBC_2.1strrchr@@GLIBC_2.0strcasecmp@@GLIBC_2.0exit@@GLIBC_2.0_edata_GLOBAL_OFFSET_TABLE_free@@GLIBC_2.0_endmemset@@GLIBC_2.0__ctype_b@@GLIBC_2.0fopen@@GLIBC_2.1_IO_stdin_usedfsizefwrite@@GLIBC_2.0__data_start__gmon_start__strcpy@@GLIBC_2.0z88dk-1.8.ds1/support/bin2var/bin2var.c0000644000175000017500000001154307237752755017321 0ustar tygrystygrys/* Bin2Var by David Phillips Converts binary images to TI Graph Link format files 1.00 -- 08/22/00 * first release * support for 83P, 8XP 1.10 -- 08/23/00 * made code more modular * added support for 82P, 86P, 86S * fixed __MSDOS__ macro spelling to be correct 1.20 -- 08/24/00 * added suport for 85S * corrected header for 8XP * changed error message printing to use stderr Edited by Jeremy Drake to add the tasmCmp symbol to 8XP files */ #include #include #include #include #include #if (!defined(__MSDOS__)) && (!defined(__WIN32__)) #define stricmp strcasecmp #endif enum EXT { E_82P, E_83P, E_8XP, E_85S, E_86P, E_86S }; void die(const char *fmt, ...) { va_list argptr; if (fmt) { va_start(argptr, fmt); vfprintf(stderr, fmt, argptr); va_end(argptr); } else fprintf(stderr, "Usage: bin2var input.bin output.ext\n\n" "Valid extensions for the output file: " "82p, 83p, 8xp, 85s, 86p, 86s\n"); exit(1); } int fsize(FILE *fp) { int p, size; p = ftell(fp); fseek(fp, 0L, SEEK_END); size = ftell(fp); fseek(fp, p, SEEK_SET); return size; } void cfwrite(const void *buf, int len, FILE *fp, unsigned short *chk) { int i; fwrite(buf, len, 1, fp); for(i = 0; i < len; i++) *chk += ((unsigned char *)buf)[i]; } void writecomment(FILE *fp, const char *comment) { char str[50]; fwrite(comment, strlen(comment), 1, fp); memset(str, 0, 42); fwrite(str, 42 - strlen(comment), 1, fp); } void genname(const char *fname, char *name) { char str[256], *c; strcpy(str, fname); c = strchr(str, '.'); if ((c - str) > 8) c[8] = 0; else *c = 0; c = str - 1; do { c++; *c = toupper(*c); if (!isalnum(*c)) *c = 0; } while (*c != 0); if (!strlen(str)) die("A valid variable name could not be generated!\n"); strcpy(name, str); } int main(int argc, char* argv[]) { const char *comment = "Created with Bin2Var v1.10"; FILE *fp; char *buf, str[256], *c; int i, n, ext, n2; unsigned short chk; printf("Bin2Var v1.20 by David Phillips \n\n"); if (argc != 3) die(0); buf = strrchr(argv[2], '.'); if (!buf) die("Output file must have an extension!\n"); if (!stricmp(buf, ".82p")) ext = E_82P; else if (!stricmp(buf, ".83p")) ext = E_83P; else if (!stricmp(buf, ".8xp")) ext = E_8XP; else if (!stricmp(buf, ".85s")) ext = E_85S; else if (!stricmp(buf, ".86p")) ext = E_86P; else if (!stricmp(buf, ".86s")) ext = E_86S; else die("Extension \'%s\' is not supported!\n", buf); genname(argv[2], str); fp = fopen(argv[1], "rb"); if (!fp) die("Failed to open input file: %s\n", argv[1]); n = fsize(fp); buf = (char *)malloc(n); fread(buf, n, 1, fp); if (ferror(fp)) die("Error reading input file: %s\n", argv[1]); fclose(fp); fp = fopen(argv[2], "wb"); if (!fp) die("Failed to open output file: %s\n", argv[2]); chk = 0; if (ext == E_82P) fwrite("**TI82**\x1a\x0a\x00", 11, 1, fp); else if (ext == E_83P) fwrite("**TI83**\x1a\x0a\x00", 11, 1, fp); else if (ext == E_8XP) fwrite("**TI83F*\x1a\x0a\x00", 11, 1, fp); else if (ext == E_85S) fwrite("**TI85**\x1a\x0c\x00", 11, 1, fp); else if ((ext == E_86P) || (ext == E_86S)) fwrite("**TI86**\x1a\x0a\x00", 11, 1, fp); writecomment(fp, comment); if ((ext == E_82P) || (ext == E_83P)) i = n + 17; else if (ext == E_8XP) i = n + 19; else if (ext == E_85S) i = n + 10 + strlen(str); else i = n + 18; fwrite(&i, 2, 1, fp); if ((ext == E_82P) || (ext == E_83P) || (ext == E_8XP)) cfwrite("\x0b\0x00", 2, fp, &chk); else if (ext == E_85S) { i = 4 + strlen(str); cfwrite(&i, 1, fp, &chk); cfwrite("\0x00", 1, fp, &chk); } else cfwrite("\x0c\0x00", 2, fp, &chk); if(ext == E_8XP) i = n + 4; else i = n + 2; cfwrite(&i, 2, fp, &chk); if ((ext == E_82P) || (ext == E_83P) || (ext == E_8XP)) cfwrite("\x06", 1, fp, &chk); else if (ext == E_86P) cfwrite("\x12", 1, fp, &chk); else if ((ext == E_85S) || (ext == E_86S)) cfwrite("\x0c", 1, fp, &chk); i = strlen(str); if ((ext == E_85S) || (ext == E_86P) || (ext == E_86S)) cfwrite(&i, 1, fp, &chk); cfwrite(str, i, fp, &chk); memset(str, 0, 8); if (ext != E_85S) cfwrite(str, 8 - i, fp, &chk); if (ext == E_8XP) { i = n + 4; n2 = n + 2; } else { i = n + 2; n2 = n; } cfwrite(&i, 2, fp, &chk); cfwrite(&n2, 2, fp, &chk); if(ext == E_8XP) { cfwrite("\xBB", 1, fp, &chk); cfwrite("\x6D", 1, fp, &chk); } cfwrite(buf, n, fp, &chk); fwrite(&chk, 2, 1, fp); if (ferror(fp)) die("Failed writing output file: %s\n", argv[2]); fclose(fp); free(buf); printf("'%s' successfully converted to '%s'\n", argv[1], argv[2]); return 0; } z88dk-1.8.ds1/support/bin2var/bin2var.exe0000644000175000017500000007500007237752755017656 0ustar tygrystygrysMZ@ !L!This program cannot be run in DOS mode. $PELcǦ9 V2'p@(.textTV `.rdataipZ@@.data"\@.idatan@.relocHr@BUSVW}+E EEPEP@@P Eh0@@@P j _^[USVWEP{ EjjEP EP\ EjEPEP E_^[USVWEPjE PEPEEE 9E EM3ҊE3fыEf_^[U4SVWEPjE PPE Pcj*jEPS EPj*E P+SEP-_^[USVWEPPij.PEE+ E@EHEEEPM=@hEPE @3fAEE~P h@PE Pl_^[U$SVWÈ@h@} j3j.E @P h@hD@PNPDžhL@P#PDžhT@PODžh\@PODžjhd@PODž?hl@PwODžPht@PE @PQh@E @PbE @Ph@PPPjPP@ E @Ph@.Ph܁@E @PE @Ph@fDžPjj h@V Pjj h @, Pjj h@ \Pjj h$@ 2 Pjj h0@ EPP a@$P D PjjP "PPjh<@YP PPjPqPPjhD@TPPjhL@2PPjP "PPjhT@f"PPjhX@p7 PPjh\@4P PPjPPPPPjjP )PP+PPl#PPjPPPjP:PPjh`@PPjhd@PPPPxPjjPE@ E @Phh@Pr PC E @PE @Ph@ 3_^[̡@th@h@h@h@ËD$jjP2 ̋D$jjP @|$SV\$@u?=@t$5@;5@rtЃ;5@sh@h@'h$@h @u D$ P @^[VWt$|$ ;vtЃ;w_^SVt$ WV L$D$PQV VW _^[̃=t@Vu t@=t@} t@jt@Pjx@u)t@jjKx@u jH @3x@L P|3@Ƌ΃p@ȃtu Fh@r^k=@tSVt$ WV L$D$PQV VWb _^[SVW|$G txt$t tufG uW3m\$\$WXG tG tt uGVGSP @_^[ø_@^[̃SVt$ WUF~D$}FD$jjP } ]_^[ËF D$u +~]_^[ËN+؉D$ D$tMD$D$D$d$|$D$d$p@D$Dt;s 9 uCA;ru(]_^[D$u]@_^[D$Nu 3];_^[Ël$ D$p@D$D$L$D$DtqD$jjP ;uFL;v 8 uE@;wF t@=D$jWP~ wF t tnD$L$D tE+;]_^[ËD$ D$SD$VD$D$WUu 3]_^[ Ë\$,C t CD$D$|$C %t3St,;rՋʋ;t$+ȃ)CT$9l$wctS|$t +t$+D$VPKQ tx+D$;sFD$+҃K +t$$]_^[ ËD$SQtXMCD$D$D$$D$(]_^[ ËD$++t$$]_^[ ËD$+҃K +t$$]_^[ ËD$++t$$]_^[ ̋L$tAt<u~Ѓ3ƒtAt2t$ttu͍AL$+ÍAL$+ÍAL$+ÍAL$+̋T$ L$tG3D$Wr-كt+шGIuʃttGJuD$_ËD$W|$bL$WtAt;u~Ѓ3ƒtAt#ttt͍y yyyL$ tAtdGu~Ѓ3‹tt4t'ttljD$_fD$G_fD$_ÈD$_̋L$SA=w@3fJ#D$[Ê3ۊڡ@DXtT$D$ L$ L$D$ L$jjQPD$Pju3[ËD$%#D$[̃=@S\$ua|z [Á}0=@~ jS" @3fYu[Ê3Ҋѡ@DPtL$D$ \$ \$D$ L$jj@QPD$PhRu[Ãu 3D$[33ɊD$L$[ ̋D$L$8t t@3VWh@TL$D$PQh@+ h@W_^̋D$tPjd@Pİ@VWt$ F @t F _^ètBVVmFP}FtPFF _^{u3ËL$PD$T$PQRŐD$j@L$PQ ̋L$ D$SL$VD$ D$ WUu 3]_^[ Ë\$,C t CD$D$|$C t2Ct+;rЋʋ|$3+ȃ)ST$^9l$w8|$t ͋+t$+QCL$QP tAtT+D$ StVL$MD$CD$_D$(]_^[ ËD$+҃K +t$$]_^[ ËD$+҃K +t$$]_^[ ËD$++t$$]_^[ ̡@L$PQVWt$ v3_^Åu|$VutVl u3_^ËD$ d@PjQȰ@UW}3AOE G8t3_dUjhp@hTR@Pd%SVWeа@3ҋȊԁȂ@ Ă@@ʉ @E *̰@p@%@t =p@u j#"h؂@܂@PЂ@P̂@P Ps'EEEPEPJ ËeEPjEE_d^[]Ã=@tR*D$P*h@VWt$ FPQ,u3_^Á@u3 8@u^x@F t3_^Í<@?uhu3_^ËF_FFN ^3_^̃|$Vt$ t,F t5V8f FF^F t V ^́H$PS$TVD$ WUD$@%t$X|$X|$( |x3o@3L$@p@ȃL$@$2@D$LD$HD$4D$8D$3t$<à u3Ɋ2@$2@^΀SKC;*u*$dP D$8؃D$4 D$4ˍLQЉL$4D$*u)$dPG D$ D$D$ˍLQЉL$˃I.3 3@$ 3@$`86ux4u$`cD$@3 @D$<DAt)D$($\PQR$l $`D$($\PQR $`$`D$(]_^[Hà ԃρ˃C533@$P3@0u$dPu#PD$\P(fD$HYD$L @D$X|$D$xD$z0u|$t\$$dPrD$u ԇ@D$l$3D$<fEfPD$P(;|$dPt:Ht3tD$<8L$D$<8L$Ї@D$+эyc@ y$dPL$, tfD$H)ƀt<4D$D$DƀtD$0D$8D$DQD$t.$dPD$$T$( D$D' t3@$dPtD$$T$$D+@$dPtD$$T$$D$ D$$@t/|$$(||$ sD$ L$$؃D$,فL$0D$ L$$D$,L$0u d$,d$0|$} D$|$0u|$,uD$8$WD$D$L$|$0u|$,t]|$ ǙD$,L$0T$$T$ \$$SRQP&X0L$0D$,T$ l$$URQP&D$,9T$0~\$DD$L$뉍$W+|$D$D$80uGL$D$0u guD$$d$dHPL$PD$LL$T$TPD$\QӍL$XRPQ8@t|$uD$XPD@guuD$XP<@|$X-uD$YD$|$+эyGyD$\D$XD$,|$u Ї@D$|$Kt ?tGKu+|$|$H@t3tD$-tD$+ t D$ D$8D$4++D$8 D$ uD$($\T$ PQRj GD$($\T$8PD$QRPht$uD$($\T$ PQRj0|$<tI~El$_ōL$fPQD#~?L$($\QRPD$ PKuD$($\T$PQWRD$($\T$ PQRj ip+@x*@*@*@:+@G+@+@h,@*@*@*@*@*@/,@I+@V,@[,@`,@/,@,@,@,@-@X.@-@,@.@,@.@ .@;.@P.@-@.@.@d1@   ̋T$BHBxL$ 3A L$RQD$ uSVt$ W|$U\$l$ O~USV }u]_^[SVt$ W|$U\$l$ O~UFSQG }u]_^[̋D$A̋D$AQ̋D$fAÃDSVWUhu j5p@h@ ;v%3ɺ NFVp@;wD$P@f|$B|$DD$D8X4|;=h@~]t@h{tAEh@ ;v 3ɈH@@ U;w;=h@=h@3~?t/t*Pذ@tŋ̓p@ ʉQEC;|3=ܰ@p@;uSCtFP׃t(Uذ@t%+uK@uK K@KF|h@P԰@]_^[DVW|$ |$u5Ȱ@d@v3WjPօu=@tWd@u3_^SVW3U9=t@~Y x@t7h tPtFP|x@ Qp x@G9=t@]_^[Vt$u j^V5t^F @tFPH^3^SVt$ W3F Ȁu<t5F+؅~*SPFP ;uF tF N FF_^[j SVW3U33|$x@ 0t8A t1uQtCutQu|Ãt]_^[̋L$SV; h@Wp@4D2tiQ u_@ ^[ËL$T$QjRP@ظu@tP*_^[Ë_d0^[ø_@ @^[SVt$WU~F "@tFF Ff F 3F F FF u&@t8@u WLu V/ F tuF+@FHۉF~"SFPW C ]_F ^[ø؇@tNjσp@@ t jjWL D$ND$SPW= ;t]N _^[ËD$]%_^[à ]_F ^[̋T$9h@SVWUƒp@D$ƒL$D$D+3$4t$ ;u 3]_^[è t jjRy D$L$AD$$0+$0;\$$+$0;sG< u FCCÍL$$+=|ՍD$$j+؍L$(D$T$PSQL$,R@t=D$D$ ;}9D$j$4PU RQ@tD$D$D$ @D$|$ |$tG|$u#@ D$]_@^[ËD$P ]_^[ËD$L$D @t$08u 3]_^[ø]@@_^[ËD$ ]+_^[ø]@ @_^[̃@SVWUuLD$5@Pjh@jjօt/D$Pjh@j@t3]_^[Ë5@@u-T$,u@L$$D$ \$QL$PSQR]_^[ã@ux33|$(;u=@D$ jL$ jPQj W@t>Ujt-D$ UL$ VPQjW@tL$$QPD$ VP@V]_^[S@VWUuOj5@jjh@hjօt0jjjh@hj@t 3]_^[Ë5@|$ @~D$WP@@u!D$(L$$T$PD$QL$WRPQ]_^[ã@39t$,u @D$,D$jL$0jWPj Q@u3]_^[ÍmP؅u3]_^[ËD$UL$0SWPjQ@tSD$jL$jUSPQ@t7D$tID$(; L$PD$(T$PUSQR@SV3]_^[Í}PtыD$WL$VUSPQ@tD$(jju D$4jj-@WVh PՋu&덋L$4PD$0-@PWVh QՋiSxVo]_^[̋D$VW|$ Ht :t BIu:u+׋_^jhj@d@SVWU|$9=h@ǃp@ǃ 4D1trtujj;tWP@u @3WtU2]_^[Ë]_D03^[ø]@ @_^[Vt$F t+t'FP'f FF^̃L$ SV3WU3atrtwt3]_^[ú 3ҋ5@5@̀9+IwD$C@D$D$$|C@3t3΀@t3@t3wmt3e [t3RJt3A9t31@$t3t3@A9D$ hL$PRQЅ} 3]_^[ËD$$3x@]_p ^H[HHPÐtB@B@B@B@B@B@B@C@C@mB@     VW3395t@~P x@tP tG9=t@,x@4"j  x@ x@t3tFF FFF_^Vt$F @t F ^ÃF u VFFNPVQR FtltgV ‚u3N؇@tp@Ȋ@$ GD$MD.;|$(u |$ u D$$jjP |$ t G;t$&ED@u+|$(|$D$]_^[3]_^[ø]@ @_^[̋ X@tD$Pуt3USVWUjjh H@uD]_^[]ËL$AtD$T$SVWD$PjhH@d5d%D$ Xp t.;t$$t(4v L$H |uhD@Td _^[3d yH@uQ R 9QuSQ@ SQ@MKCk Y[̋D$VWPT:P/u@_^Ãu_^Ë5@L$ @x @ @9 @}" @ I<8@ @ Iu=@=u @p=u @]=u @J=u @7=u @$=u @=u @@Pj҃=@@@P҃_5@^ËL$Q@_^̺0@L$9 t @@0@;w+#̃@SVW3U:t:=tF+р:uPU؂@؅u j -@ŀ}t^+щL$}=t=Qu j ++;ȃl$}u@P]_^[̃VWh`@Vj@p@5@8t5p@D$ L$PQjjV^D$D$ PZu j D$ L$T$PQPWVD$H=Ђ@_̂@^̋L$ST$Vt$ WD$U|$t T$D$>"tFt@F3ۊɈ@t t@F t t u˄uNPtL@FF>"t0t*3ҊɈ@t tF@t@F>"ut@>"uF3> t uF>|$t T$D$T$ 3>\uFE>\t>"u$ut V:"u3ۃMtt\@MutOu tF tAt7t!3ۊɈ@tF@@FPo3ۊɈ@tFFWt@|$t T$T$ ]_^[̃=@SVWUu@5,@֋t@\$0$@؅t @3]_^[Ë|$\$5,@=@u֋u 3]_^[f?tf>uf>u+jjFjjVWjj@tAUo؅t2jjUSVWjj@u S3W(@]_^[W(@3]_^[Ã=@u{u$@؅u 3]_^[Ë;tE}uE}u+EUD$uS @3]_^[Ë|$S @D$]_^[3]_^[̋D$SVWUP9-̉@u 3]_^[Åu_3]_^[D$@9(0D$=@rD$PU0@CȈ@3@󫪃|$t$8D$t,Nt%33Ҋ;rɈ@@3ɊN;s>uԸɈ@@=rU-̉@MȈ@3@󫪋L$It1Nt*33ۊ;r@Ɉ@B3ۊ^;s>u@rU-̉@Љ@D$@@؉@@@]_^I3Z[J3̉@؉@]_Љ@3^[AAÃ=@t3]_^[ø]_^[@D$u@%8@u@%4@u@@̋D$-w3ɊQ@$Q@3øøøøQ@Q@Q@Q@Q@W3Ȉ@@󫪣؉@؉@_̉@Љ@AAj9VC20XC00USVWU] E@EEEECs {ta v|tEVUkT]^] t3x<{SAkVSv vjDC T{ v4롸UkjS6]]_^[]UL$)APAP]̡@t u.=@u%hЍ@th́3H@S$VWU9t @Ѝ@r9H@=@_=@u =@Ix$hP-@jՅu @$f$$+у Output file must have an extension! .82p.83p.8xp.85s.86p.86sExtension '%s' is not supported! rbFailed to open input file: %s Error reading input file: %s wbFailed to open output file: %s **TI82** **TI83** **TI83F* **TI85** **TI86** x00x00 x00 mFailed writing output file: %s '%s' successfully converted to '%s' @@@@ ((((( H . @(null)(null)ȇ@@    `y!@~ڣ @ڣ AϢ[@~QQ^ _j21~runtime error TLOSS error SING error DOMAIN error R6027 - not enough space for lowio initialization R6026 - not enough space for stdio initialization R6025 - pure virtual function call R6024 - not enough space for _onexit/atexit table R6019 - unable to open console device R6018 - unexpected heap error R6017 - unexpected multithread lock error R6016 - not enough space for thread data abnormal program termination R6009 - not enough space for environment R6008 - not enough space for arguments R6002 - floating point not loaded @@ Č@ @t@D@ @@@@\@$@x@y@z@@@Microsoft Visual C++ Runtime Library Runtime Error! Program: ...`@`@`@`@`@`@        ! 5A CPR S WY l m pr   )    Assertion failed: %s, file %s, line %d @@@GetLastActivePopupGetActiveWindowMessageBoxAuser32.dll(гfr~α 6H^n~Xβ0JV`lfr~α 6H^n~Xβ0JV`lbExitProcessYHeapFreeSHeapAllocGetCommandLineA7GetVersionSetHandleCountGetFileTypeGetStdHandleGetStartupInfoAGetLastErrorSetFilePointerOWriteFileGetStringTypeABWideCharToMultiByteGetStringTypeWMultiByteToWideCharuLCMapStringAvLCMapStringWUHeapCreateCloseHandleReadFileRtlUnwind&UnhandledExceptionFilterGetModuleFileNameAFreeEnvironmentStringsAGetEnvironmentStringsFreeEnvironmentStringsWGetEnvironmentStringsWGetCPInfoGetACPGetOEMCPFlushFileBuffersSetStdHandle+CreateFileAGetProcAddressxLoadLibraryASetEndOfFileKERNEL32.dll"0?0D01)2x22223-3X3333 4.4\4445A5k55556\7~78@8|89:v:::::::B;W;_;h;q;;;;;;;"<,<8>> h333333+4444447v777777888/848>8H8i8n8t8z8889)969K9F:X:t:::;;;{<7c7u77888,9F9X999::e:}::;;<7=[=c=~======>*>R>a>j>>>>>>>??1?p???@ 0(0I0000071A1112&2Z2i2^3|3333333333344#484A444i5555 66667778A888859?9O9U9[9c9m9s99999999:::;:H:Q:a:k::::@;k;t;y;;;;;K<>>:>@>>>>>>>B>n>~>>>>>????`T000G0N0T0_0e0m0v0~0000000 1"111112 2E22233R3n33454T44p 00P 002355777L=T=\=d=l=t=|===========8><>@>D>H>L>???z88dk-1.8.ds1/support/bin2var/bin2var2.c0000644000175000017500000001354107237752755017403 0ustar tygrystygrys/* Bin2Var by David Phillips Converts binary images to TI Graph Link format files 1.00 -- 08/22/00 * first release * support for 83P, 8XP 1.10 -- 08/23/00 * made code more modular * added support for 82P, 86P, 86S * fixed __MSDOS__ macro spelling to be correct 1.20 -- 08/24/00 * added suport for 85S * corrected header for 8XP * changed error message printing to use stderr Edited by Jeremy Drake to create unsquished 83P and 8XP files with correct "End" and "AsmPrgm" symbols */ #include #include #include #include #include // #if (!defined(__MSDOS__)) && (!defined(__WIN32__)) // #define stricmp strcasecmp // #endif enum EXT { E_82P, E_83P, E_8XP, E_85S, E_86P, E_86S }; void die(const char *fmt, ...) { va_list argptr; if (fmt) { va_start(argptr, fmt); vfprintf(stderr, fmt, argptr); va_end(argptr); } else fprintf(stderr, "Usage: bin2var input.bin output.ext\n\n" "Valid extensions for the output file: " "82p, 83p, 8xp, 85s, 86p, 86s\n"); exit(1); } int fsize(FILE *fp) { int p, size; p = ftell(fp); fseek(fp, 0L, SEEK_END); size = ftell(fp); fseek(fp, p, SEEK_SET); return size; } void cfwrite(const void *buf, int len, FILE *fp, unsigned short *chk) { int i; fwrite(buf, len, 1, fp); for(i = 0; i < len; i++) *chk += ((unsigned char *)buf)[i]; } void datawrite(unsigned char *buf, int len, FILE *fp, unsigned short *chk) { int i, n; char charbuffer[1]; char *charbufferp; for(i = 0; i < len; i++) { n = (unsigned char)buf[i]; _itoa( n, charbuffer, 16 ); if( charbuffer[1] == 0 ) { charbuffer[1] = charbuffer[0]; charbuffer[0] = '0'; } charbufferp = _strupr(charbuffer); fwrite(charbufferp, 2, 1, fp); *chk += charbuffer[0]; *chk += charbuffer[1]; } } void writecomment(FILE *fp, const char *comment) { char str[50]; fwrite(comment, strlen(comment), 1, fp); memset(str, 0, 42); fwrite(str, 42 - strlen(comment), 1, fp); } void genname(const char *fname, char *name) { char str[256], *c; strcpy(str, fname); c = strchr(str, '.'); if ((c - str) > 8) c[8] = 0; else *c = 0; c = str - 1; do { c++; *c = toupper(*c); if (!isalnum(*c)) *c = 0; } while (*c != 0); if (!strlen(str)) die("A valid variable name could not be generated!\n"); strcpy(name, str); } int main(int argc, char* argv[]) { const char *comment = "Created with Bin2Var v1.10"; FILE *fp; char *buf, str[256], *c; int i, n, ext, n2; unsigned short chk; printf("Bin2Var v1.20 by David Phillips \n\n"); if (argc != 3) die(0); buf = strrchr(argv[2], '.'); if (!buf) die("Output file must have an extension!\n"); if (!stricmp(buf, ".82p")) ext = E_82P; else if (!stricmp(buf, ".83p")) ext = E_83P; else if (!stricmp(buf, ".8xp")) ext = E_8XP; else if (!stricmp(buf, ".85s")) ext = E_85S; else if (!stricmp(buf, ".86p")) ext = E_86P; else if (!stricmp(buf, ".86s")) ext = E_86S; else die("Extension \'%s\' is not supported!\n", buf); genname(argv[2], str); fp = fopen(argv[1], "rb"); if (!fp) die("Failed to open input file: %s\n", argv[1]); n = fsize(fp); buf = (char *)malloc(n); fread(buf, n, 1, fp); if (ferror(fp)) die("Error reading input file: %s\n", argv[1]); fclose(fp); fp = fopen(argv[2], "wb"); if (!fp) die("Failed to open output file: %s\n", argv[2]); chk = 0; if (ext == E_82P) fwrite("**TI82**\x1a\x0a\x00", 11, 1, fp); else if (ext == E_83P) fwrite("**TI83**\x1a\x0a\x00", 11, 1, fp); else if (ext == E_8XP) fwrite("**TI83F*\x1a\x0a\x00", 11, 1, fp); else if (ext == E_85S) fwrite("**TI85**\x1a\x0c\x00", 11, 1, fp); else if ((ext == E_86P) || (ext == E_86S)) fwrite("**TI86**\x1a\x0a\x00", 11, 1, fp); writecomment(fp, comment); if ((ext == E_82P) ) i = n + 17; else if (ext == E_83P) i = (n * 2) + 26; else if (ext == E_8XP) i = (n * 2) + 20; else if (ext == E_85S) i = n + 10 + strlen(str); else i = n + 18; fwrite(&i, 2, 1, fp); if ((ext == E_82P) || (ext == E_83P) || (ext == E_8XP)) cfwrite("\x0b\0x00", 2, fp, &chk); else if (ext == E_85S) { i = 4 + strlen(str); cfwrite(&i, 1, fp, &chk); cfwrite("\0x00", 1, fp, &chk); } else cfwrite("\x0c\0x00", 2, fp, &chk); if(ext == E_8XP) i = (n * 2) + 5; else if(ext == E_83P) i = (n * 2) + 11; else i = n + 2; cfwrite(&i, 2, fp, &chk); if ((ext == E_82P) || (ext == E_83P) || (ext == E_8XP)) cfwrite("\x06", 1, fp, &chk); else if (ext == E_86P) cfwrite("\x12", 1, fp, &chk); else if ((ext == E_85S) || (ext == E_86S)) cfwrite("\x0c", 1, fp, &chk); i = strlen(str); if ((ext == E_85S) || (ext == E_86P) || (ext == E_86S)) cfwrite(&i, 1, fp, &chk); cfwrite(str, i, fp, &chk); memset(str, 0, 8); if (ext != E_85S) cfwrite(str, 8 - i, fp, &chk); if (ext == E_8XP) { i = (n * 2) + 5; n2 = (n * 2) + 3; } else if (ext == E_83P) { i = (n * 2) + 11; n2 = (n * 2) + 9; } else { i = n + 2; n2 = n; } cfwrite(&i, 2, fp, &chk); cfwrite(&n2, 2, fp, &chk); if(ext == E_8XP) { cfwrite("\xBB", 1, fp, &chk); cfwrite("\x6C", 1, fp, &chk); cfwrite("\x3F", 1, fp, &chk); } if((ext == E_83P) || (ext == E_8XP)) datawrite(buf, n, fp, &chk); else cfwrite(buf, n, fp, &chk); if(ext == E_83P) { cfwrite("\x3F", 1, fp, &chk); cfwrite("\xD4", 1, fp, &chk); cfwrite("\x3F", 1, fp, &chk); cfwrite("0000", 4, fp, &chk); cfwrite("\x3F", 1, fp, &chk); cfwrite("\xD4", 1, fp, &chk); } fwrite(&chk, 2, 1, fp); if (ferror(fp)) die("Failed writing output file: %s\n", argv[2]); fclose(fp); free(buf); printf("'%s' successfully converted to '%s'\n", argv[1], argv[2]); return 0; } z88dk-1.8.ds1/support/bin2var/bin2var2.exe0000644000175000017500000007700007237752755017742 0ustar tygrystygrysMZ@ !L!This program cannot be run in DOS mode. $PELǦ9 Z2`+p@(.textuXZ `.rdataip^@@.data"`@.idatar@.reloc\v@BUSVW}+E EEPEP@@P! Eh0@@@P j _^[USVWEPEjjEP EPEjEPEP E_^[USVWEPjE PEP EEE 9E EM3ҊE3fыEf_^[USVWEEE 9EEM3ҊUjEPEP E EEE0EPEEPjjEPNEM3f‹MfEM3f‹Mfk_^[U4SVWEPjE PPE Pj*jEPD EPj*E P+SEP_^[USVWEPPZj.PEE+ E@EHEEEPM=@hEPE @3fAEE~P h@PE P]_^[U$SVWÈ@h@} jj.E @P h@ShD@P?SDžhL@PSDžhT@PRDžh\@PRDžjhd@PRDž?hl@PhRDžPht@=PE @PQh@E @PSE @Ph@P@PxPjPP@ E @Ph@Ph܁@E @PE @Ph@5fDžPjj h@ Pjj h @ Pjj h@ \Pjj h$@i 2 Pjj h0@2 EPPc@$P| D PjjP^  "PPjh<@YP PPjPPPjhD@PPjhL@k2 PPjP "PPjhT@f"PPjhX@7 PPjh\@HP@  PPjPPPPPjjP= )PP+PP'O'  PPjPPPjPWPPjh`@PPjhd@xPPjhh@[ )PPPP|$PPPPPPjhl@PPjhp@PPjht@PPjhx@sPPjh@VPPjh@9PjjPF@ E @Ph@BP P E @PE @Ph@I 3_^[̡@th@h@h@h@ËD$jjP2 ̋D$jjP @|$SV\$@u?=@t$5@;5@rtЃ;5@sh@h@'h$@h @u D$ P @^[VWt$|$ ;vtЃ;w_^SVt$ WVsL$D$PQVN VW_^[̃=@Vu @=@} @j@P@u)@jj@u j @3@L P|3(@Ƌ΃@ȃtu F@r^=@t}SVt$ WVC L$D$PQV VW _^[SVW|$G txt$t tufG uW3m\$\$WG tG tt uGVGSPw @_^[ø_Ђ@^[̃SVt$ WUF~D$}FD$jjP# } ]_^[ËF D$u +~]_^[ËN+؉D$ D$tMD$D$D$d$|$D$d$@D$Dt;s 9 uCA;ru(]_^[D$u]Ђ@_^[D$Nu 3];_^[Ël$ D$@D$D$L$D$DtqD$jjP ;uFL;v 8 uE@;wF t@=D$jWP wF t tnD$L$D tE+;]_^[ËD$ D$SD$VD$D$WUu 3]_^[ Ë\$,C t CD$D$|$C %t3St,;rՋʋ;t$+ȃ)CT$9l$wctS|$t +t$+D$VPKQ tx+D$;sFD$+҃K +t$$]_^[ ËD$SQWtXMCD$D$D$$D$(]_^[ ËD$++t$$]_^[ ËD$+҃K +t$$]_^[ ËD$++t$$]_^[ SVWU39-@u)\$À;ta| z @8u]_^[Ë\$jj@jjShP tNVt?j@VUjShPt!++ȃUo]_^[̋L$ VD$ u}t$ jQVP ^Ët$ jQVP ^̃|$SVt$WUt -FL$L$l$+ڋ+ȃ vW0FuNNG;r]_^[ËL$tAt<u~Ѓ3ƒtAt2t$ttu͍AL$+ÍAL$+ÍAL$+ÍAL$+̋T$ L$tG3D$Wr-كt+шGIuʃttGJuD$_ËD$W|$bL$WtAt;u~Ѓ3ƒtAt#ttt͍y yyyL$ tAtdGu~Ѓ3‹tt4t'ttljD$_fD$G_fD$_ÈD$_̋L$SA=w@3fJ#D$[Ê3ۊڡ@DXtT$D$ L$ L$D$ L$jjQPD$Pju3[ËD$%#D$[̃=@S\$ua|z [Á}0=@~ jS" @3fYu[Ê3Ҋѡ@DPtL$D$ \$ \$D$ L$jj@QPD$PhRu[Ãu 3D$[33ɊD$L$[ ̋D$L$8t t@3VWh8@TL$D$PQh8@+ h8@W_^̋D$tPj@Pİ@VWt$ F @t F _^ètBVVmFP}FtPFF _^{u3ËL$PD$T$PQRŐD$j@L$PQ ̋L$ D$SL$VD$ D$ WUu 3]_^[ Ë\$,C t CD$D$|$C t2Ct+;rЋʋ|$3+ȃ)ST$^9l$w8|$t ͋+t$+QCL$QP tAtT+D$ StVL$MD$CD$_D$(]_^[ ËD$+҃K +t$$]_^[ ËD$+҃K +t$$]_^[ ËD$++t$$]_^[ ̡8@L$PQVWt$ v3_^Åu|$VutVl u3_^ËD$ @PjQȰ@UW}3AOE G8t3_dUjhp@hU@Pd%SVWeа@3ҋȊԁ@ @܂@ʉ @E *̰@@%@t =@u jJ#"@@P@P@P' P'EEEPEPJ ËeEP EE_d^[]Ã=ć@tR*D$P*h@VWt$ FPQ,u3_^Á8@u3 X@u^@F t3_^Í<Ї@?uhu3_^ËF_FFN ^3_^̃|$Vt$ t,F t5V8f FF^F t V ^́H$PS$TVD$ WUD$@%t$X|$X|$( |x3o@3L$@p@ȃL$@$`6@D$LD$HD$4D$8D$3t$<à u3Ɋ6@$6@^΀SKC;*u*$dP D$8؃D$4 D$4ˍLQЉL$4D$*u)$dPG D$ D$D$ˍLQЉL$˃I.36@$6@$`86ux4u$`cD$@3 @D$<DAt)D$($\PQR$l $`D$($\PQR $`$`D$(]_^[Hà ԃρ˃C5347@$6@0u$dPu#PD$\P(fD$HYD$L @D$X|$D$xD$z0u|$t\$$dPrD$u @D$l$3D$<fEfPD$P(;|$dPt:Ht3tD$<8L$D$<8L$@D$+эyc@ y$dPL$, tfD$H)ƀt<4D$D$DƀtD$0D$8D$DQD$t.$dPD$$T$( D$D' t3@$dPtD$$T$$D+@$dPtD$$T$$D$ D$$@t/|$$(||$ sD$ L$$؃D$,فL$0D$ L$$D$,L$0u d$,d$0|$} D$|$0u|$,uD$8$WD$D$L$|$0u|$,t]|$ ǙD$,L$0T$$T$ \$$SRQP&X0L$0D$,T$ l$$URQP&D$,9T$0~\$DD$L$뉍$W+|$D$D$80uGL$D$0u guD$$d$dHPL$PD$LL$T$TPD$\QӍL$XRPQX@t|$uD$XPd@guuD$XP\@|$X-uD$YD$|$+эyGyD$\D$XD$,|$u @D$|$Kt ?tGKu+|$|$H@t3tD$-tD$+ t D$ D$8D$4++D$8 D$ uD$($\T$ PQRj GD$($\T$8PD$QRPht$uD$($\T$ PQRj0|$<tI~El$_ōL$fPQD#~?L$($\QRPD$ PKuD$($\T$PQWRD$($\T$ PQRj ipt/@.@K.@.@.@.@,/@0@i.@q.@|.@.@.@/@IJ/@/@/@0@/@&0@u0@u0@0@1@51@40@1@0@1@1@1@1@0@I2@P2@5@   ̋T$BHBxL$ 3A L$RQD$ uSVt$ W|$U\$l$ O~USV }u]_^[SVt$ W|$U\$l$ O~UFSQG }u]_^[̋D$A̋D$AQ̋D$fAÃDSVWUhu j5@@ ;v%3ɺ NFV@;wD$P@f|$B|$DD$D8X4|;=@~]@h{tAE@ ;v 3ɈH@@ U;w;=@=@3~?t/t*Pذ@tŋ̓@ ʉQEC;|3=ܰ@@;uSCtFP׃t(Uذ@t%+uK@uK K@KF|@P԰@]_^[DVW|$ |$u5Ȱ@@v3WjPօu=8@tW@u3_^SVW3U9=@~Y @t7h tPtFP|@ Qp @G9=@]_^[Vt$u j^V5t^F @tFPH^3^SVt$ W3F Ȁu<t5F+؅~*SPFP ;uF tF N FF_^[j SVW3U33|$@ 0t8A t1uQtCutQu|Ãt]_^[̋L$SV; @W@4D2tiQ u_Ђ@ ^[ËL$T$QjRP@ظu@tP*_^[Ë_d0^[ø_Ђ@ Ԃ@^[SVt$WU~F "@tFF Ff F 3F F FF u&8@tX@u WLu V/ F tuF+@FHۉF~"SFPW C ]_F ^[ø@tNjσ@@ t jjWL D$ND$SPW= ;t]N _^[ËD$]%_^[à ]_F ^[̋T$9@SVWUƒ@D$ƒL$D$D+3$4t$ ;u 3]_^[è t jjRy D$L$AD$$0+$0;\$$+$0;sG< u FCCÍL$$+=|ՍD$$j+؍L$(D$T$PSQL$,R@t=D$D$ ;}9D$j$4PU RQ@tD$D$D$ @D$|$ |$tG|$u#Ђ@ D$]_Ԃ@^[ËD$P ]_^[ËD$L$D @t$08u 3]_^[ø]Ђ@Ԃ@_^[ËD$ ]+_^[ø]Ђ@ Ԃ@_^[S@VWUuOj5@jjh@hjօt0jjjh @hj@t 3]_^[Ë5@|$ @~D$WP@@u!D$(L$$T$PD$QL$WRPQ]_^[ã@39t$,u (@D$,D$jL$0jWPj Q@u3]_^[ÍmP؅u3]_^[ËD$UL$0SWPjQ@tSD$jL$jUSPQ@t7D$tID$(; L$PD$(T$PUSQR@S?V63]_^[Í}POtыD$WL$VUSPQ@tD$(jju D$4jj-@WVh PՋu&덋L$4PD$0-@PWVh QՋiSV]_^[̋D$VW|$ Ht :t BIu:u+׋_^̃0@SVWUuLD$5@Pjh@jjօt/D$Pjh @j@t3]_^[Ë5@0@u-T$,u@L$$D$ \$QL$PSQR]_^[ã0@ux33|$(;u=(@D$ jL$ jPQj W@t>Ujft-D$ UL$ VPQjW@tL$$QPD$ VP@VJ]_^[jhj@@SVWU|$9=@ǃ@ǃ 4D1trtujj;tWP@u @3WtU2]_^[Ë]_D03^[ø]Ђ@ Ԃ@_^[Vt$F t+t'FP'f FF^̃L$ SV3WU3atrtwt3]_^[ú 3ҋ5؏@5؏@̀9+IwD$DG@D$D$$G@3t3΀@t3@t3wmt3e [t3RJt3A9t31@$t3t3@A9D$ hL$PRQЅ} 3]_^[ËD$$3@]_p ^H[HHPÐF@4F@EF@WF@iF@zF@F@F@F@ F@     VW3395@~P @tP tG9=@,@4"j  @ @t3tFF FFF_^Vt$F @t F ^ÃF u VFFNPVQR FtltgV ‚u3N@t@Ȋ@$ GD$MD.;|$(u |$ u D$$jjP |$ t G;t$&ED@u+|$(|$D$]_^[3]_^[ø]Ђ@ Ԃ@_^[̋ x@tD$Pуt3USVWUjjhK@uD]_^[]ËL$AtD$T$SVWD$PjhK@d5d%D$ Xp t.;t$$t(4v L$H |uhD@Td _^[3d yK@uQ R 9QuSQ<@ SQ<@MKCk Y[̋D$VWPT:P/u@_^Ãu_^Ë5؈@L$ ؈@x ̈@ Ȉ@9 Ȉ@}" Ȉ@ I"tFt@F3ۊ@t t@F t t u˄uNPtL@FF>"t0t*3Ҋ@t tF@t@F>"ut@>"uF3> t uF>|$t T$D$T$ 3>\uFE>\t>"u$ut V:"u3ۃMtt\@MutOu tF tAt7t!3ۊ@tF@@FPo3ۊ@tFFWt@|$t T$T$ ]_^[̃=@SVWUu@5,@֋t@\$0$@؅t @3]_^[Ë|$\$5,@=@u֋u 3]_^[f?tf>uf>u+jjFjjVWjj@tAUo؅t2jjUSVWjj@u S3W(@]_^[W(@3]_^[Ã=@u{u$@؅u 3]_^[Ë;tE}uE}u+EUD$uS @3]_^[Ë|$S @D$]_^[3]_^[̋D$SVWUP9-@u 3]_^[Åu_3]_^[D$@9(0D$=@rD$PU0@C@3@󫪃|$t$8D$t,Nt%33Ҋ;r@@3ɊN;s>uԸ@@=rU-@M@3@󫪋L$It1Nt*33ۊ;r@@B3ۊ^;s>u@rU-@@D$@@@@@]_^I3Z[J3@@]_@3^[AAÃ=@t3]_^[ø]_^[@D$u@%8@u@%4@u@(@̋D$-w3ɊU@$U@3øøøøpU@vU@|U@U@mU@W3@@󫪣@@_@@AAj9VC20XC00USVWU] E@EEEECs {ta v|tEVUkT]^] t3x<{SAkVSv vjDC T{ v4롸UkjS6]]_^[]UL$)APAP]̡ć@t u.=ȇ@u%h@th́3h@S$VWU9t @@r9h@=ć@_=ć@u =ȇ@Ix$hP-@jՅu@@$f$$+у Output file must have an extension! .82p.83p.8xp.85s.86p.86sExtension '%s' is not supported! rbFailed to open input file: %s Error reading input file: %s wbFailed to open output file: %s **TI82** **TI83** **TI83F* **TI85** **TI86** x00x00 x00 l???0000?Failed writing output file: %s '%s' successfully converted to '%s' @@@@ ((((( H .`@(null)(null)@؇@    `y!@~ڣ @ڣ AϢ[@~QQ^ _j21~runtime error TLOSS error SING error DOMAIN error R6027 - not enough space for lowio initialization R6026 - not enough space for stdio initialization R6025 - pure virtual function call R6024 - not enough space for _onexit/atexit table R6019 - unable to open console device R6018 - unexpected heap error R6017 - unexpected multithread lock error R6016 - not enough space for thread data abnormal program termination R6009 - not enough space for environment R6008 - not enough space for arguments R6002 - floating point not loaded <@@ @ @@d@@@@܋@@|@D@x4@y$@z@@@Microsoft Visual C++ Runtime Library Runtime Error! Program: ...d@d@d@d@d@d@        ! 5A CPR S WY l m pr   )    Assertion failed: %s, file %s, line %d <@܏@@GetLastActivePopupGetActiveWindowMessageBoxAuser32.dll(гfr~α$4JZl~Xβ0JV`lfr~α$4JZl~Xβ0JV`lbExitProcessYHeapFreeSHeapAllocGetCommandLineA7GetVersionSetHandleCountGetFileTypeGetStdHandleGetStartupInfoAGetLastErrorSetFilePointerOWriteFileMultiByteToWideCharuLCMapStringABWideCharToMultiBytevLCMapStringWGetStringTypeAGetStringTypeWUHeapCreateCloseHandleReadFileRtlUnwind&UnhandledExceptionFilterGetModuleFileNameAFreeEnvironmentStringsAGetEnvironmentStringsFreeEnvironmentStringsWGetEnvironmentStringsWGetCPInfoGetACPGetOEMCPFlushFileBuffersSetStdHandle+CreateFileAGetProcAddressxLoadLibraryASetEndOfFileKERNEL32.dll"0?0D022'3Z3_3333424]4444 5x55556D6n667#8E88,9h9;8;U;;< <=l>x>>>>>>>>>>?7? p001?1h3336657_7u777C8\8k888:; ;l;q;;;;;;;;;; <<<^>e>??F?x?00"001Y4v444`6d6h6l6p6t6x6|6666666666666666777 77777 7$7(7,7078888 9'9G9u999999 :@:G:v:{:::::;;&;<<<<<<'=1===>>>>????@ 0j0t000000011'1@1E1p11111/2z222$363>3[3c3~3333334*4[4`4z4444!5+5555 667 7$7(7,7074787<7@777777788 999999::J;T;r;;;J >%>\>u>> ????*????P/0151111111112X2n22222383d3x333333 4.4L4R4q4{44444444555*545?5H5b5i55555555555666727;7N7[7d7777728e88888899C9]9{9999:::; ;;!;7;<;J;\;h;m;;;;;<>>>> ?\>`>d>h>l>0 00z88dk-1.8.ds1/support/bin2var/bin2var2.txt0000644000175000017500000000511007237752755017771 0ustar tygrystygrysBin2Var2 modified by Jeremy Drake August 25, 2000 I have modified the program Bin2Var by David Phillips to make unsquished programs for the TI-83 and TI-83 Plus. It inserts the AsmPrgm symbol at the beginning of TI-83 Plus programs and it inserts the End 0000 End stuff at the end of a TI-83 program. I have also modified the squishing version to insert the tasmCmp symbol at the beginning of TI-83 Plus programs so that they can be executed via Asm(prgmName) without a .db 0bbh, 6dh at the beginning of your program. Bin2var.exe squishes, Bin2var2.exe doesn't. The syntax is the same for both. Bin2var(2) input.bin output.ext valid output extensions are 82P 83P 8XP 85s 86p 86s, although I only modified 83P and 8XP The others still work exactly the same. The batch files: ion.bat: the original asm.bat, assembles for ION 83asm.bat: makes an unsquished 83p file 83pasm.bat: makes an unsquished 8xp file 83squasm.bat: makes a squished 83p file 83psqasm.bat: makes a squished 8xp file The original documentation follows: Bin2Var version 1.20 by David Phillips August 24, 2000 This is a simple utility that converts binary images into variables in TI Graph Link format. The following formats are supported: 82P, 83P, 8XP, 85S, 86P and 86S. All testing was done using VTI and not the actual TI Graph Link software. This program was written as a suitable replacement for DevPac83 and DevPac8X, as these programs do not work under Windows NT or Windows 2000. Other formats may be supported in the future if there is a demand (i.e. email me and tell me what you want!). 82P, 85S, 86P and 86S format were added at Clem's request. The included asm.bat batch file is a modification of the one included with ION. You can use it to compile TI-83 and TI-83+ programs for ION using TASM. Messages are written to stdout, so if you redirect the program's to nul, no output will be printed under normal circumstances. Error messages are written to stderr, so you will see errors even if output is redirected to nul. The program is written in ANSI C, so it should compile on just about any platform. There is a binary version include for Win32 (a console app) that was compiled with Borland C++Builder 5. I tested, it does compile on Linux using GCC, but you'll have to compile it yourself if you want to use it on Linux. This program is released under the GNU GPL version 2 or later. In other words, I take no responsibility for this program, and you are free to do anything you like with the source, provided the source is available to anyone who asks for it. z88dk-1.8.ds1/support/bin2var/ion.bat0000644000175000017500000000120507237752755017061 0ustar tygrystygrys@echo off echo ----- Assembling %1 for the TI-83 Plus... echo #define TI83P >temp.z80 if exist %1.z80 type %1.z80 >>temp.z80 if exist %1.asm type %1.asm >>temp.z80 tasm -80 -i -b temp.z80 %1.bin if errorlevel 1 goto ERRORS bin2var %1.bin %1.8xp echo ----- Assembling %1 for the TI-83... echo #define TI83 >temp.z80 if exist %1.z80 type %1.z80 >>temp.z80 if exist %1.asm type %1.asm >>temp.z80 tasm -80 -i -b temp.z80 %1.bin if errorlevel 1 goto ERRORS bin2var %1.bin %1.83p echo ----- Success! echo TI-83 version is %1.83p echo TI-83 Plus version is %1.8xp goto DONE :ERRORS echo ----- There were errors. :DONE del temp.z80 >nul del %1.bin >nul z88dk-1.8.ds1/support/bogomips/0000755000175000017500000000000010765202715016044 5ustar tygrystygrysz88dk-1.8.ds1/support/bogomips/bogomips.10000644000175000017500000000163507130401730017740 0ustar tygrystygrys.TH BOGOMIPS 1 "4 Jun 1994" "Linux" "User Commands" .SH NAME bogomips \- BogoMIPs Benchmark Program .SH SYNOPSIS bogomips .SH DESCRIPTION .B Bogomips is a standalone version of the benchmark program run by the Linux kernel at boot time. .PP .SH "COMMAND\-LINE OPTIONS" No options are currently supported. .SH EXAMPLES .TP 0.5i .B bogomips .SH PORTABILITY .B Bogomips should compile on any ANSI C conforming system. .SH BUGS/LIMITATIONS .PP The "Bogo" in BogoMIPs stands for bogus. See the BOGOMips Mini-HOWTO document for more information on interpreting the results of the program. See also the "New Hacker's Dictionary" (sometimes known as the "Jargon File") for a definition of bogosity and bogon particle physics. .SH AUTHOR .B Bogomips was written by Jeff Tranter (Jeff_Tranter@Mitel.COM) based on code from the Linux kernel, by Linus Torvalds. Additional changes suggested by Thomas McWilliams and Paul Healy. z88dk-1.8.ds1/support/bogomips/bogomips.c0000644000175000017500000000365707247713302020042 0ustar tygrystygrys/* * Standalone BogoMips program * * Based on code Linux kernel code in init/main.c and * include/linux/delay.h * * For more information on interpreting the results, see the BogoMIPS * Mini-HOWTO document. * * version: 1.3 * author: Jeff Tranter (Jeff_Tranter@Mitel.COM) * * djm 20/3/2000 * Made a little bit more relevent for 8 bit machines in the printing * stage...should be right! */ #include #include #ifdef CLASSIC_BOGOMIPS /* the original code from the Linux kernel */ static __inline__ void delay(int loops) { __asm__(".align 2,0x90\n1:\tdecl %0\n\tjns 1b": :"a" (loops):"ax"); } #endif #ifdef QNX_BOGOMIPS /* version for QNX C compiler */ void delay(int loops); #pragma aux delay = \ "l1:" \ "dec eax" \ "jns l1" \ parm nomemory [eax] modify exact nomemory [eax]; #endif #ifdef PORTABLE_BOGOMIPS /* portable version */ static void delay(long loops) { long i; for (i = loops; i != 0 ; i--) ; } #endif /* * This is a chronic cheat! The code is completely different and runs * many times quicker.. * * We could just forget it really! */ #ifdef Z80_DELAY static void delay(long loops) { #asm .del_loop call l_declong ld a,h or l or e or d jp nz,del_loop #endasm } #endif int main(void) { unsigned long loops_per_sec = 1; unsigned long ticks; unsigned long bogo; unsigned long sub; printf("Calibrating delay loop.. "); fflush(stdout); while ((loops_per_sec <<= 1)) { ticks = clock(); delay(loops_per_sec); ticks = clock() - ticks; if (ticks >= CLOCKS_PER_SEC) { loops_per_sec = (loops_per_sec / ticks) * CLOCKS_PER_SEC; bogo = loops_per_sec/500000L; sub = loops_per_sec/5000L; sub %=100; printf("ok - %lu.%s%lu BogoMips\n", bogo, (sub<10)?"0":"", sub ); printf("loops_per_sec=%lu\n",loops_per_sec); return 0; } } printf("failed\n"); return -1; } z88dk-1.8.ds1/support/bogomips/BUGS0000644000175000017500000000100207130401730016506 0ustar tygrystygrysThere may be slight differences between the portable and machine independent versions of the bogomips program. On my system (Linux 1.0.9, 386DX-40, gcc 2.5.8) I get the same results, but they may vary with other compilers or processors. Compiling without optimization certainly makes a difference. When running on a new platform, look at the generated assembly code. The compiler might try to optimize out the delay() function. If so, compile with less optimization or try making the loop counter ("i") volatile. z88dk-1.8.ds1/support/bogomips/CHANGES0000644000175000017500000000127607130401730017033 0ustar tygrystygrysChanges from 1.1 to 1.2: - now supports 3 versions: - original ("classic") Linux bogomips program - version for QNX C compiler - machine indenpendant version (default) - the machine independent version should compile and run on any ANSI C conforming system (tested on Sun-3 and Sun SPARC under SunOS 4.1) - additional changes thanks to Paul Healy - here are some additional results: Machine BogoMIPs ------- -------- Sun-3/80 4.00 Sun IPC 24.00 Sun SS10 34.00 Changes from 1.0 to 1.1: - added fflush() call after first printf() statement - fixed typo in README file - used compiler flags "-fomit-frame-pointer -N -s"; executable is much smaller (thanks to Thomas G. McWilliams) z88dk-1.8.ds1/support/bogomips/INSTALLING0000644000175000017500000000143307130401730017422 0ustar tygrystygrysThere are three variants of this program: - portable version (only requires ANSI C compiler and library) - original Linux version (dependent on gcc and Intel CPU) - QNX version (dependent on QNX C compiler and Intel CPU) The first two versions should give the same results if you are using gcc under Linux. The original Linux version also works under FreeBSD and BSD386. The portable version is the default. Edit the appropriate lines in the make file to select one of the others. To build for Linux under gcc, just type "make". If using a compiler other than GNU gcc, edit the compile options in the makefile. Run the program as "bogomips". Install the binary and man page using "make install" as root (change the makefile if you don't want them put in /usr/local/bin and /usr/local/man). z88dk-1.8.ds1/support/bogomips/Makefile0000644000175000017500000000202307130401730017467 0ustar tygrystygrys# # Makefile for bogomips program # # uncomment one of the followng definitions for DEFS # use this for the portable bogomips program DEFS = -DPORTABLE_BOGOMIPS # use this for the original Linux bogomips program #DEFS = -DCLASSIC_BOGOMIPS # use this for the QNX specific bogomips program #DEFS = -DQNX_BOGOMIPS # uncomment this if your system does not define CLOCKS_PER_SEC # should match units returned by clock() function # the value below works for SunOS 4.1 #DEFS = -DPORTABLE_BOGOMIPS -DCLOCKS_PER_SEC=1000000 # use these flags if using gcc CC = gcc CFLAGS = -Wall -O2 -fomit-frame-pointer -finline-functions -N -s # use these flags if you are not using gcc; modify as needed #CC = cc #CFLAGS = -O bogomips: bogomips.c $(CC) $(DEFS) $(CFLAGS) -o bogomips bogomips.c clean: $(RM) bogomips install: bogomips bogomips.1 cp bogomips /usr/local/bin/bogomips cp bogomips.1 /usr/local/man/man1/bogomips.1 dist: cd .. ; \ tar -czvf bogo-1.2.tar.gz \ bogo-1.2/{bogomips.c,bogomips.1,README,INSTALLING,TODO,CHANGES,BUGS,Makefile} z88dk-1.8.ds1/support/bogomips/README0000644000175000017500000000434207130401730016715 0ustar tygrystygrysAs we all know Bogomips are dodgy..very dodgy infact! Here's a z80 version with two switches, compile either: % zcc -DPORTABLE_BOGOMIPS bogomips.c -o bogomips.bas % zcc -DZ80_DELAY bogomips.c -o bogomips.bas The first uses C to generate the delay loop, the second uses some asm which achieves the same..with a speedup of about 8 fold. Here's eome figures: -DPORTABLE_BOGOMIPS ZX Spectrum (emulated via ZXAM) - 0.0148 Bogomips (7400 loops) Z88 (Real thing) - 0.0134 Bogomips (6700) (Flicking installer options achieves the same result) -DZ80_DELAY ZX Spectrum (emulated via ZXAM) - 0.10 Bogomips (51200) Z88 (Real thing/Int/OZ+) - 0.0910 Bogomips (45500) Z88 (Real thing/OZ+) - 0.0916 Bogomips (45800) Z88 (Real thing/Int) - 0.0916 Bogomips (45800) Z88 (Real thing) - 0.0928 Bogomips (46400) Ironic thing is that you can't really compare the two machines since clock() on the ZX just picks up some values where as on the z88 it uses the OS. However, the delay loop does take longer than these functions do take so I think it's probably possible to compare. Taking -Z80_DELAY: (.10 / 0.928 ) * 3.28 = 3.53 Where 3.28 is the ~ clockspeed of the z88 and 3.53 is ~ clockspeed of ZX - so we have rough concurrence -- From the original Bogomips distribution -- Tired of rebooting your system so you can see how many BogoMIPS it's running at today? Want to impress your friends? Be the first person on your block to run the standalone bogomips program. Now you can measure BogoMIPs all day long without having to bring your system down. This could be the "killer app" that Linux has been waiting for. "Bogomips" is a standalone program that displays your system performance using one of the world's most recognized benchmarks. It uses the same code that is used in the Linux kernel while booting, but runs as a user program. A man page and make file are included. Detailed instructions for building, running, and installing are in the file INSTALLNG. Version 1.3 of BogoMIPs is now portable and should run on any system that supports an ANSI C compiler and library. The package is available from sunsite.unc.edu in the directory /pub/Linux/system/Misc P.S. Don't forget to post your results to the net and impress thousands of people around the world! z88dk-1.8.ds1/support/bogomips/TODO0000644000175000017500000000022307130401730016517 0ustar tygrystygrysFeatures planned for release 2.0: - user's manual (PostScript, approx. 100 pages) - optimize code for better performance - multi-language support z88dk-1.8.ds1/support/bogomips/z88_bogo.bas0000644000175000017500000000416207130401730020163 0ustar tygrystygrys<>&2300ʋ=&AFFFָP !9{">#!9s#A## .S#1ɯ2#!a#u"u#2w#*u#:w#u!(*u#7oSmall C+ z88!9!9&.'!9&|##!9& &.'&î#ÿ#!"&!%>:'!9&>*&.'|r%!9%.'!9&͜#!9%!9&&.'!9&!d&o%!9&!9&3&!d͖&.'!9&! ''$!%!9&! 3&! 9&!3&!d3&>:'! 9T%!9&!P''%!%!9&!3&!d3&>:'T%!%!9&!P3&! 3&! 9&!23&>:'! 9!%!9&>:'!9!#!%>:'! 9!Calibrating delay loop.. ok - %lu.%02lu BogoMips ok - 0.%lu BogoMips ok - 0.%lu%lu BogoMips loops_per_sec=%lu failed  _`i|+^#V#N#FPY#||=)jz !9 !!RR0Z?!9 !!>0Z#}ٕo|ٜg{ٛ_zٚW&?7?+}ŕo|ٜg{ٛ_zٚW8 |!7?|7!&?+}|{zj')!9 *q#^#V!9r'++w'm'og~#fo!9! 9r'#l++~b)!9~%ʵ'!9n&! 9r'*_)!9! 9r'#l++~!9n&B)!9! 9r'#l++~!9n&>(!9r'++l+!9r'&!9^#V! 9^!de*e)!9!9r'++l+I(}d'u'_)!9r'r'"&!9^#V!e)!9!9r'++l+_)!9r'r'!9^#V!e)!9!9r'++l+_)!9r'r'!9++r'#l++~(!9n&! 9r'*(!9r'++l+_)!9r'^#V! 9r'*!9r'++l+_)!9n&! 9r'*_)}l'dL(uʀ(sʴ(c)*)y'!9~ʃ)! 9&!T]5+8ê)!-! 9r'*! 9! 9&+.'!9! 9&! 3&.'|)!9&! 9^#V! 9n&e)!9! 9&! ͔*!0|*! 9r'*!9^#V#Nz !!R(!R(!R y  .! 'i&y<8i&m*7?+{_z!8ɳ7}Ņo|ٌg{ً_zيWz Bz+xG!9Oz+ !!RR0Z?x+y+(+ |/g}/oz/W{/_;++}ŕo|ٜg{ٛ_zٚWz( |!7|7?!}|z88dk-1.8.ds1/support/bogomips/z88_bogo80.bas0000644000175000017500000000407107130401730020332 0ustar tygrystygrys<>&2300ʋ=&AFFFָP !9{">#!9s#A#ͧ# .S#1ɯ2#!a#u"u#2w#*u#:w#u!(*u#7oSmall C+ z88%|œ#!%!Q%>'!9%>%&|?%!9%&!9%͜#!9%!9%͜&&!9%!d͵&<%!9%!9%%!d]&&!9%! &ҙ$!k%!9%! %! 9%!%!d%>'! 9!%!9%!P&$!%!9%!%!d%>'!%!%!9%!P%! %! 9%!2%>'! 9!%!9%>'!9!û#!%>'! 9!Calibrating delay loop.. ok - %lu.%02lu BogoMips ok - 0.%lu BogoMips ok - 0.%lu%lu BogoMips loops_per_sec=%lu failed  _`i|+^#V#N#FPY|=)jz !9 !!RR0Z?!9 !!>0Z#}ٕo|ٜg{ٛ_zٚWͿ&?7?+}ŕo|ٜg{ٛ_zٚW8 |!7?|7!Ϳ&?+}|{z1')!9 *q#^#V!99'++>'4'og~#fo!9! 99'#3++~))!9~%|'!9n&! 99')&)!9! 99'#3++~!9n& )!9! 99'#3++~!9n&(!99'++3+!99'%!9^#V! 9^!d,*,)!9!99'++3+(}dʼ'uʼ'&)!99'9'%!9^#V!,)!9!99'++3+&)!99'9'!9^#V!,)!9!99'++3+&)!99'9'!9++9'#3++~ʷ(!9n&! 99')Ç(!99'++3+&)!99'^#V! 99')!99'++3+&)!9n&! 99')&)}lʜ'd(uG(s{(c((@'!9~J)! 9%!T]*8q)!-! 99')! 9! 9%*&!9! 9%! %&|ʶ)!9%! 9^#V! 9n&,)!9! 9%! [*!0C*! 99')!9^#V#Nz !!R(!R(!R y  .! 'i&y<8i&4*7?+{_z!8ɳ7}Ņo|ٌg{ً_zيWz Bz*xG!9Oz* !!RR0Z?x*y** |/g}/oz/W{/_++}ŕo|ٜg{ٛ_zٚWz( |!7|7?!}|z88dk-1.8.ds1/support/bogomips/zx_bogo.bin0000644000175000017500000000623307130401730020177 0ustar tygrystygrys!9" !9s;>͌!X'1Small C+ ZX!9!9ރ!9|ʉÆ!9ͻރ̂`q!҂!6>!9>ڂރ|$!9ͱރ!9N!9ͱ!9ͅރ!9!2͞!!9!9!2Fރ!9! ׃~!P!9! ! 9!!d>! 9!9!P׃!i!9!!d>!~!9!P! ! 9!2>! 9!!9>!9!à!>! 9!Calibrating delay loop.. ok - %lu.%02lu BogoMips ok - 0.%lu BogoMips ok - 0.%lu%lu BogoMips loops_per_sec=%lu failed *x\:z\_|+^#V#N#FPY#||=)jz !9 !!RR0Z?!9 !!>0Z#}ٕo|ٜg{ٛ_zٚWͨ?7?+}ŕo|ٜg{ٛ_zٚW8 |!7?|7!ͨ?+}|{z)!9 *&^#V!9"++'og~#fo!9! 9"#͕+~!9~%e!9n&! 9"Ά!9! 9"#͕+~!9n&!9! 9"#͕+~!9n&!9"++͕!9"!9^#V! 9^!d͎!9!9"++͕}dʥuʥ!9""҂!9^#V!!9!9"++͕!9""!9^#V!!9!9"++͕!9""!9++"#͕+~ʠ!9n&! 9"Άp!9"++͕!9"^#V! 9"Ά!9"++͕!9n&! 9"Ά}lʅdu0sdcʱڅ)!9~3! 9!T]^8Z!-! 9"Ά! 9! 9Eރ!9! 9! ރ|ʟ!9! 9^#V! 9n&!9! 9! ͽ!0ͥ! 9"Ά!9^#V#Nz !!R(!R(!R y:o&=2w* 4o&^#V*o&)))K9x@gxo>8>O/O~#G~w$*,u(.$| ͻ!"K9x@Wx_o&)))K6\ ~#*,,t e!4E}-"}?,"|%"|$"!@@u!"| ͻ&$.">2!Q"* R|u">2!q":!4" @!" """""UU"w"w""wDww"DD"D"U"f"D"DDDD"D""""DU"w"U""w""""Dwff""DDwUUUUw"f"""w"U"Dwfff3UUwwDff3DfUU"w""DDwU"UUw"UU3f"""""D"D"wwD""D"U""fݪw"UUwUUfUfUUf3DDDD3fUUUUfwDfDDwwDfDDD"UDwU"UUwUUUw""""wUU"UUffUUDDDDDwUwwwUUwUUUUU"UUUU"fUUfDDwUUUwwwUUfUU3D"fw"""""UUUUUwUUUUU"Uwwww"UU""UUUUU"""w""DwwDDDDwDD""ww"w"""""UDDfwUwDDfUUf3DDD33UU3"UfD33DfDDD3UU3fDDfUUU"f""wU"DUffUUDDDDD3UwwwUfUUUU"UUU"fUUfDD3UU33DDDD3D"f"w"""UUUUwUUUU"Uwww"UU"UUUUU3fw"Dw3"D""3""""""f"""fUww͖7?+{_z!8ɳ7}Ņo|ٌg{ً_zيWz BzExG!9OzE !!RR0Z?xEyEQ |/g}/oz/W{/_d+}ŕo|ٜg{ٛ_zٚWz( |!7|7?!}|z88dk-1.8.ds1/support/bogomips/zx_bogo80.bin0000644000175000017500000000614207130401730020346 0ustar tygrystygrys!9" !9s;>Y!X'1Small C+ ZX͈|N!͙!>ͱ!9͎>ͥ͡|!9~ͥ!9͎N!9~!9͎Lͥ!9͎!2e!9͎!9͎ͪ!2 ͥ!9͎! ͞K!!9͎! ͪ! 9͎!ͪ!dͪ>ͱ! 9Ӂ!9͎!P͞ҏ!6!9͎!ͪ!dͪ>ͱӁ!K!9͎!Pͪ! ͪ! 9͎!2ͪ>ͱ! 9!c!9͎>ͱ!9!m!v>ͱ! 9!Calibrating delay loop.. ok - %lu.%02lu BogoMips ok - 0.%lu BogoMips ok - 0.%lu%lu BogoMips loops_per_sec=%lu failed *x\:z\_|+^#V#N#FPY|=)jz !9 !!RR0Z?!9 !!>0Z#}ٕo|ٜg{ٛ_zٚWo?7?+}ŕo|ٜg{ٛ_zٚW8 |!7?|7!o?+}|{z)!9 *&^#V!9++og~#fo!9! 9#\+~م!9~%,!9n&! 9͕օ!9! 9#\+~!9n&ù!9! 9#\+~!9n&õ!9++\!9͎!9^#V! 9^!dU܅!9!9++\}dlulօ!9͙!9^#V!܅!9!9++\օ!9!9^#V!܅!9!9++\օ!9!9++#\+~g!9n&! 9͕7!9++\օ!9^#V! 9͕!9++\օ!9n&! 9͕օ}lLdÄus+cxá!9~! 9͎!T]%8!!-! 9͕! 9! 9͎ ͥ!9! 9͎! ͪͥ|f!9͎! 9^#V! 9n&܅!9! 9͎! ̈́!0l! 9͕!9^#V#Nz !!R(!R(!R ydž:Mo&O=2Mw*N o&^#V*Ko&)))UKK9x@gxo>8>O/O~#G~w$*K,u(.$| ͂!"KKK9x@Wx_o&)))K6\ ~#*K,,; Ň,ŇŇŇŇŇŇƇ·߇ׇŇŇŇŇŇŇŇŇ ŇŇŇŇŇŇŇŇŇ}-"K}?,"K|%"K|$"K!@@u!"K| ͂&$."K>2M!"N*P R|u"K>2M!8"N:P!"@!Q""""""UU"w"w""wDww"DD"D"U"f"D"DDDD"D""""DU"w"U""w""""Dwff""DDwUUUUw"f"""w"U"Dwfff3UUwwDff3DfUU"w""DDwU"UUw"UU3f"""""D"D"wwD""D"U""fݪw"UUwUUfUfUUf3DDDD3fUUUUfwDfDDwwDfDDD"UDwU"UUwUUUw""""wUU"UUffUUDDDDDwUwwwUUwUUUUU"UUUU"fUUfDDwUUUwwwUUfUU3D"fw"""""UUUUUwUUUUU"Uwwww"UU""UUUUU"""w""DwwDDDDwDD""ww"w"""""UDDfwUwDDfUUf3DDD33UU3"UfD33DfDDD3UU3fDDfUUU"f""wU"DUffUUDDDDD3UwwwUfUUUU"UUU"fUUfDD3UU33DDDD3D"f"w"""UUUUwUUUU"Uwww"UU"UUUUU3fw"Dw3"D""3""""""f"""fUww]7?+{_z!8ɳ7}Ņo|ٌg{ً_zيWz Bz xG!9Oz  !!RR0Z?x y  |/g}/oz/W{/_++}ŕo|ٜg{ٛ_zٚWz( |!7|7?!}|z88dk-1.8.ds1/support/c128/0000755000175000017500000000000010765202715014702 5ustar tygrystygrysz88dk-1.8.ds1/support/c128/bin3000.c0000644000175000017500000000263507342723347016135 0ustar tygrystygrys/* * C128 binary file transfer utility * * $Id: bin3000.c,v 1.1 2001/08/28 14:12:55 stefano Exp $ */ #include /* stdlib.h MUST be included to really open files as binary */ #include #ifdef SYMANTEC_C #include #endif void writebyte(unsigned char, FILE *); void writeword(unsigned int, FILE *); int main(int argc, char *argv[]) { FILE *fpin, *fpout; int c; int i; int len; #ifdef SYMANTEC_C argc=ccommand(&argv); #endif if (argc != 3 ) { fprintf(stdout,"Usage: %s [in file] [out file]\n",argv[0]); exit(1); } if ( (fpin=fopen(argv[1],"rb") ) == NULL ) { printf("Can't open input file\n"); exit(1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { printf("Couldn't determine size of file\n"); fclose(fpin); exit(1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(argv[2],"wb") ) == NULL ) { printf("Can't open output file\n"); exit(1); } /* Write out the header file */ writeword(0x3000,fpout); /* We append the binary file */ for (i=0; i compile the program bin3000 a.bin z80mc -> add the 2 bit address stub c1541 mydisk.d64 (write z80run) -> insert the BASIC loader (if new disk) (delete z80mc) -> delete the old MC program (if any) write z80mc -> insert the (new) MC program exit x128 mydisk.d64 -> run the emulator load "z80run",8 -> load the BASIC loader run The code is put at the address $3000; to modify at least the ORG address in c128_crt0.asm and the line 12 of the BASIC loader need to be changed (BLOAD "z80mc",b0,P[location]). Have fun! Stefano z88dk-1.8.ds1/support/c128/z80run0000644000175000017500000000023107350150521015760 0ustar tygrystygrys  0 "Z80MC",B0 / JP $3000T 65518,195: 65519,0: 65520,48Zj CLI / RTS 4352,88: 4353,96#( 65488:z88dk-1.8.ds1/support/cpc/0000755000175000017500000000000010765202715014772 5ustar tygrystygrysz88dk-1.8.ds1/support/cpc/README0000644000175000017500000000154010076763445015661 0ustar tygrystygrys$Id: README,v 1.5 2004/07/19 15:22:13 stefano Exp $ Amstrad CPC (see also the notes on "z88dk/doc/cpc.txt") - Compile the program (optionally you can set another address for ORG) zcc +cpc program.c - Prepare an empty snapshot with your preferred Amstrad emulator (the snapshot format may be a bit different, but normally the locations are the same) memory &1fff (BASIC command) - Save the snapshot and exit from the emulator - Insert the compiled code into the snapshot: sna_mng i a.bin loader.sna 24576 30000 - Re-run the emulator, load the modified snapshot and type: call &6000 As an alternative the XTI (Disk Image XTender) utility can be used; this puts a binary file into a disk image. A valid location/version for XTI (when this document is been updated) is: ftp://ftp.lip6.fr/pub/amstrad/emu-uti/pcxti14.zip Enjoy ! z88dk-1.8.ds1/support/cpc/sna_mng.c0000644000175000017500000000422307311423437016560 0ustar tygrystygrys/* $Id: sna_mng.c,v 1.1 2001/06/12 14:28:47 stefano Exp $ This utility comes from the "roudoudou" web site. Translations are from Stefano Bodrato (12/6/2001). Original README file follows. --- --- --- --- --- --- --- --- --- --- Snapshot Manager for msdos by Roudoudou, an utility to transfer files in a 64 Ko .SNA snapshots files http://www.roudoudou.com Snapshot Manager pour msdos par Roudoudou, un utilitaire pour transfrer des fichiers dans un fichier snapshot de 64 Ko */ #include #include FILE *f; int adress; char buffer[70000]; void main(int argc, char **argv) { printf("Snapshot manager\n\n"); if (argc<6) { printf("sna_mng \n\n"); printf("i : insere file_in dans file_out a l'adresse adress\n"); printf("e : extrait file_in dans file_out de l'adresse adress\n\n"); printf("i : insert file_in into file_out at the desired address\n"); printf("e : extract file_in from file_out starting at the desired address\n"); exit(0); } adress=atoi(argv[4]); if (!(argv[1][0]=='i' || argv[1][0]=='I' || argv[1][0]=='e' || argv[1][0]=='E')) exit(0); if (argv[1][0]=='i' || argv[1][0]=='I') { f=fopen(argv[3],"rb"); if (!f) { printf("%s non trouv dukon!\n",argv[3]); printf("(%s not found!)\n",argv[3]); exit(0); } fread(buffer,65792,1,f); fclose(f); f=fopen(argv[2],"rb"); if (!f) { printf("%s non trouv dukon!\n",argv[2]); printf("(%s not found!)\n",argv[2]); exit(0); } fread(buffer+adress+0x100,atoi(argv[5]),1,f); fclose(f); f=fopen(argv[3],"wb"); fwrite(buffer,65792,1,f); fclose(f); } else if (argv[1][0]=='e' || argv[1][0]=='E') { f=fopen(argv[2],"rb"); if (!f) { printf("%s non trouv dukon!\n",argv[2]); printf("(%s not found!)\n",argv[2]); exit(0); } fread(buffer,65792,1,f); fclose(f); f=fopen(argv[3],"wb"); fwrite(buffer+adress+0x100,atoi(argv[5]),1,f); fclose(f); } printf("fini\n"); printf("(The END)\n"); } z88dk-1.8.ds1/support/font/0000755000175000017500000000000010765202715015173 5ustar tygrystygrysz88dk-1.8.ds1/support/font/fontpack.c0000644000175000017500000000272307500073176017150 0ustar tygrystygrys/* * Font Packer * * This program packs a 4 bit left shifted font so that * two characters are stored in a single one. * The resulting font can be used with the TI calculators and * the ZX Spectrum in ANSI VT mode building the libraries with * the -DPACKEDFONT flag set. * * Example: fontpack F4.BIN F4PACK.BIN * * Stefano 6/6/2002 * * $Id: fontpack.c,v 1.1 2002/06/07 09:01:50 stefano Exp $ */ #include #include int main(int argc, char *argv[]) { unsigned char mychar[8]; FILE *fpin, *fpout; int x; int c; int i; int len; if ((argc < 3 )||(argc > 4 )) { fprintf(stdout,"Usage: %s [input 4 bit font] [output packed font] \n",argv[0]); exit(1); } if ( (fpin=fopen(argv[1],"rb") ) == NULL ) { printf("Can't open input file\n"); exit(1); } /* * Now we try to determine the size of the input font */ if (fseek(fpin,0,SEEK_END)) { printf("Couldn't determine size of file\n"); fclose(fpin); exit(1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(argv[2],"w+b") ) == NULL ) { printf("Can't open output file\n"); exit(1); } for (x=0; x<(len/16); x++) { //EVEN CHAR for (i=0; i<8;i++) mychar[i]=getc(fpin); //ODD CHAR for (i=0; i<8;i++) mychar[i]=mychar[i]+(unsigned char)(getc(fpin)/16); //Write packed char loop for (i=0; i<8;i++) fputc(mychar[i],fpout); } fclose(fpin); fclose(fpout); } z88dk-1.8.ds1/support/generic/0000755000175000017500000000000010765202715015641 5ustar tygrystygrysz88dk-1.8.ds1/support/generic/inject.c0000644000175000017500000000332007265326365017270 0ustar tygrystygrys/* * inject.c * * Puts a file into another file at the given position * * Stefano Bodrato Feb. 2001 * * $Id: inject.c,v 1.2 2001/04/12 13:26:13 stefano Exp $ */ #include /* stdlib.h MUST be included to really open files as binary */ #include int main(int argc, char *argv[]) { char name[11]; FILE *fpin, *fpref, *fpout; int c; int i; int pos, len, reflen; if (argc != 5 ) { fprintf(stdout,"Usage: %s [binary file] [reference file] [position] [injected output file]\n",argv[0]); exit(1); } if ( (fpin=fopen(argv[1],"rb") ) == NULL ) { printf("Can't open binary file\n"); exit(1); } if ( (fpref=fopen(argv[2],"rb") ) == NULL ) { printf("Can't open reference file\n"); exit(1); } pos=atoi(argv[3]); /* * Now we try to determine the size of the file * to be injected.. */ if (fseek(fpin,0,SEEK_END)) { printf("Couldn't determine size of the binary file\n"); fclose(fpin); exit(1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); /* * ... and the len of the reference file */ if (fseek(fpref,0,SEEK_END)) { printf("Couldn't determine size of the reference file\n"); fclose(fpref); exit(1); } reflen=ftell(fpref); fseek(fpref,0L,SEEK_SET); if ( len>=reflen ) { printf("The reference file must be longer than the binary file\n"); exit(1); } if ( (fpout=fopen(argv[4],"wb") ) == NULL ) { printf("Can't open output file\n"); exit(1); } /* First part */ for (i=0; i /* stdlib.h MUST be included to really open files as binary */ #include void writeword(unsigned int, FILE *); int main(int argc, char *argv[]) { char name[11]; FILE *fpin, *fpout; int c; int i; int len; if (argc != 3 ) { fprintf(stdout,"Usage: %s [binary file] [Sharp MZ .m12 file]\n",argv[0]); exit(1); } if ( (fpin=fopen(argv[1],"rb") ) == NULL ) { printf("Can't open input file\n"); exit(1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { printf("Couldn't determine size of file\n"); fclose(fpin); exit(1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(argv[2],"wb") ) == NULL ) { printf("Can't open output file\n"); exit(1); } /* Write out the MZ file */ fputc(1,fpout); /* MZ80K M/C file */ fputc('P',fpout); fputc('R',fpout); fputc('G',fpout); for (i=0;i<14;i++) fputc(13,fpout); writeword(len,fpout); writeword(4608,fpout); writeword(4608,fpout); for (i=0;i<104;i++) fputc(0,fpout); /* ... M/C ...*/ for (i=0; i #include #include #include #ifdef __APPLE__ #define O_BINARY 0 #define __unix__ #else #ifndef __unix__ #include #endif #endif #include char *randname(void); unsigned long getlength(char *s); /* BASIC ICON */ /*static char thehead[]={ 0x1A, 0xFC, 0x0F, 0x02, 0x0C, 0x01, 0x0A, 0xFF, 0x09, 0x01, 0x0D, 0x3D, 0x0D, 0x45, 0x0D, 0x3D, 0x0D, 0x45, 0x0D, 0x3D, 0x0D, 0x01, 0x0D, 0xFF, 0x07, 0x00, 0x00 }; */ /* C Program Icon */ /*static char thehead[]={ 0x1A, 0x00, 0x00, 0x78, 0x00, 0x84, 0x00, 0x02, 0x00, 0xe2, 0x03, 0x22, 0x04, 0x22, 0x04, 0xe2, 0x03, 0x22, 0x00, 0xa4, 0x00, 0x78, 0x00, 0x20, 0x00, 0x00, 0x00 }; */ /* New C Program Icon */ static char thehead[]={ 0x1a, 0xFF, 0x03, 0x01, 0x06, 0xF1, 0x0E, 0xF9, 0x09, 0x99, 0x09, 0x19, 0x08, 0x19, 0x08, 0x99, 0x09, 0xF9, 0x09, 0xF1, 0x08, 0x01, 0x08, 0xFF, 0x0F, 0x00, 0x00 }; #ifndef __unix__ unsigned long getlength(char *s) { int h; unsigned long l; if(!(h=open(s,O_BINARY|O_RDONLY))) return 0; l=filelength(h); close(h); return l; } #else unsigned long getlength(char *s) { unsigned long l; FILE *fh=fopen(s,"rb"); if(!fh) return 0; fseek(fh,0,SEEK_END); l=ftell(fh); fclose(fh); return l; } #endif char *randname() { static char name[9]; int i; int r; name[0]='B'; for(i=1; i<8; i++) { r=rand()%(26+10); if(r<10) name[i]=(char)(r+'0'); else name[i]=(char)(r+'A'-10); } name[8]=0; return name; } main(argc,OrigArgv) int argc; char **OrigArgv; { FILE *in, *out; int c; char name[128]; char *rn; char locname[12]; char **argv; unsigned i; unsigned short owner,oldowner; time_t s; srand(time(&s)); argv=OrigArgv; if(argc>1 && argv[1][0]=='-') { sscanf(argv[1]+1,"%hu",&owner); argv++; argc--; } else owner=65535; if(argc!=2 && argc!=3 && argc!=4 && argc!=5) { fprintf(stderr,"makewzd [-ownerid] filename [Title [(\"Description\" | @descfile) [iconfile]]]\n\n" " Creates filename.wzd from filename.bin, adding Title and\n" " Description if specified, and loading in an iconfile if provided.\n" " The default title is the filename.\n"); return 1; } strcpy(name,argv[1]); strcat(name,".bin"); if(!getlength(name) || NULL==(in=fopen(name,"rb"))) { fprintf(stderr,"File `%s' is either unaccessible or zero length.\n",name); return 4; } strcpy(name,argv[1]); strcat(name,".wzd"); if(NULL==(out=fopen(name,"wb"))) { fprintf(stderr,"Cannot open `%s' for writing.\n",name); return 5; } fprintf(out,"\r\n" "\r\n" "MY PROGRAMS\r\n" "\r\n" "\r\n" "%s\r\n" "\r\n" "\r\n" "PROGRAM\r\n" "\r\n" "\r\n", ( (argc==2)?argv[1]: argv[2] )); if(argc>=4 && argv[3][0]=='@') { FILE *desc=fopen(argv[3]+1,"r"); if(desc==NULL) { fprintf(stderr,"Cannot open %s.\n",argv[3]+1); return 6; } while(-1!=(c=fgetc(desc))) if(c=='\n') fputs("\r\n",out); else fputc(c,out); fputs("\r\n",out); fclose(desc); } else fprintf(out,"%s\r\n",(argc==2)?argv[1]:( (argc==3)?argv[2]: argv[3] )); fprintf(out, "\r\n" "\r\n" "BIN_PROG_1\r\n" "\r\n" "\r\n" "PFILE:%s.BAS\r\n" "\r\n" "\r\n", rn=randname()); if(argc==5) { FILE *icon=fopen(argv[4],"rb"); if(NULL==icon) { fprintf(stderr,"Cannot open icon file.\n"); fclose(out); unlink(name); return 17; } while(-1!=(c=getc(icon))) fputc(c,out); fclose(icon); } else for(i=0; i tmp_$THISFILE.op1 copt $COMPILER/lib/z80rules.1 < tmp_$THISFILE.op1 > tmp_$THISFILE.opt # Produce a list file cp tmp_$THISFILE.opt tmp_opt_$THISFILE.asm z80asm $FLAGS -l tmp_opt_$THISFILE.asm z80asm $FLAGS -eopt -ns -Mo tmp_$THISFILE.opt z88dk-1.8.ds1/support/rcmx000/baudmeas.asm0000644000175000017500000000150610623244602017675 0ustar tygrystygrys; ; Z88DK - Rabbit Control Module examples ; This file is part of baudmeas.c ; ; $Id: baudmeas.asm,v 1.1 2007/05/18 06:36:50 stefano Exp $ ; baudmeas: ld bc,0 ld de,07ffh l1: defb 0d3h ; ioi ld (2),a ; Any write triggers transfer defb 0d3h ; ioi ld hl,(2) ; RTC byte 0-1 defb 0dch ; and hl,de jr nz,l1 l3: inc bc push bc ld b,98h ld hl,8 l2: defb 0d3h ; ioi ld (hl),5ah ; WDTCR <= 5ah djnz l2 pop bc defb 0d3h ; ioi ld (2),a ; Any write triggers transfer defb 0d3h ; ioi ld hl,(2) ; RTC byte 0-1 bit 2,h jr Z,l3 ld h,b ld l,c ld de,8 add hl,de defb 0fch ; rr hl defb 0fch ; rr hl defb 0fch ; rr hl defb 0fch ; rr hl ld a,l ; Calculate same baudrate as bootstrap (2400) ; a := a*3*2*2*2 ld b,a add a,b add a,b ; a*3 add a,a ; a*3*2 add a,a ; a*3*2*2 add a,a ; a*3*2*2*2 (*24) ret z88dk-1.8.ds1/support/rcmx000/baudmeas.c0000644000175000017500000000144210623244602017336 0ustar tygrystygrys/* Z88DK - Rabbit Control Module examples Measuring the RMC baud rate $Id: baudmeas.c,v 1.1 2007/05/18 06:36:50 stefano Exp $ */ #include static int baudmeas() { #asm push af ; push bc ; push de ; call baudmeas ; ld l,a ; ld h,0 ; pop de ; pop bc ; pop af ; ret #include "baudmeas.asm" #endasm } /** Simple hack just to set outgoing serial to the baudrate obtained earlier */ static int init_serial(int divisor) { #asm ; Set the baudrate to 2400 ; ld a,l ; serial divisor, low byte ; defb 0d3h ; ioi ; ld (0a9h),a ; #endasm } int main() { int divisor; divisor=baudmeas(); init_serial(divisor-1); printf("This little program should now have measured the baudrate.\n"); printf("The divisor was: %d\n", divisor); while (1); } z88dk-1.8.ds1/support/rcmx000/boot.c0000755000175000017500000002326410623244602016531 0ustar tygrystygrys #include #include #include #include #include #include #include #include #include #include #include #include #include #include "bootbytes.h" static int debug_hex=0; static int debug_dtr=0; static int debug_flush=0; static int debug_poll=0; static int debug_rw=0; static void dtr_ctl(int fd, int dtrval) { int dtrflags=0; ioctl(fd, TIOCMGET, &dtrflags); if (debug_dtr) fprintf(stderr, "dtrFlags are %x.\n", dtrflags); if (dtrval) { dtrflags |= TIOCM_DTR; } else { dtrflags &= ~TIOCM_DTR; } ioctl(fd, TIOCMSET, &dtrflags); if (debug_dtr) fprintf(stderr, "Setting %x.\n", dtrflags); ioctl(fd, TIOCMGET, &dtrflags); if (debug_dtr) fprintf(stderr, "dtrFlags are %x.\n", dtrflags); return; } static void change_baudrate(int fd, int baudr) { struct termios ios; memset(&ios, 0, sizeof(ios)); tcgetattr(fd, &ios); if (debug_flush) fprintf(stderr, "IBaud=%d\n", cfgetispeed(&ios)); if (debug_flush) fprintf(stderr, "OBaud=%d\n", cfgetospeed(&ios)); switch(baudr) { case 2400: { cfsetospeed(&ios, B2400); break; } case 57600: { cfsetospeed(&ios, B57600); break; } default: { fprintf(stderr, "Illegal baudrate: %d\n", baudr); exit(1); } } tcsetattr(fd, TCSADRAIN, &ios); } static void msleep(int msec) { poll(NULL, 0, msec); } /** Will wait indefinately for either stdin or serial data */ static void do_poll(int serfd) { struct pollfd fds[2]; memset(fds, 0, 2*sizeof(struct pollfd)); if (debug_poll) fprintf(stderr, "Entering do_poll()\n"); fds[0].fd=serfd; fds[1].fd=0; /* stdin */ fds[0].events=POLLIN; fds[1].events=POLLIN; fds[0].revents=0; fds[1].revents=0; poll(fds, 2, -1); if (debug_poll) fprintf(stderr, "Leaving do_poll()\n"); } static int check_fd(int anfd) { struct pollfd fds; fds.fd=anfd; fds.events=POLLIN; fds.revents=0; poll(&fds, 1, 0); if (debug_poll) { if (fds.revents & POLLIN) { if (debug_poll) fprintf(stderr, "fd=%d, we have pollin data\n", anfd); } else { if (debug_poll) fprintf(stderr, "fd=%d, we have NO pollin data\n", anfd); } } return (fds.revents & POLLIN); } /** Code below here should be fairly portable **/ static void usage(const char* argv0) { fprintf(stderr, "Usage: %s -r \n", argv0); fprintf(stderr, " or\n", argv0); fprintf(stderr, "Usage: %s -b \n", argv0); exit(1); } static void talk(int tty) { unsigned char ch; while(1) { do_poll(tty); /** Infinite wait for either stdin or data from serial */ if (check_fd(tty)) { if (debug_rw) fprintf(stderr, " Before read serial...\n"); read(tty, &ch, 1); if (debug_rw) fprintf(stderr, " After read serial...\n"); if (debug_hex) fprintf(stderr, "Got: %.2x (hex))\n", ch); /** Print unprintables as stars '*' */ if (ch>=' ' && ch<='~') { printf("%c", ch); } else if (ch==13) { printf("\n"); } else if (ch==10) { printf("\n"); } else { printf("<%.2X>", ch); } fflush(stdout); } else if (check_fd(0)) { if (debug_rw) fprintf(stderr, " Before read stdin...\n"); read(0, &ch, 1); if (debug_rw) fprintf(stderr, " After read stdin...\n"); if (debug_rw) fprintf(stderr, " Read stdin=%d\n", ch); write(tty, &ch, 1); if (!check_fd(tty)) { msleep(100); /** Just sleep to give target a chance to respond */ } } } } int main(int argc, char *argv[]) { /** Assume hex-ascii */ int is_bin=0; /** This flag is set if we communicate raw with the target */ int is_raw=0; unsigned char ch; int divisor; char* ttyname; char* fname; char* binfilename; int tty; FILE *coldboot; FILE *binfile; /** To keep the size of the .bin file */ long fsize; unsigned csum; int i; if (argc!=4 && argc!=5) { usage(argv[0]); } if (0==strncmp(argv[1], "-b", 2)) { if (argc!=5) usage(argv[0]); ttyname=argv[2]; divisor=atoi(argv[3]); binfilename=argv[4]; is_bin=1; binfile=fopen(binfilename, "rb"); if (binfile==NULL) { fprintf(stderr, "Could not open %s\n", binfilename); exit(1); } } else if (0==strncmp(argv[1], "-r", 2)) { if (argc!=4) usage(argv[0]); ttyname=argv[2]; fname=argv[3]; binfile=NULL; is_raw=1; } else { usage(argv[0]); } if (is_raw) { coldboot=fopen(fname, "rb"); if (coldboot==NULL) { fprintf(stderr, "Could not open %s\n", fname); exit(1); } } tty=open(ttyname, O_RDWR|O_NOCTTY); if (tty==-1) { fprintf(stderr, "Could not open device: %s\n", ttyname); exit(1); } change_baudrate(tty, 2400); /** Reset active **/ dtr_ctl(tty, 1); /** Reset turned off */ dtr_ctl(tty, 0); /** Time to stabilize */ msleep(500); /** Flush serial port */ while (check_fd(tty)) { unsigned char junk; read(tty, &junk, 1); if (debug_flush) fprintf(stderr, "Flushed %.2x off serial line\n", junk); } if (is_raw) /** Take whole file from coldboot file @ 2400 */ { printf("Using the -r (raw) option means that we will download the whole program\n"); printf("with the ultra slow bootstrap utility @ 2400 baud, this means even\n"); printf("the smallest hello-world program will take about 13-14 seconds to\n"); printf("complete, please be patient.\n"); printf("Also note that stdout will not work until it is set up in user code!!!\n"); i=0; while (!feof(coldboot)) { fread(&ch, 1, 1, coldboot); if (feof(coldboot)) break; /** Make the rawmode target code bypass the handshake BA BE etc. */ if (i==0x3e) { /** Are we the dummy mnemonic ld hl,NN ??? */ if (ch==0x21) { ch=0xc3; /** jp NN mnemonic, address is same */ fprintf(stderr, "Changing to jp at address 0x03h\n"); } else { fprintf(stderr, "Wrong magic pattern in .LOD file, have you changed rcmx000_boot.asm???\n"); exit(1); } } write(tty, &ch, 1); if (debug_hex) fprintf(stderr, "wrote: %.2x \n", ch); i++; } } else /** We take the cold boot section from this binaries own data... */ { for (i=0;i>8)&255; write(tty, &ch, 1); if (debug_hex) fprintf(stderr, "wrote: %.2x \n", ch); csum += ch; } fseek(binfile, 0, SEEK_SET); for (i=0;i>8)&255); /** Read the checksum */ read(tty, &ch, 1); if (debug_hex) fprintf(stderr, "Got Checksum lo: %.2x (hex))\n", ch); if (ch!=(csum&255)) { fprintf(stderr, "Wrong checksum\n"); exit(1); } read(tty, &ch, 1); if (debug_hex) fprintf(stderr, "Got Checksum hi: %.2x (hex))\n", ch); if (ch!=((csum/256)&255)) { fprintf(stderr, "Wrong checksum\n"); exit(1); } /** Start conversation with stdin/stdout of target */ talk(tty); } z88dk-1.8.ds1/support/rcmx000/compile_any.sh0000755000175000017500000000112310623244602020243 0ustar tygrystygrys#!/bin/sh THISFILE=$1 COMPILER=/usr/local/lib/z88dk cp $COMPILER/lib/rcmx000_crt0.opt tmp_rcmx000_crt0.opt cp tmp_rcmx000_crt0.opt tmp_rcmx000_crt0.asm zcpp -I. -DZ80 -DSMALL_C -DRCMX000 -D__RCMX000__ -DSCCZ80 -I$COMPILER/include $THISFILE.c tmp_$THISFILE.i sccz80 -// tmp_$THISFILE.i copt $COMPILER/lib/z80rules.2 < tmp_$THISFILE.asm > tmp_$THISFILE.op1 copt $COMPILER/lib/z80rules.1 < tmp_$THISFILE.op1 > tmp_$THISFILE.opt # Produce a list file... cp tmp_$THISFILE.opt tmp_opt_$THISFILE.asm z80asm $FLAGS -l tmp_opt_$THISFILE.asm z80asm $FLAGS -eopt -ns -Mo tmp_$THISFILE.opt z88dk-1.8.ds1/support/rcmx000/link_any.sh0000755000175000017500000000030510571263054017555 0ustar tygrystygrys#!/bin/sh COMPILER=/usr/local/lib/z88dk z80asm $FLAGS -a -m -Mo -oa.bin -i$COMPILER/lib/clibs/ndos -i$COMPILER/lib/clibs/rcmx000_clib -i$COMPILER/lib/clibs/z80_crt0 tmp_rcmx000_crt0.opt $@ z88dk-1.8.ds1/support/rcmx000/Makefile0000755000175000017500000000276610761004036017064 0ustar tygrystygrys # You NEED to set this to your serial port SERDEVICE=/dev/ttyXXX all: boot mk_boot_code _fix_perms RCMX000_BOOT.LOD BAUDMEAS.LOD _fix_perms: chmod a+rx link_any.sh compile_any.sh boot: boot.c bootbytes.h gcc -o boot boot.c mk_coldboot_hfile: mk_coldboot_hfile.c gcc -o mk_coldboot_hfile mk_coldboot_hfile.c mk_boot_code: mk_boot_code.c gcc -o mk_boot_code mk_boot_code.c bootbytes.h: mk_coldboot_hfile RCMX000_BOOT.LOD ./mk_coldboot_hfile RCMX000_BOOT.LOD > bootbytes.h # Here we use some special utilities and assembler flags to make the .LOD file # (same is now used for all users programs) rcmx000_boot.o: rcmx000_boot.asm z80asm rcmx000_boot.asm rcmx000_boot.bin: rcmx000_boot.o z80asm -a -m -Mo -orcmx000_boot.bin rcmx000_boot.o rcmx000_boot.asm: ln -s ../../lib/rcmx000_boot.asm . # The .LOD file used for all normal user programs RCMX000_BOOT.LOD: rcmx000_boot.bin mk_boot_code ./mk_boot_code rcmx000_boot.map rcmx000_boot.bin RCMX000_BOOT.LOD BAUDMEAS.LOD: baudmeas.bin mk_boot_code ./mk_boot_code -r tmp_rcmx000_crt0.sym baudmeas.bin BAUDMEAS.LOD baudmeas.bin: tmp_baudmeas.o rm -f a.bin ; ./link_any.sh tmp_baudmeas.o ; mv a.bin baudmeas.bin tmp_baudmeas.o: baudmeas.c baudmeas.asm ./compile_any.sh baudmeas # Use this to find out the baudrate of your Rabbit, but you only can know # the tty device!! run_baudmeas: ./boot -r $(SERDEVICE) BAUDMEAS.LOD clean: rm -f *.o boot mk_boot_code *.sym *.map *.LOD *.bin rcmx000_boot.asm mk_coldboot_hfile bootbytes.h tmp_* zcc_opt.def *.obj *~ z88dk-1.8.ds1/support/rcmx000/mk_boot_code.c0000755000175000017500000001565410623244602020216 0ustar tygrystygrys#include #include #include static int debug_file=0; static int debug_parse=0; static int debug_lookup=0; static int debug_out=0; /** List of labels to look out for and store in our table */ static const char* s_labels[] = { "__PATCH_BAUDRATE", "__PREFIX", "__POSTFIX", "__START_PROG", "__END_PROG", ""}; static int *s_values; static FILE* openfile(const char* str, const char* mode) { FILE *retval; if (debug_file) fprintf(stderr, "Attempt to open file: ``%s'' with mode ``%s''\n", str, mode); retval=fopen(str, mode); if (retval==NULL) { fprintf(stderr, "File: ``%s'' could not be opened\n", str); exit(1); } return retval; } static int get_hex(const char* pek) { int retval; const char* peki=pek; /** state=0 (init) state=1 found '=' state=2 reading_hex */ int state=0; while (peki-pek<1024) { switch(state) { case 0: { if (*peki=='=') state=1; break; } case 1: { if (*peki!=' ') state=2; break; } case 2: { if (debug_parse) fprintf(stderr, "Reading hex: %s", peki); sscanf(peki, "%x", &retval); if (debug_parse) fprintf(stderr, "value: %d (dec) %x (hex)\n\n", retval, retval); return retval; break; } default: { fprintf(stderr, "Parse error in sym file\n"); exit(1); } } peki++; } return retval; } /** Called once by main to malloc */ static int check_value_size() { int val=0; while (s_labels[val][0]!='\0') { val++; } return val; } static int lookup(const char* labelstr) { int retval=0; if (debug_lookup) { fprintf(stderr, "Looking up: ``%s''\n", labelstr); } while (s_labels[retval][0]!='\0') { int l1=strlen(s_labels[retval]); int l2=strlen(labelstr); if (l1==l2) { if (0==strncmp(labelstr, s_labels[retval], l1)) { if (debug_lookup) { fprintf(stderr, "Found ix: %d, value=%.4x\n", retval, s_values[retval]); } return retval; } } retval++; } if (debug_lookup) { fprintf(stderr, "Label: ``%s'' not found, returning -1\n", labelstr); } return -1; } static void read_symfile(FILE* symfile, int* values) { char buf[1024]; char label[1024]; int i; for (i=0;i<10;i++) { fgets(buf, 1024, symfile); } while (!feof(symfile)) { int ix; char *pek; fgets(buf, 1024, symfile); pek=buf; while (*pek!='\n') pek++; if (debug_file) fprintf(stderr, "scanned one line in symfile: <<<%s>>>\n", buf); { /* Lookup */ int peki; label[0]='\0'; ix=-1; for (peki=0;;peki++) { if ( (buf[peki])==' ' || (buf[peki])=='\n' || (buf[peki])=='\t' || (buf[peki])=='\r') { label[peki]='\0'; /** Now we are ready to call lookup routine */ ix=lookup(label); break; } label[peki]=buf[peki]; } } if (ix==-1) continue; values[ix]=get_hex(buf); } } static void usage(const char* name) { fprintf(stderr, "Usage: %s [-r] \n", name); exit(1); } int main(int argc, char* argv[]) { FILE* symfile; /** File with sym pointers to program start/end */ FILE* binfile; /** Binary file with the i/o in three bytes and code in normal way */ FILE* loadfile; /** This contains a format suitable for feeding * the cold boot feature of rcm2/3000 */ int start_prog_ix=-1, prefix_ix=-1, postfix_ix=-1, end_prog_ix=-1; int start_prog, prefix, postfix, end_prog; int i; unsigned char byte, value; int do_raw=0; s_values=(int*)malloc(sizeof(int) * check_value_size()); if (argc!=4 && argc!=5) { usage(argv[0]); } if (argc==4) { symfile=openfile(argv[1], "r"); binfile=openfile(argv[2], "rb"); loadfile=openfile(argv[3], "wb"); } if (argc==5) { if (0==strncmp(argv[1], "-r", 2)) { do_raw=1; } else { usage(argv[0]); } symfile=openfile(argv[2], "r"); binfile=openfile(argv[3], "rb"); loadfile=openfile(argv[4], "wb"); } read_symfile(symfile, s_values); start_prog_ix=lookup("__START_PROG"); prefix_ix=lookup("__PREFIX"); postfix_ix=lookup("__POSTFIX"); end_prog_ix=lookup("__END_PROG"); if (start_prog_ix==-1 || prefix_ix==-1 || postfix_ix==-1 || end_prog_ix==-1) { fprintf(stderr, "symbol file does not contain correct labels\n"); fprintf(stderr, "Labels needed: __PREFIX, __POSTFIX, __START_PROG and __END_PROG\n"); exit(1); } start_prog = s_values[start_prog_ix]; prefix = s_values[prefix_ix]; postfix = s_values[postfix_ix]; end_prog = s_values[end_prog_ix]; if (debug_parse) fprintf(stderr, "Start: %d, End: %d\n", start_prog, end_prog); /** First send the io-bytes we need to make target work at all... */ fseek(binfile, prefix, SEEK_SET); /** Bypass beginning bytes */ for (i=0;i #include int main(int argc, char *argv[]) { int i, num_to_read; unsigned char ch; unsigned char *chs; FILE *coldboot; coldboot=fopen(argv[1], "rb"); if (coldboot==NULL) { fprintf(stderr, "Could not open %s\n", argv[1]); exit(1); } num_to_read=0; while (1) { fread(&ch, 1, 1, coldboot); if (feof(coldboot)) break; num_to_read++; } i=0; fseek(coldboot, 0, SEEK_SET); chs=(char*)malloc(num_to_read); while (1) { fread(&chs[i], 1, 1, coldboot); if (feof(coldboot)) break; i++; } printf("#ifndef __BOOTBYTES__H\n"); printf("#define __BOOTBYTES__H\n\n"); printf("static const int s_num_bytes = %d;\n", num_to_read); printf("static const unsigned char s_lodfile[] = {\n"); for (i=0;i/z88dk/support/rcmx000 with the make command. The compiler / assembler / linker After the previous section it should now be possible to compile the example programs in examples/rcmx000, just by entering that directory and typing 'make' The download utility (boot) You should be able to run the boot program, from z88dk/support/rcmx000 either directly or by including this also into your PATH. boot on its own on a command line will give a short hint of its usage. The lines run_example: and run_baudmeas in the Makefile should also give you a hint on how to use this util Obtaining your baudrate Since the Rabbit serial boot loader derives its clock speed from the CPU clock it is necessary to measure the baud rate in order to set it to some other speed than the hw supported bootstrap speed of 2400 baud. The bootstrap baudrate is always the same since it is derived from other means. What needs to be set is the baudrate divisor, which will be different for different clocks. The baudmeas.c and baudmeas.asm routines will do this for you, replace the ttyXXX in the Makefile and run 'make run_baudmeas', *NOTE* This will download several kBytes of data at 2400 baud so it will take about 19-20 seconds to complete. Be Patient!!! The good news is that this needs to be run only once for each new target! If it takes longer than that, you might want to check your cabling the power supply to the rabbit board, if you are using the correct serial port etc. It has also proved necessary in some cases to initialize the serial port, via the 'minicom' program once after each reboot. If all goes well you should see a few lines of text and after that a number will be presented to you, it will be 120 for clocks of 9.216 MHz and 192 for clocks of 14.745600 MHz etc. Example programs Now that you know your baudrate divisor you can patch that into the Makefile at the run_example line. Run this example via the 'make run_example' command line. The example.c program will ask you to enter a few characters and then The example.c program will then echo the characters one-by-one including the newline characterr, thus demonstrating rudimentary stdio capabilities. Another example program, valid only for the Rabbit 2000 boards, is the twinkle2000.c It will set the output bits of port "A" on the processor to flash on and off each second (using the RTC to get the timing). The final example program will flash the diodes on the Rabbit 3000 dev boards, located on port PGx, surprisingly named twinkle3000.c ;-) 2) Hardware Rabbit development boards There are a number of evaluation and developement boards available. If you need info, lookup www.rabbitsemiconductor.com Download cable The download cable converts between the hosts rs232 line to logic levels suitable for the Rabbit boards. Build your own stuff Just by taking a Core module and some 0.1" adapter wings it is quite simple for the average home-electronic-hobbyist. Just solder together the adapter wings that convert from the Core modules 1.0 mm spacing to 0.1" suitable for a breadbord. The only pins on the breadboard that need connecting for the Core module to start is the VCC and GND pins (and the programming cable of course ;-) Beware!! the voltage required is different for different Core modules some, like the RCM2000 series requires 5V and others, like the RCM3000 requires 3.3V, if you fry something, don't blame me!!! The download cable is not rocket-science either, it is possible to use some simple logic converter, like a MAX232, the most troublesome part might be to find a 1mm spaced 10-pin connector. To test the module you can run the example.c program provided in the examples/rcmx000/ directory. If you want something more visible, it is easy to connect a LED to one of the port pins, using a suitable current limiting resistor of about 330 Ohm 3) Todo's Rabbit specific mnemonic support Only the changes absolutely necessary for the compiler to produce valid assembler output is currently implemented. For instance, the ioi and ioe mnemonics necessary to program the Rabbit's I/O must be written using DEFB directives, look at the example codes and also the file "bootstrap.asm" for ideas. Also the interrupt handling mnemonics etc are not handled in the assembler. Native multiplication etc. support The Rabbit has a number of nice features not found in the Z80 series, (at least not in the offical version), such as multiplication. This is not used since I have made no alterations to the compiler, (it seems to require the hands of an expert ;-) Persistent storage (flash) When using the almost-native compiler, Dynamic-C, for the Rabbit boards, it automatically stores any program written into the on-board flash so that if the rabbit is disconnected from the programming cable it will start to execute that code by itself when power is applied. No code to handle the flash has so far been written. >64k memory model The Rabbit processors are capable of adressing 1M of total memory using an efficient bank-switching scheme. This is not used currently and the programs are limited to max 64k. See the www.rabbitsemiconductor.com site for more documentation on the segment registers. Drivers Only rudimentary support for stdio has been implemented, in order to use any other cool features, such as ethernet, PWM modulation or just simple bit-banging I/O, driver code has to be written. The #asm directive of the z88dk can be used for writing to registers setting up interrupts etc. Debugging Always a hot issue, my plan is to implement the NoICE protocol ( http://www.noicedebugger.com ) to enable assembler, or at least hex-monitor debugging. This is not so much work, but one also might want C-level debugging which is a larger project. Support for other host-OS than Linux It should not be that hard to make this run on any machine with a decent C-compiler and a serial port, the code for downloading via serial line is not so large. One needs to be able to change the baudrate on-the-fly and also to control the DTR line directly since it resets the target. 4) Contact me Any comments you can send to mimarob@algonet.se z88dk-1.8.ds1/support/README0000644000175000017500000000041007316063115015075 0ustar tygrystygrys$Id: README,v 1.2 2001/06/26 10:39:09 dom Exp $ A few support programs, mainly to allow conversion of outputted binary files from the compiler into a form suitable for loading into emulators or simulators. Other small programs: bogomips - Fake speed calculator z88dk-1.8.ds1/support/rel/0000755000175000017500000000000010765202715015007 5ustar tygrystygrysz88dk-1.8.ds1/support/rel/msbasic/0000755000175000017500000000000010765202715016430 5ustar tygrystygrysz88dk-1.8.ds1/support/rel/msbasic/baslib.c0000755000175000017500000005716710547512176020056 0ustar tygrystygrys/* * Example: linking a program generated with the MS Basic Compiler * and then converted with the rel2z80 tool to run on the ZX Spectrum. * The BASIC program is linked as if it was a library, and this one * provides the necessary entries, main() included. * This is a sort of "Debugging runtime".. written in C ! * There is some inline assembly to read/convert parameters. * Not all the functions are implemented, anyway some simple program * can be linked and 'run' (or 'debugged' !). * * * Given a REL file generated by the BASIC Compiler in CP/M, first convert it: * > rel2z80 HILO.REL * * This will extract a binary object SSMAIN.O * Now link it into a Z80ASM library and copy the lib in your Z88DK tree: * * > z80asm -d -ns -nm -Mo -xssmain ssmain.o * > copy ssmain.lib "c:\Program Files\z88dk\lib\clibs" * * Ok, this program is the new runtime library. * Compile it referring to SSMAIN as a library to be included: * > zcc +zxansi -lndos -lssmain -lm -lmalloc -create-app -zorg=26000 baslib.c * * Now try "a.tap" on your favourite Spectrum emulator ! * * * $Id: baslib.c,v 1.1 2007/01/05 18:10:06 stefano Exp $ * */ #include #include #include #include #include #include #define HPSIZE 2000 HEAPSIZE(HPSIZE) // Compiled BASIC start address extern void __LIB__ SSMAIN(); // Begin (initialize runtime env if necessary) extern void __LIB__ SINI(); // End extern void __LIB__ SEND(); // Chain - load and run another program. extern void __LIB__ SCHN(); extern void __LIB__ SRUN(); // Print char extern void __LIB__ SCHR(); extern void __LIB__ SIN0A(); extern void __LIB__ SIN0B(); extern void __LIB__ SIPUA(); extern void __LIB__ SIPUB(); extern void __LIB__ SLIPA(); extern void __LIB__ SLTMA(); extern void __LIB__ SFMUA(); extern void __LIB__ SFADC(); extern void __LIB__ SGTCC(); extern void __LIB__ SNECE(); extern void __LIB__ SEQCG(); extern void __LIB__ SGTCG(); extern void __LIB__ SEQJG(); // ON GOTO extern void __LIB__ SOGTA(); // ON GOSUB //extern void __LIB__ SOGSA(); extern void __LIB__ SCINA(); extern void __LIB__ SCINC(); extern void __LIB__ S530(); // Compare string extern void __LIB__ SEQTA(); extern void __LIB__ SMID(); extern void __LIB__ SREAA(); extern void __LIB__ SDVDA(); extern void __LIB__ SBSUA(); extern void __LIB__ SSASB(); // LEN string extern void __LIB__ SLENA(); // Set text width extern void __LIB__ SWID(); extern void __LIB__ SLFMA(); extern void __LIB__ SFADA(); // float save, put accumulator into specified location extern void __LIB__ SFASO(); extern void __LIB__ SFASA(); extern void __LIB__ STABA(); extern void __LIB__ SLEF(); extern void __LIB__ SINT(); // RANDOMIZE extern void __LIB__ SRZ0(); // RND extern void __LIB__ SRAN(); // Float compare and conditional jump extern void __LIB__ SLTJA(); extern void __LIB__ SGTJA(); extern void __LIB__ SEQJA(); extern void __LIB__ SNEJA(); extern void __LIB__ SGEJA(); extern void __LIB__ SLEJA(); // Float accumulator compare and conditional jump extern void __LIB__ SLTJC(); extern void __LIB__ SGTJC(); extern void __LIB__ SEQJC(); extern void __LIB__ SNEJC(); extern void __LIB__ SGEJC(); extern void __LIB__ SLEJC(); extern void __LIB__ SRPT(); extern void __LIB__ SRGT(); extern void __LIB__ SDKN(); extern void __LIB__ SDKM(); extern void __LIB__ SDKC(); extern void __LIB__ SSTMA(); extern void __LIB__ SPV0C(); // Print (no newline) extern void __LIB__ SPV1A(); // float extern void __LIB__ SPV1B(); // double precision extern void __LIB__ SPV1C(); // integer extern void __LIB__ SPV1D(); // string // Print (newline) extern void __LIB__ SPV2A(); // float extern void __LIB__ SPV2B(); // double precision extern void __LIB__ SPV2C(); // integer extern void __LIB__ SPV2D(); // string extern void __LIB__ SCISA(); extern void __LIB__ SIMUG(); extern void __LIB__ SFMUC(); extern void __LIB__ SFMUE(); extern void __LIB__ SPR0A(); extern void __LIB__ SPR0D(); extern void DOJUMP(); void *tmem; #asm ; MS BASIC FP accumulator XDEF SAC .SAC defb 0,0,0,0 #endasm int B_CHAN = 0; char B_FLAGS = ' '; int B_RECSIZ = 0; int B_TMPINT = 0; int B_TMPINT2 = 0; int B_TMPINT3 = 0; float B_TMPFLOAT; float B_TMPFLOAT2; char B_TMPSTR [255]; char B_TMPSTR2 [255]; #ifdef DEBUG void pause() { int i; for (i=0; i<2000; i++) printf(""); } #endif void SINI() { #asm push hl #endasm #ifdef DEBUG printf("Initializing...\n"); pause (); #endif heapinit(HPSIZE); } // Chain void SCHN() { #asm call readstr #endasm #ifdef DEBUG printf("SCHN.- LOAD AND RUN ANOTHER PROGRAM: '%s'\n", B_TMPSTR); pause (); #endif exit(0); } void SEND() { #ifdef DEBUG printf("Exiting...\n"); pause (); #endif exit(0); } void SRUN() { #ifdef DEBUG printf("SRUN\n"); pause (); #endif } void SCHR() { #asm ld (_B_TMPINT),hl jr nocls ld a,26 cp l jr nz,nocls ld l,12 nocls: ld (mychr),hl #endasm #ifdef DEBUG printf("SCHR - print char %u\n",B_TMPINT); pause (); #endif #asm ld hl,chrstr ret chrstr: defb 1 defw mychr mychr: defb 65 #endasm } void SLTMA() { #ifdef DEBUG printf("SLTMA\n"); pause (); #endif } void SFMUA() { #asm call read2parms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld de,_B_TMPFLOAT2 call load_float #endasm #ifdef DEBUG printf("SFMUA - variable (%u){%f} and (%u){%f} \n", B_TMPINT, B_TMPFLOAT, B_TMPINT2, B_TMPFLOAT2); pause (); #endif } void SFADC() { #asm call read1parm ld hl,_B_TMPFLOAT call store_float ld (_B_TMPINT),hl ld de,_B_TMPFLOAT call load_float #endasm #ifdef DEBUG printf("SFADC - variable (%u){%f}\n", B_TMPINT, B_TMPFLOAT); pause (); #endif } // ??? void SGTCC() { #asm call read1parm ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float #endasm #ifdef DEBUG printf("SGTCC - expr (SAC > (%u){%f})\n", B_TMPINT, B_TMPFLOAT); pause (); #endif } void SNECE() { #ifdef DEBUG printf("SNECE\n"); pause (); #endif } void SEQCG() { #asm call read1parm ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float #endasm #ifdef DEBUG printf("SEQCG - (%u)%f \n", B_TMPINT, B_TMPFLOAT); pause (); #endif } // ??? void SGTCG() { #asm call read1parm ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float #endasm #ifdef DEBUG printf("SGTCG - expr (SAC > (%u){%f})\n", B_TMPINT, B_TMPFLOAT); pause (); #endif } void SEQJG() { #ifdef DEBUG printf("SEQJG\n"); pause (); #endif } // ON GOTO void SOGTA() { #asm ld (_B_TMPINT),hl ld a,l pop hl ld b,(hl) inc hl push hl and a jr z,zogt ;cp 1 ; default ?? ;jr z,zogt inc b cp b jr nc,zogt push af push bc ;#endasm ; ;#ifdef DEBUG ; printf("SOGTA - ON %u GOTO\n", B_TMPINT); ; pause (); ;#endif ; ;#asm ; pop af ; pop bc pop hl sogt: ld e,(hl) inc hl ld d,(hl) inc hl dec a jr nz,sogt push de ret zogt: pop hl dec b noogt: inc hl inc hl djnz noogt push hl #endasm #ifdef DEBUG printf("SOGTA - ON GOTO, value %u doesn't match\n", B_TMPINT); pause (); #endif } void SCINA() { #asm ld (_B_TMPINT),hl ld de,_B_TMPFLOAT call load_float #endasm #ifdef DEBUG printf("SCINA - pick %f (%u) and keep its int {%u}\n", B_TMPFLOAT, B_TMPINT, (int)B_TMPFLOAT); pause (); #endif B_TMPINT=(int)B_TMPFLOAT; #asm ld hl,(_B_TMPINT) #endasm } void SCINC() { printf("SCINC\n"); } void S530() { #ifdef DEBUG printf("S530\n"); pause (); #endif } void SMID() { #asm call readstr #endasm printf("SMID - '%s'\n", B_TMPSTR); } void SLENA() { #asm call readstr #endasm #ifdef DEBUG printf("SLENA - LEN('%s')=%u\n", B_TMPSTR, strlen(B_TMPSTR)); #endif B_TMPINT=strlen(B_TMPSTR); } void SREAA() { printf("SREAA\n"); } void SDVDA() { #asm call read2parms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld de,_B_TMPFLOAT2 call load_float #endasm #ifdef DEBUG printf("SDVDA - %f(%u) / %f(%u)\n", B_TMPFLOAT, B_TMPINT, B_TMPFLOAT2, B_TMPINT2); #endif B_TMPFLOAT=B_TMPFLOAT/B_TMPFLOAT2; #asm ld hl,_B_TMPFLOAT ld de,SAC call store_float #endasm } void SBSUA() { printf("SBSUA\n"); } void SSASB() { #asm ld (_B_TMPINT),hl #endasm printf("SSASB - $u\n", B_TMPINT); } void SEQTA() { #asm call read2str call readjpparm #endasm #ifdef DEBUG printf("SEQTA - Compare string '%s' with '%s'(%u), if eq jp to %u\n", B_TMPSTR, B_TMPSTR2, B_TMPINT2, B_TMPINT); //printf("Result: %s\n",(strcmp ((char *)B_TMPSTR, (char *)B_TMPSTR2) == 0)); pause (); #endif #asm ld hl,_B_TMPSTR ld de,_B_TMPSTR2 .strcmp1 ld a,(de) ; Next char from s2 inc de ; Ready for next char cpi ; Compare with s1 (and inc hl) -- does not set C flag ret nz ; Different! and a ; Check for end of strings jr nz,strcmp1 ; Round again ; Both strings ended simultaneously ; now we know *s1=*s2=0, return hl=0 call _DOJUMP #endasm } void SWID() { #ifdef DEBUG #asm ld (_B_TMPINT),hl #endasm printf("SWID - Set screen text width to %u\n", B_TMPINT); pause (); #endif } void SLFMA() { #asm call read1parm ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float #endasm #ifdef DEBUG printf("SLFMA - load float constant %f\n", B_TMPFLOAT); #endif #asm ld hl,_B_TMPFLOAT ld de,SAC call store_float #endasm #ifdef DEBUG pause (); #endif } void SFADA() { #asm call read2parms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld de,_B_TMPFLOAT2 call load_float #endasm #ifdef DEBUG printf("SFADA - %f (%u) + %f (%u) = %f\n", B_TMPFLOAT, B_TMPINT, B_TMPFLOAT2, B_TMPINT2, B_TMPFLOAT+B_TMPFLOAT2); #endif B_TMPFLOAT = B_TMPFLOAT+B_TMPFLOAT2; #asm ld hl,_B_TMPFLOAT ld de,SAC call store_float #endasm #ifdef DEBUG pause (); #endif } void SFASO() { #asm call read1parm ld hl,SAC ld bc,4 ldir #endasm #ifdef DEBUG #asm ld hl,(_B_TMPINT) ld de,(_B_TMPFLOAT) call load_float #endasm printf("SFASO - put result {%f} in (%u)\n", B_TMPFLOAT, B_TMPINT); pause (); #endif } void SFASA() { // I'm unsure.. perhaps I should malloc 4 bytes and update value as a ptr to it ? #asm call read2parms ld hl,(_B_TMPINT2) ld de,(_B_TMPINT) ld bc,4 ldir #endasm #ifdef DEBUG #asm ld hl,(_B_TMPINT2) ld de,(_B_TMPFLOAT2) call load_float #endasm printf("SFASA - (%u) = %f\n", B_TMPINT, B_TMPFLOAT2); pause (); #endif } void STABA() { #asm ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("STABA - Print TAB %u \n", B_TMPINT); pause (); #else for ( B_TMPINT2=0; B_TMPINT2 %f (%u) jump to %u \n", B_TMPFLOAT, B_TMPINT, B_TMPFLOAT2, B_TMPINT2, B_TMPINT3); pause (); #endif if (B_TMPFLOAT > B_TMPFLOAT2) DOJUMP(); } void SEQJA() { #asm call read3jpparms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld de,_B_TMPFLOAT2 call load_float #endasm #ifdef DEBUG printf("SEQJA - if %f (%u) = %f (%u) jump to %u \n", B_TMPFLOAT, B_TMPINT, B_TMPFLOAT2, B_TMPINT2, B_TMPINT3); pause (); #endif if (B_TMPFLOAT == B_TMPFLOAT2) DOJUMP(); } void SNEJA() { #asm call read3jpparms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld de,_B_TMPFLOAT2 call load_float #endasm #ifdef DEBUG printf("SEQJA - if %f (%u) <> %f (%u) jump to %u \n", B_TMPFLOAT, B_TMPINT, B_TMPFLOAT2, B_TMPINT2, B_TMPINT3); pause (); #endif if (B_TMPFLOAT != B_TMPFLOAT2) DOJUMP(); } void SGEJA() { #asm call read3jpparms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld de,_B_TMPFLOAT2 call load_float #endasm #ifdef DEBUG printf("SLEJA - if %f (%u) >= %f (%u) jump to %u \n", B_TMPFLOAT, B_TMPINT, B_TMPFLOAT2, B_TMPINT2, B_TMPINT3); pause (); #endif if (!(B_TMPFLOAT < B_TMPFLOAT2)) DOJUMP(); } void SLEJA() { #asm call read3jpparms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld de,_B_TMPFLOAT2 call load_float #endasm #ifdef DEBUG printf("SLEJA - if %f (%u) <= %f (%u) jump to %u \n", B_TMPFLOAT, B_TMPINT, B_TMPFLOAT2, B_TMPINT2, B_TMPINT3); pause (); #endif if (!(B_TMPFLOAT > B_TMPFLOAT2)) DOJUMP(); } void SLTJC() { #asm call read2parms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld (jploc +1 ),hl #endasm #ifdef DEBUG printf("SLTJC - if SAC < (%u) {%f} jp %u\n", B_TMPINT, B_TMPFLOAT, B_TMPINT2); pause (); #endif if (B_TMPFLOAT < B_TMPFLOAT2) DOJUMP(); } void SGTJC() { #asm call read2parms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld (jploc +1 ),hl #endasm #ifdef DEBUG printf("SGTJC - if SAC > (%u) {%f} jp %u\n", B_TMPINT, B_TMPFLOAT, B_TMPINT2); pause (); #endif if (B_TMPFLOAT > B_TMPFLOAT2) DOJUMP(); } void SEQJC() { #asm call read2parms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld (jploc +1 ),hl #endasm #ifdef DEBUG printf("SEQJC - if SAC = (%u) {%f} jp %u\n", B_TMPINT, B_TMPFLOAT, B_TMPINT2); pause (); #endif if (B_TMPFLOAT == B_TMPFLOAT2) DOJUMP(); } void SNEJC() { #asm call read2parms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld (jploc +1 ),hl #endasm #ifdef DEBUG printf("SNEJC - if SAC <> (%u) {%f} jp %u\n", B_TMPINT, B_TMPFLOAT, B_TMPINT2); pause (); #endif if (B_TMPFLOAT != B_TMPFLOAT2) DOJUMP(); } void SGEJC() { #asm call read2parms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld (jploc +1 ),hl #endasm #ifdef DEBUG printf("SGEJC - if SAC >= (%u) {%f} jp %u\n", B_TMPINT, B_TMPFLOAT, B_TMPINT2); pause (); #endif if (!(B_TMPFLOAT < B_TMPFLOAT2)) DOJUMP(); } void SLEJC() { #asm call read2parms ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,(_B_TMPINT2) ld (jploc +1 ),hl #endasm #ifdef DEBUG printf("SLEJC - if SAC <= (%u) {%f} jp %u\n", B_TMPINT, B_TMPFLOAT, B_TMPINT2); pause (); #endif if (!(B_TMPFLOAT > B_TMPFLOAT2)) DOJUMP(); } void SRPT() { #asm ld (_B_CHAN),de ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("SRPT - put to stream #%u value.. %u \n", B_CHAN, B_TMPINT); pause (); #endif } void SRGT() { #asm ld (_B_CHAN),de ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("SRGT - get from stream #%u value.. %u \n", B_CHAN, B_TMPINT); pause (); #endif } void SDKN() { #asm call readstr #endasm B_FLAGS = B_TMPSTR[0]; #ifdef DEBUG printf("SDKN - Init OPEN with flags: '%s'\n", B_TMPSTR); pause (); #endif } void SDKM() { #asm ld (_B_CHAN),bc ld (_B_RECSIZ),hl ld h,d ld l,e call readstr #endasm #ifdef DEBUG printf("SDKM - open '%c', %u, '%s', recsize %u \n", B_FLAGS, B_CHAN, B_TMPSTR, B_RECSIZ); pause (); #endif } void SDKC() { #asm ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("SDKC - close #%u\n", B_TMPINT); pause (); #endif } void SSTMA() { #ifdef DEBUG printf("SSTMA\n"); pause (); #endif } void SIN0A() { #asm call readstr pop hl ld e,(hl) inc hl ld d,0 ld (_B_TMPINT),de push hl #endasm #ifdef DEBUG printf("SIN0A - Print msg for input: '%s' - flag %u\n", B_TMPSTR, B_TMPINT); pause (); #else printf("%s ? ", B_TMPSTR); #endif } void SIN0B() { #asm ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("SIN0B - set up input from #%u\n", B_TMPINT); pause (); #endif } void SLIPA() { #asm ld (_B_TMPINT),hl push hl #endasm #ifdef DEBUG printf("SLIPA - line input: put string in location %u\n", B_TMPSTR); pause (); #endif gets (B_TMPSTR); #asm pop hl #endasm } void SIPUA() { #asm call read1parm #endasm // 10100000001 -- 1281 -- Number ( byte sequence: 01 07 ) // 11100000001 -- 1793 -- string ( byte sequence: 01 05 ) gets (B_TMPSTR); if (!(B_TMPINT & 512)) { B_TMPFLOAT = atof(B_TMPSTR); #ifdef DEBUG printf (" SIPUA - %f",B_TMPFLOAT); #endif } printf ("\n"); #ifdef DEBUG pause (); #endif } void SIPUB() { #asm ld (_B_TMPINT2),hl ld d,h ld e,l ld a,(_B_TMPINT+1) and 2 jr nz,is_string ld hl,_B_TMPFLOAT call store_float ;jr is_num .is_string ;ld hl,_B_TMPSTR ;call store_string ;.is_num #endasm if (B_TMPINT & 512) { tmem=malloc(strlen(B_TMPSTR)+3); #ifdef DEBUG printf ("\n Malloc of %u bytes; location %u\n", strlen(B_TMPSTR)+3, tmem); #endif #asm ld hl,_B_TMPSTR ld de,(_tmem) call store_string ; copy the string ptr onto the variable position ld hl,(_tmem) ld de,(_B_TMPINT2) ld bc,3 ldir #endasm #ifdef DEBUG printf ("\n .entered string %s\n", B_TMPSTR); #endif } else { #asm ;ld de,(_B_TMPINT2) ;call store_float ld hl,(_B_TMPINT2) ld de,_B_TMPFLOAT call load_float #endasm #ifdef DEBUG printf ("\n...entered number %f\n", B_TMPFLOAT); #endif } #ifdef DEBUG printf("SIPUB - string ptr now points to %u\n", B_TMPINT2); pause (); #endif } void SPV0C() { #ifdef DEBUG printf("SPV0C\n"); pause (); #endif } void SPV1A() { #asm ld (_B_TMPINT),hl ld de,_B_TMPFLOAT call load_float #endasm #ifdef DEBUG printf("SPV1A - (%u) ", B_TMPINT); #endif printf(" %f ", B_TMPFLOAT); #ifdef DEBUG printf("\n"); pause (); #endif } void SPV1B() { #asm ld (_B_TMPINT),hl ld de,_B_TMPFLOAT call load_double #endasm #ifdef DEBUG printf("SPV1B - (%u) ", B_TMPINT); #endif printf(" %f ", B_TMPFLOAT); #ifdef DEBUG printf("\n"); pause (); #endif } void SPV1C() { #asm ld h,d ld l,e ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("SPV1C - "); #endif printf(" %u ", B_TMPINT); #ifdef DEBUG printf("\n"); pause (); #endif } void SPV1D() { #asm call readstr #endasm #ifdef DEBUG printf("SPV1D - "); #endif printf("%s", B_TMPSTR); #ifdef DEBUG printf("\n"); pause (); #endif } void SPV2A() { #asm ld (_B_TMPINT),hl ld de,_B_TMPFLOAT call load_float #endasm #ifdef DEBUG printf("SPV2A - (%u) ", B_TMPINT); #endif printf(" %f\n", B_TMPFLOAT); #ifdef DEBUG pause (); #endif } void SPV2B() { #asm ld (_B_TMPINT),hl ld de,_B_TMPFLOAT call load_double #endasm #ifdef DEBUG printf("SPV2B - (%u) ", B_TMPINT); #endif printf(" %f\n", B_TMPFLOAT); #ifdef DEBUG pause (); #endif } void SPV2C() { #asm ld h,d ld l,e ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("SPV2C - "); #endif printf(" %u\n", B_TMPINT); #ifdef DEBUG pause (); #endif } void SPV2D() { #asm call readstr #endasm #ifdef DEBUG printf("SPV2D - "); #endif printf("%s\n", B_TMPSTR); #ifdef DEBUG pause (); #endif } void SCISA() { #asm ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("SCISA - put int {%u} into float SAC\n", B_TMPINT); pause (); #endif B_TMPFLOAT = (float) B_TMPINT; #asm ld hl,_B_TMPFLOAT ld de,SAC call store_float #endasm } void SIMUG() { #asm ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("SIMUG - (INTEGER multiply * %u)\n", B_TMPINT); pause (); #endif } void SIMUC() { #asm ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("SIMUC - (INTEGER multiply * %u)\n", B_TMPINT); pause (); #endif } void SIMUE() { #asm ld (_B_TMPINT),hl #endasm #ifdef DEBUG printf("SIMUE - (INTEGER multiply * %u)\n", B_TMPINT); pause (); #endif } void SFMUC() { #asm call read1parm ld hl,(_B_TMPINT) ld de,_B_TMPFLOAT call load_float ld hl,SAC ld de,_B_TMPFLOAT2 call load_float #endasm #ifdef DEBUG printf("SFMUC - (FLOAT multiply %f * %f)\n", B_TMPFLOAT2, B_TMPFLOAT); #endif B_TMPFLOAT = B_TMPFLOAT * B_TMPFLOAT2; #asm ld hl,_B_TMPFLOAT ld de,SAC call store_float #endasm #ifdef DEBUG pause (); #endif } void SFMUE() { #ifdef DEBUG printf("SFMUE - (FLOAT multiply ?)\n"); pause (); #endif } void SPR0A() { // Probably this had to print a "Line feed" #ifdef DEBUG printf("* "); #endif } void SPR0D() { #asm ld (_B_TMPINT),hl ld h,d ld l,e call readstr #endasm #ifdef DEBUG printf("SPR0D - Setup print to #%u: %s[CR]\n", B_TMPINT, B_TMPSTR); pause (); #endif } // Main entry - just links the "library" with the BASIC compiled object code main() { SSMAIN(); } // Service routines: // transfer and convert data from/to program memory or data areas #asm .readstr ld c,(hl) inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ld de,_B_TMPSTR ld b,0 inc bc ldir dec de xor a ld (de),a ret .read2str push de ld c,(hl) inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ld de,_B_TMPSTR ld b,0 inc bc ldir dec de xor a ld (de),a pop de ld h,d ld l,e ld c,(hl) inc hl ld a,(hl) inc hl ld h,(hl) ld l,a ld de,_B_TMPSTR2 ld b,0 inc bc ldir dec de xor a ld (de),a ret .readjpparm pop bc pop hl ld e,(hl) inc hl ld d,(hl) inc hl ld (_B_TMPINT),de ld (jploc + 1),de push hl push bc ret .read3jpparms pop bc pop hl ld e,(hl) inc hl ld d,(hl) inc hl ld (_B_TMPINT),de ld e,(hl) inc hl ld d,(hl) inc hl ld (_B_TMPINT2),de ld e,(hl) inc hl ld d,(hl) inc hl ld (_B_TMPINT3),de ld (jploc + 1),de push hl push bc ret .read2parms pop bc pop hl ld e,(hl) inc hl ld d,(hl) inc hl ld (_B_TMPINT),de ld e,(hl) inc hl ld d,(hl) inc hl ld (_B_TMPINT2),de push hl push bc ret .read1byte2parms pop bc pop hl ld d,0 inc hl ld e,(hl) ld (_B_TMPINT3),de ld e,(hl) inc hl ld d,(hl) inc hl ld (_B_TMPINT),de ld e,(hl) inc hl ld d,(hl) inc hl ld (_B_TMPINT2),de push hl push bc ret .read1parm pop bc pop hl ld e,(hl) inc hl ld d,(hl) inc hl push hl push bc ld (_B_TMPINT),de ret ; Pick float in HL (MS Basic format) and put it into DE (Z88DK format) .load_float xor a ld (de),a inc de ld (de),a inc de ld bc,4 ldir ret ; Pick double precision # in HL (MS Basic format) and put it into DE (Z88DK format) .load_double inc hl inc hl ld bc,6 ldir ret ; Move float in HL (Z88DK format) to DE (MS Basic format) .store_float ld bc,4 inc hl inc hl ldir ret ; Move # in HL (Z88DK format) to DE (MS Basic format) in double precision .store_double ld bc,6 ;xor a ; we leave the extra precision bytes untouched: ;ld (de),a ; no need to force them to zero because no one will use them inc de ;ld (de),a inc de ldir ret ; Copy C style string in HL to DE in BASIC format. ; The first byte holds the string lenght, then we have two bytes ; for the string location and the string itself (non terminated). .store_string push hl ld bc,0 .count_loop ld a,(hl) and a jr z,end_count inc hl inc c jr nz,count_loop .end_count ld h,d ld l,e ld (hl),c inc hl inc de inc de inc de ld (hl),e inc hl ld (hl),d pop hl ldir ret ._DOJUMP ; pop hl pop hl .jploc jp jploc #endasm z88dk-1.8.ds1/support/rel/REL2BIN.C0000755000175000017500000002736710415140457016166 0ustar tygrystygrys/* REL file analyzer: generates binary blocks which can be disassembled by Enrico Maria Giordano and Stefano Bodrato This file is part of the Z88 Developement Kit - http://www.z88dk.org $Id: REL2BIN.C,v 1.3 2006/04/06 07:20:15 stefano Exp $ */ #include #include #include #define LabelCount 0xf000 char ModuleName[256]; int counter = 0; int chainaddr = 0; int PSize, DSize; int locator; int labelcnt = LabelCount; static int LastAddressType = 0; static int CurrByte = 0; static int CurrBit = -1; static int Pass = 2; int ReadOneBit( FILE *FilePtr, int Boundary ) { int Bit; if ( CurrBit == -1 || Boundary ) { CurrByte = fgetc( FilePtr ); CurrBit = 7; if ( Boundary ) return 0; } Bit = ( CurrByte & 128 ) == 128; CurrByte *= 2; --CurrBit; return Bit; } int ReadBits( FILE *FilePtr, int ToRead ) { int Bits = 0; int i; for ( i = 0; i < ToRead; ++i ) Bits = Bits * 2 + ReadOneBit( FilePtr, 0 ); if ( ToRead == 16 ) Bits = ( Bits >> 8 ) + ( ( Bits & 255 ) << 8 ); return Bits; } int WriteBlock ( char *ModuleName, unsigned char segment[], int size ) { FILE *fpout; if ( ( fpout = fopen( ModuleName, "wb" ) ) == NULL ) { printf("Can't open output file '%s'\n",ModuleName); exit(1); } for (locator = 0; locator < size; locator++) { fputc (segment[locator],fpout); printf ("%u ", segment[locator]); } fclose (fpout); printf ("\n\n\n"); } int SwitchPass ( FILE *FilePtr ) { static int svByte, svBit, svFile; static int svCounter; switch ( Pass ) { case 1: // Pass 2: pre-link and load data basing on "PSize" and "DSize" CurrByte = svByte; CurrBit = svBit; fseek ( FilePtr, svFile, SEEK_SET ); counter=svCounter; Pass = 2; break; case 2: // Pass 1: find the Data and Program size DSize = 0; PSize = 0; svByte = CurrByte; svBit = CurrBit; svCounter = counter; svFile = ftell( FilePtr ); Pass = 1; break; } printf ( "Switched to pass %u\n", Pass ); return ( Pass ); } char *ReadStr( FILE *FilePtr, char *Buffer, int Length ) { int i; for ( i = 0; i < Length; ++i ) { Buffer[ i ] = ( char ) ReadBits( FilePtr, 8 ); if ( Buffer[ i ] == '$' ) Buffer[ i ] = 'S'; if ( Buffer[ i ] == '.' ) Buffer[ i ] = '_'; if ( Buffer[ i ] == '?' ) Buffer[ i ] = 'X'; if ( Buffer[ i ] == '@' ) Buffer[ i ] = 'A'; } Buffer[ Length ] = '\0'; return Buffer; } char *AddressType( char *Buffer, int Type ) { switch ( Type ) { case 0: strcpy( Buffer, "AB" ); break; case 1: strcpy( Buffer, "PR" ); break; case 2: strcpy( Buffer, "DR" ); break; case 3: strcpy( Buffer, "CR" ); break; } return Buffer; } int ReadAddress ( FILE *FilePtr, char *Type ) { int AType; int Address; AType = ReadBits( FilePtr, 2 ); LastAddressType = AType; Address = ReadBits( FilePtr, 16 ); Type = AddressType( Type, AType ); return Address; } int ReadLink( FILE *FilePtr, unsigned char segment[] ) { char Name[ 256 ]; char Type[ 3 ]; int Address, PtrNext; if ( ( Pass == 1 ) && ( PSize != 0 ) && ( DSize != 0 ) ) { printf ("\nProgram Size: %d Data Size: %d\n\n", PSize, DSize); SwitchPass ( FilePtr ); return 1; } //printf ( "Pass %d :", Pass ); switch ( ReadBits( FilePtr, 4 ) ) { case 0: ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if ( Pass == 2 ) printf( "Entry symbol: %s\n", Name ); break; case 1: ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if ( Pass == 2 ) printf( "Select common block: %s\n", Name ); break; case 2: ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if ( Pass == 2 ) printf( "Program name: %s\n", Name ); break; case 3: ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if ( Pass == 1 ) printf( "Special item 0011. External library request: %s\n\n", Name ); //exit( 1 ); break; case 4: if ( Pass == 1 ) printf( "Warning: unused special item 0100\n" ); ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if (Pass == 1) printf( "Item name: %s \n\n", Name ); //exit( 1 ); break; case 5: Address = ReadAddress ( FilePtr, Type ); ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if ( Pass == 2 ) printf( "Common block size: %s %d [%s]\n", Name, Address, Type ); break; case 6: Address = ReadAddress ( FilePtr, Type ); ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if ( Pass == 2 ) { printf( "Chain external: %s $%x [%s]", Name, labelcnt, Type ); while ((Address != 0) && (Address<60000)) { PtrNext = segment[Address] + 256 * segment[Address+1]; printf(" - $%x -", Address); segment[Address] = labelcnt & 255; segment[Address+1] = labelcnt >> 8; //printf("%u\n\n",PtrNext); Address = PtrNext; } } labelcnt++; if ( Pass == 2 ) printf( "\n" ); break; case 7: Address = ReadAddress ( FilePtr, Type ); ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if ( Pass == 2 ) printf( "Entry point: %s $%x [%s]\n", Name, Address, Type ); // STE -- Block name = last entry point found // this differs from rel2z80 sprintf (ModuleName,"%s",Name); // STE // if ( ModuleName == 0 ) // sprintf (ModuleName,"%s",Name); break; case 8: if ( Pass == 2 ) printf( "Error: unused special item 1000\n" ); exit( 1 ); break; case 9: Address = ReadAddress ( FilePtr, Type ); if ( Pass == 2 ) printf( "External offset: $%x [%s]\n", Address, Type ); break; case 10: Address = ReadAddress ( FilePtr, Type ); if ( Pass == 2 ) printf( "Data size: %d [%s]\n", Address, Type ); if ( (Pass == 1) && (DSize == 0) ) DSize = Address; break; case 11: Address = ReadAddress ( FilePtr, Type ); if ( Pass == 2 ) printf( "Location counter: $%x [%s]\n", Address, Type ); // **** if ( LastAddressType == 2 ) counter = ( Address + PSize ); else counter = Address; break; case 12: Address = ReadAddress ( FilePtr, Type ); if ( Pass == 2 ) { printf( "Chain address: $%x [%s]", Address, Type ); //chainaddr = Address; while ((Address != 0) && (Address<60000)) { PtrNext = segment[Address] + 256 * segment[Address+1]; printf(" - $%x -", Address); segment[Address] = counter & 255; segment[Address+1] = counter >> 8; //printf("%u\n\n",PtrNext); Address = PtrNext; } } if ( Pass == 2 ) printf("\n"); //counter = counter +2; ?? Why does this hang ? break; case 13: Address = ReadAddress ( FilePtr, Type ); if ( (Pass == 1) && (PSize == 0) ) { printf( "Program size: %d [%s]\n", Address, Type ); PSize = Address; } break; case 14: Address = ReadAddress ( FilePtr, Type ); printf( "End module: %d [%s]\n\n", Address, Type ); if ( Pass == 2 ) { WriteBlock ( ModuleName, segment, PSize + DSize ); counter = 0; } if ( Pass == 1 ) { if ( PSize == 0 ) PSize = counter; printf( "Adjusting program size: to %d\n", PSize ); } counter = 0; ReadOneBit( FilePtr, 1 ); SwitchPass ( FilePtr ); break; case 15: printf( "End file\n" ); return 0; break; } return 1; } int ReadItem( FILE *FilePtr ) { unsigned char byt; int RelPtr; unsigned char segment[64000]; if ( ReadBits( FilePtr, 1 ) == 0 ) { // printf( "[LC] %d\n", ReadBits( FilePtr, 8 ) ); //printf( "%d\n", ReadBits( FilePtr, 8 ) ); byt = ReadBits( FilePtr, 8 ); if (LastAddressType == 2) { if ((byt > 31) && (byt < 128)) if (Pass == 2) printf( "[$%x]{%d} %d \t%c\n", counter, LastAddressType, byt, byt); else if (Pass == 2) printf( "[$%x]{%d} %d \t-\n", counter, LastAddressType, byt); segment[ counter ] = byt; } else { if (Pass == 2) printf( "[$%x]{%d} %d\n", counter, LastAddressType, byt); segment[counter] = byt; } counter++; } else { switch ( ReadBits( FilePtr, 2 ) ) { case 0: if ( !ReadLink( FilePtr, segment ) ) return 0; break; case 1: RelPtr = ReadBits( FilePtr, 16 ); if (Pass == 2) { printf( "[$%x PS] $%x\n\n", counter, RelPtr ); segment[counter] = RelPtr & 255; segment[counter+1] = RelPtr >> 8; } counter = counter +2; break; case 2: RelPtr = ReadBits( FilePtr, 16 ); if (Pass == 2) { printf( "[$%x DS] $%x\n\n", counter, PSize + RelPtr ); // **** segment[counter] = ( PSize + RelPtr ) & 255; segment[counter+1] = ( PSize + RelPtr ) >> 8; } counter = counter +2; break; case 3: RelPtr = ReadBits( FilePtr, 16 ); if (Pass == 2) { printf( "[$%x CB] $%x\n\n", counter, RelPtr ); segment[counter] = RelPtr & 255; segment[counter+1] = RelPtr >> 8; } counter = counter +2; break; } } return 1; } int main( int argc, char *argv[] ) { FILE *RelFile; if ( argc != 2 ) { printf( "Usage: rel2bin \n" ); return 1; } RelFile = fopen( argv[ 1 ], "rb" ); if ( !RelFile ) { printf( "Can't open file %s\n", argv[ 1 ] ); return 1; } SwitchPass ( RelFile ); while ( ReadItem( RelFile) ); fclose( RelFile ); return 0; } z88dk-1.8.ds1/support/rel/REL2Z80.C0000755000175000017500000005156610415140457016135 0ustar tygrystygrys/* REL to Z80ASM format library converter by Enrico Maria Giordano and Stefano Bodrato This file is part of the Z88 Developement Kit - http://www.z88dk.org $Id: REL2Z80.C,v 1.5 2006/04/06 07:20:15 stefano Exp $ */ #include #include #include #define ABSOLUTE 0 #define PROGRAM_RELATIVE 1 #define DATA_RELATIVE 2 #define COMMON_RELATIVE 3 static int CurrByte = 0; static int CurrBit = -1; struct ExpDecl { int Address; char Type; char Name[ 8 ]; struct ExpDecl *Next; }; struct NameDecl { int Address; char Name[ 8 ]; char Type; struct NameDecl *Next; }; struct LibNameDecl { char Name[ 8 ]; struct LibNameDecl *Next; }; struct Z80Module { int OrgAddress; int ModuleNamePtr; int ExpDeclPtr; int NameDeclPtr; int LibNameDeclPtr; int DataBlockPtr; struct ExpDecl *ExpDecl; struct NameDecl *NameDecl; struct LibNameDecl *LibNameDecl; char ModuleName[ 8 ]; int DataBlock[ 65536 ]; int DataBlockSize; int DataSize; int ProgramSize; int Location; int Pass; int LastAddrType; }; void AddExpDecl( struct Z80Module *Z80Module, int Address, char Type, char *Name ) { struct ExpDecl *Tmp = Z80Module -> ExpDecl; struct ExpDecl *New; New = malloc( sizeof( struct ExpDecl ) ); New -> Address = Address; New -> Type = Type; strcpy( New -> Name, Name ); New -> Next = 0; if ( !Tmp ) { Z80Module -> ExpDecl = New; return; } while ( Tmp -> Next ) Tmp = Tmp -> Next; Tmp -> Next = New; } void CompleteExpDecl( struct Z80Module *Z80Module ) { struct ExpDecl *Tmp = Z80Module -> ExpDecl; int Address, TmpAddr; while ( Tmp ) { Address = Tmp -> Address; if ( Tmp -> Type == 'C' ) { while ( ( TmpAddr = Z80Module -> DataBlock[ Address ] + 256 * Z80Module -> DataBlock[ Address + 1 ] ) != 0 ) { Z80Module -> DataBlock[ Address ] = 0; Z80Module -> DataBlock[ Address + 1 ] = 0; Address = TmpAddr; //printf ( "Added ExpDecl %s, address %u\n", Tmp -> Name, Address ); AddExpDecl( Z80Module, Address, 'C', Tmp -> Name ); } } Tmp = Tmp -> Next; } } int GetExpDeclLen( struct Z80Module *Z80Module ) { struct ExpDecl *Tmp = Z80Module -> ExpDecl; int Len = 0; while ( Tmp ) { Len += 4 + strlen( Tmp -> Name ) + 1; Tmp = Tmp -> Next; } return Len; } int ExistNameDecl( struct Z80Module *Z80Module, char *Name ) { struct NameDecl *Tmp = Z80Module -> NameDecl; while ( Tmp ) { if ( strcmp( Tmp -> Name, Name ) == 0 ) return 1; Tmp = Tmp -> Next; } return 0; } void AddNameDecl( struct Z80Module *Z80Module, int Address, char Type, char *Name ) { struct NameDecl *Tmp = Z80Module -> NameDecl; struct NameDecl *New; if ( ExistNameDecl( Z80Module, Name ) ) return; New = malloc( sizeof( struct NameDecl ) ); strcpy( New -> Name, Name ); New -> Type = Type; New -> Address = Address; New -> Next = 0; if ( !Tmp ) { Z80Module -> NameDecl = New; return; } while ( Tmp -> Next ) Tmp = Tmp -> Next; Tmp -> Next = New; } int GetNameDeclLen( struct Z80Module *Z80Module ) { struct NameDecl *Tmp = Z80Module -> NameDecl; int Len = 0; while ( Tmp ) { Len += 7 + strlen( Tmp -> Name ); Tmp = Tmp -> Next; } return Len; } int ExistLibNameDecl( struct Z80Module *Z80Module, char *Name ) { struct LibNameDecl *Tmp = Z80Module -> LibNameDecl; while ( Tmp ) { if ( strcmp( Tmp -> Name, Name ) == 0 ) return 1; Tmp = Tmp -> Next; } return 0; } void AddLibNameDecl( struct Z80Module *Z80Module, char *Name ) { struct LibNameDecl *Tmp = Z80Module -> LibNameDecl; struct LibNameDecl *New; if ( ExistLibNameDecl( Z80Module, Name ) ) return; New = malloc( sizeof( struct LibNameDecl ) ); strcpy( New -> Name, Name ); New -> Next = 0; if ( !Tmp ) { Z80Module -> LibNameDecl = New; return; } while ( Tmp -> Next ) Tmp = Tmp -> Next; Tmp -> Next = New; } int GetLibNameDeclLen( struct Z80Module *Z80Module ) { struct LibNameDecl *Tmp = Z80Module -> LibNameDecl; int Len = 0; while ( Tmp ) { Len += 1 + strlen( Tmp -> Name ); Tmp = Tmp -> Next; } return Len; } void WriteWord( FILE *Z80File, int Value ) { fprintf( Z80File, "%c%c", Value & 255, Value >> 8 ); } void WriteLong( FILE *Z80File, int Value ) { fprintf( Z80File, "%c%c%c%c", Value & 255, Value >> 8, Value >> 16, Value >> 24 ); } void WriteZ80( struct Z80Module *Z80Module ) { FILE *Z80File; char Filename[ 12 ]; struct ExpDecl *TmpExp = Z80Module -> ExpDecl; struct NameDecl *TmpName = Z80Module -> NameDecl; struct LibNameDecl *TmpLib = Z80Module -> LibNameDecl; int i; strcpy( Filename, Z80Module -> ModuleName ); strcat( Filename, ".O" ); Z80File = fopen( Filename, "wb" ); fprintf( Z80File, "Z80RMF01" ); WriteWord( Z80File, Z80Module -> OrgAddress ); WriteLong( Z80File, Z80Module -> ModuleNamePtr ); WriteLong( Z80File, Z80Module -> ExpDeclPtr ); WriteLong( Z80File, Z80Module -> NameDeclPtr ); WriteLong( Z80File, Z80Module -> LibNameDeclPtr ); WriteLong( Z80File, Z80Module -> DataBlockPtr ); while ( TmpExp ) { fprintf( Z80File, "C" ); WriteWord( Z80File, TmpExp -> Address ); fprintf( Z80File, "%c%s%c", strlen( TmpExp -> Name ), TmpExp -> Name, 0 ); TmpExp = TmpExp -> Next; } fprintf( Z80File, "XA" ); WriteLong( Z80File, 0 ); fprintf( Z80File, "%c%s", strlen( Z80Module -> ModuleName ), Z80Module -> ModuleName ); while ( TmpName ) { if ( TmpName -> Type == 'G' ) { fprintf( Z80File, "GA" ); WriteLong( Z80File, 0 ); fprintf( Z80File, "%c%s", strlen( TmpName -> Name ), TmpName -> Name ); TmpName = TmpName -> Next; } else { fprintf( Z80File, "LA" ); WriteLong( Z80File, TmpName -> Address ); fprintf( Z80File, "%c%s", strlen( TmpName -> Name ), TmpName -> Name ); TmpName = TmpName -> Next; } } while ( TmpLib ) { fprintf( Z80File, "%c%s", strlen( TmpLib -> Name ), TmpLib -> Name ); TmpLib = TmpLib -> Next; } fprintf( Z80File, "%c%s", strlen( Z80Module -> ModuleName ), Z80Module -> ModuleName ); WriteWord( Z80File, Z80Module -> DataBlockSize ); for ( i = 0; i < Z80Module -> DataBlockSize; ++i ) fprintf( Z80File, "%c", Z80Module -> DataBlock[ i ] ); fclose( Z80File ); } void ReleaseZ80Module( struct Z80Module *Z80Module ) { struct ExpDecl *TmpExp = Z80Module -> ExpDecl; struct NameDecl *TmpName = Z80Module -> NameDecl; struct LibNameDecl *TmpLib = Z80Module -> LibNameDecl; while ( TmpExp ) { TmpExp = Z80Module -> ExpDecl -> Next; free( Z80Module -> ExpDecl ); Z80Module -> ExpDecl = TmpExp; } while ( TmpName ) { TmpName = Z80Module -> NameDecl -> Next; free( Z80Module -> NameDecl ); Z80Module -> NameDecl = TmpName; } while ( TmpLib ) { TmpLib = Z80Module -> LibNameDecl -> Next; free( Z80Module -> LibNameDecl ); Z80Module -> LibNameDecl = TmpLib; } } /* Here we load two types of cross-reference: 'L' stands for local: it is a relative pointer which needs to be relocated at linking time 'C' is a reference to a single pointer or to a "chain" of pointers pointing to the current position. CompleteExpDecl will unroll this latest kind of xref as well as the references to global functions. */ void SetRelativeAddr( struct Z80Module *Z80Module, int Location, int RelativePtr, char Type ) { char Name[ 256 ]; if ( Type == 'L' ) { Z80Module -> DataBlock[ Location ] = RelativePtr & 255; Z80Module -> DataBlock[ Location + 1 ] = RelativePtr >> 8; } sprintf ( Name, "LOC_%X", RelativePtr ); if ( Z80Module -> Pass == 2) { AddNameDecl( Z80Module, RelativePtr, 'L', Name ); AddExpDecl( Z80Module, Location, Type, Name ); } } int ReadOneBit( FILE *FilePtr, int Boundary ) { int Bit; if ( CurrBit == -1 || Boundary ) { CurrByte = fgetc( FilePtr ); CurrBit = 7; if ( Boundary ) return 0; } Bit = ( CurrByte & 128 ) == 128; CurrByte *= 2; --CurrBit; return Bit; } int ReadBits( FILE *FilePtr, int ToRead ) { int Bits = 0; int i; for ( i = 0; i < ToRead; ++i ) Bits = Bits * 2 + ReadOneBit( FilePtr, 0 ); if ( ToRead == 16 ) Bits = ( Bits >> 8 ) + ( ( Bits & 255 ) << 8 ); return Bits; } int SwitchPass ( FILE *FilePtr, struct Z80Module *Z80Module ) { static int svByte, svBit, svFile; int x; switch ( Z80Module -> Pass ) { case 1: // Pass 2: pre-link and load data basing on "ProgramSize" and "ProgramSize" for (x=0; x<65536; x++) Z80Module -> DataBlock[x] = 0; CurrByte = svByte; CurrBit = svBit; fseek ( FilePtr, svFile, SEEK_SET ); Z80Module -> Pass = 2; break; case 2: // Pass 1: find the Data and Program size Z80Module -> DataSize = 0; Z80Module -> ProgramSize = 0; svByte = CurrByte; svBit = CurrBit; svFile = ftell( FilePtr ); Z80Module -> Pass = 1; break; } return ( Z80Module -> Pass ); } char *ReadStr( FILE *FilePtr, char *Buffer, int Length ) { int i; for ( i = 0; i < Length; ++i ) { Buffer[ i ] = ( char ) ReadBits( FilePtr, 8 ); if ( Buffer[ i ] == '$' ) Buffer[ i ] = 'S'; if ( Buffer[ i ] == '.' ) Buffer[ i ] = '_'; if ( Buffer[ i ] == '?' ) Buffer[ i ] = 'X'; if ( Buffer[ i ] == '@' ) Buffer[ i ] = 'A'; } Buffer[ Length ] = '\0'; return Buffer; } char *AddressType( char *Buffer, int Type ) { switch ( Type ) { case ABSOLUTE: strcpy( Buffer, "AB" ); break; case PROGRAM_RELATIVE: strcpy( Buffer, "PR" ); break; case DATA_RELATIVE: strcpy( Buffer, "DR" ); break; case COMMON_RELATIVE: strcpy( Buffer, "CR" ); break; } return Buffer; } int ReadAddress ( FILE *FilePtr, struct Z80Module *Z80Module ) { int Address; Z80Module -> LastAddrType = ReadBits( FilePtr, 2 ); Address = ReadBits( FilePtr, 16 ); return Address; } int ReadLink( FILE *FilePtr, struct Z80Module *Z80Module ) { char Name[ 256 ]; char Type[ 3 ]; int Address, TmpAddr; switch ( ReadBits( FilePtr, 4 ) ) { case 0: ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); // printf( "Entry symbol: %s\n", Name ); break; case 1: ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); // printf( "Select common block: %s\n", Name ); break; case 2: ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); // printf( "Program name: %s\n", Name ); break; case 3: ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if ( Z80Module -> Pass == 1 ) printf( "Warning: special item 0011 requests an external library - [%s]\n", Name ); break; case 4: ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if ( Z80Module -> Pass == 1 ) printf( "Warning: ignoring special item declaration 0100 [%s]\n", Name ); break; case 5: Address = ReadAddress ( FilePtr, Z80Module ); ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); // printf( "Common block size: %s %d [%s]\n", Name, Address, Type ); break; case 6: Address = ReadAddress ( FilePtr, Z80Module ); ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); if ( Z80Module -> Pass == 2 ) { //printf( "Chain external: %s %d [%d]\n", Name, Address, Z80Module -> LastAddrType ); AddExpDecl( Z80Module, Address, 'C', Name ); AddLibNameDecl( Z80Module, Name ); } break; case 7: Address = ReadAddress ( FilePtr, Z80Module ); ReadStr( FilePtr, Name, ReadBits( FilePtr, 3 ) ); // printf( "Entry point: %s %d [%s]\n", Name, Address, Type ); if ( Z80Module -> Pass == 2 ) { // Stefano - here we choose the module name // This point needs to be improved if ( *Z80Module -> ModuleName == 0 ) //if (( *Z80Module -> ModuleName == 0 ) && ( Address == 0 )) { strcpy( Z80Module -> ModuleName, Name ); Z80Module -> OrgAddress = Address; } else AddNameDecl( Z80Module, 0, 'G', Name ); } break; case 8: printf( "Error: unused special item 1000\n" ); exit( 1 ); break; case 9: Address = ReadAddress ( FilePtr, Z80Module ); // printf( "External offset: %d [%s]\n", Address, Type ); break; case 10: Address = ReadAddress ( FilePtr, Z80Module ); // printf( "Data size: %d [%s]\n", Address, Type ); if ( ( Z80Module -> Pass == 1 ) && ( Address != 0 ) ) Z80Module -> DataSize = Address; break; case 11: Address = ReadAddress ( FilePtr, Z80Module ); if ( Z80Module -> LastAddrType == DATA_RELATIVE ) { Z80Module -> Location = Address + Z80Module -> ProgramSize; } else { Z80Module -> Location = Address; } // printf( "Location counter: %d [%s]\n", Address, Type ); break; case 12: Address = ReadAddress ( FilePtr, Z80Module ); if ( Z80Module -> Pass == 2 ) { //printf( "%d: Chain address: %d [%d]\n", Z80Module -> Location, Address, Z80Module -> LastAddrType ); SetRelativeAddr( Z80Module, Address, Z80Module -> Location, 'C' ); } break; case 13: Address = ReadAddress ( FilePtr, Z80Module ); // printf( "Program size: %d [%s]\n", Address, Type ); if ( ( Z80Module -> Pass == 1 ) && ( Address != 0 ) ) Z80Module -> ProgramSize = Address; break; case 14: if ( Z80Module -> Pass == 1 ) { SwitchPass ( FilePtr, Z80Module ); if ( Z80Module -> ProgramSize == 0 ) Z80Module -> ProgramSize = Z80Module -> Location; Z80Module -> Location = 0; return 1; } Address = ReadAddress ( FilePtr, Z80Module ); // printf( "End module: %d [%s]\n\n", Address, Type ); ReadOneBit( FilePtr, 1 ); if ( *Z80Module -> ModuleName == 0 ) strcpy ( Z80Module -> ModuleName, "_MAIN" ); Z80Module -> DataBlockSize = Z80Module -> ProgramSize + Z80Module -> DataSize; if ( Z80Module -> OrgAddress == 0 ) Z80Module -> OrgAddress = 65535; CompleteExpDecl( Z80Module ); if ( GetExpDeclLen( Z80Module ) > 0 ) Z80Module -> ExpDeclPtr = 30; else Z80Module -> NameDeclPtr = 30; if ( Z80Module -> ExpDeclPtr > 0 ) Z80Module -> NameDeclPtr = Z80Module -> ExpDeclPtr + GetExpDeclLen( Z80Module ); if ( GetLibNameDeclLen( Z80Module ) > 0 ) Z80Module -> LibNameDeclPtr = Z80Module -> NameDeclPtr + 7 + strlen( Z80Module -> ModuleName ) + GetNameDeclLen( Z80Module ); else Z80Module -> ModuleNamePtr = Z80Module -> NameDeclPtr + 7 + strlen( Z80Module -> ModuleName ) + GetNameDeclLen( Z80Module ); if ( Z80Module -> LibNameDeclPtr > 0 ) Z80Module -> ModuleNamePtr = Z80Module -> LibNameDeclPtr + GetLibNameDeclLen( Z80Module ); Z80Module -> DataBlockPtr = Z80Module -> ModuleNamePtr + 1 + strlen( Z80Module -> ModuleName ); printf ( "%s\t\tProgram Size: %u \tData Size: %u\n", Z80Module -> ModuleName, Z80Module -> ProgramSize, Z80Module -> DataSize ); WriteZ80( Z80Module ); memset( Z80Module, 0, sizeof( struct Z80Module ) ); Z80Module -> ModuleNamePtr = -1; Z80Module -> ExpDeclPtr = -1; Z80Module -> NameDeclPtr = -1; Z80Module -> LibNameDeclPtr = -1; Z80Module -> DataBlockPtr = -1; Z80Module -> Location = 0; Z80Module -> DataSize = 0; Z80Module -> ProgramSize = 0; Z80Module -> Pass = 2; SwitchPass( FilePtr, Z80Module ); Z80Module -> LastAddrType = ABSOLUTE; break; case 15: printf( "End file\n" ); return 0; break; } return 1; } int ReadItem( FILE *FilePtr, struct Z80Module *Z80Module ) { int RelativePtr; if ( ReadBits( FilePtr, 1 ) == 0 ) { if ( Z80Module -> Pass == 2 ) { Z80Module -> DataBlock[ Z80Module -> Location++ ] = ReadBits( FilePtr, 8 ); } else { ReadBits( FilePtr, 8 ); Z80Module -> Location++; } } else { switch ( ReadBits( FilePtr, 2 ) ) { case 0: return ReadLink( FilePtr, Z80Module ); break; case 1: // printf( "%5d [PS] %d\n\n", Location, ReadBits( FilePtr, 16 ) ); RelativePtr = ReadBits( FilePtr, 16 ); if ( Z80Module -> Pass == 2 ) SetRelativeAddr( Z80Module, Z80Module -> Location, RelativePtr, 'L' ); break; case 2: // printf( "%5d [DS] %d\n\n", Location, ReadBits( FilePtr, 16 ) ); RelativePtr = ReadBits( FilePtr, 16 ); if ( Z80Module -> Pass == 2 ) SetRelativeAddr( Z80Module, Z80Module -> Location, Z80Module -> ProgramSize + RelativePtr, 'L' ); break; case 3: // printf( "%5d [CB] %d\n\n", Location, ReadBits( FilePtr, 16 ) ); RelativePtr = ReadBits( FilePtr, 16 ); if ( Z80Module -> Pass == 2 ) SetRelativeAddr( Z80Module, Z80Module -> Location, RelativePtr, 'L' ); break; } Z80Module -> Location += 2; } return 1; } int main( int argc, char *argv[] ) { FILE *RelFile; struct Z80Module Z80Module; if ( ( argc != 2 ) ) { printf( "Usage: REL2Z80 \n" ); return 1; } RelFile = fopen( argv[ 1 ], "rb" ); if ( !RelFile ) { printf( "Can't open file %s\n", argv[ 1 ] ); return 1; } memset( &Z80Module, 0, sizeof( struct Z80Module ) ); Z80Module.ModuleNamePtr = -1; Z80Module.ExpDeclPtr = -1; Z80Module.NameDeclPtr = -1; Z80Module.LibNameDeclPtr = -1; Z80Module.DataBlockPtr = -1; Z80Module.Location = 0; Z80Module.DataSize = 0; Z80Module.ProgramSize = 0; Z80Module.Pass = 2; SwitchPass( RelFile, &Z80Module ); Z80Module.LastAddrType = ABSOLUTE; while ( ReadItem( RelFile, &Z80Module ) ); ReleaseZ80Module( &Z80Module ); fclose( RelFile ); return 0; } z88dk-1.8.ds1/support/rex/0000755000175000017500000000000010765202715015023 5ustar tygrystygrysz88dk-1.8.ds1/support/sam/0000755000175000017500000000000010765202715015005 5ustar tygrystygrysz88dk-1.8.ds1/support/sam/dskman.c0000644000175000017500000003222707443162506016436 0ustar tygrystygrys// SimCoupe .DSK Manipulator // 1.0.0 MacOS by Andrew Collier // // quick and dirty ANSI C port by Thomas Harte!! // Command line enhancement by Frode Tenneb #include #include #include #include void doOpenCommand(FILE **f, char *fname); void doSaveCommand(FILE **f, char *fname); void Menu(void); void Usage(void); void AskChanges(void); void SaveDsk(char *fname); void NewDsk(void); void OpenDsk(char *dskimage); void DirectoryDsk(void); void LoadFile(void); void SaveFile(char *fname); unsigned char * Addr(int track,int sector,int offset); unsigned char *image; FILE *dsk; FILE *file; int validdsk; int changes; /* something of a small patch for the scanf newline type problem */ char no_newlines_getchar(void) { char key; do { key = getchar(); } while(key == '\n'); return key; } /* pathetic little patch ends */ char *getfname(char *title) { char *ret; ret = malloc(256); printf("%s",title); scanf("%s",ret); return ret; } void doOpenCommand(FILE **f, char *fname) { *f = NULL; if (!fname) { fname = getfname("Open file name:"); } if(fname) { *f = fopen(fname, "r"); }; } void doSaveCommand(FILE **f, char *fname) { *f = NULL; if (!fname) { fname = getfname("Save file as:"); } *f = fopen(fname, "w"); } int main(int argc, char **argv) { char command; if ((image = malloc(819200)) == (unsigned char *) NULL) { printf("Sorry, not enough free memory to load .DSK file\n"); getchar(); } else { /* We have commands - add the file(s) to the diskimage */ if (argc >= 2 ) { if (argv[1][0] == '-') { if (argv[1][1] == 'h') { Usage(); exit(0); } } if (argc < 3) { Usage(); exit(1); } OpenDsk(argv[1]); SaveFile(argv[2]); SaveDsk(argv[1]); exit(0); } command = 'X'; validdsk = 0; changes = 0; Menu(); while (command != 'Q') { printf ("? "); command = toupper(getchar()); printf ("%c\n",command); switch (command) { case '?': case 'H': Menu(); break; case 'N': AskChanges(); NewDsk(); break; case 'O': AskChanges(); OpenDsk(NULL); break; case 'D': DirectoryDsk(); break; case 'L': LoadFile(); break; case 'S': SaveFile(NULL); break; case 'W': SaveDsk(NULL); break; case 'Q': AskChanges(); break; } }; }; return 0; } void Menu(void) { printf ("** Andrew Collier's SimCoupe .DSK manipulator **\n"); printf ("** Command line enhancements by Frode Tenneb **\n\n"); printf ("N: New .DSK file\n"); printf ("O: Open .DSK file\n"); printf ("W: Write changes\n"); printf ("D: Directory .DSK file\n"); printf ("S: Save file into .DSK\n"); printf ("L: Load file from .DSK\n"); printf ("Q: Quit program\n"); } void Usage(void) { printf ("** Andrew Collier's SimCoupe .DSK manipulator **\n"); printf ("** Command line enhancements by Frode Tenneb **\n\n"); printf ("Usage: dskman [[-h][DSK-file]] [file]\n\n"); printf (" -h This help\n\n"); printf ("Example: dskman test.dsk file\n"); printf (" dskman (by itself) will get you into the original menu mode\n"); } void AskChanges(void) { char command; if (changes) { printf ("Unsaved changes to DSK\nSave before continuing? Y/N\n"); command = 'X'; while ((command != 'Y') && (command != 'N')) { command = toupper(getchar()); } if (command == 'Y') { SaveDsk(NULL); } } } void SaveDsk(char *fname) { doSaveCommand(&dsk, fname); if (dsk != NULL) { if (fwrite (image, (size_t) 1, (size_t) 819200, dsk) == 819200) { changes = 0; printf ("OK\n"); } else { printf ("Sorry, there has been a disk write error\n"); }; fclose(dsk); } } void NewDsk(void) { int i; for (i = 0; i<819200; i++) { *(image+i) = (unsigned char)0; } validdsk = 1; changes = 1; } void OpenDsk(char *dskimage) { doOpenCommand(&dsk, dskimage); if (dsk != NULL) { fseek (dsk, 0, 2); if (ftell (dsk) == 819200) { fseek (dsk, 0 , 0); if (fread (image, (size_t) 1, (size_t) 819200, dsk) == 819200) { validdsk = 1; printf (".DSK loaded\n"); changes = 0; } else { validdsk = 0; printf ("Sorry, there has been a disk read error\n"); }; } else { printf ("Sorry, this is not a valid .DSK file\n"); validdsk = 0; }; fclose (dsk); } else { printf ("Sorry, no such .DSK file\n"); if (dskimage) { exit(1); } } } void DirectoryDsk(void) { if (validdsk != 0) { int maxdtrack,nfiles,nfsect,flen,i,stat,track,sect,half; char filename[11]; if ( *(image+255) == 255) { printf ("*** SAMDOS directory:\n"); maxdtrack = 4; } else { maxdtrack = 4 + *(image+255); for (i=0; i<10; i++) { filename[i] = *(image+210+i); }; filename[10]=0; printf ("*** MasterDos directory: %s\n",filename); } nfiles = 0; nfsect = 10 * (160 - maxdtrack) + (maxdtrack > 4); for (track = 0; track < maxdtrack; track++) { for (sect = 1; sect <= 10; sect ++) { for (half = 0; half < 2; half ++) { if ((track != 4) || (sect != 1)) { if ((stat = *Addr(track,sect,256*half)) != 0) { for (i=0; i<10; i++) { filename[i] = *Addr(track,sect,256*half+1+i); if ((filename[i]<32) || (filename[i]>126)) filename[i]='?'; }; filename[10]=0; printf("%s ",filename); if (stat & 128) printf ("H"); else printf("."); if (stat & 64) printf ("P"); else printf("."); flen = *Addr(track,sect,256*half +240); flen += 256* *Addr(track, sect, 256*half +241); flen += 16384* *Addr(track,sect,256*half +239); printf("%6.0f ",(float)flen); nfsect -= *Addr(track,sect,256*half +12); nfsect -= 256* *Addr(track,sect,256*half +11); //if ((++nfiles %4) == 0) printf("\n"); } else if ((*Addr(track,sect,256*half +1)) == 0) { half = 1; sect = 10; track = maxdtrack; }; }; }; }; }; printf("\n%d files, %d K free\n",nfiles,nfsect/2); } else { printf ("No loaded .DSK file\n"); }; } void LoadFile(void) { char filename[11]; int i,t,s,h,length,maxdtrack,ss,tt; unsigned char *found; if (validdsk != 0) { printf ("Filename: "); i=0; filename[i] = no_newlines_getchar(); while ((i<10) && (filename[i] != '\n')) { filename[++i] = getchar(); } while (filename[i] != '\n') { filename[i] = getchar(); } while (i<10) { filename[i++]=' '; } filename[10]=0; found = NULL; if ( *(image+255) == 255) { maxdtrack = 4; } else { maxdtrack = 4 + *(image+255); } for (t=0; t=501) { fwrite(Addr(t,s,9),1,501,file); i -= 501; } else { fwrite(Addr(t,s,9),1,i,file); i=0; }; while (i>0) { tt = *Addr(t,s,510); ss = *Addr(t,s,511); t = tt; s = ss; // printf("t %d s %d\t",t,s); if (i>=510) { fwrite(Addr(t,s,0),1,510,file); i -= 510; } else { fwrite(Addr(t,s,0),1,i,file); i=0; }; }; fclose(file); printf("Filename %s Length %d ",filename,length); length = *(found +237); length += 256* *(found +238); length += 16384* ((*(found +236) & 31) -1); printf ("Start %d ", length); length = *(found +243); length += 256* *(found +244); length += 16384* (1 + *(found +242) & 31); if (length != 589823) printf ("Execute %d ", length); printf ("\n"); }; }; }; } void SaveFile(char *fname) { char filename[11], *basen; unsigned char sectmap[195],usedmap[195],*found; int filelength,maxdtrack,s,t,h,i,m,a,tt,ss; if (validdsk != 0) { doOpenCommand(&file, fname); if (file == NULL) { printf("Sorry, file not found\n"); exit(1); } fseek (file, 0, 2); filelength = ftell(file); fseek (file,0,0); if ( *(image+255) == 255) { maxdtrack = 4; } else { maxdtrack = 4 + *(image+255); }; for (i=0; i<195; i++) { sectmap[i] = usedmap[i] = 0; } for (t=0; t4) { sectmap[0] &= 254; sectmap[1] &= 3; if (maxdtrack>5) { a=1; m=4; for (i=0; i<10*(maxdtrack - 4); i++) { sectmap[a] &= m; m *=2; if (m==256) { a ++; m = 1; } } } } for (t=0; t (510*i - 9)) { printf("Sorry, not enough space on dsk\n"); } else { t=4; s=1; m=1; a=0; while ((sectmap[a] & m)) { m *= 2; if (m==256) { m =1; a ++; } s++; if (s==11) { s=1; t++; if (t==80) t=128; } } memset(filename, 32, 10); filename[10]=0; if (!fname) { printf ("Save Filename:"); i=0; filename[i] = no_newlines_getchar(); while ((i<10) && (filename[i] != '\n')) { filename[++i] = getchar(); } while (filename[i] != '\n') { filename[i] = getchar(); } while (i<10) { filename[i++]=' '; } } else { basen = basename(fname); strncpy(filename, basen, strlen(basen)); printf ("Save Filename:%s\n", filename); } *(found) = 19; *Addr(t,s,0) = 19; for (i=0; i<10; i++) { *(found+1+i) = filename[i]; } i = (filelength+9)/510; *(found+11) = i/256; *(found+12) = i%256; *(found+13) = t; *(found+14) = s; *(found+220) = 0; *(found+236) = 1; *Addr(t,s,8) = 1; *(found+237) = 0; *Addr(t,s,3) = 0; *(found+238) = 128; *Addr(t,s,4) = 128; *(found+239) = filelength/16384; *Addr(t,s,7) = filelength/16384; *(found+240) = filelength%256; *Addr(t,s,1) = filelength%256; *(found+241) = (filelength%16384)/256; *Addr(t,s,2) = (filelength%16384)/256; *(found+242) = 255; *(found+243) = 255; *(found+244) = 255; if (filelength < 502) { fread(Addr(t,s,9),1,filelength,file); *Addr(t,s,510) = 0; *Addr(t,s,511) = 0; usedmap[a] |= m; sectmap[a] |= m; } else { fread(Addr(t,s,9),1,501,file); filelength -= 501; usedmap[a] |= m; sectmap[a] |= m; while (filelength > 0) { printf ("t %d s %d, ",t,s); tt = t; ss = s; while ((sectmap[a] & m)) { m *= 2; if (m==256) { m =1; a ++; } s++; if (s==11) { s=1; t++; if (t==80) t=128; } } *Addr(tt,ss,510) = t; *Addr(tt,ss,511) = s; if (filelength > 510) { fread(Addr(t,s,0),1,510,file); filelength -= 510; usedmap[a] |= m; sectmap[a] |= m; } else { fread(Addr(t,s,0),1,filelength,file); filelength = 0; usedmap[a] |= m; sectmap[a] |= m; *Addr(t,s,510) = 0; *Addr(t,s,511) = 0; } } } for (i=0;i<195;i++) { *(found+15+i) = usedmap[i]; } changes = 1; printf ("OK\n"); } } } unsigned char *Addr(int track,int sector,int offset) { unsigned char *a; if (track < 80) { a = image + 10240*track + 512*(sector-1) + offset; } else { a = image + 5120 + 10240*(track - 128) + 512*(sector-1) + offset; } return a; } z88dk-1.8.ds1/support/sam/dskmanANSI.c0000644000175000017500000002716707301227437017116 0ustar tygrystygrys// SimCoupe .DSK Manipulator // 1.0.0 MacOS by Andrew Collier // // quick and dirty ANSI C port by Thomas Harte!! #include #include #include void doOpenCommand(FILE **f); void doSaveCommand(FILE **f); void Menu(void); void AskChanges(void); void SaveDsk(void); void NewDsk(void); void OpenDsk(void); void DirectoryDsk(void); void LoadFile(void); void SaveFile(void); unsigned char * Addr(int track,int sector,int offset); unsigned char *image; FILE *dsk; FILE *file; int validdsk; int changes; /* something of a small patch for the scanf newline type problem */ char no_newlines_getchar(void) { char key; do { key = getchar(); } while(key == '\n'); return key; } /* pathetic little patch ends */ char *getfname(char *title) { char *ret; ret = malloc(256); printf("%s",title); scanf("%s",ret); return ret; } void doOpenCommand(FILE **f) { char *fname; *f = NULL; fname = getfname("Open file name:"); if(fname) { *f = fopen(fname, "rb"); }; } void doSaveCommand(FILE **f) { char *fname; *f = NULL; fname = getfname("Save file as:"); *f = fopen(fname, "wb"); } int main(void) { char command; if ((image = malloc(819200)) == (unsigned char *) NULL) { printf("Sorry, not enough free memory to load .DSK file\n"); getchar(); } else { command = 'X'; validdsk = 0; changes = 0; Menu(); while (command != 'Q') { printf ("? "); command = toupper(getch()); printf ("%c\n",command); switch (command) { case '?': case 'H': Menu(); break; case 'N': AskChanges(); NewDsk(); break; case 'O': AskChanges(); OpenDsk(); break; case 'D': DirectoryDsk(); break; case 'L': LoadFile(); break; case 'S': SaveFile(); break; case 'W': SaveDsk(); break; case 'Q': AskChanges(); break; } }; }; return 0; } void Menu(void) { printf ("** Andrew Collier's SimCoupe .DSK manipulator **\n\n"); printf ("N: New .DSK file\n"); printf ("O: Open .DSK file\n"); printf ("W: Write changes\n"); printf ("D: Directory .DSK file\n"); printf ("S: Save file into .DSK\n"); printf ("L: Load file from .DSK\n"); printf ("Q: Quit program\n"); } void AskChanges(void) { char command; if (changes) { printf ("Unsaved changes to DSK\nSave before continuing? Y/N\n"); command = 'X'; while ((command != 'Y') && (command != 'N')) { command = toupper(getch()); } if (command == 'Y') { SaveDsk(); } } } void SaveDsk(void) { doSaveCommand(&dsk); if (dsk != NULL) { if (fwrite (image, (size_t) 1, (size_t) 819200, dsk) == 819200) { changes = 0; printf ("OK\n"); } else { printf ("Sorry, there has been a disk write error\n"); }; fclose(dsk); } } void NewDsk(void) { int i; for (i = 0; i<819200; i++) { *(image+i) = (unsigned char)0; } validdsk = 1; changes = 1; } void OpenDsk(void) { doOpenCommand(&dsk); if (dsk != NULL) { fseek (dsk, 0, 2); if (ftell (dsk) == 819200) { fseek (dsk, 0 , 0); if (fread (image, (size_t) 1, (size_t) 819200, dsk) == 819200) { validdsk = 1; printf (".DSK loaded\n"); changes = 0; } else { validdsk = 0; printf ("Sorry, there has been a disk read error\n"); }; } else { printf ("Sorry this is not a valid .DSK file\n"); validdsk = 0; }; fclose (dsk); } } void DirectoryDsk(void) { if (validdsk != 0) { int maxdtrack,nfiles,nfsect,flen,i,stat,track,sect,half; char filename[11]; if ( *(image+255) == 255) { printf ("*** SAMDOS directory:\n"); maxdtrack = 4; } else { maxdtrack = 4 + *(image+255); for (i=0; i<10; i++) { filename[i] = *(image+210+i); }; filename[10]=0; printf ("*** MasterDos directory: %s\n",filename); } nfiles = 0; nfsect = 10 * (160 - maxdtrack) + (maxdtrack > 4); for (track = 0; track < maxdtrack; track++) { for (sect = 1; sect <= 10; sect ++) { for (half = 0; half < 2; half ++) { if ((track != 4) || (sect != 1)) { if ((stat = *Addr(track,sect,256*half)) != 0) { for (i=0; i<10; i++) { filename[i] = *Addr(track,sect,256*half+1+i); if ((filename[i]<32) || (filename[i]>126)) filename[i]='?'; }; filename[10]=0; printf("%s ",filename); if (stat & 128) printf ("H"); else printf("."); if (stat & 64) printf ("P"); else printf("."); flen = *Addr(track,sect,256*half +240); flen += 256* *Addr(track, sect, 256*half +241); flen += 16384* *Addr(track,sect,256*half +239); printf("%6.0f ",(float)flen); nfsect -= *Addr(track,sect,256*half +12); nfsect -= 256* *Addr(track,sect,256*half +11); //if ((++nfiles %4) == 0) printf("\n"); } else if ((*Addr(track,sect,256*half +1)) == 0) { half = 1; sect = 10; track = maxdtrack; }; }; }; }; }; printf("\n%d files, %d K free\n",nfiles,nfsect/2); } else { printf ("No loaded .DSK file\n"); }; } void LoadFile(void) { char filename[11]; int i,t,s,h,length,maxdtrack,ss,tt; unsigned char *found; if (validdsk != 0) { printf ("Filename: "); i=0; filename[i] = no_newlines_getchar(); while ((i<10) && (filename[i] != '\n')) { filename[++i] = getchar(); } while (filename[i] != '\n') { filename[i] = getchar(); } while (i<10) { filename[i++]=' '; } filename[10]=0; found = NULL; if ( *(image+255) == 255) { maxdtrack = 4; } else { maxdtrack = 4 + *(image+255); } for (t=0; t=501) { fwrite(Addr(t,s,9),1,501,file); i -= 501; } else { fwrite(Addr(t,s,9),1,i,file); i=0; }; while (i>0) { tt = *Addr(t,s,510); ss = *Addr(t,s,511); t = tt; s = ss; // printf("t %d s %d\t",t,s); if (i>=510) { fwrite(Addr(t,s,0),1,510,file); i -= 510; } else { fwrite(Addr(t,s,0),1,i,file); i=0; }; }; fclose(file); printf("Filename %s Length %d ",filename,length); length = *(found +237); length += 256* *(found +238); length += 16384* ((*(found +236) & 31) -1); printf ("Start %d ", length); length = *(found +243); length += 256* *(found +244); length += 16384* (1 + *(found +242) & 31); if (length != 589823) printf ("Execute %d ", length); printf ("\n"); }; }; }; } void SaveFile(void) { char filename[11]; unsigned char sectmap[195],usedmap[195],*found; int filelength,maxdtrack,s,t,h,i,m,a,tt,ss; if (validdsk != 0) { doOpenCommand(&file); fseek (file, 0, 2); filelength = ftell(file); fseek (file,0,0); if ( *(image+255) == 255) { maxdtrack = 4; } else { maxdtrack = 4 + *(image+255); }; for (i=0; i<195; i++) { sectmap[i] = usedmap[i] = 0; } for (t=0; t4) { sectmap[0] &= 254; sectmap[1] &= 3; if (maxdtrack>5) { a=1; m=4; for (i=0; i<10*(maxdtrack - 4); i++) { sectmap[a] &= m; m *=2; if (m==256) { a ++; m = 1; } } } } for (t=0; t (510*i - 9)) { printf("Sorry, Not enough space on dsk\n"); } else { t=4; s=1; m=1; a=0; while ((sectmap[a] & m)) { m *= 2; if (m==256) { m =1; a ++; } s++; if (s==11) { s=1; t++; if (t==80) t=128; } } printf ("Save Filename:"); i=0; filename[i] = no_newlines_getchar(); while ((i<10) && (filename[i] != '\n')) { filename[++i] = getchar(); } while (filename[i] != '\n') { filename[i] = getchar(); } while (i<10) { filename[i++]=' '; } filename[10]=0; *(found) = 19; *Addr(t,s,0) = 19; for (i=0; i<10; i++) { *(found+1+i) = filename[i]; } i = (filelength+9)/510; *(found+11) = i/256; *(found+12) = i%256; *(found+13) = t; *(found+14) = s; *(found+220) = 0; *(found+236) = 1; *Addr(t,s,8) = 1; *(found+237) = 0; *Addr(t,s,3) = 0; *(found+238) = 128; *Addr(t,s,4) = 128; *(found+239) = filelength/16384; *Addr(t,s,7) = filelength/16384; *(found+240) = filelength%256; *Addr(t,s,1) = filelength%256; *(found+241) = (filelength%16384)/256; *Addr(t,s,2) = (filelength%16384)/256; *(found+242) = 255; *(found+243) = 255; *(found+244) = 255; if (filelength < 502) { fread(Addr(t,s,9),1,filelength,file); *Addr(t,s,510) = 0; *Addr(t,s,511) = 0; usedmap[a] |= m; sectmap[a] |= m; } else { fread(Addr(t,s,9),1,501,file); filelength -= 501; usedmap[a] |= m; sectmap[a] |= m; while (filelength > 0) { printf ("t %d s %d, ",t,s); tt = t; ss = s; while ((sectmap[a] & m)) { m *= 2; if (m==256) { m =1; a ++; } s++; if (s==11) { s=1; t++; if (t==80) t=128; } } *Addr(tt,ss,510) = t; *Addr(tt,ss,511) = s; if (filelength > 510) { fread(Addr(t,s,0),1,510,file); filelength -= 510; usedmap[a] |= m; sectmap[a] |= m; } else { fread(Addr(t,s,0),1,filelength,file); filelength = 0; usedmap[a] |= m; sectmap[a] |= m; *Addr(t,s,510) = 0; *Addr(t,s,511) = 0; } } } for (i=0;i<195;i++) { *(found+15+i) = usedmap[i]; } changes = 1; printf ("OK\n"); } } } unsigned char *Addr(int track,int sector,int offset) { unsigned char *a; if (track < 80) { a = image + 10240*track + 512*(sector-1) + offset; } else { a = image + 5120 + 10240*(track - 128) + 512*(sector-1) + offset; } return a; } z88dk-1.8.ds1/support/sam/dskmanMACOS.c0000644000175000017500000002776407301227437017231 0ustar tygrystygrys// SimCoupe .DSK Manipulator // 1.0.0 MacOS by Andrew Collier #include #include #include #include #include #include void doOpenCommand(FILE **f); void doSaveCommand(FILE **f); void Menu(void); void AskChanges(void); void SaveDsk(void); void NewDsk(void); void OpenDsk(void); void DirectoryDsk(void); void LoadFile(void); void SaveFile(void); unsigned char * Addr(int track,int sector,int offset); unsigned char *image; FILE *dsk; FILE *file; int validdsk; int changes; void doOpenCommand(FILE **f) { StandardFileReply fileReply; *f = NULL; StandardGetFile(NULL,-1,NULL,&fileReply); if(fileReply.sfGood) { *f = FSp_fopen(&fileReply.sfFile, "rb"); }; } void doSaveCommand(FILE **f) { StandardFileReply fileReply; *f = NULL; StandardPutFile("\pSave file as:","\puntitled",&fileReply); *f = FSp_fopen(&fileReply.sfFile, "wb"); } int main(void) { char command; SIOUXSettings.autocloseonquit = 1; SIOUXSettings.asktosaveonclose = 0; SIOUXSettings.standalone = 1; SIOUXSettings.initializeTB = 1; SIOUXSettings.setupmenus = 1; if ((image = malloc(819200)) == (unsigned char *) NULL) { printf("Sorry, not enough free memory to load .DSK file\n"); getchar(); } else { command = 'X'; validdsk = 0; changes = 0; Menu(); while (command != 'Q') { printf ("? "); command = toupper(getch()); printf ("%c\n",command); switch (command) { case '?': case 'H': Menu(); break; case 'N': AskChanges(); NewDsk(); break; case 'O': AskChanges(); OpenDsk(); break; case 'D': DirectoryDsk(); break; case 'L': LoadFile(); break; case 'S': SaveFile(); break; case 'W': SaveDsk(); break; case 'Q': AskChanges(); break; } }; }; return 0; } void Menu(void) { printf ("** Andrew Collier's SimCoupe .DSK manipulator **\n\n"); printf ("N: New .DSK file\n"); printf ("O: Open .DSK file\n"); printf ("W: Write changes\n"); printf ("D: Directory .DSK file\n"); printf ("S: Save file into .DSK\n"); printf ("L: Load file from .DSK\n"); printf ("Q: Quit program\n"); } void AskChanges(void) { char command; if (changes) { printf ("Unsaved changes to DSK\nSave before continuing? Y/N\n"); command = 'X'; while ((command != 'Y') && (command != 'N')) { command = toupper(getch()); } if (command == 'Y') { SaveDsk(); } } } void SaveDsk(void) { doSaveCommand(&dsk); if (dsk != NULL) { if (fwrite (image, (size_t) 1, (size_t) 819200, dsk) == 819200) { changes = 0; printf ("OK\n"); } else { printf ("Sorry, there has been a disk write error\n"); }; fclose(dsk); } } void NewDsk(void) { int i; for (i = 0; i<819200; i++) { *(image+i) = (unsigned char)0; } validdsk = 1; changes = 1; } void OpenDsk(void) { doOpenCommand(&dsk); if (dsk != NULL) { fseek (dsk, 0, 2); if (ftell (dsk) == 819200) { fseek (dsk, 0 , 0); if (fread (image, (size_t) 1, (size_t) 819200, dsk) == 819200) { validdsk = 1; printf (".DSK loaded\n"); changes = 0; } else { validdsk = 0; printf ("Sorry, there has been a disk read error\n"); }; } else { printf ("Sorry this is not a valid .DSK file\n"); validdsk = 0; }; fclose (dsk); } } void DirectoryDsk(void) { if (validdsk != 0) { int maxdtrack,nfiles,nfsect,flen,i,stat,track,sect,half; char filename[11]; if ( *(image+255) == 255) { printf ("*** SAMDOS directory:\n"); maxdtrack = 4; } else { maxdtrack = 4 + *(image+255); for (i=0; i<10; i++) { filename[i] = *(image+210+i); }; filename[10]=0; printf ("*** MasterDos directory: %s\n",filename); } nfiles = 0; nfsect = 10 * (160 - maxdtrack) + (maxdtrack > 4); for (track = 0; track < maxdtrack; track++) { for (sect = 1; sect <= 10; sect ++) { for (half = 0; half < 2; half ++) { if ((track != 4) || (sect != 1)) { if ((stat = *Addr(track,sect,256*half)) != 0) { for (i=0; i<10; i++) { filename[i] = *Addr(track,sect,256*half+1+i); if ((filename[i]<32) || (filename[i]>126)) filename[i]='?'; }; filename[10]=0; printf("%s ",filename); if (stat & 128) printf ("H"); else printf("."); if (stat & 64) printf ("P"); else printf("."); flen = *Addr(track,sect,256*half +240); flen += 256* *Addr(track, sect, 256*half +241); flen += 16384* *Addr(track,sect,256*half +239); printf("%6.0f ",(float)flen); nfsect -= *Addr(track,sect,256*half +12); nfsect -= 256* *Addr(track,sect,256*half +11); if ((++nfiles %4) == 0) printf("\n"); } else if ((*Addr(track,sect,256*half +1)) == 0) { half = 1; sect = 10; track = maxdtrack; }; }; }; }; }; printf("\n%d files, %d K free\n",nfiles,nfsect/2); } else { printf ("No loaded .DSK file\n"); }; } void LoadFile(void) { char filename[11]; int i,t,s,h,length,maxdtrack,ss,tt; unsigned char *found; if (validdsk != 0) { printf ("Filename: "); i=0; filename[i] = getchar(); while ((i<10) && (filename[i] != '\n')) { filename[++i] = getchar(); } while (filename[i] != '\n') { filename[i] = getchar(); } while (i<10) { filename[i++]=' '; } filename[10]=0; found = NULL; if ( *(image+255) == 255) { maxdtrack = 4; } else { maxdtrack = 4 + *(image+255); } for (t=0; t=501) { fwrite(Addr(t,s,9),1,501,file); i -= 501; } else { fwrite(Addr(t,s,9),1,i,file); i=0; }; while (i>0) { tt = *Addr(t,s,510); ss = *Addr(t,s,511); t = tt; s = ss; // printf("t %d s %d\t",t,s); if (i>=510) { fwrite(Addr(t,s,0),1,510,file); i -= 510; } else { fwrite(Addr(t,s,0),1,i,file); i=0; }; }; fclose(file); printf("Filename %s Length %d ",filename,length); length = *(found +237); length += 256* *(found +238); length += 16384* ((*(found +236) & 31) -1); printf ("Start %d ", length); length = *(found +243); length += 256* *(found +244); length += 16384* (1 + *(found +242) & 31); if (length != 589823) printf ("Execute %d ", length); printf ("\n"); }; }; }; } void SaveFile(void) { char filename[11]; unsigned char sectmap[195],usedmap[195],*found; int filelength,maxdtrack,s,t,h,i,m,a,tt,ss; if (validdsk != 0) { doOpenCommand(&file); fseek (file, 0, 2); filelength = ftell(file); fseek (file,0,0); if ( *(image+255) == 255) { maxdtrack = 4; } else { maxdtrack = 4 + *(image+255); }; for (i=0; i<195; i++) { sectmap[i] = usedmap[i] = 0; } for (t=0; t4) { sectmap[0] &= 254; sectmap[1] &= 3; if (maxdtrack>5) { a=1; m=4; for (i=0; i<10*(maxdtrack - 4); i++) { sectmap[a] &= m; m *=2; if (m==256) { a ++; m = 1; } } } } for (t=0; t (510*i - 9)) { printf("Sorry, Not enough space on dsk\n"); } else { t=4; s=1; m=1; a=0; while ((sectmap[a] & m)) { m *= 2; if (m==256) { m =1; a ++; } s++; if (s==11) { s=1; t++; if (t==80) t=128; } } printf ("Save Filename: "); i=0; filename[i] = getchar(); while ((i<10) && (filename[i] != '\n')) { filename[++i] = getchar(); } while (filename[i] != '\n') { filename[i] = getchar(); } while (i<10) { filename[i++]=' '; } filename[10]=0; *(found) = 19; *Addr(t,s,0) = 19; for (i=0; i<10; i++) { *(found+1+i) = filename[i]; } i = (filelength+9)/510; *(found+11) = i/256; *(found+12) = i%256; *(found+13) = t; *(found+14) = s; *(found+220) = 0; *(found+236) = 1; *Addr(t,s,8) = 1; *(found+237) = 0; *Addr(t,s,3) = 0; *(found+238) = 128; *Addr(t,s,4) = 128; *(found+239) = filelength/16384; *Addr(t,s,7) = filelength/16384; *(found+240) = filelength%256; *Addr(t,s,1) = filelength%256; *(found+241) = (filelength%16384)/256; *Addr(t,s,2) = (filelength%16384)/256; *(found+242) = 255; *(found+243) = 255; *(found+244) = 255; if (filelength < 502) { fread(Addr(t,s,9),1,filelength,file); *Addr(t,s,510) = 0; *Addr(t,s,511) = 0; usedmap[a] |= m; sectmap[a] |= m; } else { fread(Addr(t,s,9),1,501,file); filelength -= 501; usedmap[a] |= m; sectmap[a] |= m; while (filelength > 0) { printf ("t %d s %d, ",t,s); tt = t; ss = s; while ((sectmap[a] & m)) { m *= 2; if (m==256) { m =1; a ++; } s++; if (s==11) { s=1; t++; if (t==80) t=128; } } *Addr(tt,ss,510) = t; *Addr(tt,ss,511) = s; if (filelength > 510) { fread(Addr(t,s,0),1,510,file); filelength -= 510; usedmap[a] |= m; sectmap[a] |= m; } else { fread(Addr(t,s,0),1,filelength,file); filelength = 0; usedmap[a] |= m; sectmap[a] |= m; *Addr(t,s,510) = 0; *Addr(t,s,511) = 0; } } } for (i=0;i<195;i++) { *(found+15+i) = usedmap[i]; } changes = 1; printf ("OK\n"); } } } unsigned char *Addr(int track,int sector,int offset) { unsigned char *a; if (track < 80) { a = image + 10240*track + 512*(sector-1) + offset; } else { a = image + 5120 + 10240*(track - 128) + 512*(sector-1) + offset; } return a; } z88dk-1.8.ds1/support/sam/README0000644000175000017500000000124007443162506015664 0ustar tygrystygrys$Id: README,v 1.3 2002/03/11 17:11:34 stefano Exp $ The SAM Coupe port is been tested on the SAMEMU emulator (http://www.inf.upol.cz/~keprta/sam/samemu/welcome.html). Such emulator can load a file in ram (at address 32768) by simply pressing F1, so: - compile the program (zcc +sam hello.c) - copy the compiled output to a file called "SAMFILE" (copy a.bin samfile -or- copy a.bin samfile ) - run the emulator, press F1 (apparently nothing happens) and type "call 32768". Alternatively you can use the SimCoup emulator (http://sourceforge.net/projects/simcoupe/) and use the dskman utility to save your files to a dsk-image which can be read into SimCoup. z88dk-1.8.ds1/support/sprites/0000755000175000017500000000000010765202715015716 5ustar tygrystygrysz88dk-1.8.ds1/support/sprites/readme.txt0000755000175000017500000000364410565630111017717 0ustar tygrystygrys$Id: readme.txt,v 1.2 2007/02/17 16:41:45 stefano Exp $ Z88DK Sprite Editor ------------------- By Daniel McKinnon - slightly upgraded by Stefano Bodrato - This is a simple sprite editor for z88dk with it's main feature being that it automatically will generate code for you. This program is a little dodgy, and could use some work. That's why you can send me YOUR OWN updates! stikmansoftware@yahoo.com Anything welcome Compiling: Make sure you have Allegro (obtainable at http://www.allegro.cc/) a C compiler, and an Operating System (which includes the Virus known as Wingblowz! :) Unix: type "gcc -o sprite sprite.c `allegro-config --libs` " Those are ticks " ' " (above the ~ key on most keyboards) not apostraphies " ' " DJGPP: type "gcc -o sprite.exe sprite.c -lalleg " Visual C: from the Visual Studio command prompt type "cl sprite.c alleg.lib" How to use: Image Editing Up / Down......................Zoom In / Out SHIFT + arrow keys.............Scroll Sprite H..............................Flip sprite horizontally V..............................Flip sprite vertically D..............................Flip sprite diagonally I..............................Invert Sprite L..............................Import From BMP or PCX C..............................Choose Source Sprite for Copying (copy) P..............................Copy Source sprite to current sprite (paste) SHIFP + P......................Divide the source sprite into pieces and paste them to the destination and its following ones. M..............................Compute mask for copied sprite and paste to current sprite Saving / Loading F2.............................Saves all sprites into a sprite file (not code) F3.............................Load sprites from sprite file (not code) F5.............................Save code file generating code from sprite 0 - selected z88dk-1.8.ds1/support/sprites/sprite.c0000755000175000017500000004474510565630111017402 0ustar tygrystygrys/* $Id: sprite.c,v 1.2 2007/02/17 16:41:45 stefano Exp $ A program to import / make sprites for use with z88dk by Daniel McKinnon slightly improved by Stefano Bodrato Please send Daniel McKinnon your own updates to the code, it can be anything! Comments, GUI elements, Bug-Fixes, Features, ports, etc. Send any updates, fixes, or support requests to: stikmansoftware@yahoo.com ...and signal changes to the z88dk_devel list, too. P.S. Some of the comments are a little dodgy and could use some fixing up */ //#include //#include #include "allegro.h" #include #define MAX_SIZE_X 255 #define MAX_SIZE_Y 255 #define MAX_SPRITE 150 #define DEFAULT_BLOCK_SIZE 32 #define DEFAULT_SIZE_X 8 #define DEFAULT_SIZE_Y 8 BITMAP *buffer; int bls; typedef struct spritetype { int size_x, size_y; int p[ MAX_SIZE_X ][ MAX_SIZE_Y ]; } spritetype; int on_sprite; int copied; //Sprite selected as source for copying int num_sprites; spritetype sprite[ MAX_SPRITE + 1 ]; char hexcode[ MAX_SIZE_X * MAX_SIZE_Y ]; //Generated C Code (called hexcode out of laziness) char *hexc = "0123456789ABCDEF"; //For converting integers (0-15) to Hex //Draws a button at (x, y) with width/height (w, h), displaying text *text, with colour void draw_button( int x, int y, int w, int h, char *text, int border_c, int fill_c, int text_c ) { rect( buffer, x, y, x+w, y+h, border_c ); //Boder rectfill( buffer, x+1, y+1, x+w-1, y+h-1, fill_c ); //Fill textout_centre( buffer, font, text, x+(w/2), y+(h/2) - 4, text_c ); //Text } //Checks wheather mouse has been clicked within certain "button" boundries int button_pressed( int x, int y, int w, int h ) { if ( (mouse_x > x) && (mouse_x < (x+w) ) && (mouse_y > y) && (mouse_y < (y+w) ) && (mouse_b & 1) ) return 1; else return 0; } //Updates all graphics on screen void update_screen() { int x, y; int c1, c2, c3; char text[ 100 ]; show_mouse( buffer ); clear_to_color( buffer, makecol(210,240,210) ); //Draw Big Sprite Block for ( x = 1; x <= sprite[ on_sprite ].size_x; x++ ) for ( y = 1; y <= sprite[ on_sprite ].size_y; y++ ) if ( sprite[ on_sprite ].p[ x ][ y ] ) rectfill( buffer, x * bls, y * bls, (x * bls) + bls, (y * bls) + bls, 0 ); //Draw Border Around Sprite Block rect( buffer, bls - 1, bls - 1, (sprite[ on_sprite ].size_x * bls) + bls + 1, (sprite[ on_sprite ].size_y * bls) + bls + 1, makecol(255,0,0) ); c1 = 0; c2 = makecol( 200, 255, 200 ); c3 = 0; sprintf( text, "Sprite %i", on_sprite ); draw_button( 20, 435, 80, 23, text, c1, c2, c3 ); sprintf( text, "Width :%i", sprite[ on_sprite ].size_x ); draw_button( 220, 435, 80, 23, text, c1, c2, c3 ); sprintf( text, "Height: %i", sprite[ on_sprite ].size_y ); draw_button( 420, 435, 80, 23, text, c1, c2, c3 ); c1 = makecol( 255,255,0 ); c2 = makecol( 200, 100, 75 ); c3 = makecol( 255,255,255 ); draw_button( 101, 435, 50, 23, "Last", c1, c2, c3 ); draw_button( 151, 435, 50, 23, "Next", c1, c2, c3 ); draw_button( 301, 435, 50, 23, "-1", c1, c2, c3 ); draw_button( 351, 435, 50, 23, "+1", c1, c2, c3 ); draw_button( 501, 435, 50, 23, "-1", c1, c2, c3 ); draw_button( 551, 435, 50, 23, "+1", c1, c2, c3 ); blit( buffer, screen, 0, 0, 0, 0, 640, 480 ); show_mouse( screen ); } //The block that the mouse is over top of int mx, my; //Calculate which block the mouse is over top of void do_mouse_stuff() { mx = ( mouse_x / bls ); my = ( mouse_y / bls ); if ( mx > sprite[ on_sprite ].size_x ) mx = sprite[ on_sprite ].size_x; if ( my > sprite[ on_sprite ].size_y ) my = sprite[ on_sprite ].size_y; if ( mx < 1 ) mx = 1; if ( my < 1 ) my = 1; } void generate_codes( int i ) { int bstring[ MAX_SIZE_X * MAX_SIZE_Y ]; //Binary String int hstring[ MAX_SIZE_X * MAX_SIZE_Y ]; //Hex String int p, n, t, r; //Some working variables int bin_size; int hex_size; int x, y; sprintf( hexcode, "" ); //Make the Binary String p = 0; for ( y = 1; y <= sprite[ i ].size_y; y++ ) for ( x = 1; x <= (int)( ( (sprite[ i ].size_x - 1) / 8) + 1) * 8; x++ ) { bstring[ p ] = sprite[ i ].p[ x ][ y ]; p++; } bin_size = p; //Convert binary string to Hex String r = 0; for ( p = 0; p < bin_size; p += 4 ) { //Turn every 4 into a binary number, Dan Style: //Take the first number, if the next number is 0 then multiply it by 2, //If it is 1 multiply it by two and then add one! //It's a clever way of converting binary numbers (the way I figured it out //when I was 10) n = bstring[ p ]; for ( t = p + 1; t < p + 4; t++ ) { if ( bstring[ t ] ) n = (n * 2) + 1; else n = (n * 2); } hstring[ r ] = n; r++; } hex_size = r; //Make C Code n = 0; sprintf( hexcode, "char sprite%i[] = { %i, %i", i, sprite[ i ].size_x, sprite[ i ].size_y ); for ( p = 0; p < hex_size; p += 2 ) { sprintf( hexcode, "%s, 0x%c%c ", hexcode, hexc[ hstring[ p ] ], hexc[ hstring[ p + 1] ] ); n++; if ( n > 10 ) { sprintf( hexcode, "%s\n", hexcode ); n = 0; } } sprintf( hexcode, "%s };\n", hexcode ); } //Fits a sprite to best fit on the screen void fit_sprite_on_screen() { //Calculate size of best fit if ( sprite[ on_sprite ].size_x > sprite[ on_sprite ].size_y ) bls = (int)(600 / (sprite[ on_sprite ].size_x + 10)); else bls = (int)(440 / (sprite[ on_sprite ].size_y + 10)); } void invert_sprite() { int x, y; for ( x = 1; x <= sprite[ on_sprite ].size_x; x++ ) for ( y = 1; y <= sprite[ on_sprite ].size_y; y++ ) sprite[ on_sprite ].p[ x ][ y ] = !sprite[ on_sprite ].p[ x ][ y ]; update_screen(); } //flip sprite horizontally void flip_sprite_h() { int x, y, p; for ( y = 1; y <= sprite[ on_sprite ].size_y; y++ ) for ( x = 1; x <= sprite[ on_sprite ].size_x /2; x++ ) { p = sprite[ on_sprite ].p[ x ][ y ]; sprite[ on_sprite ].p[ x ][ y ] = sprite[ on_sprite ].p[ sprite[ on_sprite ].size_x - x + 1 ][ y ]; sprite[ on_sprite ].p[ sprite[ on_sprite ].size_x - x +1 ][ y ] = p; } update_screen(); } //flip sprite vertically void flip_sprite_v() { int x, y, p; for ( x = 1; x <= sprite[ on_sprite ].size_x; x++ ) for ( y = 1; y <= sprite[ on_sprite ].size_y /2; y++ ) { p = sprite[ on_sprite ].p[ x ][ y ]; sprite[ on_sprite ].p[ x ][ y ] = sprite[ on_sprite ].p[ x ][ sprite[ on_sprite ].size_y - y + 1 ]; sprite[ on_sprite ].p[ x ][ sprite[ on_sprite ].size_y - y + 1 ] = p; } update_screen(); } //flip sprite diagonally void flip_sprite_d() { int x, y, p; int save_x, save_y; //save sprite dims save_x = sprite[ on_sprite ].size_x; save_y = sprite[ on_sprite ].size_y; if (save_x > save_y) sprite[ on_sprite ].size_y = save_x; else sprite[ on_sprite ].size_x = save_y; for ( y = 1; y <= sprite[ on_sprite ].size_y; y++ ) for ( x = y; x <= sprite[ on_sprite ].size_x; x++ ) { p = sprite[ on_sprite ].p[ x ][ y ]; sprite[ on_sprite ].p[ x ][ y ] = sprite[ on_sprite ].p[ y ][ x ]; sprite[ on_sprite ].p[ y ][ x ] = p; } sprite[ on_sprite ].size_x = save_y; sprite[ on_sprite ].size_y = save_x; update_screen(); } void scroll_sprite_left() { int x, y; for ( x = 1; x < sprite[ on_sprite ].size_x; x++ ) for ( y = 1; y <= sprite[ on_sprite ].size_y; y++ ) sprite[ on_sprite ].p[ x ][ y ] = sprite[ on_sprite ].p[ x + 1 ][ y ]; update_screen(); } void scroll_sprite_right() { int x, y; for ( x = sprite[ on_sprite ].size_x; x > 0 ; x-- ) for ( y = 1; y <= sprite[ on_sprite ].size_y; y++ ) sprite[ on_sprite ].p[ x ][ y ] = sprite[ on_sprite ].p[ x - 1 ][ y ]; update_screen(); } void scroll_sprite_up() { int x, y; for ( y = 1; y < sprite[ on_sprite ].size_y; y++ ) for ( x = 1; x <= sprite[ on_sprite ].size_x; x++ ) sprite[ on_sprite ].p[ x ][ y ] = sprite[ on_sprite ].p[ x ][ y + 1 ]; update_screen(); } void scroll_sprite_down() { int x, y; for ( y = sprite[ on_sprite ].size_y; y > 0 ; y-- ) for ( x = 1; x <= sprite[ on_sprite ].size_x; x++ ) sprite[ on_sprite ].p[ x ][ y ] = sprite[ on_sprite ].p[ x ][ y - 1 ]; update_screen(); } //chop sprite in smaller items void chop_sprite( int src ) { int x, y, x_offset, y_offset; int save_x, save_y; //save destination sprites' dims save_x = sprite[ on_sprite ].size_x; save_y = sprite[ on_sprite ].size_y; y_offset = 0; while ( sprite[ src ].size_y > y_offset) { x_offset = 0; while ( sprite[ src ].size_x > x_offset) { sprite[ on_sprite ].size_x = save_x; sprite[ on_sprite ].size_y = save_y; for ( y = 1; y <= save_y; y++ ) for ( x = 1; x <= save_x; x++ ) sprite[ on_sprite ].p[ x ][ y ] = sprite[ src ].p[ x + x_offset ][ y + y_offset ]; on_sprite++; x_offset = x_offset + save_x; //update_screen(); } y_offset = y_offset + save_y; } update_screen(); } void import_from_bitmap( char *file ) { BITMAP *temp; int x, y; temp = load_bitmap( file, 0 ); sprite[ on_sprite ].size_x = temp->w; sprite[ on_sprite ].size_y = temp->h; if ( sprite[ on_sprite ].size_x > MAX_SIZE_X ) sprite[ on_sprite ].size_x = MAX_SIZE_X; if ( sprite[ on_sprite ].size_y > MAX_SIZE_Y ) sprite[ on_sprite ].size_y = MAX_SIZE_Y; fit_sprite_on_screen(); for ( x = 1; x <= sprite[ on_sprite ].size_x; x++ ) for ( y = 1; y <= sprite[ on_sprite ].size_y; y++ ) sprite[ on_sprite ].p[ x ][ y ] = !(getpixel( temp, x - 1, y - 1 ) >= 1 ); update_screen(); } void do_import_bitmap() { char file[ 255 ]; sprintf( file, "./" ); if ( file_select_ex( "Import From Bitmap", file, "BMP;PCX", 255, 640, 480 ) ) import_from_bitmap( file ); } //Saves a header file with sprites 0-on_sprite for use with z88dk void save_code_file( char *file ) { FILE *f; int i; f = fopen( file, "w" ); fputs( "// Generated by Daniel McKinnon's z88dk Sprite Editor\n", f ); for ( i = 0; i <= on_sprite; i++ ) { generate_codes( i ); fputs( hexcode, f ); } fclose( f ); } void save_sprite_file( char *file ) { PACKFILE *f; f = pack_fopen( file, "pw+b" ); pack_fwrite( sprite, sizeof( sprite ), f ); pack_fclose( f ); } void load_sprite_file( char *file ) { PACKFILE *f; if ( exists( file ) ) { f = pack_fopen( file, "pr+b" ); pack_fread( &sprite, sizeof( sprite ), f ); pack_fclose( f ); } update_screen(); } //The file selector for saving code files void do_save_code() { char file[ 255 ]; if ( file_select_ex( "Save To...", file, "h", 255, 640, 480 ) ) save_code_file( file ); } //The file selector for saving sprite files void do_save_sprites() { char file[ 255 ]; if ( file_select_ex( "Save To...", file, "csp", 255, 640, 480 ) ) save_sprite_file( file ); } //The file selector for loading sprite files void do_load_sprites() { char file[ 255 ]; if ( file_select_ex( "Load File", file, "csp", 255, 640, 480 ) ) load_sprite_file( file ); } //Resets all sprites to default size void reset_sprites() { int i; for ( i = 0; i <= MAX_SPRITE; i++ ) { sprite[ i ].size_x = DEFAULT_SIZE_X; sprite[ i ].size_y = DEFAULT_SIZE_Y; } } //Copies sprite[ src ].p[][] to sprite[ dest ].p[][] void copy_sprite( int src, int dest ) { int x, y; //Copy sizes sprite[ dest ].size_x = sprite[ src ].size_x; sprite[ dest ].size_y = sprite[ src ].size_y; //Copy Sprite data for ( x = 1; x <= sprite[ src ].size_x; x++ ) for ( y = 1; y <= sprite[ src ].size_y; y++ ) sprite[ dest ].p[ x ][ y ] = sprite[ src ].p[ x ][ y ]; update_screen(); } //Compute the copied sprite's mask and paste it in a new one void copy_sprite_mask( int src, int dest ) { int x1, x2, y; int fx1, fx2; int y1, y2, x; int fy1, fy2; //Copy sizes sprite[ dest ].size_x = sprite[ src ].size_x; sprite[ dest ].size_y = sprite[ src ].size_y; /* //dst initialization shouldn't be necessary for ( x = 1; x <= sprite[ dest ].size_x; x++ ) for ( y = 1; y <= sprite[ dest ].size_y; y++ ) sprite[ dest ].p[ x ][ y ] = FALSE; */ //look for bytes to mask horizontally for ( y = 1; y <= sprite[ src ].size_y; y++ ) { x1 = 1; x2 = sprite[ src ].size_x; fx1 = fx2 = FALSE; while ( (( fx1 == FALSE ) || ( fx2 == FALSE )) && (x2 >= x1) ) { if ( sprite[ src ].p[ x1 ][ y ] || sprite[ src ].p[ x1 + 1 ][ y ] ) { fx1 = TRUE; sprite[ dest ].p[ x1 ][ y ] = 2; } if ( sprite[ src ].p[ x2 ][ y ] || sprite[ src ].p[ x2 - 1 ][ y ] ) { fx2 = TRUE; sprite[ dest ].p[ x2 ][ y ] = 2; } if ( fx1 != TRUE ) { if ( sprite[ dest ].p[ x1 ][ y ] != 2 ) sprite[ dest ].p[ x1 ][ y ] = 3; x1++; } if ( fx2 != TRUE ) { if ( sprite[ dest ].p[ x2 ][ y ] != 2 ) sprite[ dest ].p[ x2 ][ y ] = 3; x2--; } } } //look for bytes to mask vertically for ( x = 1; x <= sprite[ src ].size_x; x++ ) { y1 = 1; y2 = sprite[ src ].size_y; fy1 = fy2 = FALSE; while ( (( fy1 == FALSE ) || ( fy2 == FALSE )) && (y2 >= y1) ) { if ( sprite[ src ].p[ x ][ y1 ] || sprite[ src ].p[ x ][ y1 + 1 ] ) { fy1 = TRUE; sprite[ dest ].p[ x ][ y1 ] = 2; } if ( sprite[ src ].p[ x ][ y2 ] || sprite[ src ].p[ x ][ y2 - 1 ] ) { fy2 = TRUE; sprite[ dest ].p[ x ][ y2 ] = 2; } if ( fy1 != TRUE ) { if ( sprite[ dest ].p[ x ][ y1 ] != 2 ) sprite[ dest ].p[ x ][ y1 ] = 3; y1++; } if ( fy2 != TRUE ) { if ( sprite[ dest ].p[ x ][ y2 ] != 2 ) sprite[ dest ].p[ x ][ y2 ] = 3; y2--; } } } //now pixels marked with '3' or '2' are the mask bits, convert to white: //everything else is black for ( x = 1; x <= sprite[ src ].size_x; x++ ) for ( y = 1; y <= sprite[ src ].size_y; y++ ) sprite[ dest ].p[ x ][ y ] = ( sprite[ dest ].p[ x ][ y ] < 3 ); update_screen(); } void do_gui_buttons() { //Last Sprite if ( button_pressed( 101, 435, 50, 23 ) ) if ( on_sprite > 0 ) { on_sprite--; update_screen(); while (mouse_b & 1); } //Next Sprite if ( button_pressed( 151, 435, 50, 23 ) ) if ( on_sprite < MAX_SPRITE ) { on_sprite++; update_screen(); while (mouse_b & 1); } //Width -1 if ( button_pressed( 301, 435, 50, 23 ) ) if ( sprite[ on_sprite ].size_x > 1 ) { sprite[ on_sprite ].size_x--; update_screen(); while (mouse_b & 1); } //Width +1 if ( button_pressed( 351, 435, 50, 23 ) ) if ( sprite[ on_sprite ].size_x < MAX_SIZE_X ) { sprite[ on_sprite ].size_x++; update_screen(); while (mouse_b & 1); } //Height -1 if ( button_pressed( 501, 435, 50, 23 ) ) if ( sprite[ on_sprite ].size_y > 1 ) { sprite[ on_sprite ].size_y--; update_screen(); while (mouse_b & 1); } //Height +1 if ( button_pressed( 551, 435, 50, 23 ) ) if ( sprite[ on_sprite ].size_y < MAX_SIZE_Y ) { sprite[ on_sprite ].size_y++; update_screen(); while (mouse_b & 1); } } void do_keyboard_input() { //Keyboard Input if ( key[ KEY_L ] ) do_import_bitmap(); if ( key[ KEY_I ] ) { invert_sprite(); while ( key[ KEY_I ] ); } if ( key[ KEY_H ] ) { flip_sprite_h(); while ( key[ KEY_H ] ); } if ( key[ KEY_V ] ) { flip_sprite_v(); while ( key[ KEY_V ] ); } if ( key[ KEY_D ] ) { flip_sprite_d(); while ( key[ KEY_D ] ); } if ( key[ KEY_LSHIFT ] && key[ KEY_LEFT ] ) { scroll_sprite_left(); while ( key[ KEY_LEFT ] ); } if ( key[ KEY_LSHIFT ] && key[ KEY_RIGHT ] ) { scroll_sprite_right(); while ( key[ KEY_RIGHT ] ); } if ( key[ KEY_LSHIFT ] && key[ KEY_UP ] ) { scroll_sprite_up(); while ( key[ KEY_UP ] ); } if ( key[ KEY_LSHIFT ] && key[ KEY_DOWN ] ) { scroll_sprite_down(); while ( key[ KEY_DOWN ] ); } if ( key[ KEY_UP ] && (bls < 64 ) ) { bls++; update_screen(); while ( key[ KEY_UP ] ); } if ( key[ KEY_DOWN ] && (bls > 1) ) { bls--; update_screen(); while ( key[ KEY_DOWN ] ); } //Copy/Paste if ( key[ KEY_C ] ) copied = on_sprite; if ( key[ KEY_LSHIFT ] ) { if ( key[ KEY_P ] ) if (copied < on_sprite) { chop_sprite( copied ); while ( key[ KEY_P ] ); } } else { if ( key[ KEY_P ] ) if (copied != on_sprite) copy_sprite( copied, on_sprite ); } //Paste copied sprite's mask if ( key[ KEY_M ] ) if (copied != on_sprite) copy_sprite_mask( copied, on_sprite ); while ( key[ KEY_M ] ); // Save / Load / Generate Code if ( key[ KEY_F2 ] ) do_save_sprites(); if ( key[ KEY_F3 ] ) do_load_sprites(); if ( key[ KEY_F5 ] ) do_save_code(); if ( key[ KEY_F ] ) { fit_sprite_on_screen(); update_screen(); } } void do_sprite_drawing() { int d; //Get the mouse's position over top of sprite do_mouse_stuff(); //Draw on sprite if mouse is over the sprite feild if ( ( mouse_b & 1 ) && (mouse_x > bls ) && (mouse_y > bls ) && (mouse_x < (sprite[ on_sprite ].size_x * bls) + bls) && (mouse_y < (sprite[ on_sprite ].size_y * bls) + bls) ) { //If the player has clicked then select oposing colour of pixel that mouse is over d = !sprite[ on_sprite ].p[ mx ][ my ]; //Continuousely draw pixel of previousely determined colour under mouse until mouse is unlclicked while ( mouse_b & 1 ) { do_mouse_stuff(); sprite[ on_sprite ].p[ mx ][ my ] = d; update_screen(); } } } //************************************************************************** // MAIN * //************************************************************************** int main( int argc, char *argv[] ) { //Init system allegro_init(); install_keyboard(); install_timer(); install_mouse(); //Setup graphics set_color_depth( 16 ); //if ( set_gfx_mode(GFX_XWINDOWS, 640, 480, 0, 0 ) < 0 ) if ( set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0 ) < 0 ) exit( -1 ); //Setup double buffer buffer = create_bitmap( 640, 480 ); if ( buffer == NULL ) exit( -1 ); //Transparent background for text text_mode( -1 ); //Reset all sprite sizes reset_sprites(); on_sprite = 0; //Choose Sprite 0 copied = 0; fit_sprite_on_screen(); //------Main Program Loop---------- update_screen(); while ( !key[ KEY_ESC ] ) { do_gui_buttons(); do_sprite_drawing(); do_keyboard_input(); } return 0; } END_OF_MAIN(); z88dk-1.8.ds1/support/svi/0000755000175000017500000000000010765202715015026 5ustar tygrystygrysz88dk-1.8.ds1/support/svi/README0000644000175000017500000000057607366020673015722 0ustar tygrystygrys$Id: README,v 1.3 2001/10/25 14:29:15 stefano Exp $ Quick note for the Spectravideo SVI port: - Compile the program (zcc +svi adv_a.c) - Convert the binary to CAS image file (bin2svi a.bin adv.cas) - Run the SVI emulator and load the "tape" with the /r option. If you are using the Jimmy Mrdell's "SVI" emulator, you can specify the autoload option: svi -tapa adv.cas z88dk-1.8.ds1/support/ti86/0000755000175000017500000000000010765202715015017 5ustar tygrystygrysz88dk-1.8.ds1/support/ticalc/0000755000175000017500000000000010765202715015464 5ustar tygrystygrysz88dk-1.8.ds1/support/ticalc/bin2var/0000755000175000017500000000000010765202715017027 5ustar tygrystygrysz88dk-1.8.ds1/support/ticalc/bin2var/83asm.bat0000644000175000017500000000011607240302053020436 0ustar tygrystygrys@echo off tasm -80 -i -b %1.z80 %1.bin bin2var2 %1.bin %1.83p del %1.bin >nul z88dk-1.8.ds1/support/ticalc/bin2var/83pasm.bat0000644000175000017500000000011607240302053020616 0ustar tygrystygrys@echo off tasm -80 -i -b %1.z80 %1.bin bin2var2 %1.bin %1.8xp del %1.bin >nul z88dk-1.8.ds1/support/ticalc/bin2var/83psqasm.bat0000644000175000017500000000011507240302053021161 0ustar tygrystygrys@echo off tasm -80 -i -b %1.z80 %1.bin bin2var %1.bin %1.8xp del %1.bin >nul z88dk-1.8.ds1/support/ticalc/bin2var/83squasm.bat0000644000175000017500000000011507240302053021166 0ustar tygrystygrys@echo off tasm -80 -i -b %1.z80 %1.bin bin2var %1.bin %1.83p del %1.bin >nul z88dk-1.8.ds1/support/ticalc/bin2var/bin2var.c0000644000175000017500000001164607267010556020551 0ustar tygrystygrys/* Bin2Var by David Phillips Converts binary images to TI Graph Link format files 1.00 -- 08/22/00 * first release * support for 83P, 8XP 1.10 -- 08/23/00 * made code more modular * added support for 82P, 86P, 86S * fixed __MSDOS__ macro spelling to be correct 1.20 -- 08/24/00 * added suport for 85S * corrected header for 8XP * changed error message printing to use stderr Edited by Jeremy Drake to add the tasmCmp symbol to 8XP files ------- $Id: bin2var.c,v 1.2 2001/04/17 09:48:30 stefano Exp $ */ #include #include #include #include #include #if (!defined(__MSDOS__)) && (!defined(__WIN32__)) #define stricmp strcasecmp #endif enum EXT { E_82P, E_83P, E_8XP, E_85S, E_86P, E_86S }; void die(const char *fmt, ...) { va_list argptr; if (fmt) { va_start(argptr, fmt); vfprintf(stderr, fmt, argptr); va_end(argptr); } else fprintf(stderr, "Usage: bin2var input.bin output.ext\n\n" "Valid extensions for the output file: " "82p, 83p, 8xp, 85s, 86p, 86s\n"); exit(1); } int fsize(FILE *fp) { int p, size; p = ftell(fp); fseek(fp, 0L, SEEK_END); size = ftell(fp); fseek(fp, p, SEEK_SET); return size; } void cfwrite(const void *buf, int len, FILE *fp, unsigned short *chk) { int i; fwrite(buf, len, 1, fp); for(i = 0; i < len; i++) *chk += ((unsigned char *)buf)[i]; } void writecomment(FILE *fp, const char *comment) { char str[50]; fwrite(comment, strlen(comment), 1, fp); memset(str, 0, 42); fwrite(str, 42 - strlen(comment), 1, fp); } void genname(const char *fname, char *name) { char str[256], *c; strcpy(str, fname); c = strchr(str, '.'); if ((c - str) > 8) c[8] = 0; else *c = 0; c = str - 1; do { c++; *c = toupper(*c); if (!isalnum(*c)) *c = 0; } while (*c != 0); if (!strlen(str)) die("A valid variable name could not be generated!\n"); strcpy(name, str); } int main(int argc, char* argv[]) { const char *comment = "Created with Bin2Var v1.10"; FILE *fp; char *buf, str[256], *c; int i, n, ext, n2; unsigned short chk; printf("Bin2Var v1.20 by David Phillips \n\n"); if (argc != 3) die(0); buf = strrchr(argv[2], '.'); if (!buf) die("Output file must have an extension!\n"); if (!stricmp(buf, ".82p")) ext = E_82P; else if (!stricmp(buf, ".83p")) ext = E_83P; else if (!stricmp(buf, ".8xp")) ext = E_8XP; else if (!stricmp(buf, ".85s")) ext = E_85S; else if (!stricmp(buf, ".86p")) ext = E_86P; else if (!stricmp(buf, ".86s")) ext = E_86S; else die("Extension \'%s\' is not supported!\n", buf); genname(argv[2], str); fp = fopen(argv[1], "rb"); if (!fp) die("Failed to open input file: %s\n", argv[1]); n = fsize(fp); buf = (char *)malloc(n); fread(buf, n, 1, fp); if (ferror(fp)) die("Error reading input file: %s\n", argv[1]); fclose(fp); fp = fopen(argv[2], "wb"); if (!fp) die("Failed to open output file: %s\n", argv[2]); chk = 0; if (ext == E_82P) fwrite("**TI82**\x1a\x0a\x00", 11, 1, fp); else if (ext == E_83P) fwrite("**TI83**\x1a\x0a\x00", 11, 1, fp); else if (ext == E_8XP) fwrite("**TI83F*\x1a\x0a\x00", 11, 1, fp); else if (ext == E_85S) fwrite("**TI85**\x1a\x0c\x00", 11, 1, fp); else if ((ext == E_86P) || (ext == E_86S)) fwrite("**TI86**\x1a\x0a\x00", 11, 1, fp); writecomment(fp, comment); if ((ext == E_82P) || (ext == E_83P)) i = n + 17; else if (ext == E_8XP) i = n + 19; else if (ext == E_85S) i = n + 10 + strlen(str); else i = n + 18; fwrite(&i, 2, 1, fp); if ((ext == E_82P) || (ext == E_83P) || (ext == E_8XP)) cfwrite("\x0b\0x00", 2, fp, &chk); else if (ext == E_85S) { i = 4 + strlen(str); cfwrite(&i, 1, fp, &chk); cfwrite("\0x00", 1, fp, &chk); } else cfwrite("\x0c\0x00", 2, fp, &chk); if(ext == E_8XP) i = n + 4; else i = n + 2; cfwrite(&i, 2, fp, &chk); if ((ext == E_82P) || (ext == E_83P) || (ext == E_8XP)) cfwrite("\x06", 1, fp, &chk); else if (ext == E_86P) cfwrite("\x12", 1, fp, &chk); else if ((ext == E_85S) || (ext == E_86S)) cfwrite("\x0c", 1, fp, &chk); i = strlen(str); if ((ext == E_85S) || (ext == E_86P) || (ext == E_86S)) cfwrite(&i, 1, fp, &chk); cfwrite(str, i, fp, &chk); memset(str, 0, 8); if (ext != E_85S) cfwrite(str, 8 - i, fp, &chk); if (ext == E_8XP) { i = n + 4; n2 = n + 2; } else { i = n + 2; n2 = n; } cfwrite(&i, 2, fp, &chk); cfwrite(&n2, 2, fp, &chk); if(ext == E_8XP) { cfwrite("\xBB", 1, fp, &chk); cfwrite("\x6D", 1, fp, &chk); } cfwrite(buf, n, fp, &chk); fwrite(&chk, 2, 1, fp); if (ferror(fp)) die("Failed writing output file: %s\n", argv[2]); fclose(fp); free(buf); printf("'%s' successfully converted to '%s'\n", argv[1], argv[2]); return 0; } z88dk-1.8.ds1/support/ticalc/bin2var/bin2var2.c0000644000175000017500000001364507267010556020634 0ustar tygrystygrys/* Bin2Var by David Phillips Converts binary images to TI Graph Link format files 1.00 -- 08/22/00 * first release * support for 83P, 8XP 1.10 -- 08/23/00 * made code more modular * added support for 82P, 86P, 86S * fixed __MSDOS__ macro spelling to be correct 1.20 -- 08/24/00 * added suport for 85S * corrected header for 8XP * changed error message printing to use stderr Edited by Jeremy Drake to create unsquished 83P and 8XP files with correct "End" and "AsmPrgm" symbols ------- $Id: bin2var2.c,v 1.2 2001/04/17 09:48:30 stefano Exp $ */ #include #include #include #include #include // #if (!defined(__MSDOS__)) && (!defined(__WIN32__)) // #define stricmp strcasecmp // #endif enum EXT { E_82P, E_83P, E_8XP, E_85S, E_86P, E_86S }; void die(const char *fmt, ...) { va_list argptr; if (fmt) { va_start(argptr, fmt); vfprintf(stderr, fmt, argptr); va_end(argptr); } else fprintf(stderr, "Usage: bin2var input.bin output.ext\n\n" "Valid extensions for the output file: " "82p, 83p, 8xp, 85s, 86p, 86s\n"); exit(1); } int fsize(FILE *fp) { int p, size; p = ftell(fp); fseek(fp, 0L, SEEK_END); size = ftell(fp); fseek(fp, p, SEEK_SET); return size; } void cfwrite(const void *buf, int len, FILE *fp, unsigned short *chk) { int i; fwrite(buf, len, 1, fp); for(i = 0; i < len; i++) *chk += ((unsigned char *)buf)[i]; } void datawrite(unsigned char *buf, int len, FILE *fp, unsigned short *chk) { int i, n; char charbuffer[1]; char *charbufferp; for(i = 0; i < len; i++) { n = (unsigned char)buf[i]; _itoa( n, charbuffer, 16 ); if( charbuffer[1] == 0 ) { charbuffer[1] = charbuffer[0]; charbuffer[0] = '0'; } charbufferp = _strupr(charbuffer); fwrite(charbufferp, 2, 1, fp); *chk += charbuffer[0]; *chk += charbuffer[1]; } } void writecomment(FILE *fp, const char *comment) { char str[50]; fwrite(comment, strlen(comment), 1, fp); memset(str, 0, 42); fwrite(str, 42 - strlen(comment), 1, fp); } void genname(const char *fname, char *name) { char str[256], *c; strcpy(str, fname); c = strchr(str, '.'); if ((c - str) > 8) c[8] = 0; else *c = 0; c = str - 1; do { c++; *c = toupper(*c); if (!isalnum(*c)) *c = 0; } while (*c != 0); if (!strlen(str)) die("A valid variable name could not be generated!\n"); strcpy(name, str); } int main(int argc, char* argv[]) { const char *comment = "Created with Bin2Var v1.10"; FILE *fp; char *buf, str[256], *c; int i, n, ext, n2; unsigned short chk; printf("Bin2Var v1.20 by David Phillips \n\n"); if (argc != 3) die(0); buf = strrchr(argv[2], '.'); if (!buf) die("Output file must have an extension!\n"); if (!stricmp(buf, ".82p")) ext = E_82P; else if (!stricmp(buf, ".83p")) ext = E_83P; else if (!stricmp(buf, ".8xp")) ext = E_8XP; else if (!stricmp(buf, ".85s")) ext = E_85S; else if (!stricmp(buf, ".86p")) ext = E_86P; else if (!stricmp(buf, ".86s")) ext = E_86S; else die("Extension \'%s\' is not supported!\n", buf); genname(argv[2], str); fp = fopen(argv[1], "rb"); if (!fp) die("Failed to open input file: %s\n", argv[1]); n = fsize(fp); buf = (char *)malloc(n); fread(buf, n, 1, fp); if (ferror(fp)) die("Error reading input file: %s\n", argv[1]); fclose(fp); fp = fopen(argv[2], "wb"); if (!fp) die("Failed to open output file: %s\n", argv[2]); chk = 0; if (ext == E_82P) fwrite("**TI82**\x1a\x0a\x00", 11, 1, fp); else if (ext == E_83P) fwrite("**TI83**\x1a\x0a\x00", 11, 1, fp); else if (ext == E_8XP) fwrite("**TI83F*\x1a\x0a\x00", 11, 1, fp); else if (ext == E_85S) fwrite("**TI85**\x1a\x0c\x00", 11, 1, fp); else if ((ext == E_86P) || (ext == E_86S)) fwrite("**TI86**\x1a\x0a\x00", 11, 1, fp); writecomment(fp, comment); if ((ext == E_82P) ) i = n + 17; else if (ext == E_83P) i = (n * 2) + 26; else if (ext == E_8XP) i = (n * 2) + 20; else if (ext == E_85S) i = n + 10 + strlen(str); else i = n + 18; fwrite(&i, 2, 1, fp); if ((ext == E_82P) || (ext == E_83P) || (ext == E_8XP)) cfwrite("\x0b\0x00", 2, fp, &chk); else if (ext == E_85S) { i = 4 + strlen(str); cfwrite(&i, 1, fp, &chk); cfwrite("\0x00", 1, fp, &chk); } else cfwrite("\x0c\0x00", 2, fp, &chk); if(ext == E_8XP) i = (n * 2) + 5; else if(ext == E_83P) i = (n * 2) + 11; else i = n + 2; cfwrite(&i, 2, fp, &chk); if ((ext == E_82P) || (ext == E_83P) || (ext == E_8XP)) cfwrite("\x06", 1, fp, &chk); else if (ext == E_86P) cfwrite("\x12", 1, fp, &chk); else if ((ext == E_85S) || (ext == E_86S)) cfwrite("\x0c", 1, fp, &chk); i = strlen(str); if ((ext == E_85S) || (ext == E_86P) || (ext == E_86S)) cfwrite(&i, 1, fp, &chk); cfwrite(str, i, fp, &chk); memset(str, 0, 8); if (ext != E_85S) cfwrite(str, 8 - i, fp, &chk); if (ext == E_8XP) { i = (n * 2) + 5; n2 = (n * 2) + 3; } else if (ext == E_83P) { i = (n * 2) + 11; n2 = (n * 2) + 9; } else { i = n + 2; n2 = n; } cfwrite(&i, 2, fp, &chk); cfwrite(&n2, 2, fp, &chk); if(ext == E_8XP) { cfwrite("\xBB", 1, fp, &chk); cfwrite("\x6C", 1, fp, &chk); cfwrite("\x3F", 1, fp, &chk); } if((ext == E_83P) || (ext == E_8XP)) datawrite(buf, n, fp, &chk); else cfwrite(buf, n, fp, &chk); if(ext == E_83P) { cfwrite("\x3F", 1, fp, &chk); cfwrite("\xD4", 1, fp, &chk); cfwrite("\x3F", 1, fp, &chk); cfwrite("0000", 4, fp, &chk); cfwrite("\x3F", 1, fp, &chk); cfwrite("\xD4", 1, fp, &chk); } fwrite(&chk, 2, 1, fp); if (ferror(fp)) die("Failed writing output file: %s\n", argv[2]); fclose(fp); free(buf); printf("'%s' successfully converted to '%s'\n", argv[1], argv[2]); return 0; } z88dk-1.8.ds1/support/ticalc/bin2var/bin2var2.txt0000644000175000017500000000534607267010556021230 0ustar tygrystygrys$Id: bin2var2.txt,v 1.2 2001/04/17 09:48:30 stefano Exp $ ------- (Stefano's note: Removed the exe files. They can be added in the binary distributions.) Bin2Var2 modified by Jeremy Drake August 25, 2000 I have modified the program Bin2Var by David Phillips to make unsquished programs for the TI-83 and TI-83 Plus. It inserts the AsmPrgm symbol at the beginning of TI-83 Plus programs and it inserts the End 0000 End stuff at the end of a TI-83 program. I have also modified the squishing version to insert the tasmCmp symbol at the beginning of TI-83 Plus programs so that they can be executed via Asm(prgmName) without a .db 0bbh, 6dh at the beginning of your program. Bin2var.exe squishes, Bin2var2.exe doesn't. The syntax is the same for both. Bin2var(2) input.bin output.ext valid output extensions are 82P 83P 8XP 85s 86p 86s, although I only modified 83P and 8XP The others still work exactly the same. The batch files: ion.bat: the original asm.bat, assembles for ION 83asm.bat: makes an unsquished 83p file 83pasm.bat: makes an unsquished 8xp file 83squasm.bat: makes a squished 83p file 83psqasm.bat: makes a squished 8xp file The original documentation follows: Bin2Var version 1.20 by David Phillips August 24, 2000 This is a simple utility that converts binary images into variables in TI Graph Link format. The following formats are supported: 82P, 83P, 8XP, 85S, 86P and 86S. All testing was done using VTI and not the actual TI Graph Link software. This program was written as a suitable replacement for DevPac83 and DevPac8X, as these programs do not work under Windows NT or Windows 2000. Other formats may be supported in the future if there is a demand (i.e. email me and tell me what you want!). 82P, 85S, 86P and 86S format were added at Clem's request. The included asm.bat batch file is a modification of the one included with ION. You can use it to compile TI-83 and TI-83+ programs for ION using TASM. Messages are written to stdout, so if you redirect the program's to nul, no output will be printed under normal circumstances. Error messages are written to stderr, so you will see errors even if output is redirected to nul. The program is written in ANSI C, so it should compile on just about any platform. There is a binary version include for Win32 (a console app) that was compiled with Borland C++Builder 5. I tested, it does compile on Linux using GCC, but you'll have to compile it yourself if you want to use it on Linux. This program is released under the GNU GPL version 2 or later. In other words, I take no responsibility for this program, and you are free to do anything you like with the source, provided the source is available to anyone who asks for it. z88dk-1.8.ds1/support/ticalc/bin2var/ion.bat0000644000175000017500000000120507240302053020270 0ustar tygrystygrys@echo off echo ----- Assembling %1 for the TI-83 Plus... echo #define TI83P >temp.z80 if exist %1.z80 type %1.z80 >>temp.z80 if exist %1.asm type %1.asm >>temp.z80 tasm -80 -i -b temp.z80 %1.bin if errorlevel 1 goto ERRORS bin2var %1.bin %1.8xp echo ----- Assembling %1 for the TI-83... echo #define TI83 >temp.z80 if exist %1.z80 type %1.z80 >>temp.z80 if exist %1.asm type %1.asm >>temp.z80 tasm -80 -i -b temp.z80 %1.bin if errorlevel 1 goto ERRORS bin2var %1.bin %1.83p echo ----- Success! echo TI-83 version is %1.83p echo TI-83 Plus version is %1.8xp goto DONE :ERRORS echo ----- There were errors. :DONE del temp.z80 >nul del %1.bin >nul z88dk-1.8.ds1/support/ticalc/compti.bat0000755000175000017500000000014507434141117017447 0ustar tygrystygrys@echo off call compti82 %1 call compti83 %1 call compti8x %1 call compti85 %1 call compti86 %1 z88dk-1.8.ds1/support/ticalc/compti82.bat0000755000175000017500000000027307434141117017623 0ustar tygrystygryszcc +ti82 %1.c -lm -ltigray82 -o%1.crash.82.NA.bin bin2var %1.crash.82.NA.bin %1.crash.NA.82p zcc +ti82ansi %1.c -lm -ltigray82 -o%1.crash.82.bin bin2var %1.crash.82.bin %1.crash.82p z88dk-1.8.ds1/support/ticalc/compti83.bat0000755000175000017500000000411607434141117017624 0ustar tygrystygryszcc +ti83 %1.c -startup=1 -lm -ltigray83 -o%1.ion.83.NA.bin bin2var %1.ion.83.NA.bin %1.ion.NA.83p zcc +ti83 %1.c -startup=2 -lm -ltigray83 -o%1.ven.83.NA.bin bin2var %1.ven.83.NA.bin %1.ven.NA.83p zcc +ti83 %1.c -startup=3 -lm -ltigray83 -o%1.zes.83.NA.bin bin2var %1.zes.83.NA.bin %1.zes.NA.83p zcc +ti83 %1.c -startup=4 -lm -ltigray83 -o%1.anova.83.NA.bin bin2var %1.anova.83.NA.bin %1.anova.NA.83p zcc +ti83 %1.c -startup=5 -lm -ltigray83 -o%1.tiexplorer.83.NA.bin bin2var %1.tiexplorer.83.NA.bin %1.tiexplorer.NA.83p zcc +ti83 %1.c -startup=6 -lm -ltigray83 -o%1.ashell.83.NA.bin bin2var %1.ashell.83.NA.bin %1.ashell.NA.83p zcc +ti83 %1.c -startup=7 -lm -ltigray83 -o%1.sos.83.NA.bin bin2var %1.sos.83.NA.bin %1.sos.NA.83p zcc +ti83 %1.c -startup=8 -lm -ltigray83 -o%1.ve.83.NA.bin bin2var %1.ve.83.NA.bin %1.ve.NA.83p zcc +ti83 %1.c -startup=9 -lm -ltigray83 -o%1.zasm.83.NA.bin bin2var %1.zasm.83.NA.bin %1.zasm.NA.83p zcc +ti83 %1.c -startup=10 -lm -ltigray83 -o%1.asm.83.NA.bin bin2var %1.asm.83.NA.bin %1.asm1.NA.83p bin2var2 %1.asm.83.NA.bin %1.asm2.NA.83p zcc +ti83ansi %1.c -startup=1 -lm -ltigray83 -o%1.ion.83.bin bin2var %1.ion.83.bin %1.ion.83p zcc +ti83ansi %1.c -startup=2 -lm -ltigray83 -o%1.ven.83.bin bin2var %1.ven.83.bin %1.ven.83p zcc +ti83ansi %1.c -startup=3 -lm -ltigray83 -o%1.zes.83.bin bin2var %1.zes.83.bin %1.zes.83p zcc +ti83ansi %1.c -startup=4 -lm -ltigray83 -o%1.anova.83.bin bin2var %1.anova.83.bin %1.anova.83p zcc +ti83ansi %1.c -startup=5 -lm -ltigray83 -o%1.tiexplorer.83.bin bin2var %1.tiexplorer.83.bin %1.tiexplorer.83p zcc +ti83ansi %1.c -startup=6 -lm -ltigray83 -o%1.ashell.83.bin bin2var %1.ashell.83.bin %1.ashell.83p zcc +ti83ansi %1.c -startup=7 -lm -ltigray83 -o%1.sos.83.bin bin2var %1.sos.83.bin %1.sos.83p zcc +ti83ansi %1.c -startup=8 -lm -ltigray83 -o%1.ve.83.bin bin2var %1.ve.83.bin %1.ve.83p zcc +ti83ansi %1.c -startup=9 -lm -ltigray83 -o%1.zasm.83.bin bin2var %1.zasm.83.bin %1.zasm.83p zcc +ti83ansi %1.c -startup=10 -lm -ltigray83 -o%1.asm.83.bin bin2var %1.asm.83.bin %1.asm1.83p bin2var2 %1.asm.83.bin %1.asm2.83p z88dk-1.8.ds1/support/ticalc/compti85.bat0000755000175000017500000000027307434141117017626 0ustar tygrystygryszcc +ti85 %1.c -lm -ltigray85 -o%1.rigel.85.NA.bin bin2var %1.rigel.85.NA.bin %1.rigel.NA.85s zcc +ti85ansi %1.c -lm -ltigray85 -o%1.rigel.85.bin bin2var %1.rigel.85.bin %1.rigel.85s z88dk-1.8.ds1/support/ticalc/compti86.bat0000755000175000017500000000357607434141117017640 0ustar tygrystygryszcc +ti86 %1.c -startup=1 -lm -ltigray86 -o%1 prgm86 %1 del %1.LASM.86.NA.obj ren %1 %1.LASM.86.NA.obj del %1.LASM.86.NA.86p ren %1.86p %1.LASM.86.NA.86p zcc +ti86 %1.c -startup=2 -lm -ltigray86 -o%1 prgm86 %1 del %1.ASE.86.NA.obj ren %1 %1.ASE.86.NA.obj del %1.ASE.86.NA.86p ren %1.86p %1.ASE.86.NA.86p zcc +ti86 %1.c -startup=3 -lm -ltigray86 -o%1 prgm86 %1 del %1.zap2000.86.NA.obj ren %1 %1.zap2000.86.NA.obj del %1.zap2000.86.NA.86p ren %1.86p %1.zap2000.86.NA.86p zcc +ti86 %1.c -startup=4 -lm -ltigray86 -o%1 prgm86 %1 del %1.emanon.86.NA.obj ren %1 %1.emanon.86.NA.obj del %1.emanon.86.NA.86p ren %1.86p %1.emanon.86.NA.86p zcc +ti86 %1.c -startup=5 -lm -ltigray86 -o%1 prgm86 %1 del %1.emb_LargeLD.86.NA.obj ren %1 %1.emb_LargeLD.86.NA.obj del %1.emb_LargeLD.86.NA.86p ren %1.86p %1.emb_LargeLD.86.NA.86p zcc +ti86 %1.c -startup=10 -lm -ltigray86 -o%1 prgm86 %1 del %1.asm.86.NA.obj ren %1 %1.asm.86.NA.obj del %1.asm.86.NA.86p ren %1.86p %1.asm.86.NA.86p zcc +ti86ansi %1.c -startup=1 -lm -ltigray86 -o%1 prgm86 %1 del %1.LASM.86.obj del %1.LASM.86p ren %1 %1.LASM.86.obj ren %1.86p %1.LASM.86p zcc +ti86ansi %1.c -startup=2 -lm -ltigray86 -o%1 prgm86 %1 del %1.ASE.86.obj del %1.ASE.86p ren %1 %1.ASE.86.obj ren %1.86p %1.ASE.86p zcc +ti86ansi %1.c -startup=3 -lm -ltigray86 -o%1 prgm86 %1 del %1.zap2000.86.obj del %1.zap2000.86p ren %1 %1.zap2000.86.obj ren %1.86p %1.zap2000.86p zcc +ti86ansi %1.c -startup=4 -lm -ltigray86 -o%1 prgm86 %1 del %1.emanon.86.obj del %1.emanon.86p ren %1 %1.emanon.86.obj ren %1.86p %1.emanon.86p zcc +ti86ansi %1.c -startup=5 -lm -ltigray86 -o%1 prgm86 %1 del %1.emb_LargeLD.86.obj del %1.emb_LargeLD.86p ren %1 %1.emb_LargeLD.86.obj ren %1.86p %1.emb_LargeLD.86p zcc +ti86ansi %1.c -startup=10 -lm -ltigray86 -o%1 prgm86 %1 del %1.asm.86.obj del %1.asm.86p ren %1 %1.asm.86.obj ren %1.86p %1.asm.86p z88dk-1.8.ds1/support/ticalc/compti8x.bat0000755000175000017500000000056507434141117017735 0ustar tygrystygryszcc +ti8x %1.c -startup=1 -lm -ltigray83p -o%1.ion.8x.bin bin2var %1.ion.8x.bin %1.ion.8xp zcc +ti8x %1.c -startup=2 -lm -ltigray83p -o%1.mir.8x.bin bin2var %1.mir.8x.bin %1.mir.8xp zcc +ti8x %1.c -startup=4 -lm -ltigray83p -o%1.tse.8x.bin bin2var %1.tse.8x.bin %1.tse.8xp zcc +ti8x %1.c -startup=10 -lm -ltigray83p -o%1.asm.8x.bin bin2var %1.asm.8x.bin %1.asm.8xp z88dk-1.8.ds1/support/ticalc/README0000644000175000017500000000222107414553771016351 0ustar tygrystygrys$Id: README,v 1.3 2002/01/02 09:50:49 stefano Exp $ Since all the TI calculators' startup files have been modified to be "bin2var" compatible, the old conversion tool aren't supported anymore. This HOWTO is much more simple now: TI82: CrASH shell SDK suggested (http://www.lfx.org/crashware/ or http://www.ticalc.org) TI83: All the Shells ! (http://www.ticalc.org/pub/83/asm/shells) Change the -startup flag at compile time (see TI83_CRT0.ASM) ION Shell is used by default, now. TI83 plus: Tested under the ION SHELL (http://www.ticalc.org/pub/83plus/asm/shells/ion.zip). TI85: We heavily changed the binary structure, recently !! TI86: Different options available; the LASM startup is good for long programs, otherwise choose another shell or the pure asm() exec starup. LASM can be found on http://www.ticalc.org/pub/86/asm/shells/ti86no8k.zip this will go over the 8Kb barrier. Generic examples : - zcc +ti85ansi -lm program.c - bin2var a.bin program.85s - zcc +ti83 -lm -startup=2 program.c - bin2var a.bin program.83p - zcc +ti8xansi -lm -startup=1 program.c - bin2var a.bin program.8xp z88dk-1.8.ds1/support/ticalc/ti86/0000755000175000017500000000000010765202715016256 5ustar tygrystygrysz88dk-1.8.ds1/support/vz/0000755000175000017500000000000010765202715014664 5ustar tygrystygrysz88dk-1.8.ds1/support/vz/loader.vz0000644000175000017500000000012707237777314016527 0ustar tygrystygrys loaderzz 30862,0{ 30863,128{ (1){Z(0)%{ 30z88dk-1.8.ds1/support/vz/README0000644000175000017500000000273407736255250015560 0ustar tygrystygrys$Id: README,v 1.4 2003/09/30 10:27:52 stefano Exp $ The default startup behaviour has now changed. The BASIC loader block is embedded in the CRT0 stub, so that the resulting binary file is ready for use (name it with the "vz" extension). The graph/text mode is automatically switched by calling "clg" or printing CHR$ 12. If you prefer the old behaviuour (separate BASIC loader + external tools), then go on reading. This can still be useful for some particular situation, such as mixing BASIC and machine code. THIS IS THE OLD PROCEDURE (use the "-startup=2" parameter) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - How pass the code to the VZ emulator. - Get the VZ emulator from: http://www.powerup.com.au/~intertek/VZ200/vz.htm - Get the utilities, also - Set the environment variables correctly - Compile your code (to a.bin) NOTE: the "-startup=2" parameter is now required - Use the rbinary utility (Rbinary.exe a.bin a.vz) - Run the emulator - Type: POKE 30862,0:POKE 30863,128 - Press F10, then 1 (Load Program) - Chose a.vz - Return to the emulator (press ENTER) - Type: X=USR(0) Enjoy it ! The most difficult thing is to "understand" the VZ keyboard; only the left SHIFT key works. It is also possible to create a .WAV file for passing the program on tape. If you're going to run graphics type in a small BASIC program like this: 10 MODE (1) 20 X = USR (0) After executing the program BASIC goes back to text mode. z88dk-1.8.ds1/support/winstall/0000755000175000017500000000000010765202715016062 5ustar tygrystygrysz88dk-1.8.ds1/support/winstall/icons/0000755000175000017500000000000010765202715017175 5ustar tygrystygrysz88dk-1.8.ds1/support/winstall/icons/z88dk.ico0000755000175000017500000000206610253772026020647 0ustar tygrystygrys(& N( wwwwwwp  p( @ppwwppp𙙑w pwpwpppppppppppwpppxpxpz88dk-1.8.ds1/support/winstall/icons/z88dk_Image.bmp0000755000175000017500000014653610253772026021770 0ustar tygrystygrysBM^6(:(  fgfc' &&&787ݢGVWW@@@8rrr{|zùǽy|\KLKs{uDDDlolž']^]~ȾnwpŻadaOPO-.-v~wwxwBBBHIH FGFURKY$y4ʼn;e*ՙCi,]! INٝEU#u2E9ɍ=ѕAQ!Pm.Tq5}6I}Am1r0_(L]&̐?O u9a(Β@i-Mz>p/x<P[ üFLHRSR232n==>>>y >>>>>)l>>fz">>>:d)>>>}[d>> xEr:>>>=[) >>lpOd= >>p[bF>>>n<y>>.[p">>>=C%l>>>n~[f>>yNn:>>>=[b)>>>)M.=>>>:%[r=>>>:N6y >>d[d>> =pl>>f~[n >>l%xn>>>}bF>>>n.E:>>>=%="dp">>>=Er= >>p~npdFbf>> yddy>>fffn)b)>>>lEtl>>>n~pn~b}dr=>>>:r%A%n:>>>=%==p""rd>> =Nnfn.xN= >>%}:%.)bn >>lM>d~fdb)fb}>>>nCn'66>>>f~d:f~r="dp">>>=dzpx3<'n.zp>}%:}dFb.>> y~.p%'fnN%F=%n)b) >>l3z'f''%~ndb}dr=>>>:nt,CN'nt.fr""rd>> }<3nfAd,p}~.)bn >>M.n'==)fb}>3%N6nA}%rFdpdOd'd~fddFrM<%p'f|Otdf~f)bEnf',r%=}b}.z'ftOF=%r""rnnd~fd.}bE'.f~)f,'nxE~rFdE|f'p%dFrdzf)A'6Nb).' y}~҃b)CtxO>=O=[Z3r=3x">=A%tZzdttxx">=..nd̥~p""r">=,n~bF҃zx.)b">=FZp" O3EЃMb)f">=OA:%[̥f.Zzzr="d">=.dt҃b),M3̕dFb">=,f~3r=En)">=}ZzdA3tMb}d">=O=[Znd̥33r""r">=ptbF҃txM. >y..֥Ep" O3Oۓ) >>lCn~̥f.ZrF>>>:n=QZd.".҃b):,Od>> =%[d Fdb),3r=f >> t.F.r=ZzdAEb}>>>.}ddAOOn.̥r">>=C"}df.b}҃}>=C":npb),Ep"O3)>=O,A":np~r=̥..Zz)>=O,A=fp~dAO҃b),O)>==f%f.3r=)>=Ob),ZzdAE)>=%҃r=֥On.̥)>=F3dAOb})>=FZf.Ep"O3)>=F֥b),Z..Z)>=:Zr=),֥O)>=:E3dAO3rF)>=:Zzf.ZdAOE)>=:Ob),֥Of.Z)>=:{rFb}C)>=:{O3d"AOEr"O3)>=:{:MZzf:.Z.Z)>=:{:Mb):,),֥O)>=:{:MrF"3rF")>=:{:MEd" OdAOE)>=:{:MZ2j 5֥f.Z)>=:{:M2,b}C)>=:{:M2F"5$3r"O3)>=:{:Md"Zd)>=:{:M^),֥)>=:{:MZ`,3bF")>=:{:M^53rF"d" O3)>=:{:M d" O֥f.Z)>=:{:MH`f.b)C)>=:{:MZ_$b),3r"3)>=:{:M 3rF"Zd)>=:{:Md" O)d̥)>=:{:M_$Hf.3bF">=:{:MZ`҃b),d" O6>=:{:M__`3rF"̥fCІ>>> :{:MZd" O҃).OA>>>):{:M֥Of.3)..>>l:{:Mb),Zz).,>> :{:M3rF"f.">>>=:{:MZzd" O"CO >>>n:{:MO..tO >>>l9 oM _  Z D, 0_d>>yLږM __ ږy.C>> =2`>M  Z2`O5$>>>:1X:{:M XOOA>>>)(M).>>l(_____b,>> M_ _  _ ZXO">>>=1C2M_ H^H2&v.O>>>:n>Р _ q5v`>>l12j:g__ _____5 ^$$ 2S>:{:M ̥p>>y:{:MZbF>>):{:M3Sb>:{:Mp>>y:{:M_̥F>:{:MZ҃p>>:{:M >l:{:M">=:{:M[">=:{:MZ[">=:{:M[">=:{:M[[">=:{:Mg _  [[">=:{:M  [[">=:{:M [[">=:{:M[[">=:{:M[[">=:{:M_____[[">=:{:M_ _  __ __ [[">=:{:M ^[[">=:{:M_  [[">=:{:M_ [[">=:{:M[[">=:{:M__[[">=:{:M   [[">=:{:M[[">=:{:M_[[">=:{:M[[">=:{:M[[">=:{:M[[">=6666bp̥̥̥[[">=OOxxxxxxxxxxxxxxxxOO66b%%{,CGE̥EGKGE̥EGGE̥Exxx666">=fffxГMOO3b{,].|]qq UGU q qq UEK qq ߤGGKKKEzM6{%b66:>"|A)))))))AnfxM6%4%6MxOxz4LTTAX-\-)7qUKq 7$7qUK 77 qqqq qE{44%b6:>l jjy )A'%8LTTTTTTTTLL%Mxx--1DDDoj)'fM6]gI+1Lm9HH*^ 䇇 m`(2 Wq?m`( Ba 8\(;BJoHoj~4T\(*XH1KK 7L0`(Y 8X(YS LIYVDooJ8X`ea9kH1 g!(YD$\kYH LIYDJO~4T\(1$8m#?]5Y LIYwJJaO8X`e1_2\kYS?m#Ya LIYaPJO~4T\(k29(aB!(29(aB!\kY LIYPJO8X`eSxxx((SUL9#5 1UL9#(08m`2 LIYPVO~4T\(gxOxT\(Y8m#eS58m#eS_ ]0` LIYwO8X`evЕ{?9(YVߔL9#g(ߔL9#$K $X` LIYPO~4T\($O%Lm{q\kY\(W \kY_K $X` LIYjO8X`e2OM6]X`e>]78XY?9#eq 78XY^K $X` LIYaO~4T\(OOЀ4T\(-g85\ke$5(85\ke(K $X` LIYVO8X`e2~OOx%L0#IX\#27?m#X\#2!(K $X` LIYO~4T\(OЀ4T9!Sk$\!ka\k`K $X` LIYBO%8X`eЕOxg02(*0 78X(*m#e#W$0` LIY&OO~6]gI+OЀge1D _W \1D ]XD 8m# LIYfOxГ{]gI(Еx {LDBgq9;B!!k_a ?9kY LIYn~6%]XI(vx~ge2BK \kB8U80`v$$L5!(Y LIYPByA'fx{LTg0\`;x6]g0ḢU85(_K 9HgX\`Y LIY Af{8gm\IkY{L0\YHH1`q9#e;`EU]5!(#Y LIYoPP}|fMT9k+ee;DB2۔!`HH2BaG]X`(^aG 785*YYY LIYw&)nM6]gIk&Y;8]X`k1BBE 7?9#^Bq785B_a LIY-D AfM6gILm1P+#q!(YH?9_`̇W 78H LIY&ooDv)'fЀ4TmkTL9kY +YHwKqg(;8m#̇q LIY>o-&fx%]T09LmkLoHHvLqg( L9#a  LIY-&+fM%LLa00`YXkPJPYq!(a \kE  LIY- DjOxM%*5Ya)\koVV 7?9k8XY^EW LIY> j OM9kIe180*?5\keE# LIY:>:A))OOxxxxxOzzq]5(+YHHa%q9km!#^̇]0`LY">='''ffzzzzttttz L0D;H4]5\;k(K $X`?Y">=zzzzttttEEtz0*1<&?g*DK $X`eY">=zzzzttttEEE[EtL5 Svy.'-v^ K $0`veY">=zzzzttttEEE[[[3[t7]LF)f| &-D $0`T`e^">=zzzzttttEEEE[[3QEzq`p:|')-]0`Y`e*:>=zzzzttttEEEE[[3QQE H`<"'|lW$X`TeY*:>=zzzzttttEEEE[[[QQ3EU 226lن') ^ K 5!keI(o>=zzzzttttEEE[[[QQEtzW(鞞^%F)fAw__^q?m# 8m(2J>=zzttttEEE[[[3QQ33EEEEE333p::..) ⥥E$X gmIJ>=ttttEEE[[[3QQfF<}K 8W]gJ>=ttttEEEE[[3QQ̥b)}=ttttEEEE[[[QQrF|:FMGK\_J>=tttEEEE[[[3QQ3d":||E0Y_tx~M; J>=tEEEE[[[3QQfF<}̥[OOb66 >=EEE[[[3QQ̥b)}=E[[[[QQQr=|:FM[[">=[[[QQQ3d"||[[">=[3QQfF<}[[">=QQ̥b)}<=[[">=Qr=F[[">=3d".||[[">=nFy[[">=Z̥b})<=[[">=r"F[[">=3d".|[[">=nFFp[[">=̥b}|<"M[[">=֣r"F[[">=i֣Z3.=<)[[">=fEZ)yF%[[">=.N̥bF|<"=M[[">=Ap"|}[[">=OFx3.=<}[[">=nEZE)}=d.ZbF|"=M[[">=6tq1 _vPAOFxIY \ynEZ72,.E! KHv5^.r(D` BX*O F k "nL\^,.E3aa(f.r\v_|OAFa0}T;B1,.E1 .rvOA"ZBsssRs} IBccccRcRRccsB,.EU K cc@R@@R.Nssssc@@c@RAZ RcІF? @c@@RCfE\@@@@c@Rc@.NaRcRR@s6Z#sssssOFxnE^ YEBYEBd.1UUf6B5#S#SZOFx(  "n!Y!YZ,.EB988Z,r5ZO>>>>F B Z,">>>>>>>nSSCA>>>>"nl>>.EZU7Z>>> : y >>r#YYZd">>>>y=>>>"2vB vB C >>>>=nn>>>}E2_ mv2_ mvZ>>> :ll>>>.EXBZOd">>>>yy >>r B BZԬ, >>>>نn= >>"e^e^ZA>>> :)n:>>>}B \ W \ WOd>>>>yl>>>fEYD92D92Z, >>>>نny>>N*$!$!>>ZA>>> ")= >>Bq!\q!\>>dO.>>>> n:>> D!0 D!0= >>,>>>>l1v$`$`B:>>> OA>>> "ABmel>>>.O.>>>> vBveY$Y$y>>,,">>>>y!B(v#U1#U1= >>>>>"n+Uaa*?# \K\ \K\n>>: }9((B&BS vB1`kB1`kj&B)nBf&BVSjyB v aSD*l)VBBB )-a_vz88dk-1.8.ds1/support/winstall/icons/z88dk_Image_test.bmp0000755000175000017500000014653610253772026023027 0ustar tygrystygrysBM^6(:( !!!---3333:::::nCCCHGGKIIUSSa^^ebbiffkiiassvrrzvv{yy  " !!$"$$+***--0-102252656685:9==A>A@BBEBEDEEHDKIJIMMPLQPSSTRWVUUXVZYTT\\\\a]aaccdbfdeebbidljkkjjnnnnpnqptqutvuxuxxyy|z~}iirrww~}}}}~zĂ„…Ć΁ʼnƋȍ҆҉ȑɒ̒ɔʔ̕˘̙Λ֒ؖԚМН֜ٛРѡԡҤҥԦߠԩЫթ֭֬تޫجج߯װذþٱܲڴ۵ܸܶݻᣣ㫫䳳༻鼼Emw`,/ZR#$T?' һ̻̻Ż̻ŻŻ̺Ż̺r#kڔ88Ŵ}-_Ҫ >ә`aY3MZSSSSXSSSSXSSSSXSSS?]KKKKKKKKRg2€SKKKKKKKKS)،ZRRRRRS]̟{{{{{Ř@{{{'3******************aVG<<<<<<<<<<<<!4?#^*: PԁYOV/$O *A7GFK)'X! !o '!!!?,!!$ >L!!,E8?1Y5 S4?l>\Z{Է ?=**=B7**G"**-S7-**_0((a#P,((^(((I(((:pP禀q;79|$+Z77D;777IC77|"445M844|444SY444Dç#殖FFF̘DFI\#DFK`/\DF^.#{@@LIPG@@?A@(MA@@F(®STSr¬SSXЀ'TSy8,}VS},/oOOz.PSOOOOO_RRPX2ygeś)he|PڦeeAEhe+Fy^] Pa]_^]]_ҿg]]]7P򌄄P򌅄L̿o׆PPP '겕 )ז,y񛖗EﴗٙP򔌌P򔌌ԌX 謫>ز,̩.#\լ;MR򦞞ڞY5-#L' )_7²#T貲Ʋ]>V+2}; #E'+/P>n)\牧>ā)NTsx= x?,`z T>)s?;__.Tss;,I>''$!T)AVe}; T$e4ytt )׽ԽԽӽӽӽӽIe/V#B##$/#/};)P e_2E)8TttG'썂;44}#}\VP~ffffffffffffffffffy2#? 8Vs\vU#_.'5;/,.,.,.,.,!t+58,>زIs+,.,,,,,_Py+'.,, TTE>$)ܺ,B'Gz# T$87 I8'ѯ'>ݳT8ƒ5V򱃂߿#򯚯ݚݠ8ŒdbbbbbbbbbbGeƒcbbbbbbbbbd'P~f~~~ƙ#_cUJHJUc؉'5؏WUHHbUzY bQQQQQ#̴Y)5ƕB#MWQPQPQ–*,.+ #,,,.'ye).,,,!,,.,,    jj jj      iiiiiiiiii iii iiii j iiii iiii iii iiii  iii iiii iiiiiiii j  iii iiii iiiiiiii  iiii iiii iii iiii iiiiiiiiii iii iiii j   j j j   j jjj    j j j j   j jj   j         j j  jj jj  jj j          z88dk-1.8.ds1/support/winstall/icons/z88dk_SmallImage.bmp0000755000175000017500000001007610253772026022746 0ustar tygrystygrysBM>6(77   3::nasszz88dk-1.8.ds1/support/winstall/icons/z88dk_test.ico0000755000175000017500000000137610253772026021711 0ustar tygrystygrys ( @DDDODDODDDDDDODDDDDDDOODDOOODDOODDDOODDOOOOODDODDDODODDDDOOOODDODDOODDDOOODDOODDDODDODDDDDDODDDO????????z88dk-1.8.ds1/support/winstall/read_after.txt0000755000175000017500000000134610253772026020725 0ustar tygrystygrysImportant matters: 1. You have to add the "bin" folder (under the installation directory) to your PATH environment variable, to access compiler commands directly from the command prompt. 2. If you are running Windows ME, restart your computer after this setup procedure. 3. do not delete the two files "unins000.exe" and "unins000.dat" under the installation directory: they are part of the uninstall process! 4. the uninstall process will not delete the files and the directories that you add under the installation folder; hence please remove them by yourself. Enjoy z88dk! ------ z88dk setup team: - author: Marcello Zaniboni - technical consultant: Stefano Bodrato - graphics: Luciano "Lucky" Costarelli z88dk-1.8.ds1/support/winstall/read_before.txt0000755000175000017500000000077610253772026021074 0ustar tygrystygrys---------- z88dk ---------- z88dk is a Z80 cross compiler producing binaries for over 20 different z80 based machines. Binaries are supplied for Win32, Amiga and Solaris platforms. This setup program will install z88dk on Windows; at the moment it is known to work fine with every version except for Windows 95 and 98 (Windows Millennium Edition is OK). For more info about z88dk, please visit http://www.z88dk.org For any problem/question about this setup, you can write to mzaniboni@hotmail.com z88dk-1.8.ds1/support/winstall/setup_ext/0000755000175000017500000000000010765202715020102 5ustar tygrystygrysz88dk-1.8.ds1/support/winstall/setup_ext/cfgs/0000755000175000017500000000000010765202715021024 5ustar tygrystygrysz88dk-1.8.ds1/support/winstall/setup_ext/cfgs/abc80.cfg0000755000175000017500000000545110253772027022412 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\abc80_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -labc80_clib -lndos -DZ80 -DSMALL_C -DABC80 -D__ABC80__ -M -DSCCZ80 -Cz+abc80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/aceansi.cfg0000755000175000017500000000544310253772027023121 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ace_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -laceansi_clib -lndos -DZ80 -DSMALL_C -DACE -D__ACE__ -M -DSCCZ80 -Cz+ace z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/aquansi.cfg0000755000175000017500000000546710253772027023165 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\aquarius_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -laquansi_clib -lndos -DZ80 -DSMALL_C -DAQUARIUS -D__AQUARIUS__ -M -DSCCZ80 -Cz+aquarius z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/aquarius.cfg0000755000175000017500000000547010253772027023350 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\aquarius_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -laquarius_clib -lndos -DZ80 -DSMALL_C -DAQUARIUS -D__AQUARIUS__ -M -DSCCZ80 -Cz+aquarius z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/c128ansi.cfg0000755000175000017500000000544310253772027023046 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\c128ansi_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lc128ansi_clib -lndos -DZ80 -DSMALL_C -DC128 -D__C128__ -M -DSCCZ80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/cpc.cfg0000755000175000017500000000544110253772027022261 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\cpc_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB cpc_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lcpc_clib -DZ80 -DSMALL_C -DCPC -D__CPC__ -M -DSCCZ80 -Cz+cpc z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/cpcansi.cfg0000755000175000017500000000544510253772027023140 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\cpc_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB cpc_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lcpcansi_clib -DZ80 -DSMALL_C -DCPC -D__CPC__ -M -DSCCZ80 -Cz+cpc z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/cpm.cfg0000755000175000017500000000543110253772027022272 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\cpm_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -oa.com -lcpm_clib -DZ80 -DSMALL_C -DCPM -D__CPM__ -M -DSCCZ80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/embedded.cfg0000755000175000017500000000547510253772027023254 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\embedded_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo -iembedded_clib2 # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lembedded_clib -lndos -DZ80 -DSMALL_C -DEMBEDDED -D__EMBEDDED__ -DSCCZ80 -M z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/m5.cfg0000755000175000017500000000542310253772027022035 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\m5_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lm5_clib -lndos -DZ80 -DSMALL_C -DM5 -D__M5__ -M -DSCCZ80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/msx.cfg0000755000175000017500000000543710253772027022330 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\msx_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lmsx_clib -lndos -DZ80 -DSMALL_C -DMSX -D__MSX__ -M -DSCCZ80 -Cz+msx z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/mz.cfg0000755000175000017500000000544410253772027022145 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\mz_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lmz_clib -lndos -DZ80 -DSMALL_C -DSHARPMZ -D__SHARPMZ__ -M -DSCCZ80 -Cz+mz z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/mzansi.cfg0000755000175000017500000000545010253772027023015 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\mz_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lmzansi_clib -lndos -DZ80 -DSMALL_C -DSHARPMZ -D__SHARPMZ__ -M -DSCCZ80 -Cz+mz z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/nasansi.cfg0000755000175000017500000000546010253772027023151 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\nascom_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lnasansi_clib -lndos -DZ80 -DSMALL_C -DNASCOM -D__NASCOM__ -M -DSCCZ80 -Cz+nasansi z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/nascom.cfg0000755000175000017500000000545610253772027023002 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\nascom_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lnascom_clib -lndos -DZ80 -DSMALL_C -DNASCOM -D__NASCOM__ -M -DSCCZ80 -Cz+nascom z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/nc.cfg0000755000175000017500000000543110253772027022113 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\nc_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lnc_clib -lndos -DZ80 -DSMALL_C -DNC100 -D__NC100__ -M -DSCCZ80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ozansi.cfg0000755000175000017500000000543610253772027023023 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\oz_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lozansi_clib -lndos -DZ80 -DSMALL_C -DOZ -D__OZ__ -M -DSCCZ80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/pps.cfg0000755000175000017500000000543210253772027022316 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\pps_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lpps_clib -DZ80 -DSMALL_C -DSPRINTER -D__SPRINTER__ -M -DSCCZ80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ppsansi.cfg0000755000175000017500000000543610253772027023175 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\pps_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lppsansi_clib -DZ80 -DSMALL_C -DSPRINTER -D__SPRINTER__ -M -DSCCZ80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/rex.cfg0000755000175000017500000000543710253772027022317 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\rex_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -I~\include/rex -lrex_clib -make-app -DZ80 -DSMALL_C -DREX -D__REX__ -M -Wn39 -Wn40 -DSCCZ80 -Cz+rex z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/rexlib.cfg0000755000175000017500000000543710253772027023006 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER mkaddin # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\rxl_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -I~\include/rex -lrex_clib -make-app -DZ80 -DSMALL_C -DREX -D__REX__ -M -Wn39 -Wn40 -DSCCZ80 -Cz+rex z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/sam.cfg0000755000175000017500000000542710253772027022300 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\sam_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lsam_clib -lndos -DZ80 -DSMALL_C -DSAM -D__SAM__ -M -DSCCZ80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/samansi.cfg0000755000175000017500000000542210253772027023146 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\sam_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lsamansi_clib -lndos -DZ80 -DSMALL_C -DSAM -D__SAM__ -M z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/svi.cfg0000755000175000017500000000543710253772027022322 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\svi_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lsvi_clib -lndos -DZ80 -DSMALL_C -DSVI -D__SVI__ -M -DSCCZ80 -Cz+svi z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ti82.cfg0000755000175000017500000000544410253772027022305 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ti82_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti82_clib -lndos -DZ80 -DSMALL_C -DTI82 -D__TI82__ -M -DSCCZ80 -Cz+ti82 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ti82ansi.cfg0000755000175000017500000000545010253772027023155 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ti82_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti82ansi_clib -lndos -DZ80 -DSMALL_C -DTI82 -D__TI82__ -M -DSCCZ80 -Cz+ti82 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ti83.cfg0000755000175000017500000000544410253772027022306 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ti83_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti83_clib -lndos -DZ80 -DSMALL_C -DTI83 -D__TI83__ -M -DSCCZ80 -Cz+ti83 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ti83ansi.cfg0000755000175000017500000000545010253772027023156 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ti83_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti83ansi_clib -lndos -DZ80 -DSMALL_C -DTI83 -D__TI83__ -M -DSCCZ80 -Cz+ti83 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ti85.cfg0000755000175000017500000000544410253772027022310 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ti85_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti85_clib -lndos -DZ80 -DSMALL_C -DTI85 -D__TI85__ -M -DSCCZ80 -Cz+ti85 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ti85ansi.cfg0000755000175000017500000000545010253772027023160 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ti85_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti85ansi_clib -lndos -DZ80 -DSMALL_C -DTI85 -D__TI85__ -M -DSCCZ80 -Cz+ti85 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ti86.cfg0000755000175000017500000000544410253772027022311 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ti86_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti86_clib -lndos -DZ80 -DSMALL_C -DTI86 -D__TI86__ -M -DSCCZ80 -Cz+ti86 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ti86ansi.cfg0000755000175000017500000000545010253772027023161 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ti86_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti86ansi_clib -lndos -DZ80 -DSMALL_C -DTI86 -D__TI86__ -M -DSCCZ80 -Cz+ti86 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ti8x.cfg0000755000175000017500000000544610253772027022415 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ti83p_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti83p_clib -lndos -DZ80 -DSMALL_C -DTI8x -D__TI8x__ -M -DSCCZ80 -Cz+ti8x z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/ti8xansi.cfg0000755000175000017500000000545210253772027023265 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\ti83p_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lti83pansi_clib -lndos -DZ80 -DSMALL_C -DTI8x -D__TI8x__ -M -DSCCZ80 -Cz+ti8x z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/vz.cfg0000755000175000017500000000543110253772027022152 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\vz_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lvz_clib -lndos -DZ80 -DSMALL_C -DVZ200 -D__VZ200__ -M -DSCCZ80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/vzansi.cfg0000755000175000017500000000543510253772027023031 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -math-z88 # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\vz_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lvzansi_clib -lndos -DZ80 -DSMALL_C -DVZ200 -D__VZ200__ -M -DSCCZ80 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/z88.cfg0000755000175000017500000000542210253772027022144 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\z88_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lz88_clib -DZ80 -DSMALL_C -DZ88 -D__Z88__ -M -oa.bas -DSCCZ80 -Cz+z88 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/z88ansi.cfg0000755000175000017500000000541610253772027023022 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\z88_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lz88ansi_clib -DZ80 -DSMALL_C -DZ88 -D__Z88__ -M -DSCCZ80 -Cz+z88 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/z88net.cfg0000755000175000017500000000543710253772027022661 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\z88_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lz88net_clib -lnet -DNET_STDIO -DZ80 -DSMALL_C -DZ88 -D__Z88__ -M -DSCCZ80 -Cz+z88 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/zcc.cfg0000755000175000017500000000542210253772027022272 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # (Leave alone for z88) Z88MATHFLG -math-z88 -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\z88_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # z88_clib required here because we've split up z88 functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lz88_clib -DZ80 -DSMALL_C -DZ88 -D__Z88__ -M -oa.bas -DSCCZ80 -Cz+z88 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/zx.cfg0000755000175000017500000000545110253772027022156 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\spec_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB zx_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lzx_clib -DZ80 -DSMALL_C -DSPECTRUM -D__SPECTRUM__ -M -DSCCZ80 -Cz+zx z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/zx81.cfg0000755000175000017500000000545410253772027022332 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\zx81_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lzx81_clib -lndos -DZ80 -DSMALL_C -DZX81 -D__ZX81__ -M -DSCCZ80 -Cz+zx81 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/zx81ansi.cfg0000755000175000017500000000546010253772027023202 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\zx81_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB z88_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lzx81ansi_clib -lndos -DZ80 -DSMALL_C -DZX81 -D__ZX81__ -M -DSCCZ80 -Cz+zx81 z88dk-1.8.ds1/support/winstall/setup_ext/cfgs/zxansi.cfg0000755000175000017500000000545210253772027023032 0ustar tygrystygrys# # Config file for zcc (front end for Small C+ compiler) # # # Names of the various programs, if they're in your path you won't need to # alter these settings - except for COPYCMD, on unix set it to: cp # Z80EXE z80asm CPP zcpp LINKER z80asm COMPILER sccz80 COPTEXE copt COPYCMD copy APPMAKER appmake # # Flag to stimulate alternate handling of math constants, this flag is # supplied to the compiler when you supply -lmz to the frontend # you'll probably want to change this if you're retargetting # # No handling for the Spectrum, so leave as per z88 Z88MATHFLG -D__NATIVE_MATH__ # # Style of the C Preprocessor # # 1 = outimplied - cpp creates .i file # 2 = outspecified - output specified by zcc # 3 = filter - input piped into cpp by zcc and out to a file by zcc # # zcpp, gnu cpp, vbcc cpp are all outspecified # STYLECPP 2 # # Where the include files are kept (-I is preprocessor flag to tell it where # to find header files) # # Include the full path, eg ~\include # INCPATH -I~\include # # Any extra command line options for the assembler # # (Leave alone!) ASMOPTS -Mo # # Options for the optimizer # # COPTRULES3 contains optimizations which call in other library # routines..boosting code size, but..may save in the end if they # are used often # # COPTRULES2 is the extended rule set for indexing within arrays and # optimizing operations on unsigned chars # # COPTRULES1 is the standard rule set (been hanging around for ages! # # Supply the full path before the filenames, eg ~\lib\z80rules.1 # COPTRULES1 ~\lib\z80rules.1 COPTRULES2 ~\lib\z80rules.2 COPTRULES3 ~\lib\z80rules.0 # # Asm file which contains the startup code (omit suffix for Z80asm sake) # # CRT0 = Full path and name of the startup code file (omit suffix!) # CRT0 ~\lib\spec_crt0 # # Linker Options # # LIBPATH = where the linker libraries or stored # Keep the -i before the path in LIBPATH - (this is a z80asm flag for # libraries) # # LINKOPTS = Options required when linking (leave alone!) # LIBPATH -i~\lib\clibs\ LINKOPTS -a -m -Mo # # Names of the libraries # Z88MATHLIB = name of library linked if -lmz supplied # STARTUPLIB = library that is always linked in (contains all lib functions) # GENMATHLIB = generic maths library # # (Leave alone!) # Z88MATHLIB zx_math STARTUPLIB z80_crt0 GENMATHLIB gen_math # # Any default options you want - these are options to zcc which are fed # through to compiler, assembler etc as necessary # # -I. needed for some strange reason for GNU cpp, I dunno why.. # # The ones here, set verbose flag (echo commands) and switch on optimization # # (Leave alone!) [Recommended settings..] # # spec_clib required here because we've split up machine functions from # generic z80 startup functions # OPTIONS -// -v -O2 -I. -lzxan_clib -DZ80 -DSMALL_C -DSPECTRUM -D__SPECTRUM__ -M -DSCCZ80 -Cz+zx z88dk-1.8.ds1/support/winstall/setup_ext/compile.bat0000755000175000017500000000034410253772027022226 0ustar tygrystygrys@echo off set TOP=C:\GCJ set MINGDIR=%TOP% set PATH=%PATH%;%MINGDIR%\bin;%MINGDIR%\mingw32\bin;%MINGDIR%\libexec\gcc\mingw32\3.4.2 gcc -O3 -march=i486 -o deploy_z88dk.exe deploy.c strip deploy_z88dk.exe echo Done. pause z88dk-1.8.ds1/support/winstall/setup_ext/deploy.c0000755000175000017500000000506110253772027021547 0ustar tygrystygrys#include #include #include #include void sendinfo(void); const int N_FILES = 44; const char TOKEN = '~'; char * fileNames[] = { "abc80.cfg", "aceansi.cfg", "aquansi.cfg", "aquarius.cfg", "c128ansi.cfg", "cpc.cfg", "cpcansi.cfg", "cpm.cfg", "embedded.cfg", "m5.cfg", "msx.cfg", "mz.cfg", "mzansi.cfg", "nasansi.cfg", "nascom.cfg", "nc.cfg", "ozansi.cfg", "pps.cfg", "ppsansi.cfg", "rex.cfg", "rexlib.cfg", "sam.cfg", "samansi.cfg", "svi.cfg", "ti82.cfg", "ti82ansi.cfg", "ti83.cfg", "ti83ansi.cfg", "ti85.cfg", "ti85ansi.cfg", "ti86.cfg", "ti86ansi.cfg", "ti8x.cfg", "ti8xansi.cfg", "vz.cfg", "vzansi.cfg", "z88.cfg", "z88ansi.cfg", "z88net.cfg", "zcc.cfg", "zx.cfg", "zx81.cfg", "zx81ansi.cfg", "zxansi.cfg" }; int main(int argc, char * argv[]) { int i = 0; FILE *fin ,*fout; char ch; char *destdirname; char *destfilename; if (argc != 2) { printf("\nImproper command: specify the installation directory.\n"); sleep(7000); exit(-1); } printf("\nInstalling in \"%s\"...\n\n", argv[1]); destdirname = calloc(MAX_PATH + 1, sizeof(char)); GetShortPathName(argv[1], destdirname, MAX_PATH); for (i = 0; i < N_FILES; i++) { destfilename = calloc(MAX_PATH + 1, sizeof(char)); strncpy(destfilename, destdirname, MAX_PATH); strcat(destfilename, "\\LIB\\CONFIG\\"); strcat(destfilename, fileNames[i]); if ((fin = fopen(fileNames[i], "r")) == NULL) { printf("\nError opening file %s\n", fileNames[i]); sendinfo(); exit(2); } if ((fout = fopen(destfilename, "w")) == NULL) { printf("\nError creating file %s\n", destfilename); sendinfo(); exit(3); } printf("\tprocessing \"%s\"\n", fileNames[i]); while ((ch = getc(fin)) != EOF) { if (ch == TOKEN) { fputs(destdirname, fout); } else { putc(ch, fout); } } fclose(fin); fclose(fout); free(destfilename); } printf("\n...done!\n\n", argv[1]); return 0; } void sendinfo(void) { printf("\nPlease send info about this error to mzaniboni@hotmail.com\n"); printf("Thanks :-)\n"); sleep(10000); } z88dk-1.8.ds1/support/winstall/setup_ext/deploy_z88dk.exe0000755000175000017500000002100010253772027023125 0ustar tygrystygrysMZ@ !L!This program cannot be run in DOS mode. $PELxB 8  @p P`.text ``.data @.rdata0@@.bss@.idataP@.rsrc`@@U]U1ۉu1=wC=r[$1D$ tlt*$л؋u]]=t=t؋u]]v=u$ 1t$ t4t$ $\$ t$ L$d b US$]$@z bE@@U\$ @D$T$L$ $@@1 @@tX @8Q@t @@D$8Q@K0 $8Q@t@@\$ 8Q@QP$ @vL$@@T$@@$B$ D$8Q@B$e8Q@Uv'U$(Q@&U$(Q@&U HQ@]t&U SR/WhW2@a$1@$2@$'=$!u< @Whp2@$1@$2@$'$ h2@\$X$U3@Q@3@r]ÐU]ÐU @t&  @QA @uÍ&US@t)t'@Ku$@Z[[]Ë @1 @@u뽍US @@u6@ @@t%tt&@Ku$@[[]Ë @1 @@uUp@@]HUBSdT$U1ۉT$$P@ uFJx|*Au Jy;size == sizeof(W32_EH_SHARED)%s:%u: failed assertion `%s' ../../gcc/gcc/config/i386/w32-shared-ptr.cGetAtomNameA (atom, s, sizeof(s)) != 0TPHSPtP\SQPSQQQQQQQQRR R0RDRPR\RhRpR|RRRRRRRRRRRRRS SS$SQQQQQQQRR R0RDRPR\RhRpR|RRRRRRRRRRRRRS SS$SAddAtomAExitProcessFindAtomAGetAtomNameA~GetShortPathNameASetUnhandledExceptionFilterH_sleep'__getmainargs<__p__environ>__p__fmodeP__set_app_typey_cexit_filbuf_flsbuf_iob^_onexit_setmodeabortatexit!calloc*exit-fclose0fflush8fopen9fprintf;fputs?freermallocprintfputssignalstrcatstrncpyPPPPPPKERNEL32.dllPmsvcrt.dll(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(P(Pmsvcrt.dll @2X3p`( bd" Z88DKICON( wwwwwwp  p( @ppwwppp𙙑w pwpwpppppppppppwpppxpxp(2 3z88dk-1.8.ds1/support/winstall/z88dk Windows setup.pdf0000755000175000017500000005410610253772026022271 0ustar tygrystygrys%PDF-1.2 %쏢 5 0 obj <> stream xKo7{ 7{jAhR`[J֖ɮ샤$ʖZBdǐ;~r θ+8i/^=LWA8(qW\ \Ë^(by_XVئ,x`iQϬPʁbRש8_0-2 ײH&ПPYiV,7%(慓EV4L:l+]zYz{/'ZBqiLE'<(2KPzgǡRs[G_j@,itO>Z]ib"uM,IO5I<42SXr?gUo bФ*DDܤDi%Hr6əS;VM=IR^bśrk Rlb 8q -4W|(TzH.39yT`86*t86*T^om8Nk!omb~/cdJ4mŪ$dx!6l"2A(  A]$u~ \:;^bgE|N٠cj0hKe]EV%S%h "iQ4HP4iMj>FwK6ls;S*aU.E#Z64Ό*Zp%IrU~#jYؖYlĤƷcEÐ8^О'%(#ơ~Jb" cutiq(6yJR' Ap:6˖YhуbSñ#?\ n cQP Z *I&W%?im~uL!Gp@8aĴ<]\ y!8")/u udeM\#E;ABl{dXl"Wͺ%LidQ'I9: W5r8#@EQPOR0fu F>Z6mPcdc"Beֵf85tN2 9mɣQ<0<:Ptc{)9_D\G{ъtR] pLEE ފ۸ۢu7ؖdh" E'ӿ%`aM }J0H\:%fZd%O!ӟ"Yʞ iƸK<4Ij!RԇMGz74FݍFUFL7xǼ^-#cL](2 ̾ZѻX'K.3ah [Y3n D|5l`5 ۥkp'bwpvgj;DmHl.Ǘ_sgP)ϲJ)D_pytbEKt-]X7n#?íL]|I\-{w(trxz{ŇF{d%t),U #endstream endobj 6 0 obj 1969 endobj 14 0 obj <> stream x]Ys~ط`<%VbW`ŕR)\eDҊ3`@7f9vŔRl _M۳z_gBVMW Wo78{Y]9t-WoT[u6o϶?}{qVV8Q鍲U#?m?섫nu^ϻsS g90u?U%kuhkipЕavRjvO\U Tox{aT5j) pE 0vM]ϳ[ YƃNxpa5~qWZ+YQ%W~FjvnB~yla)Ci꾅= t٩umÙ~BjzH׹KWn+Sn&<&==\ҮMUV0s*~ӕG00*/4MtŚ>x:ƪcHjJ a%oܯD+iMTb}h5co.`.EOMU7eCy|sʮQgx<{“պcaj W&5TH]hrqQCg O*'P▭#ًݹ42#~(B4F >чiJgd?zw-r74+2m;^ޟf=8Sy?n+rbxTzqcfTT3&v_E 넥X4ԉwsm G๋ɬ}|Z%d'߀M4dޙUjx2K)E+$fpIe` F1zJ,!.PwŸ8|wo[/˜HaC厭FtH/|oa (ZnOy wT{jۈe-G(J))Y}Ѷ˂uV{1l20ʩ5*m,6*?5|fPSCP{w.KNڊ!\%O6ujz4bIRt<DQrzaS8߂ה8aY1 F~G p8B'eWkrBȟ? z ~B'g:kld8.Tc K~=:pQ:~%ޟ:nrIDȥ}.YeXlu*}*8|W+XQp۝넟sBF 2 &bP_FE]*]#[?gF|?9Pr+<6YPrO,9&foz}U4T 蝍=y&Ԑ_:$%ԲZZb߰#F0å0V*"R>#}U.x?% _OBO@RNfIk: "}Yg-Иma-OĄ?d6)F5 Q꣕{**Ze%V8[ 6Qّ26Sz2SRK}tji7q!.df7L}+s]P֚q&{QTR#kһg]+5O/)7רuD)]2`(xiޖ?\ݼ۟Tjڪm D:ttGbp:܍Tz#dOO3"#쩨=c0_A NCyPfN)4z Nk`qMy%H)ӒFR%7&Y1p!tIv:VQOcɉK?BAX*5E" .Td%w0T`? #RB`c棦1dCL -kI5ʛ2q}}U[^cnRۆ s?}kl g(?[_7aoCY9׸Lˏ`iBox_Ð7pYcxo5yFCz~ROOjH'É%@ b} 25b57NH@,dbwDNesۣ); i2!5X¯<;//tfPsM$*vR.H5lɔgo4zx=%" uNdjqWg,B6 '_ q0Ă:r46ܛ#׫b*"L[EjAriϗXcGhK\fz2 7f^]LK-:ZҴ"tUO,2|]{`XO e$JRk0z"_Yc ˛qUu|0ę&ToId0~\#dž^ 7$XTE7_&8JK u2%6!d농{t=Wv*D=ZS*FP%G({T_=jӸjw{4?W$uDyڔF6Df<|06"leh0 9y<SQ[Uṭ B \9JY 3:llEr4/ z0t8",Ґ~1#ឩy|4iT*yitVJ(:F.^Q>^C~'M (6€TP՛+v(tLJ֌7 xWyHr1*-n{B#\ˊ{Y@QH4,O~x_ʉ:BQI|TNRV̙d]B/^pFGwH3(@ŷ0ee=%ZbGgK݌Ӆ:L߰<.5t!"䄡з PU9>5t(TW?%*K>"af*Ԑ1F*i~4r{ K$Kcd_5?)EqFU6e <λϓE_o&rb?;dL~?du.y-}W䃤)zR@PajJWX2S"͒ Mk0"Qb!'F7)P78ҷlN mDGxnHiDc]<Խrh8-w\g47 Ql%+73'C"njy,g`f=PaGCPLĞy;7]7&rr2t'e4+VceʤO*9D-cR%[ aatmo([e܎ mg|K7wp/Thhoגl6 8hZ&BU(FP }K)5#)N ;~xY.$\7J|iJvɢ~XxB`F\tvAf1a,ףwg?FiУߋ1jOjyZ5&OuࡡXx V_os|壮ɤN" 8S*mTZH=0t!1<}Klޏ&0XKbjsg9> stream xZ}UG7h[z!)$xTߥq.v e]}eي]DJ1JkHRc$Ul(ĒHLm,!qΜ޼BrΙsΜ9w̼c;t13sXo lůmF7j1sN21 !f[2 ~nrŋqdSCQ qǔ6q!W:+ZFr+MlpR== Z h!jsHjP+vlS]jҐV_,n;s"{$Rn9KکKV^E P܄rj]RpƠ:ΪO\F8pkY*->H ?&q~$+p܀30o~X/BQ k2V*4=i,7ǍL&2̑/>;sto70w5u[hsϚdƜ=Ϗ4꘻o?ͽ֓Β^F{ؽ7?5†'~ؙo^tSy_ڇWO>v1ԝo7g7/{}`(;vz=׺`wGMz؝_..[j^{;w \|ŸqaLJ#L;2mak{7nj{K/.;OɁm܆з5OȌuI+?\{OW]{;76ᩯOqщ'ɗ~{ts/]xyu榫OӎnѱGwڗm:rO^n+l~뙫KKtwə fs-48C\D~966g!.2fL5Y甈\ȵ8| [7! &q[TLX䯰s3tJ*/aq9 WJ,%Kf14doZg! 6 sˉzH"\C6H*'n˫ _奚34o)̵M(&vIjHRÒgDD8(z[EQ"m00;zv42)Sjs,9EktJRtekXkEyT"XC>UE [s]'$0r-_81 $rT">3toHA&h83"X>,ˬC"*[d5VTWjnm3u=I4p++0Hl{`Fط)5]นiE㋾(8XHR%'E6fݷTgcz]q *!կ=TDF3 J3J!ӷ^UFXDv$E"AAp]vkM+yWG5k+tg -s<\X.v# °@yl7ԯgX~ho A!ym.T"]gd{@ +tC؎zȫsK7O8j> j2n3/ endstream endobj 21 0 obj 2583 endobj 29 0 obj <> stream x[mo_o'|7)wg(`KJ^b)!+{%;C!)90l$K3d',#}<-믑X}H=$JY\esbD42\|͓ߩKM[W96i7/_ʥ&/.Es\3bY4J(ob]1gU6:Ų!߁*a(Qdhz/l+HSVѷv'/K:]q#sK+ ck~9U 66F>6b{ץJh%:FeLn9~Ij9s& K^%Cȳ| ZCvIqWNl׮|5&ϳ-].:g+U{\Ly+q%_>υ4^iUveBzk@UԆZ>y&,n<=K7&W^YIf$cmW;!T(,@ʐZ$,sbnc?bn,`+!TWH/Ij_R07zX:!/]/vq/㟽tX9PBSZu7,W*ߢtn}r6P&pAۀR< a$t0VZ/Qwlhz( tL' keAg$ڶݴX*6{͊"Tu%RPkrcTPf8er{&LO&-$LuLPeˌrMuRrC!iC/*=BC~.^-(] 4|ԚI ]c2BTԻuUZ?Z!BP `jѪ3`¨t5WqM0ѳN>ޞTL\Xۀ5%QH+ִ=Jrwbf~$<@txOOag _?ZPL BB l6C rxT*[.(i$%a%hBb`TA,BPs({awhq'[jF*gQ.G`ʋXiO|1rß"|ޮC;vp.T-Pp&-moEq:vid֙%m,LcfRcFWc;6q6f|&:Bj'Z:&/ҨiҞ2Ej[jv1.6iUixBrqL8hzq9BXADr\ @0:L; y`JKȳM' v48472 {7T]V؋ H]7t#=>e(YbI0x i[i|T38 _yMnNqi2N};dKN(Nݪ9TsE'P'ām n-}f Ϫg( F!շ|30\rvQ&?d8+?=u XܦjrkSE}z)vB[٪L"x!OP:=ʸSSJWfH ÎOB<-~, 59scͲB12In;+Ҋ6^P M J k<ԉ's{.:؀632rY/dL[df06 5h#-'ڋ-cyW;1 RڨT @vaSuI'JD%1$\{y+x/!RP{6ɮCtҟC?d=lm[Ol':űgߎ">ݡ"H-|*>m۩>JqW&R ?:D5(g9~"ztBwMrhNeϻ2~4)8CS!ÅOeՁr~idMO!D2GpRB8s>ݶ> stream xXnE}߯ Ҵ~cBAD{w}!w <+s)A(꺜:]2V2BV_u_bu[=_.N^J)!mXHRRUBJi : *)a+ӽSڦ:6F+rwMErA)jti2U_gِKaeE M }k*%S{SD+QpUNmXsPDI7\ vC MXaܛbq8)Y~s04@ R| .źA#Y"{tYwRڧ*h%Ew_$  1yᕫoZ >)}4ClXB9UV!=rQuC >`.NIyC֫btC/7Eնl3.k~P6. ZGQNaG 󵛝cVuWU%+d-pfGTR U&(0#73pL 67~~x0KX`XQR%VuwB'BK'AOp+ PcQQ,-ګ)dUV0OH?QYS.!uT]N/BA7"iFn(§O MtQzBjFO/jj $)E?fl_g^͏n oAg5pSn",cvdt${ hc$=K4t1 =|G$K.EFu I XRBKӫ{oծ%/q:ϛր V%3L!QƧ#Ivȅ(!:sNUC[vRcK#ut^o O;'&XfHJQh(g~J M'f}ϯnX~nxeg9qR(#ɳQK|@i}^ԇb[['`1*Upz#)-)1))TDzI7w1v6L W:c͸LaxːQѪDyWRcDJȋhhևj21:(7jO?~YP @9r"^r6_q&NGI7L5& :\;p}N X&OOfi3|ZQ\%~LΗqD'w1g TJ QE*PJӒ+7xq˴ AKU6K/+½: - )3|oG4>MSf( j_ZTz<dN\/F[)azj~endstream endobj 39 0 obj 1393 endobj 4 0 obj <> /Contents 5 0 R >> endobj 13 0 obj <> /Contents 14 0 R >> endobj 19 0 obj <> /Contents 20 0 R >> endobj 28 0 obj <> /Contents 29 0 R >> endobj 37 0 obj <> /Contents 38 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 4 0 R 13 0 R 19 0 R 28 0 R 37 0 R ] /Count 5 /Rotate 0>> endobj 1 0 obj <> endobj 12 0 obj <> endobj 18 0 obj <> endobj 22 0 obj [/Indexed /DeviceRGB 15 <000000FFFFFFFEFEFE8080809B9B00F8F8F8FEFECDFEFE9BCDCD63FECD9B0404 04000000000000000000000000000000>]endobj 23 0 obj [/Indexed /DeviceRGB 15 <000000FFFFFFFEFEFE8080809C9C00F7F7F7FEFECEFEFE9CCECE63FECE9C0000 00000000000000000000000000000000>]endobj 25 0 obj <> endobj 26 0 obj <> endobj 24 0 obj <>stream xMn 'AvNUEGH}Ի, ޶ E*?<xuk*4Z^vrPsRx25Zp*UMٶ0W5"K7~ =@r# k$V'wDNeP?gzYE߆wCQ%*|.iruѰ#Or  W*=/Tp'F_#ֺhڽ?d3LֺG~ʶqރ=OߤbY5XV+oڣш*g&bTi|eM`V+S`SwWp>ý}-\a)mɲ4 0r%s;X ٕ-*J•puϮV1떡6bBm%tqJ NcQдcl! Ad,W*j[XP[aPKR~ eV^լR{ʰ|WTqmfkϊpf̭TYU e T[W=9V2WY9W+veMv%]#–v%,tTY֕*J#+jvey/ 2 )STQCO_ endstream endobj 27 0 obj <> endobj 31 0 obj [/Indexed /DeviceRGB 15 <000000FFFFFFFEFEFE9C9C00F7F7F7FEFECEFEFE9CCECE63808080FECE9C0000 00000000000000000000000000000000>]endobj 34 0 obj <> endobj 35 0 obj <> endobj 32 0 obj <>stream x]K8xA堫9 j7@/ ѷ'$~"$*;,Ό|H)An۽j6l=7>2ϗoYTQ]k)MHַ݅Z,-]X{Gq32ֺ,|эZKً鿯{6Bk;Zôփ%[GeU۲LhwCKlZI>ͣem$-wҷoپUa]]<k@Uqo{.fs߾P<^2//F~vW-q-5C㖭nZ1Sri z-/ZZy݈Zމ߀ՃMSf ) ԏ@5f/!2pl]LedA [eQ D Z(Ekw;!oOD{^'MĀZ?vV īڦ#[LFVljմ"qb6*\'?k'B&;FUO~G'?iaKkyO~"0qfu-oN=(=fv7 o .\m2[ T9Z~PxX[+S"0(\O7#@Ak]ڷ3R2!ux[ SJI $kˣ-y"e [=-j, THXV $7FB3b|,to-G+#iq wyM1 ffkO1$ ݨJbL}<*.f ~)BHzme~蔸 2GQ LR@ bP)Io X-3(| ]^DW;oA{' BJJ;D BxSVOeIcq xd۪>k{xgXhZD#Zi[ 4:eռ65f-75@polVeY& Φ %d|n)^.z{ݜhZw*-Zc@l5P!["&A,y:` b>"$A򌯖20 7a O T,k]H m9%@dՎ2P+̠ "R2}A9dWSZ쾠b2Q:Ja5=3 0Ff("2Ft 2pT=e`SE;,d Ѻ iaѴ8 g^S"Kю>/Edi.2VHmyk\NGVOd`EDof@) X < 0ש쀅2p H&mڗ\\d)UqmW.iLէ0*(\l 3[T >^DV<.2 ^$ ,¹߄WMRZ 2Mj\ uJP 3w}|QU9 'l/}2si~*o`)vZ~2PJOF, ^ dxA;[]"""? ZN6<RZP]J v%@\-'r늘 E!ub5'?FDŽYGPj\'JRiku[ `#\2EXhp+A"|~ZiTZk&{'YȽǣNz]-Qv(qwE6MŢypKkw4P!H79rD_f6a Ғ1;2IqKvk nikݔS p3VxIEWp+<IEW0+?! endstream endobj 36 0 obj <> endobj 40 0 obj <> endobj 7 0 obj <> endobj 41 0 obj <> endobj 17 0 obj <> endobj 9 0 obj <> endobj 42 0 obj <> endobj 33 0 obj <> endobj 10 0 obj <> endobj 8 0 obj <> endobj 11 0 obj <> endobj 16 0 obj <> endobj 2 0 obj <>endobj xref 0 43 0000000000 65535 f 0000014977 00000 n 0000021309 00000 n 0000014881 00000 n 0000014061 00000 n 0000000015 00000 n 0000002054 00000 n 0000020611 00000 n 0000021103 00000 n 0000020823 00000 n 0000021033 00000 n 0000021165 00000 n 0000015025 00000 n 0000014203 00000 n 0000002074 00000 n 0000006819 00000 n 0000021232 00000 n 0000020755 00000 n 0000015095 00000 n 0000014347 00000 n 0000006840 00000 n 0000009495 00000 n 0000015167 00000 n 0000015307 00000 n 0000015522 00000 n 0000015447 00000 n 0000015490 00000 n 0000016273 00000 n 0000014542 00000 n 0000009516 00000 n 0000012554 00000 n 0000016323 00000 n 0000016527 00000 n 0000020971 00000 n 0000016463 00000 n 0000016495 00000 n 0000020478 00000 n 0000014737 00000 n 0000012575 00000 n 0000014040 00000 n 0000020550 00000 n 0000020691 00000 n 0000020911 00000 n trailer << /Size 43 /Root 1 0 R /Info 2 0 R /ID [<3B8C14F28F964B1E699C431702BF1F96><3B8C14F28F964B1E699C431702BF1F96>] >> startxref 21584 %%EOF z88dk-1.8.ds1/support/winstall/z88dk.iss0000755000175000017500000001262610253772026017563 0ustar tygrystygrys; z88dk setup sript, by Marcello Zaniboni (www.geocities.com/marcellozaniboni) ; This script works with Inno Setup Compiler (www.jrsoftware.org/isinfo.php); ; if you want to run it, edit SourceDir and OutputDir properly. ; [Setup] InternalCompressLevel=max SolidCompression=true MinVersion=4.90.3000,4.0.1381 AppCopyright=z88dk.org AppName=z88dk 1.6 AppVerName=z88dk 1.6 InfoAfterFile=setup\read_after.txt InfoBeforeFile=setup\read_before.txt WizardImageFile=setup\icons\z88dk_Image.bmp DefaultGroupName=z88dk 1.6 OutputDir=C:\z88dk\setup OutputBaseFilename=z88dk-1.6-setup ShowLanguageDialog=auto AppID=z88dk_1.6_uninstall AppPublisher=http://www.z88dk.org AppPublisherURL=http://www.z88dk.org AppSupportURL=http://www.z88dk.org AppVersion=1.6 DefaultDirName={pf}\z88dk AppComments=created by z88dk setup UninstallDisplayName=z88dk - setup SetupIconFile=setup\icons\z88dk.ico SourceDir=C:\z88dk VersionInfoVersion=1.6 VersionInfoCompany=z88dk VersionInfoDescription=z88dk setup VersionInfoTextVersion=1.6 beta ChangesEnvironment=true AppUpdatesURL=http://www.z88dk.org AppContact=http://www.z88dk.org WizardSmallImageFile=setup\icons\z88dk_SmallImage.bmp LicenseFile=LICENSE DisableStartupPrompt=false FlatComponentsList=false [Components] Name: z88dk; Description: The z80 C cross compiler; Types: custom compact full; Flags: fixed Name: doc; Description: Compiler documentation; Types: custom full Name: examples; Description: Examples; Types: custom full Name: optdoc; Description: Additional compiler documentation; Types: custom full Name: source; Description: Compiler source files; Types: custom full Name: support; Description: Source code for old support programs (to allow conversion into a form suitable for loading into emulators or simulators); Types: custom full [Files] ; Mandatory files Source: setup\setup_ext\deploy_z88dk.exe; DestDir: {tmp}; Flags: deleteafterinstall; Components: z88dk Source: setup\setup_ext\cfgs\*; DestDir: {tmp}; Flags: deleteafterinstall; Components: z88dk Source: LICENSE; DestDir: {app}; Components: z88dk Source: noarch\EXTENSIONS; DestDir: {app}; Components: z88dk Source: bin\*; DestDir: {app}\bin; Components: z88dk Source: lib\config\*; DestDir: {app}\lib\config; Components: z88dk Source: noarch\include\*; DestDir: {app}\include; Components: z88dk Source: noarch\include\net\*; DestDir: {app}\include\net; Components: z88dk Source: noarch\include\oz\*; DestDir: {app}\include\oz; Components: z88dk Source: noarch\include\oz700\*; DestDir: {app}\include\oz700; Components: z88dk Source: noarch\include\rex\*; DestDir: {app}\include\rex; Components: z88dk Source: noarch\include\sys\*; DestDir: {app}\include\sys; Components: z88dk Source: noarch\lib\*; DestDir: {app}\lib Source: noarch\lib\clibs\*; DestDir: {app}\lib\clibs Source: noarch\lib\config\*; DestDir: {app}\lib\config ; Optional files Source: noarch\examples\*; DestDir: {app}\examples; Components: examples Source: noarch\examples\ace\*; DestDir: {app}\examples\ace; Components: examples Source: noarch\examples\console\*; DestDir: {app}\examples\console; Components: examples Source: noarch\examples\embedded\*; DestDir: {app}\examples\embedded; Components: examples Source: noarch\examples\graphics\*; DestDir: {app}\examples\graphics; Components: examples Source: noarch\examples\rex\*; DestDir: {app}\examples\rex; Components: examples Source: noarch\examples\sam\*; DestDir: {app}\examples\sam; Components: examples Source: noarch\examples\sound\*; DestDir: {app}\examples\sound; Components: examples Source: noarch\examples\spectrum\*; DestDir: {app}\examples\spectrum; Components: examples Source: noarch\examples\ticalc\*; DestDir: {app}\examples\ticalc; Components: examples Source: noarch\examples\vz\*; DestDir: {app}\examples\vz; Components: examples Source: noarch\examples\z88\*; DestDir: {app}\examples\z88; Components: examples Source: noarch\examples\zx81\*; DestDir: {app}\examples\zx81; Components: examples Source: noarch\examples\zxvgs\*; DestDir: {app}\examples\zxvgs; Components: examples Source: noarch\src\*; DestDir: {app}\src; Components: source Source: noarch\libsrc\*; DestDir: {app}\libsrc; Components: source Source: noarch\doc\*; DestDir: {app}\doc; Components: doc Source: noarch\doc\netman\*; DestDir: {app}\doc\netman; Components: doc Source: noarch\support\*; DestDir: {app}\support; Components: support Source: noarch\www\*; DestDir: {app}\www; Components: optdoc Source: noarch\www\pics\*; DestDir: {app}\www\pics; Components: optdoc Source: noarch\www\old\*; DestDir: {app}\www\old; Components: optdoc [Registry] ; Win NT platforms Root: HKCU; Subkey: Environment; ValueType: string; ValueName: Z80_OZFILES; ValueData: {app}\lib\; Flags: uninsdeletevalue; MinVersion: 0,4.0.1381 Root: HKCU; Subkey: Environment; ValueType: string; ValueName: ZCCCFG; ValueData: {app}\lib\config\; Flags: uninsdeletevalue; MinVersion: 0,4.0.1381 ; Win ME platform Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\SessionManager\Environment; ValueType: string; ValueName: Z80_OZFILES; ValueData: {app}\lib\; MinVersion: 4.90.3000,0; Flags: uninsdeletekey Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\SessionManager\Environment; ValueType: string; ValueName: ZCCCFG; ValueData: {app}\lib\config\; MinVersion: 4.90.3000,0; Flags: uninsdeletekey [Run] Filename: {tmp}\deploy_z88dk.exe; WorkingDir: {tmp}; Flags: hidewizard; Parameters: """{app}"""; StatusMsg: Please wait a little bit... z88dk-1.8.ds1/support/X11/0000755000175000017500000000000010765202715014576 5ustar tygrystygrysz88dk-1.8.ds1/support/X11/bdf2c.awk0000755000175000017500000000234710732675645016305 0ustar tygrystygrys# bdf2c.awk # # Convert a BDF font into C language sprite definitions # suitable to work with the z88dk X11/Xlib library emulation # # $Id: bdf2c.awk,v 1.1 2007/12/21 08:39:01 stefano Exp $ # BEGIN { FS = "[ \t]*" datamode = 0; commentchars = 1; width = 0; height = 0; print "char _font[] = { "; } { if (match($1,/FONT/)) { print "// " $2; next; } if (match($1,/STARTCHAR/)) { print "// " $2; if ($2 == "space") commentchars = 0; if (commentchars != 0) { print "/*" } next; } if (datamode == 1) { if (match($1,/ENDCHAR/)) { datamode = 0; if (commentchars != 0) { print "*/" } next; } if (length($1) == 2) print "0x" $1 "," else print "0x" substr($1,1,2) ", 0x" substr($1,3,2) "," } if (match($1,/DWIDTH/)) { width = $2; next; } if (match($1,/BBX/)) { height = $3; next; } if (match($1,/BITMAP/)) { datamode = 1; if (height == 0) print width "," 1 "," 0 "," else print width "," height "," next; } next; } END { print 0 " };" }z88dk-1.8.ds1/support/z88/0000755000175000017500000000000010765202715014656 5ustar tygrystygrysz88dk-1.8.ds1/support/zx/0000755000175000017500000000000010765202715014666 5ustar tygrystygrysz88dk-1.8.ds1/support/zx/bin2bas-rem.c0000644000175000017500000000726710553474742017155 0ustar tygrystygrys/* * Usage: bin2rem [binfile] [tapfile] * * Dominic Morris - 08/02/2000 - tapmaker * Stefano Bodrato - 03/12/2000 - bin2tap * Stefano Bodrato - 13/09/2001 - bin2bas-rem * * Creates a new TAP file (overwriting if necessary) with a BASIC program line * in which we store the self-relocating binary file as if it was a REMark. * * To compile a relocatable program: * zcc +zx -Ca-R -lm -lndos program.c * bin2bas-rem a.bin a.tap * * To run the machine code: * PRINT USR (PEEK 23635+256*PEEK 23636+5) * - or - * 1 DEF FN l()=USR(PEEK 23637+256*PEEK 23638+5) * 100 LET x=FN l() * 101 REM (program) * 200 LET x=FN l() * 201 REM (another merged program) * * * Warning: most of the fcntl drivers just won't run; in that case BASIC is moved, in fact. * DO NOT edit the REM line. You need to place it at its right position with this tool. * * Hint: if you are in trouble try to MERGE the REM lines again in to you main BASIC block. * * * $Id: bin2bas-rem.c,v 1.4 2007/01/17 19:32:50 stefano Exp $ */ #include /* Stefano reckons stdlib.h is needed for binary files for Win compilers*/ #include unsigned char parity; void writebyte(unsigned char, FILE *); void writeword(unsigned int, FILE *); void writestring(char *mystring, FILE *fp); int main(int argc, char *argv[]) { char name[11]; char mybuf[20]; FILE *fpin, *fpout; int c; int i; int len; int bline; if ((argc < 3 )||(argc > 4 )) { fprintf(stdout,"Usage: %s [code file] [tap file] \n",argv[0]); exit(1); } bline=1; if (argc == 4 ) { bline=atoi(argv[3]); } if ( (fpin=fopen(argv[1],"rb") ) == NULL ) { fprintf(stderr,"Can't open input file\n"); exit(1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { fprintf(stderr,"Couldn't determine size of file\n"); fclose(fpin); exit(1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(argv[2],"wb") ) == NULL ) { fprintf(stdout,"Can't open output file\n"); exit(1); } /* BASIC loader */ /* Write out the BASIC header file */ writeword(19,fpout); /* Header len */ writebyte(0,fpout); /* Header is 0 */ parity=0; writebyte(0,fpout); /* Filetype (Basic) */ writestring("REM line ",fpout); writeword(6+len,fpout); /* length */ writeword(0x802E,fpout); /* line for auto-start */ writeword(6+len,fpout); /* length (?) */ writebyte(parity,fpout); /* Write out the BASIC program */ writeword(8+len,fpout); /* block lenght */ parity=0; writebyte(255,fpout); /* Data... */ writebyte(bline/256,fpout); /* MSB of BASIC line number */ writebyte(bline%256,fpout); /* MSB of BASIC line number */ writeword(2+len,fpout); /* BASIC line length */ writebyte(0xEA,fpout); /* REM */ /* BIN stuff */ /* eat the first 4 bytes */ c=getc(fpin); c=getc(fpin); c=getc(fpin); c=getc(fpin); /* replace with the ZX Spectrum specific ones */ writebyte(0xC5,fpout); /* push bc */ writebyte(0xC5,fpout); /* push bc */ writebyte(0xFD,fpout); /* --- */ writebyte(0xE1,fpout); /* pop iy */ for (i=0; i<(len-4);i++) { c=getc(fpin); writebyte(c,fpout); } writebyte(0x0d,fpout); /* ENTER (end of BASIC line) */ writebyte(parity,fpout); fclose(fpin); fclose(fpout); } void writeword(unsigned int i, FILE *fp) { writebyte(i%256,fp); writebyte(i/256,fp); } void writebyte(unsigned char c, FILE *fp) { fputc(c,fp); parity^=c; } void writestring(char *mystring, FILE *fp) { char p; for (p=0; p < strlen(mystring); p++) { writebyte(mystring[p],fp); } } z88dk-1.8.ds1/support/zx/README0000644000175000017500000000171507350150521015543 0ustar tygrystygrys$Id: README,v 1.4 2001/09/13 15:31:29 stefano Exp $ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TAPMAKER: This is a quick and dirty hack originally written for mymzx - this takes any file and creates a .TAP file for it - the file contained is of type CODE and loads to address 0. This tool appends to the end of the specified .TAP file so watch out! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BIN2TAP: Creates .TAP file with a very simple BASIC loader at the beginning. After converting, a LOAD "" is sufficient to run your code ! Warning: this tool OVERWRITES the specified .TAP file !!! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BIN2BAS-REM: For skilled users only. Creates a .TAP file with a single BASIC REM line inside. The line has the binary code in it... Warning: this tool OVERWRITES the specified .TAP file !!! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - z88dk-1.8.ds1/support/zx/tapmaker.c0000644000175000017500000000441107365216303016636 0ustar tygrystygrys/* * Quick 'n' dirty mym to tap converter * * Usage: mym2tap [mymfile] [tapfile] * * zack 8/2/2000 * * Actually..can be used for any CODE file * And we append so we can create mega files... * * Stefano 23/10/2001 - ORG Parameter added * * $Id: tapmaker.c,v 1.4 2001/10/23 07:31:15 stefano Exp $ */ #include /* Stefano reckons stdlib.h is needed for binary files for Win compilers*/ #include unsigned char parity; void writebyte(unsigned char, FILE *); void writeword(unsigned int, FILE *); int main(int argc, char *argv[]) { char name[11]; FILE *fpin, *fpout; int c; int i; int len; int pos; if ((argc < 3 )||(argc > 4 )) { fprintf(stdout,"Usage: %s [code file] [tap file] \n",argv[0]); exit(1); } pos=32768; if (argc == 4 ) { pos=atoi(argv[3]); } if ( (fpin=fopen(argv[1],"rb") ) == NULL ) { printf("Can't open input file\n"); exit(1); } /* * Now we try to determine the size of the file * to be converted */ if (fseek(fpin,0,SEEK_END)) { printf("Couldn't determine size of file\n"); fclose(fpin); exit(1); } len=ftell(fpin); fseek(fpin,0L,SEEK_SET); if ( (fpout=fopen(argv[2],"a+b") ) == NULL ) { printf("Can't open output file\n"); exit(1); } /* Write out the header file */ writeword(19,fpout); /* Header len */ writebyte(0,fpout); /* Header is 0 */ parity=0; writebyte(3,fpout); /* Filetype (Code) */ /* Deal with the filename */ if (strlen(argv[1]) >= 10 ) { strncpy(name,argv[1],10); } else { strcpy(name,argv[1]); strncat(name," ",10-strlen(argv[1])); } for (i=0;i<=9;i++) writebyte(name[i],fpout); writeword(len,fpout); writeword(pos,fpout); /* load address */ writeword(0,fpout); /* offset */ writebyte(parity,fpout); /* Now onto the data bit */ writeword(len+2,fpout); /* Length of next block */ parity=0; writebyte(255,fpout); /* Data... */ for (i=0; i 7499 - query driver description s$ = Name/Description 7500 - OPEN sequential file s=stream number (4-15); the ASM part detects the existence of the channel and handles a "file not found" condition if it is missing f=mode flag (0=read, 256=write, etc..) d=drive number (it is extracted from the file name, see above) n$=file name 7550 - CLOSE sequential file s=stream number 7600 - LOAD block a=address or 0 if unspecified l=length or 0 if unspecified d=drive number n$=file name 7650 - SAVE block a=addess l=length d=drive number n$=file name 7700 - Init printer channel (open #3) Optionally you can handle a "file name" to redirect the printer output. This entry works as a sort of "OPEN" command, but the stream number must be forced to #3. 7750 - Close printer channel (close #3) 7800 - Do hardcopy (or dump screen to file, or whatever you prefer) 7900 - DELETE file d=drive number n$=file name 7950 - RENAME file d=drive number n$=old file name o$=new file name z88dk-1.8.ds1/support/zx81/0000755000175000017500000000000010765202715015037 5ustar tygrystygrysz88dk-1.8.ds1/test/0000755000175000017500000000000010765202715013470 5ustar tygrystygrysz88dk-1.8.ds1/test/machine/0000755000175000017500000000000010765202715015074 5ustar tygrystygrysz88dk-1.8.ds1/test/machine/cmds.h0000644000175000017500000000040610702233416016164 0ustar tygrystygrys #ifndef CMDS_H #define CMDS_H #define CMD_EXIT 0 /**< Exit, hl holds return value */ #define CMD_PRINTCHAR 1 /**< Print character, hl holds character to print */ #define CMD_READKEY 2 /**< Read console, hl holds the pressed key */ #endif z88dk-1.8.ds1/test/machine/main.c0000644000175000017500000000433010702513122016150 0ustar tygrystygrys #include "Z80/Z80.h" #include #include #include #include #include #include "cmds.h" static Z80 z80; static int quitting; byte RAM[65536]; #if 0 byte DebugZ80(register Z80 *R) { printf("\tAF=%04x BC=%04x DE=%04x HL=%04x IX=%04x IY=%04x\n" "\tAF'%04x BC'%04x DE'%04x HL'%04x PC=%04x SP=%04x\n", R->AF.W, R->BC.W, R->DE.W, R->HL.W, R->IX.W, R->IY.W, R->AF1.W, R->BC1.W, R->DE1.W, R->HL1.W, R->PC.W, R->SP.W); } #endif word LoopZ80(Z80 *R) { if ( quitting ) { return INT_QUIT; } return INT_NONE; } void PatchZ80(Z80 *R) { int val; switch (R->AF.B.h ) { case CMD_EXIT: exit(R->HL.B.l); case CMD_PRINTCHAR: if ( R->HL.B.l == '\n' || R->HL.B.l == '\r' ) { fputc('\n',stdout); } else { fputc(R->HL.B.l,stdout); } fflush(stdout); break; case CMD_READKEY: val = getchar(); R->HL.W = val; break; default: printf("Unknown code %d\n",R->AF.B.h); exit(1); } } /* Patching instruction: * * a = code */ void JumpZ80(word PC) { // printf("Jumping to %d\n",(int)PC); } static char *load_file(char *filename) { FILE *fp; if ( ( fp = fopen(filename,"rb") ) == NULL ) { printf("Cannot load file %s\n",filename); exit(1); } fread(&RAM[0], sizeof(RAM[0]), 65536, fp); fclose(fp); } static void sighandler(int sig) { quitting = 1; } int main(int argc, char *argv[]) { int ch; int alarmtime = 30; char *progname = argv[0]; while ( ( ch = getopt(argc, argv, "w:")) != -1 ) { switch ( ch ) { case 'w': alarmtime = atoi(optarg); break; } } argc -= optind; argv += optind; if ( argc < 1 ) { printf("Usage: %s [program to run]\n", progname); exit(1); } /* Clear memory */ memset(RAM,0,sizeof(RAM)); signal(SIGALRM, sighandler); if ( alarmtime != -1 ) { alarm(alarmtime); /* Abort a test run if it's been too long */ } /* Reset the machine */ ResetZ80(&z80); load_file(argv[0]); RunZ80(&z80); return 1; } z88dk-1.8.ds1/test/machine/Makefile0000644000175000017500000000042310702217026016523 0ustar tygrystygrys SOURCES = main.c Z80/Debug.c Z80/Z80.c OBJECTS = $(SOURCES:.c=.o) HEADERS = CFLAGS = -DZ88DK -DJUMPZ80 -DDEBUG2 -DLSB_FIRST all: machine %.o: %.c $(HEADERS) gcc -c -o $@ $(CFLAGS) $< machine: $(OBJECTS) gcc -o $@ $(OBJECTS) clean: rm -f $(OBJECTS) machine *~ z88dk-1.8.ds1/test/machine/Z80/0000755000175000017500000000000010765202715015455 5ustar tygrystygrysz88dk-1.8.ds1/test/machine/Z80/Codes.h0000644000175000017500000003267710702217026016672 0ustar tygrystygrys/** Z80: portable Z80 emulator *******************************/ /** **/ /** Codes.h **/ /** **/ /** This file contains implementation for the main table of **/ /** Z80 commands. It is included from Z80.c. **/ /** **/ /** Copyright (C) Marat Fayzullin 1994-2007 **/ /** You are not allowed to distribute this software **/ /** commercially. Please, notify me, if you make any **/ /** changes to this file. **/ /*************************************************************/ case JR_NZ: if(R->AF.B.l&Z_FLAG) R->PC.W++; else { R->ICount-=5;M_JR; } break; case JR_NC: if(R->AF.B.l&C_FLAG) R->PC.W++; else { R->ICount-=5;M_JR; } break; case JR_Z: if(R->AF.B.l&Z_FLAG) { R->ICount-=5;M_JR; } else R->PC.W++; break; case JR_C: if(R->AF.B.l&C_FLAG) { R->ICount-=5;M_JR; } else R->PC.W++; break; case JP_NZ: if(R->AF.B.l&Z_FLAG) R->PC.W+=2; else { M_JP; } break; case JP_NC: if(R->AF.B.l&C_FLAG) R->PC.W+=2; else { M_JP; } break; case JP_PO: if(R->AF.B.l&P_FLAG) R->PC.W+=2; else { M_JP; } break; case JP_P: if(R->AF.B.l&S_FLAG) R->PC.W+=2; else { M_JP; } break; case JP_Z: if(R->AF.B.l&Z_FLAG) { M_JP; } else R->PC.W+=2; break; case JP_C: if(R->AF.B.l&C_FLAG) { M_JP; } else R->PC.W+=2; break; case JP_PE: if(R->AF.B.l&P_FLAG) { M_JP; } else R->PC.W+=2; break; case JP_M: if(R->AF.B.l&S_FLAG) { M_JP; } else R->PC.W+=2; break; case RET_NZ: if(!(R->AF.B.l&Z_FLAG)) { R->ICount-=6;M_RET; } break; case RET_NC: if(!(R->AF.B.l&C_FLAG)) { R->ICount-=6;M_RET; } break; case RET_PO: if(!(R->AF.B.l&P_FLAG)) { R->ICount-=6;M_RET; } break; case RET_P: if(!(R->AF.B.l&S_FLAG)) { R->ICount-=6;M_RET; } break; case RET_Z: if(R->AF.B.l&Z_FLAG) { R->ICount-=6;M_RET; } break; case RET_C: if(R->AF.B.l&C_FLAG) { R->ICount-=6;M_RET; } break; case RET_PE: if(R->AF.B.l&P_FLAG) { R->ICount-=6;M_RET; } break; case RET_M: if(R->AF.B.l&S_FLAG) { R->ICount-=6;M_RET; } break; case CALL_NZ: if(R->AF.B.l&Z_FLAG) R->PC.W+=2; else { R->ICount-=7;M_CALL; } break; case CALL_NC: if(R->AF.B.l&C_FLAG) R->PC.W+=2; else { R->ICount-=7;M_CALL; } break; case CALL_PO: if(R->AF.B.l&P_FLAG) R->PC.W+=2; else { R->ICount-=7;M_CALL; } break; case CALL_P: if(R->AF.B.l&S_FLAG) R->PC.W+=2; else { R->ICount-=7;M_CALL; } break; case CALL_Z: if(R->AF.B.l&Z_FLAG) { R->ICount-=7;M_CALL; } else R->PC.W+=2; break; case CALL_C: if(R->AF.B.l&C_FLAG) { R->ICount-=7;M_CALL; } else R->PC.W+=2; break; case CALL_PE: if(R->AF.B.l&P_FLAG) { R->ICount-=7;M_CALL; } else R->PC.W+=2; break; case CALL_M: if(R->AF.B.l&S_FLAG) { R->ICount-=7;M_CALL; } else R->PC.W+=2; break; case ADD_B: M_ADD(R->BC.B.h);break; case ADD_C: M_ADD(R->BC.B.l);break; case ADD_D: M_ADD(R->DE.B.h);break; case ADD_E: M_ADD(R->DE.B.l);break; case ADD_H: M_ADD(R->HL.B.h);break; case ADD_L: M_ADD(R->HL.B.l);break; case ADD_A: M_ADD(R->AF.B.h);break; case ADD_xHL: I=RdZ80(R->HL.W);M_ADD(I);break; case ADD_BYTE: I=OpZ80(R->PC.W++);M_ADD(I);break; case SUB_B: M_SUB(R->BC.B.h);break; case SUB_C: M_SUB(R->BC.B.l);break; case SUB_D: M_SUB(R->DE.B.h);break; case SUB_E: M_SUB(R->DE.B.l);break; case SUB_H: M_SUB(R->HL.B.h);break; case SUB_L: M_SUB(R->HL.B.l);break; case SUB_A: R->AF.B.h=0;R->AF.B.l=N_FLAG|Z_FLAG;break; case SUB_xHL: I=RdZ80(R->HL.W);M_SUB(I);break; case SUB_BYTE: I=OpZ80(R->PC.W++);M_SUB(I);break; case AND_B: M_AND(R->BC.B.h);break; case AND_C: M_AND(R->BC.B.l);break; case AND_D: M_AND(R->DE.B.h);break; case AND_E: M_AND(R->DE.B.l);break; case AND_H: M_AND(R->HL.B.h);break; case AND_L: M_AND(R->HL.B.l);break; case AND_A: M_AND(R->AF.B.h);break; case AND_xHL: I=RdZ80(R->HL.W);M_AND(I);break; case AND_BYTE: I=OpZ80(R->PC.W++);M_AND(I);break; case OR_B: M_OR(R->BC.B.h);break; case OR_C: M_OR(R->BC.B.l);break; case OR_D: M_OR(R->DE.B.h);break; case OR_E: M_OR(R->DE.B.l);break; case OR_H: M_OR(R->HL.B.h);break; case OR_L: M_OR(R->HL.B.l);break; case OR_A: M_OR(R->AF.B.h);break; case OR_xHL: I=RdZ80(R->HL.W);M_OR(I);break; case OR_BYTE: I=OpZ80(R->PC.W++);M_OR(I);break; case ADC_B: M_ADC(R->BC.B.h);break; case ADC_C: M_ADC(R->BC.B.l);break; case ADC_D: M_ADC(R->DE.B.h);break; case ADC_E: M_ADC(R->DE.B.l);break; case ADC_H: M_ADC(R->HL.B.h);break; case ADC_L: M_ADC(R->HL.B.l);break; case ADC_A: M_ADC(R->AF.B.h);break; case ADC_xHL: I=RdZ80(R->HL.W);M_ADC(I);break; case ADC_BYTE: I=OpZ80(R->PC.W++);M_ADC(I);break; case SBC_B: M_SBC(R->BC.B.h);break; case SBC_C: M_SBC(R->BC.B.l);break; case SBC_D: M_SBC(R->DE.B.h);break; case SBC_E: M_SBC(R->DE.B.l);break; case SBC_H: M_SBC(R->HL.B.h);break; case SBC_L: M_SBC(R->HL.B.l);break; case SBC_A: M_SBC(R->AF.B.h);break; case SBC_xHL: I=RdZ80(R->HL.W);M_SBC(I);break; case SBC_BYTE: I=OpZ80(R->PC.W++);M_SBC(I);break; case XOR_B: M_XOR(R->BC.B.h);break; case XOR_C: M_XOR(R->BC.B.l);break; case XOR_D: M_XOR(R->DE.B.h);break; case XOR_E: M_XOR(R->DE.B.l);break; case XOR_H: M_XOR(R->HL.B.h);break; case XOR_L: M_XOR(R->HL.B.l);break; case XOR_A: R->AF.B.h=0;R->AF.B.l=P_FLAG|Z_FLAG;break; case XOR_xHL: I=RdZ80(R->HL.W);M_XOR(I);break; case XOR_BYTE: I=OpZ80(R->PC.W++);M_XOR(I);break; case CP_B: M_CP(R->BC.B.h);break; case CP_C: M_CP(R->BC.B.l);break; case CP_D: M_CP(R->DE.B.h);break; case CP_E: M_CP(R->DE.B.l);break; case CP_H: M_CP(R->HL.B.h);break; case CP_L: M_CP(R->HL.B.l);break; case CP_A: R->AF.B.l=N_FLAG|Z_FLAG;break; case CP_xHL: I=RdZ80(R->HL.W);M_CP(I);break; case CP_BYTE: I=OpZ80(R->PC.W++);M_CP(I);break; case LD_BC_WORD: M_LDWORD(BC);break; case LD_DE_WORD: M_LDWORD(DE);break; case LD_HL_WORD: M_LDWORD(HL);break; case LD_SP_WORD: M_LDWORD(SP);break; case LD_PC_HL: R->PC.W=R->HL.W;JumpZ80(R->PC.W);break; case LD_SP_HL: R->SP.W=R->HL.W;break; case LD_A_xBC: R->AF.B.h=RdZ80(R->BC.W);break; case LD_A_xDE: R->AF.B.h=RdZ80(R->DE.W);break; case ADD_HL_BC: M_ADDW(HL,BC);break; case ADD_HL_DE: M_ADDW(HL,DE);break; case ADD_HL_HL: M_ADDW(HL,HL);break; case ADD_HL_SP: M_ADDW(HL,SP);break; case DEC_BC: R->BC.W--;break; case DEC_DE: R->DE.W--;break; case DEC_HL: R->HL.W--;break; case DEC_SP: R->SP.W--;break; case INC_BC: R->BC.W++;break; case INC_DE: R->DE.W++;break; case INC_HL: R->HL.W++;break; case INC_SP: R->SP.W++;break; case DEC_B: M_DEC(R->BC.B.h);break; case DEC_C: M_DEC(R->BC.B.l);break; case DEC_D: M_DEC(R->DE.B.h);break; case DEC_E: M_DEC(R->DE.B.l);break; case DEC_H: M_DEC(R->HL.B.h);break; case DEC_L: M_DEC(R->HL.B.l);break; case DEC_A: M_DEC(R->AF.B.h);break; case DEC_xHL: I=RdZ80(R->HL.W);M_DEC(I);WrZ80(R->HL.W,I);break; case INC_B: M_INC(R->BC.B.h);break; case INC_C: M_INC(R->BC.B.l);break; case INC_D: M_INC(R->DE.B.h);break; case INC_E: M_INC(R->DE.B.l);break; case INC_H: M_INC(R->HL.B.h);break; case INC_L: M_INC(R->HL.B.l);break; case INC_A: M_INC(R->AF.B.h);break; case INC_xHL: I=RdZ80(R->HL.W);M_INC(I);WrZ80(R->HL.W,I);break; case RLCA: I=R->AF.B.h&0x80? C_FLAG:0; R->AF.B.h=(R->AF.B.h<<1)|I; R->AF.B.l=(R->AF.B.l&~(C_FLAG|N_FLAG|H_FLAG))|I; break; case RLA: I=R->AF.B.h&0x80? C_FLAG:0; R->AF.B.h=(R->AF.B.h<<1)|(R->AF.B.l&C_FLAG); R->AF.B.l=(R->AF.B.l&~(C_FLAG|N_FLAG|H_FLAG))|I; break; case RRCA: I=R->AF.B.h&0x01; R->AF.B.h=(R->AF.B.h>>1)|(I? 0x80:0); R->AF.B.l=(R->AF.B.l&~(C_FLAG|N_FLAG|H_FLAG))|I; break; case RRA: I=R->AF.B.h&0x01; R->AF.B.h=(R->AF.B.h>>1)|(R->AF.B.l&C_FLAG? 0x80:0); R->AF.B.l=(R->AF.B.l&~(C_FLAG|N_FLAG|H_FLAG))|I; break; case RST00: M_RST(0x0000);break; case RST08: M_RST(0x0008);break; case RST10: M_RST(0x0010);break; case RST18: M_RST(0x0018);break; case RST20: M_RST(0x0020);break; case RST28: M_RST(0x0028);break; case RST30: M_RST(0x0030);break; case RST38: M_RST(0x0038);break; case PUSH_BC: M_PUSH(BC);break; case PUSH_DE: M_PUSH(DE);break; case PUSH_HL: M_PUSH(HL);break; case PUSH_AF: M_PUSH(AF);break; case POP_BC: M_POP(BC);break; case POP_DE: M_POP(DE);break; case POP_HL: M_POP(HL);break; case POP_AF: M_POP(AF);break; case DJNZ: if(--R->BC.B.h) { R->ICount-=5;M_JR; } else R->PC.W++;break; case JP: M_JP;break; case JR: M_JR;break; case CALL: M_CALL;break; case RET: M_RET;break; case SCF: S(C_FLAG);R(N_FLAG|H_FLAG);break; case CPL: R->AF.B.h=~R->AF.B.h;S(N_FLAG|H_FLAG);break; case NOP: break; case OUTA: I=OpZ80(R->PC.W++);OutZ80(I|(R->AF.W&0xFF00),R->AF.B.h);break; case INA: I=OpZ80(R->PC.W++);R->AF.B.h=InZ80(I|(R->AF.W&0xFF00));break; case HALT: R->PC.W--; R->IFF|=IFF_HALT; R->IBackup=0; R->ICount=0; break; case DI: if(R->IFF&IFF_EI) R->ICount+=R->IBackup-1; R->IFF&=~(IFF_1|IFF_2|IFF_EI); break; case EI: if(!(R->IFF&(IFF_1|IFF_EI))) { R->IFF|=IFF_2|IFF_EI; R->IBackup=R->ICount; R->ICount=1; } break; case CCF: R->AF.B.l^=C_FLAG;R(N_FLAG|H_FLAG); R->AF.B.l|=R->AF.B.l&C_FLAG? 0:H_FLAG; break; case EXX: J.W=R->BC.W;R->BC.W=R->BC1.W;R->BC1.W=J.W; J.W=R->DE.W;R->DE.W=R->DE1.W;R->DE1.W=J.W; J.W=R->HL.W;R->HL.W=R->HL1.W;R->HL1.W=J.W; break; case EX_DE_HL: J.W=R->DE.W;R->DE.W=R->HL.W;R->HL.W=J.W;break; case EX_AF_AF: J.W=R->AF.W;R->AF.W=R->AF1.W;R->AF1.W=J.W;break; case LD_B_B: R->BC.B.h=R->BC.B.h;break; case LD_C_B: R->BC.B.l=R->BC.B.h;break; case LD_D_B: R->DE.B.h=R->BC.B.h;break; case LD_E_B: R->DE.B.l=R->BC.B.h;break; case LD_H_B: R->HL.B.h=R->BC.B.h;break; case LD_L_B: R->HL.B.l=R->BC.B.h;break; case LD_A_B: R->AF.B.h=R->BC.B.h;break; case LD_xHL_B: WrZ80(R->HL.W,R->BC.B.h);break; case LD_B_C: R->BC.B.h=R->BC.B.l;break; case LD_C_C: R->BC.B.l=R->BC.B.l;break; case LD_D_C: R->DE.B.h=R->BC.B.l;break; case LD_E_C: R->DE.B.l=R->BC.B.l;break; case LD_H_C: R->HL.B.h=R->BC.B.l;break; case LD_L_C: R->HL.B.l=R->BC.B.l;break; case LD_A_C: R->AF.B.h=R->BC.B.l;break; case LD_xHL_C: WrZ80(R->HL.W,R->BC.B.l);break; case LD_B_D: R->BC.B.h=R->DE.B.h;break; case LD_C_D: R->BC.B.l=R->DE.B.h;break; case LD_D_D: R->DE.B.h=R->DE.B.h;break; case LD_E_D: R->DE.B.l=R->DE.B.h;break; case LD_H_D: R->HL.B.h=R->DE.B.h;break; case LD_L_D: R->HL.B.l=R->DE.B.h;break; case LD_A_D: R->AF.B.h=R->DE.B.h;break; case LD_xHL_D: WrZ80(R->HL.W,R->DE.B.h);break; case LD_B_E: R->BC.B.h=R->DE.B.l;break; case LD_C_E: R->BC.B.l=R->DE.B.l;break; case LD_D_E: R->DE.B.h=R->DE.B.l;break; case LD_E_E: R->DE.B.l=R->DE.B.l;break; case LD_H_E: R->HL.B.h=R->DE.B.l;break; case LD_L_E: R->HL.B.l=R->DE.B.l;break; case LD_A_E: R->AF.B.h=R->DE.B.l;break; case LD_xHL_E: WrZ80(R->HL.W,R->DE.B.l);break; case LD_B_H: R->BC.B.h=R->HL.B.h;break; case LD_C_H: R->BC.B.l=R->HL.B.h;break; case LD_D_H: R->DE.B.h=R->HL.B.h;break; case LD_E_H: R->DE.B.l=R->HL.B.h;break; case LD_H_H: R->HL.B.h=R->HL.B.h;break; case LD_L_H: R->HL.B.l=R->HL.B.h;break; case LD_A_H: R->AF.B.h=R->HL.B.h;break; case LD_xHL_H: WrZ80(R->HL.W,R->HL.B.h);break; case LD_B_L: R->BC.B.h=R->HL.B.l;break; case LD_C_L: R->BC.B.l=R->HL.B.l;break; case LD_D_L: R->DE.B.h=R->HL.B.l;break; case LD_E_L: R->DE.B.l=R->HL.B.l;break; case LD_H_L: R->HL.B.h=R->HL.B.l;break; case LD_L_L: R->HL.B.l=R->HL.B.l;break; case LD_A_L: R->AF.B.h=R->HL.B.l;break; case LD_xHL_L: WrZ80(R->HL.W,R->HL.B.l);break; case LD_B_A: R->BC.B.h=R->AF.B.h;break; case LD_C_A: R->BC.B.l=R->AF.B.h;break; case LD_D_A: R->DE.B.h=R->AF.B.h;break; case LD_E_A: R->DE.B.l=R->AF.B.h;break; case LD_H_A: R->HL.B.h=R->AF.B.h;break; case LD_L_A: R->HL.B.l=R->AF.B.h;break; case LD_A_A: R->AF.B.h=R->AF.B.h;break; case LD_xHL_A: WrZ80(R->HL.W,R->AF.B.h);break; case LD_xBC_A: WrZ80(R->BC.W,R->AF.B.h);break; case LD_xDE_A: WrZ80(R->DE.W,R->AF.B.h);break; case LD_B_xHL: R->BC.B.h=RdZ80(R->HL.W);break; case LD_C_xHL: R->BC.B.l=RdZ80(R->HL.W);break; case LD_D_xHL: R->DE.B.h=RdZ80(R->HL.W);break; case LD_E_xHL: R->DE.B.l=RdZ80(R->HL.W);break; case LD_H_xHL: R->HL.B.h=RdZ80(R->HL.W);break; case LD_L_xHL: R->HL.B.l=RdZ80(R->HL.W);break; case LD_A_xHL: R->AF.B.h=RdZ80(R->HL.W);break; case LD_B_BYTE: R->BC.B.h=OpZ80(R->PC.W++);break; case LD_C_BYTE: R->BC.B.l=OpZ80(R->PC.W++);break; case LD_D_BYTE: R->DE.B.h=OpZ80(R->PC.W++);break; case LD_E_BYTE: R->DE.B.l=OpZ80(R->PC.W++);break; case LD_H_BYTE: R->HL.B.h=OpZ80(R->PC.W++);break; case LD_L_BYTE: R->HL.B.l=OpZ80(R->PC.W++);break; case LD_A_BYTE: R->AF.B.h=OpZ80(R->PC.W++);break; case LD_xHL_BYTE: WrZ80(R->HL.W,OpZ80(R->PC.W++));break; case LD_xWORD_HL: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); WrZ80(J.W++,R->HL.B.l); WrZ80(J.W,R->HL.B.h); break; case LD_HL_xWORD: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); R->HL.B.l=RdZ80(J.W++); R->HL.B.h=RdZ80(J.W); break; case LD_A_xWORD: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); R->AF.B.h=RdZ80(J.W); break; case LD_xWORD_A: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); WrZ80(J.W,R->AF.B.h); break; case EX_HL_xSP: J.B.l=RdZ80(R->SP.W);WrZ80(R->SP.W++,R->HL.B.l); J.B.h=RdZ80(R->SP.W);WrZ80(R->SP.W--,R->HL.B.h); R->HL.W=J.W; break; case DAA: J.W=R->AF.B.h; if(R->AF.B.l&C_FLAG) J.W|=256; if(R->AF.B.l&H_FLAG) J.W|=512; if(R->AF.B.l&N_FLAG) J.W|=1024; R->AF.W=DAATable[J.W]; break; default: if(R->TrapBadOps) printf ( "[Z80 %lX] Unrecognized instruction: %02X at PC=%04X\n", (long)R->User,OpZ80(R->PC.W-1),R->PC.W-1 ); break; z88dk-1.8.ds1/test/machine/Z80/CodesCB.h0000644000175000017500000002623410702217026017067 0ustar tygrystygrys/** Z80: portable Z80 emulator *******************************/ /** **/ /** CodesCB.h **/ /** **/ /** This file contains implementation for the CB table of **/ /** Z80 commands. It is included from Z80.c. **/ /** **/ /** Copyright (C) Marat Fayzullin 1994-2007 **/ /** You are not allowed to distribute this software **/ /** commercially. Please, notify me, if you make any **/ /** changes to this file. **/ /*************************************************************/ case RLC_B: M_RLC(R->BC.B.h);break; case RLC_C: M_RLC(R->BC.B.l);break; case RLC_D: M_RLC(R->DE.B.h);break; case RLC_E: M_RLC(R->DE.B.l);break; case RLC_H: M_RLC(R->HL.B.h);break; case RLC_L: M_RLC(R->HL.B.l);break; case RLC_xHL: I=RdZ80(R->HL.W);M_RLC(I);WrZ80(R->HL.W,I);break; case RLC_A: M_RLC(R->AF.B.h);break; case RRC_B: M_RRC(R->BC.B.h);break; case RRC_C: M_RRC(R->BC.B.l);break; case RRC_D: M_RRC(R->DE.B.h);break; case RRC_E: M_RRC(R->DE.B.l);break; case RRC_H: M_RRC(R->HL.B.h);break; case RRC_L: M_RRC(R->HL.B.l);break; case RRC_xHL: I=RdZ80(R->HL.W);M_RRC(I);WrZ80(R->HL.W,I);break; case RRC_A: M_RRC(R->AF.B.h);break; case RL_B: M_RL(R->BC.B.h);break; case RL_C: M_RL(R->BC.B.l);break; case RL_D: M_RL(R->DE.B.h);break; case RL_E: M_RL(R->DE.B.l);break; case RL_H: M_RL(R->HL.B.h);break; case RL_L: M_RL(R->HL.B.l);break; case RL_xHL: I=RdZ80(R->HL.W);M_RL(I);WrZ80(R->HL.W,I);break; case RL_A: M_RL(R->AF.B.h);break; case RR_B: M_RR(R->BC.B.h);break; case RR_C: M_RR(R->BC.B.l);break; case RR_D: M_RR(R->DE.B.h);break; case RR_E: M_RR(R->DE.B.l);break; case RR_H: M_RR(R->HL.B.h);break; case RR_L: M_RR(R->HL.B.l);break; case RR_xHL: I=RdZ80(R->HL.W);M_RR(I);WrZ80(R->HL.W,I);break; case RR_A: M_RR(R->AF.B.h);break; case SLA_B: M_SLA(R->BC.B.h);break; case SLA_C: M_SLA(R->BC.B.l);break; case SLA_D: M_SLA(R->DE.B.h);break; case SLA_E: M_SLA(R->DE.B.l);break; case SLA_H: M_SLA(R->HL.B.h);break; case SLA_L: M_SLA(R->HL.B.l);break; case SLA_xHL: I=RdZ80(R->HL.W);M_SLA(I);WrZ80(R->HL.W,I);break; case SLA_A: M_SLA(R->AF.B.h);break; case SRA_B: M_SRA(R->BC.B.h);break; case SRA_C: M_SRA(R->BC.B.l);break; case SRA_D: M_SRA(R->DE.B.h);break; case SRA_E: M_SRA(R->DE.B.l);break; case SRA_H: M_SRA(R->HL.B.h);break; case SRA_L: M_SRA(R->HL.B.l);break; case SRA_xHL: I=RdZ80(R->HL.W);M_SRA(I);WrZ80(R->HL.W,I);break; case SRA_A: M_SRA(R->AF.B.h);break; case SLL_B: M_SLL(R->BC.B.h);break; case SLL_C: M_SLL(R->BC.B.l);break; case SLL_D: M_SLL(R->DE.B.h);break; case SLL_E: M_SLL(R->DE.B.l);break; case SLL_H: M_SLL(R->HL.B.h);break; case SLL_L: M_SLL(R->HL.B.l);break; case SLL_xHL: I=RdZ80(R->HL.W);M_SLL(I);WrZ80(R->HL.W,I);break; case SLL_A: M_SLL(R->AF.B.h);break; case SRL_B: M_SRL(R->BC.B.h);break; case SRL_C: M_SRL(R->BC.B.l);break; case SRL_D: M_SRL(R->DE.B.h);break; case SRL_E: M_SRL(R->DE.B.l);break; case SRL_H: M_SRL(R->HL.B.h);break; case SRL_L: M_SRL(R->HL.B.l);break; case SRL_xHL: I=RdZ80(R->HL.W);M_SRL(I);WrZ80(R->HL.W,I);break; case SRL_A: M_SRL(R->AF.B.h);break; case BIT0_B: M_BIT(0,R->BC.B.h);break; case BIT0_C: M_BIT(0,R->BC.B.l);break; case BIT0_D: M_BIT(0,R->DE.B.h);break; case BIT0_E: M_BIT(0,R->DE.B.l);break; case BIT0_H: M_BIT(0,R->HL.B.h);break; case BIT0_L: M_BIT(0,R->HL.B.l);break; case BIT0_xHL: I=RdZ80(R->HL.W);M_BIT(0,I);break; case BIT0_A: M_BIT(0,R->AF.B.h);break; case BIT1_B: M_BIT(1,R->BC.B.h);break; case BIT1_C: M_BIT(1,R->BC.B.l);break; case BIT1_D: M_BIT(1,R->DE.B.h);break; case BIT1_E: M_BIT(1,R->DE.B.l);break; case BIT1_H: M_BIT(1,R->HL.B.h);break; case BIT1_L: M_BIT(1,R->HL.B.l);break; case BIT1_xHL: I=RdZ80(R->HL.W);M_BIT(1,I);break; case BIT1_A: M_BIT(1,R->AF.B.h);break; case BIT2_B: M_BIT(2,R->BC.B.h);break; case BIT2_C: M_BIT(2,R->BC.B.l);break; case BIT2_D: M_BIT(2,R->DE.B.h);break; case BIT2_E: M_BIT(2,R->DE.B.l);break; case BIT2_H: M_BIT(2,R->HL.B.h);break; case BIT2_L: M_BIT(2,R->HL.B.l);break; case BIT2_xHL: I=RdZ80(R->HL.W);M_BIT(2,I);break; case BIT2_A: M_BIT(2,R->AF.B.h);break; case BIT3_B: M_BIT(3,R->BC.B.h);break; case BIT3_C: M_BIT(3,R->BC.B.l);break; case BIT3_D: M_BIT(3,R->DE.B.h);break; case BIT3_E: M_BIT(3,R->DE.B.l);break; case BIT3_H: M_BIT(3,R->HL.B.h);break; case BIT3_L: M_BIT(3,R->HL.B.l);break; case BIT3_xHL: I=RdZ80(R->HL.W);M_BIT(3,I);break; case BIT3_A: M_BIT(3,R->AF.B.h);break; case BIT4_B: M_BIT(4,R->BC.B.h);break; case BIT4_C: M_BIT(4,R->BC.B.l);break; case BIT4_D: M_BIT(4,R->DE.B.h);break; case BIT4_E: M_BIT(4,R->DE.B.l);break; case BIT4_H: M_BIT(4,R->HL.B.h);break; case BIT4_L: M_BIT(4,R->HL.B.l);break; case BIT4_xHL: I=RdZ80(R->HL.W);M_BIT(4,I);break; case BIT4_A: M_BIT(4,R->AF.B.h);break; case BIT5_B: M_BIT(5,R->BC.B.h);break; case BIT5_C: M_BIT(5,R->BC.B.l);break; case BIT5_D: M_BIT(5,R->DE.B.h);break; case BIT5_E: M_BIT(5,R->DE.B.l);break; case BIT5_H: M_BIT(5,R->HL.B.h);break; case BIT5_L: M_BIT(5,R->HL.B.l);break; case BIT5_xHL: I=RdZ80(R->HL.W);M_BIT(5,I);break; case BIT5_A: M_BIT(5,R->AF.B.h);break; case BIT6_B: M_BIT(6,R->BC.B.h);break; case BIT6_C: M_BIT(6,R->BC.B.l);break; case BIT6_D: M_BIT(6,R->DE.B.h);break; case BIT6_E: M_BIT(6,R->DE.B.l);break; case BIT6_H: M_BIT(6,R->HL.B.h);break; case BIT6_L: M_BIT(6,R->HL.B.l);break; case BIT6_xHL: I=RdZ80(R->HL.W);M_BIT(6,I);break; case BIT6_A: M_BIT(6,R->AF.B.h);break; case BIT7_B: M_BIT(7,R->BC.B.h);break; case BIT7_C: M_BIT(7,R->BC.B.l);break; case BIT7_D: M_BIT(7,R->DE.B.h);break; case BIT7_E: M_BIT(7,R->DE.B.l);break; case BIT7_H: M_BIT(7,R->HL.B.h);break; case BIT7_L: M_BIT(7,R->HL.B.l);break; case BIT7_xHL: I=RdZ80(R->HL.W);M_BIT(7,I);break; case BIT7_A: M_BIT(7,R->AF.B.h);break; case RES0_B: M_RES(0,R->BC.B.h);break; case RES0_C: M_RES(0,R->BC.B.l);break; case RES0_D: M_RES(0,R->DE.B.h);break; case RES0_E: M_RES(0,R->DE.B.l);break; case RES0_H: M_RES(0,R->HL.B.h);break; case RES0_L: M_RES(0,R->HL.B.l);break; case RES0_xHL: I=RdZ80(R->HL.W);M_RES(0,I);WrZ80(R->HL.W,I);break; case RES0_A: M_RES(0,R->AF.B.h);break; case RES1_B: M_RES(1,R->BC.B.h);break; case RES1_C: M_RES(1,R->BC.B.l);break; case RES1_D: M_RES(1,R->DE.B.h);break; case RES1_E: M_RES(1,R->DE.B.l);break; case RES1_H: M_RES(1,R->HL.B.h);break; case RES1_L: M_RES(1,R->HL.B.l);break; case RES1_xHL: I=RdZ80(R->HL.W);M_RES(1,I);WrZ80(R->HL.W,I);break; case RES1_A: M_RES(1,R->AF.B.h);break; case RES2_B: M_RES(2,R->BC.B.h);break; case RES2_C: M_RES(2,R->BC.B.l);break; case RES2_D: M_RES(2,R->DE.B.h);break; case RES2_E: M_RES(2,R->DE.B.l);break; case RES2_H: M_RES(2,R->HL.B.h);break; case RES2_L: M_RES(2,R->HL.B.l);break; case RES2_xHL: I=RdZ80(R->HL.W);M_RES(2,I);WrZ80(R->HL.W,I);break; case RES2_A: M_RES(2,R->AF.B.h);break; case RES3_B: M_RES(3,R->BC.B.h);break; case RES3_C: M_RES(3,R->BC.B.l);break; case RES3_D: M_RES(3,R->DE.B.h);break; case RES3_E: M_RES(3,R->DE.B.l);break; case RES3_H: M_RES(3,R->HL.B.h);break; case RES3_L: M_RES(3,R->HL.B.l);break; case RES3_xHL: I=RdZ80(R->HL.W);M_RES(3,I);WrZ80(R->HL.W,I);break; case RES3_A: M_RES(3,R->AF.B.h);break; case RES4_B: M_RES(4,R->BC.B.h);break; case RES4_C: M_RES(4,R->BC.B.l);break; case RES4_D: M_RES(4,R->DE.B.h);break; case RES4_E: M_RES(4,R->DE.B.l);break; case RES4_H: M_RES(4,R->HL.B.h);break; case RES4_L: M_RES(4,R->HL.B.l);break; case RES4_xHL: I=RdZ80(R->HL.W);M_RES(4,I);WrZ80(R->HL.W,I);break; case RES4_A: M_RES(4,R->AF.B.h);break; case RES5_B: M_RES(5,R->BC.B.h);break; case RES5_C: M_RES(5,R->BC.B.l);break; case RES5_D: M_RES(5,R->DE.B.h);break; case RES5_E: M_RES(5,R->DE.B.l);break; case RES5_H: M_RES(5,R->HL.B.h);break; case RES5_L: M_RES(5,R->HL.B.l);break; case RES5_xHL: I=RdZ80(R->HL.W);M_RES(5,I);WrZ80(R->HL.W,I);break; case RES5_A: M_RES(5,R->AF.B.h);break; case RES6_B: M_RES(6,R->BC.B.h);break; case RES6_C: M_RES(6,R->BC.B.l);break; case RES6_D: M_RES(6,R->DE.B.h);break; case RES6_E: M_RES(6,R->DE.B.l);break; case RES6_H: M_RES(6,R->HL.B.h);break; case RES6_L: M_RES(6,R->HL.B.l);break; case RES6_xHL: I=RdZ80(R->HL.W);M_RES(6,I);WrZ80(R->HL.W,I);break; case RES6_A: M_RES(6,R->AF.B.h);break; case RES7_B: M_RES(7,R->BC.B.h);break; case RES7_C: M_RES(7,R->BC.B.l);break; case RES7_D: M_RES(7,R->DE.B.h);break; case RES7_E: M_RES(7,R->DE.B.l);break; case RES7_H: M_RES(7,R->HL.B.h);break; case RES7_L: M_RES(7,R->HL.B.l);break; case RES7_xHL: I=RdZ80(R->HL.W);M_RES(7,I);WrZ80(R->HL.W,I);break; case RES7_A: M_RES(7,R->AF.B.h);break; case SET0_B: M_SET(0,R->BC.B.h);break; case SET0_C: M_SET(0,R->BC.B.l);break; case SET0_D: M_SET(0,R->DE.B.h);break; case SET0_E: M_SET(0,R->DE.B.l);break; case SET0_H: M_SET(0,R->HL.B.h);break; case SET0_L: M_SET(0,R->HL.B.l);break; case SET0_xHL: I=RdZ80(R->HL.W);M_SET(0,I);WrZ80(R->HL.W,I);break; case SET0_A: M_SET(0,R->AF.B.h);break; case SET1_B: M_SET(1,R->BC.B.h);break; case SET1_C: M_SET(1,R->BC.B.l);break; case SET1_D: M_SET(1,R->DE.B.h);break; case SET1_E: M_SET(1,R->DE.B.l);break; case SET1_H: M_SET(1,R->HL.B.h);break; case SET1_L: M_SET(1,R->HL.B.l);break; case SET1_xHL: I=RdZ80(R->HL.W);M_SET(1,I);WrZ80(R->HL.W,I);break; case SET1_A: M_SET(1,R->AF.B.h);break; case SET2_B: M_SET(2,R->BC.B.h);break; case SET2_C: M_SET(2,R->BC.B.l);break; case SET2_D: M_SET(2,R->DE.B.h);break; case SET2_E: M_SET(2,R->DE.B.l);break; case SET2_H: M_SET(2,R->HL.B.h);break; case SET2_L: M_SET(2,R->HL.B.l);break; case SET2_xHL: I=RdZ80(R->HL.W);M_SET(2,I);WrZ80(R->HL.W,I);break; case SET2_A: M_SET(2,R->AF.B.h);break; case SET3_B: M_SET(3,R->BC.B.h);break; case SET3_C: M_SET(3,R->BC.B.l);break; case SET3_D: M_SET(3,R->DE.B.h);break; case SET3_E: M_SET(3,R->DE.B.l);break; case SET3_H: M_SET(3,R->HL.B.h);break; case SET3_L: M_SET(3,R->HL.B.l);break; case SET3_xHL: I=RdZ80(R->HL.W);M_SET(3,I);WrZ80(R->HL.W,I);break; case SET3_A: M_SET(3,R->AF.B.h);break; case SET4_B: M_SET(4,R->BC.B.h);break; case SET4_C: M_SET(4,R->BC.B.l);break; case SET4_D: M_SET(4,R->DE.B.h);break; case SET4_E: M_SET(4,R->DE.B.l);break; case SET4_H: M_SET(4,R->HL.B.h);break; case SET4_L: M_SET(4,R->HL.B.l);break; case SET4_xHL: I=RdZ80(R->HL.W);M_SET(4,I);WrZ80(R->HL.W,I);break; case SET4_A: M_SET(4,R->AF.B.h);break; case SET5_B: M_SET(5,R->BC.B.h);break; case SET5_C: M_SET(5,R->BC.B.l);break; case SET5_D: M_SET(5,R->DE.B.h);break; case SET5_E: M_SET(5,R->DE.B.l);break; case SET5_H: M_SET(5,R->HL.B.h);break; case SET5_L: M_SET(5,R->HL.B.l);break; case SET5_xHL: I=RdZ80(R->HL.W);M_SET(5,I);WrZ80(R->HL.W,I);break; case SET5_A: M_SET(5,R->AF.B.h);break; case SET6_B: M_SET(6,R->BC.B.h);break; case SET6_C: M_SET(6,R->BC.B.l);break; case SET6_D: M_SET(6,R->DE.B.h);break; case SET6_E: M_SET(6,R->DE.B.l);break; case SET6_H: M_SET(6,R->HL.B.h);break; case SET6_L: M_SET(6,R->HL.B.l);break; case SET6_xHL: I=RdZ80(R->HL.W);M_SET(6,I);WrZ80(R->HL.W,I);break; case SET6_A: M_SET(6,R->AF.B.h);break; case SET7_B: M_SET(7,R->BC.B.h);break; case SET7_C: M_SET(7,R->BC.B.l);break; case SET7_D: M_SET(7,R->DE.B.h);break; case SET7_E: M_SET(7,R->DE.B.l);break; case SET7_H: M_SET(7,R->HL.B.h);break; case SET7_L: M_SET(7,R->HL.B.l);break; case SET7_xHL: I=RdZ80(R->HL.W);M_SET(7,I);WrZ80(R->HL.W,I);break; case SET7_A: M_SET(7,R->AF.B.h);break; z88dk-1.8.ds1/test/machine/Z80/CodesED.h0000644000175000017500000001632010702217026017066 0ustar tygrystygrys/** Z80: portable Z80 emulator *******************************/ /** **/ /** CodesED.h **/ /** **/ /** This file contains implementation for the ED table of **/ /** Z80 commands. It is included from Z80.c. **/ /** **/ /** Copyright (C) Marat Fayzullin 1994-2007 **/ /** You are not allowed to distribute this software **/ /** commercially. Please, notify me, if you make any **/ /** changes to this file. **/ /*************************************************************/ /** This is a special patch for emulating BIOS calls: ********/ case DB_FE: PatchZ80(R);break; /*************************************************************/ case ADC_HL_BC: M_ADCW(BC);break; case ADC_HL_DE: M_ADCW(DE);break; case ADC_HL_HL: M_ADCW(HL);break; case ADC_HL_SP: M_ADCW(SP);break; case SBC_HL_BC: M_SBCW(BC);break; case SBC_HL_DE: M_SBCW(DE);break; case SBC_HL_HL: M_SBCW(HL);break; case SBC_HL_SP: M_SBCW(SP);break; case LD_xWORDe_HL: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); WrZ80(J.W++,R->HL.B.l); WrZ80(J.W,R->HL.B.h); break; case LD_xWORDe_DE: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); WrZ80(J.W++,R->DE.B.l); WrZ80(J.W,R->DE.B.h); break; case LD_xWORDe_BC: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); WrZ80(J.W++,R->BC.B.l); WrZ80(J.W,R->BC.B.h); break; case LD_xWORDe_SP: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); WrZ80(J.W++,R->SP.B.l); WrZ80(J.W,R->SP.B.h); break; case LD_HL_xWORDe: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); R->HL.B.l=RdZ80(J.W++); R->HL.B.h=RdZ80(J.W); break; case LD_DE_xWORDe: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); R->DE.B.l=RdZ80(J.W++); R->DE.B.h=RdZ80(J.W); break; case LD_BC_xWORDe: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); R->BC.B.l=RdZ80(J.W++); R->BC.B.h=RdZ80(J.W); break; case LD_SP_xWORDe: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); R->SP.B.l=RdZ80(J.W++); R->SP.B.h=RdZ80(J.W); break; case RRD: I=RdZ80(R->HL.W); J.B.l=(I>>4)|(R->AF.B.h<<4); WrZ80(R->HL.W,J.B.l); R->AF.B.h=(I&0x0F)|(R->AF.B.h&0xF0); R->AF.B.l=PZSTable[R->AF.B.h]|(R->AF.B.l&C_FLAG); break; case RLD: I=RdZ80(R->HL.W); J.B.l=(I<<4)|(R->AF.B.h&0x0F); WrZ80(R->HL.W,J.B.l); R->AF.B.h=(I>>4)|(R->AF.B.h&0xF0); R->AF.B.l=PZSTable[R->AF.B.h]|(R->AF.B.l&C_FLAG); break; case LD_A_I: R->AF.B.h=R->I; R->AF.B.l=(R->AF.B.l&C_FLAG)|(R->IFF&IFF_2? P_FLAG:0)|ZSTable[R->AF.B.h]; break; case LD_A_R: R->R++; R->AF.B.h=(byte)(R->R-R->ICount); R->AF.B.l=(R->AF.B.l&C_FLAG)|(R->IFF&IFF_2? P_FLAG:0)|ZSTable[R->AF.B.h]; break; case LD_I_A: R->I=R->AF.B.h;break; case LD_R_A: break; case IM_0: R->IFF&=~(IFF_IM1|IFF_IM2);break; case IM_1: R->IFF=(R->IFF&~IFF_IM2)|IFF_IM1;break; case IM_2: R->IFF=(R->IFF&~IFF_IM1)|IFF_IM2;break; case RETI: case RETN: if(R->IFF&IFF_2) R->IFF|=IFF_1; else R->IFF&=~IFF_1; M_RET;break; case NEG: I=R->AF.B.h;R->AF.B.h=0;M_SUB(I);break; case IN_B_xC: M_IN(R->BC.B.h);break; case IN_C_xC: M_IN(R->BC.B.l);break; case IN_D_xC: M_IN(R->DE.B.h);break; case IN_E_xC: M_IN(R->DE.B.l);break; case IN_H_xC: M_IN(R->HL.B.h);break; case IN_L_xC: M_IN(R->HL.B.l);break; case IN_A_xC: M_IN(R->AF.B.h);break; case IN_F_xC: M_IN(J.B.l);break; case OUT_xC_B: OutZ80(R->BC.W,R->BC.B.h);break; case OUT_xC_C: OutZ80(R->BC.W,R->BC.B.l);break; case OUT_xC_D: OutZ80(R->BC.W,R->DE.B.h);break; case OUT_xC_E: OutZ80(R->BC.W,R->DE.B.l);break; case OUT_xC_H: OutZ80(R->BC.W,R->HL.B.h);break; case OUT_xC_L: OutZ80(R->BC.W,R->HL.B.l);break; case OUT_xC_A: OutZ80(R->BC.W,R->AF.B.h);break; case INI: WrZ80(R->HL.W++,InZ80(R->BC.W)); --R->BC.B.h; R->AF.B.l=N_FLAG|(R->BC.B.h? 0:Z_FLAG); break; case INIR: do { WrZ80(R->HL.W++,InZ80(R->BC.W)); --R->BC.B.h;R->ICount-=21; } while(R->BC.B.h&&(R->ICount>0)); if(R->BC.B.h) { R->AF.B.l=N_FLAG;R->PC.W-=2; } else { R->AF.B.l=Z_FLAG|N_FLAG;R->ICount+=5; } break; case IND: WrZ80(R->HL.W--,InZ80(R->BC.W)); --R->BC.B.h; R->AF.B.l=N_FLAG|(R->BC.B.h? 0:Z_FLAG); break; case INDR: do { WrZ80(R->HL.W--,InZ80(R->BC.W)); --R->BC.B.h;R->ICount-=21; } while(R->BC.B.h&&(R->ICount>0)); if(R->BC.B.h) { R->AF.B.l=N_FLAG;R->PC.W-=2; } else { R->AF.B.l=Z_FLAG|N_FLAG;R->ICount+=5; } break; case OUTI: --R->BC.B.h; I=RdZ80(R->HL.W++); OutZ80(R->BC.W,I); R->AF.B.l=N_FLAG|(R->BC.B.h? 0:Z_FLAG)|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); break; case OTIR: do { --R->BC.B.h; I=RdZ80(R->HL.W++); OutZ80(R->BC.W,I); R->ICount-=21; } while(R->BC.B.h&&(R->ICount>0)); if(R->BC.B.h) { R->AF.B.l=N_FLAG|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); R->PC.W-=2; } else { R->AF.B.l=Z_FLAG|N_FLAG|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); R->ICount+=5; } break; case OUTD: --R->BC.B.h; I=RdZ80(R->HL.W--); OutZ80(R->BC.W,I); R->AF.B.l=N_FLAG|(R->BC.B.h? 0:Z_FLAG)|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); break; case OTDR: do { --R->BC.B.h; I=RdZ80(R->HL.W--); OutZ80(R->BC.W,I); R->ICount-=21; } while(R->BC.B.h&&(R->ICount>0)); if(R->BC.B.h) { R->AF.B.l=N_FLAG|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); R->PC.W-=2; } else { R->AF.B.l=Z_FLAG|N_FLAG|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); R->ICount+=5; } break; case LDI: WrZ80(R->DE.W++,RdZ80(R->HL.W++)); --R->BC.W; R->AF.B.l=(R->AF.B.l&~(N_FLAG|H_FLAG|P_FLAG))|(R->BC.W? P_FLAG:0); break; case LDIR: do { WrZ80(R->DE.W++,RdZ80(R->HL.W++)); --R->BC.W;R->ICount-=21; } while(R->BC.W&&(R->ICount>0)); R->AF.B.l&=~(N_FLAG|H_FLAG|P_FLAG); if(R->BC.W) { R->AF.B.l|=N_FLAG;R->PC.W-=2; } else R->ICount+=5; break; case LDD: WrZ80(R->DE.W--,RdZ80(R->HL.W--)); --R->BC.W; R->AF.B.l=(R->AF.B.l&~(N_FLAG|H_FLAG|P_FLAG))|(R->BC.W? P_FLAG:0); break; case LDDR: do { WrZ80(R->DE.W--,RdZ80(R->HL.W--)); --R->BC.W;R->ICount-=21; } while(R->BC.W&&(R->ICount>0)); R->AF.B.l&=~(N_FLAG|H_FLAG|P_FLAG); if(R->BC.W) { R->AF.B.l|=N_FLAG;R->PC.W-=2; } else R->ICount+=5; break; case CPI: I=RdZ80(R->HL.W++); J.B.l=R->AF.B.h-I; --R->BC.W; R->AF.B.l = N_FLAG|(R->AF.B.l&C_FLAG)|ZSTable[J.B.l]| ((R->AF.B.h^I^J.B.l)&H_FLAG)|(R->BC.W? P_FLAG:0); break; case CPIR: do { I=RdZ80(R->HL.W++); J.B.l=R->AF.B.h-I; --R->BC.W;R->ICount-=21; } while(R->BC.W&&J.B.l&&(R->ICount>0)); R->AF.B.l = N_FLAG|(R->AF.B.l&C_FLAG)|ZSTable[J.B.l]| ((R->AF.B.h^I^J.B.l)&H_FLAG)|(R->BC.W? P_FLAG:0); if(R->BC.W&&J.B.l) R->PC.W-=2; else R->ICount+=5; break; case CPD: I=RdZ80(R->HL.W--); J.B.l=R->AF.B.h-I; --R->BC.W; R->AF.B.l = N_FLAG|(R->AF.B.l&C_FLAG)|ZSTable[J.B.l]| ((R->AF.B.h^I^J.B.l)&H_FLAG)|(R->BC.W? P_FLAG:0); break; case CPDR: do { I=RdZ80(R->HL.W--); J.B.l=R->AF.B.h-I; --R->BC.W;R->ICount-=21; } while(R->BC.W&&J.B.l); R->AF.B.l = N_FLAG|(R->AF.B.l&C_FLAG)|ZSTable[J.B.l]| ((R->AF.B.h^I^J.B.l)&H_FLAG)|(R->BC.W? P_FLAG:0); if(R->BC.W&&J.B.l) R->PC.W-=2; else R->ICount+=5; break; z88dk-1.8.ds1/test/machine/Z80/CodesXCB.h0000644000175000017500000000633110702217026017213 0ustar tygrystygrys/** Z80: portable Z80 emulator *******************************/ /** **/ /** CodesXCB.h **/ /** **/ /** This file contains implementation for FD/DD-CB tables **/ /** of Z80 commands. It is included from Z80.c. **/ /** **/ /** Copyright (C) Marat Fayzullin 1994-2007 **/ /** You are not allowed to distribute this software **/ /** commercially. Please, notify me, if you make any **/ /** changes to this file. **/ /*************************************************************/ case RLC_xHL: I=RdZ80(J.W);M_RLC(I);WrZ80(J.W,I);break; case RRC_xHL: I=RdZ80(J.W);M_RRC(I);WrZ80(J.W,I);break; case RL_xHL: I=RdZ80(J.W);M_RL(I);WrZ80(J.W,I);break; case RR_xHL: I=RdZ80(J.W);M_RR(I);WrZ80(J.W,I);break; case SLA_xHL: I=RdZ80(J.W);M_SLA(I);WrZ80(J.W,I);break; case SRA_xHL: I=RdZ80(J.W);M_SRA(I);WrZ80(J.W,I);break; case SLL_xHL: I=RdZ80(J.W);M_SLL(I);WrZ80(J.W,I);break; case SRL_xHL: I=RdZ80(J.W);M_SRL(I);WrZ80(J.W,I);break; case BIT0_B: case BIT0_C: case BIT0_D: case BIT0_E: case BIT0_H: case BIT0_L: case BIT0_A: case BIT0_xHL: I=RdZ80(J.W);M_BIT(0,I);break; case BIT1_B: case BIT1_C: case BIT1_D: case BIT1_E: case BIT1_H: case BIT1_L: case BIT1_A: case BIT1_xHL: I=RdZ80(J.W);M_BIT(1,I);break; case BIT2_B: case BIT2_C: case BIT2_D: case BIT2_E: case BIT2_H: case BIT2_L: case BIT2_A: case BIT2_xHL: I=RdZ80(J.W);M_BIT(2,I);break; case BIT3_B: case BIT3_C: case BIT3_D: case BIT3_E: case BIT3_H: case BIT3_L: case BIT3_A: case BIT3_xHL: I=RdZ80(J.W);M_BIT(3,I);break; case BIT4_B: case BIT4_C: case BIT4_D: case BIT4_E: case BIT4_H: case BIT4_L: case BIT4_A: case BIT4_xHL: I=RdZ80(J.W);M_BIT(4,I);break; case BIT5_B: case BIT5_C: case BIT5_D: case BIT5_E: case BIT5_H: case BIT5_L: case BIT5_A: case BIT5_xHL: I=RdZ80(J.W);M_BIT(5,I);break; case BIT6_B: case BIT6_C: case BIT6_D: case BIT6_E: case BIT6_H: case BIT6_L: case BIT6_A: case BIT6_xHL: I=RdZ80(J.W);M_BIT(6,I);break; case BIT7_B: case BIT7_C: case BIT7_D: case BIT7_E: case BIT7_H: case BIT7_L: case BIT7_A: case BIT7_xHL: I=RdZ80(J.W);M_BIT(7,I);break; case RES0_xHL: I=RdZ80(J.W);M_RES(0,I);WrZ80(J.W,I);break; case RES1_xHL: I=RdZ80(J.W);M_RES(1,I);WrZ80(J.W,I);break; case RES2_xHL: I=RdZ80(J.W);M_RES(2,I);WrZ80(J.W,I);break; case RES3_xHL: I=RdZ80(J.W);M_RES(3,I);WrZ80(J.W,I);break; case RES4_xHL: I=RdZ80(J.W);M_RES(4,I);WrZ80(J.W,I);break; case RES5_xHL: I=RdZ80(J.W);M_RES(5,I);WrZ80(J.W,I);break; case RES6_xHL: I=RdZ80(J.W);M_RES(6,I);WrZ80(J.W,I);break; case RES7_xHL: I=RdZ80(J.W);M_RES(7,I);WrZ80(J.W,I);break; case SET0_xHL: I=RdZ80(J.W);M_SET(0,I);WrZ80(J.W,I);break; case SET1_xHL: I=RdZ80(J.W);M_SET(1,I);WrZ80(J.W,I);break; case SET2_xHL: I=RdZ80(J.W);M_SET(2,I);WrZ80(J.W,I);break; case SET3_xHL: I=RdZ80(J.W);M_SET(3,I);WrZ80(J.W,I);break; case SET4_xHL: I=RdZ80(J.W);M_SET(4,I);WrZ80(J.W,I);break; case SET5_xHL: I=RdZ80(J.W);M_SET(5,I);WrZ80(J.W,I);break; case SET6_xHL: I=RdZ80(J.W);M_SET(6,I);WrZ80(J.W,I);break; case SET7_xHL: I=RdZ80(J.W);M_SET(7,I);WrZ80(J.W,I);break; z88dk-1.8.ds1/test/machine/Z80/CodesXX.h0000644000175000017500000003446610702217026017150 0ustar tygrystygrys/** Z80: portable Z80 emulator *******************************/ /** **/ /** CodesXX.h **/ /** **/ /** This file contains implementation for FD/DD tables of **/ /** Z80 commands. It is included from Z80.c. **/ /** **/ /** Copyright (C) Marat Fayzullin 1994-2007 **/ /** You are not allowed to distribute this software **/ /** commercially. Please, notify me, if you make any **/ /** changes to this file. **/ /*************************************************************/ case JR_NZ: if(R->AF.B.l&Z_FLAG) R->PC.W++; else { R->ICount-=5;M_JR; } break; case JR_NC: if(R->AF.B.l&C_FLAG) R->PC.W++; else { R->ICount-=5;M_JR; } break; case JR_Z: if(R->AF.B.l&Z_FLAG) { R->ICount-=5;M_JR; } else R->PC.W++; break; case JR_C: if(R->AF.B.l&C_FLAG) { R->ICount-=5;M_JR; } else R->PC.W++; break; case JP_NZ: if(R->AF.B.l&Z_FLAG) R->PC.W+=2; else { M_JP; } break; case JP_NC: if(R->AF.B.l&C_FLAG) R->PC.W+=2; else { M_JP; } break; case JP_PO: if(R->AF.B.l&P_FLAG) R->PC.W+=2; else { M_JP; } break; case JP_P: if(R->AF.B.l&S_FLAG) R->PC.W+=2; else { M_JP; } break; case JP_Z: if(R->AF.B.l&Z_FLAG) { M_JP; } else R->PC.W+=2; break; case JP_C: if(R->AF.B.l&C_FLAG) { M_JP; } else R->PC.W+=2; break; case JP_PE: if(R->AF.B.l&P_FLAG) { M_JP; } else R->PC.W+=2; break; case JP_M: if(R->AF.B.l&S_FLAG) { M_JP; } else R->PC.W+=2; break; case RET_NZ: if(!(R->AF.B.l&Z_FLAG)) { R->ICount-=6;M_RET; } break; case RET_NC: if(!(R->AF.B.l&C_FLAG)) { R->ICount-=6;M_RET; } break; case RET_PO: if(!(R->AF.B.l&P_FLAG)) { R->ICount-=6;M_RET; } break; case RET_P: if(!(R->AF.B.l&S_FLAG)) { R->ICount-=6;M_RET; } break; case RET_Z: if(R->AF.B.l&Z_FLAG) { R->ICount-=6;M_RET; } break; case RET_C: if(R->AF.B.l&C_FLAG) { R->ICount-=6;M_RET; } break; case RET_PE: if(R->AF.B.l&P_FLAG) { R->ICount-=6;M_RET; } break; case RET_M: if(R->AF.B.l&S_FLAG) { R->ICount-=6;M_RET; } break; case CALL_NZ: if(R->AF.B.l&Z_FLAG) R->PC.W+=2; else { R->ICount-=7;M_CALL; } break; case CALL_NC: if(R->AF.B.l&C_FLAG) R->PC.W+=2; else { R->ICount-=7;M_CALL; } break; case CALL_PO: if(R->AF.B.l&P_FLAG) R->PC.W+=2; else { R->ICount-=7;M_CALL; } break; case CALL_P: if(R->AF.B.l&S_FLAG) R->PC.W+=2; else { R->ICount-=7;M_CALL; } break; case CALL_Z: if(R->AF.B.l&Z_FLAG) { R->ICount-=7;M_CALL; } else R->PC.W+=2; break; case CALL_C: if(R->AF.B.l&C_FLAG) { R->ICount-=7;M_CALL; } else R->PC.W+=2; break; case CALL_PE: if(R->AF.B.l&P_FLAG) { R->ICount-=7;M_CALL; } else R->PC.W+=2; break; case CALL_M: if(R->AF.B.l&S_FLAG) { R->ICount-=7;M_CALL; } else R->PC.W+=2; break; case ADD_B: M_ADD(R->BC.B.h);break; case ADD_C: M_ADD(R->BC.B.l);break; case ADD_D: M_ADD(R->DE.B.h);break; case ADD_E: M_ADD(R->DE.B.l);break; case ADD_H: M_ADD(R->XX.B.h);break; case ADD_L: M_ADD(R->XX.B.l);break; case ADD_A: M_ADD(R->AF.B.h);break; case ADD_xHL: I=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++)); M_ADD(I);break; case ADD_BYTE: I=OpZ80(R->PC.W++);M_ADD(I);break; case SUB_B: M_SUB(R->BC.B.h);break; case SUB_C: M_SUB(R->BC.B.l);break; case SUB_D: M_SUB(R->DE.B.h);break; case SUB_E: M_SUB(R->DE.B.l);break; case SUB_H: M_SUB(R->XX.B.h);break; case SUB_L: M_SUB(R->XX.B.l);break; case SUB_A: R->AF.B.h=0;R->AF.B.l=N_FLAG|Z_FLAG;break; case SUB_xHL: I=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++)); M_SUB(I);break; case SUB_BYTE: I=OpZ80(R->PC.W++);M_SUB(I);break; case AND_B: M_AND(R->BC.B.h);break; case AND_C: M_AND(R->BC.B.l);break; case AND_D: M_AND(R->DE.B.h);break; case AND_E: M_AND(R->DE.B.l);break; case AND_H: M_AND(R->XX.B.h);break; case AND_L: M_AND(R->XX.B.l);break; case AND_A: M_AND(R->AF.B.h);break; case AND_xHL: I=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++)); M_AND(I);break; case AND_BYTE: I=OpZ80(R->PC.W++);M_AND(I);break; case OR_B: M_OR(R->BC.B.h);break; case OR_C: M_OR(R->BC.B.l);break; case OR_D: M_OR(R->DE.B.h);break; case OR_E: M_OR(R->DE.B.l);break; case OR_H: M_OR(R->XX.B.h);break; case OR_L: M_OR(R->XX.B.l);break; case OR_A: M_OR(R->AF.B.h);break; case OR_xHL: I=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++)); M_OR(I);break; case OR_BYTE: I=OpZ80(R->PC.W++);M_OR(I);break; case ADC_B: M_ADC(R->BC.B.h);break; case ADC_C: M_ADC(R->BC.B.l);break; case ADC_D: M_ADC(R->DE.B.h);break; case ADC_E: M_ADC(R->DE.B.l);break; case ADC_H: M_ADC(R->XX.B.h);break; case ADC_L: M_ADC(R->XX.B.l);break; case ADC_A: M_ADC(R->AF.B.h);break; case ADC_xHL: I=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++)); M_ADC(I);break; case ADC_BYTE: I=OpZ80(R->PC.W++);M_ADC(I);break; case SBC_B: M_SBC(R->BC.B.h);break; case SBC_C: M_SBC(R->BC.B.l);break; case SBC_D: M_SBC(R->DE.B.h);break; case SBC_E: M_SBC(R->DE.B.l);break; case SBC_H: M_SBC(R->XX.B.h);break; case SBC_L: M_SBC(R->XX.B.l);break; case SBC_A: M_SBC(R->AF.B.h);break; case SBC_xHL: I=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++)); M_SBC(I);break; case SBC_BYTE: I=OpZ80(R->PC.W++);M_SBC(I);break; case XOR_B: M_XOR(R->BC.B.h);break; case XOR_C: M_XOR(R->BC.B.l);break; case XOR_D: M_XOR(R->DE.B.h);break; case XOR_E: M_XOR(R->DE.B.l);break; case XOR_H: M_XOR(R->XX.B.h);break; case XOR_L: M_XOR(R->XX.B.l);break; case XOR_A: R->AF.B.h=0;R->AF.B.l=P_FLAG|Z_FLAG;break; case XOR_xHL: I=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++)); M_XOR(I);break; case XOR_BYTE: I=OpZ80(R->PC.W++);M_XOR(I);break; case CP_B: M_CP(R->BC.B.h);break; case CP_C: M_CP(R->BC.B.l);break; case CP_D: M_CP(R->DE.B.h);break; case CP_E: M_CP(R->DE.B.l);break; case CP_H: M_CP(R->XX.B.h);break; case CP_L: M_CP(R->XX.B.l);break; case CP_A: R->AF.B.l=N_FLAG|Z_FLAG;break; case CP_xHL: I=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++)); M_CP(I);break; case CP_BYTE: I=OpZ80(R->PC.W++);M_CP(I);break; case LD_BC_WORD: M_LDWORD(BC);break; case LD_DE_WORD: M_LDWORD(DE);break; case LD_HL_WORD: M_LDWORD(XX);break; case LD_SP_WORD: M_LDWORD(SP);break; case LD_PC_HL: R->PC.W=R->XX.W;JumpZ80(R->PC.W);break; case LD_SP_HL: R->SP.W=R->XX.W;break; case LD_A_xBC: R->AF.B.h=RdZ80(R->BC.W);break; case LD_A_xDE: R->AF.B.h=RdZ80(R->DE.W);break; case ADD_HL_BC: M_ADDW(XX,BC);break; case ADD_HL_DE: M_ADDW(XX,DE);break; case ADD_HL_HL: M_ADDW(XX,XX);break; case ADD_HL_SP: M_ADDW(XX,SP);break; case DEC_BC: R->BC.W--;break; case DEC_DE: R->DE.W--;break; case DEC_HL: R->XX.W--;break; case DEC_SP: R->SP.W--;break; case INC_BC: R->BC.W++;break; case INC_DE: R->DE.W++;break; case INC_HL: R->XX.W++;break; case INC_SP: R->SP.W++;break; case DEC_B: M_DEC(R->BC.B.h);break; case DEC_C: M_DEC(R->BC.B.l);break; case DEC_D: M_DEC(R->DE.B.h);break; case DEC_E: M_DEC(R->DE.B.l);break; case DEC_H: M_DEC(R->XX.B.h);break; case DEC_L: M_DEC(R->XX.B.l);break; case DEC_A: M_DEC(R->AF.B.h);break; case DEC_xHL: I=RdZ80(R->XX.W+(offset)RdZ80(R->PC.W));M_DEC(I); WrZ80(R->XX.W+(offset)OpZ80(R->PC.W++),I); break; case INC_B: M_INC(R->BC.B.h);break; case INC_C: M_INC(R->BC.B.l);break; case INC_D: M_INC(R->DE.B.h);break; case INC_E: M_INC(R->DE.B.l);break; case INC_H: M_INC(R->XX.B.h);break; case INC_L: M_INC(R->XX.B.l);break; case INC_A: M_INC(R->AF.B.h);break; case INC_xHL: I=RdZ80(R->XX.W+(offset)RdZ80(R->PC.W));M_INC(I); WrZ80(R->XX.W+(offset)OpZ80(R->PC.W++),I); break; case RLCA: I=(R->AF.B.h&0x80? C_FLAG:0); R->AF.B.h=(R->AF.B.h<<1)|I; R->AF.B.l=(R->AF.B.l&~(C_FLAG|N_FLAG|H_FLAG))|I; break; case RLA: I=(R->AF.B.h&0x80? C_FLAG:0); R->AF.B.h=(R->AF.B.h<<1)|(R->AF.B.l&C_FLAG); R->AF.B.l=(R->AF.B.l&~(C_FLAG|N_FLAG|H_FLAG))|I; break; case RRCA: I=R->AF.B.h&0x01; R->AF.B.h=(R->AF.B.h>>1)|(I? 0x80:0); R->AF.B.l=(R->AF.B.l&~(C_FLAG|N_FLAG|H_FLAG))|I; break; case RRA: I=R->AF.B.h&0x01; R->AF.B.h=(R->AF.B.h>>1)|(R->AF.B.l&C_FLAG? 0x80:0); R->AF.B.l=(R->AF.B.l&~(C_FLAG|N_FLAG|H_FLAG))|I; break; case RST00: M_RST(0x0000);break; case RST08: M_RST(0x0008);break; case RST10: M_RST(0x0010);break; case RST18: M_RST(0x0018);break; case RST20: M_RST(0x0020);break; case RST28: M_RST(0x0028);break; case RST30: M_RST(0x0030);break; case RST38: M_RST(0x0038);break; case PUSH_BC: M_PUSH(BC);break; case PUSH_DE: M_PUSH(DE);break; case PUSH_HL: M_PUSH(XX);break; case PUSH_AF: M_PUSH(AF);break; case POP_BC: M_POP(BC);break; case POP_DE: M_POP(DE);break; case POP_HL: M_POP(XX);break; case POP_AF: M_POP(AF);break; case DJNZ: if(--R->BC.B.h) { R->ICount-=5;M_JR; } else R->PC.W++;break; case JP: M_JP;break; case JR: M_JR;break; case CALL: M_CALL;break; case RET: M_RET;break; case SCF: S(C_FLAG);R(N_FLAG|H_FLAG);break; case CPL: R->AF.B.h=~R->AF.B.h;S(N_FLAG|H_FLAG);break; case NOP: break; case OUTA: I=OpZ80(R->PC.W++);OutZ80(I|(R->AF.W&0xFF00),R->AF.B.h);break; case INA: I=OpZ80(R->PC.W++);R->AF.B.h=InZ80(I|(R->AF.W&0xFF00));break; case HALT: R->PC.W--; R->IFF|=IFF_HALT; R->IBackup=0; R->ICount=0; break; case DI: if(R->IFF&IFF_EI) R->ICount+=R->IBackup-1; R->IFF&=~(IFF_1|IFF_2|IFF_EI); break; case EI: if(!(R->IFF&(IFF_1|IFF_EI))) { R->IFF|=IFF_2|IFF_EI; R->IBackup=R->ICount; R->ICount=1; } break; case CCF: R->AF.B.l^=C_FLAG;R(N_FLAG|H_FLAG); R->AF.B.l|=R->AF.B.l&C_FLAG? 0:H_FLAG; break; case EXX: J.W=R->BC.W;R->BC.W=R->BC1.W;R->BC1.W=J.W; J.W=R->DE.W;R->DE.W=R->DE1.W;R->DE1.W=J.W; J.W=R->HL.W;R->HL.W=R->HL1.W;R->HL1.W=J.W; break; case EX_DE_HL: J.W=R->DE.W;R->DE.W=R->HL.W;R->HL.W=J.W;break; case EX_AF_AF: J.W=R->AF.W;R->AF.W=R->AF1.W;R->AF1.W=J.W;break; case LD_B_B: R->BC.B.h=R->BC.B.h;break; case LD_C_B: R->BC.B.l=R->BC.B.h;break; case LD_D_B: R->DE.B.h=R->BC.B.h;break; case LD_E_B: R->DE.B.l=R->BC.B.h;break; case LD_H_B: R->XX.B.h=R->BC.B.h;break; case LD_L_B: R->XX.B.l=R->BC.B.h;break; case LD_A_B: R->AF.B.h=R->BC.B.h;break; case LD_xHL_B: J.W=R->XX.W+(offset)OpZ80(R->PC.W++); WrZ80(J.W,R->BC.B.h);break; case LD_B_C: R->BC.B.h=R->BC.B.l;break; case LD_C_C: R->BC.B.l=R->BC.B.l;break; case LD_D_C: R->DE.B.h=R->BC.B.l;break; case LD_E_C: R->DE.B.l=R->BC.B.l;break; case LD_H_C: R->XX.B.h=R->BC.B.l;break; case LD_L_C: R->XX.B.l=R->BC.B.l;break; case LD_A_C: R->AF.B.h=R->BC.B.l;break; case LD_xHL_C: J.W=R->XX.W+(offset)OpZ80(R->PC.W++); WrZ80(J.W,R->BC.B.l);break; case LD_B_D: R->BC.B.h=R->DE.B.h;break; case LD_C_D: R->BC.B.l=R->DE.B.h;break; case LD_D_D: R->DE.B.h=R->DE.B.h;break; case LD_E_D: R->DE.B.l=R->DE.B.h;break; case LD_H_D: R->XX.B.h=R->DE.B.h;break; case LD_L_D: R->XX.B.l=R->DE.B.h;break; case LD_A_D: R->AF.B.h=R->DE.B.h;break; case LD_xHL_D: J.W=R->XX.W+(offset)OpZ80(R->PC.W++); WrZ80(J.W,R->DE.B.h);break; case LD_B_E: R->BC.B.h=R->DE.B.l;break; case LD_C_E: R->BC.B.l=R->DE.B.l;break; case LD_D_E: R->DE.B.h=R->DE.B.l;break; case LD_E_E: R->DE.B.l=R->DE.B.l;break; case LD_H_E: R->XX.B.h=R->DE.B.l;break; case LD_L_E: R->XX.B.l=R->DE.B.l;break; case LD_A_E: R->AF.B.h=R->DE.B.l;break; case LD_xHL_E: J.W=R->XX.W+(offset)OpZ80(R->PC.W++); WrZ80(J.W,R->DE.B.l);break; case LD_B_H: R->BC.B.h=R->XX.B.h;break; case LD_C_H: R->BC.B.l=R->XX.B.h;break; case LD_D_H: R->DE.B.h=R->XX.B.h;break; case LD_E_H: R->DE.B.l=R->XX.B.h;break; case LD_H_H: R->XX.B.h=R->XX.B.h;break; case LD_L_H: R->XX.B.l=R->XX.B.h;break; case LD_A_H: R->AF.B.h=R->XX.B.h;break; case LD_xHL_H: J.W=R->XX.W+(offset)OpZ80(R->PC.W++); WrZ80(J.W,R->HL.B.h);break; case LD_B_L: R->BC.B.h=R->XX.B.l;break; case LD_C_L: R->BC.B.l=R->XX.B.l;break; case LD_D_L: R->DE.B.h=R->XX.B.l;break; case LD_E_L: R->DE.B.l=R->XX.B.l;break; case LD_H_L: R->XX.B.h=R->XX.B.l;break; case LD_L_L: R->XX.B.l=R->XX.B.l;break; case LD_A_L: R->AF.B.h=R->XX.B.l;break; case LD_xHL_L: J.W=R->XX.W+(offset)OpZ80(R->PC.W++); WrZ80(J.W,R->HL.B.l);break; case LD_B_A: R->BC.B.h=R->AF.B.h;break; case LD_C_A: R->BC.B.l=R->AF.B.h;break; case LD_D_A: R->DE.B.h=R->AF.B.h;break; case LD_E_A: R->DE.B.l=R->AF.B.h;break; case LD_H_A: R->XX.B.h=R->AF.B.h;break; case LD_L_A: R->XX.B.l=R->AF.B.h;break; case LD_A_A: R->AF.B.h=R->AF.B.h;break; case LD_xHL_A: J.W=R->XX.W+(offset)OpZ80(R->PC.W++); WrZ80(J.W,R->AF.B.h);break; case LD_xBC_A: WrZ80(R->BC.W,R->AF.B.h);break; case LD_xDE_A: WrZ80(R->DE.W,R->AF.B.h);break; case LD_B_xHL: R->BC.B.h=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++));break; case LD_C_xHL: R->BC.B.l=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++));break; case LD_D_xHL: R->DE.B.h=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++));break; case LD_E_xHL: R->DE.B.l=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++));break; case LD_H_xHL: R->HL.B.h=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++));break; case LD_L_xHL: R->HL.B.l=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++));break; case LD_A_xHL: R->AF.B.h=RdZ80(R->XX.W+(offset)OpZ80(R->PC.W++));break; case LD_B_BYTE: R->BC.B.h=OpZ80(R->PC.W++);break; case LD_C_BYTE: R->BC.B.l=OpZ80(R->PC.W++);break; case LD_D_BYTE: R->DE.B.h=OpZ80(R->PC.W++);break; case LD_E_BYTE: R->DE.B.l=OpZ80(R->PC.W++);break; case LD_H_BYTE: R->XX.B.h=OpZ80(R->PC.W++);break; case LD_L_BYTE: R->XX.B.l=OpZ80(R->PC.W++);break; case LD_A_BYTE: R->AF.B.h=OpZ80(R->PC.W++);break; case LD_xHL_BYTE: J.W=R->XX.W+(offset)OpZ80(R->PC.W++); WrZ80(J.W,OpZ80(R->PC.W++));break; case LD_xWORD_HL: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); WrZ80(J.W++,R->XX.B.l); WrZ80(J.W,R->XX.B.h); break; case LD_HL_xWORD: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); R->XX.B.l=RdZ80(J.W++); R->XX.B.h=RdZ80(J.W); break; case LD_A_xWORD: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); R->AF.B.h=RdZ80(J.W); break; case LD_xWORD_A: J.B.l=OpZ80(R->PC.W++); J.B.h=OpZ80(R->PC.W++); WrZ80(J.W,R->AF.B.h); break; case EX_HL_xSP: J.B.l=RdZ80(R->SP.W);WrZ80(R->SP.W++,R->XX.B.l); J.B.h=RdZ80(R->SP.W);WrZ80(R->SP.W--,R->XX.B.h); R->XX.W=J.W; break; case DAA: J.W=R->AF.B.h; if(R->AF.B.l&C_FLAG) J.W|=256; if(R->AF.B.l&H_FLAG) J.W|=512; if(R->AF.B.l&N_FLAG) J.W|=1024; R->AF.W=DAATable[J.W]; break; z88dk-1.8.ds1/test/machine/Z80/ConDebug.c0000644000175000017500000001667510702217026017316 0ustar tygrystygrys/** Z80: portable Z80 emulator *******************************/ /** **/ /** ConDebug.c **/ /** **/ /** This file contains a console version of the built-in **/ /** debugger, using EMULib's Console.c. When -DCONDEBUG is **/ /** ommitted, ConDebug.c just includes the default command **/ /** line based debugger (Debug.c). **/ /** **/ /** Copyright (C) Marat Fayzullin 2005-2007 **/ /** You are not allowed to distribute this software **/ /** commercially. Please, notify me, if you make any **/ /** changes to this file. **/ /*************************************************************/ #ifdef DEBUG #ifndef CONDEBUG /** Normal DebugZ80() ****************************************/ /** When CONDEBUG #undefined, we use plain command line. **/ /*************************************************************/ #include "Debug.c" #else /** Console DebugZ80() ***************************************/ /** When CONDEBUG #defined, we use EMULib console. **/ /*************************************************************/ #include "Z80.h" #include "Console.h" #include #define DebugZ80 OriginalDebugZ80 #include "Debug.c" #undef DebugZ80 #define CLR_BACK PIXEL(255,255,255) #define CLR_TEXT PIXEL(0,0,0) #define CLR_DIALOG PIXEL(0,100,0) #define CLR_PC PIXEL(255,0,0) #define CLR_SP PIXEL(0,0,100) static byte ChrDump(byte C) { return((C>=32)&&(C<128)? C:'.'); } /** DebugZ80() ***********************************************/ /** This function should exist if DEBUG is #defined. When **/ /** Trace!=0, it is called after each command executed by **/ /** the CPU, and given the Z80 registers. **/ /*************************************************************/ byte DebugZ80(Z80 *R) { char S[1024]; word A,Addr,ABuf[20]; int J,I,K,X,Y,MemoryDump,DrawWindow,ExitNow; /* If we don't have enough screen estate... */ if((VideoW<32*8)||(VideoH<23*8)) { /* Show warning message */ CONMsg( -1,-1,-1,-1,PIXEL(255,255,255),PIXEL(255,0,0), "Error","Screen is\0too small!\0\0" ); /* Continue emulation */ R->Trace=0; return(1); } X = ((VideoW>>3)-32)>>1; Y = ((VideoH>>3)-23)>>1; Addr = R->PC.W; A = ~Addr; K = 0; for(DrawWindow=1,MemoryDump=ExitNow=0;!ExitNow&&VideoImg;) { if(DrawWindow) { CONWindow(X,Y,32,23,CLR_TEXT,CLR_BACK,"Z80 Debugger"); sprintf(S,"PC %04X",R->PC.W); CONSetColor(CLR_BACK,CLR_PC); CONPrint(X+24,Y+18,S); sprintf(S,"SP %04X",R->SP.W); CONSetColor(CLR_BACK,CLR_SP); CONPrint(X+24,Y+19,S); CONSetColor(CLR_TEXT,CLR_BACK); sprintf(S, " %c%c%c%c%c%c\n\n" "AF %04X\nBC %04X\nDE %04X\nHL %04X\nIX %04X\nIY %04X\n\n" "AF'%04X\nBC'%04X\nDE'%04X\nHL'%04X\n\n" "IR %02X%02X", R->AF.B.l&0x80? 'S':'.',R->AF.B.l&0x40? 'Z':'.',R->AF.B.l&0x10? 'H':'.', R->AF.B.l&0x04? 'P':'.',R->AF.B.l&0x02? 'N':'.',R->AF.B.l&0x01? 'C':'.', R->AF.W,R->BC.W,R->DE.W,R->HL.W, R->IX.W,R->IY.W, R->AF1.W,R->BC1.W,R->DE1.W,R->HL1.W, R->I,R->R ); CONPrint(X+24,Y+2,S); sprintf(S, "%s %s", R->IFF&0x04? "IM2":R->IFF&0x02? "IM1":"IM0", R->IFF&0x01? "EI":"DI" ); CONPrint(X+25,Y+21,S); DrawWindow=0; A=~Addr; } /* If top address has changed... */ if(A!=Addr) { /* Clear display */ CONBox((X+1)<<3,(Y+2)<<3,23*8,20*8,CLR_BACK); if(MemoryDump) { /* Draw memory dump */ for(J=0,A=Addr;J<20;J++,A+=4) { if(A==R->PC.W) CONSetColor(CLR_BACK,CLR_PC); else if(A==R->SP.W) CONSetColor(CLR_BACK,CLR_SP); else CONSetColor(CLR_TEXT,CLR_BACK); sprintf(S,"%04X%c",A,A==R->PC.W? CON_MORE:A==R->SP.W? CON_LESS:':'); CONPrint(X+1,Y+J+2,S); CONSetColor(CLR_TEXT,CLR_BACK); sprintf(S, "%02X %02X %02X %02X %c%c%c%c", RdZ80(A),RdZ80(A+1),RdZ80(A+2),RdZ80(A+3), ChrDump(RdZ80(A)),ChrDump(RdZ80(A+1)), ChrDump(RdZ80(A+2)),ChrDump(RdZ80(A+3)) ); CONPrint(X+7,Y+J+2,S); } } else { /* Draw listing */ for(J=0,A=Addr;J<20;J++) { if(A==R->PC.W) CONSetColor(CLR_BACK,CLR_PC); else if(A==R->SP.W) CONSetColor(CLR_BACK,CLR_SP); else CONSetColor(CLR_TEXT,CLR_BACK); sprintf(S,"%04X%c",A,A==R->PC.W? CON_MORE:A==R->SP.W? CON_LESS:':'); CONPrint(X+1,Y+J+2,S); ABuf[J]=A; A+=DAsm(S,A); CONSetColor(CLR_TEXT,CLR_BACK); CONPrintN(X+7,Y+J+2,S,23); } } /* Display redrawn */ A=Addr; } /* Draw pointer */ CONChar(X+6,Y+K+2,CON_ARROW); /* Show screen buffer */ ShowVideo(); /* Get key code */ I=WaitKey(); /* Clear pointer */ CONChar(X+6,Y+K+2,' '); /* Get and process key code */ switch(I) { case 'H': CONMsg( -1,-1,-1,-1, CLR_BACK,CLR_DIALOG, "Debugger Help", "ENTER - Execute next opcode\0" " UP - Previous opcode\0" " DOWN - Next opcode\0" " LEFT - Page up\0" "RIGHT - Page down\0" " H - This help page\0" " G - Go to address\0" " D - Disassembler view\0" " M - Memory dump view\0" " S - Show stack\0" " J - Jump to cursor\0" " R - Run to cursor\0" " C - Continue execution\0" " Q - Quit emulator\0" ); DrawWindow=1; break; case CON_UP: if(K) --K; else if(MemoryDump) Addr-=4; else for(--Addr;Addr+DAsm(S,Addr)>A;--Addr); break; case CON_DOWN: if(K<19) ++K; else if(MemoryDump) Addr+=4; else Addr+=DAsm(S,Addr); break; case CON_LEFT: if(MemoryDump) Addr-=4*20; else { for(I=20,Addr=~A;(Addr>A)||((A^Addr)&~Addr&0x8000);++I) for(J=0,Addr=A-I;J<20;++J) Addr+=DAsm(S,Addr); Addr=A-I+1; } break; case CON_RIGHT: if(MemoryDump) Addr+=4*20; else for(J=0;J<20;++J) Addr+=DAsm(S,Addr); break; case CON_OK: ExitNow=1; break; case 'Q': return(0); case CON_EXIT: case 'C': R->Trap=0xFFFF; R->Trace=0; ExitNow=1; break; case 'R': R->Trap=ABuf[K]; R->Trace=0; ExitNow=1; break; case 'M': MemoryDump=1; A=~Addr; break; case 'S': MemoryDump=1; Addr=R->SP.W; K=0; A=~Addr; break; case 'D': MemoryDump=0; A=~Addr; break; case 'G': if(CONInput(-1,-1,CLR_BACK,CLR_DIALOG,"Go to Address:",S,5|CON_HEX)) { Addr=strtol(S,0,16);K=0; } DrawWindow=1; break; case 'J': R->PC.W=ABuf[K]; A=~Addr; break; } } /* Continue emulation */ return(1); } #endif /* CONDEBUG */ #endif /* DEBUG */ z88dk-1.8.ds1/test/machine/Z80/Debug.c0000644000175000017500000004740710702217026016653 0ustar tygrystygrys/** Z80: portable Z80 emulator *******************************/ /** **/ /** Debug.c **/ /** **/ /** This file contains the built-in debugging routine for **/ /** the Z80 emulator which is called on each Z80 step when **/ /** Trap!=0. **/ /** **/ /** Copyright (C) Marat Fayzullin 1995-2007 **/ /** You are not allowed to distribute this software **/ /** commercially. Please, notify me, if you make any **/ /** changes to this file. **/ /*************************************************************/ #ifdef DEBUG #include "Z80.h" #include #include #include #ifdef FMSX #include "AY8910.h" extern AY8910 PSG; #endif static const char *Mnemonics[256] = { "NOP","LD BC,#h","LD (BC),A","INC BC","INC B","DEC B","LD B,*h","RLCA", "EX AF,AF'","ADD HL,BC","LD A,(BC)","DEC BC","INC C","DEC C","LD C,*h","RRCA", "DJNZ @h","LD DE,#h","LD (DE),A","INC DE","INC D","DEC D","LD D,*h","RLA", "JR @h","ADD HL,DE","LD A,(DE)","DEC DE","INC E","DEC E","LD E,*h","RRA", "JR NZ,@h","LD HL,#h","LD (#h),HL","INC HL","INC H","DEC H","LD H,*h","DAA", "JR Z,@h","ADD HL,HL","LD HL,(#h)","DEC HL","INC L","DEC L","LD L,*h","CPL", "JR NC,@h","LD SP,#h","LD (#h),A","INC SP","INC (HL)","DEC (HL)","LD (HL),*h","SCF", "JR C,@h","ADD HL,SP","LD A,(#h)","DEC SP","INC A","DEC A","LD A,*h","CCF", "LD B,B","LD B,C","LD B,D","LD B,E","LD B,H","LD B,L","LD B,(HL)","LD B,A", "LD C,B","LD C,C","LD C,D","LD C,E","LD C,H","LD C,L","LD C,(HL)","LD C,A", "LD D,B","LD D,C","LD D,D","LD D,E","LD D,H","LD D,L","LD D,(HL)","LD D,A", "LD E,B","LD E,C","LD E,D","LD E,E","LD E,H","LD E,L","LD E,(HL)","LD E,A", "LD H,B","LD H,C","LD H,D","LD H,E","LD H,H","LD H,L","LD H,(HL)","LD H,A", "LD L,B","LD L,C","LD L,D","LD L,E","LD L,H","LD L,L","LD L,(HL)","LD L,A", "LD (HL),B","LD (HL),C","LD (HL),D","LD (HL),E","LD (HL),H","LD (HL),L","HALT","LD (HL),A", "LD A,B","LD A,C","LD A,D","LD A,E","LD A,H","LD A,L","LD A,(HL)","LD A,A", "ADD B","ADD C","ADD D","ADD E","ADD H","ADD L","ADD (HL)","ADD A", "ADC B","ADC C","ADC D","ADC E","ADC H","ADC L","ADC (HL)","ADC A", "SUB B","SUB C","SUB D","SUB E","SUB H","SUB L","SUB (HL)","SUB A", "SBC B","SBC C","SBC D","SBC E","SBC H","SBC L","SBC (HL)","SBC A", "AND B","AND C","AND D","AND E","AND H","AND L","AND (HL)","AND A", "XOR B","XOR C","XOR D","XOR E","XOR H","XOR L","XOR (HL)","XOR A", "OR B","OR C","OR D","OR E","OR H","OR L","OR (HL)","OR A", "CP B","CP C","CP D","CP E","CP H","CP L","CP (HL)","CP A", "RET NZ","POP BC","JP NZ,#h","JP #h","CALL NZ,#h","PUSH BC","ADD *h","RST 00h", "RET Z","RET","JP Z,#h","PFX_CB","CALL Z,#h","CALL #h","ADC *h","RST 08h", "RET NC","POP DE","JP NC,#h","OUTA (*h)","CALL NC,#h","PUSH DE","SUB *h","RST 10h", "RET C","EXX","JP C,#h","INA (*h)","CALL C,#h","PFX_DD","SBC *h","RST 18h", "RET PO","POP HL","JP PO,#h","EX HL,(SP)","CALL PO,#h","PUSH HL","AND *h","RST 20h", "RET PE","LD PC,HL","JP PE,#h","EX DE,HL","CALL PE,#h","PFX_ED","XOR *h","RST 28h", "RET P","POP AF","JP P,#h","DI","CALL P,#h","PUSH AF","OR *h","RST 30h", "RET M","LD SP,HL","JP M,#h","EI","CALL M,#h","PFX_FD","CP *h","RST 38h" }; static const char *MnemonicsCB[256] = { "RLC B","RLC C","RLC D","RLC E","RLC H","RLC L","RLC (HL)","RLC A", "RRC B","RRC C","RRC D","RRC E","RRC H","RRC L","RRC (HL)","RRC A", "RL B","RL C","RL D","RL E","RL H","RL L","RL (HL)","RL A", "RR B","RR C","RR D","RR E","RR H","RR L","RR (HL)","RR A", "SLA B","SLA C","SLA D","SLA E","SLA H","SLA L","SLA (HL)","SLA A", "SRA B","SRA C","SRA D","SRA E","SRA H","SRA L","SRA (HL)","SRA A", "SLL B","SLL C","SLL D","SLL E","SLL H","SLL L","SLL (HL)","SLL A", "SRL B","SRL C","SRL D","SRL E","SRL H","SRL L","SRL (HL)","SRL A", "BIT 0,B","BIT 0,C","BIT 0,D","BIT 0,E","BIT 0,H","BIT 0,L","BIT 0,(HL)","BIT 0,A", "BIT 1,B","BIT 1,C","BIT 1,D","BIT 1,E","BIT 1,H","BIT 1,L","BIT 1,(HL)","BIT 1,A", "BIT 2,B","BIT 2,C","BIT 2,D","BIT 2,E","BIT 2,H","BIT 2,L","BIT 2,(HL)","BIT 2,A", "BIT 3,B","BIT 3,C","BIT 3,D","BIT 3,E","BIT 3,H","BIT 3,L","BIT 3,(HL)","BIT 3,A", "BIT 4,B","BIT 4,C","BIT 4,D","BIT 4,E","BIT 4,H","BIT 4,L","BIT 4,(HL)","BIT 4,A", "BIT 5,B","BIT 5,C","BIT 5,D","BIT 5,E","BIT 5,H","BIT 5,L","BIT 5,(HL)","BIT 5,A", "BIT 6,B","BIT 6,C","BIT 6,D","BIT 6,E","BIT 6,H","BIT 6,L","BIT 6,(HL)","BIT 6,A", "BIT 7,B","BIT 7,C","BIT 7,D","BIT 7,E","BIT 7,H","BIT 7,L","BIT 7,(HL)","BIT 7,A", "RES 0,B","RES 0,C","RES 0,D","RES 0,E","RES 0,H","RES 0,L","RES 0,(HL)","RES 0,A", "RES 1,B","RES 1,C","RES 1,D","RES 1,E","RES 1,H","RES 1,L","RES 1,(HL)","RES 1,A", "RES 2,B","RES 2,C","RES 2,D","RES 2,E","RES 2,H","RES 2,L","RES 2,(HL)","RES 2,A", "RES 3,B","RES 3,C","RES 3,D","RES 3,E","RES 3,H","RES 3,L","RES 3,(HL)","RES 3,A", "RES 4,B","RES 4,C","RES 4,D","RES 4,E","RES 4,H","RES 4,L","RES 4,(HL)","RES 4,A", "RES 5,B","RES 5,C","RES 5,D","RES 5,E","RES 5,H","RES 5,L","RES 5,(HL)","RES 5,A", "RES 6,B","RES 6,C","RES 6,D","RES 6,E","RES 6,H","RES 6,L","RES 6,(HL)","RES 6,A", "RES 7,B","RES 7,C","RES 7,D","RES 7,E","RES 7,H","RES 7,L","RES 7,(HL)","RES 7,A", "SET 0,B","SET 0,C","SET 0,D","SET 0,E","SET 0,H","SET 0,L","SET 0,(HL)","SET 0,A", "SET 1,B","SET 1,C","SET 1,D","SET 1,E","SET 1,H","SET 1,L","SET 1,(HL)","SET 1,A", "SET 2,B","SET 2,C","SET 2,D","SET 2,E","SET 2,H","SET 2,L","SET 2,(HL)","SET 2,A", "SET 3,B","SET 3,C","SET 3,D","SET 3,E","SET 3,H","SET 3,L","SET 3,(HL)","SET 3,A", "SET 4,B","SET 4,C","SET 4,D","SET 4,E","SET 4,H","SET 4,L","SET 4,(HL)","SET 4,A", "SET 5,B","SET 5,C","SET 5,D","SET 5,E","SET 5,H","SET 5,L","SET 5,(HL)","SET 5,A", "SET 6,B","SET 6,C","SET 6,D","SET 6,E","SET 6,H","SET 6,L","SET 6,(HL)","SET 6,A", "SET 7,B","SET 7,C","SET 7,D","SET 7,E","SET 7,H","SET 7,L","SET 7,(HL)","SET 7,A" }; static const char *MnemonicsED[256] = { "DB EDh,00h","DB EDh,01h","DB EDh,02h","DB EDh,03h", "DB EDh,04h","DB EDh,05h","DB EDh,06h","DB EDh,07h", "DB EDh,08h","DB EDh,09h","DB EDh,0Ah","DB EDh,0Bh", "DB EDh,0Ch","DB EDh,0Dh","DB EDh,0Eh","DB EDh,0Fh", "DB EDh,10h","DB EDh,11h","DB EDh,12h","DB EDh,13h", "DB EDh,14h","DB EDh,15h","DB EDh,16h","DB EDh,17h", "DB EDh,18h","DB EDh,19h","DB EDh,1Ah","DB EDh,1Bh", "DB EDh,1Ch","DB EDh,1Dh","DB EDh,1Eh","DB EDh,1Fh", "DB EDh,20h","DB EDh,21h","DB EDh,22h","DB EDh,23h", "DB EDh,24h","DB EDh,25h","DB EDh,26h","DB EDh,27h", "DB EDh,28h","DB EDh,29h","DB EDh,2Ah","DB EDh,2Bh", "DB EDh,2Ch","DB EDh,2Dh","DB EDh,2Eh","DB EDh,2Fh", "DB EDh,30h","DB EDh,31h","DB EDh,32h","DB EDh,33h", "DB EDh,34h","DB EDh,35h","DB EDh,36h","DB EDh,37h", "DB EDh,38h","DB EDh,39h","DB EDh,3Ah","DB EDh,3Bh", "DB EDh,3Ch","DB EDh,3Dh","DB EDh,3Eh","DB EDh,3Fh", "IN B,(C)","OUT (C),B","SBC HL,BC","LD (#h),BC", "NEG","RETN","IM 0","LD I,A", "IN C,(C)","OUT (C),C","ADC HL,BC","LD BC,(#h)", "DB EDh,4Ch","RETI","DB EDh,4Eh","LD R,A", "IN D,(C)","OUT (C),D","SBC HL,DE","LD (#h),DE", "DB EDh,54h","DB EDh,55h","IM 1","LD A,I", "IN E,(C)","OUT (C),E","ADC HL,DE","LD DE,(#h)", "DB EDh,5Ch","DB EDh,5Dh","IM 2","LD A,R", "IN H,(C)","OUT (C),H","SBC HL,HL","LD (#h),HL", "DB EDh,64h","DB EDh,65h","DB EDh,66h","RRD", "IN L,(C)","OUT (C),L","ADC HL,HL","LD HL,(#h)", "DB EDh,6Ch","DB EDh,6Dh","DB EDh,6Eh","RLD", "IN F,(C)","DB EDh,71h","SBC HL,SP","LD (#h),SP", "DB EDh,74h","DB EDh,75h","DB EDh,76h","DB EDh,77h", "IN A,(C)","OUT (C),A","ADC HL,SP","LD SP,(#h)", "DB EDh,7Ch","DB EDh,7Dh","DB EDh,7Eh","DB EDh,7Fh", "DB EDh,80h","DB EDh,81h","DB EDh,82h","DB EDh,83h", "DB EDh,84h","DB EDh,85h","DB EDh,86h","DB EDh,87h", "DB EDh,88h","DB EDh,89h","DB EDh,8Ah","DB EDh,8Bh", "DB EDh,8Ch","DB EDh,8Dh","DB EDh,8Eh","DB EDh,8Fh", "DB EDh,90h","DB EDh,91h","DB EDh,92h","DB EDh,93h", "DB EDh,94h","DB EDh,95h","DB EDh,96h","DB EDh,97h", "DB EDh,98h","DB EDh,99h","DB EDh,9Ah","DB EDh,9Bh", "DB EDh,9Ch","DB EDh,9Dh","DB EDh,9Eh","DB EDh,9Fh", "LDI","CPI","INI","OUTI", "DB EDh,A4h","DB EDh,A5h","DB EDh,A6h","DB EDh,A7h", "LDD","CPD","IND","OUTD", "DB EDh,ACh","DB EDh,ADh","DB EDh,AEh","DB EDh,AFh", "LDIR","CPIR","INIR","OTIR", "DB EDh,B4h","DB EDh,B5h","DB EDh,B6h","DB EDh,B7h", "LDDR","CPDR","INDR","OTDR", "DB EDh,BCh","DB EDh,BDh","DB EDh,BEh","DB EDh,BFh", "DB EDh,C0h","DB EDh,C1h","DB EDh,C2h","DB EDh,C3h", "DB EDh,C4h","DB EDh,C5h","DB EDh,C6h","DB EDh,C7h", "DB EDh,C8h","DB EDh,C9h","DB EDh,CAh","DB EDh,CBh", "DB EDh,CCh","DB EDh,CDh","DB EDh,CEh","DB EDh,CFh", "DB EDh,D0h","DB EDh,D1h","DB EDh,D2h","DB EDh,D3h", "DB EDh,D4h","DB EDh,D5h","DB EDh,D6h","DB EDh,D7h", "DB EDh,D8h","DB EDh,D9h","DB EDh,DAh","DB EDh,DBh", "DB EDh,DCh","DB EDh,DDh","DB EDh,DEh","DB EDh,DFh", "DB EDh,E0h","DB EDh,E1h","DB EDh,E2h","DB EDh,E3h", "DB EDh,E4h","DB EDh,E5h","DB EDh,E6h","DB EDh,E7h", "DB EDh,E8h","DB EDh,E9h","DB EDh,EAh","DB EDh,EBh", "DB EDh,ECh","DB EDh,EDh","DB EDh,EEh","DB EDh,EFh", "DB EDh,F0h","DB EDh,F1h","DB EDh,F2h","DB EDh,F3h", "DB EDh,F4h","DB EDh,F5h","DB EDh,F6h","DB EDh,F7h", "DB EDh,F8h","DB EDh,F9h","DB EDh,FAh","DB EDh,FBh", "DB EDh,FCh","DB EDh,FDh","DB EDh,FEh","DB EDh,FFh" }; static const char *MnemonicsXX[256] = { "NOP","LD BC,#h","LD (BC),A","INC BC","INC B","DEC B","LD B,*h","RLCA", "EX AF,AF'","ADD I%,BC","LD A,(BC)","DEC BC","INC C","DEC C","LD C,*h","RRCA", "DJNZ @h","LD DE,#h","LD (DE),A","INC DE","INC D","DEC D","LD D,*h","RLA", "JR @h","ADD I%,DE","LD A,(DE)","DEC DE","INC E","DEC E","LD E,*h","RRA", "JR NZ,@h","LD I%,#h","LD (#h),I%","INC I%","INC I%h","DEC I%h","LD I%h,*h","DAA", "JR Z,@h","ADD I%,I%","LD I%,(#h)","DEC I%","INC I%l","DEC I%l","LD I%l,*h","CPL", "JR NC,@h","LD SP,#h","LD (#h),A","INC SP","INC (I%+^h)","DEC (I%+^h)","LD (I%+^h),*h","SCF", "JR C,@h","ADD I%,SP","LD A,(#h)","DEC SP","INC A","DEC A","LD A,*h","CCF", "LD B,B","LD B,C","LD B,D","LD B,E","LD B,I%h","LD B,I%l","LD B,(I%+^h)","LD B,A", "LD C,B","LD C,C","LD C,D","LD C,E","LD C,I%h","LD C,I%l","LD C,(I%+^h)","LD C,A", "LD D,B","LD D,C","LD D,D","LD D,E","LD D,I%h","LD D,I%l","LD D,(I%+^h)","LD D,A", "LD E,B","LD E,C","LD E,D","LD E,E","LD E,I%h","LD E,I%l","LD E,(I%+^h)","LD E,A", "LD I%h,B","LD I%h,C","LD I%h,D","LD I%h,E","LD I%h,I%h","LD I%h,I%l","LD H,(I%+^h)","LD I%h,A", "LD I%l,B","LD I%l,C","LD I%l,D","LD I%l,E","LD I%l,I%h","LD I%l,I%l","LD L,(I%+^h)","LD I%l,A", "LD (I%+^h),B","LD (I%+^h),C","LD (I%+^h),D","LD (I%+^h),E","LD (I%+^h),H","LD (I%+^h),L","HALT","LD (I%+^h),A", "LD A,B","LD A,C","LD A,D","LD A,E","LD A,I%h","LD A,I%l","LD A,(I%+^h)","LD A,A", "ADD B","ADD C","ADD D","ADD E","ADD I%h","ADD I%l","ADD (I%+^h)","ADD A", "ADC B","ADC C","ADC D","ADC E","ADC I%h","ADC I%l","ADC (I%+^h)","ADC,A", "SUB B","SUB C","SUB D","SUB E","SUB I%h","SUB I%l","SUB (I%+^h)","SUB A", "SBC B","SBC C","SBC D","SBC E","SBC I%h","SBC I%l","SBC (I%+^h)","SBC A", "AND B","AND C","AND D","AND E","AND I%h","AND I%l","AND (I%+^h)","AND A", "XOR B","XOR C","XOR D","XOR E","XOR I%h","XOR I%l","XOR (I%+^h)","XOR A", "OR B","OR C","OR D","OR E","OR I%h","OR I%l","OR (I%+^h)","OR A", "CP B","CP C","CP D","CP E","CP I%h","CP I%l","CP (I%+^h)","CP A", "RET NZ","POP BC","JP NZ,#h","JP #h","CALL NZ,#h","PUSH BC","ADD *h","RST 00h", "RET Z","RET","JP Z,#h","PFX_CB","CALL Z,#h","CALL #h","ADC *h","RST 08h", "RET NC","POP DE","JP NC,#h","OUTA (*h)","CALL NC,#h","PUSH DE","SUB *h","RST 10h", "RET C","EXX","JP C,#h","INA (*h)","CALL C,#h","PFX_DD","SBC *h","RST 18h", "RET PO","POP I%","JP PO,#h","EX I%,(SP)","CALL PO,#h","PUSH I%","AND *h","RST 20h", "RET PE","LD PC,I%","JP PE,#h","EX DE,I%","CALL PE,#h","PFX_ED","XOR *h","RST 28h", "RET P","POP AF","JP P,#h","DI","CALL P,#h","PUSH AF","OR *h","RST 30h", "RET M","LD SP,I%","JP M,#h","EI","CALL M,#h","PFX_FD","CP *h","RST 38h" }; static const char *MnemonicsXCB[256] = { "RLC B","RLC C","RLC D","RLC E","RLC H","RLC L","RLC (I%@h)","RLC A", "RRC B","RRC C","RRC D","RRC E","RRC H","RRC L","RRC (I%@h)","RRC A", "RL B","RL C","RL D","RL E","RL H","RL L","RL (I%@h)","RL A", "RR B","RR C","RR D","RR E","RR H","RR L","RR (I%@h)","RR A", "SLA B","SLA C","SLA D","SLA E","SLA H","SLA L","SLA (I%@h)","SLA A", "SRA B","SRA C","SRA D","SRA E","SRA H","SRA L","SRA (I%@h)","SRA A", "SLL B","SLL C","SLL D","SLL E","SLL H","SLL L","SLL (I%@h)","SLL A", "SRL B","SRL C","SRL D","SRL E","SRL H","SRL L","SRL (I%@h)","SRL A", "BIT 0,B","BIT 0,C","BIT 0,D","BIT 0,E","BIT 0,H","BIT 0,L","BIT 0,(I%@h)","BIT 0,A", "BIT 1,B","BIT 1,C","BIT 1,D","BIT 1,E","BIT 1,H","BIT 1,L","BIT 1,(I%@h)","BIT 1,A", "BIT 2,B","BIT 2,C","BIT 2,D","BIT 2,E","BIT 2,H","BIT 2,L","BIT 2,(I%@h)","BIT 2,A", "BIT 3,B","BIT 3,C","BIT 3,D","BIT 3,E","BIT 3,H","BIT 3,L","BIT 3,(I%@h)","BIT 3,A", "BIT 4,B","BIT 4,C","BIT 4,D","BIT 4,E","BIT 4,H","BIT 4,L","BIT 4,(I%@h)","BIT 4,A", "BIT 5,B","BIT 5,C","BIT 5,D","BIT 5,E","BIT 5,H","BIT 5,L","BIT 5,(I%@h)","BIT 5,A", "BIT 6,B","BIT 6,C","BIT 6,D","BIT 6,E","BIT 6,H","BIT 6,L","BIT 6,(I%@h)","BIT 6,A", "BIT 7,B","BIT 7,C","BIT 7,D","BIT 7,E","BIT 7,H","BIT 7,L","BIT 7,(I%@h)","BIT 7,A", "RES 0,B","RES 0,C","RES 0,D","RES 0,E","RES 0,H","RES 0,L","RES 0,(I%@h)","RES 0,A", "RES 1,B","RES 1,C","RES 1,D","RES 1,E","RES 1,H","RES 1,L","RES 1,(I%@h)","RES 1,A", "RES 2,B","RES 2,C","RES 2,D","RES 2,E","RES 2,H","RES 2,L","RES 2,(I%@h)","RES 2,A", "RES 3,B","RES 3,C","RES 3,D","RES 3,E","RES 3,H","RES 3,L","RES 3,(I%@h)","RES 3,A", "RES 4,B","RES 4,C","RES 4,D","RES 4,E","RES 4,H","RES 4,L","RES 4,(I%@h)","RES 4,A", "RES 5,B","RES 5,C","RES 5,D","RES 5,E","RES 5,H","RES 5,L","RES 5,(I%@h)","RES 5,A", "RES 6,B","RES 6,C","RES 6,D","RES 6,E","RES 6,H","RES 6,L","RES 6,(I%@h)","RES 6,A", "RES 7,B","RES 7,C","RES 7,D","RES 7,E","RES 7,H","RES 7,L","RES 7,(I%@h)","RES 7,A", "SET 0,B","SET 0,C","SET 0,D","SET 0,E","SET 0,H","SET 0,L","SET 0,(I%@h)","SET 0,A", "SET 1,B","SET 1,C","SET 1,D","SET 1,E","SET 1,H","SET 1,L","SET 1,(I%@h)","SET 1,A", "SET 2,B","SET 2,C","SET 2,D","SET 2,E","SET 2,H","SET 2,L","SET 2,(I%@h)","SET 2,A", "SET 3,B","SET 3,C","SET 3,D","SET 3,E","SET 3,H","SET 3,L","SET 3,(I%@h)","SET 3,A", "SET 4,B","SET 4,C","SET 4,D","SET 4,E","SET 4,H","SET 4,L","SET 4,(I%@h)","SET 4,A", "SET 5,B","SET 5,C","SET 5,D","SET 5,E","SET 5,H","SET 5,L","SET 5,(I%@h)","SET 5,A", "SET 6,B","SET 6,C","SET 6,D","SET 6,E","SET 6,H","SET 6,L","SET 6,(I%@h)","SET 6,A", "SET 7,B","SET 7,C","SET 7,D","SET 7,E","SET 7,H","SET 7,L","SET 7,(I%@h)","SET 7,A" }; /** DAsm() ***************************************************/ /** DAsm() will disassemble the code at adress A and put **/ /** the output text into S. It will return the number of **/ /** bytes disassembled. **/ /*************************************************************/ static int DAsm(char *S,word A) { char R[128],H[10],C,*P; const char *T; byte J,Offset; word B; Offset=0; B=A; C='\0'; J=0; switch(RdZ80(B)) { case 0xCB: B++;T=MnemonicsCB[RdZ80(B++)];break; case 0xED: B++;T=MnemonicsED[RdZ80(B++)];break; case 0xDD: B++;C='X'; if(RdZ80(B)!=0xCB) T=MnemonicsXX[RdZ80(B++)]; else { B++;Offset=RdZ80(B++);J=1;T=MnemonicsXCB[RdZ80(B++)]; } break; case 0xFD: B++;C='Y'; if(RdZ80(B)!=0xCB) T=MnemonicsXX[RdZ80(B++)]; else { B++;Offset=RdZ80(B++);J=1;T=MnemonicsXCB[RdZ80(B++)]; } break; default: T=Mnemonics[RdZ80(B++)]; } if(P=strchr(T,'^')) { strncpy(R,T,P-T);R[P-T]='\0'; sprintf(H,"%02X",RdZ80(B++)); strcat(R,H);strcat(R,P+1); } else strcpy(R,T); if(P=strchr(R,'%')) *P=C; if(P=strchr(R,'*')) { strncpy(S,R,P-R);S[P-R]='\0'; sprintf(H,"%02X",RdZ80(B++)); strcat(S,H);strcat(S,P+1); } else if(P=strchr(R,'@')) { strncpy(S,R,P-R);S[P-R]='\0'; if(!J) Offset=RdZ80(B++); strcat(S,Offset&0x80? "-":"+"); J=Offset&0x80? 256-Offset:Offset; sprintf(H,"%02X",J); strcat(S,H);strcat(S,P+1); } else if(P=strchr(R,'#')) { strncpy(S,R,P-R);S[P-R]='\0'; sprintf(H,"%04X",RdZ80(B)+256*RdZ80(B+1)); strcat(S,H);strcat(S,P+1); B+=2; } else strcpy(S,R); return(B-A); } /** DebugZ80() ***********************************************/ /** This function should exist if DEBUG is #defined. When **/ /** Trace!=0, it is called after each command executed by **/ /** the CPU, and given the Z80 registers. **/ /*************************************************************/ byte DebugZ80(Z80 *R) { static const char Flags[9] = "SZ.H.PNC"; char S[128],T[10]; byte J,I; DAsm(S,R->PC.W); for(J=0,I=R->AF.B.l;J<8;J++,I<<=1) T[J]=I&0x80? Flags[J]:'.'; T[8]='\0'; printf ( "AF:%04X HL:%04X DE:%04X BC:%04X PC:%04X SP:%04X IX:%04X IY:%04X I:%02X\n", R->AF.W,R->HL.W,R->DE.W,R->BC.W,R->PC.W,R->SP.W,R->IX.W,R->IY.W,R->I ); printf ( "AT PC: [%02X - %s] AT SP: [%04X] FLAGS: [%s] %s: %s\n\n", RdZ80(R->PC.W),S,RdZ80(R->SP.W)+RdZ80(R->SP.W+1)*256,T, R->IFF&0x04? "IM2":R->IFF&0x02? "IM1":"IM0", R->IFF&0x01? "EI":"DI" ); while(1) { printf("\n[Command,'?']-> "); fflush(stdout);fflush(stdin); fgets(S,50,stdin); for(J=0;S[J]>=' ';J++) S[J]=toupper(S[J]); S[J]='\0'; switch(S[0]) { case 'H': case '?': puts("\n***** Built-in Z80 Debugger Commands *****"); puts(" : Break at next instruction"); puts("= : Break at addr"); puts("+ : Break at PC + offset"); puts("c : Continue without break"); puts("j : Continue from addr"); puts("m : Memory dump at addr"); puts("d : Disassembly at addr"); puts("?,h : Show this help text"); puts("q : Exit Z80 emulation"); break; case '\0': return(1); case '=': if(strlen(S)>=2) { sscanf(S+1,"%hX",&(R->Trap));R->Trace=0;return(1); } break; case '+': if(strlen(S)>=2) { sscanf(S+1,"%hX",&(R->Trap)); R->Trap+=R->PC.W;R->Trace=0; return(1); } break; case 'J': if(strlen(S)>=2) { sscanf(S+1,"%hX",&(R->PC.W));R->Trace=0;return(1); } break; case 'C': R->Trap=0xFFFF;R->Trace=0;return(1); case 'Q': return(0); case 'M': { word Addr; if(strlen(S)>1) sscanf(S+1,"%hX",&Addr); else Addr=R->PC.W; puts(""); for(J=0;J<16;J++) { printf("%04X: ",Addr); for(I=0;I<16;I++,Addr++) printf("%02X ",RdZ80(Addr)); printf(" | ");Addr-=16; for(I=0;I<16;I++,Addr++) putchar(isprint(RdZ80(Addr))? RdZ80(Addr):'.'); puts(""); } } break; case 'D': { word Addr; if(strlen(S)>1) sscanf(S+1,"%hX",&Addr); else Addr=R->PC.W; puts(""); for(J=0;J<16;J++) { printf("%04X: ",Addr); Addr+=DAsm(S,Addr); puts(S); } } break; #ifdef FMSX case 'S': for(J=0;J /** INLINE ***************************************************/ /** C99 standard has "inline", but older compilers used **/ /** __inline for the same purpose. **/ /*************************************************************/ #ifdef __C99__ #define INLINE inline #else #define INLINE __inline #endif /** System-Dependent Stuff ***********************************/ /** This is system-dependent code put here to speed things **/ /** up. It has to stay inlined to be fast. **/ /*************************************************************/ #ifdef COLEM #define RdZ80 RDZ80 extern byte *ROMPage[]; INLINE byte RdZ80(word A) { return(ROMPage[A>>13][A&0x1FFF]); } #endif #ifdef SPECCY #define RdZ80 RDZ80 #define WrZ80 WRZ80 extern byte *Page[],*ROM; INLINE byte RdZ80(word A) { return(Page[A>>13][A&0x1FFF]); } INLINE void WrZ80(word A,byte V) { if(Page[A>>13]>13][A&0x1FFF]=V; } #endif #ifdef Z88DK extern byte RAM[65536]; //#define RdZ80 RDZ80 //#define WrZ80 WRZ80 INLINE byte RdZ80(word A) { return(RAM[A]); } INLINE void WrZ80(word A, byte V) { RAM[A] = V; } #define InZ80(a) (0xFF) #define OutZ80(a,v) #endif #ifdef MG #define RdZ80 RDZ80 extern byte *Page[]; INLINE byte RdZ80(word A) { return(Page[A>>13][A&0x1FFF]); } #endif #ifdef FMSX #define FAST_RDOP extern byte *RAM[]; INLINE byte OpZ80(word A) { return(RAM[A>>13][A&0x1FFF]); } #endif /** FAST_RDOP ************************************************/ /** With this #define not present, RdZ80() should perform **/ /** the functions of OpZ80(). **/ /*************************************************************/ #ifndef FAST_RDOP #define OpZ80(A) RdZ80(A) #endif #define S(Fl) R->AF.B.l|=Fl #define R(Fl) R->AF.B.l&=~(Fl) #define FLAGS(Rg,Fl) R->AF.B.l=Fl|ZSTable[Rg] #define M_RLC(Rg) \ R->AF.B.l=Rg>>7;Rg=(Rg<<1)|R->AF.B.l;R->AF.B.l|=PZSTable[Rg] #define M_RRC(Rg) \ R->AF.B.l=Rg&0x01;Rg=(Rg>>1)|(R->AF.B.l<<7);R->AF.B.l|=PZSTable[Rg] #define M_RL(Rg) \ if(Rg&0x80) \ { \ Rg=(Rg<<1)|(R->AF.B.l&C_FLAG); \ R->AF.B.l=PZSTable[Rg]|C_FLAG; \ } \ else \ { \ Rg=(Rg<<1)|(R->AF.B.l&C_FLAG); \ R->AF.B.l=PZSTable[Rg]; \ } #define M_RR(Rg) \ if(Rg&0x01) \ { \ Rg=(Rg>>1)|(R->AF.B.l<<7); \ R->AF.B.l=PZSTable[Rg]|C_FLAG; \ } \ else \ { \ Rg=(Rg>>1)|(R->AF.B.l<<7); \ R->AF.B.l=PZSTable[Rg]; \ } #define M_SLA(Rg) \ R->AF.B.l=Rg>>7;Rg<<=1;R->AF.B.l|=PZSTable[Rg] #define M_SRA(Rg) \ R->AF.B.l=Rg&C_FLAG;Rg=(Rg>>1)|(Rg&0x80);R->AF.B.l|=PZSTable[Rg] #define M_SLL(Rg) \ R->AF.B.l=Rg>>7;Rg=(Rg<<1)|0x01;R->AF.B.l|=PZSTable[Rg] #define M_SRL(Rg) \ R->AF.B.l=Rg&0x01;Rg>>=1;R->AF.B.l|=PZSTable[Rg] #define M_BIT(Bit,Rg) \ R->AF.B.l=(R->AF.B.l&C_FLAG)|H_FLAG|PZSTable[Rg&(1<Rg.B.l=OpZ80(R->SP.W++);R->Rg.B.h=OpZ80(R->SP.W++) #define M_PUSH(Rg) \ WrZ80(--R->SP.W,R->Rg.B.h);WrZ80(--R->SP.W,R->Rg.B.l) #define M_CALL \ J.B.l=OpZ80(R->PC.W++);J.B.h=OpZ80(R->PC.W++); \ WrZ80(--R->SP.W,R->PC.B.h);WrZ80(--R->SP.W,R->PC.B.l); \ R->PC.W=J.W; \ JumpZ80(J.W) #define M_JP J.B.l=OpZ80(R->PC.W++);J.B.h=OpZ80(R->PC.W);R->PC.W=J.W;JumpZ80(J.W) #define M_JR R->PC.W+=(offset)OpZ80(R->PC.W)+1;JumpZ80(R->PC.W) #define M_RET R->PC.B.l=OpZ80(R->SP.W++);R->PC.B.h=OpZ80(R->SP.W++);JumpZ80(R->PC.W) #define M_RST(Ad) \ WrZ80(--R->SP.W,R->PC.B.h);WrZ80(--R->SP.W,R->PC.B.l);R->PC.W=Ad;JumpZ80(Ad) #define M_LDWORD(Rg) \ R->Rg.B.l=OpZ80(R->PC.W++);R->Rg.B.h=OpZ80(R->PC.W++) #define M_ADD(Rg) \ J.W=R->AF.B.h+Rg; \ R->AF.B.l= \ (~(R->AF.B.h^Rg)&(Rg^J.B.l)&0x80? V_FLAG:0)| \ J.B.h|ZSTable[J.B.l]| \ ((R->AF.B.h^Rg^J.B.l)&H_FLAG); \ R->AF.B.h=J.B.l #define M_SUB(Rg) \ J.W=R->AF.B.h-Rg; \ R->AF.B.l= \ ((R->AF.B.h^Rg)&(R->AF.B.h^J.B.l)&0x80? V_FLAG:0)| \ N_FLAG|-J.B.h|ZSTable[J.B.l]| \ ((R->AF.B.h^Rg^J.B.l)&H_FLAG); \ R->AF.B.h=J.B.l #define M_ADC(Rg) \ J.W=R->AF.B.h+Rg+(R->AF.B.l&C_FLAG); \ R->AF.B.l= \ (~(R->AF.B.h^Rg)&(Rg^J.B.l)&0x80? V_FLAG:0)| \ J.B.h|ZSTable[J.B.l]| \ ((R->AF.B.h^Rg^J.B.l)&H_FLAG); \ R->AF.B.h=J.B.l #define M_SBC(Rg) \ J.W=R->AF.B.h-Rg-(R->AF.B.l&C_FLAG); \ R->AF.B.l= \ ((R->AF.B.h^Rg)&(R->AF.B.h^J.B.l)&0x80? V_FLAG:0)| \ N_FLAG|-J.B.h|ZSTable[J.B.l]| \ ((R->AF.B.h^Rg^J.B.l)&H_FLAG); \ R->AF.B.h=J.B.l #define M_CP(Rg) \ J.W=R->AF.B.h-Rg; \ R->AF.B.l= \ ((R->AF.B.h^Rg)&(R->AF.B.h^J.B.l)&0x80? V_FLAG:0)| \ N_FLAG|-J.B.h|ZSTable[J.B.l]| \ ((R->AF.B.h^Rg^J.B.l)&H_FLAG) #define M_AND(Rg) R->AF.B.h&=Rg;R->AF.B.l=H_FLAG|PZSTable[R->AF.B.h] #define M_OR(Rg) R->AF.B.h|=Rg;R->AF.B.l=PZSTable[R->AF.B.h] #define M_XOR(Rg) R->AF.B.h^=Rg;R->AF.B.l=PZSTable[R->AF.B.h] #define M_IN(Rg) \ Rg=InZ80(R->BC.W); \ R->AF.B.l=PZSTable[Rg]|(R->AF.B.l&C_FLAG) #define M_INC(Rg) \ Rg++; \ R->AF.B.l= \ (R->AF.B.l&C_FLAG)|ZSTable[Rg]| \ (Rg==0x80? V_FLAG:0)|(Rg&0x0F? 0:H_FLAG) #define M_DEC(Rg) \ Rg--; \ R->AF.B.l= \ N_FLAG|(R->AF.B.l&C_FLAG)|ZSTable[Rg]| \ (Rg==0x7F? V_FLAG:0)|((Rg&0x0F)==0x0F? H_FLAG:0) #define M_ADDW(Rg1,Rg2) \ J.W=(R->Rg1.W+R->Rg2.W)&0xFFFF; \ R->AF.B.l= \ (R->AF.B.l&~(H_FLAG|N_FLAG|C_FLAG))| \ ((R->Rg1.W^R->Rg2.W^J.W)&0x1000? H_FLAG:0)| \ (((long)R->Rg1.W+(long)R->Rg2.W)&0x10000? C_FLAG:0); \ R->Rg1.W=J.W #define M_ADCW(Rg) \ I=R->AF.B.l&C_FLAG;J.W=(R->HL.W+R->Rg.W+I)&0xFFFF; \ R->AF.B.l= \ (((long)R->HL.W+(long)R->Rg.W+(long)I)&0x10000? C_FLAG:0)| \ (~(R->HL.W^R->Rg.W)&(R->Rg.W^J.W)&0x8000? V_FLAG:0)| \ ((R->HL.W^R->Rg.W^J.W)&0x1000? H_FLAG:0)| \ (J.W? 0:Z_FLAG)|(J.B.h&S_FLAG); \ R->HL.W=J.W #define M_SBCW(Rg) \ I=R->AF.B.l&C_FLAG;J.W=(R->HL.W-R->Rg.W-I)&0xFFFF; \ R->AF.B.l= \ N_FLAG| \ (((long)R->HL.W-(long)R->Rg.W-(long)I)&0x10000? C_FLAG:0)| \ ((R->HL.W^R->Rg.W)&(R->HL.W^J.W)&0x8000? V_FLAG:0)| \ ((R->HL.W^R->Rg.W^J.W)&0x1000? H_FLAG:0)| \ (J.W? 0:Z_FLAG)|(J.B.h&S_FLAG); \ R->HL.W=J.W enum Codes { NOP,LD_BC_WORD,LD_xBC_A,INC_BC,INC_B,DEC_B,LD_B_BYTE,RLCA, EX_AF_AF,ADD_HL_BC,LD_A_xBC,DEC_BC,INC_C,DEC_C,LD_C_BYTE,RRCA, DJNZ,LD_DE_WORD,LD_xDE_A,INC_DE,INC_D,DEC_D,LD_D_BYTE,RLA, JR,ADD_HL_DE,LD_A_xDE,DEC_DE,INC_E,DEC_E,LD_E_BYTE,RRA, JR_NZ,LD_HL_WORD,LD_xWORD_HL,INC_HL,INC_H,DEC_H,LD_H_BYTE,DAA, JR_Z,ADD_HL_HL,LD_HL_xWORD,DEC_HL,INC_L,DEC_L,LD_L_BYTE,CPL, JR_NC,LD_SP_WORD,LD_xWORD_A,INC_SP,INC_xHL,DEC_xHL,LD_xHL_BYTE,SCF, JR_C,ADD_HL_SP,LD_A_xWORD,DEC_SP,INC_A,DEC_A,LD_A_BYTE,CCF, LD_B_B,LD_B_C,LD_B_D,LD_B_E,LD_B_H,LD_B_L,LD_B_xHL,LD_B_A, LD_C_B,LD_C_C,LD_C_D,LD_C_E,LD_C_H,LD_C_L,LD_C_xHL,LD_C_A, LD_D_B,LD_D_C,LD_D_D,LD_D_E,LD_D_H,LD_D_L,LD_D_xHL,LD_D_A, LD_E_B,LD_E_C,LD_E_D,LD_E_E,LD_E_H,LD_E_L,LD_E_xHL,LD_E_A, LD_H_B,LD_H_C,LD_H_D,LD_H_E,LD_H_H,LD_H_L,LD_H_xHL,LD_H_A, LD_L_B,LD_L_C,LD_L_D,LD_L_E,LD_L_H,LD_L_L,LD_L_xHL,LD_L_A, LD_xHL_B,LD_xHL_C,LD_xHL_D,LD_xHL_E,LD_xHL_H,LD_xHL_L,HALT,LD_xHL_A, LD_A_B,LD_A_C,LD_A_D,LD_A_E,LD_A_H,LD_A_L,LD_A_xHL,LD_A_A, ADD_B,ADD_C,ADD_D,ADD_E,ADD_H,ADD_L,ADD_xHL,ADD_A, ADC_B,ADC_C,ADC_D,ADC_E,ADC_H,ADC_L,ADC_xHL,ADC_A, SUB_B,SUB_C,SUB_D,SUB_E,SUB_H,SUB_L,SUB_xHL,SUB_A, SBC_B,SBC_C,SBC_D,SBC_E,SBC_H,SBC_L,SBC_xHL,SBC_A, AND_B,AND_C,AND_D,AND_E,AND_H,AND_L,AND_xHL,AND_A, XOR_B,XOR_C,XOR_D,XOR_E,XOR_H,XOR_L,XOR_xHL,XOR_A, OR_B,OR_C,OR_D,OR_E,OR_H,OR_L,OR_xHL,OR_A, CP_B,CP_C,CP_D,CP_E,CP_H,CP_L,CP_xHL,CP_A, RET_NZ,POP_BC,JP_NZ,JP,CALL_NZ,PUSH_BC,ADD_BYTE,RST00, RET_Z,RET,JP_Z,PFX_CB,CALL_Z,CALL,ADC_BYTE,RST08, RET_NC,POP_DE,JP_NC,OUTA,CALL_NC,PUSH_DE,SUB_BYTE,RST10, RET_C,EXX,JP_C,INA,CALL_C,PFX_DD,SBC_BYTE,RST18, RET_PO,POP_HL,JP_PO,EX_HL_xSP,CALL_PO,PUSH_HL,AND_BYTE,RST20, RET_PE,LD_PC_HL,JP_PE,EX_DE_HL,CALL_PE,PFX_ED,XOR_BYTE,RST28, RET_P,POP_AF,JP_P,DI,CALL_P,PUSH_AF,OR_BYTE,RST30, RET_M,LD_SP_HL,JP_M,EI,CALL_M,PFX_FD,CP_BYTE,RST38 }; enum CodesCB { RLC_B,RLC_C,RLC_D,RLC_E,RLC_H,RLC_L,RLC_xHL,RLC_A, RRC_B,RRC_C,RRC_D,RRC_E,RRC_H,RRC_L,RRC_xHL,RRC_A, RL_B,RL_C,RL_D,RL_E,RL_H,RL_L,RL_xHL,RL_A, RR_B,RR_C,RR_D,RR_E,RR_H,RR_L,RR_xHL,RR_A, SLA_B,SLA_C,SLA_D,SLA_E,SLA_H,SLA_L,SLA_xHL,SLA_A, SRA_B,SRA_C,SRA_D,SRA_E,SRA_H,SRA_L,SRA_xHL,SRA_A, SLL_B,SLL_C,SLL_D,SLL_E,SLL_H,SLL_L,SLL_xHL,SLL_A, SRL_B,SRL_C,SRL_D,SRL_E,SRL_H,SRL_L,SRL_xHL,SRL_A, BIT0_B,BIT0_C,BIT0_D,BIT0_E,BIT0_H,BIT0_L,BIT0_xHL,BIT0_A, BIT1_B,BIT1_C,BIT1_D,BIT1_E,BIT1_H,BIT1_L,BIT1_xHL,BIT1_A, BIT2_B,BIT2_C,BIT2_D,BIT2_E,BIT2_H,BIT2_L,BIT2_xHL,BIT2_A, BIT3_B,BIT3_C,BIT3_D,BIT3_E,BIT3_H,BIT3_L,BIT3_xHL,BIT3_A, BIT4_B,BIT4_C,BIT4_D,BIT4_E,BIT4_H,BIT4_L,BIT4_xHL,BIT4_A, BIT5_B,BIT5_C,BIT5_D,BIT5_E,BIT5_H,BIT5_L,BIT5_xHL,BIT5_A, BIT6_B,BIT6_C,BIT6_D,BIT6_E,BIT6_H,BIT6_L,BIT6_xHL,BIT6_A, BIT7_B,BIT7_C,BIT7_D,BIT7_E,BIT7_H,BIT7_L,BIT7_xHL,BIT7_A, RES0_B,RES0_C,RES0_D,RES0_E,RES0_H,RES0_L,RES0_xHL,RES0_A, RES1_B,RES1_C,RES1_D,RES1_E,RES1_H,RES1_L,RES1_xHL,RES1_A, RES2_B,RES2_C,RES2_D,RES2_E,RES2_H,RES2_L,RES2_xHL,RES2_A, RES3_B,RES3_C,RES3_D,RES3_E,RES3_H,RES3_L,RES3_xHL,RES3_A, RES4_B,RES4_C,RES4_D,RES4_E,RES4_H,RES4_L,RES4_xHL,RES4_A, RES5_B,RES5_C,RES5_D,RES5_E,RES5_H,RES5_L,RES5_xHL,RES5_A, RES6_B,RES6_C,RES6_D,RES6_E,RES6_H,RES6_L,RES6_xHL,RES6_A, RES7_B,RES7_C,RES7_D,RES7_E,RES7_H,RES7_L,RES7_xHL,RES7_A, SET0_B,SET0_C,SET0_D,SET0_E,SET0_H,SET0_L,SET0_xHL,SET0_A, SET1_B,SET1_C,SET1_D,SET1_E,SET1_H,SET1_L,SET1_xHL,SET1_A, SET2_B,SET2_C,SET2_D,SET2_E,SET2_H,SET2_L,SET2_xHL,SET2_A, SET3_B,SET3_C,SET3_D,SET3_E,SET3_H,SET3_L,SET3_xHL,SET3_A, SET4_B,SET4_C,SET4_D,SET4_E,SET4_H,SET4_L,SET4_xHL,SET4_A, SET5_B,SET5_C,SET5_D,SET5_E,SET5_H,SET5_L,SET5_xHL,SET5_A, SET6_B,SET6_C,SET6_D,SET6_E,SET6_H,SET6_L,SET6_xHL,SET6_A, SET7_B,SET7_C,SET7_D,SET7_E,SET7_H,SET7_L,SET7_xHL,SET7_A }; enum CodesED { DB_00,DB_01,DB_02,DB_03,DB_04,DB_05,DB_06,DB_07, DB_08,DB_09,DB_0A,DB_0B,DB_0C,DB_0D,DB_0E,DB_0F, DB_10,DB_11,DB_12,DB_13,DB_14,DB_15,DB_16,DB_17, DB_18,DB_19,DB_1A,DB_1B,DB_1C,DB_1D,DB_1E,DB_1F, DB_20,DB_21,DB_22,DB_23,DB_24,DB_25,DB_26,DB_27, DB_28,DB_29,DB_2A,DB_2B,DB_2C,DB_2D,DB_2E,DB_2F, DB_30,DB_31,DB_32,DB_33,DB_34,DB_35,DB_36,DB_37, DB_38,DB_39,DB_3A,DB_3B,DB_3C,DB_3D,DB_3E,DB_3F, IN_B_xC,OUT_xC_B,SBC_HL_BC,LD_xWORDe_BC,NEG,RETN,IM_0,LD_I_A, IN_C_xC,OUT_xC_C,ADC_HL_BC,LD_BC_xWORDe,DB_4C,RETI,DB_,LD_R_A, IN_D_xC,OUT_xC_D,SBC_HL_DE,LD_xWORDe_DE,DB_54,DB_55,IM_1,LD_A_I, IN_E_xC,OUT_xC_E,ADC_HL_DE,LD_DE_xWORDe,DB_5C,DB_5D,IM_2,LD_A_R, IN_H_xC,OUT_xC_H,SBC_HL_HL,LD_xWORDe_HL,DB_64,DB_65,DB_66,RRD, IN_L_xC,OUT_xC_L,ADC_HL_HL,LD_HL_xWORDe,DB_6C,DB_6D,DB_6E,RLD, IN_F_xC,DB_71,SBC_HL_SP,LD_xWORDe_SP,DB_74,DB_75,DB_76,DB_77, IN_A_xC,OUT_xC_A,ADC_HL_SP,LD_SP_xWORDe,DB_7C,DB_7D,DB_7E,DB_7F, DB_80,DB_81,DB_82,DB_83,DB_84,DB_85,DB_86,DB_87, DB_88,DB_89,DB_8A,DB_8B,DB_8C,DB_8D,DB_8E,DB_8F, DB_90,DB_91,DB_92,DB_93,DB_94,DB_95,DB_96,DB_97, DB_98,DB_99,DB_9A,DB_9B,DB_9C,DB_9D,DB_9E,DB_9F, LDI,CPI,INI,OUTI,DB_A4,DB_A5,DB_A6,DB_A7, LDD,CPD,IND,OUTD,DB_AC,DB_AD,DB_AE,DB_AF, LDIR,CPIR,INIR,OTIR,DB_B4,DB_B5,DB_B6,DB_B7, LDDR,CPDR,INDR,OTDR,DB_BC,DB_BD,DB_BE,DB_BF, DB_C0,DB_C1,DB_C2,DB_C3,DB_C4,DB_C5,DB_C6,DB_C7, DB_C8,DB_C9,DB_CA,DB_CB,DB_CC,DB_CD,DB_CE,DB_CF, DB_D0,DB_D1,DB_D2,DB_D3,DB_D4,DB_D5,DB_D6,DB_D7, DB_D8,DB_D9,DB_DA,DB_DB,DB_DC,DB_DD,DB_DE,DB_DF, DB_E0,DB_E1,DB_E2,DB_E3,DB_E4,DB_E5,DB_E6,DB_E7, DB_E8,DB_E9,DB_EA,DB_EB,DB_EC,DB_ED,DB_EE,DB_EF, DB_F0,DB_F1,DB_F2,DB_F3,DB_F4,DB_F5,DB_F6,DB_F7, DB_F8,DB_F9,DB_FA,DB_FB,DB_FC,DB_FD,DB_FE,DB_FF }; static void CodesCB(register Z80 *R) { register byte I; I=OpZ80(R->PC.W++); R->ICount-=CyclesCB[I]; switch(I) { #include "CodesCB.h" default: if(R->TrapBadOps) printf ( "[Z80 %lX] Unrecognized instruction: CB %02X at PC=%04X\n", (long)(R->User),OpZ80(R->PC.W-1),R->PC.W-2 ); } } static void CodesDDCB(register Z80 *R) { register pair J; register byte I; #define XX IX J.W=R->XX.W+(offset)OpZ80(R->PC.W++); I=OpZ80(R->PC.W++); R->ICount-=CyclesXXCB[I]; switch(I) { #include "CodesXCB.h" default: if(R->TrapBadOps) printf ( "[Z80 %lX] Unrecognized instruction: DD CB %02X %02X at PC=%04X\n", (long)(R->User),OpZ80(R->PC.W-2),OpZ80(R->PC.W-1),R->PC.W-4 ); } #undef XX } static void CodesFDCB(register Z80 *R) { register pair J; register byte I; #define XX IY J.W=R->XX.W+(offset)OpZ80(R->PC.W++); I=OpZ80(R->PC.W++); R->ICount-=CyclesXXCB[I]; switch(I) { #include "CodesXCB.h" default: if(R->TrapBadOps) printf ( "[Z80 %lX] Unrecognized instruction: FD CB %02X %02X at PC=%04X\n", (long)R->User,OpZ80(R->PC.W-2),OpZ80(R->PC.W-1),R->PC.W-4 ); } #undef XX } static void CodesED(register Z80 *R) { register byte I; register pair J; I=OpZ80(R->PC.W++); R->ICount-=CyclesED[I]; switch(I) { #include "CodesED.h" case PFX_ED: R->PC.W--;break; default: if(R->TrapBadOps) printf ( "[Z80 %lX] Unrecognized instruction: ED %02X at PC=%04X\n", (long)R->User,OpZ80(R->PC.W-1),R->PC.W-2 ); } } static void CodesDD(register Z80 *R) { register byte I; register pair J; #define XX IX I=OpZ80(R->PC.W++); R->ICount-=CyclesXX[I]; switch(I) { #include "CodesXX.h" case PFX_FD: case PFX_DD: R->PC.W--;break; case PFX_CB: CodesDDCB(R);break; default: if(R->TrapBadOps) printf ( "[Z80 %lX] Unrecognized instruction: DD %02X at PC=%04X\n", (long)R->User,OpZ80(R->PC.W-1),R->PC.W-2 ); } #undef XX } static void CodesFD(register Z80 *R) { register byte I; register pair J; #define XX IY I=OpZ80(R->PC.W++); R->ICount-=CyclesXX[I]; switch(I) { #include "CodesXX.h" case PFX_FD: case PFX_DD: R->PC.W--;break; case PFX_CB: CodesFDCB(R);break; default: printf ( "Unrecognized instruction: FD %02X at PC=%04X\n", OpZ80(R->PC.W-1),R->PC.W-2 ); } #undef XX } /** ResetZ80() ***********************************************/ /** This function can be used to reset the register struct **/ /** before starting execution with Z80(). It sets the **/ /** registers to their supposed initial values. **/ /*************************************************************/ void ResetZ80(Z80 *R) { R->PC.W = 0x0000; R->SP.W = 0xF000; R->AF.W = 0x0000; R->BC.W = 0x0000; R->DE.W = 0x0000; R->HL.W = 0x0000; R->AF1.W = 0x0000; R->BC1.W = 0x0000; R->DE1.W = 0x0000; R->HL1.W = 0x0000; R->IX.W = 0x0000; R->IY.W = 0x0000; R->I = 0x00; R->R = 0x00; R->IFF = 0x00; R->ICount = R->IPeriod; R->IRequest = INT_NONE; R->IBackup = 0; JumpZ80(R->PC.W); } /** ExecZ80() ************************************************/ /** This function will execute given number of Z80 cycles. **/ /** It will then return the number of cycles left, possibly **/ /** negative, and current register values in R. **/ /*************************************************************/ #ifdef EXECZ80 int ExecZ80(register Z80 *R,register int RunCycles) { register byte I; register pair J; for(R->ICount=RunCycles;;) { while(R->ICount>0) { #ifdef DEBUG /* Turn tracing on when reached trap address */ if(R->PC.W==R->Trap) R->Trace=1; /* Call single-step debugger, exit if requested */ if(R->Trace) if(!DebugZ80(R)) return(R->ICount); #endif /* Read opcode and count cycles */ I=OpZ80(R->PC.W++); /* Count cycles */ R->ICount-=Cycles[I]; /* Interpret opcode */ switch(I) { #include "Codes.h" case PFX_CB: CodesCB(R);break; case PFX_ED: CodesED(R);break; case PFX_FD: CodesFD(R);break; case PFX_DD: CodesDD(R);break; } } /* Unless we have come here after EI, exit */ if(!(R->IFF&IFF_EI)) return(R->ICount); else { /* Done with AfterEI state */ R->IFF=(R->IFF&~IFF_EI)|IFF_1; /* Restore the ICount */ R->ICount+=R->IBackup-1; /* Interrupt CPU if needed */ if((R->IRequest!=INT_NONE)&&(R->IRequest!=INT_QUIT)) IntZ80(R,R->IRequest); } } } #endif /* EXECZ80 */ /** IntZ80() *************************************************/ /** This function will generate interrupt of given vector. **/ /*************************************************************/ void IntZ80(Z80 *R,word Vector) { /* If HALTed, take CPU off HALT instruction */ if(R->IFF&IFF_HALT) { R->PC.W++;R->IFF&=~IFF_HALT; } if((R->IFF&IFF_1)||(Vector==INT_NMI)) { /* Save PC on stack */ M_PUSH(PC); /* Automatically reset IRequest if needed */ if(R->IAutoReset&&(Vector==R->IRequest)) R->IRequest=INT_NONE; /* If it is NMI... */ if(Vector==INT_NMI) { /* Clear IFF1 */ R->IFF&=~(IFF_1|IFF_EI); /* Jump to hardwired NMI vector */ R->PC.W=0x0066; JumpZ80(0x0066); /* Done */ return; } /* Further interrupts off */ R->IFF&=~(IFF_1|IFF_2|IFF_EI); /* If in IM2 mode... */ if(R->IFF&IFF_IM2) { /* Make up the vector address */ Vector=(Vector&0xFF)|((word)(R->I)<<8); /* Read the vector */ R->PC.B.l=RdZ80(Vector++); R->PC.B.h=RdZ80(Vector); JumpZ80(R->PC.W); /* Done */ return; } /* If in IM1 mode, just jump to hardwired IRQ vector */ if(R->IFF&IFF_IM1) { R->PC.W=0x0038;JumpZ80(0x0038);return; } /* If in IM0 mode... */ /* Jump to a vector */ switch(Vector) { case INT_RST00: R->PC.W=0x0000;JumpZ80(0x0000);break; case INT_RST08: R->PC.W=0x0008;JumpZ80(0x0008);break; case INT_RST10: R->PC.W=0x0010;JumpZ80(0x0010);break; case INT_RST18: R->PC.W=0x0018;JumpZ80(0x0018);break; case INT_RST20: R->PC.W=0x0020;JumpZ80(0x0020);break; case INT_RST28: R->PC.W=0x0028;JumpZ80(0x0028);break; case INT_RST30: R->PC.W=0x0030;JumpZ80(0x0030);break; case INT_RST38: R->PC.W=0x0038;JumpZ80(0x0038);break; } } } /** RunZ80() *************************************************/ /** This function will run Z80 code until an LoopZ80() call **/ /** returns INT_QUIT. It will return the PC at which **/ /** emulation stopped, and current register values in R. **/ /*************************************************************/ #ifndef EXECZ80 word RunZ80(Z80 *R) { register byte I; register pair J; for(;;) { #ifdef DEBUG /* Turn tracing on when reached trap address */ if(R->PC.W==R->Trap) R->Trace=1; /* Call single-step debugger, exit if requested */ if(R->Trace) if(!DebugZ80(R)) return(R->PC.W); #endif I=OpZ80(R->PC.W++); R->ICount-=Cycles[I]; switch(I) { #include "Codes.h" case PFX_CB: CodesCB(R);break; case PFX_ED: CodesED(R);break; case PFX_FD: CodesFD(R);break; case PFX_DD: CodesDD(R);break; } /* If cycle counter expired... */ if(R->ICount<=0) { /* If we have come after EI, get address from IRequest */ /* Otherwise, get it from the loop handler */ if(R->IFF&IFF_EI) { R->IFF=(R->IFF&~IFF_EI)|IFF_1; /* Done with AfterEI state */ R->ICount+=R->IBackup-1; /* Restore the ICount */ /* Call periodic handler or set pending IRQ */ if(R->ICount>0) J.W=R->IRequest; else { J.W=LoopZ80(R); /* Call periodic handler */ R->ICount+=R->IPeriod; /* Reset the cycle counter */ if(J.W==INT_NONE) J.W=R->IRequest; /* Pending IRQ */ } } else { J.W=LoopZ80(R); /* Call periodic handler */ R->ICount+=R->IPeriod; /* Reset the cycle counter */ if(J.W==INT_NONE) J.W=R->IRequest; /* Pending IRQ */ } if(J.W==INT_QUIT) return(R->PC.W); /* Exit if INT_QUIT */ if(J.W!=INT_NONE) IntZ80(R,J.W); /* Int-pt if needed */ } } /* Execution stopped */ return(R->PC.W); } #endif /* !EXECZ80 */ z88dk-1.8.ds1/test/machine/Z80/Z80.h0000644000175000017500000002042710702217026016204 0ustar tygrystygrys/** Z80: portable Z80 emulator *******************************/ /** **/ /** Z80.h **/ /** **/ /** This file contains declarations relevant to emulation **/ /** of Z80 CPU. **/ /** **/ /** Copyright (C) Marat Fayzullin 1994-2007 **/ /** You are not allowed to distribute this software **/ /** commercially. Please, notify me, if you make any **/ /** changes to this file. **/ /*************************************************************/ #ifndef Z80_H #define Z80_H #ifdef __cplusplus extern "C" { #endif /* Compilation options: */ /* #define DEBUG */ /* Compile debugging version */ /* #define LSB_FIRST */ /* Compile for low-endian CPU */ /* #define MSB_FIRST */ /* Compile for hi-endian CPU */ /* LoopZ80() may return: */ #define INT_RST00 0x00C7 /* RST 00h */ #define INT_RST08 0x00CF /* RST 08h */ #define INT_RST10 0x00D7 /* RST 10h */ #define INT_RST18 0x00DF /* RST 18h */ #define INT_RST20 0x00E7 /* RST 20h */ #define INT_RST28 0x00EF /* RST 28h */ #define INT_RST30 0x00F7 /* RST 30h */ #define INT_RST38 0x00FF /* RST 38h */ #define INT_IRQ INT_RST38 /* Default IRQ opcode is FFh */ #define INT_NMI 0xFFFD /* Non-maskable interrupt */ #define INT_NONE 0xFFFF /* No interrupt required */ #define INT_QUIT 0xFFFE /* Exit the emulation */ /* Bits in Z80 F register: */ #define S_FLAG 0x80 /* 1: Result negative */ #define Z_FLAG 0x40 /* 1: Result is zero */ #define H_FLAG 0x10 /* 1: Halfcarry/Halfborrow */ #define P_FLAG 0x04 /* 1: Result is even */ #define V_FLAG 0x04 /* 1: Overflow occured */ #define N_FLAG 0x02 /* 1: Subtraction occured */ #define C_FLAG 0x01 /* 1: Carry/Borrow occured */ /* Bits in IFF flip-flops: */ #define IFF_1 0x01 /* IFF1 flip-flop */ #define IFF_IM1 0x02 /* 1: IM1 mode */ #define IFF_IM2 0x04 /* 1: IM2 mode */ #define IFF_2 0x08 /* IFF2 flip-flop */ #define IFF_EI 0x20 /* 1: EI pending */ #define IFF_HALT 0x80 /* 1: CPU HALTed */ /** Simple Datatypes *****************************************/ /** NOTICE: sizeof(byte)=1 and sizeof(word)=2 **/ /*************************************************************/ #ifndef BYTE_TYPE_DEFINED #define BYTE_TYPE_DEFINED typedef unsigned char byte; #endif #ifndef WORD_TYPE_DEFINED #define WORD_TYPE_DEFINED typedef unsigned short word; #endif typedef signed char offset; /** Structured Datatypes *************************************/ /** NOTICE: #define LSB_FIRST for machines where least **/ /** signifcant byte goes first. **/ /*************************************************************/ typedef union { #ifdef LSB_FIRST struct { byte l,h; } B; #else struct { byte h,l; } B; #endif word W; } pair; typedef struct { pair AF,BC,DE,HL,IX,IY,PC,SP; /* Main registers */ pair AF1,BC1,DE1,HL1; /* Shadow registers */ byte IFF,I; /* Interrupt registers */ byte R; /* Refresh register */ int IPeriod,ICount; /* Set IPeriod to number of CPU cycles */ /* between calls to LoopZ80() */ int IBackup; /* Private, don't touch */ word IRequest; /* Set to address of pending IRQ */ byte IAutoReset; /* Set to 1 to autom. reset IRequest */ byte TrapBadOps; /* Set to 1 to warn of illegal opcodes */ word Trap; /* Set Trap to address to trace from */ byte Trace; /* Set Trace=1 to start tracing */ void *User; /* Arbitrary user data (ID,RAM*,etc.) */ } Z80; /** ResetZ80() ***********************************************/ /** This function can be used to reset the registers before **/ /** starting execution with RunZ80(). It sets registers to **/ /** their initial values. **/ /*************************************************************/ void ResetZ80(register Z80 *R); /** ExecZ80() ************************************************/ /** This function will execute given number of Z80 cycles. **/ /** It will then return the number of cycles left, possibly **/ /** negative, and current register values in R. **/ /*************************************************************/ #ifdef EXECZ80 int ExecZ80(register Z80 *R,register int RunCycles); #endif /** IntZ80() *************************************************/ /** This function will generate interrupt of given vector. **/ /*************************************************************/ void IntZ80(register Z80 *R,register word Vector); /** RunZ80() *************************************************/ /** This function will run Z80 code until an LoopZ80() call **/ /** returns INT_QUIT. It will return the PC at which **/ /** emulation stopped, and current register values in R. **/ /*************************************************************/ #ifndef EXECZ80 word RunZ80(register Z80 *R); #endif /** RdZ80()/WrZ80() ******************************************/ /** These functions are called when access to RAM occurs. **/ /** They allow to control memory access. **/ /************************************ TO BE WRITTEN BY USER **/ void WrZ80(register word Addr,register byte Value); byte RdZ80(register word Addr); /** InZ80()/OutZ80() *****************************************/ /** Z80 emulation calls these functions to read/write from **/ /** I/O ports. There can be 65536 I/O ports, but only first **/ /** 256 are usually used. **/ /************************************ TO BE WRITTEN BY USER **/ void OutZ80(register word Port,register byte Value); byte InZ80(register word Port); /** PatchZ80() ***********************************************/ /** Z80 emulation calls this function when it encounters a **/ /** special patch command (ED FE) provided for user needs. **/ /** For example, it can be called to emulate BIOS calls, **/ /** such as disk and tape access. Replace it with an empty **/ /** macro for no patching. **/ /************************************ TO BE WRITTEN BY USER **/ void PatchZ80(register Z80 *R); /** DebugZ80() ***********************************************/ /** This function should exist if DEBUG is #defined. When **/ /** Trace!=0, it is called after each command executed by **/ /** the CPU, and given the Z80 registers. Emulation exits **/ /** if DebugZ80() returns 0. **/ /*************************************************************/ #ifdef DEBUG byte DebugZ80(register Z80 *R); #endif /** LoopZ80() ************************************************/ /** Z80 emulation calls this function periodically to check **/ /** if the system hardware requires any interrupts. This **/ /** function must return an address of the interrupt vector **/ /** (0x0038, 0x0066, etc.) or INT_NONE for no interrupt. **/ /** Return INT_QUIT to exit the emulation loop. **/ /************************************ TO BE WRITTEN BY USER **/ word LoopZ80(register Z80 *R); /** JumpZ80() ************************************************/ /** Z80 emulation calls this function when it executes a **/ /** JP, JR, CALL, RST, or RET. You can use JumpZ80() to **/ /** trap these opcodes and switch memory layout. **/ /************************************ TO BE WRITTEN BY USER **/ #ifndef JUMPZ80 #define JumpZ80(PC) #else void JumpZ80(word PC); #endif #ifdef __cplusplus } #endif #endif /* Z80_H */ z88dk-1.8.ds1/test/Makefile0000644000175000017500000000036010702225414015117 0ustar tygrystygrys SUBDIRS = machine suites all: subdirs-all subdirs-all: $(SUBDIRS) clean: subdirs-clean subdirs-clean: @for s in $(SUBDIRS); \ do \ $(MAKE) -C $$s clean ; \ done .PHONY: subdirs-all $(SUBDIRS) $(SUBDIRS): $(MAKE) -C $@ all z88dk-1.8.ds1/test/suites/0000755000175000017500000000000010765202715015004 5ustar tygrystygrysz88dk-1.8.ds1/test/suites/Makefile0000644000175000017500000000035610702237160016441 0ustar tygrystygrys SUBDIRS = string stdio all: subdirs-all subdirs-all: $(SUBDIRS) clean: subdirs-clean subdirs-clean: @for s in $(SUBDIRS); \ do \ $(MAKE) -C $$s clean ; \ done .PHONY: subdirs-all $(SUBDIRS) $(SUBDIRS): $(MAKE) -C $@ all z88dk-1.8.ds1/test/suites/stdio/0000755000175000017500000000000010765202715016126 5ustar tygrystygrysz88dk-1.8.ds1/test/suites/stdio/main.c0000644000175000017500000000015710702237160017212 0ustar tygrystygrys #include "stdio_tests.h" int main(int argc, char *argv[]) { int res = 0; res += test_scanf_d(); } z88dk-1.8.ds1/test/suites/stdio/Makefile0000644000175000017500000000027410702237160017562 0ustar tygrystygrys SOURCES := $(wildcard *.c) all: test.bin test.bin: $(SOURCES) zcc +test -vn $(SOURCES) -o $@ -lndos ../../machine/machine -w 60 test.bin clean: rm -f test.bin zcc_opt.def *~ z88dk-1.8.ds1/test/suites/stdio/scanf.c0000644000175000017500000000132610702237160017357 0ustar tygrystygrys #include /** \test Test %d handling of scanf() Test takes about 40 seconds to run */ int test_scanf_d() { char buf[20]; int i,j; unsigned int failures = 0; unsigned int success = 0; printf("Starting scanf %%d test\n"); for ( i = -32767; i < 32767; i++ ) { if ( i % 1000 == 0 ) { printf("%d ",i); } sprintf(buf,"%d",i); sscanf(buf,"%d",&j); if ( i != j ) { printf("Failed conversion for %d != %d\n",i,j); failures++; } else { success++; } } printf("%u cases, %u success, %u failures\n",success + failures, success, failures); return failures; } z88dk-1.8.ds1/test/suites/stdio/stdio_tests.h0000644000175000017500000000012610702237160020633 0ustar tygrystygrys #ifndef STRING_TESTS_H #define STRING_TESTS_H extern int test_scanf_d(); #endif z88dk-1.8.ds1/test/suites/string/0000755000175000017500000000000010765202715016312 5ustar tygrystygrysz88dk-1.8.ds1/test/suites/string/main.c0000644000175000017500000000015710702225415017376 0ustar tygrystygrys #include "string_tests.h" int main(int argc, char *argv[]) { int res = 0; res += test_strcmp(); } z88dk-1.8.ds1/test/suites/string/Makefile0000644000175000017500000000026610702225415017747 0ustar tygrystygrys SOURCES := $(wildcard *.c) all: test.bin test.bin: $(SOURCES) zcc +test -vn $(SOURCES) -o $@ -lndos ../../machine/machine test.bin clean: rm -f test.bin zcc_opt.def *~ z88dk-1.8.ds1/test/suites/string/strcmp.c0000644000175000017500000000275310702225415017766 0ustar tygrystygrys #include #include #include "string_tests.h" struct tcase { char *first; char *second; int result; }; struct tcase tests[] = { { "equal", "equal", 0 }, { "equal", "notequal", -1 }, { "equal", "EQUAL", 1 }, { NULL } }; int test_strcmp() { struct tcase *test = &tests[0]; int res; int failure = 0; int success = 0; int cases = 0; printf("Running strcmp tests...\n"); while ( test->first != NULL ) { cases++; res = strcmp(test->first, test->second); switch ( test->result ) { case 0: /* Equal */ if ( res != 0 ) { printf("<%s> <%s> gave us %d expected %d\n",test->first,test->second,res,test->result); failure++; } else { success++; } break; case -1: if ( res >= 0 ) { printf("<%s> <%s> gave us %d expected %d\n",test->first,test->second,res,test->result); failure++; } else { success++; } break; case 1: if ( res <= 0 ) { printf("<%s> <%s> gave us %d expected %d\n",test->first,test->second,res,test->result); failure++; } else { success++; } break; } test++; } printf("%d cases, %d success, %d failures\n",cases, success, failure); return failure; } z88dk-1.8.ds1/test/suites/string/string_tests.h0000644000175000017500000000012510702225415021202 0ustar tygrystygrys #ifndef STRING_TESTS_H #define STRING_TESTS_H extern int test_strcmp(); #endif z88dk-1.8.ds1/win32/0000755000175000017500000000000010765202715013453 5ustar tygrystygrysz88dk-1.8.ds1/win32/z88dk.sln0000755000175000017500000000710410637512030015136 0ustar tygrystygrys Microsoft Visual Studio Solution File, Format Version 9.00 # Visual C++ Express 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "z80asm", "..\src\z80asm\z80asm.vcproj", "{53E270D6-344C-49AB-94F2-7871479963C1}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "appmake", "..\src\appmake\appmake.vcproj", "{36242CB0-B746-49EF-AC14-66E2F8085784}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "copt", "..\src\copt\copt.vcproj", "{96114913-11E4-4A62-A268-46F702C0B025}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zcpp", "..\src\cpp\zcpp.vcproj", "{7F2BBA5D-C456-4B8E-BD59-C14CDA400E0B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sccz80", "..\src\sccz80\sccz80.vcproj", "{F132AE45-BCBF-4B5A-A61A-8816E4A88941}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zcc", "..\src\zcc\zcc.vcproj", "{DDF3E1DD-FF5A-4292-BD8E-BF3D0D1EE3B7}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "z80nm", "..\support\ar\z80nm.vcproj", "{5AF7641B-C432-4E2C-A659-8B71D4B87B86}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {53E270D6-344C-49AB-94F2-7871479963C1}.Debug|Win32.ActiveCfg = Debug|Win32 {53E270D6-344C-49AB-94F2-7871479963C1}.Debug|Win32.Build.0 = Debug|Win32 {53E270D6-344C-49AB-94F2-7871479963C1}.Release|Win32.ActiveCfg = Release|Win32 {53E270D6-344C-49AB-94F2-7871479963C1}.Release|Win32.Build.0 = Release|Win32 {36242CB0-B746-49EF-AC14-66E2F8085784}.Debug|Win32.ActiveCfg = Debug|Win32 {36242CB0-B746-49EF-AC14-66E2F8085784}.Debug|Win32.Build.0 = Debug|Win32 {36242CB0-B746-49EF-AC14-66E2F8085784}.Release|Win32.ActiveCfg = Release|Win32 {36242CB0-B746-49EF-AC14-66E2F8085784}.Release|Win32.Build.0 = Release|Win32 {96114913-11E4-4A62-A268-46F702C0B025}.Debug|Win32.ActiveCfg = Debug|Win32 {96114913-11E4-4A62-A268-46F702C0B025}.Debug|Win32.Build.0 = Debug|Win32 {96114913-11E4-4A62-A268-46F702C0B025}.Release|Win32.ActiveCfg = Release|Win32 {96114913-11E4-4A62-A268-46F702C0B025}.Release|Win32.Build.0 = Release|Win32 {7F2BBA5D-C456-4B8E-BD59-C14CDA400E0B}.Debug|Win32.ActiveCfg = Debug|Win32 {7F2BBA5D-C456-4B8E-BD59-C14CDA400E0B}.Debug|Win32.Build.0 = Debug|Win32 {7F2BBA5D-C456-4B8E-BD59-C14CDA400E0B}.Release|Win32.ActiveCfg = Release|Win32 {7F2BBA5D-C456-4B8E-BD59-C14CDA400E0B}.Release|Win32.Build.0 = Release|Win32 {F132AE45-BCBF-4B5A-A61A-8816E4A88941}.Debug|Win32.ActiveCfg = Debug|Win32 {F132AE45-BCBF-4B5A-A61A-8816E4A88941}.Debug|Win32.Build.0 = Debug|Win32 {F132AE45-BCBF-4B5A-A61A-8816E4A88941}.Release|Win32.ActiveCfg = Release|Win32 {F132AE45-BCBF-4B5A-A61A-8816E4A88941}.Release|Win32.Build.0 = Release|Win32 {DDF3E1DD-FF5A-4292-BD8E-BF3D0D1EE3B7}.Debug|Win32.ActiveCfg = Debug|Win32 {DDF3E1DD-FF5A-4292-BD8E-BF3D0D1EE3B7}.Debug|Win32.Build.0 = Debug|Win32 {DDF3E1DD-FF5A-4292-BD8E-BF3D0D1EE3B7}.Release|Win32.ActiveCfg = Release|Win32 {DDF3E1DD-FF5A-4292-BD8E-BF3D0D1EE3B7}.Release|Win32.Build.0 = Release|Win32 {5AF7641B-C432-4E2C-A659-8B71D4B87B86}.Debug|Win32.ActiveCfg = Debug|Win32 {5AF7641B-C432-4E2C-A659-8B71D4B87B86}.Debug|Win32.Build.0 = Debug|Win32 {5AF7641B-C432-4E2C-A659-8B71D4B87B86}.Release|Win32.ActiveCfg = Release|Win32 {5AF7641B-C432-4E2C-A659-8B71D4B87B86}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal z88dk-1.8.ds1/www/0000755000175000017500000000000010765202715013335 5ustar tygrystygrysz88dk-1.8.ds1/www/old/0000755000175000017500000000000010765202715014113 5ustar tygrystygrysz88dk-1.8.ds1/www/pics/0000755000175000017500000000000010765202715014273 5ustar tygrystygrys