~vertigo/forthbox

b8f21ace1b4dde09164bff374d18bc4c28b5038f — Samuel A. Falvo II 4 months ago 096098a
Alter SystemForth and boot code to use new I/O location
M sysf.disk0/bios.debug.s => sysf.disk0/bios.debug.s +12 -8
@@ 1,5 1,9 @@
CONDAT          = $FE20
CONSTAT         = $FE21
; This file implements the debug console driver.
; This is typically an RS232-type I/O port or something similarly simple.

EMUIOBASE	= $FC0000
CONDAT          = EMUIOBASE+$20
CONSTAT         = EMUIOBASE+$21

debug_emit:
        .al


@@ 28,7 32,7 @@ debug_emit_hw:
	_AS
	pha
	lda #$02	; wait for device to be ready
again:	bit CONSTAT
again:	and CONSTAT
	beq again
	pla
	sta CONDAT


@@ 128,12 132,12 @@ zAnswer = zDev+2
        _AXS
        ldx #$03        ; assume both input and output are ready
        lda #$02        ; test output queue status
        bit CONSTAT
        and CONSTAT
        bne S1          ; if set, leave bit X[0] set.
        dex             ; clear bit 0

S1:     lda #$01        ; test input queue status
        bit CONSTAT
        and CONSTAT
        bne S2          ; if set, leave bit X[1] set.
        dex             ; clear bit 1
        dex


@@ 161,9 165,9 @@ zDev    = zK+1
zAnswer = zDev+2

        _AS
	lda #$01
again:	bit CONSTAT
	beq again
again:	lda CONSTAT
	lsr
	bcc again
        lda #$00
        xba
        lda CONDAT

M sysf.disk0/bootstrap.s => sysf.disk0/bootstrap.s +6 -4
@@ 19,7 19,8 @@ BSP_ORG		= $4000
BIOS_ORG	= $8000
BIOS_END	= $FE00	; stop loading at I/O registers.

DASDBASE	= $FE30
EMUIOBASE	= $FC0000
DASDBASE	= EMUIOBASE+$30
DASDSEL		= DASDBASE+0
DASDBLKH	= DASDBASE+1
DASDBLKL	= DASDBASE+2


@@ 27,7 28,7 @@ DASDSEEK	= DASDBASE+3
DASDDATA	= DASDBASE+4
DASDSTAT	= DASDBASE+5

CONBASE		= $FE20
CONBASE		= EMUIOBASE+$20
CONDATA		= CONBASE+0
CONSTAT		= CONBASE+1



@@ 55,8 56,9 @@ reset:
	ldx #hello
	jsr print

	stz DASDSEL	; DASD 0
	stz DASDBLKH	; block high
	lda #0
	sta DASDSEL	; DASD 0
	sta DASDBLKH	; block high
	lda #$01	; block low (start immediately after boot block)
	sta DASDBLKL
	sta DASDSEEK	; Seek DASD 0

M sysf.disk0/bsf1.k1emu.fs => sysf.disk0/bsf1.k1emu.fs +10 -6
@@ 3,7 3,7 @@

( Disk I/O ports )

HEX FE30 DECIMAL
HEX 0030 DECIMAL
DUP TCONSTANT dasd_n    1+
DUP TCONSTANT dasd_bh   1+
DUP TCONSTANT dasd_bl   1+


@@ 12,18 12,22 @@ DUP TCONSTANT dasd_dat  1+
DUP TCONSTANT dasd_stat 1+
DROP

T: drv0     0 dasd_n C! ;
T: sector   DUP dasd_bl C! 2/ 2/ 2/ 2/ 2/ 2/ 2/ 2/ dasd_bh C! ;
T: seek     DUP dasd_seek C! ;
HEX FC DECIMAL TCONSTANT emu_io_bank

T: drv0     0 dasd_n emu_io_bank C!16M ;
T: sector   DUP dasd_bl emu_io_bank C!16M 2/ 2/ 2/ 2/ 2/ 2/ 2/ 2/ dasd_bh emu_io_bank C!16M ;
T: seek     DUP dasd_seek emu_io_bank C!16M ;
T: wrdata   dasd_dat emu_io_bank C!16M ;
T: rddata   dasd_dat emu_io_bank C@16M ;

T: writeto ( blk buf -- )
    SWAP 2* drv0 sector seek 
    0 BEGIN DUP 1024 XOR WHILE OVER C@ dasd_dat C! 1+ SWAP 1+ SWAP REPEAT
    0 BEGIN DUP 1024 XOR WHILE OVER C@ wrdata 1+ SWAP 1+ SWAP REPEAT
    2DROP ;

T: readfrom ( blk buf -- )
    SWAP 2* drv0 sector seek 
    0 BEGIN DUP 1024 XOR WHILE SWAP dasd_dat C@ OVER C! 1+ SWAP 1+ REPEAT
    0 BEGIN DUP 1024 XOR WHILE SWAP rddata OVER C! 1+ SWAP 1+ REPEAT
    2DROP ;

\ vim: ts=4 sw=4 et ai

M sysf.disk0/sysf.check.fs => sysf.disk0/sysf.check.fs +1 -1
@@ 1,6 1,6 @@
\ Invariant checking

T: EMUQUIT                  $A5 $FE40 !! C! ;
T: EMUQUIT                  $A5 $0040 $FC !! C!16M ;
T: BYE                      EMUQUIT ;
T: CHECK ( f caddr u -- )   ROT IF TYPE CR BEGIN EMUQUIT AGAIN ELSE 2DROP THEN ;


M sysf.disk0/sysf.conin.fs => sysf.disk0/sysf.conin.fs +2 -2
@@ 2,10 2,10 @@ TX: perTIB /TIB   80 ;
TCREATE TIB       80 TALLOT

TX: KEYq KEY? ( -- f )
  $FE21 C@ 1 AND ;
  $0021 $FC C@16M 1 AND ;

T: KEY ( -- ch )
  BEGIN KEY? UNTIL  $FE20 C@ ;
  BEGIN KEY? UNTIL  $0020 $FC C@16M ;

TX: dotbs .bs ( $08 -- )
  DUP EMIT SPACE EMIT ;

M sysf.disk0/sysf.conout.fs => sysf.disk0/sysf.conout.fs +1 -1
@@ 1,6 1,6 @@
\ Console output

T: EMIT ( ch -- )           $FE20 C! ;
T: EMIT ( ch -- )           $0020 $FC C!16M ;
T: CR ( -- )                13 EMIT 10 EMIT ;
T: SPACE ( -- )             32 EMIT ;
T: SPACES ( u -- )          BEGIN DUP WHILE SPACE 1- REPEAT DROP ;