A comparison between Z80 and Intel-8080 assembly instructions.

Source: https://es.wikipedia.org/wiki/Intel_8080

DISCLAIMER: This page is a mirror of no longer existing lonestar's site, which is now archived here. This page will be deleted in case of original author's claim. Original work belongs to Frank Durda IV. 8080 Mnemonic Z80 Mnemonic Machine Code Operation MOV A,A LD A,A 7F A <- A MOV A,B LD A,B 78 A <- B MOV A,C LD A,C 79 A <- C MOV A,D LD A,D 7A A <- D MOV A,E LD A,E 7B A <- E MOV A,H LD A,H 7C A <- H MOV A,L LD A,L 7D A <- L MOV A,M LD A,(HL) 7E A <- (HL) LDAX B LD A,(BC) 0A A <- (BC) LDAX D LD A,(DE) 1A A <- (DE) LDA word LD A,(word) 3Aword A <- (word) --- LD A,(IX+index) DD7Eindex A <- (IX+index) --- LD A,(IY+index) FD7Eindex A <- (IY+index) MOV B,A LD B,A 47 B <- A MOV B,B LD B,B 40 B <- B

MOV B,C LD B,C 41 B <- C MOV B,D LD B,D 42 B <- D MOV B,E LD B,E 43 B <- E MOV B,H LD B,H 44 B <- H MOV B,L LD B,L 45 B <- L MOV B,M LD B,(HL) 46 B <- (HL) --- LD B,(IX+index) DD46index B <- (IX+index) --- LD B,(IY+index) FD46index B <- (IY+index) MOV C,A LD C,A 4F C <- A MOV C,B LD C,B 48 C <- B MOV C,C LD C,C 49 C <- C MOV C,D LD C,D 4A C <- D MOV C,E LD C,E 4B C <- E MOV C,H LD C,H 4C C <- H MOV C,L LD C,L 4D C <- L MOV C,M LD C,(HL) 4E C <- (HL) --- LD C,(IX+index) DD4Eindex C <- (IX+index) --- LD C,(IY+index) FD4Eindex C <- (IY+index) MOV D,A LD D,A 57 D <- A MOV D,B LD D,B 50 D <- B MOV D,C LD D,C…

Siamo nel 2020 e sembra esserci un rinnovato interesse nei confronti delle BBS. Per chi sapesse cosa siano, in breve e in modo molto approssimativo BBS (Bulletin Board System) erano dei servizi telematici (in voga negli anni 80 - primi 90) di messaggistica e scambio file, che "viaggiavano" sulla comune linea telefonica, e i cui nodi erano gestiti in gran parte dalla comunità di hobbisti e amatori. Ci si collegava tramite modem spesso alla velocità di 1200bps (150 byte al secondo) e l'interfaccia utente era esclusivamente testuale, con caratteri ASCII che simulavano "grafica". Oggi le linee telefoniche analogiche non esistono praticamente più e le BBS sopravvissute si sono spostate su Internet, dove ne nascono anche di nuove. Per potersi collegare tramite un vecchio computer serve ovviamente un collegamento seriale, ed è semplice trovare online progetti e realizzazioni di modem Wi-Fi, cioè dispositivi che connettendosi alla porta seriale RS-232 emulano il funzionamento di un modem analogico, collegandosi però in TELNET a

un host remoto (specificando la porta). Avendo però a disposizione un Raspberry PiZeroW e un adattatore USB -> RS232 è possibile realizzarsi in casa un modem Wi-Fi a "costo zero" (oltre quello del Pi e dell'adattatore!) senza bisogno di saldature e modifiche. Ecco quindi un breve tutorial su come realizzarlo. Innanzitutto occorre un adattatore USB -> Seriale RS232. Ho utilizzato nel caso specifico un modello Digitus, disponibile anche su Amazon (qui il link al prodotto), che ha funzionato al primo colpo sul PiZeroW senza bisogno di ulteriori "smanettamenti". Installazione del sistema operativo Il PiZeroW è fornito di solito con una microSD con già installato Raspberry Pi OS. Supponiamo però di partire da zero, avendo a disposizione una microSD vuota. Il modo più semplice e immediato per installare un sistema operativo sulla microSD è utilizzare il tool RPI Imager, distribuito gratuitamente a questo link. Al primo passaggio, CHOOSE OS, scegliete "Raspberry Pi OS (Other)", e di seguito la versione leggera "Raspberry Pi OS…

Source: https://archive.org/serve/ZorkI_r75_earlier_4amCrack/

Zork è il nome di una delle text adventure più famose della storia, rilasciata da Infocom per la prima volta nel 1977. Non la prima, che fu Colossal Cave Adventure (sempre nel 1977), ma di sicuro un nome che evoca in modo iconico questa categoria di giochi. In comune col capostipite prima citato ha l'essere stata sviluppata in prima battuta per il mainframe PDP-10. Infocom ha distribuito successivamente decine di altre text adventure (ricordiamo Hitchhiker's guide to the galaxy) basate sullo stesso modello. A differenza però del capostipite Colossal Cave Adventure che fu scritto in FORTRAN, tutte le text adventure di Infocom sono state in un linguaggio specifico per descrivere il mondo all'interno del quale si muove il giocatore di una adventure: oggi si direbbe un DSL (Domain Specific Language). Linguaggio ZIL e Z-Machine multipiattaforma Questo linguaggio fu denominato ZIL (Zork Implementation Language), è un linguaggio dichiarativo e ha una struttura simile a quella del LISP, e a partire dal

