]> cloudbase.mooo.com Git - z180-stamp.git/commitdiff
CP/M 3 compatible character i/o handling
authorLeo C <erbl259-lmu@yahoo.de>
Tue, 28 Oct 2014 09:29:13 +0000 (10:29 +0100)
committerLeo C <erbl259-lmu@yahoo.de>
Tue, 28 Oct 2014 09:29:13 +0000 (10:29 +0100)
z180/Tupfile
z180/bioscio.180 [new file with mode: 0644]
z180/chario.180 [new file with mode: 0644]
z180/conbuf-a.180
z180/console.180
z180/ddtz.180
z180/modebaud.inc [new file with mode: 0644]
z180/r3init.180
z180/ser1-i.180

index 8b50b8a2930a040367f62208643d29f1febfa65c..bb88946149b2e6ea0457e259f63af365adc23bfe 100644 (file)
@@ -5,7 +5,7 @@ PROG    = hdrom
 SRC    = r3init.180 
 SRC    += ddtz.180
 #SRC   += fifoio.180 msgbuf.180 ser1-i.180 console.180
-SRC    += msgbuf-a.180 conbuf-a.180 ser1-i.180 console.180
+SRC    += msgbuf-a.180 conbuf-a.180 ser1-i.180 bioscio.180 chario.180
 # serial (asci1) console only:
 #SRC   += ser1-i.180 console.180
 SRC    += romend.180
