aboutsummaryrefslogtreecommitdiffstats
path: root/asm/text_mode.atk16
blob: 9a57954704e35c02763b6714667d2a550e4ead49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
@opt stack_pointer RF
@opt csr_scratch RH
@use ext_std:*
@use ext_string_io:*

; bootstrap code (must be called to set up mandatory data)
; will jump to label main
@include bootstrap

@label main
  cursor_to_line RC 1
  put_string RC RB " HELLO CORECAMP"
  new_line RC
  put_string RC RB " »»»»»»» BY JAN"
  new_line RC
  new_line RC
  put_string RC RB " > "

  set_graphics_mode gr_text_mode

@label loop
  jpi loop

@label keyboard_isr
  stack_stash RA RB
  ldi vt_kb_pp_addr RA    ; RA := Keyboard peripheral address pointer
  ldr RA RA               ; RA := Keyboard peripheral address deref
  ldr RA RA               ; RA := <16-bit keyboard character code> from MMIO register
  ldi vt_term_pp_addr RB  ; RB := Terminal peripheral address pointer
  ldr RB RB               ; RB := Terminal peripheral address deref

  mov RA RD
  subi RD 5 RD
  subi RD 5 RD
  bri zero keyboard_isr_clear
  mov RA RD
  subi RD 5 RD
  subi RD 3 RD
  bri zero keyboard_isr_backspace
  str RA RC
  addi RC 1 RC
  jpi keyboard_isr_end
@label keyboard_isr_clear
  new_line RC
  put_string RC RB " > "
  addi RC 1 RC
@label keyboard_isr_backspace
  subi RC 1 RC
  put_char RC RB " "
  subi RC 1 RC
@label keyboard_isr_end
  stack_restore RA RB
  rti