sorgente viene compilato (tramite compilatori appositi, per esempio ZILF) in una sorta di bytecode, pronto a sua volta a essere eseguito da una virtual machine, che viene detta in questo caso Z-Machine, una sorta di ScummVM ante-litteram. Ciò significa che il file eseguibile che viene lanciato per far partire il gioco non contiene il gioco in sé, bensì è un'implementazione della Z-Machine, che legge e interpreta il file compilato a partire dal sorgente ZIL. Tale scelta lungimirante ha permesso a Infocom di rilasciare i suoi titoli su praticamente qualunque piattaforma esistente (negli anni, dalla versione PDP-11, a quella per CP/M, fino ad Amiga), in quanto bastava fare il porting della sola implementazione di Z-Machine per la specifica piattaforma, mentre i file compilati dai sorgenti ZIL dei giochi erano gli stessi ovunque. In questo video del 1986 della BBC vediamo i dipendenti Infocom all'opera, nella produzione delle decine di titoli di text-adventure, che parlano del loro lavoro: https://www.facebook.com/watch/?v=370943990432516   La versione…

The purpose of this document is to clarify how variables are stored in RAM and how this information can be used. This information applies to Apple-1 (both Originals and Replicas) and to most of the emulators. A brief recap, taken from the Apple-1 PRELIMINARY BASIC USERS MANUAL: Let us suppose, from now on, that the memory configuration is "standard" according to the indications in the manual: PRIMARY RAM BANK from address \$0000 to \$0FFF (4096 bytes) OPTIONAL RAM BANK from address \$E000 to \$EFFF (4096 bytes) BASIC will be loaded in the optional RAM BANK. We will not consider memory manipulation made by LOMEM or HIMEM commands. When BASIC is running the user’s RAM, by default, is from \$0800 to \$0FFF (2047 bytes). 1. Program not using variables A BASIC program is stored so that its end coincides with the last byte of memory available. In the two examples above, the one-liner 10 PRINT “HELLO” is stored from \$0FF4 to

\$0FFF. If a second line is added (20 PRINT “WORLD”) the entire program is “shifted”. The two-line program now starts at \$0FE8 and ends at \$0FFF. Is it reasonable to assume that variables will be stored at the opposite end of the available memory, in order to avoid any conflict with the program code. A quick inspection of the first locations shows nothing, which is also reasonable because our program uses no variables at all: 2. Program using numeric variables Let us restart everything and declare a variable, and see what happens: As expected, nothing is stored in the “program area” of the memory, since we did not write any program. I choose 32767 as value for the variable because it is hexadecimal \$7FFF and its HI and LO bytes are quite recognisable among all the others. They look to be stored in little-endian notation, two bytes as expected in locations \$0804 and \$0805. Are we able to spot out…

Can an Apple-1 computer decipher a message encrypted with an Enigma cyphering machine in a reasonable time?

Recently I (re)watched the movie “The imitation game”: the English mathematical genius Alan Turing cracks the German Enigma code with help from fellow mathematicians, using an electro-mechanical device called Bombe. At the end of the movie, I found myself wondering: "Would an Apple-1 be able to decrypt a text ciphered by an Enigma machine? If so, how fast would it be?” The Enigma Machine is well documented in all its versions and variants, and the Internet is full of code and emulators. I am not going to explain the operation principles of the Enigma Machine, on the Internet there is a plenty of valuable sources of knowledge. In the Bibliography section, you will find some link. SEARCHING FOR… THE RIGHT CODE What I was looking for was a short source code that could run in a few kiB of memory. In this article, I will not go deep into the mathematical theories behind the "Enigma", and I will not dwell

