x/restructure

This commit is contained in:
Kitty-Cricket Piapiac 2023-03-29 12:48:55 -07:00
parent c70e59bf41
commit 18eac84dec
11 changed files with 50 additions and 76 deletions

View File

@ -1,5 +1,5 @@
-inc "x/dev.inc"
-org #100
-inc "x/inc/dev.kmm"
-org #0100
:entry
pw #00000000 `disp:pal io

View File

@ -1,27 +0,0 @@
-inc "x/dev.inc"
!+1 pb #01 ad ;
!re ~ju ;
-org #0100
:entry
pw #00100010 pw @data/s0/hello pw @g/puts ca
pw #00100020 pw @data/s0/tqbfj pw @g/puts ca
pw #00100030 pw @data/s0/symbs pw @g/puts ca
ex
;
:g
:putc {xy c--} pw @data/font/Corsivo sw pb #08 mu ad `disp:blt io `disp:pos io ph #ff31 `disp:out io `re ;
:puts {xy *s--} sw pw @x mw pw @f pw @s0/for ca `re
:f {c--} pw @x sw ov fw sw pw @putc ca du fh pb #08 ad sw mh `re ;
:x #00000000 ; ;
;
:s0
:for {*s *f--} ss :loop du fb du no pw @end jc ~du ~ss ca `+1 pw @loop ju ; :end dr dr ~dr ; `re ;
;
:data
:s0
:hello "hello, world!" #00 ;
:tqbfj "the quick brown fox jumps over the lazy dog." #00 ;
:symbs "~!@#$%^&*()-+=_" #01020304 #05060708 #090a0b0c #0d0e0f10 #11121314 #15161718 #191a1b1c #1d1e1f00 ;
;
:font -inc "x/corsivo.inc" ;
;

View File

@ -1,17 +1,20 @@
-inc "x/dev.inc"
!+1 pb #01 ad ;
!nl #0a ;
-inc "x/inc/dev.kmm"
-inc "x/inc/a.kmm"
-org #0100
:entry
pw @data/hello-meow pw @s0/put ca
pw @data/hello-world pw @s0/put ca
pw #00100010 pw @data/hello-world pw @g/puts ca
pw #00100020 pw @data/symbs-ascii pw @g/puts ca
pw #00100030 pw @data/symbs-other pw @g/puts ca
ex
;
:s0
:put du fb du no pw @end jc `term:0 io `+1 pw @put ju :end dr dr ~ju ; ;
;
:s0 -inc "x/lib/s0.kmm" ;
:g -inc "x/lib/graphics.kmm" ;
:data
:hello-meow "hello meow :3c" `nl #00 ;
:hello-world "hello, world!!" `nl #00 ;
:hello-world "hello, world!!" #00 ;
:symbs-ascii "`~!@#$%^&*()-+_={}[];:',<.>/?" #00 ;
:symbs-other #01020304 #05060708 #090a0b0c #0d0e0f10
#11121314 #15161719 #191a1b1c #1d1e1f00 ;
;

4
x/inc/a.kmm Normal file
View File

@ -0,0 +1,4 @@
{utils < 4 bytes}
!+1 pb #01 ad ;
!-1 pb #01 su ;
!nl #0a ;

View File

@ -1,8 +1,5 @@
-inc "x/dev.inc"
!+1 pb #1 ad ;
!nl #0a ;
!ret ~ju ;
-inc "x/inc/dev.kmm"
-inc "x/inc/a.kmm"
-org #100
:entry
pw @ivt/keeb-down `keeb:down mw
@ -10,27 +7,18 @@
ex
;
:ivt
:keeb-down
pw @data/keeb-down pw @s0/put ca
`keeb ii pw @key/put ca
pb `nl `term:0 io
`ret
;
:keeb-up
pw @data/keeb-up pw @s0/put ca
`keeb ii pw @key/put ca
pb `nl `term:0 io
`ret
;
:keeb-down pw @data/s0/keeb-down pw @t/puts ca `keeb ii pw @key/put ca pb `nl `term:0 io ~ju ;
:keeb-up pw @data/s0/keeb-up pw @t/puts ca `keeb ii pw @key/put ca pb `nl `term:0 io ~ju ;
;
:key
:ascii? du pb #80 lt sw pb #1f gt an `ret ;
:put du pw @ascii? ca pw @ascii jc dr `ret :ascii `term:0 io ; `ret ;
;
:s0
:put du fb du no pw @end jc `term:0 io `+1 pw @put ju :end dr dr ; `ret ;
:ascii? du pb #80 lt sw pb #1f gt an ~ju ;
:put du pw @ascii? ca pw @ascii jc dr ~ju :ascii `term:0 io ; ~ju ;
;
:s0 -inc "x/lib/s0.kmm" ;
:t -inc "x/lib/term.kmm" ;
:data
:keeb-down "keyboard down: " #00 ;
:keeb-up "keyboard up: " #00 ;
:s0
:keeb-down "keyboard down: " #00 ;
:keeb-up "keyboard up: " #00 ;
;
;

7
x/lib/graphics.kmm Normal file
View File

@ -0,0 +1,7 @@
:putc {xy c--} pw @data/font/Corsivo sw pb #08 mu ad `disp:blt io `disp:pos io ph #ff31 `disp:out io ~ju ;
:puts {xy *s--} sw pw @x mw pw @f pw @s0/for ca ~ju
:f {c--} pw @x sw ov fw sw pw @putc ca du fh pb #08 ad sw mh ~ju ;
:x #00000000 ; ;
:data :font -inc "x/inc/corsivo.kmm" ; ;

1
x/lib/s0.kmm Normal file
View File

@ -0,0 +1 @@
:for {*s *f--} ss :loop du fb du no pw @end jc ~du ~ss ca `+1 pw @loop ju ; :end dr dr ~dr ; ~ju ;

2
x/lib/term.kmm Normal file
View File

@ -0,0 +1,2 @@
:putc `term:0 io ~ju ;
:puts pw @putc pw @s0/for ca ~ju ;

View File

@ -1,20 +1,16 @@
-inc "x/dev.inc"
!vsync pb #0 ;
!ret ~ju ;
-org #100
-inc "x/inc/dev.kmm"
-org #0100
:entry
pw @cursormove `vsync mw
pw @cursormove `disp:vsync mw
ex
;
:cursormove
pw @data/2b/cursor `disp:blt io
pw @pos fw `disp:pos io
pw #00ffff72 `disp:out io
`mouse:pos ii du `disp:pos io
pw @pos mw
pw #00f25032 `disp:out io
`ret
pw @data/2b/cursor `disp:blt io
pw @pos fw `disp:pos io
pw #00ffff72 `disp:out io
`mouse:pos ii du `disp:pos io pw @pos mw
pw #00f25032 `disp:out io
~ju
:pos #00000000 ;
;
:data