Skip to content

Instantly share code, notes, and snippets.

Avatar

Cedric Beust cbeust

View GitHub Profile
View enum.rs
pub const BRK: u8 = 0x00;
pub const JSR: u8 = 0x20;
// ...
// opcode hex, opcode name, instruction size
let ops: Vec<(u8, &str, usize)> = vec![
(BRK, "BRK", 1),
(JSR, "JSR", 3),
// ...
];
View enum.kt
enum class Opcode(val opcode: Int, val opName: String, val size: Int) {
BRK(0x00, "BRK", 1),
JSR(0x20, "JSR", 3)
//
}
@cbeust
cbeust / mix.kt
Last active Oct 5, 2021
Mixing default and named parameters
View mix.kt
// skip 'visible', use its default value
val w = Window(0, 0, blackAndWhite = true)
View mix.kt
val w = Window(0, 0, visible = false, blackAndWhite = true)
View window.kt
val w = Window(0, 0, false, true) // mmmh, which boolean means what?
View window2.kt
class Window(x: Int, y: Int, visible: Boolean = false, blackAndWhite: Boolean = false)
View window.kt
class Window(x: Int, y: Int, visible: Boolean = false)
View window.rs
struct Window {
x: u16,
y: u16,
visible: bool,
}
impl Window {
fn new_with_visibility(x: u16, y: u16, visible: bool) -> Self {
Window {
x, y, visible
View gist:05f0cbb277ca5030b267513758d52395
;CHROME REVENGE by Abaddon
;the DOS 1k intro for Assembly 2020
;code: TomCat
;music: ern0
maxvol EQU 0
times EQU 0
Divider EQU 68