on the different decryption techniques that could be used. I found many programs, but unfortunately, many of them needed RAM that the Apple-1 simply does not have. Finally, I found the source code candidate to be adapted for the CC65 cross compiler: http://www.cs.miami.edu/home/harald/enigma/ The small program can encrypt/decrypt messages with an user-defined machine setting or brute-force an encrypted message. How does it work? In the movie they use a word, called crib, they believe was encrypted in the message (i.e. “weather”) to program Turing’s Machine. The machine “simply” tries all the permutations of settings in order to obtain the original crib. Due to the huge number of different initial settings of the Enigma machine, this method was very time consuming: many expedients were put into practice to reduce the number of permutations (i.e. the Diagonal Board method discovered by Turing’s colleague Gordon Welchman). The program, written in C language, needed some adjustment to be compiled by CC65. In this, I…

PURPOSE Allow the Apple-1 computer (and Replicas) to handle connections with telnet protocol (either outgoing or incoming) in order to connect to existing BBSes or chat sessions (keyboard-to-keyboard) IMPLEMENTATION An Asynchronous Communications Interface Adapter (ACIA) 6551 has been used. It was commonly used as an UART (Universal Asynchronous Receiver-Transmitter) for the 6502 microprocessor; it is addressed through a 74154 (4 to 16 lines decoder/demultiplexer). UART is then connected to an ESP8266 that acts as an Hayes-compatible Wi-Fi Modem. The ESP8266 must be programmed following the instructions: https://1200baud.wordpress.com/2017/03/04/build-your-own-9600-baud-c64-wifi-modem-for-20/ A small Terminal program written in Assembly is used to interact with it. CIRCUIT & ADDRESSING Power is derived from the 5V main bus. 74154 acts as Address Decoder as described below. Apple-1’s Address lines from A12 to A15 (A15 is MSB) are connected to 74154’s A...D input lines (D is MSB) in order to split the addressable 64 kiB into 4 kiB chunks. This operation is very common in this architecture. Although it would have been possible to use the signals R, S and

T (coming from the mainboard’s 74154, which perform the same operation) they were not used. R line is commonly used with Cassette Interface; S and T are usually not used (not connected) on to original boards. To guarantee the functionality of the interface with unmodified original boards the 74154 perform its own “four most significant bit” Address decoding. It has been decided that 75154’s output named “7” (corresponding to Addresses from $7000 to 7FFF) is assigned to the 6551. To perform this selection, output “7” has been connected to 6551’s /CS1 pin. Other outputs might be used in the future in order to add functionality to the board, i.e. EPROM etc. The other 6551’s Chip Select pin, CS0, is not used and it has been tied to +5V. Data Bus signals (D0 to D7, D7 is MSB) are connected to 6551, as well as /IRQ, ɸ2, R/W and /RES. 6551’s RS0 and RS1 inputs are respectively connected to Apple-1’s A0 and A1 Address lines: they will be used to read and write the four registers of the 6551. 6551’s…

by Claudio Parmigiani PURPOSE Allow the Apple-1 computer to generate sounds and simple melodies via BASIC or Assembler. IMPLEMENTATION A SID (Sound Interface Device, MOS 6581) has been used. It is addressed through a TTL logic, which will be explained later. Some circuitry has been added to ensure compatibility with the MOS 8580. An amplifier has also been added in order to provide an adequate output level. CIRCUIT POWER 5V is taken directly from the Expansion Bus 12V (for 6581) or 9V (for 8580) is derived from the “12V Unregulated” on the Expansion Bus. Raw voltage is about ~20V (not stabilized). A jumper is used to select the right voltage. FILTERS Typical 6581’s CAP1/CAP2 filter capacitors value is 470pF. These capacitors are present on the board. It is possible to select other capacitors by switching another couple of jumpers. Alternative capacitors must be connected to the appropriate sockets. AUDIO AMPLIFIER A simple 1-transistor (2N2222) audio amplifier is used. Output is

connected to a stereo 3.5mm jack female connector. MISCELLANEOUS POTX/POTY SID’s pin are connected to auxiliary connector, for future use. ADDRESSING Connections to /RES, R/W and ɸ2 signals are by the book, just like Data Bus (D0 to D7) and Address Bus (A0 to A4) signals. Chip Select (/CS) signal is derived from a TTL 74LS10 logic port, which provide a logic LOW signal when: Address bus is $C8xx ɸ2 is at logic HIGH level. $C8xx address is resolved as follows: HEX: C 8 0 0 ADDR LINE: A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 BIN: 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 ↓ ↓ ↓ ↓ ACTION: pick "R" LOW signal pick A11 HIGH signal does not care does not care “R” signal is usually hard-wired on the CHIP SELECT section of the Mainboard of the Apple-1. It is usually connected…

