Trying to obtain fixed position system calls. Not working ATM
This commit is contained in:
parent
c21462e52f
commit
b1f9788772
3
assembly/applications/call_printc.asm
Normal file
3
assembly/applications/call_printc.asm
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ld bc, 0xA000
|
||||||
|
call 0x0010
|
||||||
|
jp 0
|
@ -1,6 +1,8 @@
|
|||||||
bios:
|
bios:
|
||||||
@echo "Building PAT80 rom..."
|
@echo "Building PAT80 rom..."
|
||||||
@z80asm -i main.asm -o rom.bin
|
@z80asm -i main.asm -o rom.bin || (exit 1)
|
||||||
|
@echo "Generating label lookup table..."
|
||||||
|
@z80asm -i main.asm -o rom.bin -L 2>&1 | grep "Sys_" > rom.label
|
||||||
@echo "PAT80 Rom size:"
|
@echo "PAT80 Rom size:"
|
||||||
@du -h rom.bin
|
@du -h rom.bin
|
||||||
@echo "Stretching rom to EEPROM size..."
|
@echo "Stretching rom to EEPROM size..."
|
||||||
|
@ -12,9 +12,9 @@ Time_delay55:
|
|||||||
bit 0,a ; 8
|
bit 0,a ; 8
|
||||||
bit 0,a ; 8
|
bit 0,a ; 8
|
||||||
bit 0,a ; 8
|
bit 0,a ; 8
|
||||||
and a,255 ; 7
|
and 255 ; 7
|
||||||
dec bc ; 6
|
dec bc ; 6
|
||||||
ld a,c ; 4
|
ld a,c ; 4
|
||||||
or a,b ; 4
|
or b ; 4
|
||||||
jp nz,Time_delay55 ; 10, total = 55 states/iteration
|
jp nz,Time_delay55 ; 10, total = 55 states/iteration
|
||||||
ret
|
ret
|
@ -19,6 +19,45 @@ jp Sysinit ; Startup vector: DO NOT MOVE! Must be the first instruction
|
|||||||
; I/O 6 (0xC0 - 0xDF)
|
; I/O 6 (0xC0 - 0xDF)
|
||||||
; I/O 7 (0xE0 - 0xFF)
|
; I/O 7 (0xE0 - 0xFF)
|
||||||
|
|
||||||
|
; **** SYSTEM CALLS ****
|
||||||
|
; System calls provide access to low level functions (input from keyboard, output to screen etc).
|
||||||
|
; The name starts always with Sys_
|
||||||
|
|
||||||
|
; Prints string
|
||||||
|
; @param BC Pointer to a null-terminated string first character
|
||||||
|
org 0x0010
|
||||||
|
Sys_Print:
|
||||||
|
call Term_print
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Writes a single character
|
||||||
|
; @param A Value of character to print
|
||||||
|
org 0x0020
|
||||||
|
Sys_Printc:
|
||||||
|
call Term_printc
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Reads a single character
|
||||||
|
; @return A The read character
|
||||||
|
org 0x0030
|
||||||
|
Sys_Readc:
|
||||||
|
call Term_readc
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Reads a line
|
||||||
|
; @return BC The pointer to a null-terminated read string
|
||||||
|
org 0x0040
|
||||||
|
Sys_Readline:
|
||||||
|
call Term_readline
|
||||||
|
ret
|
||||||
|
|
||||||
|
; Emits system beep
|
||||||
|
org 0x0050
|
||||||
|
Sys_Beep:
|
||||||
|
call Snd_beep
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; MEMORY CONFIGURATION
|
; MEMORY CONFIGURATION
|
||||||
SYS_VAR_SPACE: EQU 0x8000
|
SYS_VAR_SPACE: EQU 0x8000
|
||||||
@ -49,37 +88,6 @@ include 'libs/time.asm'
|
|||||||
;include 'tests/sndtest.asm'
|
;include 'tests/sndtest.asm'
|
||||||
|
|
||||||
|
|
||||||
; **** SYSTEM CALLS ****
|
|
||||||
|
|
||||||
; Prints string
|
|
||||||
; @param BC Pointer to a null-terminated string first character
|
|
||||||
Print:
|
|
||||||
call Term_print
|
|
||||||
ret
|
|
||||||
|
|
||||||
; Writes a single character
|
|
||||||
; @param A Value of character to print
|
|
||||||
Printc:
|
|
||||||
call Term_printc
|
|
||||||
ret
|
|
||||||
|
|
||||||
; Reads a single character
|
|
||||||
; @return A The read character
|
|
||||||
Readc:
|
|
||||||
call Term_readc
|
|
||||||
ret
|
|
||||||
|
|
||||||
; Reads a line
|
|
||||||
; @return BC The pointer to a null-terminated read string
|
|
||||||
Readline:
|
|
||||||
call Term_readline
|
|
||||||
ret
|
|
||||||
|
|
||||||
; Emits system beep
|
|
||||||
Beep:
|
|
||||||
call Snd_beep
|
|
||||||
ret
|
|
||||||
|
|
||||||
; **** SYSTEM INITIALIZATION ****
|
; **** SYSTEM INITIALIZATION ****
|
||||||
Sysinit:
|
Sysinit:
|
||||||
; Init snd driver
|
; Init snd driver
|
||||||
@ -93,7 +101,7 @@ Sysinit:
|
|||||||
call Time_delay55
|
call Time_delay55
|
||||||
|
|
||||||
; Play startup sound
|
; Play startup sound
|
||||||
call Beep
|
call Sys_Beep
|
||||||
|
|
||||||
; Run memory monitor
|
; Run memory monitor
|
||||||
call Monitor_main
|
call Monitor_main
|
||||||
|
@ -32,18 +32,18 @@ MON_DUMP_BYTES_PER_LINE: EQU 8
|
|||||||
Monitor_main:
|
Monitor_main:
|
||||||
; Print welcome string
|
; Print welcome string
|
||||||
ld bc, MON_WELCOME
|
ld bc, MON_WELCOME
|
||||||
call Print
|
call Sys_Print
|
||||||
monitor_main_loop:
|
monitor_main_loop:
|
||||||
; Newline
|
; Newline
|
||||||
ld a, 10
|
ld a, 10
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; Draw prompt char
|
; Draw prompt char
|
||||||
ld a, 62 ; >
|
ld a, 62 ; >
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; Read char from command line
|
; Read char from command line
|
||||||
call Readc ; blocking: returns when a character was read and placed in A reg
|
call Sys_Readc ; blocking: returns when a character was read and placed in A reg
|
||||||
call Strings_charToUpper ; user may enter lowercase char: transform to upper
|
call Strings_charToUpper ; user may enter lowercase char: transform to upper
|
||||||
call Printc ; Print back the character to provide user feedback
|
call Sys_Printc ; Print back the character to provide user feedback
|
||||||
; Switch case
|
; Switch case
|
||||||
ld hl, MON_COMMAND_HELP
|
ld hl, MON_COMMAND_HELP
|
||||||
cp (hl) ; check incoming char is equal to command's first char
|
cp (hl) ; check incoming char is equal to command's first char
|
||||||
@ -68,27 +68,27 @@ Monitor_main:
|
|||||||
jp z, monitor_adb
|
jp z, monitor_adb
|
||||||
; Unrecognized command: print error and beep
|
; Unrecognized command: print error and beep
|
||||||
ld bc, MON_ERR_SYNTAX
|
ld bc, MON_ERR_SYNTAX
|
||||||
call Print
|
call Sys_Print
|
||||||
call Beep
|
call Sys_Beep
|
||||||
jp monitor_main_loop
|
jp monitor_main_loop
|
||||||
|
|
||||||
monitor_help:
|
monitor_help:
|
||||||
ld bc, MON_COMMAND_HELP + 1 ; autocomplete command
|
ld bc, MON_COMMAND_HELP + 1 ; autocomplete command
|
||||||
call Print
|
call Sys_Print
|
||||||
|
|
||||||
ld bc, MON_HELP
|
ld bc, MON_HELP
|
||||||
call Print
|
call Sys_Print
|
||||||
jp monitor_main_loop
|
jp monitor_main_loop
|
||||||
|
|
||||||
; Asks the user for a memory position and shows the following 64 bytes of memory
|
; Asks the user for a memory position and shows the following 64 bytes of memory
|
||||||
; @uses a, b, c, d, e, h, l
|
; @uses a, b, c, d, e, h, l
|
||||||
monitor_dump:
|
monitor_dump:
|
||||||
ld bc, MON_COMMAND_DUMP + 1 ; autocomplete command
|
ld bc, MON_COMMAND_DUMP + 1 ; autocomplete command
|
||||||
call Print
|
call Sys_Print
|
||||||
; Now read the address from the user
|
; Now read the address from the user
|
||||||
call monitor_arg_2byte ; returns the read bytes in hl
|
call monitor_arg_2byte ; returns the read bytes in hl
|
||||||
ld a, 10 ; newline
|
ld a, 10 ; newline
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; now start displaying bytes from memory
|
; now start displaying bytes from memory
|
||||||
ld e, MON_DUMP_BYTES_LINES ; the number of lines to display
|
ld e, MON_DUMP_BYTES_LINES ; the number of lines to display
|
||||||
monitor_dump_show_bytes_loop:
|
monitor_dump_show_bytes_loop:
|
||||||
@ -100,10 +100,10 @@ monitor_dump:
|
|||||||
call monitor_printHexByte
|
call monitor_printHexByte
|
||||||
; print four spaces
|
; print four spaces
|
||||||
ld a, 32
|
ld a, 32
|
||||||
call Printc
|
call Sys_Printc
|
||||||
call Printc
|
call Sys_Printc
|
||||||
call Printc
|
call Sys_Printc
|
||||||
call Printc
|
call Sys_Printc
|
||||||
monitor_dump_show_bytes_line_loop: ; counts down from 15 to 0
|
monitor_dump_show_bytes_line_loop: ; counts down from 15 to 0
|
||||||
ld a, d
|
ld a, d
|
||||||
sub MON_DUMP_BYTES_PER_LINE + 1
|
sub MON_DUMP_BYTES_PER_LINE + 1
|
||||||
@ -114,14 +114,14 @@ monitor_dump:
|
|||||||
call monitor_printHexByte
|
call monitor_printHexByte
|
||||||
; print space
|
; print space
|
||||||
ld a, 32
|
ld a, 32
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; if position is 4, print a second space (to group nibbles)
|
; if position is 4, print a second space (to group nibbles)
|
||||||
ld a, d
|
ld a, d
|
||||||
cp MON_DUMP_BYTES_PER_LINE / 2 + MON_DUMP_BYTES_PER_LINE + 1
|
cp MON_DUMP_BYTES_PER_LINE / 2 + MON_DUMP_BYTES_PER_LINE + 1
|
||||||
jp nz, no_second_space
|
jp nz, no_second_space
|
||||||
; print second space
|
; print second space
|
||||||
ld a, 32
|
ld a, 32
|
||||||
call Printc
|
call Sys_Printc
|
||||||
no_second_space:
|
no_second_space:
|
||||||
; move to next mem position
|
; move to next mem position
|
||||||
inc hl
|
inc hl
|
||||||
@ -139,23 +139,23 @@ monitor_dump:
|
|||||||
sbc hl, bc
|
sbc hl, bc
|
||||||
; print 3 spaces to separate hex from ascii
|
; print 3 spaces to separate hex from ascii
|
||||||
ld a, 32
|
ld a, 32
|
||||||
call Printc
|
call Sys_Printc
|
||||||
call Printc
|
call Sys_Printc
|
||||||
call Printc
|
call Sys_Printc
|
||||||
no_mempos_decr:
|
no_mempos_decr:
|
||||||
; print ascii
|
; print ascii
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
call monitor_printAsciiByte
|
call monitor_printAsciiByte
|
||||||
; print space
|
; print space
|
||||||
ld a, 32
|
ld a, 32
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; if position is 12 (8+4), print a second space (to group nibbles)
|
; if position is 12 (8+4), print a second space (to group nibbles)
|
||||||
ld a, d
|
ld a, d
|
||||||
cp MON_DUMP_BYTES_PER_LINE / 2 + 1
|
cp MON_DUMP_BYTES_PER_LINE / 2 + 1
|
||||||
jp nz, no_second_space2
|
jp nz, no_second_space2
|
||||||
; print second space
|
; print second space
|
||||||
ld a, 32
|
ld a, 32
|
||||||
call Printc
|
call Sys_Printc
|
||||||
no_second_space2:
|
no_second_space2:
|
||||||
; move to next mem position
|
; move to next mem position
|
||||||
inc hl
|
inc hl
|
||||||
@ -164,7 +164,7 @@ monitor_dump:
|
|||||||
jp nz, monitor_dump_show_bytes_line_loop
|
jp nz, monitor_dump_show_bytes_line_loop
|
||||||
; print newline
|
; print newline
|
||||||
ld a, 10
|
ld a, 10
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; decrement line counter
|
; decrement line counter
|
||||||
dec e
|
dec e
|
||||||
jp nz, monitor_dump_show_bytes_loop ; if line counter is not 0, print another line
|
jp nz, monitor_dump_show_bytes_loop ; if line counter is not 0, print another line
|
||||||
@ -175,13 +175,13 @@ monitor_dump:
|
|||||||
; @uses a, b, c, h, l
|
; @uses a, b, c, h, l
|
||||||
monitor_set:
|
monitor_set:
|
||||||
ld bc, MON_COMMAND_SET + 1 ; autocomplete command
|
ld bc, MON_COMMAND_SET + 1 ; autocomplete command
|
||||||
call Print
|
call Sys_Print
|
||||||
; Now read the memory address to be changed from the user
|
; Now read the memory address to be changed from the user
|
||||||
call monitor_arg_2byte ; returns the read bytes in hl
|
call monitor_arg_2byte ; returns the read bytes in hl
|
||||||
; Start looping memory addresses
|
; Start looping memory addresses
|
||||||
monitor_set_byte_loop:
|
monitor_set_byte_loop:
|
||||||
ld a, 10 ; newline
|
ld a, 10 ; newline
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; Print current address
|
; Print current address
|
||||||
ld a, h
|
ld a, h
|
||||||
call monitor_printHexByte
|
call monitor_printHexByte
|
||||||
@ -189,21 +189,21 @@ monitor_set:
|
|||||||
call monitor_printHexByte
|
call monitor_printHexByte
|
||||||
; print two spaces
|
; print two spaces
|
||||||
ld a, 32
|
ld a, 32
|
||||||
call Printc
|
call Sys_Printc
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; print previous memory content (hex)
|
; print previous memory content (hex)
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
call monitor_printHexByte
|
call monitor_printHexByte
|
||||||
; print two spaces
|
; print two spaces
|
||||||
ld a, 32
|
ld a, 32
|
||||||
call Printc
|
call Sys_Printc
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; print previous memory content (ascii)
|
; print previous memory content (ascii)
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
call monitor_printAsciiByte
|
call monitor_printAsciiByte
|
||||||
; print space
|
; print space
|
||||||
ld a, 32
|
ld a, 32
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; ask the user the new memory content
|
; ask the user the new memory content
|
||||||
call monitor_arg_byte ; returns the read byte in a, exit code in b
|
call monitor_arg_byte ; returns the read byte in a, exit code in b
|
||||||
; find if user pressed Q/ENTER
|
; find if user pressed Q/ENTER
|
||||||
@ -217,8 +217,8 @@ monitor_set:
|
|||||||
; user didn't press Q/ENTER: he inserted a valid byte
|
; user didn't press Q/ENTER: he inserted a valid byte
|
||||||
; print two spaces
|
; print two spaces
|
||||||
ld a, 32
|
ld a, 32
|
||||||
call Printc
|
call Sys_Printc
|
||||||
call Printc
|
call Sys_Printc
|
||||||
ld a, c ; restore valid byte in a
|
ld a, c ; restore valid byte in a
|
||||||
call monitor_printAsciiByte ; print user-inserted byte in ascii
|
call monitor_printAsciiByte ; print user-inserted byte in ascii
|
||||||
ld a, c ; restore valid byte in a
|
ld a, c ; restore valid byte in a
|
||||||
@ -231,7 +231,7 @@ monitor_set:
|
|||||||
; @uses a, b, c, h, l
|
; @uses a, b, c, h, l
|
||||||
monitor_zero: ; TODO: bugged, doesn't exit cycle
|
monitor_zero: ; TODO: bugged, doesn't exit cycle
|
||||||
ld bc, MON_COMMAND_ZERO + 1 ; autocomplete command
|
ld bc, MON_COMMAND_ZERO + 1 ; autocomplete command
|
||||||
call Print
|
call Sys_Print
|
||||||
; Now read the starting memory address
|
; Now read the starting memory address
|
||||||
call monitor_arg_2byte ; returns the read bytes in hl
|
call monitor_arg_2byte ; returns the read bytes in hl
|
||||||
; starting addr in bc
|
; starting addr in bc
|
||||||
@ -256,26 +256,26 @@ monitor_zero: ; TODO: bugged, doesn't exit cycle
|
|||||||
|
|
||||||
monitor_load:
|
monitor_load:
|
||||||
ld bc, MON_COMMAND_LOAD + 1 ; autocomplete command
|
ld bc, MON_COMMAND_LOAD + 1 ; autocomplete command
|
||||||
call Print
|
call Sys_Print
|
||||||
jp monitor_main_loop
|
jp monitor_main_loop
|
||||||
|
|
||||||
monitor_run:
|
monitor_run:
|
||||||
ld bc, MON_COMMAND_RUN + 1 ; autocomplete command
|
ld bc, MON_COMMAND_RUN + 1 ; autocomplete command
|
||||||
call Print
|
call Sys_Print
|
||||||
; Now read the memory address to be changed from the user
|
; Now read the memory address to be changed from the user
|
||||||
call monitor_arg_2byte ; returns the read bytes in hl
|
call monitor_arg_2byte ; returns the read bytes in hl
|
||||||
ld a, 10 ; newline
|
ld a, 10 ; newline
|
||||||
call Printc
|
call Sys_Printc
|
||||||
jp (hl) ; Start executing code
|
jp (hl) ; Start executing code
|
||||||
|
|
||||||
monitor_adb:
|
monitor_adb:
|
||||||
ld bc, MON_COMMAND_ADB + 1 ; autocomplete command
|
ld bc, MON_COMMAND_ADB + 1 ; autocomplete command
|
||||||
call Print
|
call Sys_Print
|
||||||
; start copying incoming data to application space
|
; start copying incoming data to application space
|
||||||
call monitor_copyTermToAppMem
|
call monitor_copyTermToAppMem
|
||||||
;jp APP_SPACE ; Start executing code
|
;jp APP_SPACE ; Start executing code
|
||||||
ld bc, APP_SPACE
|
ld bc, APP_SPACE
|
||||||
call Print
|
call Sys_Print
|
||||||
jp monitor_main_loop
|
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)
|
||||||
@ -285,7 +285,7 @@ monitor_adb:
|
|||||||
monitor_arg_byte:
|
monitor_arg_byte:
|
||||||
; Print 0x... prompt
|
; Print 0x... prompt
|
||||||
ld bc, MON_ARG_HEX
|
ld bc, MON_ARG_HEX
|
||||||
call Print
|
call Sys_Print
|
||||||
; Read 2 digits
|
; Read 2 digits
|
||||||
call monitor_arg_byte_impl
|
call monitor_arg_byte_impl
|
||||||
ret
|
ret
|
||||||
@ -297,7 +297,7 @@ monitor_arg_byte:
|
|||||||
monitor_arg_2byte:
|
monitor_arg_2byte:
|
||||||
; Print 0x... prompt
|
; Print 0x... prompt
|
||||||
ld bc, MON_ARG_HEX
|
ld bc, MON_ARG_HEX
|
||||||
call Print
|
call Sys_Print
|
||||||
; Read 2 digits
|
; Read 2 digits
|
||||||
call monitor_arg_byte_impl
|
call monitor_arg_byte_impl
|
||||||
ld h, a ; move result to h
|
ld h, a ; move result to h
|
||||||
@ -348,7 +348,7 @@ monitor_arg_byte_impl:
|
|||||||
; (0 if no control key was, pressed, 1 for Q, 2 for RETURN)
|
; (0 if no control key was, pressed, 1 for Q, 2 for RETURN)
|
||||||
; @uses a, b
|
; @uses a, b
|
||||||
monitor_readHexDigit:
|
monitor_readHexDigit:
|
||||||
call Readc
|
call Sys_Readc
|
||||||
; check if user pressed Q
|
; check if user pressed Q
|
||||||
; if user pressed Q, return exit code 1 in b and 0 in a
|
; if user pressed Q, return exit code 1 in b and 0 in a
|
||||||
cp 81
|
cp 81
|
||||||
@ -372,7 +372,7 @@ monitor_readHexDigit:
|
|||||||
jp p, monitor_readHexDigit_char ; if not negative (ns), maybe is a char
|
jp p, monitor_readHexDigit_char ; if not negative (ns), maybe is a char
|
||||||
; otherwise is a number! First print for visive feedback
|
; otherwise is a number! First print for visive feedback
|
||||||
ld a, b
|
ld a, b
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; then convert to its value subtracting 48
|
; then convert to its value subtracting 48
|
||||||
sub a, 48
|
sub a, 48
|
||||||
ld b, 0 ; set b to exit code 0 to represent "valid value in a"
|
ld b, 0 ; set b to exit code 0 to represent "valid value in a"
|
||||||
@ -384,7 +384,7 @@ monitor_readHexDigit:
|
|||||||
jp m, monitor_readHexDigit ; if negative (s), ascii code is under 65: ignore char
|
jp m, monitor_readHexDigit ; if negative (s), ascii code is under 65: ignore char
|
||||||
; otherwise is a valid char (A-F). Print for visive feedback
|
; otherwise is a valid char (A-F). Print for visive feedback
|
||||||
ld a, b
|
ld a, b
|
||||||
call Printc
|
call Sys_Printc
|
||||||
; Its numeric value is 10 (A) to 15 (F). To obtain this, subtract 55.
|
; Its numeric value is 10 (A) to 15 (F). To obtain this, subtract 55.
|
||||||
sub a, 55
|
sub a, 55
|
||||||
ld b, 0 ; set b to exit code 0 to represent "valid value in a"
|
ld b, 0 ; set b to exit code 0 to represent "valid value in a"
|
||||||
@ -407,10 +407,10 @@ monitor_printHexByte:
|
|||||||
ld c, a
|
ld c, a
|
||||||
; rotate out the least significant nibble to obtain a byte with the most significant nibble
|
; rotate out the least significant nibble to obtain a byte with the most significant nibble
|
||||||
; in the least significant nibble position
|
; in the least significant nibble position
|
||||||
rrca a
|
rrca
|
||||||
rrca a
|
rrca
|
||||||
rrca a
|
rrca
|
||||||
rrca a
|
rrca
|
||||||
; the upper nibble must now be discarded
|
; the upper nibble must now be discarded
|
||||||
and %00001111
|
and %00001111
|
||||||
call monitor_printHexDigit
|
call monitor_printHexDigit
|
||||||
@ -436,14 +436,14 @@ monitor_printHexDigit:
|
|||||||
ld a, b ; restore a
|
ld a, b ; restore a
|
||||||
; add 48 (the ASCII number for 0) to obtain the corresponding number
|
; add 48 (the ASCII number for 0) to obtain the corresponding number
|
||||||
add 48
|
add 48
|
||||||
call Printc
|
call Sys_Printc
|
||||||
ret
|
ret
|
||||||
monitor_printHexDigit_letter:
|
monitor_printHexDigit_letter:
|
||||||
ld a, b ; restore a
|
ld a, b ; restore a
|
||||||
; to obtain the corresponding letter we should subtract 10 (so we count from A)
|
; to obtain the corresponding letter we should subtract 10 (so we count from A)
|
||||||
; and add 65 (the ASCII number for A). So -10+65=+55 we add only 55.
|
; and add 65 (the ASCII number for A). So -10+65=+55 we add only 55.
|
||||||
add 55
|
add 55
|
||||||
call Printc
|
call Sys_Printc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Prints an ASCII character. Similar to system Print function, but
|
; Prints an ASCII character. Similar to system Print function, but
|
||||||
@ -462,11 +462,11 @@ monitor_printAsciiByte:
|
|||||||
jp p, monitor_printAsciiByte_nonprintable
|
jp p, monitor_printAsciiByte_nonprintable
|
||||||
; otherwise is a printable ascii char
|
; otherwise is a printable ascii char
|
||||||
ld a, b ; restore a
|
ld a, b ; restore a
|
||||||
call Printc
|
call Sys_Printc
|
||||||
ret
|
ret
|
||||||
monitor_printAsciiByte_nonprintable:
|
monitor_printAsciiByte_nonprintable:
|
||||||
ld a, 46 ; print dot
|
ld a, 46 ; print dot
|
||||||
call Printc
|
call Sys_Printc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Copy data from STDIN to application memory. This is tought to be used with parallel terminal, not keyboard:
|
; Copy data from STDIN to application memory. This is tought to be used with parallel terminal, not keyboard:
|
||||||
@ -476,7 +476,7 @@ monitor_copyTermToAppMem:
|
|||||||
ld b, 255; MON_ADB_TIMEOUT ; the timeout counter (number cycles without available data that represent the end of stream)
|
ld b, 255; MON_ADB_TIMEOUT ; the timeout counter (number cycles without available data that represent the end of stream)
|
||||||
monitor_copyTermToAppMem_loop:
|
monitor_copyTermToAppMem_loop:
|
||||||
dec b ; decrement the timeout counter
|
dec b ; decrement the timeout counter
|
||||||
ret 0 ; if counter is 0, timeout reached: return
|
ret z ; if counter is 0, timeout reached: return
|
||||||
; check if bytes are available
|
; check if bytes are available
|
||||||
call Term_availb
|
call Term_availb
|
||||||
cp 0
|
cp 0
|
||||||
|
5
assembly/bios/rom.label
Normal file
5
assembly/bios/rom.label
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Sys_Beep: equ $0050
|
||||||
|
Sys_Print: equ $0010
|
||||||
|
Sys_Printc: equ $0020
|
||||||
|
Sys_Readc: equ $0030
|
||||||
|
Sys_Readline: equ $0040
|
Loading…
x
Reference in New Issue
Block a user