start of linked list windows rendering

This commit is contained in:
Sarah Jamie Lewis 2021-11-14 21:29:42 -08:00
parent 78f1b17358
commit 85c4715a52
3 changed files with 71 additions and 26 deletions

View File

@ -361,29 +361,46 @@ label handle_keypress:
bappend $4 command_line_input
ret
label window_1:
label kernel_windows_start:
nop
label kernel_windows_end:
nop
label window_2:
nop
label kernel_windows:
; 4 contains the data we want to store
label make_node:
tx $C $4 ; temp store 4
loadi $4 2 ; each node is 2 words
call FFFFF0 ; Allocate space
; 4 now contains a ptr to new space
rstore $C $4
ret
; $4 contains the ptr to the new node
; $5 contains the ptr to the end node
label append_node:
inc $5
rstore $4 $5 ; store the pointer to the new node $4 in the next ptr in $5
store $4 kernel_windows_end ; bump the end pointer
ret
label _temp_window_list_ptr
nop
; Kernel Begins
@ $CB000:
loadi $4 2
call FFFFF0 ; Allocate First Linked List
store $4 kernel_windows
; Create a Test Window
loadi $4 $30
loadi $5 $30
loadi $6 $A0
loadi $7 $A0
loadi $8 TestWindow
call make_window
store $4 window_1
call make_node ; with the data in 4
store $4 kernel_windows_start
store $4 kernel_windows_end
loadi $4 $55
loadi $5 $70
@ -391,7 +408,23 @@ label kernel_windows:
loadi $7 $A0
loadi $8 TestWindow2
call make_window
store $4 window_2
call make_node ; with the data in 4
loadi $5 kernel_windows_end
rload $5 $5
call append_node
loadi $4 $140
loadi $5 $140
loadi $6 $F0
loadi $7 $50
loadi $8 TestWindow2
call make_window
call make_node ; with the data in 4
loadi $5 kernel_windows_end
rload $5 $5
call append_node
;tore $4 kernel_windows_end ; bump the end pointer
label kernel_loop:
loadi $9 $0; 640-64
@ -407,13 +440,25 @@ label kernel_windows:
loadi $8 $222222
call draw_filled_rect
loadi $4 window_1
rload $4 $4
call draw_window
loadi $4 window_2
rload $4 $4
call draw_window
; Render All The Windows...
load $4 kernel_windows_start
label draw_next_window:
store $4 _temp_window_list_ptr ; temp store
rload $4 $4
call draw_window ; draw this window
load $4 _temp_window_list_ptr ; load window pointer from temp
inc $4 ; increment the pointer
rload $4 $4
tx $1 $4
loadi $2 $0
jeq +2
jmp draw_next_window
;loadi $4 window_2
;rload $4 $4
;call draw_window
loadi $9 $5;
loadi $A $5;
@ -517,6 +562,5 @@ label kernel_windows:
add $1 $4 $1
store $1 _allocator_ptr
loadi $2 $FFFFF0
sub $2 $1 $2
sub $2 $4 $4
sub $2 $1 $4
ret

View File

@ -150,10 +150,13 @@ impl Machine {
self.memory[REGISTER_PAGE + input_reg] -= 1;
}
0x06 => {
// STORE Mem[R(In)] = R(X)
let input_reg = ((instruction) >> 24 & 0x0F) as usize;
let reg = (instruction & 0x000000FF) as usize;
let addr = self.memory[REGISTER_PAGE + reg] as usize;
// STORE Mem[R(Addr)] = R(In)
let reg = (instruction & 0x000000FF) as usize;// 4
let addr = self.memory[REGISTER_PAGE + reg] as usize; // R(
let input_reg = ((instruction) >> 24 & 0x0F) as usize; // C4)
// Mem(4) = R(C)
self.memory[addr] = self.memory[REGISTER_PAGE + input_reg];
}
0x07 => {

View File

@ -4,7 +4,7 @@ label make_window
tx $D $5
loadi $4 6
call $FFFFF0 ; allocate 6 bytes on the heap
tx $E $4
rstore $D $4
inc $4
rstore $5 $4
@ -18,8 +18,7 @@ label make_window
inc $4
rstore $8 $4
loadi $1 6
sub $4 $1 $4
tx $4 $E
ret
; 4 contains the address of the window
@ -31,7 +30,6 @@ label _draw_window
nop
label draw_window:
tx $C $4
inc $C
rload $C $4
store $4 _draw_window
inc $C