Sommario Si propone una breve bibliografia ragionata per un primo percorso orientativo destinato a chi intenda (ricominciare a) programmare su C64 in linguaggio Assembly eventualmente affiancato dal BASIC V2, con nozioni architetturali e uso avanzato delle caratteristiche di grafica e suono. Questo medesimo articolo è disponibile anche in PDF. «Mathematics is the art of giving the same name to different things.» (Henri Poincare, 1854-1912) 1 Introduzione. Con oltre 17 milioni di unità prodotte, il Commodore 64 è indiscutibilmente il PET più venduto della storia e il relativo mercato bibliografico è conseguentemente uno dei più sviluppati in assoluto, con centinaia di titoli stampati da decine di editori di ogni dimensione, firmati da autori spesso di fama internazionale nel campo dei microcomputer e relativi processori 8 bit. Qui si vuole proporre un percorso di studio che comprende i testi più essenziali, rivelatisi alla prova del tempo e nella didattica superiori agli altri per qualità dei contenuti, impostazione, accuratezza, autorevolezza. Per la massima

efficacia e qualità dei risultati, il percorso di studio individuale deve necessariamente seguire la consueta progressione: prima l'architettura, poi il linguaggio macchina in sè, poi i vari Assembler con le loro idiosincrasie sintattiche e sistemi di macro profondamente incompatibili gli uni con gli altri (inclusi i moderni ambienti di cross-development, ormai sempre più necessari), poi la programmazione dei singoli chip periferici specializzati e infine le applicazioni, studiando e ristudiando il codice applicativo che ormai si trova in giro, tra disassemblati e rilasci al pubblico dominio, in quantità esorbitanti. L'assioma fondamentale per la programmazione low level su C64 (ma vale anche per qualsiasi altra piattaforma) è che si impara leggendo molto codice Assembly avanzato scritto da programmatori professionisti e ben preparati: lo studio della mediocrità, dice il grandissimo Harold Bloom, non può che generare altra mediocrità. A sua volta, comprendere nei dettagli tale codice richiede lo studio di svariate tipologie di testi, senza limitarsi al solo Assembly che è il punto…

Introduzione In questo articolo vedremo come poter configurare un web server su un C64 non espanso, con il solo ausilio di una unità disco (reale o emulata con SD2IEC/Pi1541), di una cartuccia/interfaccia ethernet, e di un BASIC extender molto interessante. L’interfaccia ethernet viene fornita dalla cartuccia 64NIC+, che mette a disposizione del C64 una connettività a 10Mbit/s emulando diversi standard: RR-NET, TFE, NET64. Ha anche altre caratteristiche interessanti, come ad esempio quella di poter ospitare una ROM/EPROM da caricare al boot ma di queste, per il momento, non ci occuperemo Lo stack TCP/IP viene gestito e programmato appunto da un BASIC extender chiamato BASIC ON BAILS. Scritto da Jonno Downes nel 2010-11 e basato su netboot65, insieme a KIPPER BASIC forma una suite con la quale è possibile scrivere programmi per il networking, in semplice BASIC. A tale scopo vedremo che sono stati aggiunti diversi comandi. BASIC ON BAILS è dedicato allo sviluppo di applicazioni lato server, KIPPER BASIC è

più dedicato allo sviluppo di applicazioni lato client. Dato che il nostro intento è sviluppare un piccolo web server, utilizzeremo BASIC ON BAILS. BASIC ON BAILS (BoB, da qui in avanti) viene distribuito liberamente e va caricato sul nostro C64 come un semplice programma PRG. È lungo 39 blocchi, che equivalgono all’incirca a 10kByte, e lascia dunque memoria sufficiente per realizzare qualcosa di carino, unico e… vostro. Test di connettività e comandi Appena caricato, BoB… dà errore! Ma non c’è da preoccuparsi. Alla prima esecuzione esso è predisposto per cercare sull’unità disco corrente il programma chiamato INDEX.BAS. Non trovandolo darà errore, ma BoB sarà ancora in memoria e pronto per essere utilizzato. Potremo usare questa feature quando saremo soddisfatti del sito web che avremo creato: potremo salvarlo con il nome INDEX.BAS in modo che venga caricato automaticamente all’avvio di BoB. Una bella comodità. Focalizziamoci ora sui comandi aggiunti da BoB al classico BASIC V2 e vediamo dapprima quelli dedicati alla…