• Please review our updated Terms and Rules here

Z80Asm help.... cant address FE0AH with LC, Get or Put...

pocoaust

Member
Joined
Jun 1, 2022
Messages
14
G'day,
sorry i am just teaching myself Assembly to repair this Micromation. I have worked out that to address the 8251 Uart on the Double disk controller i only need to address 2 ports, as the hardware takes care of settings and R/W and W/R hardware as far as i can tell. They are FE0AH for control port and FE02H for read and write data. I have editored a sample monitor that i found for the jade board, and it compiles on Z80asm under windows z80 emulator running cpm.

When I try to change the default address to use the double CPU, the compiler either crashes or errors, and if I change syntax and it actually works, the resulting Hex file is corrupt..
I believe the issue is the instructions are expecting a byte, but the address takes up 2 bytes? Anyone know how to get around fix this?

Thanks in advance....

This is the error message:
JADOR.Z80 - Byte Out of Range Line 01375
IN A,(KBDST)JADOR.Z80 - Byte Out of Range Line 01382
CONIN: IN A,(KBDST)End of file Pass 1
2 Error(s) Detected.
1984 Absolute Bytes. 161 Symbols Detected.

This is the changed code:

; CONTROL PORTS FOR MICROMATION DOUBLER
KDCONT: EQU 0FE0AH ; DOUBLER CONTROL PORT
KDRDWT: EQU 0FE02H ; DOUBLER WRITE PORT SELECTED BY WR / RD


CONOUT: PUSH AF ; push AF into stack
LD A,(KDCONT) ; Read from Control Port
AND 04H ; logical And tranmit ready 01h or 00000001 bin
JP Z,CONOUT+1 ; jump to address
POP AF ; POP FROM THE STACK BACK TO AF
LD (KDRDWT),A ; write to port A
RET ; Return
;
CONIN: LD A,(KDCONT)
AND 02H ; logical And recieve ready 02h or 00000002 bin
JP Z,CONIN
LD A,(KDRDWT) ; read from dataport into A
AND 7FH ; only chars up to 7F
CP 61H ; 'a' to '|' ? If so, A-=20H for capitalization
JP C,ECHO
CP 7CH
JP NC,ECHO
SUB 20H ;subtract
ECHO: CP 18H ; cancel character
JP Z,EXEC ; jump to Exec
 
The Z80 IN and OUT instructions duplicate the same instruction in the 8080. This means that not only do they only accept an 8 bit value for the port address, in operation they also put the contents of the accumulator onto the upper 8 address lines. In a system with 16 bit addresses for the ports, this is a recipe for disaster. Instead, use the IN (C) and OUT (C) instructions.
LD BC,PORT_ADDRESS OUT (C) or LD BC,PORT_ADDRESS IN (C)

should do what you want.
 
The Z80 IN and OUT instructions duplicate the same instruction in the 8080. This means that not only do they only accept an 8 bit value for the port address, in operation they also put the contents of the accumulator onto the upper 8 address lines. In a system with 16 bit addresses for the ports, this is a recipe for disaster. Instead, use the IN (C) and OUT (C) instructions.

The OP could be a little clearer about what they're working on, but... I found this manual for the "Micromation Doubler" disk controller, and I assume that's what they're playing with. So far as I can tell this device uses memory mapped I/O, not port I/O. (On the "S100 bus interface" page of the schematic there's a circuit that appears to be designed to create a signal that's active when the S100's IO IN/OUT pins are active in order to suppress the PROM that does the chip select I/O decoder PROM... which only looks address lines A9 and up. (This interpretation is verified by the text on page 20.) So they definitely should not be using the IN/OUT commands to access this thing.

(The I/O is decoded from FE00H to FFFFH, but because only 4 address lines are used to select functions on the UART and control latches I assume that this address block just repeats 32 times at 16 byte intervals.)

I have editored a sample monitor that i found for the jade board, and it compiles on Z80asm under windows z80 emulator running cpm.

The manual for this device has the PROM code with routines for reading and writing the disk, etc, but unfortunately it doesn't seem to include a console driver. That would sure be helpful...

But just for sanity's sake: What assembler are you trying to use to make this, and where did you get the code you're modifying? Are you sure you're not running into a dumb problem like the assembler you're using natively expects 8080 mnemonics and only does Z80 using macros, or vice-versa? (IE, you're trying to assemble 8080-oriented assembly on a native Z80 assembler?) Mnemonics incompatibility was a common and annoying problem when dealing with the Z80 at the time, and it's pretty common for S100/CP/M oriented software to use the 8080 syntax.
 
Thanks for everyones help. I have now got a working monitor that runs in emulator, but I have found the the 74s471 prom that controls the data lines to the s100 bus has a bad output. I will attempt to read the code, but as the bad output is on a data line, i will see how I go.

Thanks Again.
 
Back
Top