Added link to Font Tutorial, added HGR and Text address
parent
ab15e2e218
commit
6b1be0fa76
102
Home.md
102
Home.md
|
@ -1,3 +1,103 @@
|
|||
Welcome to the AppleWin wiki!
|
||||
|
||||
Nothing here -yet- but we'll eventually be posting tips & tricks about AppleWin.
|
||||
# HGR
|
||||
|
||||
* [6502 Assembly HGR Font Tutorial](https://github.com/Michaelangel007/apple2_hgr_font_tutorial)
|
||||
|
||||
## = Y to Address =
|
||||
|
||||
Given:
|
||||
|
||||
y = abcd efgh
|
||||
|
||||
Address is then:
|
||||
|
||||
---- ---- abcd efgh INPUT: Y
|
||||
---- ---- ---- -fgh &7
|
||||
---- -fgh ---- ---- * 0x100
|
||||
+ ---f gh-- ---- ---- * 4
|
||||
|
||||
---- ---- abcd efgh INPUT: Y
|
||||
---- ---- ---a bcde y/8
|
||||
---- ---- ---- -cde & 7
|
||||
---- ---- -cde ---- * 0x10
|
||||
+ ---- --cd e--- ---- * 8
|
||||
|
||||
---- ---- abcd efgh INPUT: Y (64 = 2^6)
|
||||
---- ---- ---- --ab y/64
|
||||
---- ---- --ab ---- * 0x10
|
||||
---- ---- -ab- ---- * 2
|
||||
---- ---- ---a b--- y/64 * 8
|
||||
+ ---- ---- -aba b--- y/64*0x28 See Note for alt. * 0x28
|
||||
|
||||
-PP- ---- 0000 0000 Graphics page, $20 or $40
|
||||
|
||||
= 0PPf ghcd eaba b000 Address
|
||||
|
||||
|
||||
|
||||
C code:
|
||||
|
||||
```C
|
||||
int HGR_y_to_address( int y ) {
|
||||
return 0x2000 + (y&7)*0x400 + ((y/8)&7)*0x80 + (y/64)*0x28;
|
||||
}
|
||||
```
|
||||
|
||||
6502 code:
|
||||
|
||||
```assembly
|
||||
ORG $900
|
||||
0900: B9 00 10 Y2HGRADR LDA YHgrLo, Y
|
||||
0903: 85 26 STA GBASL
|
||||
0905: B9 00 11 LDA YHgrHi, Y
|
||||
0908: 44 E6 ORA $E6
|
||||
090A: 85 27 STA GBASH
|
||||
090C: 60 RTS
|
||||
```
|
||||
|
||||
# TEXT
|
||||
|
||||
## Row to Address
|
||||
|
||||
Given:
|
||||
|
||||
y = 000a bcde (Range 0 .. 23 = $00 .. $17)
|
||||
|
||||
---- ---- 000a bcde INPUT: Y
|
||||
000a bcde ---- ---- * 256
|
||||
000a bcd0 ---- ---- & 0xFE
|
||||
0000 abcd ---- ---- / 2
|
||||
0000 00cd ---- ---- & 3
|
||||
+ 0000 01cd ---- ---- | 4
|
||||
```
|
||||
---- ---- 000a bcde INPUT: Y
|
||||
---- ---- 000a b000 & 0x18
|
||||
---- ---- e00a b000 = temp
|
||||
---- ---- 000a b000 & 18
|
||||
---- ---0 00ab 0000 * 2
|
||||
---- --00 0ab0 0000 * 2
|
||||
+ ---- --00 eaba b000 | temp
|
||||
|
||||
= 0000 01cd eaba b000 Address
|
||||
```
|
||||
|
||||
```assembly
|
||||
FBC1: 48 577 BASCALC PHA ;CALC BASE ADR IN BASL,H
|
||||
FBC2: 4A 578 LSR ; FOR GIVEN LINE NO
|
||||
FBC3: 29 03 579 AND #$03 ; 0<=LINE NO.<=$17
|
||||
FBC5: 09 04 580 ORA #$04 ;ARG=000ABCDE, GENERATE
|
||||
FBC7: 85 29 581 STA BASH ; BASH=000001CD
|
||||
FBC9: 68 582 PLA ; AND
|
||||
FBCA: 29 18 583 AND #$18 ; BASL=EABAB000
|
||||
FBCC: 90 02 584 BCC BSCLC2
|
||||
FBCE: 69 7F 585 ADC #$7F
|
||||
FBD0: 85 28 586 BSCLC2 STA BASL
|
||||
FBD2: 0A 587 ASL
|
||||
FBD3: 0A 588 ASL
|
||||
FBD4: 05 28 589 ORA BASL
|
||||
FBD6: 85 28 590 STA BASL
|
||||
FBD8: 60 591 RTS
|
||||
```
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue