Well, I still have haven't done anything more interesting than writing a keyboard examination routine. It has had some improvements. I did just minutes ago, run the keyboard program on the real MZ-700. Up until then, it was only an emulator running on Win 7. For the most part, running it on the '700 works like it does on the emulator. However, there's one peculiarity... I can't get any results from pressing any of the function keys. I can't get results from F1 to F4 on the emulator either but F6 to F9 do work for me there. I'm guessing F1 to F4 not working on either platform is probably due to the particular monitor call I'm using for key input, but wanted to get answers from those with experience, so here's what I've assembled with Z80AS:
Code: Select all
ORG $1200
CALL INITIALIZE_DISPLAY
MAIN:
CALL DISPLAY_COUNTERS
CALL $001B
PUSH AF
CP $64 ; SHIFT+BREAK (On PC, SHIFT+ESC or SHIFT+END)
JP Z, EXIT ; Exit to Monitor
CP $15 ; SHIFT+DEL = $15 = CLS
CALL Z, CLEAR_SCREEN_15 ; CLS and Show Code for SHIFT+DEL
CALL Z, RESET_COUNTERS
LD DE, MSG2 ; <SPACE> + $0D
CALL Z, $0015
POP AF
CALL NZ, PRINT_CODE
JP NZ, WAIT
JP MAIN
WAIT:
CALL $001B
JP NZ, WAIT
LD DE, CHAR_COUNT
LD A, (DE)
INC A
CP 8
LD (DE), A
CALL Z, NEW_LINE
JP MAIN
EXIT:
CALL CLEAR_SCREEN
POP AF ; Restore $64 to A
CALL $03C3 ; Print the $64 for user
JP $00AD ; Exit to Monitor
PRINT_CODE:
PUSH AF
CALL $03C3
LD DE, MSG2 ; <SPACE> + $0D
CALL $0015
POP AF
RET
DISPLAY_COUNTERS:
LD HL, $D070 ;$D3C0
LD DE, CHAR_COUNT
LD A, (DE)
ADD A, $20
LD B, A
SUB $2A
JR C, NUMERAL_COL
LD A, (DE)
SUB 10
ADD A, $01
LD B, A
NUMERAL_COL:
LD A, B
LD (HL), A
LD HL, $D071 ;$D3C3
LD DE, LINE_COUNT
LD A, (DE)
ADD A, $20
LD B, A
SUB $2A
JR C, NUMERAL_ROW
LD A, (DE)
SUB 10
ADD A, $01
LD B, A
NUMERAL_ROW:
LD A, B
LD (HL), A
RET
CLEAR_SCREEN_15:
PUSH AF
CALL CLEAR_SCREEN
LD DE, MSG1
CALL $0015
CALL $0009
LD DE, MSG2 ; <SPACE> + $0D
CALL $0015
CALL $0009
POP AF
RET
CLEAR_SCREEN:
LD A, $16 ;force clear screen
CALL $0012 ;print clear screen
RET
NEW_LINE:
PUSH AF
LD A, 0
LD DE, CHAR_COUNT
LD (DE), A
LD DE, LINE_COUNT
LD A, (DE)
CP 15
CALL Z, NEW_PAGE
CALL NZ, INC_LINE
CALL NZ, $0009
LD DE, MSG2 ; <SPACE> + $0D
CALL $0015
POP AF
RET
NEW_PAGE:
PUSH AF
NEW_PAGE_LP:
LD HL, $D070
LD A, '.'
LD (HL), A
LD HL, $D071
LD (HL), A
CALL $001B
JP Z, NEW_PAGE_LP ; Hold here until a key is pressed
CALL RESET_COUNTERS
CALL CLEAR_SCREEN_15
POP AF
RET
INC_LINE:
LD DE, LINE_COUNT
LD A, (DE)
INC A
LD (DE), A
RET
INITIALIZE_DISPLAY:
CALL CLEAR_SCREEN
LD DE, MSG1
CALL $0015
CALL $0009
LD DE, MSG2 ; <SPACE> + $0D
CALL $0015
CALL $0009
PUSH AF
LD A, 0
LD DE, CHAR_COUNT
LD (DE), A
LD DE, LINE_COUNT
LD (DE), A
LD DE, MSG2 ; <SPACE> + $0D
CALL $0015
POP AF
RET
RESET_COUNTERS:
PUSH AF
LD A, 0
LD DE, CHAR_COUNT
LD (DE), A
LD DE, LINE_COUNT
LD (DE), A
POP AF
RET
MSG1: DB " SHIFT+DEL = CLS, SHIFT+BREAK = EXIT"
MSG2: DB " ", $0D
CHAR_COUNT: DB 00h
LINE_COUNT: DB 00h
END
My apologies for not being more generous with code comments. I didn't think I'd push this thing that far along.
I do have other finicky/flaky keys that I suppose are not 100% due to the age and wear of the computer. I can get those to work by a little wiggling on the key itself. This trick doesn't seem to work for the function keys though. That's why I'm guessing it's the particular monitor call. Most keys do work surprisingly well for their age. Sadly, the space bar is one of the flaky ones.
Thanks,
John