2007-09-11 14:12:59 +02:00
|
|
|
;;;
|
|
|
|
;;;
|
|
|
|
;;; rs232-asm.S
|
|
|
|
;;;
|
|
|
|
;;; PC-6001 Architecture depend RS-232C implementation,
|
|
|
|
;;; uses a bunch of BIOS functions.
|
|
|
|
;;;
|
|
|
|
;;; @author Takahide Matsutsuka <markn@markn.org>
|
|
|
|
;;;
|
2007-09-19 14:47:19 +02:00
|
|
|
;;; $Id: rs232-asm.S,v 1.2 2007/09/19 12:47:19 matsutsuka Exp $
|
2007-09-11 14:12:59 +02:00
|
|
|
;;;
|
|
|
|
|
|
|
|
;; definitions of PC-6001 BIOS routines
|
|
|
|
_rs232c_initialize = 0x19bf
|
|
|
|
_rs232c_char_output = 0x19e8
|
|
|
|
_char_input_sub = 0x2642
|
|
|
|
_rs232c_interrupt_sub = 0x0f64
|
|
|
|
|
|
|
|
;; export symbols
|
|
|
|
.globl _rs232_arch_writeb
|
|
|
|
.globl _rs232_arch_poll
|
|
|
|
.globl _rs232_arch_init
|
|
|
|
|
|
|
|
.area _CODE
|
|
|
|
|
|
|
|
;; ---------------------------------
|
|
|
|
;; void rs232_writeb(u8_t c)
|
|
|
|
;; Stack; retl reth c
|
|
|
|
;; AFBC__HL____
|
|
|
|
;; return void
|
|
|
|
;; ---------------------------------
|
|
|
|
_rs232_arch_writeb:
|
|
|
|
ld hl, #2
|
|
|
|
add hl, sp
|
|
|
|
ld a, (hl)
|
|
|
|
call _rs232c_char_output
|
|
|
|
ret
|
|
|
|
|
|
|
|
;; ---------------------------------
|
2007-09-19 14:47:19 +02:00
|
|
|
;; unsigned char rs232_arch_poll(unsigned char *stat);
|
|
|
|
;; Stack; retl reth statl stath
|
|
|
|
;; AFBCDEHL____
|
|
|
|
;; return input byte (*stat == 0 if no input)
|
2007-09-11 14:12:59 +02:00
|
|
|
;; ---------------------------------
|
|
|
|
_rs232_arch_poll:
|
2007-09-19 14:47:19 +02:00
|
|
|
ld hl, #2
|
|
|
|
add hl, sp
|
|
|
|
ld e, (hl)
|
|
|
|
inc hl
|
|
|
|
ld d, (hl)
|
|
|
|
ld a, #0x01
|
|
|
|
ld (de), a
|
2007-09-11 14:12:59 +02:00
|
|
|
di
|
|
|
|
call #_char_input_sub ; read from buffer
|
|
|
|
ei
|
|
|
|
jr nz, _rs232_arch_poll_ret
|
|
|
|
xor a ; we have no data in the buffer
|
2007-09-19 14:47:19 +02:00
|
|
|
ld (de), a
|
2007-09-11 14:12:59 +02:00
|
|
|
_rs232_arch_poll_ret:
|
|
|
|
ld l, a
|
|
|
|
ret
|
|
|
|
|
|
|
|
;; ---------------------------------
|
|
|
|
;; void rs232_init(unsigned long ubr);
|
|
|
|
;; Stack; retl reth ubr1 ubr2 ubr3 ubr4
|
|
|
|
;; AFB_DEHL____
|
|
|
|
;; return void
|
|
|
|
;; ---------------------------------
|
|
|
|
_rs232_arch_init:
|
|
|
|
ld b, #0x4f
|
|
|
|
call _rs232c_initialize
|
|
|
|
ret
|