diff --git a/z180/bioscio.180 b/z180/bioscio.180
new file mode 100644 (file)
index 0000000..a3a179f
--- /dev/null
@@ -0,0 +1,325 @@
+\r
+       .z80\r
+\r
+;                Copyright (C), 1982\r
+;               Digital Research, Inc\r
+;                   P.O. Box 579\r
+;              Pacific Grove, CA  93950\r
+\r
+;   This is the invariant portion of the modular BIOS and is\r
+;      distributed as source for informational purposes only.\r
+;      All desired modifications should be performed by\r
+;      adding or changing externally defined modules.\r
+;      This allows producing "standard" I/O modules that\r
+;      can be combined to support a particular system\r
+;      configuration.\r
+;\r
+;   Modified for faster character I/O by Udo Munk\r
+\r
+cr     equ     13\r
+lf     equ     10\r
+bell   equ     7\r
+ctlQ   equ     'Q'-'@'\r
+ctlS   equ     'S'-'@'\r
+\r
+       cseg                    ; GENCPM puts CSEG stuff in common memory\r
+\r
+       ; variables in system data page\r
+\r
+;;     extrn   @covec,@civec,@aovec,@aivec,@lovec ; I/O redirection vectors\r
+                               \r
+       ; user defined character I/O routines\r
+\r
+       extrn   ?ci,?co,?cist,?cost     ; each take device in <B>\r
+       extrn   ?cinit                  ; (re)initialize device in <C>\r
+       extrn   @ctbl                   ; physical character device table\r
+\r
+\r
+       include modebaud.inc    ; define mode bits\r
+\r
+\r
+       public  @covec,@civec,@aovec,@aivec,@lovec ; I/O redirection vectors\r
+       public  ?const,?conin,?cono,?list,?auxo,?auxi\r
+       public  ?lists,?conos,?auxis,?auxos,?dvtbl,charini\r
+\r
+\r
+@CIVEC:        dw      0               ; Console Input Redirection\r
+                               ; Vector (word, r/w)\r
+@COVEC:        dw      0               ; Console Output Redirection\r
+                               ; Vector (word, r/w)\r
+@AIVEC:        dw      0               ; Auxiliary Input Redirection\r
+                               ; Vector (word, r/w)\r
+@AOVEC:        dw      0               ; Auxiliary Output Redirection\r
+                               ; Vector (word, r/w)\r
+@LOVEC:        dw      0               ; List Output Redirection\r
+                               ; Vector (word, r/w)\r
+\r
+\r
+charini:\r
+\r
+       ld      c,15            ; initialize all 16 character devices\r
+c$init$loop:\r
+       push    bc\r
+       call    ?cinit\r
+       pop     bc\r
+       dec     c\r
+       jp      p,c$init$loop\r
+\r
+       ld      hl,1100000000000000b    ; assign console to HOST and ASCI1\r
+       ld      (@civec),hl\r
+       ld      (@covec),hl\r
+       ld      hl,0000000000000000b    ; assign auxiliary to nothing\r
+       ld      (@aivec),hl\r
+       ld      (@aovec),hl\r
+       ld      hl,0000000000000000b    ; assign printer to nothing\r
+       ld      (@lovec),hl\r
+       ret\r
+\r
+\r
+       ; DEVTBL\r
+       ;       Return address of character device table\r
+\r
+?dvtbl:\r
+devtbl:\r
+       ld      hl,@ctbl\r
+       ret\r
+\r
+\r
+       ; CONOUT\r
+       ;       Console Output. Send character in <C>\r
+       ;                       to all selected devices\r
+\r
+?cono:\r
+conout:\r
+       ld      hl,(@covec)     ; fetch console output bit vector\r
+       jr      out$scan\r
+\r
+\r
+       ; AUXOUT\r
+       ;       Auxiliary Output. Send character in <C>\r
+       ;                       to all selected devices\r
+\r
+?auxo:\r
+auxout:\r
+       ld      hl,(@aovec)     ; fetch aux output bit vector\r
+       jr      out$scan\r
+\r
+\r
+       ; LIST\r
+       ;       List Output. Send character in <C>\r
+       ;                       to all selected devices.\r
+\r
+?list:\r
+list:\r
+       ld      hl,(@lovec)     ; fetch list output bit vector\r
+\r
+out$scan:\r
+       ld      b,0             ; start with device 0\r
+co$next:\r
+       add     hl,hl           ; shift out next bit\r
+       jr      nc,not$out$device\r
+       push    hl              ; save the vector\r
+       push    bc              ; save the count and character\r
+       call    ?co             ; if device selected, print it\r
+       pop     bc              ; recover count and character\r
+       pop     hl              ; recover the rest of the vector\r
+not$out$device:\r
+       inc     b               ; next device number\r
+       ld      a,h\r
+       or      l               ; see if any devices left\r
+       jr      nz,co$next      ; and go find them...\r
+       ret\r
+\r
+\r
+       ; CONOST\r
+       ;       Console Output Status. Return true if\r
+       ;               all selected console output devices\r
+       ;               are ready.\r
+\r
+?conos:\r
+conost:\r
+       ld      hl,(@covec)     ; get console output bit vector\r
+       jr      ost$scan\r
+\r
+\r
+       ; AUXOST\r
+       ;       Auxiliary Output Status. Return true if\r
+       ;               all selected auxiliary output devices\r
+       ;               are ready.\r
+\r
+?auxos:\r
+auxost:\r
+       ld      hl,(@aovec)     ; get aux output bit vector\r
+       jr      ost$scan\r
+\r
+\r
+       ; LISTST\r
+       ;       List Output Status. Return true if\r
+       ;               all selected list output devices\r
+       ;               are ready.\r
+\r
+?lists:\r
+listst:\r
+       ld      hl,(@lovec)     ; get list output bit vector\r
+\r
+ost$scan:\r
+       ld      b,0             ; start with device 0\r
+cos$next:\r
+       add     hl,hl           ; check next bit\r
+       push    hl              ; save the vector\r
+       push    bc              ; save the count\r
+       ld      a,0FFh          ; assume device ready\r
+       call    c,coster        ; check status for this device\r
+       pop     bc              ; recover count\r
+       pop     hl              ; recover bit vector\r
+       or      a               ; see if device ready\r
+       ret     z               ; if any not ready, return false\r
+       inc     b               ; drop device number\r
+       ld      a,h\r
+       or      l               ; see if any more selected devices\r
+       jr      nz,cos$next\r
+       or      0FFh            ; all selected were ready, return true\r
+       ret\r
+\r
+coster:                ; check for output device ready, including optional\r
+               ;       xon/xoff support\r
+               ;\r
+               ;TODO: interrupt driven devices should xon/xoff handle\r
+               ;       in isv\r
+\r
+       ld      l,b\r
+       ld      h,0             ; make device code 16 bits\r
+       push    hl              ; save it in stack\r
+       add     hl,hl\r
+       add     hl,hl\r
+       add     hl,hl           ; create offset into device characteristics tbl\r
+       ld      de,@ctbl+6\r
+       add     hl,de           ; make address of mode byte\r
+       ld      a,(hl)\r
+       and     mb$xon$xoff\r
+       pop     hl              ; recover console number in <HL>\r
+       jp      z,?cost         ; not a xon device, go get output status direct\r
+       ld      de,xofflist\r
+       add     hl,de           ; make pointer to proper xon/xoff flag\r
+       call    cist1           ; see if this keyboard has character\r
+       ld      a,(hl)\r
+       call    nz,ci1          ; get flag or read key if any\r
+       cp      ctlq\r
+       jr      nz,not$q        ; if its a ctl-Q,\r
+       ld      a,0FFh          ;       set the flag ready\r
+not$q:\r
+       cp      ctls\r
+       jr      nz,not$s        ; if its a ctl-S,\r
+       ld      a,00h           ;       clear the flag\r
+not$s:\r
+       ld      (hl),a          ; save the flag\r
+       call    cost1           ; get the actual output status,\r
+       and     (hl)            ; and mask with ctl-Q/ctl-S flag\r
+       ret                     ; return this as the status\r
+\r
+cist1:         ; get input status with <BC> and <HL> saved\r
+       push    bc\r
+       push    hl\r
+       call    ?cist\r
+       pop     hl\r
+       pop     bc\r
+       or      a\r
+       ret\r
+\r
+cost1:         ; get output status, saving <BC> & <HL>\r
+       push    bc\r
+       push    hl\r
+       call    ?cost\r
+       pop     hl\r
+       pop     bc\r
+       or      a\r
+       ret\r
+\r
+ci1:           ; get input, saving <BC> & <HL>\r
+       push    bc\r
+       push    hl\r
+       call    ?ci\r
+       pop     hl\r
+       pop     bc\r
+       ret\r
+\r
+\r
+       ; AUXIST\r
+       ;       Auxiliary Input Status. Return true if\r
+       ;               any selected auxiliary input device\r
+       ;               has an available character.\r
+?auxis:\r
+auxist:\r
+       ld      hl,(@aivec)     ; get aux input bit vector\r
+       jr      ist$scan\r
+\r
+\r
+       ; CONST\r
+       ;       Console Input Status. Return true if\r
+       ;               any selected console input device\r
+       ;               has an available character.\r
+?const:\r
+const:\r
+       ld      hl,(@civec)     ; get console input bit vector\r
+\r
+\r
+ist$scan:\r
+       ld      b,0             ; start with device 0\r
+cis$next:\r
+       add     hl,hl           ; check next bit\r
+       ld      a,0             ; assume device not ready\r
+       call    c,cist1         ; check status for this device\r
+       or      a\r
+       ret     nz              ; if any ready, return true\r
+       inc     b               ; next device number\r
+       ld      a,h\r
+       or      l               ; see if any more selected devices\r
+       jr      nz,cis$next\r
+       xor     a               ; all selected were not ready, return false\r
+       ret\r
+\r
+\r
+       ; AUXIN\r
+       ;       Auxiliary Input. Return character from first\r
+       ;               ready auxiliary input device.\r
+?auxi:\r
+auxin:\r
+       ld      hl,(@aivec)\r
+       jr      in$scan\r
+\r
+\r
+       ; CONIN\r
+       ;       Console Input. Return character from first\r
+       ;               ready console input device.\r
+?conin:\r
+conin:\r
+       ld      hl,(@civec)\r
+\r
+in$scan:\r
+       push    hl              ; save bit vector\r
+       ld      b,0\r
+ci$next:\r
+       add     hl,hl           ; shift out next bit\r
+       ld      a,0             ; insure zero a (nonexistant device not ready).\r
+       call    c,cist1         ; see if the device has a character\r
+       or      a\r
+       jr      nz,ci$rdy       ; this device has a character\r
+       inc     b               ; else, next device\r
+       ld      a,h\r
+       or      l               ; see if any more devices\r
+       jr      nz,ci$next      ; go look at them\r
+       pop     hl              ; recover bit vector\r
+       jr      in$scan         ; loop til we find a character\r
+ci$rdy:\r
+       pop     hl              ; discard extra stack\r
+       jp      ?ci\r
+\r
+\r
+\r
+xofflist:\r
+       db      -1,-1,-1,-1,-1,-1,-1,-1 ; ctl-s clears to zero\r
+       db      -1,-1,-1,-1,-1,-1,-1,-1\r
+\r
+\r
+       end\r
+\r
diff --git a/z180/chario.180 b/z180/chario.180
new file mode 100644 (file)
index 0000000..6632690
--- /dev/null
@@ -0,0 +1,103 @@
+       page    255\r
+       .z80\r
+\r
+\r
+;      CP/M 3  compatible character i/o \r
+\r
+       public  ?cinit,?ci,?co,?cist,?cost\r
+       public  @ctbl\r
+\r
+       extrn   ff.init,ff.i.st,ff.in,ff.o.st,ff.out\r
+       extrn   ser.init,ser.ist,ser.in,ser.ost,ser.out\r
+       \r
+       include config.inc\r
+       include z180reg.inc\r
+       include modebaud.inc    ; define mode bits and baud eqautes\r
+\r
+\r
+max$device     equ 2\r
+\r
+       cseg\r
+\r
+; c = device\r
+\r
+?cinit:                                ; init devices\r
+       ld      b,c\r
+       call    vector$io\r
+       dw      ff.init\r
+       dw      ser.init\r
+       dw      rret\r
+\r
+; b = device, c = output char, a = input char\r
+\r
+?ci:                           ; character input\r
+       call    vector$io\r
+       dw      ff.in\r
+       dw      ser.in\r
+       dw      null$input\r
+\r
+?cist:                         ; character input status\r
+       call    vector$io\r
+       dw      ff.i.st\r
+       dw      ser.ist\r
+       dw      null$status\r
+\r
+?co:                           ; character output\r
+       call    vector$io\r
+       dw      ff.out\r
+       dw      ser.out\r
+       dw      rret\r
+\r
+?cost:                         ; character output status\r
+       call    vector$io\r
+       dw      ff.o.st\r
+       dw      ser.ost\r
+       dw      ret$true\r
+\r
+vector$io:\r
+       ld      a,max$device\r
+       ld      e,b\r
+vector:\r
+       pop     hl\r
+       ld      d,0\r
+       cp      e\r
+       jr      nc,exist\r
+       ld      e,a             ; use null device if a >= max$device\r
+exist: add     hl,de\r
+       add     hl,de\r
+       ld      a,(hl)\r
+       inc     hl\r
+       ld      h,(hl)\r
+       ld      l,a\r
+       jp      (hl)\r
+\r
+\r
+null$input:\r
+       ld      a,1Ah\r
+rret:\r
+       ret\r
+ret$true:\r
+       or      0FFh\r
+       ret\r
+\r
+null$status:\r
+       xor     a\r
+       ret\r
+\r
+;--------------------------------------------------------------\r
+\r
+\r
+@ctbl:\r
+       db      'HOST  '        ; device 0\r
+       db      mb$output\r
+       db      baud$none\r
+\r
+       db      'ASCI1 '        ; device 0\r
+       db      mb$in$out+mb$serial+mb$soft$baud\r
+ser1$baud:\r
+       db      baud$19200\r
+\r
+       db      0               ; table terminator\r
+\r
+       end\r
+\r
index 3ec84d45827372df88a63460d25f90d687c79d9c..8534f7300441c0af2d99e4cac4bac3447c31d9cf 100644 (file)
@@ -4,7 +4,7 @@
 ;\r
 ; FIFO channels for communication with avr\r
 ;\r
