Wednesday, August 15, 2018

--> 8080 & 8085

The 8080 was released in 1974, the same year as the 6800.  It was the basis of the Altair 8800, was the first machine to run Microsoft BASIC and was the basis for the first CP/M computers.
The Z80 runs 8080 binary code, but the 8080 cannot run all Z80 code due to the additional registers and instructions.  The mnemonics used in the assembly source code is different between the the 8080 and Z80..

The 8080 also made it into the Compucolor machines, the Interact Home Computer and the French version called the Hector.

The 8085, a microcontroller version of the 8080, was the basis of the Tandy Model 100 series.

*edit*
After looking at how much of the Z80 code will need to be rewritten, I have decided not to make a complete port, at least not for now.


*edit*
To give you an idea of the work required, I've changed some of the opcodes from Z80 to 8080 equivalents, marked missing instructions with an asterisk, and commented out some code with a semicolon.  This is nowhere near complete and doesn't address some of the missing 16 bit instruction issues.

;**************************************************
; write two characters at once
;**************************************************
print642:
  ; C contains left character, A contains right character
  mov  h,0    ; clear h
  mov  l,c    ; now HL = left char
  mov  d,h    ; clear d
  mov  e,a    ; now DE = right char
  mov  bc,FONT_ADDRl-224 ;add font address  - correct for missing  sbc a,' '
  ; Calculate location of the first character
*  add  hl,hl   ; now HL = 2 *  INT[char]
*  add  hl,hl   ; now HL = 4 *  INT[char]
*  add  hl,hl   ; now HL = 8 *  INT[char]
*  add  hl,bc   ; now hl = FONT_ADDR + 8 *  INT[char]
*  ex  de,hl   ; use DE for first character data pointer, now HL = right char
  
  ; Calculate location of the second character
*  add  hl,hl   ; now HL = 2 *  INT[char]
*  add  hl,hl   ; now HL = 4 *  INT[char]
*  add  hl,hl   ; now HL = 8 *  INT[char]
*  add  hl,bc   ; now hl = FONT_ADDR + 7 *  INT[char]  HL is now 2nd character data pointer

  ; now calculate screen address
  mov  a,[AT_IROW]  ; get the row
  aci  a,70h   ; add screen MSB
*  mov  ixh,a   ; save it
  mov  a,[AT_COL]  ; get the column
  rra      ; least significant bit only indicates which half of byte character is on
*  mov  ixl,a   ; screen address LSB is 0 so just put a in l

  ;start printing
  ldax a,[de]   ; get byte of 1st char
  add  a,[hl]   ; get byte of 2nd char
*  mov  [IX+0],a  ; write result back to screen
;  inx  d    ; next font1 data location
;  inx  h    ; next font2 data location
  inr  e    ; next font1 data location
  inr  l    ; next font2 data location

  mov  a,[de]   ; get byte of 1st char
  add  a,[hl]   ; get byte of 2nd char
*  mov  [IX+1],a  ; write result back to screen
;  inx  d    ; next font1 data location
;  inx  h    ; next font2 data location
  inr  e    ; next font1 data location
  inr  l    ; next font2 data location

  mov  a,[de]   ; get byte of 1st char
  add  a,[hl]   ; get byte of 2nd char
*  mov  [IX+2],a  ; write result back to screen
;  inx  d    ; next font1 data location
;  inx  h    ; next font2 data location
  inr  e    ; next font1 data location
  inr  l    ; next font2 data location

  mov  a,[de]   ; get byte of 1st char
  add  a,[hl]   ; get byte of 2nd char
*  mov  [IX+3],a  ; write result back to screen
;  inx  d    ; next font1 data location
;  inx  h    ; next font2 data location
  inr  e    ; next font1 data location
  inr  l    ; next font2 data location

  mov  a,[de]   ; get byte of 1st char
  add  a,[hl]   ; get byte of 2nd char
*  mov  [IX+4],a  ; write result back to screen
;  inx  d    ; next font1 data location
;  inx  h    ; next font2 data location
  inr  e    ; next font1 data location
  inr  l    ; next font2 data location

  mov  a,[de]   ; get byte of 1st char
  add  a,[hl]   ; get byte of 2nd char
*  mov  [IX+5],a  ; write result back to screen
;  inx  d    ; next font1 data location
;  inx  h    ; next font2 data location
  inr  e    ; next font1 data location
  inr  l    ; next font2 data location

  mov  a,[de]   ; get byte of 1st char
  add  a,[hl]   ; get byte of 2nd char
*  mov  [IX+6],a  ; write result back to screen
;  inx  d    ; next font1 data location
;  inx  h    ; next font2 data location
  inr  e    ; next font1 data location
  inr  l    ; next font2 data location

  mov  a,[de]   ; get byte of 1st char
  add  a,[hl]   ; get byte of 2nd char
*  mov  [IX+7],a  ; write result back to screen

  ret

No comments:

Post a Comment