Compare commits

..

2 Commits

Author SHA1 Message Date
0f7ab3941f
Print error message in pop_frame when the frame stack is empty 2023-03-28 12:27:03 -05:00
2a0ebb88df
Add terminal card driver 2023-03-28 12:26:39 -05:00
3 changed files with 39 additions and 0 deletions

View File

@ -1,6 +1,7 @@
.global main .global main
main: main:
move.l #inital_stack, a7 | Load the initial stack pointer move.l #inital_stack, a7 | Load the initial stack pointer
jsr term_init
jsr pmem_init jsr pmem_init
move.l #0x1000, d0 move.l #0x1000, d0
jsr push_page jsr push_page

View File

@ -42,8 +42,13 @@ move.l mmu_tlb_clear_addr, a0 | Clear the TLB entry for the mapping page
move.l #map_page, (a0) move.l #map_page, (a0)
rts rts
pop_no_page: pop_no_page:
move.l #oom_error_str, a0
jsr term_println
stop #2700 stop #2700
.data
oom_error_str: .asciz "Out of physical memory"
.bss .bss
mmu_tlb_clear_addr: mmu_tlb_clear_addr:
.ds.b 4 .ds.b 4

33
kernel/term.68k Normal file
View File

@ -0,0 +1,33 @@
.global term_init
term_init:
move.b #0x3, d0 | Get the pointer to the terminal card
jsr find_first_card
move.l a0, term_io_base
rts
| Prints the string pointed to by a0
| Clobbers d0, a1
.global term_print
term_print:
move.l term_io_base, a1
term_print_loop:
move.b (a0)+, d0
cmpi.b #0, d0
beq.b term_print_done
move.b d0, (a1)
bra.b term_print
term_print_done:
rts
| Prints the string pointed to by a0 followed by a newline
| Clobbers d0, a1
.global term_println
term_println:
bsr.b term_print
move.b #'\n, (a1)
rts
.bss
term_io_base:
.ds.b 4