Memory monitor: Removed unused ADB command

This commit is contained in:
Daniele Verducci 2025-02-14 09:50:44 +01:00
parent 7d89deaa02
commit 9960d81a44
3 changed files with 13 additions and 68 deletions

View File

@ -1,15 +1,24 @@
# Pat80 Operating System and Memory Monitor # Pat80 Operating System and Memory Monitor
## Intro ## Intro
This folder contains the Pat80 Operating System. This folder contains the Pat80 Operating System.
It is a System Monitor that makes available also some system API to access hardware (monitor, sound, keyboard, parallel terminal...). It is a System Monitor that makes available also some system API to access hardware (monitor, sound, keyboard, parallel terminal...).
## Build ## Build
### Requirements ### Requirements
z80asm, minipro
z80asm
minipro (if you want to write to an EEPROM)
### Make ### Make
The os can be build issuing command `make`.
The os can be **built** issuing command `make build`.
Two files will be generated: Two files will be generated:
- `rom.bin` is the rom file to be flashed on the eeprom - `rom.bin` is the rom file to be flashed on the eeprom
- `abi-generated.asm` is the file to be included in any Pat80 application to access system APIs (see README.md in ../applications/) - `abi-generated.asm` is the file to be included in any Pat80 application to access system APIs (see README.md in ../applications/)
The build routine will then try to write the rom to a MiniPRO.
The os can be **written to an EEPROM** with a minipro-compatible programmer issuing command `make write`. This runs the build and then tries to write the rom to a MiniPRO.
The os can otherwise be **runned in the emulator** issuing command `make run`. This requires to have the emulator executable already built (follow the instructions on `pat80-emulator/README.md` to build it).

View File

@ -111,7 +111,7 @@ IO_7: EQU 0xE0
;include 'drivers/hd44780.asm' ;include 'drivers/hd44780.asm'
;include 'drivers/keyboard.asm' ;include 'drivers/keyboard.asm'
include 'drivers/ps2_keyboard.asm' ;include 'drivers/ps2_keyboard.asm'
include 'drivers/arduino_terminal.asm' include 'drivers/arduino_terminal.asm'
include 'drivers/sn76489.asm' include 'drivers/sn76489.asm'
include 'monitor.asm' include 'monitor.asm'

View File

@ -25,7 +25,6 @@
; S (SET) $pos $val Replaces byte at $pos with $val ; S (SET) $pos $val Replaces byte at $pos with $val
; L (LOAD) $pos $val ; L (LOAD) $pos $val
; R (RUN) $pos Starts executing code from $pos ; R (RUN) $pos Starts executing code from $pos
; A (ADB) Enters in Assembly Depoy Bridge mode: loads all the incoming bytes in application memory and starts executing.
; The commands are entered with a single letter and the program completes the command ; The commands are entered with a single letter and the program completes the command
include 'libs/strings.asm' include 'libs/strings.asm'
@ -84,9 +83,6 @@ Monitor_main:
ld hl, MON_COMMAND_RUN ld hl, MON_COMMAND_RUN
cp (hl) cp (hl)
jp z, monitor_run jp z, monitor_run
ld hl, MON_COMMAND_ADB
cp (hl)
jp z, monitor_adb
; ld hl, MON_COMMAND_MEMTEST ; ld hl, MON_COMMAND_MEMTEST
; cp (hl) ; cp (hl)
; jp z, monitor_memtest ; jp z, monitor_memtest
@ -320,19 +316,6 @@ monitor_run:
; execute code ; execute code
jp (hl) jp (hl)
monitor_adb:
ld bc, MON_COMMAND_ADB + 1 ; autocomplete command
call Sys_Print
; start copying incoming data to application space
call monitor_copyTermToAppMem
; call monitor_enable_int ; re-enable interrupts
;jp APP_SPACE ; Start executing code
; ld bc, APP_SPACE
; call Sys_Print
jp monitor_main_loop
; Prints "0x" and read 1 hex byte (2 hex digits, e.g. 0x8C) ; Prints "0x" and read 1 hex byte (2 hex digits, e.g. 0x8C)
; Can be cancelled with Q/ENTER ; Can be cancelled with Q/ENTER
; @return a the read byte, b the exit code (0=valid byte in a, 1=Q, 2=ENTER) ; @return a the read byte, b the exit code (0=valid byte in a, 1=Q, 2=ENTER)
@ -524,53 +507,6 @@ monitor_printAsciiByte:
call Sys_Printc call Sys_Printc
ret ret
; Copy data from parallel terminal to application memory. This is tought to be used with the ADB function of the Pat80 Python Terminal.
; Uses TERM_DATA_AVAIL_REG to check if a byte is available before reading it.
; The first two received bytes (heading bytes) defines the stream length (MSB first), the rest of the bytes are copied to memory.
; The copy is completed when the number of bytes defined in the heading bytes are received.
; @uses a, b, c, d, h, l
monitor_copyTermToAppMem:
; d contains the current status.
; 2 = waiting for first heading byte
; 1 = waiting for second heading byte
; 0 = heading bytes received, now receiving binary stream
ld d, 2
ld hl, APP_SPACE ; we will write in APP_SPACE
monitor_copyTermToAppMem_loop:
ld a, d
cp 2 ; check if we are receiving first header byte
jp z, monitor_copyTermToAppMem_loop_rec_head_byte_1
ld a, d
cp 1 ; check if we are receiving second header byte
jp z, monitor_copyTermToAppMem_loop_rec_head_byte_2
; we are receiving binary stream: read byte and save to memory
call Term_readb ; reads a byte from terminal
ld (hl), a ; copy byte to memory
inc hl ; move to next memory position
dec bc ; decrement remaining bytes counter
; check if we reached the number of bytes to be transferred
ld a, b
cp 0
jp nz, monitor_copyTermToAppMem_loop ; continue loop
ld a, c
cp 0
jp nz, monitor_copyTermToAppMem_loop ; continue loop
; all bytes received, return
ret
monitor_copyTermToAppMem_loop_rec_head_byte_1:
; we are receiving first header byte: read byte and save to b
call Term_readb ; reads a byte from terminal
ld b, a
dec d
jp monitor_copyTermToAppMem_loop ; continue loop
monitor_copyTermToAppMem_loop_rec_head_byte_2:
; we are receiving second header byte: read byte and save to c
call Term_readb ; reads a byte from terminal
ld c, a
dec d
jp monitor_copyTermToAppMem_loop ; continue loop
; Runs a memory test to identify ram memory boundaries and check the ram is working. ; Runs a memory test to identify ram memory boundaries and check the ram is working.
; Starting from last memory position, writes 0xFF, reads it back, writes 0x00, reads it back. ; Starting from last memory position, writes 0xFF, reads it back, writes 0x00, reads it back.
; Exits when the first value differs from the written value (this may be caused by a bad ram ; Exits when the first value differs from the written value (this may be caused by a bad ram