Z80TEST.COM loading code complete, not tested yet

This commit is contained in:
FeralChild64 committed 2021-01-29 19:11:17 +01:00
1 parent 6e42bfe731
commit af7fb6b5fa
4 files changed
+93 -18

No files matched your search

+11 -3
View File
@@ -73,9 +73,17 @@
; BIOS data
;
!addr VEC_MOVE_fetch = $40 ; 2 bytes - vector to byte fetch routine, for BIOS routine MOVE
!addr VEC_MOVE_store = $42 ; 2 bytes - vector to byte store routine, for BIOS routine MOVE
!addr VEC_DISKIO_store = $44 ; 2 bytes - vector to byte store routine, for BIOS disk I/O operations
; Reuse data for loading
!addr BIOS_IOBUFERPTR = $40 ; 4 bytes - pointer to hardware I/O buffer
!addr BIOS_LOADPTR = $44 ; 4 bytes - pointer for loading data
!addr BIOS_LOADCOUNT = $48 ; 2 bytes - counter used for loading data
; XXX are the values below needed?
!addr VEC_MOVE_fetch = $4A ; 2 bytes - vector to byte fetch routine, for BIOS routine MOVE
!addr VEC_MOVE_store = $4C ; 2 bytes - vector to byte store routine, for BIOS routine MOVE
!addr VEC_DISKIO_store = $4E ; 2 bytes - vector to byte store routine, for BIOS disk I/O operations
;
+2 -1
View File
@@ -3,7 +3,8 @@
; Z80 emulator - precalculated data generator
;
z80_table_gen:
Z80_table_gen:
jsr PRIMM
!pet $0D, "Generating CPU tables... "
+6 -4
View File
@@ -53,9 +53,11 @@ ZVM: ; entry point
; XXX enable test jsr ZVM_memtest
; Generate CPU tables
; Generate CPU tables, reset the CPU
jsr z80_table_gen
jsr Z80_table_gen
jsr Z80_reset
; XXX Z80 clear memory here
; Try CPU test
@@ -66,7 +68,7 @@ ZVM: ; entry point
; XXX code is not ready to progress further
jsr PRIMM
!pet $0D, "Implementation not finished yet.", 0
jmp ZVM_halt
jmp ZVM_syshalt
jmp zvm_BIOS_00_BOOT
@@ -134,7 +136,7 @@ ZVM_halt_memtest_failed:
; FALLTROUGH
ZVM_halt:
ZVM_syshalt:
jsr PRIMM
!pet " * System HALTED *", 0
+74 -10
View File
@@ -6,6 +6,8 @@
ZVM_cputest:
; XXX move loading code to separate routine(s)
; Copy file name to RAM
ldx #$FF
@@ -24,14 +26,14 @@ ZVM_cputest:
lda #$2E ; dos_setname
sta HTRAP00
+nop ; required by hypervisor
bcc @end
+bcc @end
; Try to find the file
lda #$34
sta HTRAP00
+nop
bcc @end
+bcc @end
jsr PRIMM
!pet "Loading 'Z80TEST.COM'... ", 0
@@ -51,32 +53,94 @@ ZVM_cputest:
lda #$80
tsb $D689 ; XXX invent name for the register
; Prepare pointers
lda #$FF
sta BIOS_IOBUFERPTR+3
lda #$D6
sta BIOS_IOBUFERPTR+2
lda #$FF
sta BIOS_IOBUFERPTR+3
lda #$D6
sta BIOS_IOBUFERPTR+2
lda #$00
sta BIOS_LOADPTR+3
lda #$05
sta BIOS_LOADPTR+2
lda #$01
sta BIOS_LOADPTR+1
lda #$00
sta BIOS_LOADPTR+1
!addr BIOS_LOADCOUNT = $48 ; 2 bytes - counter used for loading data
; Read sectors
@loop2:
; Set I/O buffer pointer to start
lda #$6E
sta BIOS_IOBUFERPTR+1
lda #$00
sta BIOS_IOBUFERPTR+0
; Read up to 512 bytes
lda #$1A
sta HTRAP00
+nop
; .X (low byte) and .Y (high byte) contain number of bytes read
; Copy data from buffer to memory
; XXX copy data from buffer at $FFD6E00
stx BIOS_LOADCOUNT+0
sty BIOS_LOADCOUNT+1
tya
ora BIOS_LOADCOUNT+0
beq @load_done
@loop3:
; XXX finish the implementation
dew BIOS_LOADCOUNT
bmi @loop2
lda [BIOS_IOBUFERPTR],z
sta [BIOS_LOADPTR],z
inw BIOS_IOBUFERPTR
inw BIOS_LOADPTR
bra @loop3
@load_done:
; At this moment we have Z80TEST.COM loaded into memory
; Install a virtual CP/M, set PC to $0100, and run it!
lda #$01
sta REG_PC+1
dec
sta BIOS_LOADPTR+1
lda #$05
sta BIOS_LOADPTR+0
lda #$76 ; HALT
sta [BIOS_LOADPTR],z
inc BIOS_LOADPTR
lda #$FF
sta [BIOS_LOADPTR],z ; $FF = CP/M simulation for CPU test
; Run the software
jmp ZVM_next
@end:
rts
ZVM_filename_Z80TEST:
!pet "z80test.com", 0