Frogger video layout
Here is a position independent assembly function that you can call that will write an NULL terminated string to the write addresses starting at (x,y) tiles from the bottom left corner. (Cartesian co-ordinates). Note this code most likely could be optimised, I think eps that I did my loops poorly. But they do work.. so.
// load B with "column number" (0-28) // LD B, COLUMN (X position) // load C with "row number" (0-31) // LD C, ROW (Y position) // load DE with address of null // LC DE, 0xADDR // terminated frogger character set string // this WILL invalidate BC, DE, HL, so save before you call // call the address where this byte code is located // the code below is POSITION INDEPENDENT so it can be loaded anywhere // in the code ----------------------------------------------- XOR A // AF EX AF,AF' // 08 LD HL, $0xAFBF // 21 BF AF LD A,B // 78 EX AF,AF // 08 LD B,A // 47 SUB HL, BC // ED 42 EX AF, AF // 08 LD C $0x20 // 0E 20 INC A // 3C LOOP: DEC A // 3D JMPR Z DO_WRITE // 28 04 SUB HL, BC // ED 42 JMR LOOP // 18 F9 DO_WRITE: LD A, (DE) // 1A CMP A, 00 // FE 00 JPR Z, DONE // 28 06 LD (HL), A // 77 INC DE // 13 SUB HL, BC // ED 42 JMP DO_WRITE // 18 F5 DONE: RET // C9
Here is a CFG of the code above
All the tiles (from value 0x00 (top right) increasing in value to 0x255)
LD A ($0x8800) // 3A 00 88
Scratchpad RAM |
||||
---|---|---|---|---|
Chip location | Type | Bits | Address Range | |
19 | 2114 | low 4 bits | 0x8000 - 0x83FF | |
22 | 2114 | high 4 bits | 0x8000 - 0x83FF | |
20 | 2114 | low 4 bits | 0x8400 - 0x87FF | |
21 | 2114 | high 4 bits | 0x8400 - 0x87FF |
Sprites/Object RAM |
|||
---|---|---|---|
Chip location | Type | Bits | Address Range |
50 | 2114 | Low 4 bits | 0xB000 - 0xB0FF |
51 | 2114 | High 4 bits | 0xB000 - 0xB0FF |
Tile RAM |
|||
---|---|---|---|
Chip location | Type | Bits | Address Range |
85 | 2114 | ???? | 0xA800 - 0xABFF |
86 | 2114 | ???? | 0xA800 - 0xABFF |