-       global  ff.init,ff.in,ff.out,ff.i.st\r
+       global  ff.init,ff.in,ff.out,ff.i.st,ff.o.st\r
 \r
        extrn   buf.init\r
 \r
@@ -105,6 +105,7 @@ buf.put:
        push    bc\r
        push    ix\r
        pop     hl\r
+       ld      a,c\r
        ld      c,(ix+o.in_idx)         ;\r
        ld      b,0\r
        add     hl,bc\r
index 07fb570a2f07b72cb90009de48d45603503f8fb4..d4f41305e37c5488e16079977fc14142af903bfb 100644 (file)
@@ -7,9 +7,9 @@
        global  $co\r
 \r
 \r
-       extrn   ser.init,ser.instat,ser.in,ser.out\r
-       extrn   ff.init,ff.i.st,ff.in,ff.out\r
-       extrn   ff.out\r
+       extrn   ser.init,ser.ist,ser.in,ser.ost,ser.out\r
+       extrn   ff.init,ff.i.st,ff.in\r
+       extrn   ff.o.st,ff.out\r
        \r
 \r
        include config.inc\r
@@ -27,13 +27,13 @@ $coninit:
 $cists:\r
        call    ff.i.st\r
        ret     nz\r
-       call    ser.instat\r
+       call    ser.ist\r
        ret\r
        \r
 $ci:\r
        call    ff.i.st\r
        jp      nz,ff.in\r
