From f6c8930d5fc57a627050c41843d097753185f6ba Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Tue, 24 Feb 2026 00:29:18 +0200 Subject: [PATCH] Update opcode documentation: replace custom IDs with descriptive `opcode-*` IDs for improved clarity and consistency. --- doc/opcodes_00_09.org | 20 ++++----- doc/opcodes_10_19.org | 18 ++++---- doc/opcodes_20_29.org | 20 ++++----- doc/opcodes_30_39.org | 20 ++++----- doc/opcodes_40_49.org | 16 +++---- doc/virtual machine.org | 94 ++++++++++++++++++++--------------------- 6 files changed, 94 insertions(+), 94 deletions(-) diff --git a/doc/opcodes_00_09.org b/doc/opcodes_00_09.org index 14ca971..d53d0c3 100644 --- a/doc/opcodes_00_09.org +++ b/doc/opcodes_00_09.org @@ -48,7 +48,7 @@ manipulation, and basic I/O operations. * 0: nop (No Operation) :PROPERTIES: -:CUSTOM_ID: ID-4f0dee8a-647e-4d91-a252-aaf4782b5edc +:CUSTOM_ID: opcode-nop :ID: 4f0dee8a-647e-4d91-a252-aaf4782b5edc :END: @@ -87,7 +87,7 @@ next opcode. * 1: halt (Stop Execution) :PROPERTIES: -:CUSTOM_ID: ID-7c8841d3-2335-4ee9-b6b9-518d05354841 +:CUSTOM_ID: opcode-halt :ID: 7c8841d3-2335-4ee9-b6b9-518d05354841 :END: @@ -128,7 +128,7 @@ which compiles to the halt opcode. * 2: kbd@ (Keyboard Input) :PROPERTIES: -:CUSTOM_ID: ID-820b1b90-4f4c-4ab1-b49f-9b4a52ea2528 +:CUSTOM_ID: opcode-kbd-read :ID: 820b1b90-4f4c-4ab1-b49f-9b4a52ea2528 :END: @@ -206,7 +206,7 @@ Basic key reading: * 3: num (Push Literal Number) :PROPERTIES: -:CUSTOM_ID: ID-8721dc8c-b237-4e9a-a509-0ded1c02329b +:CUSTOM_ID: opcode-num :ID: 8721dc8c-b237-4e9a-a509-0ded1c02329b :END: @@ -268,7 +268,7 @@ FF ; Compiles to: 03 FF 00 00 00 * 4: jmp (Unconditional Jump) :PROPERTIES: -:CUSTOM_ID: ID-a5c53b60-ffe9-4ba4-ab87-30c2ccc51a45 +:CUSTOM_ID: opcode-jmp :ID: a5c53b60-ffe9-4ba4-ab87-30c2ccc51a45 :END: @@ -336,7 +336,7 @@ Skip over code: * 5: call (Call Subroutine) :PROPERTIES: -:CUSTOM_ID: ID-66efbd35-c2b6-4657-ba0f-ff00a3a2c312 +:CUSTOM_ID: opcode-call :ID: 66efbd35-c2b6-4657-ba0f-ff00a3a2c312 :END: @@ -403,7 +403,7 @@ argument (i.e., the address of the next instruction). * 6: 1+ (Increment) :PROPERTIES: -:CUSTOM_ID: ID-76fe1c8f-756d-406e-9e8a-4ecc8f1d7369 +:CUSTOM_ID: opcode-1plus :ID: 76fe1c8f-756d-406e-9e8a-4ecc8f1d7369 :END: @@ -454,7 +454,7 @@ Use =1+= instead of =1 += for better code density. * 7: 1- (Decrement) :PROPERTIES: -:CUSTOM_ID: ID-523f93a3-359e-4a6d-b296-df25008db403 +:CUSTOM_ID: opcode-1minus :ID: 523f93a3-359e-4a6d-b296-df25008db403 :END: @@ -510,7 +510,7 @@ A loop ; prints A, 9, 8, ... 1 * 8: dup (Duplicate) :PROPERTIES: -:CUSTOM_ID: ID-2a6a449a-fc76-421c-a81c-c2024a15fc78 +:CUSTOM_ID: opcode-dup :ID: 2a6a449a-fc76-421c-a81c-c2024a15fc78 :END: @@ -576,7 +576,7 @@ drop ; now consume it * 9: drop (Discard) :PROPERTIES: -:CUSTOM_ID: ID-4600dbeb-1833-4e7d-af7e-f6cc6c98d022 +:CUSTOM_ID: opcode-drop :ID: 4600dbeb-1833-4e7d-af7e-f6cc6c98d022 :END: diff --git a/doc/opcodes_10_19.org b/doc/opcodes_10_19.org index f93333c..3651889 100644 --- a/doc/opcodes_10_19.org +++ b/doc/opcodes_10_19.org @@ -28,7 +28,7 @@ * 10: if :PROPERTIES: -:CUSTOM_ID: ID-d6f834b6-9a37-4414-91b3-62b3e1d920c1 +:CUSTOM_ID: opcode-if :ID: d6f834b6-9a37-4414-91b3-62b3e1d920c1 :END: - *Stack Effect:* =n --= @@ -46,7 +46,7 @@ * 11: ret :PROPERTIES: -:CUSTOM_ID: ID-6e683977-a985-4bb8-9d2c-c860d30e1df6 +:CUSTOM_ID: opcode-ret :ID: 6e683977-a985-4bb8-9d2c-c860d30e1df6 :END: - *Stack Effect:* =--= @@ -60,7 +60,7 @@ * 12: c@ :PROPERTIES: -:CUSTOM_ID: ID-a2ce44f7-b661-44e0-909b-644ff52aa38e +:CUSTOM_ID: opcode-cfetch :ID: a2ce44f7-b661-44e0-909b-644ff52aa38e :END: - *Stack Effect:* =addr -- byte= @@ -77,7 +77,7 @@ * 13: c! :PROPERTIES: -:CUSTOM_ID: ID-f129ef87-a31a-40fe-b8d3-984da2db90e2 +:CUSTOM_ID: opcode-cstore :ID: f129ef87-a31a-40fe-b8d3-984da2db90e2 :END: - *Stack Effect:* =byte addr --= @@ -93,7 +93,7 @@ * 14: push :PROPERTIES: -:CUSTOM_ID: ID-e4bcbaf1-7724-4051-b19c-1aa7cd06eae6 +:CUSTOM_ID: opcode-push :ID: e4bcbaf1-7724-4051-b19c-1aa7cd06eae6 :END: - *Stack Effect:* =n --= @@ -110,7 +110,7 @@ * 15: pop :PROPERTIES: -:CUSTOM_ID: ID-21871d09-4d58-440f-8c94-231105aa4e3f +:CUSTOM_ID: opcode-pop :ID: 21871d09-4d58-440f-8c94-231105aa4e3f :END: - *Stack Effect:* =-- n= @@ -127,7 +127,7 @@ * 17: rot :PROPERTIES: -:CUSTOM_ID: ID-4cee73f7-c105-4b96-9380-ff89bd7fedad +:CUSTOM_ID: opcode-rot :ID: 4cee73f7-c105-4b96-9380-ff89bd7fedad :END: - *Stack Effect:* =n1 n2 n3 -- n2 n3 n1= @@ -144,7 +144,7 @@ * 18: disk@ :PROPERTIES: -:CUSTOM_ID: ID-bed1aa27-66ac-4c73-bbb9-e49ff2aa67c5 +:CUSTOM_ID: opcode-disk-read :ID: bed1aa27-66ac-4c73-bbb9-e49ff2aa67c5 :END: - *Stack Effect:* =sector addr --= @@ -161,7 +161,7 @@ * 19: disk! :PROPERTIES: -:CUSTOM_ID: ID-02eda775-e483-4057-b809-de36d586579b +:CUSTOM_ID: opcode-disk-write :ID: 02eda775-e483-4057-b809-de36d586579b :END: - *Stack Effect:* =addr sector --= diff --git a/doc/opcodes_20_29.org b/doc/opcodes_20_29.org index c9f48d1..14905b8 100644 --- a/doc/opcodes_20_29.org +++ b/doc/opcodes_20_29.org @@ -28,7 +28,7 @@ * 20: @ :PROPERTIES: -:CUSTOM_ID: ID-0a54f24b-e62a-4244-85e1-855a0007c81e +:CUSTOM_ID: opcode-fetch :ID: 0a54f24b-e62a-4244-85e1-855a0007c81e :END: - *Stack Effect:* =addr -- value= @@ -44,7 +44,7 @@ * 21: ! :PROPERTIES: -:CUSTOM_ID: ID-50e0c841-d678-41b4-be5a-1bab792f367d +:CUSTOM_ID: opcode-store :ID: 50e0c841-d678-41b4-be5a-1bab792f367d :END: - *Stack Effect:* =value addr --= @@ -60,7 +60,7 @@ * 22: over :PROPERTIES: -:CUSTOM_ID: ID-29828b20-b14d-41ff-9705-ca576c352fb4 +:CUSTOM_ID: opcode-over :ID: 29828b20-b14d-41ff-9705-ca576c352fb4 :END: - *Stack Effect:* =n1 n2 -- n1 n2 n1= @@ -77,7 +77,7 @@ * 23: swap :PROPERTIES: -:CUSTOM_ID: ID-905894ae-d687-47cd-add0-f1904179a8a0 +:CUSTOM_ID: opcode-swap :ID: 905894ae-d687-47cd-add0-f1904179a8a0 :END: - *Stack Effect:* =n1 n2 -- n2 n1= @@ -93,7 +93,7 @@ * 24: + :PROPERTIES: -:CUSTOM_ID: ID-bf4434bb-91a5-40c1-93de-90a0e05a50ec +:CUSTOM_ID: opcode-add :ID: bf4434bb-91a5-40c1-93de-90a0e05a50ec :END: - *Stack Effect:* =n1 n2 -- n1+n2= @@ -110,7 +110,7 @@ * 25: - :PROPERTIES: -:CUSTOM_ID: ID-9afc77fc-ecee-4a69-b1d2-f511e64a0d72 +:CUSTOM_ID: opcode-sub :ID: 9afc77fc-ecee-4a69-b1d2-f511e64a0d72 :END: - *Stack Effect:* =n1 n2 -- n2-n1= @@ -127,7 +127,7 @@ * 26: * :PROPERTIES: -:CUSTOM_ID: ID-85833e5c-e3ae-41a7-ad3d-6e9f0ecc9cdb +:CUSTOM_ID: opcode-mul :ID: 85833e5c-e3ae-41a7-ad3d-6e9f0ecc9cdb :END: - *Stack Effect:* =n1 n2 -- n1*n2= @@ -144,7 +144,7 @@ * 27: / :PROPERTIES: -:CUSTOM_ID: ID-e5ff13c7-a9e6-4035-8efd-220d05381bf1 +:CUSTOM_ID: opcode-div :ID: e5ff13c7-a9e6-4035-8efd-220d05381bf1 :END: - *Stack Effect:* =n1 n2 -- n2/n1= @@ -161,7 +161,7 @@ * 28: > :PROPERTIES: -:CUSTOM_ID: ID-abcc14d3-6cbf-46c3-8a93-ee7180f350d4 +:CUSTOM_ID: opcode-gt :ID: abcc14d3-6cbf-46c3-8a93-ee7180f350d4 :END: - *Stack Effect:* =n1 n2 -- result= @@ -178,7 +178,7 @@ * 29: < :PROPERTIES: -:CUSTOM_ID: ID-68362f38-c9e4-43f8-809c-8e15725a58c8 +:CUSTOM_ID: opcode-lt :ID: 68362f38-c9e4-43f8-809c-8e15725a58c8 :END: - *Stack Effect:* =n1 n2 -- result= diff --git a/doc/opcodes_30_39.org b/doc/opcodes_30_39.org index bff88cc..3d87fda 100644 --- a/doc/opcodes_30_39.org +++ b/doc/opcodes_30_39.org @@ -28,7 +28,7 @@ * 30: not :PROPERTIES: -:CUSTOM_ID: ID-21994321-a1c6-42f6-9682-d5a3fbabb88a +:CUSTOM_ID: opcode-not :ID: 21994321-a1c6-42f6-9682-d5a3fbabb88a :END: - *Stack Effect:* =n -- ~n= @@ -44,7 +44,7 @@ * 31: i :PROPERTIES: -:CUSTOM_ID: ID-61fbdd36-4384-44a6-b162-b4e998c4c191 +:CUSTOM_ID: opcode-i :ID: 61fbdd36-4384-44a6-b162-b4e998c4c191 :END: - *Stack Effect:* =-- r= @@ -62,7 +62,7 @@ * 32: cprt@ :PROPERTIES: -:CUSTOM_ID: ID-78c1ac50-9c26-4132-8e02-8311331f2a1c +:CUSTOM_ID: opcode-cprt-read :ID: 78c1ac50-9c26-4132-8e02-8311331f2a1c :END: - *Stack Effect:* =port -- byte= @@ -77,7 +77,7 @@ * 33: cprt! :PROPERTIES: -:CUSTOM_ID: ID-cfa8550e-bf8b-4d44-a3d1-9ba8ad183147 +:CUSTOM_ID: opcode-cprt-write :ID: cfa8550e-bf8b-4d44-a3d1-9ba8ad183147 :END: - *Stack Effect:* =byte port --= @@ -93,7 +93,7 @@ * 34: i2 :PROPERTIES: -:CUSTOM_ID: ID-c3758859-c82e-40c1-9e92-87e5ef410cd2 +:CUSTOM_ID: opcode-i2 :ID: c3758859-c82e-40c1-9e92-87e5ef410cd2 :END: - *Stack Effect:* =-- r2= @@ -111,7 +111,7 @@ * 35: i3 :PROPERTIES: -:CUSTOM_ID: ID-304cadf7-9725-4e2d-8634-2e67b5ad49f3 +:CUSTOM_ID: opcode-i3 :ID: 304cadf7-9725-4e2d-8634-2e67b5ad49f3 :END: - *Stack Effect:* =-- r3= @@ -129,7 +129,7 @@ * 36: shl :PROPERTIES: -:CUSTOM_ID: ID-978d1b75-3a1d-476f-8cdb-d3a6ee40b3f5 +:CUSTOM_ID: opcode-shl :ID: 978d1b75-3a1d-476f-8cdb-d3a6ee40b3f5 :END: @@ -170,7 +170,7 @@ shifted up, and the upper bits remain zero. * 37: shr :PROPERTIES: -:CUSTOM_ID: ID-9dbfcd07-6c34-41b7-b5dc-a33f0773e7cd +:CUSTOM_ID: opcode-shr :ID: 9dbfcd07-6c34-41b7-b5dc-a33f0773e7cd :END: @@ -211,7 +211,7 @@ Result: 0. The single bit was shifted out and discarded. * 38: or :PROPERTIES: -:CUSTOM_ID: ID-b38b971f-3a5f-4b16-9536-4193d2c5ae6b +:CUSTOM_ID: opcode-or :ID: b38b971f-3a5f-4b16-9536-4193d2c5ae6b :END: - *Stack Effect:* =n1 n2 -- n1|n2= @@ -226,7 +226,7 @@ Result: 0. The single bit was shifted out and discarded. * 39: xor :PROPERTIES: -:CUSTOM_ID: ID-e87a0d6d-89b0-4791-9500-654d60d99318 +:CUSTOM_ID: opcode-xor :ID: e87a0d6d-89b0-4791-9500-654d60d99318 :END: - *Stack Effect:* =n1 n2 -- n1^n2= diff --git a/doc/opcodes_40_49.org b/doc/opcodes_40_49.org index 8922c4a..1186994 100644 --- a/doc/opcodes_40_49.org +++ b/doc/opcodes_40_49.org @@ -28,7 +28,7 @@ * 40: vidmap :PROPERTIES: -:CUSTOM_ID: ID-fe47ff6d-768f-4b05-9f8c-f52352c106f4 +:CUSTOM_ID: opcode-vidmap :ID: fe47ff6d-768f-4b05-9f8c-f52352c106f4 :END: Stack Footprint @@ -80,7 +80,7 @@ vidmap * 41: mouse@ :PROPERTIES: -:CUSTOM_ID: ID-b4bce653-d38f-45ed-82ec-13ca78c9860b +:CUSTOM_ID: opcode-mouse :ID: b4bce653-d38f-45ed-82ec-13ca78c9860b :END: Stack Footprint: @@ -112,7 +112,7 @@ After execution, stack contains buttons (top), y, x (bottom). * 42: vidput - put image1 into image2, at location x, y :PROPERTIES: -:CUSTOM_ID: ID-238e8b03-57b6-424d-bfee-b6bb652cefbc +:CUSTOM_ID: opcode-vidput :ID: 238e8b03-57b6-424d-bfee-b6bb652cefbc :END: Stack Footprint: @@ -151,7 +151,7 @@ vidput * 43: cmove - copy memory array :PROPERTIES: -:CUSTOM_ID: ID-79e1916f-4103-42cc-ac10-bb1ee776ed50 +:CUSTOM_ID: opcode-cmove :ID: 79e1916f-4103-42cc-ac10-bb1ee776ed50 :END: @@ -173,7 +173,7 @@ regions correctly. * 44: cfill :PROPERTIES: -:CUSTOM_ID: ID-fecb9438-d9d2-4224-a017-cc87dba9209e +:CUSTOM_ID: opcode-cfill :ID: fecb9438-d9d2-4224-a017-cc87dba9209e :END: - *Stack Effect:* =byte addr len --= @@ -191,7 +191,7 @@ regions correctly. * 45: tvidput - put image with transparency support :PROPERTIES: -:CUSTOM_ID: ID-ab45247c-44c3-464d-9e2a-337f483b4616 +:CUSTOM_ID: opcode-tvidput :ID: ab45247c-44c3-464d-9e2a-337f483b4616 :END: Stack Footprint: @@ -238,7 +238,7 @@ tvidput * 46: depth :PROPERTIES: -:CUSTOM_ID: ID-77fa76d3-9cd0-49c1-882c-f30383347352 +:CUSTOM_ID: opcode-depth :ID: 77fa76d3-9cd0-49c1-882c-f30383347352 :END: - *Stack Effect:* =-- depth= @@ -255,7 +255,7 @@ tvidput * 47: charput - draw text character :PROPERTIES: -:CUSTOM_ID: ID-4bb479cf-aae0-4128-9868-f016c286a162 +:CUSTOM_ID: opcode-charput :ID: 4bb479cf-aae0-4128-9868-f016c286a162 :END: diff --git a/doc/virtual machine.org b/doc/virtual machine.org index 4a73569..4078fc4 100644 --- a/doc/virtual machine.org +++ b/doc/virtual machine.org @@ -112,54 +112,54 @@ in FIFTH programming language): | # | Name | Stack effect | Description | Notes | |----+----------+-----------------------+----------------------------------------------------------+---------------------------------------------------------------------| -| 0 | [[id:4f0dee8a-647e-4d91-a252-aaf4782b5edc][nop]] | -- | No operation; execution continues to next instruction | Used for padding or placeholder | -| 1 | [[id:7c8841d3-2335-4ee9-b6b9-518d05354841][halt]] | -- | Stop execution and exit emulator | Cleanly terminates the Fifth environment | -| 2 | [[id:820b1b90-4f4c-4ab1-b49f-9b4a52ea2528][kbd@]] | -- scancode | Read keyboard scancode; returns 0 if no key pending | Make codes for press, break codes (value+128) for release | -| 3 | [[id:8721dc8c-b237-4e9a-a509-0ded1c02329b][num]] | -- n | Push 32-bit literal from instruction stream | Followed by 4 bytes (little-endian) | -| 4 | [[id:a5c53b60-ffe9-4ba4-ab87-30c2ccc51a45][jmp]] | -- | Unconditional jump to address from instruction stream | Followed by 4-byte target address | -| 5 | [[id:66efbd35-c2b6-4657-ba0f-ff00a3a2c312][call]] | -- | Call subroutine; push return address on return stack | Use ret (opcode 11) to return; follow with 4-byte target address | -| 6 | [[id:76fe1c8f-756d-406e-9e8a-4ecc8f1d7369][1+]] | n -- n+1 | Increment top of data stack by 1 | Efficient single-byte operation for counters and pointers | -| 7 | [[id:523f93a3-359e-4a6d-b296-df25008db403][1-]] | n -- n-1 | Decrement top of data stack by 1 | Efficient single-byte operation for countdown loops | -| 8 | [[id:2a6a449a-fc76-421c-a81c-c2024a15fc78][dup]] | n -- n n | Duplicate top of data stack | Preserve values before consuming operations | -| 9 | [[id:4600dbeb-1833-4e7d-af7e-f6cc6c98d022][drop]] | n -- | Remove and discard top of data stack | Clean up stack after operations | -| 10 | [[id:d6f834b6-9a37-4414-91b3-62b3e1d920c1][if]] | n -- | Jump to address if top of stack is zero | | -| 11 | [[id:6e683977-a985-4bb8-9d2c-c860d30e1df6][ret]] | | Return from subroutine (pop return address) | | -| 12 | [[id:a2ce44f7-b661-44e0-909b-644ff52aa38e][c@]] | addr -- byte | Read byte from memory at specified address | | -| 13 | [[id:f129ef87-a31a-40fe-b8d3-984da2db90e2][c!]] | byte addr -- | Store byte to specified memory address | | -| 14 | [[id:e4bcbaf1-7724-4051-b19c-1aa7cd06eae6][push]] | n -- | Move top of data stack to return stack | | -| 15 | [[id:21871d09-4d58-440f-8c94-231105aa4e3f][pop]] | -- n | Move top of return stack to data stack | | +| 0 | [[file:opcodes_00_09.org::#opcode-nop][nop]] | -- | No operation; execution continues to next instruction | Used for padding or placeholder | +| 1 | [[file:opcodes_00_09.org::#opcode-halt][halt]] | -- | Stop execution and exit emulator | Cleanly terminates the Fifth environment | +| 2 | [[file:opcodes_00_09.org::#opcode-kbd-read][kbd@]] | -- scancode | Read keyboard scancode; returns 0 if no key pending | Make codes for press, break codes (value+128) for release | +| 3 | [[file:opcodes_00_09.org::#opcode-num][num]] | -- n | Push 32-bit literal from instruction stream | Followed by 4 bytes (little-endian) | +| 4 | [[file:opcodes_00_09.org::#opcode-jmp][jmp]] | -- | Unconditional jump to address from instruction stream | Followed by 4-byte target address | +| 5 | [[file:opcodes_00_09.org::#opcode-call][call]] | -- | Call subroutine; push return address on return stack | Use ret (opcode 11) to return; follow with 4-byte target address | +| 6 | [[file:opcodes_00_09.org::#opcode-1plus][1+]] | n -- n+1 | Increment top of data stack by 1 | Efficient single-byte operation for counters and pointers | +| 7 | [[file:opcodes_00_09.org::#opcode-1minus][1-]] | n -- n-1 | Decrement top of data stack by 1 | Efficient single-byte operation for countdown loops | +| 8 | [[file:opcodes_00_09.org::#opcode-dup][dup]] | n -- n n | Duplicate top of data stack | Preserve values before consuming operations | +| 9 | [[file:opcodes_00_09.org::#opcode-drop][drop]] | n -- | Remove and discard top of data stack | Clean up stack after operations | +| 10 | [[file:opcodes_10_19.org::#opcode-if][if]] | n -- | Jump to address if top of stack is zero | | +| 11 | [[file:opcodes_10_19.org::#opcode-ret][ret]] | | Return from subroutine (pop return address) | | +| 12 | [[file:opcodes_10_19.org::#opcode-cfetch][c@]] | addr -- byte | Read byte from memory at specified address | | +| 13 | [[file:opcodes_10_19.org::#opcode-cstore][c!]] | byte addr -- | Store byte to specified memory address | | +| 14 | [[file:opcodes_10_19.org::#opcode-push][push]] | n -- | Move top of data stack to return stack | | +| 15 | [[file:opcodes_10_19.org::#opcode-pop][pop]] | -- n | Move top of return stack to data stack | | | 16 | | | | | -| 17 | [[id:4cee73f7-c105-4b96-9380-ff89bd7fedad][rot]] | n1 n2 n3 -- n2 n3 n1 | Rotate top three stack elements | | -| 18 | [[id:bed1aa27-66ac-4c73-bbb9-e49ff2aa67c5][disk@]] | sector addr -- | Read 1KB from disk into RAM at specified address | | -| 19 | [[id:02eda775-e483-4057-b809-de36d586579b][disk!]] | addr sector -- | Write 1KB from RAM to disk at specified sector | | -| 20 | [[id:0a54f24b-e62a-4244-85e1-855a0007c81e][@]] | addr -- n | Read 32-bit value from memory | | -| 21 | [[id:50e0c841-d678-41b4-be5a-1bab792f367d][!]] | n addr -- | Store 32-bit value to memory | | -| 22 | [[id:29828b20-b14d-41ff-9705-ca576c352fb4][over]] | n1 n2 -- n1 n2 n1 | Duplicate second item on data stack | | -| 23 | [[id:905894ae-d687-47cd-add0-f1904179a8a0][swap]] | n1 n2 -- n2 n1 | Swap top two items on data stack | | -| 24 | [[id:bf4434bb-91a5-40c1-93de-90a0e05a50ec][+]] | n1 n2 -- n1+n2 | Add top two items on data stack | | -| 25 | [[id:9afc77fc-ecee-4a69-b1d2-f511e64a0d72][-]] | n1 n2 -- n1-n2 | Subtract second item from top item on data stack | TODO: verify argument order | -| 26 | [[id:85833e5c-e3ae-41a7-ad3d-6e9f0ecc9cdb][*]] | n1 n2 -- n1*n2 | Multiply top two items on data stack | | -| 27 | [[id:e5ff13c7-a9e6-4035-8efd-220d05381bf1][/]] | n1 n2 -- n2/n1 | Divide top item by second item on data stack | TODO: verify argument order | -| 28 | [[id:abcc14d3-6cbf-46c3-8a93-ee7180f350d4][>]] | n1 n2 -- result | Compare n1 > n2 (returns true, false otherwise) | TODO: document, what true and false means | -| 29 | [[id:68362f38-c9e4-43f8-809c-8e15725a58c8][<]] | n1 n2 -- result | Compare n1 < n2 (returns true, false otherwise) | TODO: document, what true and false means | -| 30 | [[id:21994321-a1c6-42f6-9682-d5a3fbabb88a][not]] | n -- ~n | Bitwise NOT on top of data stack | | -| 31 | [[id:61fbdd36-4384-44a6-b162-b4e998c4c191][i]] | -- n | Push top of return stack to data stack | | -| 32 | [[id:78c1ac50-9c26-4132-8e02-8311331f2a1c][cprt@]] | port -- byte | Read byte from hardware I/O port | | -| 33 | [[id:cfa8550e-bf8b-4d44-a3d1-9ba8ad183147][cprt!]] | byte port -- | Write byte to hardware I/O port | | -| 34 | [[id:c3758859-c82e-40c1-9e92-87e5ef410cd2][i2]] | -- n | Push second item from return stack to data stack | | -| 35 | [[id:304cadf7-9725-4e2d-8634-2e67b5ad49f3][i3]] | -- n | Push third item from return stack to data stack | | -| 36 | [[id:978d1b75-3a1d-476f-8cdb-d3a6ee40b3f5][shl]] | value count -- result | Left shift value by count bits; shifted-out bits discarded | -| 37 | [[id:9dbfcd07-6c34-41b7-b5dc-a33f0773e7cd][shr]] | value count -- result | Logical right shift; zeros shifted in, shifted-out bits discarded | -| 38 | [[id:b38b971f-3a5f-4b16-9536-4193d2c5ae6b][or]] | n1 n2 -- result | Bitwise OR of top two items on data stack | | -| 39 | [[id:e87a0d6d-89b0-4791-9500-654d60d99318][xor]] | n1 n2 -- result | Bitwise XOR of top two items on data stack | | -| 40 | [[id:fe47ff6d-768f-4b05-9f8c-f52352c106f4][vidmap]] | addr -- | Copy memory to video memory | | -| 41 | [[id:b4bce653-d38f-45ed-82ec-13ca78c9860b][mouse@]] | -- x y buttons | Read mouse coordinates and button states | | -| 42 | [[id:238e8b03-57b6-424d-bfee-b6bb652cefbc][vidput]] | addr1 addr2 x y -- | Blit image1 to image2 at (x,y) without transparency | | -| 43 | [[id:79e1916f-4103-42cc-ac10-bb1ee776ed50][cmove]] | addr1 addr2 len -- | Copy memory block from addr1 to addr2 | | -| 44 | [[id:fecb9438-d9d2-4224-a017-cc87dba9209e][cfill]] | byte addr len -- | Fill memory with specified byte value | | -| 45 | [[id:ab45247c-44c3-464d-9e2a-337f483b4616][tvidput]] | addr1 addr2 x y -- | Blit image1 to image2 at (x,y) with transparency support | | -| 46 | [[id:77fa76d3-9cd0-49c1-882c-f30383347352][depth]] | -- depth | Push current data stack depth | | -| 47 | [[id:4bb479cf-aae0-4128-9868-f016c286a162][charput]] | fg bg src dest x y -- | Draw character from source buffer to destination buffer | +| 17 | [[file:opcodes_10_19.org::#opcode-rot][rot]] | n1 n2 n3 -- n2 n3 n1 | Rotate top three stack elements | | +| 18 | [[file:opcodes_10_19.org::#opcode-disk-read][disk@]] | sector addr -- | Read 1KB from disk into RAM at specified address | | +| 19 | [[file:opcodes_10_19.org::#opcode-disk-write][disk!]] | addr sector -- | Write 1KB from RAM to disk at specified sector | | +| 20 | [[file:opcodes_20_29.org::#opcode-fetch][@]] | addr -- n | Read 32-bit value from memory | | +| 21 | [[file:opcodes_20_29.org::#opcode-store][!]] | n addr -- | Store 32-bit value to memory | | +| 22 | [[file:opcodes_20_29.org::#opcode-over][over]] | n1 n2 -- n1 n2 n1 | Duplicate second item on data stack | | +| 23 | [[file:opcodes_20_29.org::#opcode-swap][swap]] | n1 n2 -- n2 n1 | Swap top two items on data stack | | +| 24 | [[file:opcodes_20_29.org::#opcode-add][+]] | n1 n2 -- n1+n2 | Add top two items on data stack | | +| 25 | [[file:opcodes_20_29.org::#opcode-sub][-]] | n1 n2 -- n1-n2 | Subtract second item from top item on data stack | TODO: verify argument order | +| 26 | [[file:opcodes_20_29.org::#opcode-mul][*]] | n1 n2 -- n1*n2 | Multiply top two items on data stack | | +| 27 | [[file:opcodes_20_29.org::#opcode-div][/]] | n1 n2 -- n2/n1 | Divide top item by second item on data stack | TODO: verify argument order | +| 28 | [[file:opcodes_20_29.org::#opcode-gt][>]] | n1 n2 -- result | Compare n1 > n2 (returns true, false otherwise) | TODO: document, what true and false means | +| 29 | [[file:opcodes_20_29.org::#opcode-lt][<]] | n1 n2 -- result | Compare n1 < n2 (returns true, false otherwise) | TODO: document, what true and false means | +| 30 | [[file:opcodes_30_39.org::#opcode-not][not]] | n -- ~n | Bitwise NOT on top of data stack | | +| 31 | [[file:opcodes_30_39.org::#opcode-i][i]] | -- n | Push top of return stack to data stack | | +| 32 | [[file:opcodes_30_39.org::#opcode-cprt-read][cprt@]] | port -- byte | Read byte from hardware I/O port | | +| 33 | [[file:opcodes_30_39.org::#opcode-cprt-write][cprt!]] | byte port -- | Write byte to hardware I/O port | | +| 34 | [[file:opcodes_30_39.org::#opcode-i2][i2]] | -- n | Push second item from return stack to data stack | | +| 35 | [[file:opcodes_30_39.org::#opcode-i3][i3]] | -- n | Push third item from return stack to data stack | | +| 36 | [[file:opcodes_30_39.org::#opcode-shl][shl]] | value count -- result | Left shift value by count bits; shifted-out bits discarded | +| 37 | [[file:opcodes_30_39.org::#opcode-shr][shr]] | value count -- result | Logical right shift; zeros shifted in, shifted-out bits discarded | +| 38 | [[file:opcodes_30_39.org::#opcode-or][or]] | n1 n2 -- result | Bitwise OR of top two items on data stack | | +| 39 | [[file:opcodes_30_39.org::#opcode-xor][xor]] | n1 n2 -- result | Bitwise XOR of top two items on data stack | | +| 40 | [[file:opcodes_40_49.org::#opcode-vidmap][vidmap]] | addr -- | Copy memory to video memory | | +| 41 | [[file:opcodes_40_49.org::#opcode-mouse][mouse@]] | -- x y buttons | Read mouse coordinates and button states | | +| 42 | [[file:opcodes_40_49.org::#opcode-vidput][vidput]] | addr1 addr2 x y -- | Blit image1 to image2 at (x,y) without transparency | | +| 43 | [[file:opcodes_40_49.org::#opcode-cmove][cmove]] | addr1 addr2 len -- | Copy memory block from addr1 to addr2 | | +| 44 | [[file:opcodes_40_49.org::#opcode-cfill][cfill]] | byte addr len -- | Fill memory with specified byte value | | +| 45 | [[file:opcodes_40_49.org::#opcode-tvidput][tvidput]] | addr1 addr2 x y -- | Blit image1 to image2 at (x,y) with transparency support | | +| 46 | [[file:opcodes_40_49.org::#opcode-depth][depth]] | -- depth | Push current data stack depth | | +| 47 | [[file:opcodes_40_49.org::#opcode-charput][charput]] | fg bg src dest x y -- | Draw character from source buffer to destination buffer | -- 2.20.1