Posts

Showing posts from February, 2024

Lab 2 - Letter guessing game

Image
 In this lab, I decided to mimic something professor has taught in his recording, which shows how to get input, print output and jump to different branches based on conditions. Assembly is supper difficult for me as I'm really not familiar with the language. As a result, I decide to combine my lab 1 and his instructions to create a letter guessing game. This program will randomly select a letter from A to Z, store it in the memory. The user will guess the letter. If they guess it correctly, a prompt will appear and the screen will become green, else there will be an error prompt followed by an input prompt for retry, and the screen will turn red. Here is the code: ; 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 define GENERATED_LETTER $0040 define IN...

How to get multiple inputs from the emulator

Description Currently, I'm creating a project where you would have to guess a letter the from the emulator, and I would need the user to enter a random character and the application will let the user know whether they entered a correct character or not. This is what I learnt about how to get an input from a user Get an input and print it out In our emulator , if we click the note button, we can see these definitions, we’ll focus on CHRIN and CHROUT today.   ; ROM routines define          SCINIT          $ff81 ; initialize/clear screen define          CHRIN           $ffcf ; input character from keyboard define          CHROUT          $ffd2 ; output character to screen define         ...

Lab 1 - SPO 600

Image
 Description In this lab, we work will a basic assembly code that will color our screen here using this 6502 emulator Here is our base code: lda #$00 ; set a pointer in memory location $40 to point to $0200 sta $40 ; ... low byte ($00) goes in address $40 lda #$02 sta $41 ; ... high byte ($02) goes into address $41 lda #$07 ; colour number ldy #$00 ; set index to 0 loop: sta ($40),y ; set pixel colour at the address (pointer)+Y iny ; increment index bne loop ; continue until done the page (256 pixels) inc $41 ; increment the page ldx $41 ; get the current page number cpx #$06 ; compare with 6 bne loop ; continue until done all pages  The code above will fill the screen with yellow Calculating Performance Base code To calculate the performance, we need to know the time the CPU takes to run the application. We need to know the number of cycles the CPU has to iterate to finish the code. Each instruction takes a different number of cycles and by...