-       call    ser.instat\r
+       call    ser.ist\r
        jp      nz,ser.in\r
        jr      $ci\r
        \r
index 77da910a372e5b79a29863217ef54ed742167752..e544b08650a41de71727d27196b6ca4ddd4c6761 100644 (file)
@@ -1,7 +1,7 @@
        page    255\r
        .z80\r
 \r
-       external $ci, $co, $cists\r
+       extrn   ?const,?conin,?cono\r
 \r
        global  ddtz,bpent\r
        global  $stack\r
@@ -27,7 +27,7 @@ BP_CNT                equ     12              ;number of breakbpoints
 \r
 \r
 ;--------------------------------------------------\r
-; \r
+;\r
 \r
 ; copy code to common memory and execute it there\r
 comst  macro\r
@@ -103,17 +103,17 @@ ddtz:
        ld      hl,sysramc\r
        ld      de,topcodbeg\r
        ld      bc,topcodend-topcodbeg\r
-       ldir                    \r
-       \r
+       ldir\r
+\r
        ld      hl,vartab\r
        ld      de,ddtram\r
        ld      bc,vartabe-vartab\r
-       ldir            \r
+       ldir\r
        exx\r
 \r
        ld      a,e\r
        ld      (ubbr),a\r
-       \r
+\r
 ddtz_w:\r
        ld hl,MSG               ;073c\r
        call PSTR               ;073f\r
