Posts

Showing posts from February, 2024

AArch64 and x86_64 assembler code

Image
 AArch64  .text  .globl _start  min = 0                          /* starting value for the loop index; **note that this is a symbol (constant)**, not a variable */  max = 30                         /* loop exits when the index hits this number (loop condition is i<max) * _start:      mov     x19, min  loop:      /* Convert loop counter to char */      add        x15, x19, 0x30      adr        x14, msg+6      mov        x12, 10      udiv       x13, x19, x12      add        x16, x13, 0x30      cmp        x16, 0x30      b.eq       ones   ...

6502 Math and Strings Lab

Image
The 6502 processor, an 8-bit microprocessor prominent in early computing, adeptly performs basic arithmetic like addition and subtraction. However, its simplicity poses challenges for complex mathematical tasks, often requiring multiple instructions. In string manipulation, the absence of dedicated commands necessitates manual coding with load, store, and compare instructions. Programmers navigate character arrays for operations like concatenation, showcasing resource-conscious techniques in the absence of specialized string-handling instructions. Code for plotting a graph: ; ROM routines define SCINIT $ff81 ; initialize/clear screen define CHRIN $ffcf ; input character from keyboard define CHROUT $ffd2 ; output character to screen define SCREEN $ffed ; get screen size define PLOT $fff0 ; get/set cursor coordinates ; MEMORY LOCATION define INPUT_X $2000 define INPUT_Y $3000 ; Drawing X and Y axis units. LDA #$0E STA $0200 STA $0300 ST...