initial
This commit is contained in:
220
build/main.asm
Normal file
220
build/main.asm
Normal file
@@ -0,0 +1,220 @@
|
||||
;--------------------------------------------------------
|
||||
; File Created by SDCC : free open source ISO C Compiler
|
||||
; Version 4.5.0 #15242 (Linux)
|
||||
;--------------------------------------------------------
|
||||
.module main
|
||||
|
||||
.optsdcc -mz80 sdcccall(1)
|
||||
;--------------------------------------------------------
|
||||
; Public variables in this module
|
||||
;--------------------------------------------------------
|
||||
.globl _main
|
||||
.globl _delay_ms
|
||||
.globl _io_in
|
||||
.globl _io_out
|
||||
;--------------------------------------------------------
|
||||
; special function registers
|
||||
;--------------------------------------------------------
|
||||
;--------------------------------------------------------
|
||||
; ram data
|
||||
;--------------------------------------------------------
|
||||
.area _DATA
|
||||
;--------------------------------------------------------
|
||||
; ram data
|
||||
;--------------------------------------------------------
|
||||
.area _INITIALIZED
|
||||
;--------------------------------------------------------
|
||||
; absolute external ram data
|
||||
;--------------------------------------------------------
|
||||
.area _DABS (ABS)
|
||||
;--------------------------------------------------------
|
||||
; global & static initialisations
|
||||
;--------------------------------------------------------
|
||||
.area _HOME
|
||||
.area _GSINIT
|
||||
.area _GSFINAL
|
||||
.area _GSINIT
|
||||
;--------------------------------------------------------
|
||||
; Home
|
||||
;--------------------------------------------------------
|
||||
.area _HOME
|
||||
.area _HOME
|
||||
;--------------------------------------------------------
|
||||
; code
|
||||
;--------------------------------------------------------
|
||||
.area _CODE
|
||||
;main.c:19: static void acia_init(void)
|
||||
; ---------------------------------
|
||||
; Function acia_init
|
||||
; ---------------------------------
|
||||
_acia_init:
|
||||
;main.c:21: io_out(ACIA_CTRL_STATUS, ACIA_CMD_MASTER_RESET);
|
||||
ld l, #0x03
|
||||
ld a, #0x20
|
||||
call _io_out
|
||||
;main.c:22: io_out(ACIA_CTRL_STATUS, ACIA_CMD_8N1_DIV16);
|
||||
ld l, #0x15
|
||||
ld a, #0x20
|
||||
;main.c:23: }
|
||||
jp _io_out
|
||||
;main.c:25: static uint8_t acia_status(void)
|
||||
; ---------------------------------
|
||||
; Function acia_status
|
||||
; ---------------------------------
|
||||
_acia_status:
|
||||
;main.c:27: return io_in(ACIA_CTRL_STATUS);
|
||||
ld a, #0x20
|
||||
;main.c:28: }
|
||||
jp _io_in
|
||||
;main.c:30: static void acia_putc(uint8_t value)
|
||||
; ---------------------------------
|
||||
; Function acia_putc
|
||||
; ---------------------------------
|
||||
_acia_putc:
|
||||
ld l, a
|
||||
;main.c:32: while ((acia_status() & ACIA_STATUS_TDRE) == 0) {
|
||||
00101$:
|
||||
push hl
|
||||
call _acia_status
|
||||
pop hl
|
||||
bit 1, a
|
||||
jr Z, 00101$
|
||||
;main.c:34: io_out(ACIA_DATA, value);
|
||||
ld a, #0x21
|
||||
;main.c:35: }
|
||||
jp _io_out
|
||||
;main.c:37: static uint8_t acia_getc_nonblocking(uint8_t *value)
|
||||
; ---------------------------------
|
||||
; Function acia_getc_nonblocking
|
||||
; ---------------------------------
|
||||
_acia_getc_nonblocking:
|
||||
;main.c:39: if ((acia_status() & ACIA_STATUS_RDRF) == 0) {
|
||||
push hl
|
||||
call _acia_status
|
||||
pop hl
|
||||
rrca
|
||||
jr C, 00102$
|
||||
;main.c:40: return 0;
|
||||
xor a, a
|
||||
ret
|
||||
00102$:
|
||||
;main.c:43: *value = io_in(ACIA_DATA);
|
||||
push hl
|
||||
ld a, #0x21
|
||||
call _io_in
|
||||
pop hl
|
||||
ld (hl), a
|
||||
;main.c:44: return 1;
|
||||
ld a, #0x01
|
||||
;main.c:45: }
|
||||
ret
|
||||
;main.c:47: static void acia_puts(const char *text)
|
||||
; ---------------------------------
|
||||
; Function acia_puts
|
||||
; ---------------------------------
|
||||
_acia_puts:
|
||||
;main.c:49: while (*text) {
|
||||
00101$:
|
||||
ld a, (hl)
|
||||
or a, a
|
||||
ret Z
|
||||
;main.c:50: acia_putc((uint8_t)*text++);
|
||||
inc hl
|
||||
push hl
|
||||
call _acia_putc
|
||||
pop hl
|
||||
;main.c:52: }
|
||||
jr 00101$
|
||||
;main.c:54: void main(void)
|
||||
; ---------------------------------
|
||||
; Function main
|
||||
; ---------------------------------
|
||||
_main::
|
||||
push af
|
||||
;main.c:57: uint8_t ch = 0;
|
||||
ld iy, #0
|
||||
add iy, sp
|
||||
ld 0 (iy), #0x00
|
||||
;main.c:59: io_out(PIO_A_CTRL, 0x0F);
|
||||
ld l, #0x0f
|
||||
ld a, #0x42
|
||||
call _io_out
|
||||
;main.c:60: io_out(PIO_A_DATA, 0x00);
|
||||
ld l, #0x00
|
||||
ld a, #0x40
|
||||
call _io_out
|
||||
;main.c:62: acia_init();
|
||||
call _acia_init
|
||||
;main.c:63: acia_puts("ACIA 6850 test ready\r\n");
|
||||
ld hl, #___str_0
|
||||
call _acia_puts
|
||||
ld iy, #1
|
||||
add iy, sp
|
||||
ld 0 (iy), #0x00
|
||||
00106$:
|
||||
;main.c:66: uint8_t status = acia_status();
|
||||
call _acia_status
|
||||
;main.c:68: if (acia_getc_nonblocking(&ch)) {
|
||||
ld hl, #0
|
||||
add hl, sp
|
||||
call _acia_getc_nonblocking
|
||||
or a, a
|
||||
jr Z, 00104$
|
||||
;main.c:69: io_out(PIO_A_DATA, ch);
|
||||
ld iy, #0
|
||||
add iy, sp
|
||||
ld l, 0 (iy)
|
||||
ld a, #0x40
|
||||
call _io_out
|
||||
;main.c:70: acia_putc(ch);
|
||||
ld hl, #0
|
||||
add hl, sp
|
||||
ld a, (hl)
|
||||
call _acia_putc
|
||||
;main.c:71: if (ch == '\r') {
|
||||
ld hl, #0
|
||||
add hl, sp
|
||||
ld a, (hl)
|
||||
sub a, #0x0d
|
||||
jr NZ, 00102$
|
||||
;main.c:72: acia_putc('\n');
|
||||
ld a, #0x0a
|
||||
call _acia_putc
|
||||
00102$:
|
||||
;main.c:74: delay_ms(50);
|
||||
ld hl, #0x0032
|
||||
call _delay_ms
|
||||
00104$:
|
||||
;main.c:77: acia_putc((uint8_t)('0' + (cnt & 0x07)));
|
||||
ld hl, #1
|
||||
add hl, sp
|
||||
ld a, (hl)
|
||||
and a, #0x07
|
||||
add a, #0x30
|
||||
call _acia_putc
|
||||
;main.c:78: acia_puts("\r\n");
|
||||
ld hl, #___str_1
|
||||
call _acia_puts
|
||||
;main.c:79: cnt++;
|
||||
ld iy, #1
|
||||
add iy, sp
|
||||
inc 0 (iy)
|
||||
;main.c:80: delay_ms(250);
|
||||
ld hl, #0x00fa
|
||||
call _delay_ms
|
||||
jr 00106$
|
||||
;main.c:82: }
|
||||
pop af
|
||||
ret
|
||||
___str_0:
|
||||
.ascii "ACIA 6850 test ready"
|
||||
.db 0x0d
|
||||
.db 0x0a
|
||||
.db 0x00
|
||||
___str_1:
|
||||
.db 0x0d
|
||||
.db 0x0a
|
||||
.db 0x00
|
||||
.area _CODE
|
||||
.area _INITIALIZER
|
||||
.area _CABS (ABS)
|
||||
Reference in New Issue
Block a user