@@ -203,29 +203,53 @@ CMD.?:
        call    PSTR\r
        ret\r
 \r
+$ci:\r
+       push    hl\r
+       push    de\r
+       push    bc\r
+       call    ?conin\r
+       pop     bc\r
+       pop     de\r
+       pop     hl\r
+       ret\r
+\r
+$co:\r
+       push    hl\r
+       push    de\r
+       push    bc\r
+       ld      c,a\r
+       call    ?cono\r
+       pop     bc\r
+       pop     de\r
+       pop     hl\r
+       ret\r
+\r
 DELC:\r
-       ld a,b                  ;07f2\r
-       or a                    ;07f3\r
-       ret z                   ;07f4\r
-       ld a,BS                 ;07f5\r
-       call $co                ;07f7\r
-       ld a,' '                ;07fa\r
-       call $co                ;07fc\r
-       ld a,BS                 ;07ff\r
-       call $co                ;0801\r
-       dec hl                  ;0804\r
-       dec b                   ;0805\r
-       inc c                   ;0806\r
-       ld a,(hl)               ;0807\r
-       cp ' '                  ;0808\r
-       ret nc                  ;080a\r
-       ld a,BS                 ;080b\r
-       call $co                ;080d\r
-       ld a,' '                ;0810\r
-       call $co                ;0812\r
-       ld a,BS                 ;0815\r
-       call $co                ;0817\r
-       ret                     ;081a\r
+       ld      a,b\r
+       or      a\r
+       ret     z\r
+       call    DELC1\r
+       dec     hl\r
+       dec     b\r
+       inc     c\r
+       ld      a,(hl)\r
+       cp      ' '\r
+       ret     nc\r
+DELC1:\r
+       push    de\r
+       push    hl\r
+       push    bc\r
+       ld      c,BS\r
+       call    ?cono\r
+       ld      c,' '\r
+       call    ?cono\r
+       ld      c,BS\r
+       call    ?cono\r
+       pop     bc\r
+       pop     hl\r
+       pop     de\r
+       ret\r
+\r
 DELL:\r
        ld a,b                  ;081b\r
        or a                    ;081c\r
