Carte IO pour Zx81. (Circuit simple face+straps)


Fichier Kicad:
http://zx81.ordi5.free.fr/brico/Elettro ... rte_IO.zip
Modérateur : XavierSnp
Code : Tout sélectionner
.ORG 16514
START:
LD HL,($407B) ; Get Bloc from the temp address 1,2,3 or 4.
LD H,0
CALL $9D8 ; Get line address in HL : L=Line Number.
LD BC,$0005
ADD HL,BC ; Skip line header. (x REM)
LD ($407B),HL
LD HL,$407B
JP (HL)
Code : Tout sélectionner
;------- TASM ASM mnemonics. -------
; Compile this file using:
; Set TASMOPTS = -b
; tasm -80 ThisCode.tas MyBinary.BIN
;-----------------------------------
; Zx81 Program name: VB81 XuR
#define ORG .org ; TASM cross-assembler definitions
#define equ .equ
;-----------------------------------
.ORG 16514
START:
LD HL,($407B) ; Get Bloc from the temp address 1,2,3 or 4.
LD H,0
CALL $9D8 ; Get line address in HL : L=Line Number.
LD BC,$0005
ADD HL,BC ; Skip line header.
LD DE,($4010); Get Vars offset, reserved by the A$ array.
LD BC,127 ; Data lenght.
LDIR ; Copy data values.
LD A,($407B); Get Bloc again.
LD HL,$2000 ; From 2000
LD BC,$800 ; ROM length.
NxtBloc:
DEC A ; = #Bloc -1
JR Z,NxtScan ; If the bloc is reach...
ADD HL,BC ; Jump to the next ROM offset: 2800,3000 or 3800
JR NxtBloc
NxtScan:
LD A,(HL)
CP $38 ; TEST ROM "S" from "SAUVEGARDE" (first byte)
JR Z,Error1 ; Equal... Don't copy the ROM.EXIT return : inverted 0/0
; Error, Basic rom mirrored or empty RAM segment.
; MONITOR ROM NOT INSTALLED
LD (HL),$FF ; Test RAM : Set memory to $FF
LD A,(HL) ; Get the byte...
CP $FF ; Compare byte between A reg. and $FF
JR NZ,Error2 ; Error if it's a ROM !
EX DE,HL ; Store the ROM destination location in DE.
LD HL,$0005
PUSH DE ; Keep DE
CALL $9D8 ; Get Basic line 5 address. DE changed !
INC HL
INC HL
INC HL
INC HL
INC HL ; HL+5 to jump line header.
POP DE ; Retrieve DE
LD BC,$800 ; ROM Length.
LDIR ;Copy the bloc.
RET
Error1: ;ROM AGB FOUND.
RST 08H
.db $9C-29 ; RST8 Arg: Error Code:'0'
;NO RAM TO FILL, ROM already setup.
Error2:
RST 08H
.db $B7-29 ; RST8 Arg: Error Code:'R'
; No RAM below the 16k.($2000 to $3FFF)
Test: ; Read "S" in the lower memory segment.
LD BC,1 ; BLOC 1
LD A,($2000)
CP $38
RET Z
INC BC ; BLOC 2
LD A,($2800)
CP $38
RET Z
INC BC ; BLOC 3
LD A,($3000)
CP $38
RET Z
INC BC ; BLOC 4
LD A,($3800)
CP $38
RET Z
LD C,0 ; ROM not setup.
RET
.end