*UNDER CONSTRUCTION*

Varvara

created:
<a>

Uxn is to Varvara, what the 6502 is to the Nintendo.

VarvaraUxn의 시스템이다.

Important

이 글은 Uxntal 및 Uxn의 기본적인 시스템을 이해하고 있다는 가정 하에 작성되었습니다.
Uxntal

Varvara는 Uxn이 외부 세계와 소통하기 위한 인터페이스이다.

출력은 zero-page의 주소로 데이터를 보내면 그걸 Varvara가 이용하여 출력하는 방식이다. 입력은 마찬가지로 zero-page의 주소에서 Varvara가 설정 해놓은 데이터를 가져와서 사용하는 방식이다.

예를 들어 ascii 문자를 출력하는 것은 다음과 같다.
Ascii A0x41을 주소 0x18 에 작성하는 것이다.

#41 #18 DEO ( 'A'의 ascii 값은 65=0x41 )
( OUTPUT
A
)

Zero-page의 주소도 당연하게 라벨을 부여하는 것이 가능하다.

|10 @Console/vector $2 &read $5 &type $1 &write $1 &error $1
#41 .Console/write DEO
( OUTPUT
A
)

Output

앞에서 보았던 것 처럼, 출력을 하기 위해서 특정 zero-page 주소로 데이터를 보내는 방식을 사용했고, DEO opcode를 사용했다.

Device Output(DEO)은 스택에서 값을 가져와서 주어진 zero-page의 장치 부분에 작성한다.

DEO ( val device8 -- )

Ascii 값을 hex로 작성하거나, LIT을 이용하는 방법도 있다.

#41 #18 DEO
LIT "A #18 DEO
( OUTPUT
AA
)

https://wiki.xxiivv.com/site/uxntal_reference.html#deo[↗]

Note

주소 0x18은 zero-page에서 보통 @Console/write로 정의되는 주소로, console에 문자를 출력할때 사용한다.
https://wiki.xxiivv.com/site/varvara.html#console[↗]

Input

Device Input(DEI)은 주어진 zero-page의 장치 부분에서 값을 가져와서 스택에 삽입한다.

DEI ( device8 -- val )

예를 들어 Varvara 화면에서 마우스의 좌표를 아래와 같이 받아올 수 있다.

|90 @Mouse/vector $2 &x $2 &y $2 &state $4 &scrollx $2 &scrolly

@on-reset ( -> )
  ;on-mouse .Mouse/vector DEO2
  BRK

@on-mouse ( -> )
  .Mouse/x DEI2
  .Mouse/y DEI2

  POP2 POP2 BRK

Note

Vectorevent listener의 개념이라 볼 수 있다. Varvara가 마우스 관련 이벤트가 발생했을때, 자동으로 @on-mouse 라벨을 루틴으로 실행하는 것이다.
하지만 코드 내에서 실행하는 것이 아니고, 코드 내에서는 정의에 그치기에, 각 vector의 말단에 BRK를 두어 진행을 막아야한다.

Extend

그렇기에 아래와 같이 필요한 zero-page 주소들에 미리 라벨링을 하고 사용하는 편이다.

|00 @System/vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|10 @Console/vector $2 &read $5 &type $1 &write $1 &error $1
|20 @Screen/vector $2 &width $2 &height $2 &auto $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller/vector $2 &button $1 &key $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1

Webmentions(?)

Q. Why isn't my webmention not appearing?

A. I deploy this site not so often and this site is static site. So don't expect your webmention to appear instantly. Thanks for the webmention and sorry for the inconvenience.
last deployed: see footer