@@ -472,22 +496,34 @@ l0960h:
 outquote:\r
        ld a,''''               ;0979\r
 OUTCHAR:\r
-       push hl                 ;097b\r
-       push af                 ;097c\r
-       and 07fh                ;097d\r
-       call $co                ;097f\r
-       ld hl,CON.COL           ;0982\r
-       inc (hl)                ;0985\r
-       pop af                  ;0986\r
-       pop hl                  ;0987\r
+       push    hl\r
+       push    de\r
+       push    bc\r
+       push    af\r
+       and     07fh\r
+       ld      c,a\r
+       call    ?cono\r
+       ld      hl,CON.COL\r
+       inc     (hl)\r
+       pop     af\r
+       pop     bc\r
+       pop     de\r
+       pop     hl\r
        ret                     ;0988\r
 \r
 inchar:\r
-       call $cists             ;0989\r
-       and a                   ;098c\r
-       ret z                   ;098d\r
-       call $ci                ;098e\r
+       push    hl\r
+       push    de\r
+       push    bc\r
+       call    ?const\r
+       and     a\r
+       jr      z,inch1\r
+       call    ?conin\r
        scf                     ;0991\r
+inch1:\r
+       pop     bc\r
+       pop     de\r
+       pop     hl\r
        ret                     ;0992\r
 \r
 PSTR:\r
@@ -1816,7 +1852,7 @@ l1144h:
        inc hl                  ;1176\r
        ld a,d                  ;1177\r
        comrep                  ;1178\r
-       \r
+\r
        else\r
 \r
        ld a,(ddtrst)           ;115c\r
@@ -4649,7 +4685,7 @@ b_0x2108_start:                   ;       1 byte opcodes
        defb 08bh               ;2137\r
        defw l2561h             ;2138\r
 \r
-       defb 0c7h               ;213a   rst \r
+       defb 0c7h               ;213a   rst\r
        defb 0c7h               ;213b\r
        defb 0b4h               ;213c\r
        defw l231eh             ;213d\r
diff --git a/z180/modebaud.inc b/z180/modebaud.inc
new file mode 100644 (file)
index 0000000..2e60e44
--- /dev/null
@@ -0,0 +1,31 @@
+       ; equates for mode byte bit fields\r
+\r
+mb$input               equ 00000001b   ; device may do input\r
+mb$output              equ 00000010b   ; device may do output\r
+mb$in$out              equ mb$input+mb$output\r
+\r
+mb$soft$baud           equ 00000100b   ; software selectable\r
+                                       ; baud rates\r
+\r
+mb$serial              equ 00001000b   ; device may use protocol\r
+mb$xon$xoff            equ 00010000b   ; XON/XOFF protocol\r
+                                       ; enabled\r
+\r
+baud$none              equ 0           ; no baud rate associated\r
+                                       ; with this device\r
+baud$50                        equ 1           ; 50 baud\r
+baud$75                        equ 2           ; 75 baud\r
+baud$110               equ 3           ; 110 baud\r
+baud$134               equ 4           ; 134.5 baud\r
+baud$150               equ 5           ; 150 baud\r
+baud$300               equ 6           ; 300 baud\r
+baud$600               equ 7           ; 600 baud\r
+baud$1200              equ 8           ; 1200 baud\r
+baud$1800              equ 9           ; 1800 baud\r
+baud$2400              equ 10          ; 2400 baud\r
+baud$3600              equ 11          ; 3600 baud\r
+baud$4800              equ 12          ; 4800 baud\r
+baud$7200              equ 13          ; 7200 baud\r
+baud$9600              equ 14          ; 9600 baud\r
+baud$19200             equ 15          ; 19.2k baud\r
+\r
index 2dd1bb8f7343119d30c37ba43752f7d9d38e32d9..9adbdd8c3cd04a35231f1799c4c9dd882dd4f84d 100644 (file)
@@ -3,7 +3,7 @@
 \r
        extrn ddtz,bpent\r
        extrn $stack\r
-       extrn $coninit,$cists,$ci\r
+       extrn charini,?const,?conin\r
 \r
        extrn romend\r
 \r
@@ -73,17 +73,20 @@ hwini0:
 ;----------------------------------------------------------------------\r
 \r
 start:\r
-       push af                 ;003c\r
-       in0 a,(itc)             ;003d   Illegal opcode trap?\r
-       jp p,??st01             ;0040\r
-       pop af                  ;0043\r
-       jp bpent                ;0044     yes, handle\r
+       ld      (tmpstack),sp\r
+       ld      sp,tmpstack\r
+       push af\r
+       in0 a,(itc)             ;Illegal opcode trap?\r
+       jp m,??st01\r
+       ld a,i                  ;I register == 0 ?\r
+       jr z,??st02             ;    yes, harware reset\r
 \r
 ??st01:\r
-       ld a,i                  ;0047   I register == 0 ?\r
-       jr z,??st02             ;004b     yes, harware reset\r
-       pop af                  ;004d\r
-       jp bpent                ;004e     no, allready set up\r
+       ld      a,(syscbr)\r
+       out0    (cbr),a\r
+       pop af                  ;restore registers\r
+       ld      sp,(tmpstack)   ;\r
+       jp bpent                ;\r
 \r
 ??st02:\r
        di                      ;0058\r
@@ -189,6 +192,8 @@ ramok:
 \r
 alloc:\r
        out0    (cbr),c         ;01de\r
+       ld      a,c\r
+       ld      (syscbr),a\r
        ld      sp,$stack       ;01e1\r
 \r
 ; Clear RAM using DMA0\r
@@ -280,7 +285,7 @@ wstart:
 \r
        call    prt0_init\r
 \r
-       call    $coninit\r
+       call    charini\r
 \r
        call    bufferinit\r
 \r
@@ -289,15 +294,21 @@ wstart:
        im 2                    ;?030e\r
        ei                      ;0282\r
 \r
-       call $cists             ;0284\r
-       call $cists             ;0287\r
+       call ?const             ;0284\r
+       call ?const             ;0287\r
        or a                    ;028a\r
-       call nz,$ci             ;028d\r
+       call nz,?conin          ;028d\r
 \r
        ld a,(banktab)          ;\r
        ld e,a                  ;\r
        jp ddtz                 ;0290\r
 \r
+\r
+       ds      8\r
+tmpstack:\r
+       dw      2\r
+syscbr:        db      1\r
+\r
 ;\r
 ;----------------------------------------------------------------------\r
 ;\r
index 4074a9d2c95311bb66901cb7c512db1f16fc7d9a..2410e3804ed64b6f0e3126f7a0830fbdea0ab330 100644 (file)
@@ -6,8 +6,8 @@
 \r
        \r
        global  ser.init\r
-       global  ser.instat,ser.in\r
-       global  ser.out\r
+       global  ser.ist,ser.in\r
+       global  ser.ost,ser.out\r
 \r
 ;TODO: define a trampoline area somewhere in top ram. \r
 rtxisvjmp      equ     0FF60h  ;momentan frei...\r
@@ -78,7 +78,7 @@ ser.init:
 ;      ei\r
        ret                     ;\r
 \r
-ser.instat:\r
+ser.ist:\r
        push    ix\r
        ld      ix,ser1.inbuf   ;\r
 \r
@@ -126,7 +126,7 @@ bg.w1:
        ret                             ; 9\r
                                        ;   153 \r
 \r
-ser.outstat:\r
+ser.ost:\r
        push    ix\r
        ld      ix,ser1.outbuf          ;\r
 buf.full:\r
@@ -148,6 +148,7 @@ buf.put:
        push    bc\r
        push    ix\r
        pop     hl\r
+       ld      a,c\r
        ld      c,(ix+o.in_idx)         ;\r
        ld      b,0\r
        add     hl,bc\r