Преглед на файлове

zasm: change ioRewind to ioSeek

Will need it soon.
pull/10/head
Virgil Dupras преди 5 години
родител
ревизия
fa28d64278
променени са 4 файла, в които са добавени 20 реда и са изтрити 8 реда
  1. +1
    -2
      apps/zasm/io.asm
  2. +2
    -1
      apps/zasm/main.asm
  3. +10
    -3
      tools/emul/zasm.c
  4. +7
    -2
      tools/emul/zasm_glue.asm

+ 1
- 2
apps/zasm/io.asm Целия файл

@@ -22,8 +22,7 @@ ioPutC:
ld ix, (IO_OUT_PUTC)
jp (ix)

ioRewind:
ld hl, 0
ioSeek:
ld ix, (IO_IN_SEEK)
jp (ix)



+ 2
- 1
apps/zasm/main.asm Целия файл

@@ -75,7 +75,8 @@ zasmMain:
call zasmParseFile
ret nz
; Second pass
call ioRewind
ld hl, 0
call ioSeek
xor a
ld (ZASM_FIRST_PASS), a
call zasmParseFile


+ 10
- 3
tools/emul/zasm.c Целия файл

@@ -27,7 +27,7 @@
// in sync with zasm_glue.asm
#define USER_CODE 0x4800
#define STDIO_PORT 0x00
#define STDIN_REWIND 0x01
#define STDIN_SEEK 0x01

// Other consts
#define STDIN_BUFSIZE 0x8000
@@ -41,6 +41,7 @@ static uint8_t mem[0x10000];
static uint8_t inpt[STDIN_BUFSIZE];
static int inpt_size;
static int inpt_ptr;
static uint8_t received_first_seek_byte = 0;

static uint8_t io_read(int unused, uint16_t addr)
{
@@ -65,8 +66,14 @@ static void io_write(int unused, uint16_t addr, uint8_t val)
#ifndef MEMDUMP
putchar(val);
#endif
} else if (addr == STDIN_REWIND) {
inpt_ptr = 0;
} else if (addr == STDIN_SEEK) {
if (received_first_seek_byte) {
inpt_ptr |= val;
received_first_seek_byte = 0;
} else {
inpt_ptr = (val << 8) & 0xff00;
received_first_seek_byte = 1;
}
} else {
fprintf(stderr, "Out of bounds I/O write: %d / %d\n", addr, val);
}


+ 7
- 2
tools/emul/zasm_glue.asm Целия файл

@@ -2,7 +2,7 @@
.equ RAMSTART 0x4000
.equ USER_CODE 0x4800
.equ STDIO_PORT 0x00
.equ STDIN_REWIND 0x01
.equ STDIN_SEEK 0x01

jr init ; 2 bytes
; *** JUMP TABLE ***
@@ -43,7 +43,12 @@ emulPutC:
ret

emulSeek:
out (STDIN_REWIND), a
; the STDIN_SEEK port works by poking it twice. First poke is for high
; byte, second poke is for low one.
ld a, h
out (STDIN_SEEK), a
ld a, l
out (STDIN_SEEK), a
ret

#include "core.asm"


Loading…
Отказ
Запис