~vdupras/duskos

327897cc756deb49c32d4cd2cffd07ee2f69dcd2 — Virgil Dupras 6 days ago 520657b
rpi: add "key" routine
1 files changed, 13 insertions(+), 14 deletions(-)

M fs/xcomp/arm/rpi/kernel.fs
M fs/xcomp/arm/rpi/kernel.fs => fs/xcomp/arm/rpi/kernel.fs +13 -14
@@ 7,42 7,37 @@ $94 const GPPUD
$98 const GPPUDCLK0
$1000 const UART0_BASE
$00 const UART0_DR
$04 const UART0_RSRECR
$18 const UART0_FR
$20 const UART0_ILPR
$24 const UART0_IBRD
$28 const UART0_FBRD
$2c const UART0_LCRH
$30 const UART0_CR
$34 const UART0_IFLS
$38 const UART0_IMSC
$3c const UART0_RIS
$40 const UART0_MIS
$44 const UART0_ICR
$48 const UART0_DMACR
$80 const UART0_ITCR
$84 const UART0_ITIP
$88 const UART0_ITOP
$8c const UART0_TDR

: delay, ( ncycles -- )
  mov) r0 rd) swap ( ncycles ) i) ,)
  pc sub) r0 rd) r0 rn) 1 i) f) ,) ( pc ) abs>rel b) ne) ,) ;

: values ( n -- ) for 0 value next ;
2 values lblemit lblmsg
3 values lblemit lblkey lblmsg

$8000 to binstart
0 align4 here to org
forward b) ,)
pc to lblmsg ," Hello World!\0" 0 align4
pc to lblemit \ r0=char
  pc
    ldr) r1 rd) r7 rn) UART0_FR +i) ,)
    tst) r1 rn) $20 i) f) ,)
    abs>rel b) ne) ,)
    lblemit abs>rel b) ne) ,)
  str) r0 rd) r7 rn) UART0_DR +i) ,)
  mov) rPC rd) rLR rm) ,)
pc to lblkey \ r0=char
    ldr) r1 rd) r7 rn) UART0_FR +i) ,)
    tst) r1 rn) $10 i) f) ,)
    lblkey abs>rel b) ne) ,)
  ldr) r0 rd) r7 rn) UART0_DR +i) 8b) ,)
  mov) rPC rd) rLR rm) ,)
forward!
mov) rSP rd) binstart i) ,)
mov) r9 rd) MMIO_BASE i) ,) \ r9 = MMIO_BASE


@@ 88,4 83,8 @@ pc
  ldr) r0 rd) r6 rn) 8b) 1 +i) post) ,)
  teq) r0 rn) 0 i) f) ,)
  abs>rel b) ne) ,)
0 b) ,)

pc
  lblkey abs>rel bl) ,)
  lblemit abs>rel bl) ,)
  abs>rel b) ,)