35 lines
1.1 KiB
NASM
35 lines
1.1 KiB
NASM
; Initialize text mode
|
|
|
|
|
|
main:
|
|
ldw a, 0 ; Mode: 1 for text mode
|
|
ldw b, 800 ; Horizontal resolution
|
|
ldw c, 600 ; Vertical resolution
|
|
int 0x70 ; Initialize display
|
|
jsr test
|
|
ldw b, 0 ; Cursor position (character cell index)
|
|
ldw c, 0xFFFFFF ; White color
|
|
|
|
|
|
main_loop:
|
|
; Get key down (handle key press/release)
|
|
mov f, b ; f <- b
|
|
int 0xF6 ; a <- keycode | b <- first press
|
|
add b, f, ; b = f + b ; This moves the value in f back to B, and sence b is eyther 1 or 0, it will eyther increment it, or not increment it.
|
|
|
|
str b, 0xEE
|
|
str a, 0xEF
|
|
|
|
|
|
|
|
; If a key is not pressed (register 0x1 == 0), continue the loop
|
|
ldw d, 0 ; Check if a key is pressed (if register 0x1 == 1)
|
|
beq a, d, main_loop ; If A == 0, loop back to main_loop (no key is pressed)
|
|
|
|
; Render the character
|
|
int 0x72 ; Render the character (using the keycode from register 0x0 at position b)
|
|
jmp main_loop ; Jump back to the main loop
|
|
|
|
|
|
|
|
%include "std.asm" |