Move ASCII consts to ascii.h
And made them shorter in name. The new ascii.h file allow reuse in userspace code.
This commit is contained in:
parent
7046d23cd6
commit
7274dccbe7
@ -68,6 +68,7 @@
|
|||||||
; ******
|
; ******
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.org USER_CODE
|
.org USER_CODE
|
||||||
|
|
||||||
jp zasmMain
|
jp zasmMain
|
||||||
|
@ -22,14 +22,14 @@ isLineEndOrComment:
|
|||||||
isLineEnd:
|
isLineEnd:
|
||||||
or a ; same as cp 0
|
or a ; same as cp 0
|
||||||
ret z
|
ret z
|
||||||
cp 0x0d
|
cp CR
|
||||||
ret z
|
ret z
|
||||||
cp 0x0a
|
cp LF
|
||||||
ret z
|
ret z
|
||||||
cp '\'
|
cp '\'
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Sets Z is A is ' ' '\t' or ','
|
; Sets Z is A is ' ' '\t'
|
||||||
isSep:
|
isSep:
|
||||||
cp ' '
|
cp ' '
|
||||||
ret z
|
ret z
|
||||||
|
@ -19,6 +19,7 @@ look like:
|
|||||||
jp aciaInt
|
jp aciaInt
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
.equ ACIA_RAMSTART RAMSTART
|
.equ ACIA_RAMSTART RAMSTART
|
||||||
|
4
kernel/ascii.h
Normal file
4
kernel/ascii.h
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.equ BS 0x08
|
||||||
|
.equ CR 0x0d
|
||||||
|
.equ LF 0x0a
|
||||||
|
.equ DEL 0x7f
|
@ -3,16 +3,6 @@
|
|||||||
; Routines used by pretty much all parts. You will want to include it first
|
; Routines used by pretty much all parts. You will want to include it first
|
||||||
; in your glue file.
|
; in your glue file.
|
||||||
|
|
||||||
; *** CONSTS ***
|
|
||||||
.equ ASCII_BS 0x08
|
|
||||||
.equ ASCII_CR 0x0d
|
|
||||||
.equ ASCII_LF 0x0a
|
|
||||||
.equ ASCII_DEL 0x7f
|
|
||||||
|
|
||||||
; *** DATA ***
|
|
||||||
; Useful data to point to, when a pointer is needed.
|
|
||||||
P_NULL: .db 0
|
|
||||||
|
|
||||||
; *** REGISTER FIDDLING ***
|
; *** REGISTER FIDDLING ***
|
||||||
|
|
||||||
; add the value of A into DE
|
; add the value of A into DE
|
||||||
|
@ -66,7 +66,7 @@ shellInit:
|
|||||||
jp printstr
|
jp printstr
|
||||||
|
|
||||||
.welcome:
|
.welcome:
|
||||||
.db "Collapse OS", ASCII_CR, ASCII_LF, "> ", 0
|
.db "Collapse OS", CR, LF, "> ", 0
|
||||||
|
|
||||||
; Inifite loop that processes input. Because it's infinite, you should jump
|
; Inifite loop that processes input. Because it's infinite, you should jump
|
||||||
; to it rather than call it. Saves two precious bytes in the stack.
|
; to it rather than call it. Saves two precious bytes in the stack.
|
||||||
|
@ -185,7 +185,7 @@ padGetC:
|
|||||||
call vdpSpitC
|
call vdpSpitC
|
||||||
jp padGetC
|
jp padGetC
|
||||||
.return:
|
.return:
|
||||||
ld a, ASCII_LF
|
ld a, LF
|
||||||
ld (PAD_NEXTCHR), a
|
ld (PAD_NEXTCHR), a
|
||||||
; continue to .advance
|
; continue to .advance
|
||||||
.advance:
|
.advance:
|
||||||
@ -193,7 +193,7 @@ padGetC:
|
|||||||
; Z was already set from previous BIT instruction
|
; Z was already set from previous BIT instruction
|
||||||
ret
|
ret
|
||||||
.backspace:
|
.backspace:
|
||||||
ld a, ASCII_BS
|
ld a, BS
|
||||||
; Z was already set from previous BIT instruction
|
; Z was already set from previous BIT instruction
|
||||||
ret
|
ret
|
||||||
.nextchr:
|
.nextchr:
|
||||||
|
@ -119,11 +119,11 @@ vdpPutC:
|
|||||||
; 6 low bits contain our row*2 (each tile is 2 bytes wide) and high
|
; 6 low bits contain our row*2 (each tile is 2 bytes wide) and high
|
||||||
; 2 bits are the two low bits of our line
|
; 2 bits are the two low bits of our line
|
||||||
; special case: line feed, carriage return, back space
|
; special case: line feed, carriage return, back space
|
||||||
cp ASCII_LF
|
cp LF
|
||||||
jr z, vdpLF
|
jr z, vdpLF
|
||||||
cp ASCII_CR
|
cp CR
|
||||||
jr z, vdpCR
|
jr z, vdpCR
|
||||||
cp ASCII_BS
|
cp BS
|
||||||
jr z, vdpBS
|
jr z, vdpBS
|
||||||
|
|
||||||
push af
|
push af
|
||||||
|
@ -81,9 +81,9 @@ printnstr:
|
|||||||
|
|
||||||
printcrlf:
|
printcrlf:
|
||||||
push af
|
push af
|
||||||
ld a, ASCII_CR
|
ld a, CR
|
||||||
call STDIO_PUTC
|
call STDIO_PUTC
|
||||||
ld a, ASCII_LF
|
ld a, LF
|
||||||
call STDIO_PUTC
|
call STDIO_PUTC
|
||||||
pop af
|
pop af
|
||||||
ret
|
ret
|
||||||
@ -124,13 +124,13 @@ stdioReadLine:
|
|||||||
; Let's wait until something is typed.
|
; Let's wait until something is typed.
|
||||||
call STDIO_GETC
|
call STDIO_GETC
|
||||||
; got it. Now, is it a CR or LF?
|
; got it. Now, is it a CR or LF?
|
||||||
cp ASCII_CR
|
cp CR
|
||||||
jr z, .complete ; char is CR? buffer complete!
|
jr z, .complete ; char is CR? buffer complete!
|
||||||
cp ASCII_LF
|
cp LF
|
||||||
jr z, .complete
|
jr z, .complete
|
||||||
cp ASCII_DEL
|
cp DEL
|
||||||
jr z, .delchr
|
jr z, .delchr
|
||||||
cp ASCII_BS
|
cp BS
|
||||||
jr z, .delchr
|
jr z, .delchr
|
||||||
|
|
||||||
; Echo the received character right away so that we see what we type
|
; Echo the received character right away so that we see what we type
|
||||||
@ -161,10 +161,10 @@ stdioReadLine:
|
|||||||
inc b
|
inc b
|
||||||
; Char deleted in buffer, now send BS + space + BS for the terminal
|
; Char deleted in buffer, now send BS + space + BS for the terminal
|
||||||
; to clear its previous char
|
; to clear its previous char
|
||||||
ld a, ASCII_BS
|
ld a, BS
|
||||||
call STDIO_PUTC
|
call STDIO_PUTC
|
||||||
ld a, ' '
|
ld a, ' '
|
||||||
call STDIO_PUTC
|
call STDIO_PUTC
|
||||||
ld a, ASCII_BS
|
ld a, BS
|
||||||
call STDIO_PUTC
|
call STDIO_PUTC
|
||||||
jr .loop
|
jr .loop
|
||||||
|
@ -329,9 +329,9 @@ lcdClrScr:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
lcdPutC:
|
lcdPutC:
|
||||||
cp ASCII_LF
|
cp LF
|
||||||
jp z, lcdLinefeed
|
jp z, lcdLinefeed
|
||||||
cp ASCII_BS
|
cp BS
|
||||||
jr z, .bs
|
jr z, .bs
|
||||||
push hl
|
push hl
|
||||||
call fntGet
|
call fntGet
|
||||||
|
@ -12,6 +12,7 @@ jp init
|
|||||||
jp aciaInt
|
jp aciaInt
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
.equ ACIA_RAMSTART RAMSTART
|
.equ ACIA_RAMSTART RAMSTART
|
||||||
|
@ -12,6 +12,7 @@ jp init
|
|||||||
jp aciaInt
|
jp aciaInt
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
.equ ACIA_RAMSTART RAMSTART
|
.equ ACIA_RAMSTART RAMSTART
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
jp init
|
jp init
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
.equ ACIA_RAMSTART RAMSTART
|
.equ ACIA_RAMSTART RAMSTART
|
||||||
|
@ -21,6 +21,7 @@ jp sdcSendRecv
|
|||||||
jp aciaInt
|
jp aciaInt
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
.equ ACIA_RAMSTART RAMSTART
|
.equ ACIA_RAMSTART RAMSTART
|
||||||
|
@ -47,6 +47,7 @@ jp aciaInt
|
|||||||
jp blkGetB
|
jp blkGetB
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
.equ ACIA_RAMSTART RAMSTART
|
.equ ACIA_RAMSTART RAMSTART
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
retn
|
retn
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
retn
|
retn
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
retn
|
retn
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
.fill 0x64-$
|
.fill 0x64-$
|
||||||
|
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.equ FNT_WIDTH 3
|
.equ FNT_WIDTH 3
|
||||||
.equ FNT_HEIGHT 5
|
.equ FNT_HEIGHT 5
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
|
|
||||||
.equ BLOCKDEV_RAMSTART RAMSTART
|
.equ BLOCKDEV_RAMSTART RAMSTART
|
||||||
|
@ -33,6 +33,7 @@ jp printstr
|
|||||||
|
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
.inc "err.h"
|
.inc "err.h"
|
||||||
|
.inc "ascii.h"
|
||||||
.inc "parse.asm"
|
.inc "parse.asm"
|
||||||
.equ BLOCKDEV_RAMSTART RAMSTART
|
.equ BLOCKDEV_RAMSTART RAMSTART
|
||||||
.equ BLOCKDEV_COUNT 3
|
.equ BLOCKDEV_COUNT 3
|
||||||
|
Loading…
Reference in New Issue
Block a user