mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
vault backup: 2022-08-01 11:54:03
This commit is contained in:
parent
5c974b1fa6
commit
bd4f1ccc32
@ -4,6 +4,9 @@ aliases:
|
||||
tags:
|
||||
- lecture
|
||||
- cosc204
|
||||
sr-due: 2022-08-04
|
||||
sr-interval: 3
|
||||
sr-ease: 250
|
||||
---
|
||||
|
||||
# addressing modes
|
||||
@ -54,7 +57,7 @@ callling conventions
|
||||
- We’re not going to talk about passing a struct by value
|
||||
|
||||
### example in C
|
||||
|
||||
parameters
|
||||
``` c
|
||||
uint16_t two_params(uint8_t first, uint16_t second) {
|
||||
return first + second;
|
||||
@ -66,9 +69,28 @@ uint16_t call_one(void) {
|
||||
```
|
||||
|
||||
```
|
||||
LDD #$01AF ;
|
||||
decimal 431 PSHS B,A ;
|
||||
argument 2, int CLRA LDB #$CC ;
|
||||
decimal 204 PSHS B,A ;
|
||||
argument 1, int LBSR _two_params
|
||||
```
|
||||
```
|
||||
|
||||
local variables
|
||||
|
||||
``` c
|
||||
uint16_t one_param(uint16_t xyzzy) {
|
||||
uint16_t val = xyzzy;
|
||||
return val;
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
_one_param
|
||||
PSHS U
|
||||
LEAU ,S
|
||||
LEAS -2,S
|
||||
* Formal parameter(s):
|
||||
* 4,U: 2 bytes: xyzzy
|
||||
* Local non-static variable(s):
|
||||
* -2,U: 2 bytes: val
|
||||
LDD 4,U
|
||||
STD -2,U
|
||||
LEAS ,U
|
||||
PULS U,PC
|
||||
```
|
||||
|
||||
@ -43,6 +43,7 @@ tags:
|
||||
- [04-computer-architecture](notes/04-computer-architecture.md)
|
||||
- [05-6809-assembly](notes/05-6809-assembly.md)
|
||||
- [06-6809-programming](notes/06-6809-programming.md)
|
||||
- [07-6809-advanced](notes/07-6809-advanced.md)
|
||||
|
||||
# Archive
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user